Changeset 3232
- Timestamp:
- 02/18/04 16:50:18 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3231 r3232 45 45 * mraw/MRawFileRead.cc: 46 46 - don't print warning in case of none executions 47 48 * manalysis/MArrivalTimeCalc2.cc: 49 - added some const-qualifiers 47 50 48 51 -
trunk/MagicSoft/Mars/manalysis/MArrivalTimeCalc2.cc
r3213 r3232 77 77 void MArrivalTimeCalc2::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast, Byte_t windowsize) 78 78 { 79 80 79 fNumHiGainSamples = hilast-hifirst+1; 81 80 fNumLoGainSamples = lolast-lofirst+1; … … 84 83 fLoGainFirst = lofirst; 85 84 86 87 85 fWindowSize = windowsize & ~1; 88 86 89 87 if (fWindowSize != windowsize) 90 88 *fLog << warn << "MArrivalTimeCalc2::SetRange - window size has to be even, set to: " << int(fWindowSize) << " samples " << endl; 91 89 92 90 if (fWindowSize<2) 93 91 { … … 95 93 *fLog << warn << "MArrivalTimeCalc2::SetRange - window size set to two samples" << endl; 96 94 } 97 95 98 96 if (fWindowSize > fNumHiGainSamples) 99 97 { … … 101 99 *fLog << warn << "MArrivalTimeCalc2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl; 102 100 } 103 101 104 102 if (fWindowSize > fNumLoGainSamples) 105 103 { … … 109 107 110 108 fWindowSizeSqrt = TMath::Sqrt((Float_t)fWindowSize); 111 112 } 113 114 109 } 115 110 116 111 // -------------------------------------------------------------------------- … … 134 129 } 135 130 136 137 138 139 131 fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam")); 140 132 if (!fPedestals) … … 147 139 if (!fArrivalTime) 148 140 return kFALSE; 149 141 150 142 return kTRUE; 151 143 } … … 157 149 Int_t sum=0; // integral content of the actual window 158 150 Int_t max = 0; // highest integral content of all windows 159 151 160 152 // 161 153 // Calculate the sum of the first fWindowSize slices … … 163 155 sat = 0; 164 156 Byte_t *p = ptr; 165 166 157 167 158 while (p<ptr+fWindowSize) … … 198 189 } 199 190 200 201 191 // now calculate the time for the maximum window 202 203 204 Int_t timesignalsum = 0; 192 Int_t timesignalsum = 0; 205 193 Int_t timesquaredsum =0; 206 Int_t timesum =0; 207 208 194 Int_t timesum =0; 195 209 196 for (p=ptrmax; p < ptrmax + fWindowSize; p++) 210 197 { 211 timesignalsum += *p*(p-ptr); 212 timesum += p-ptr; 213 timesquaredsum += (p-ptr)*(p-ptr); 214 } 215 216 217 float pedsubsum = max - fWindowSize*pedes; 218 219 float pedsubtimesignalsum = timesignalsum - timesum*pedes; 220 221 time = pedsubsum != 0 ? pedsubtimesignalsum / pedsubsum : 1; 222 198 timesignalsum += *p*(p-ptr); 199 timesum += p-ptr; 200 timesquaredsum += (p-ptr)*(p-ptr); 201 } 202 203 const Float_t pedsubsum = max - fWindowSize*pedes; 204 const Float_t pedsubtimesignalsum = timesignalsum - timesum*pedes; 205 206 time = pedsubsum != 0 ? pedsubtimesignalsum / pedsubsum : 1; 223 207 deltatime = pedsubsum != 0 ? pedrms / pedsubsum * sqrt(timesquaredsum - fWindowSize*time) : 1; 224 208 } … … 232 216 { 233 217 MRawEvtPixelIter pixel(fRawEvt); 234 235 218 236 219 Int_t sat=0; … … 251 234 252 235 MArrivalTimePix &pix = (*fArrivalTime)[pixid]; 253 236 254 237 const Float_t pedes = ped.GetPedestal(); 255 238 const Float_t pedrms = ped.GetPedestalRms(); 256 239 257 258 240 FindSignalTime(pixel.GetHiGainSamples()+fHiGainFirst, fNumHiGainSamples, timehi, deltatimehi, sathi, pedes, pedrms); 259 241 FindSignalTime(pixel.GetLoGainSamples()+fLoGainFirst, fNumLoGainSamples, timelo, deltatimelo, satlo, pedes, pedrms); 260 261 242 243 if (satlo) 262 244 sat++; 263 264 pix.SetArrivalTime(timehi, deltatimehi, 265 timelo, deltatimelo); 266 245 246 pix.SetArrivalTime(timehi, deltatimehi, timelo, deltatimelo); 267 247 pix.SetGainSaturation(sathi, sathi, satlo); 268 269 270 } /* while (pixel.Next()) */ 248 } 271 249 272 250 fArrivalTime->SetReadyToSave(); … … 278 256 *fLog << warn << "WARNING - Lo Gain saturated in " << sat << " pixels." << endl; 279 257 280 281 258 return kTRUE; 282 259 }
Note:
See TracChangeset
for help on using the changeset viewer.