|
31 | 31 | #include "SimulationDataFormat/IOMCTruthContainerView.h" |
32 | 32 | #include "SimulationDataFormat/MCCompLabel.h" |
33 | 33 | #include "DetectorsBase/GeometryManager.h" |
| 34 | +#include "ITSMFTSimulation/AlpideSimResponse.h" |
| 35 | +#include "CCDB/BasicCCDBManager.h" |
34 | 36 |
|
35 | 37 | #include "DataFormatsITSMFT/ROFRecord.h" |
36 | 38 |
|
@@ -98,6 +100,15 @@ void CheckDigits(std::string digifile = "trkdigits.root", std::string hitfile = |
98 | 100 | SegmentationChip seg; |
99 | 101 | // seg.Print(); |
100 | 102 |
|
| 103 | + // MLOT response plane: y = halfThickness - depthMax. |
| 104 | + float depthMax = (float)o2::trk::constants::apts::thickness; // fallback (no CCDB) |
| 105 | + auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance(); |
| 106 | + ccdbMgr.setURL("http://alice-ccdb.cern.ch"); |
| 107 | + if (auto* alpResp = ccdbMgr.get<o2::itsmft::AlpideSimResponse>("IT3/Calib/APTSResponse")) { |
| 108 | + depthMax = alpResp->getDepthMax(); |
| 109 | + } |
| 110 | + const float yPlaneMLOT = o2::trk::SegmentationChip::SiliconThicknessMLOT / 2.f - depthMax; |
| 111 | + const float yPlaneVD = -o2::trk::SegmentationChip::SiliconThicknessVD; // VD reference plane in local flat y |
101 | 112 | // Hits |
102 | 113 | TFile* hitFile = TFile::Open(hitfile.data()); |
103 | 114 | TTree* hitTree = (TTree*)hitFile->Get("o2sim"); |
@@ -254,23 +265,40 @@ void CheckDigits(std::string digifile = "trkdigits.root", std::string hitfile = |
254 | 265 | auto xyzLocE = gman->getMatrixL2G(chipID) ^ (hit.GetPos()); // inverse conversion from global to local |
255 | 266 | auto xyzLocS = gman->getMatrixL2G(chipID) ^ (hit.GetPosStart()); |
256 | 267 |
|
257 | | - o2::math_utils::Vector3D<float> locH; /// Hit, average between start and end pos |
258 | | - locH.SetCoordinates(0.5f * (xyzLocE.X() + xyzLocS.X()), 0.5f * (xyzLocE.Y() + xyzLocS.Y()), 0.5f * (xyzLocE.Z() + xyzLocS.Z())); |
| 268 | + // Hit local reference: Both VD and MLOT use response-plane interpolation (in flat local frame). |
| 269 | + // For VD, transform curved → flat first, then interpolate. |
| 270 | + o2::math_utils::Vector3D<float> locH; /// Hit reference (at response plane) |
259 | 271 | o2::math_utils::Vector3D<float> locHS; /// Hit, start pos |
260 | 272 | locHS.SetCoordinates(xyzLocS.X(), xyzLocS.Y(), xyzLocS.Z()); |
261 | 273 | o2::math_utils::Vector3D<float> locHE; /// Hit, end pos |
262 | 274 | locHE.SetCoordinates(xyzLocE.X(), xyzLocE.Y(), xyzLocE.Z()); |
263 | 275 | o2::math_utils::Vector3D<float> locHF; |
264 | 276 |
|
| 277 | + if (subDetID == 0) { |
| 278 | + // VD: Interpolate to VD reference plane in flat frame; apply same r to X and Z |
| 279 | + auto flatSta = seg.curvedToFlat(layer, locHS.X(), locHS.Y()); |
| 280 | + auto flatEnd = seg.curvedToFlat(layer, locHE.X(), locHE.Y()); |
| 281 | + float x0 = flatSta.X(), y0 = flatSta.Y(), z0 = locHS.Z(); |
| 282 | + float dltx = flatEnd.X() - x0, dlty = flatEnd.Y() - y0, dltz = locHE.Z() - z0; |
| 283 | + float r = (std::abs(dlty) > 1e-9f) ? (yPlaneVD - y0) / dlty : 0.5f; |
| 284 | + locH.SetCoordinates(x0 + r * dltx, yPlaneVD, z0 + r * dltz); |
| 285 | + } else { |
| 286 | + // MLOT: Interpolate to response plane |
| 287 | + float x0 = locHS.X(), y0 = locHS.Y(), z0 = locHS.Z(); |
| 288 | + float dltx = locHE.X() - x0, dlty = locHE.Y() - y0, dltz = locHE.Z() - z0; |
| 289 | + float r = (std::abs(dlty) > 1e-9f) ? (yPlaneMLOT - y0) / dlty : 0.5f; |
| 290 | + locH.SetCoordinates(x0 + r * dltx, yPlaneMLOT, z0 + r * dltz); |
| 291 | + } |
| 292 | + |
265 | 293 | int row = 0, col = 0; |
266 | 294 | float xlc = 0., zlc = 0.; |
267 | 295 |
|
268 | 296 | if (subDetID == 0) { |
269 | 297 | Float_t x_flat = 0.f, y_flat = 0.f; |
270 | | - o2::math_utils::Vector2D<float> xyFlatH = seg.curvedToFlat(layer, locH.X(), locH.Y()); |
| 298 | + // locH is already in flat frame from interpolation above; convert digit to flat for comparison |
271 | 299 | o2::math_utils::Vector2D<float> xyFlatD = seg.curvedToFlat(layer, locD.X(), locD.Y()); |
272 | 300 | locDF.SetCoordinates(xyFlatD.X(), xyFlatD.Y(), locD.Z()); |
273 | | - locHF.SetCoordinates(xyFlatH.X(), xyFlatH.Y(), locH.Z()); |
| 301 | + locHF.SetCoordinates(locH.X(), locH.Y(), locH.Z()); // locH already in flat frame |
274 | 302 | seg.localToDetector(locHF.X(), locHF.Z(), row, col, subDetID, layer, disk); |
275 | 303 | } |
276 | 304 |
|
|
0 commit comments