@@ -48,11 +48,11 @@ void Digitizer::init()
4848 auto loadSetResponseFunc = [&](const char * name, const char * fileIB, const char * nameIB, const char * fileOB, const char * nameOB) {
4949 LOGP (info, " Loading response function for {}: IB={}:{} ; OB={}:{}" , name, nameIB, fileIB, nameOB, fileOB);
5050 auto fIB = TFile::Open (fileIB, " READ" );
51- if (fIB ->IsZombie () || !fIB ->IsOpen ()) {
51+ if (! fIB || fIB ->IsZombie () || !fIB ->IsOpen ()) {
5252 LOGP (fatal, " Cannot open file {}" , fileIB);
5353 }
54- auto fOB = TFile::Open (fileIB , " READ" );
55- if (fOB ->IsZombie () || !fOB ->IsOpen ()) {
54+ auto fOB = TFile::Open (fileOB , " READ" );
55+ if (! fOB || fOB ->IsZombie () || !fOB ->IsOpen ()) {
5656 LOGP (fatal, " Cannot open file {}" , fileOB);
5757 }
5858 mParams .setIBSimResponse (mSimRespIB = fIB ->Get <o2::itsmft::AlpideSimResponse>(nameIB));
@@ -72,11 +72,15 @@ void Digitizer::init()
7272 loadSetResponseFunc (" APTS" , responseFileIB, " response1" , responseFileOB, " response1" );
7373 mSimRespIBShift = mSimRespIB ->getDepthMax () - 10 .e -4f ;
7474 mSimRespOBShift = mSimRespOB ->getDepthMax () - Segmentation::SensorLayerThickness / 2 .f ;
75+ mSimRespIBScaleX = 0.5 * constants::pixelarray::pixels::apts::pitchX / SegmentationMosaix::mPitchRow ;
76+ mSimRespIBScaleZ = 0.5 * constants::pixelarray::pixels::apts::pitchZ / SegmentationMosaix::mPitchCol ;
7577 } else {
7678 LOGP (fatal, " ResponseFunction '{}' not implemented!" , func);
7779 }
7880 }
7981 mParams .print ();
82+ LOGP (info, " IBShift = {} ; OBShift = {}" , mSimRespIBShift , mSimRespOBShift );
83+ LOGP (info, " IB-Scale: X={} ; Z={}" , mSimRespIBScaleX , mSimRespIBScaleZ );
8084 mIRFirstSampledTF = o2::raw::HBFUtils::Instance ().getFirstSampledTFIR ();
8185}
8286
@@ -375,9 +379,17 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
375379 }
376380 bool flipCol = false , flipRow = false ;
377381 // note that response needs coordinates along column row (locX) (locZ) then depth (locY)
378- float rowMax{0 .5f * (innerBarrel ? SegmentationMosaix::mPitchRow : Segmentation::PitchRow)};
379- float colMax{0 .5f * (innerBarrel ? SegmentationMosaix::mPitchCol : Segmentation::PitchCol)};
380- auto rspmat = ((innerBarrel) ? mSimRespIB : mSimRespOB )->getResponse (xyzLocS.X () - cRowPix, xyzLocS.Z () - cColPix, xyzLocS.Y (), flipRow, flipCol, rowMax, colMax);
382+ float rowMax{}, colMax{};
383+ const AlpideRespSimMat* rspmat{nullptr };
384+ if (innerBarrel) {
385+ rowMax = 0.5 * SegmentationMosaix::mPitchRow ;
386+ colMax = 0.5 * SegmentationMosaix::mPitchCol ;
387+ rspmat = mSimRespIB ->getResponse (mSimRespIBScaleX * (xyzLocS.X () - cRowPix), mSimRespIBScaleZ * (xyzLocS.Z () - cColPix), xyzLocS.Y (), flipRow, flipCol, rowMax, colMax);
388+ } else {
389+ rowMax = 0.5 * Segmentation::PitchRow;
390+ colMax = 0.5 * Segmentation::PitchCol;
391+ rspmat = mSimRespOB ->getResponse (xyzLocS.X () - cRowPix, xyzLocS.Z () - cColPix, xyzLocS.Y (), flipRow, flipCol, rowMax, colMax);
392+ }
381393
382394 xyzLocS += step;
383395 if (rspmat == nullptr ) {
0 commit comments