@@ -103,7 +103,6 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID)
103103{
104104 LOG (debug) << " \n Processing hit with detector ID: " << hit.GetDetectorID () << " , track ID: " << hit.GetTrackID () << " , energy loss: " << hit.GetEnergyLoss () << " GeV, time: " << hit.GetTime () * sec2ns << " ns" ;
105105 // Process a single hit and create a digit if it passes all cuts
106-
107106 // Get detector element ID
108107 const int chipID = hit.GetDetectorID ();
109108 if (chipID < 0 || chipID >= mGeometry ->getSize () || mGeometry ->getSize () < 1 ) {
@@ -117,6 +116,26 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID)
117116 LOG (debug) << " Hit rejected because chip " << chipID << " is disabled" ;
118117 return ;
119118 }
119+
120+ // middle position of the hit in the sensor frame
121+ const auto & matrix = mGeometry ->getMatrixL2G (chipID);
122+ auto xyzPositionStart = matrix ^ hit.GetPosStart ();
123+ auto xyzPositionEnd = matrix ^ hit.GetPos ();
124+ const auto xMid = 0 .5f * (xyzPositionStart.X () + xyzPositionEnd.X ());
125+ const auto zMid = 0 .5f * (xyzPositionStart.Z () + xyzPositionEnd.Z ());
126+ // move this to the local pixel coordinates for the efficiency map
127+ int row, col;
128+ float xPixelCenter, zPixelCenter;
129+ if (!sSegmentation ->localToDetector (xMid, zMid, row, col, mGeometry ->getIOTOFLayer (chipID))) {
130+ LOG (debug) << " Hit rejected because position (" << xMid << " , " << zMid << " ) is outside the active area of chip " << chipID;
131+ return ; // hit is outside the active area
132+ }
133+ sSegmentation ->detectorToLocalUnchecked (row, col, xPixelCenter, zPixelCenter, mGeometry ->getIOTOFLayer (chipID));
134+
135+ if (!isEfficient (xMid - xPixelCenter, zMid - zPixelCenter)) {
136+ LOG (debug) << " Hit rejected by efficiency cut" ;
137+ return ;
138+ }
120139
121140 // Convert energy loss to charge (number of electrons)
122141 float energyLoss = hit.GetEnergyLoss (); // in GeV
0 commit comments