@@ -46,7 +46,7 @@ class ChipDigitsContainer
4646 o2::trkft3::PreDigit* findDigit (ULong64_t key);
4747 void addDigit (ULong64_t key, UInt_t roframe, UShort_t row, UShort_t col, int charge, o2::MCCompLabel lbl, float toa = 0 .f);
4848 template <int DetID>
49- void addNoise (UInt_t rofMin, UInt_t rofMax, const o2::trkft3::DigiParams<DetID>* params, int subDetID, int layer);
49+ void addNoise (UInt_t rofMin, UInt_t rofMax, const o2::trkft3::DigiParams<DetID>* params, int subDetID, int layer, float rofLengthNS );
5050
5151 // / Get global ordering key made of readout frame, column and row
5252 static ULong64_t getOrderingKey (UInt_t roframe, UShort_t row, UShort_t col)
@@ -85,7 +85,7 @@ inline void ChipDigitsContainer::addDigit(ULong64_t key, UInt_t roframe, UShort_
8585} // namespace o2::trkft3
8686
8787template <int DetID>
88- void o2::trkft3::ChipDigitsContainer::addNoise (UInt_t rofMin, UInt_t rofMax, const o2::trkft3::DigiParams<DetID>* params, int subDetID, int layer)
88+ void o2::trkft3::ChipDigitsContainer::addNoise (UInt_t rofMin, UInt_t rofMax, const o2::trkft3::DigiParams<DetID>* params, int subDetID, int layer, float rofLengthNS )
8989{
9090 UInt_t row = 0 ;
9191 UInt_t col = 0 ;
@@ -102,7 +102,7 @@ void o2::trkft3::ChipDigitsContainer::addNoise(UInt_t rofMin, UInt_t rofMax, con
102102 maxRows = o2::trk::constants::moduleMLOT::chip::nRows;
103103 maxCols = o2::trk::constants::moduleMLOT::chip::nCols;
104104 }
105- mean = params->getNoisePerPixel () * maxRows * maxCols;
105+ mean = params->getNoisePerPixel () * rofLengthNS * 1e-9 * maxRows * maxCols; // hits per ROF in the chip, calculated from the noise rate in hits/s
106106 nel = static_cast <int >(params->getChargeThreshold () * 1.1 );
107107
108108 LOG (debug) << " Adding noise for chip " << mChipIndex << " with mean " << mean << " and charge " << nel;
@@ -121,7 +121,8 @@ void o2::trkft3::ChipDigitsContainer::addNoise(UInt_t rofMin, UInt_t rofMax, con
121121 }
122122 auto key = getOrderingKey (rof, row, col);
123123 if (!findDigit (key)) {
124- addDigit (key, rof, row, col, nel, o2::MCCompLabel (true ), 0 .f ); // / TODO: find a better ToA for noise
124+ float toa = gRandom ->Uniform (0 .f , rofLengthNS); // noise fires uniformly in the ROF
125+ addDigit (key, rof, row, col, nel, o2::MCCompLabel (true ), toa);
125126 }
126127 }
127128 }
0 commit comments