Changeset 8428 for trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
- Timestamp:
- 04/20/07 14:59:58 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
r8417 r8428 71 71 #include "MGeomPix.h" 72 72 73 #include "MCalibrationIntensityRelTimeCam.h"74 73 #include "MCalibrationRelTimeCam.h" 75 74 #include "MCalibrationRelTimePix.h" … … 122 121 void MCalibrationRelTimeCalc::Clear(const Option_t *o) 123 122 { 124 125 fBadPixels = NULL; 126 fCam = NULL; 127 fIntensCam = NULL; 128 123 fBadPixels = NULL; 124 fCam = NULL; 129 125 } 130 126 … … 133 129 // Search for the following input containers and abort if not existing: 134 130 // - MGeomCam 135 // - MCalibration IntensityRelTimeCam or MCalibrationRelTimeCam131 // - MCalibrationRelTimeCam 136 132 // - MBadPixelsCam 137 133 // … … 161 157 } 162 158 163 fIntensCam = (MCalibrationIntensityRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam")); 164 if (fIntensCam) 165 *fLog << inf << "Found MCalibrationIntensityRelTimeCam ... " << endl; 166 else 167 { 168 fCam = (MCalibrationRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam")); 169 if (!fCam) 170 { 171 *fLog << err << "Cannot find MCalibrationRelTimeCam ... abort." << endl; 172 *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationRelTimeCam before..." << endl; 173 return kFALSE; 174 } 175 } 176 177 UInt_t npixels = fGeom->GetNumPixels(); 178 179 MCalibrationRelTimeCam *relcam = fIntensCam 180 ? (MCalibrationRelTimeCam*)fIntensCam->GetCam() : fCam; 181 159 fCam = (MCalibrationRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam")); 160 if (!fCam) 161 { 162 *fLog << err << "Cannot find MCalibrationRelTimeCam ... abort." << endl; 163 return kFALSE; 164 } 165 166 const UInt_t npixels = fGeom->GetNumPixels(); 182 167 for (UInt_t i=0; i<npixels; i++) 183 { 184 185 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i]; 168 { 169 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i]; 186 170 187 171 if ((*fBadPixels)[i].IsBad()) 188 172 { 189 173 pix.SetExcluded(); 190 174 continue; 191 175 } 192 176 193 177 if (IsDebug()) 194 pix.SetDebug();195 178 pix.SetDebug(); 179 } 196 180 197 181 return kTRUE; … … 242 226 FinalizeUnsuitablePixels(); 243 227 244 if (fIntensCam) 245 fIntensCam->SetReadyToSave(); 246 else 247 fCam ->SetReadyToSave(); 248 228 fCam->SetReadyToSave(); 249 229 fBadPixels->SetReadyToSave(); 250 230 … … 277 257 { 278 258 279 MCalibrationRelTimeCam *relcam = fIntensCam280 ? (MCalibrationRelTimeCam*)fIntensCam->GetCam() : fCam;281 282 259 const UInt_t npixels = fGeom->GetNumPixels(); 283 260 const UInt_t nareas = fGeom->GetNumAreas(); … … 286 263 TArrayF upplim (nareas); 287 264 TArrayF areasum (nareas); 288 // Float_t areasum2 [nareas];289 265 TArrayI numareavalid (nareas); 290 266 TArrayI useunreliable(nareas); … … 306 282 numareavalid[aidx] ++; 307 283 } 308 284 309 285 for (UInt_t aidx=0; aidx<nareas; aidx++) 310 286 if (numareavalid[aidx] < 100) … … 318 294 for (UInt_t i=0; i<npixels; i++) 319 295 { 320 321 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];296 297 const MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i]; 322 298 323 299 if (pix.IsExcluded()) … … 349 325 continue; 350 326 } 351 327 352 328 // Calculate the rms out of sum2: 353 329 /* … … 358 334 lowlim [aidx] = 0; 359 335 upplim [aidx] = areasum [aidx] + fRelTimeResolutionLimit; 360 336 361 337 } 362 338 *fLog << endl; … … 365 341 for (UInt_t i=0; i<npixels; i++) 366 342 { 367 368 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(* relcam)[i];369 343 344 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i]; 345 370 346 if (pix.IsExcluded()) 371 347 continue; 372 348 373 349 MBadPixelsPix &bad = (*fBadPixels)[i]; 374 350 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 375 351 continue; 376 352 377 353 const Float_t res = pix.GetTimePrecision(); 378 354 const Int_t aidx = (*fGeom)[i].GetAidx(); 379 355 380 356 if ( res < lowlim[aidx] || res > upplim[aidx] ) 381 357 { … … 401 377 void MCalibrationRelTimeCalc::FinalizeBadPixels() 402 378 { 403 404 MCalibrationRelTimeCam *relcam = fIntensCam405 ? (MCalibrationRelTimeCam*)fIntensCam->GetCam() : fCam;406 379 407 380 for (Int_t i=0; i<fBadPixels->GetSize(); i++) 408 381 { 409 410 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];411 382 412 383 MBadPixelsPix &bad = (*fBadPixels)[i]; … … 425 396 426 397 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 398 { 399 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i]; 427 400 pix.SetExcluded(); 401 } 428 402 } 429 403 … … 442 416 *fLog << dec; 443 417 444 MCalibrationRelTimeCam *relcam = fIntensCam ? (MCalibrationRelTimeCam*)fIntensCam->GetCam() : fCam;445 446 418 const Int_t nareas = fGeom->GetNumAreas(); 447 419 … … 453 425 unsuit[aidx] += fBadPixels->GetNumUnsuitable(MBadPixelsPix::kUnsuitableRun, fGeom, aidx); 454 426 unrel[aidx] += fBadPixels->GetNumUnsuitable(MBadPixelsPix::kUnreliableRun, fGeom, aidx); 455 relcam->SetNumUnsuitable(unsuit[aidx], aidx);456 relcam->SetNumUnreliable(unrel[aidx], aidx);427 fCam->SetNumUnsuitable(unsuit[aidx], aidx); 428 fCam->SetNumUnreliable(unrel[aidx], aidx); 457 429 } 458 430
Note:
See TracChangeset
for help on using the changeset viewer.