Changeset 17323 for trunk/Mars
- Timestamp:
- 11/17/13 20:30:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/melectronics/MAvalanchePhotoDiode.cc
r17202 r17323 240 240 Float_t n = weight; 241 241 242 /* 243 // Check if a photon in a neighboring cell is produced (crosstalk) 244 while (gRandom->Rndm()<fCrosstalkProb) 245 { 242 // Get random number of emitted and possible converted crosstalk photons 243 const UInt_t rndm = gRandom->Poisson(prob); 244 245 for (int i=0; i<rndm; i++) 246 { 246 247 // Get a random neighbor which is hit. 247 248 switch (gRandom->Integer(4)) 248 {249 case 0: x++; if (x>fHist.GetNbinsX()) continue; break;250 case 1: x--; if (x<1) continue; break;251 case 2: y++; if (y>fHist.GetNbinsY()) continue; break;252 case 3: y--; if (y<1) continue; break;253 }254 255 n += HitCellImp(x, y, t);256 }257 */258 259 260 //for (int i=0; i<1; i++)261 while (1)262 {263 const Double_t rndm = gRandom->Rndm();264 if (rndm>=prob/*fCrosstalkProb*/)265 break;266 267 // We can re-use the random number because it is uniformely268 // distributed. This saves cpu power269 const Int_t dir = TMath::FloorNint(4*rndm/prob/*fCrosstalkProb*/);270 271 // Get a random neighbor which is hit.272 switch (dir)273 249 { 274 250 case 0: if (x<fHist.GetNbinsX()) n += HitCellImp(x+1, y, t); break; … … 277 253 case 3: if (y>1) n += HitCellImp(x, y-1, t); break; 278 254 } 279 280 // In the unlikely case the calculated direction is out-of-range,281 // i.e. <0 or >3, we would just try to fill the same cell again which282 255 } 283 256
Note:
See TracChangeset
for help on using the changeset viewer.