- Timestamp:
- 03/30/10 14:47:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/melectronics/MAvalanchePhotoDiode.cc
r9462 r9565 123 123 // return 0; 124 124 125 // Number of the x/y cell in the one dimensional array 125 126 // const Int_t cell = fHist.GetBin(x, y); 126 127 const Int_t cell = x + (fHist.GetNbinsX()+2)*y; 127 128 128 // This is the fastes way to access the bin-contents in fArray 129 // Getting a reference to the float is the fastes way to 130 // access the bin-contents in fArray 129 131 Float_t &cont = fHist.GetArray()[cell]; 130 132 133 // Calculate the time since the last breakdown 131 134 // const Double_t dt = t-fHist.GetBinContent(x, y)-fDeadTime; // 132 135 const Float_t dt = t-cont-fDeadTime; … … 136 139 return 0; 137 140 138 // Signal height (in units of one photon) produced after dead time 139 const Float_t weight = fRecoveryTime<=0 ? 1 : 1.-exp(-dt/fRecoveryTime); 140 141 // The signal height (in units of one photon) produced after dead time 142 // depends on the recovery of the cell - described by an exponential. 143 const Float_t weight = fRecoveryTime<=0 ? 1. : 1-TMath::Exp(-dt/fRecoveryTime); 144 145 // The probability that the cell emits a photon causing crosstalk 146 // scales as the signal height. 147 const Float_t prob = weight*fCrosstalkProb; 148 149 // Set the contents to the time of the last breakdown (now) 141 150 cont = t; // fHist.SetBinContent(x, y, t) 142 151 … … 161 170 */ 162 171 172 163 173 //for (int i=0; i<1; i++) 164 174 while (1) 165 175 { 166 176 const Double_t rndm = gRandom->Rndm(); 167 if (rndm>= fCrosstalkProb)177 if (rndm>=prob/*fCrosstalkProb*/) 168 178 break; 169 179 170 // We can re-use the random number bec uase it is uniformely180 // We can re-use the random number because it is uniformely 171 181 // distributed. This saves cpu power 172 const Int_t dir = TMath::FloorNint(4*rndm/ fCrosstalkProb);182 const Int_t dir = TMath::FloorNint(4*rndm/prob/*fCrosstalkProb*/); 173 183 174 184 // Get a random neighbor which is hit.
Note:
See TracChangeset
for help on using the changeset viewer.