@@ -404,8 +404,12 @@ void createDigitsFromSim(const char* inpFileSim = "o2sim_HitsTPC.root", const st
404404 gRandom -> Gaus (0 , std ::abs (posEle .X () - posEleDiff .X ())) + posEle .X (),
405405 gRandom -> Gaus (0 , std ::abs (posEle .Y () - posEleDiff .Y ())) + posEle .Y (),
406406 gRandom -> Gaus (0 , std ::abs (posEle .Z () - posEleDiff .Z ())) + posEle .Z ()));
407- // auto posEleTmp = posTotElectrons[j];
408- const float driftTime = (detParam .TPClength - posTotElectrons .at (isec ).Z ()) / gasParam .DriftV ;
407+ }
408+
409+ // loop over all electrons
410+ for (unsigned int j = 0 ; j < posTotElectrons .size (); ++ j ) {
411+ auto posEleTmp = posTotElectrons [j ];
412+ const float driftTime = (detParam .TPClength - posEleTmp .Z ()) / gasParam .DriftV ;
409413
410414 if ((driftTime + hitTime ) > maxEleTime ) {
411415 LOG (warning ) << "Skipping electron with driftTime " << driftTime << " from hit at time " << hitTime ;
@@ -418,13 +422,13 @@ void createDigitsFromSim(const char* inpFileSim = "o2sim_HitsTPC.root", const st
418422 }
419423
420424 // Remove electrons that end up outside the active volume
421- if (std ::abs (posTotElectrons . at ( isec ) .Z ()) > detParam .TPClength ) {
425+ if (std ::abs (posEleTmp .Z ()) > detParam .TPClength ) {
422426 continue ;
423427 }
424428
425429 // When the electron is not in the mSector we're processing, abandon
426430 // create dummy pos at A-Side
427- auto posEleTmpTmp = posTotElectrons . at ( isec ) ;
431+ auto posEleTmpTmp = posEleTmp ;
428432 posEleTmpTmp .SetZ (1 );
429433 if (mapper .isOutOfSector (posEleTmpTmp , mSector )) {
430434 continue ;
@@ -451,10 +455,10 @@ void createDigitsFromSim(const char* inpFileSim = "o2sim_HitsTPC.root", const st
451455 for (int i = 0 ; i < nShapedPoints ; ++ i ) {
452456 digitContainer .addDigit (label , cru , driftTime / eleParam .ZbinWidth + i , globalPad , signalArray [i ]);
453457 }
454- } // secondary loop
455- } // electron loop
456- } // hit loop
457- } // track loop
458+ }
459+ } // electron loop
460+ } // hit loop
461+ } // track loop
458462
459463 // dump digits for each event to a file
460464 dumpDigits (digitContainer , 0.l , digits , labels , commonMode , brdigits , brlabel , brmCommon );
0 commit comments