Changeset 3638
- Timestamp:
- 04/03/04 17:50:04 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3637 r3638 46 46 FitLoGainHists and InitHists can be used from base class. 47 47 48 * mcalib/MCalibrationPix.[h,cc] 49 * mcalib/MCalibrationChargePix.[h,cc] 50 * mcalib/MCalibrationRelTimePix.[h,cc] 51 - put most of the functionality into the base class MCalibrationPix 52 - other two classes derive now from MCalibrationPix 53 54 * mcalib/MCalibrationCam.[h,cc] 55 * mcalib/MCalibrationChargeCam.[h,cc] 56 * mcalib/MCalibrationRelTimeCam.[h,cc] 57 - put most of the functionality into the base class MCalibrationCam 58 - other two classes derive now from MCalibrationCam 59 - calls to MCalibration*Cam[i] now have to cast! 60 61 * mcalib/MCalibrate.cc 62 * mcalib/MCalibrateData.cc 63 * mcalib/MMcCalibrateCalc.cc 64 * manalysis/MMcCalibrationUpdate.cc 65 * mcalib/MCalibrationChargeCalc.cc 66 - cast calls to MCalibration*Cam[i] 67 68 * manalysis/MGeomApply.cc 69 - add initialization MCalibrationRelTimeCam 70 - add intialization of average pixels 48 71 49 72 2004/04/02: Abelardo Moralejo -
trunk/MagicSoft/Mars/macros/calibration.C
r3624 r3638 96 96 MExtractedSignalCam sigcam; 97 97 MArrivalTimeCam timecam; 98 MCalibrationRelTimeCam relcam; 98 99 MCalibrationChargeCam calcam; 99 100 MCalibrationChargePINDiode pindiode; … … 118 119 plist.AddToList(&sigcam); 119 120 plist.AddToList(&timecam); 121 plist.AddToList(&relcam); 120 122 plist.AddToList(&calcam); 121 123 plist.AddToList(&histtime); -
trunk/MagicSoft/Mars/manalysis/MGeomApply.cc
r3624 r3638 72 72 #include "MPedestalCam.h" 73 73 #include "MCalibrationChargeCam.h" 74 #include "MCalibrationRelTimeCam.h" 74 75 #include "MCalibrationQECam.h" 75 76 #include "MPedPhotCam.h" … … 134 135 ped->InitSize(cam->GetNumPixels()); 135 136 136 MCalibrationChargeCam *cal = (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam")); 137 MCalibrationChargeCam *cal = 138 (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam")); 137 139 if (cal) 138 140 { 139 cal->InitSize(cam->GetNumPixels()); 140 cal->InitAverageAreas(cam->GetNumAreas()); 141 cal->InitAverageSectors(cam->GetNumSectors()); 141 cal->InitSize ( cam->GetNumPixels() ); 142 cal->InitAverageAreas ( cam->GetNumAreas() ); 143 cal->InitAverageSectors( cam->GetNumSectors() ); 144 } 145 146 MCalibrationRelTimeCam *cat = 147 (MCalibrationRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam")); 148 if (cat) 149 { 150 cat->InitSize ( cam->GetNumPixels() ); 151 cat->InitAverageAreas ( cam->GetNumAreas() ); 152 cat->InitAverageSectors( cam->GetNumSectors() ); 142 153 } 143 154 144 145 MCalibrationQECam *qe =(MCalibrationQECam*)pList->FindObject(AddSerialNumber("MCalibrationQECam"));155 MCalibrationQECam *qe = 156 (MCalibrationQECam*)pList->FindObject(AddSerialNumber("MCalibrationQECam")); 146 157 if (qe) 147 158 qe->InitSize(cam->GetNumPixels()); … … 151 162 pedphot->InitSize(cam->GetNumPixels()); 152 163 164 153 165 MExtractedSignalCam *ext = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam")); 154 166 if (ext) 155 167 ext->InitSize(cam->GetNumPixels()); 156 168 169 157 170 MBlindPixels *bnd = (MBlindPixels*)pList->FindObject(AddSerialNumber("MBlindPixels")); 158 171 if (bnd) -
trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
r3425 r3638 239 239 for (int i=0; i<num; i++) 240 240 { 241 MCalibrationChargePix &calpix = ( *fCalCam)[i];241 MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i]; 242 242 243 243 calpix.SetBlindPixelMethodValid(); … … 305 305 MPedPhotPix &pedpix = (*fPedPhotCam)[i]; 306 306 307 MCalibrationChargePix &calpix = ( *fCalCam)[i];307 MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i]; 308 308 Float_t adc2phot = calpix.GetMeanConversionBlindPixelMethod(); 309 309 Float_t hi2lo = calpix.GetConversionHiLo(); -
trunk/MagicSoft/Mars/mcalib/MCalibrate.cc
r3480 r3638 226 226 227 227 228 MCalibrationChargePix &pix = ( *fCalibrations)[pixidx];228 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 229 229 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 230 230 -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r3466 r3638 248 248 if(fCalibrationMode!=kNone) 249 249 { 250 MCalibrationChargePix &pix = ( *fCalibrations)[pixidx];250 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx]; 251 251 MBadPixelsPix &bad = (*fBadPixels)[pixidx]; 252 252 -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h
r3634 r3638 16 16 class MCalibrationCam : public MParContainer, public MCamEvent 17 17 { 18 18 19 protected: 19 20 … … 24 25 TClonesArray *fAverageBadSectors; //-> Array of MBadPixelsPix, one per camera sector 25 26 26 Byte_t fFlags;27 27 Byte_t fFlags; // Byte to hold the flags 28 28 29 public: 29 30 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3626 r3638 378 378 { 379 379 380 MCalibrationChargePix &pix = ( *fCam)[i];380 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 381 381 MCalibrationQEPix &pqe = (*fQECam) [i]; 382 382 MBadPixelsPix &bad = (*fBadPixels)[i]; … … 491 491 // 4) Pixel has a charge sigma bigger than its Pedestal RMS 492 492 // 493 if (cal.GetMean Charge() < fChargeLimit*cal.GetPedRms())494 { 495 *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMean Charge() << " is smaller than "493 if (cal.GetMean() < fChargeLimit*cal.GetPedRms()) 494 { 495 *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMean() << " is smaller than " 496 496 << fChargeLimit << " Pedestal RMS: " << cal.GetPedRms() << " in Pixel " << cal.GetPixId() << endl; 497 497 bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal); … … 499 499 } 500 500 501 if (cal.GetMean ChargeErr() < fChargeErrLimit)502 { 503 *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetMean ChargeErr() << " is smaller than "501 if (cal.GetMeanErr() < fChargeErrLimit) 502 { 503 *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetMeanErr() << " is smaller than " 504 504 << fChargeErrLimit << " in Pixel " << cal.GetPixId() << endl; 505 505 bad.SetUncalibrated( MBadPixelsPix::kChargeErrNotValid ); … … 507 507 } 508 508 509 if (cal.GetMean Charge() < fChargeRelErrLimit*cal.GetMeanChargeErr())510 { 511 *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMean Charge() << " is smaller than "512 << fChargeRelErrLimit << "* its error: " << cal.GetMean ChargeErr() << " in Pixel " << cal.GetPixId() << endl;509 if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr()) 510 { 511 *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMean() << " is smaller than " 512 << fChargeRelErrLimit << "* its error: " << cal.GetMeanErr() << " in Pixel " << cal.GetPixId() << endl; 513 513 bad.SetUncalibrated( MBadPixelsPix::kChargeRelErrNotValid ); 514 514 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun ); 515 515 } 516 516 517 if (cal.GetSigma Charge() < cal.GetPedRms())518 { 519 *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetSigma Charge()517 if (cal.GetSigma() < cal.GetPedRms()) 518 { 519 *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetSigma() 520 520 << " smaller than Pedestal RMS: " << cal.GetPedRms() << " in Pixel " << cal.GetPixId() << endl; 521 521 bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ); … … 601 601 { 602 602 603 MCalibrationChargePix &pix = ( *fCam)[pixid];603 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[pixid]; 604 604 // 605 605 // Check if the pixel has been excluded from the fits … … 642 642 { 643 643 644 FinalizeAvPedestals(fCam->GetAverageArea(aidx), avinnerped, avinnerprms,avinnernum); 645 FinalizeCharges(fCam->GetAverageArea(aidx),fCam->GetAverageBadArea(aidx)); 644 FinalizeAvPedestals((MCalibrationChargePix&)fCam->GetAverageArea(aidx), 645 avinnerped, avinnerprms,avinnernum); 646 FinalizeCharges((MCalibrationChargePix&)fCam->GetAverageArea(aidx), 647 fCam->GetAverageBadArea(aidx)); 646 648 } 647 649 … … 649 651 { 650 652 651 FinalizeAvPedestals(fCam->GetAverageSector(sector), avinnerped, avinnerprms,avinnernum); 652 FinalizeCharges(fCam->GetAverageSector(sector),fCam->GetAverageBadSector(sector)); 653 FinalizeAvPedestals((MCalibrationChargePix&)fCam->GetAverageSector(sector), 654 avinnerped, avinnerprms,avinnernum); 655 FinalizeCharges((MCalibrationChargePix&)fCam->GetAverageSector(sector), 656 fCam->GetAverageBadSector(sector)); 653 657 } 654 658 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3624 r3638 107 107 ///////////////////////////////////////////////////////////////////////////// 108 108 #include "MCalibrationChargeCam.h" 109 #include "MCalibrationCam.h" 109 110 110 111 #include <TH2.h> … … 152 153 fPixels = new TClonesArray("MCalibrationChargePix",1); 153 154 fAverageAreas = new TClonesArray("MCalibrationChargePix",1); 154 fAverageBadAreas = new TClonesArray("MBadPixelsPix",1); 155 fAverageSectors = new TClonesArray("MCalibrationChargePix",1); 156 fAverageBadSectors = new TClonesArray("MBadPixelsPix",1); 157 158 Clear(); 159 155 fAverageSectors = new TClonesArray("MCalibrationChargePix",1); 156 157 fMeanFluxPhesInnerPixel = 0.; 158 fMeanFluxPhesInnerPixelVar = 0.; 159 fMeanFluxPhesOuterPixel = 0.; 160 fMeanFluxPhesOuterPixelVar = 0.; 161 162 CLRBIT(fFlags,kBlindPixelMethodValid); 163 CLRBIT(fFlags,kFFactorMethodValid); 164 CLRBIT(fFlags,kPINDiodeMethodValid); 165 160 166 SetAverageQE(); 161 167 SetConvFFactorRelErrLimit(); … … 173 179 { 174 180 175 //176 // delete fPixels should delete all Objects stored inside177 //178 delete fPixels;179 delete fAverageAreas;180 delete fAverageBadAreas;181 delete fAverageSectors;182 delete fAverageBadSectors;183 184 181 185 182 if (fOffsets) … … 192 189 } 193 190 194 // -------------------------------------------------------------------195 //196 // This function simply allocates memory via the ROOT command:197 // (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*),198 // fSize * sizeof(TObject*));199 // newSize corresponds to size in our case200 // fSize is the old size (in most cases: 1)201 //202 void MCalibrationChargeCam::InitSize(const UInt_t i)203 {204 fPixels->ExpandCreate(i);205 }206 207 void MCalibrationChargeCam::InitAverageAreas(const UInt_t i)208 {209 fAverageAreas->ExpandCreate(i);210 fAverageBadAreas->ExpandCreate(i);211 }212 213 void MCalibrationChargeCam::InitAverageSectors(const UInt_t i)214 {215 fAverageSectors->ExpandCreate(i);216 fAverageBadSectors->ExpandCreate(i);217 }218 219 220 221 // --------------------------------------------------------------------------222 //223 // This function returns the current size of the TClonesArray224 // independently if the MCalibrationPix is filled with values or not.225 //226 // It is the size of the array fPixels.227 //228 Int_t MCalibrationChargeCam::GetSize() const229 {230 return fPixels->GetEntriesFast();231 }232 233 Int_t MCalibrationChargeCam::GetAverageAreas() const234 {235 return fAverageAreas->GetEntriesFast();236 }237 238 Int_t MCalibrationChargeCam::GetAverageSectors() const239 {240 return fAverageSectors->GetEntriesFast();241 }242 243 244 // --------------------------------------------------------------------------245 //246 // Get i-th pixel (pixel number)247 //248 MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i)249 {250 return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i));251 }252 253 // --------------------------------------------------------------------------254 //255 // Get i-th pixel (pixel number)256 //257 const MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i) const258 {259 return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i));260 }261 262 // --------------------------------------------------------------------------263 //264 // Get i-th average pixel (area number)265 //266 MCalibrationChargePix &MCalibrationChargeCam::GetAverageArea(UInt_t i)267 {268 return *static_cast<MCalibrationChargePix*>(fAverageAreas->UncheckedAt(i));269 }270 271 // --------------------------------------------------------------------------272 //273 // Get i-th average pixel (area number)274 //275 const MCalibrationChargePix &MCalibrationChargeCam::GetAverageArea(UInt_t i) const276 {277 return *static_cast<MCalibrationChargePix*>(fAverageAreas->UncheckedAt(i));278 }279 280 // --------------------------------------------------------------------------281 //282 // Get i-th average pixel (sector number)283 //284 MCalibrationChargePix &MCalibrationChargeCam::GetAverageSector(UInt_t i)285 {286 return *static_cast<MCalibrationChargePix*>(fAverageSectors->UncheckedAt(i));287 }288 289 // --------------------------------------------------------------------------290 //291 // Get i-th average pixel (sector number)292 //293 const MCalibrationChargePix &MCalibrationChargeCam::GetAverageSector(UInt_t i) const294 {295 return *static_cast<MCalibrationChargePix*>(fAverageSectors->UncheckedAt(i));296 }297 298 // --------------------------------------------------------------------------299 //300 // Get i-th average pixel (area number)301 //302 MBadPixelsPix &MCalibrationChargeCam::GetAverageBadArea(UInt_t i)303 {304 return *static_cast<MBadPixelsPix*>(fAverageBadAreas->UncheckedAt(i));305 }306 307 // --------------------------------------------------------------------------308 //309 // Get i-th average pixel (area number)310 //311 const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadArea(UInt_t i) const312 {313 return *static_cast<MBadPixelsPix*>(fAverageBadAreas->UncheckedAt(i));314 }315 316 // --------------------------------------------------------------------------317 //318 // Get i-th average pixel (sector number)319 //320 MBadPixelsPix &MCalibrationChargeCam::GetAverageBadSector(UInt_t i)321 {322 return *static_cast<MBadPixelsPix*>(fAverageBadSectors->UncheckedAt(i));323 }324 325 // --------------------------------------------------------------------------326 //327 // Get i-th average pixel (sector number)328 //329 const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadSector(UInt_t i) const330 {331 return *static_cast<MBadPixelsPix*>(fAverageBadSectors->UncheckedAt(i));332 }333 334 191 335 192 // -------------------------------------- … … 338 195 { 339 196 340 fPixels->ForEach(TObject, Clear)();341 342 //343 // another ForEach does not compile, thus have to do the loop ourselves:344 //345 for (Int_t i=0;i<GetAverageAreas();i++)346 {347 fAverageAreas[i].Clear();348 fAverageBadAreas[i].Clear();349 }350 351 //352 // another ForEach does not compile, thus have to do the loop ourselves:353 //354 for (Int_t i=0;i<GetAverageSectors();i++)355 {356 fAverageSectors[i].Clear();357 fAverageBadSectors[i].Clear();358 }359 360 197 fMeanFluxPhesInnerPixel = 0.; 361 198 fMeanFluxPhesInnerPixelVar = 0.; … … 366 203 CLRBIT(fFlags,kFFactorMethodValid); 367 204 CLRBIT(fFlags,kPINDiodeMethodValid); 205 206 MCalibrationCam::Clear(); 368 207 369 208 return; … … 448 287 *fLog << all << "Pix " << pix->GetPixId() 449 288 << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 450 << " Mean signal: " << pix->GetMean Charge() << " +- " << pix->GetSigmaCharge()451 << " Reduced Sigma: " << pix->GetRSigma Charge()289 << " Mean signal: " << pix->GetMean() << " +- " << pix->GetSigma() 290 << " Reduced Sigma: " << pix->GetRSigma() 452 291 << " Nr Phe's: " << pix->GetPheFFactorMethod() 453 292 << " Saturated? :" << pix->IsHiGainSaturation() … … 484 323 *fLog << all << "Average Area:" 485 324 << " Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 486 << " Mean signal: " << pix->GetMean Charge() << " +- " << pix->GetMeanChargeErr()487 << " Sigma signal: " << pix->GetSigma Charge() << " +- "<< pix->GetSigmaChargeErr()488 << " Reduced Sigma: " << pix->GetRSigma Charge()325 << " Mean signal: " << pix->GetMean() << " +- " << pix->GetMeanErr() 326 << " Sigma signal: " << pix->GetSigma() << " +- "<< pix->GetSigmaErr() 327 << " Reduced Sigma: " << pix->GetRSigma() 489 328 << " Nr Phe's: " << pix->GetPheFFactorMethod() 490 329 << endl; … … 496 335 *fLog << all << "Average Sector:" 497 336 << " Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 498 << " Mean signal: " << pix->GetMean Charge() << " +- " << pix->GetMeanChargeErr()499 << " Sigma signal: " << pix->GetSigma Charge() << " +- "<< pix->GetSigmaChargeErr()500 << " Reduced Sigma: " << pix->GetRSigma Charge()337 << " Mean signal: " << pix->GetMean() << " +- " << pix->GetMeanErr() 338 << " Sigma signal: " << pix->GetSigma() << " +- "<< pix->GetSigmaErr() 339 << " Reduced Sigma: " << pix->GetRSigma() 501 340 << " Nr Phe's: " << pix->GetPheFFactorMethod() 502 341 << endl; … … 594 433 return kFALSE; 595 434 435 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[idx]; 436 596 437 switch (type) 597 438 { 598 439 case 0: 599 if ( (*this)[idx].IsExcluded())600 return kFALSE; 601 val = (*this)[idx].GetMeanCharge();440 if (pix.IsExcluded()) 441 return kFALSE; 442 val = pix.GetMean(); 602 443 break; 603 444 case 1: 604 if ( (*this)[idx].IsExcluded())605 return kFALSE; 606 val = (*this)[idx].GetMeanChargeErr();445 if (pix.IsExcluded()) 446 return kFALSE; 447 val = pix.GetMeanErr(); 607 448 break; 608 449 case 2: 609 if ( (*this)[idx].IsExcluded())610 return kFALSE; 611 val = (*this)[idx].GetSigmaCharge();450 if (pix.IsExcluded()) 451 return kFALSE; 452 val = pix.GetSigma(); 612 453 break; 613 454 case 3: 614 if ( (*this)[idx].IsExcluded())615 return kFALSE; 616 val = (*this)[idx].GetSigmaChargeErr();455 if (pix.IsExcluded()) 456 return kFALSE; 457 val = pix.GetSigmaErr(); 617 458 break; 618 459 case 4: 619 if ( (*this)[idx].IsExcluded())620 return kFALSE; 621 val = (*this)[idx].GetChargeProb();460 if (pix.IsExcluded()) 461 return kFALSE; 462 val = pix.GetProb(); 622 463 break; 623 464 case 5: 624 if ( (*this)[idx].IsExcluded())625 return kFALSE; 626 if ( (*this)[idx].GetRSigmaCharge() == -1.)465 if (pix.IsExcluded()) 466 return kFALSE; 467 if (pix.GetRSigma() == -1.) 627 468 return kFALSE; 628 val = (*this)[idx].GetRSigmaCharge();469 val = pix.GetRSigma(); 629 470 break; 630 471 case 6: 631 if ( (*this)[idx].IsExcluded())472 if (pix.IsExcluded()) 632 473 return kFALSE; 633 if ( (*this)[idx].GetRSigmaCharge() == -1.)474 if (pix.GetRSigma() == -1.) 634 475 return kFALSE; 635 val = (*this)[idx].GetRSigmaChargeErr();476 val = pix.GetRSigmaErr(); 636 477 break; 637 478 case 7: 638 if ( (*this)[idx].IsExcluded())639 return kFALSE; 640 if ( (*this)[idx].GetRSigmaCharge() == -1.)641 return kFALSE; 642 if ( (*this)[idx].GetMeanCharge() == 0.)643 return kFALSE; 644 val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge();479 if (pix.IsExcluded()) 480 return kFALSE; 481 if (pix.GetRSigma() == -1.) 482 return kFALSE; 483 if (pix.GetMean() == 0.) 484 return kFALSE; 485 val = pix.GetRSigma() / pix.GetMean(); 645 486 break; 646 487 case 8: 647 if ( (*this)[idx].IsExcluded())648 return kFALSE; 649 if ( (*this)[idx].GetRSigmaCharge() <= 0.)488 if (pix.IsExcluded()) 489 return kFALSE; 490 if (pix.GetRSigma() <= 0.) 650 491 return kFALSE; 651 if ( (*this)[idx].GetMeanCharge() <= 0.)652 return kFALSE; 653 if ( (*this)[idx].GetRSigmaChargeErr() <= 0.)492 if (pix.GetMean() <= 0.) 493 return kFALSE; 494 if (pix.GetRSigmaErr() <= 0.) 654 495 return kFALSE; 655 if ( (*this)[idx].GetMeanChargeErr() <= 0.)656 return kFALSE; 657 // relative error Rsigma Chargesquare658 val = (*this)[idx].GetRSigmaChargeErr()* (*this)[idx].GetRSigmaChargeErr()659 / ( (*this)[idx].GetRSigmaCharge() * (*this)[idx].GetRSigmaCharge() );660 // relative error Chargesquare661 val += (*this)[idx].GetMeanChargeErr() * (*this)[idx].GetMeanChargeErr()662 / ( (*this)[idx].GetMeanCharge() * (*this)[idx].GetMeanCharge() );496 if (pix.GetMeanErr() <= 0.) 497 return kFALSE; 498 // relative error Rsigma square 499 val = pix.GetRSigmaErr()* pix.GetRSigmaErr() 500 / (pix.GetRSigma() * pix.GetRSigma() ); 501 // relative error square 502 val += pix.GetMeanErr() * pix.GetMeanErr() 503 / (pix.GetMean() * pix.GetMean() ); 663 504 // calculate relative error out of squares 664 505 val = TMath::Sqrt(val) ; 665 506 // multiply with value to get absolute error 666 val *= (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge();507 val *= pix.GetRSigma() / pix.GetMean(); 667 508 break; 668 509 case 9: 669 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())670 return kFALSE; 671 val = (*this)[idx].GetPheFFactorMethod();510 if (pix.IsExcluded() || !pix.IsFFactorMethodValid()) 511 return kFALSE; 512 val = pix.GetPheFFactorMethod(); 672 513 break; 673 514 case 10: 674 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())675 return kFALSE; 676 val = (*this)[idx].GetPheFFactorMethodErr();515 if (pix.IsExcluded() || !pix.IsFFactorMethodValid()) 516 return kFALSE; 517 val = pix.GetPheFFactorMethodErr(); 677 518 break; 678 519 case 11: 679 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())680 return kFALSE; 681 val = (*this)[idx].GetMeanConversionFFactorMethod();520 if (pix.IsExcluded() || !pix.IsFFactorMethodValid()) 521 return kFALSE; 522 val = pix.GetMeanConversionFFactorMethod(); 682 523 break; 683 524 case 12: 684 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())685 return kFALSE; 686 val = (*this)[idx].GetConversionFFactorMethodErr();525 if (pix.IsExcluded() || !pix.IsFFactorMethodValid()) 526 return kFALSE; 527 val = pix.GetConversionFFactorMethodErr(); 687 528 break; 688 529 case 13: 689 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())690 return kFALSE; 691 val = (*this)[idx].GetTotalFFactorFFactorMethod();530 if (pix.IsExcluded() || !pix.IsFFactorMethodValid()) 531 return kFALSE; 532 val = pix.GetTotalFFactorFFactorMethod(); 692 533 break; 693 534 case 14: 694 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())695 return kFALSE; 696 val = (*this)[idx].GetTotalFFactorFFactorMethodErr();535 if (pix.IsExcluded() || !pix.IsFFactorMethodValid()) 536 return kFALSE; 537 val = pix.GetTotalFFactorFFactorMethodErr(); 697 538 break; 698 539 case 15: 699 if ( (*this)[idx].IsExcluded())700 return kFALSE; 701 if ( (*this)[idx].IsFFactorMethodValid())540 if (pix.IsExcluded()) 541 return kFALSE; 542 if (pix.IsFFactorMethodValid()) 702 543 val = 1; 703 544 else … … 705 546 break; 706 547 case 16: 707 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())708 return kFALSE; 709 val = (*this)[idx].GetMeanConversionBlindPixelMethod();548 if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid()) 549 return kFALSE; 550 val = pix.GetMeanConversionBlindPixelMethod(); 710 551 break; 711 552 case 17: 712 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())713 return kFALSE; 714 val = (*this)[idx].GetConversionBlindPixelMethodErr();553 if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid()) 554 return kFALSE; 555 val = pix.GetConversionBlindPixelMethodErr(); 715 556 break; 716 557 case 18: 717 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())718 return kFALSE; 719 val = (*this)[idx].GetTotalFFactorBlindPixelMethod();558 if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid()) 559 return kFALSE; 560 val = pix.GetTotalFFactorBlindPixelMethod(); 720 561 break; 721 562 case 19: 722 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())723 return kFALSE; 724 val = (*this)[idx].GetTotalFFactorBlindPixelMethodErr();563 if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid()) 564 return kFALSE; 565 val = pix.GetTotalFFactorBlindPixelMethodErr(); 725 566 break; 726 567 case 20: 727 if ( (*this)[idx].IsExcluded())728 return kFALSE; 729 if ( (*this)[idx].IsBlindPixelMethodValid())568 if (pix.IsExcluded()) 569 return kFALSE; 570 if (pix.IsBlindPixelMethodValid()) 730 571 val = 1; 731 572 else … … 733 574 break; 734 575 case 21: 735 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())736 return kFALSE; 737 val = (*this)[idx].GetMeanConversionPINDiodeMethod();576 if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid()) 577 return kFALSE; 578 val = pix.GetMeanConversionPINDiodeMethod(); 738 579 break; 739 580 case 22: 740 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())741 return kFALSE; 742 val = (*this)[idx].GetConversionPINDiodeMethodErr();581 if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid()) 582 return kFALSE; 583 val = pix.GetConversionPINDiodeMethodErr(); 743 584 break; 744 585 case 23: 745 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())746 return kFALSE; 747 val = (*this)[idx].GetTotalFFactorPINDiodeMethod();586 if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid()) 587 return kFALSE; 588 val = pix.GetTotalFFactorPINDiodeMethod(); 748 589 break; 749 590 case 24: 750 if ( (*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())751 return kFALSE; 752 val = (*this)[idx].GetTotalFFactorPINDiodeMethodErr();591 if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid()) 592 return kFALSE; 593 val = pix.GetTotalFFactorPINDiodeMethodErr(); 753 594 break; 754 595 case 25: 755 if ( (*this)[idx].IsExcluded())756 return kFALSE; 757 if ( (*this)[idx].IsPINDiodeMethodValid())596 if (pix.IsExcluded()) 597 return kFALSE; 598 if (pix.IsPINDiodeMethodValid()) 758 599 val = 1; 759 600 else … … 761 602 break; 762 603 case 26: 763 if ( (*this)[idx].IsExcluded())604 if (pix.IsExcluded()) 764 605 val = 1.; 765 606 else … … 767 608 break; 768 609 case 27: 769 if ( (*this)[idx].IsExcluded())770 return kFALSE; 771 val = (*this)[idx].GetHiGainNumPickup();610 if (pix.IsExcluded()) 611 return kFALSE; 612 val = pix.GetHiGainNumPickup(); 772 613 break; 773 614 case 28: 774 if ( (*this)[idx].IsExcluded())775 return kFALSE; 776 val = (*this)[idx].GetLoGainNumPickup();615 if (pix.IsExcluded()) 616 return kFALSE; 617 val = pix.GetLoGainNumPickup(); 777 618 break; 778 619 case 29: 779 if ( (*this)[idx].IsExcluded())780 return kFALSE; 781 val = (*this)[idx].IsHiGainSaturation();620 if (pix.IsExcluded()) 621 return kFALSE; 622 val = pix.IsHiGainSaturation(); 782 623 break; 783 624 case 30: 784 if ( (*this)[idx].IsExcluded())785 return kFALSE; 786 val = (*this)[idx].GetPed();625 if (pix.IsExcluded()) 626 return kFALSE; 627 val = pix.GetPed(); 787 628 break; 788 629 case 31: 789 if ( (*this)[idx].IsExcluded())790 return kFALSE; 791 val = (*this)[idx].GetPedErr();630 if (pix.IsExcluded()) 631 return kFALSE; 632 val = pix.GetPedErr(); 792 633 break; 793 634 case 32: 794 if ( (*this)[idx].IsExcluded())795 return kFALSE; 796 val = (*this)[idx].GetPedRms();635 if (pix.IsExcluded()) 636 return kFALSE; 637 val = pix.GetPedRms(); 797 638 break; 798 639 case 33: 799 if ( (*this)[idx].IsExcluded())800 return kFALSE; 801 val = (*this)[idx].GetPedErr()/2.;640 if (pix.IsExcluded()) 641 return kFALSE; 642 val = pix.GetPedErr()/2.; 802 643 break; 803 644 case 34: 804 if ( (*this)[idx].IsExcluded())805 return kFALSE; 806 val = (*this)[idx].GetAbsTimeMean();645 if (pix.IsExcluded()) 646 return kFALSE; 647 val = pix.GetAbsTimeMean(); 807 648 break; 808 649 case 35: 809 if ( (*this)[idx].IsExcluded())810 return kFALSE; 811 val = (*this)[idx].GetAbsTimeRms();650 if (pix.IsExcluded()) 651 return kFALSE; 652 val = pix.GetAbsTimeRms(); 812 653 break; 813 654 default: … … 825 666 void MCalibrationChargeCam::DrawPixelContent(Int_t idx) const 826 667 { 827 (*this)[idx].DrawClone(); 668 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[idx]; 669 pix.DrawClone(); 828 670 } 829 671 … … 1096 938 1097 939 if (ratio == 1.) 1098 conv = fMeanFluxPhotonsInnerPixel / pix->GetMean Charge();940 conv = fMeanFluxPhotonsInnerPixel / pix->GetMean(); 1099 941 else 1100 conv = fMeanFluxPhotonsOuterPixel / pix->GetMean Charge();942 conv = fMeanFluxPhotonsOuterPixel / pix->GetMean(); 1101 943 1102 944 if (conv <= 0.) … … 1106 948 } 1107 949 1108 const Float_t chargeRelVar = pix->GetMean ChargeErr() * pix->GetMeanChargeErr()1109 / ( pix->GetMean Charge() * pix->GetMeanCharge());1110 const Float_t rsigma ChargeRelVar = pix->GetRSigmaChargeErr() * pix->GetRSigmaChargeErr()1111 / (pix->GetRSigma Charge() * pix->GetRSigmaCharge()) ;950 const Float_t chargeRelVar = pix->GetMeanErr() * pix->GetMeanErr() 951 / ( pix->GetMean() * pix->GetMean()); 952 const Float_t rsigmaRelVar = pix->GetRSigmaErr() * pix->GetRSigmaErr() 953 / (pix->GetRSigma() * pix->GetRSigma()) ; 1112 954 1113 955 const Float_t convrelvar = meanphotRelVar + chargeRelVar; … … 1125 967 // Calculate the Total F-Factor of the camera (in photons) 1126 968 // 1127 const Float_t totalFFactor = (pix->GetRSigma Charge()/pix->GetMeanCharge())969 const Float_t totalFFactor = (pix->GetRSigma()/pix->GetMean()) 1128 970 *TMath::Sqrt(fMeanFluxPhotonsInnerPixel); 1129 971 … … 1131 973 // Calculate the error of the Total F-Factor of the camera ( in photons ) 1132 974 // 1133 const Float_t totalFFactorVar = rsigma ChargeRelVar + chargeRelVar + meanphotRelVar;975 const Float_t totalFFactorVar = rsigmaRelVar + chargeRelVar + meanphotRelVar; 1134 976 1135 977 if (convrelvar > 0. && conv > 0.) … … 1168 1010 } 1169 1011 1170 const Float_t charge = pix->GetMean Charge();1012 const Float_t charge = pix->GetMean(); 1171 1013 const Float_t area = geom[idx].GetA(); 1172 const Float_t chargeerr = pix->GetMean ChargeErr();1014 const Float_t chargeerr = pix->GetMeanErr(); 1173 1015 1174 1016 const Float_t nphot = flux * area; … … 1212 1054 } 1213 1055 1214 const Float_t charge = pix->GetMean Charge();1056 const Float_t charge = pix->GetMean(); 1215 1057 const Float_t area = geom[idx].GetA(); 1216 const Float_t chargeerr = pix->GetMean ChargeErr();1058 const Float_t chargeerr = pix->GetMeanErr(); 1217 1059 1218 1060 const Float_t nphot = flux * area; … … 1244 1086 { 1245 1087 1246 mean = (*this)[ipx].GetMeanConversionBlindPixelMethod(); 1247 err = (*this)[ipx].GetConversionBlindPixelMethodErr(); 1248 sigma = (*this)[ipx].GetSigmaConversionBlindPixelMethod(); 1088 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx]; 1089 1090 mean = pix.GetMeanConversionBlindPixelMethod(); 1091 err = pix.GetConversionBlindPixelMethodErr(); 1092 sigma = pix.GetSigmaConversionBlindPixelMethod(); 1249 1093 1250 1094 return kTRUE; … … 1255 1099 { 1256 1100 1257 Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod(); 1101 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx]; 1102 1103 Float_t conv = pix.GetMeanConversionFFactorMethod(); 1258 1104 1259 1105 if (conv < 0.) … … 1261 1107 1262 1108 mean = conv; 1263 err = (*this)[ipx].GetConversionFFactorMethodErr();1264 sigma = (*this)[ipx].GetSigmaConversionFFactorMethod();1109 err = pix.GetConversionFFactorMethodErr(); 1110 sigma = pix.GetSigmaConversionFFactorMethod(); 1265 1111 1266 1112 return kTRUE; … … 1277 1123 { 1278 1124 1279 mean = (*this)[ipx].GetMeanConversionPINDiodeMethod(); 1280 err = (*this)[ipx].GetConversionPINDiodeMethodErr(); 1281 sigma = (*this)[ipx].GetSigmaConversionPINDiodeMethod(); 1125 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx]; 1126 1127 mean = pix.GetMeanConversionPINDiodeMethod(); 1128 err = pix.GetConversionPINDiodeMethodErr(); 1129 sigma = pix.GetSigmaConversionPINDiodeMethod(); 1282 1130 1283 1131 return kFALSE; -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r3624 r3638 2 2 #define MARS_MCalibrationChargeCam 3 3 4 #ifndef MARS_MParContainer 5 #include "MParContainer.h" 6 #endif 7 #ifndef MARS_MCamEvent 8 #include "MCamEvent.h" 4 #ifndef MARS_MCalibrationCam 5 #include "MCalibrationCam.h" 9 6 #endif 10 7 11 8 class TH1D; 12 9 class TH2D; 13 class TClonesArray;14 10 15 11 class MCalibrationChargeBlindPix; 16 12 class MCalibrationChargePINDiode; 17 13 class MCalibrationChargePix; 18 class M BadPixelsPix;14 class MGeomCam; 19 15 class MBadPixelsCam; 20 class MCalibrationChargeCam : public M ParContainer, public MCamEvent16 class MCalibrationChargeCam : public MCalibrationCam 21 17 { 22 18 private: … … 32 28 Float_t fPheFFactorRelVarLimit; // Acceptance limit for number of phe's w.r.t mean number (in variances) 33 29 34 TClonesArray *fPixels; //-> Array of MCalibrationChargePix, one per pixel35 TClonesArray *fAverageAreas; //-> Array of MCalibrationChargePix, one per pixel area36 TClonesArray *fAverageSectors; //-> Array of MCalibrationChargePix, one per camera sector37 TClonesArray *fAverageBadAreas; //-> Array of MBadPixelsPix, one per pixel area38 TClonesArray *fAverageBadSectors; //-> Array of MBadPixelsPix, one per camera sector39 40 30 TH1D* fOffsets; //! 41 31 TH1D* fSlopes; //! 42 32 43 33 TH2D* fOffvsSlope; //! 44 45 Byte_t fFlags;46 34 47 35 enum { kFFactorMethodValid, kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid }; … … 63 51 64 52 void Clear( Option_t *o="" ); 65 void InitSize( const UInt_t i );66 void InitAverageAreas( const UInt_t i );67 void InitAverageSectors( const UInt_t i );68 53 69 54 // Setters … … 79 64 80 65 // Getters 81 Int_t GetSize() const;82 Int_t GetAverageAreas() const;83 Int_t GetAverageSectors() const;84 85 66 Bool_t GetConversionFactorFFactor( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 86 67 Bool_t GetConversionFactorBlindPixel( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); … … 100 81 Bool_t IsBlindPixelMethodValid() const; 101 82 Bool_t IsPINDiodeMethodValid() const; 102 103 // Others104 MCalibrationChargePix &operator[](UInt_t i);105 const MCalibrationChargePix &operator[](UInt_t i) const;106 107 MCalibrationChargePix &GetAverageArea(UInt_t i);108 const MCalibrationChargePix &GetAverageArea(UInt_t i) const;109 110 MBadPixelsPix &GetAverageBadArea(UInt_t i);111 const MBadPixelsPix &GetAverageBadArea(UInt_t i) const;112 113 MCalibrationChargePix &GetAverageSector(UInt_t i);114 const MCalibrationChargePix &GetAverageSector(UInt_t i) const;115 116 MBadPixelsPix &GetAverageBadSector(UInt_t i);117 const MBadPixelsPix &GetAverageBadSector(UInt_t i) const;118 83 119 84 // Prints -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
r3637 r3638 74 74 Float_t fConversionHiLoVar; // The error of the conversion factor between Hi Gain and Lo Gain 75 75 76 Byte_t fCalibFlags; 76 Byte_t fCalibFlags; // The bit-field for the class-own bits 77 77 78 enum { kBlindPixelMethodValid, kFFactorMethodValid, 79 kPINDiodeMethodValid, kCombinedMethodValid }; 78 enum { kBlindPixelMethodValid, kFFactorMethodValid, 79 kPINDiodeMethodValid, kCombinedMethodValid }; // The possible bits to be set 80 80 81 81 public: -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimePix.cc
r3635 r3638 39 39 // 40 40 MCalibrationRelTimePix::MCalibrationRelTimePix(const char *name, const char *title) 41 : fRelTimeFlags(0) 41 42 { 42 43 … … 55 56 { 56 57 57 SetExcluded ( kFALSE );58 58 SetValid ( kFALSE ); 59 59 … … 82 82 // Set the Excluded Bit from outside 83 83 // 84 void MCalibrationRelTimePix::SetExcluded(Bool_t b )85 {86 b ? SETBIT(fFlags, kExcluded) : CLRBIT(fFlags, kExcluded);87 }88 89 90 // --------------------------------------------------------------------------91 //92 // Set the Excluded Bit from outside93 //94 84 void MCalibrationRelTimePix::SetValid(const Bool_t b ) 95 85 { 96 b ? SETBIT(f Flags, kValid) : CLRBIT(fFlags, kValid);86 b ? SETBIT(fRelTimeFlags, kValid) : CLRBIT(fRelTimeFlags, kValid); 97 87 } 98 88 … … 106 96 107 97 108 Bool_t MCalibrationRelTimePix::IsExcluded() const109 {110 return TESTBIT(fFlags,kExcluded);111 }112 113 98 Bool_t MCalibrationRelTimePix::IsValid() const 114 99 { 115 return TESTBIT(f Flags, kValid);100 return TESTBIT(fRelTimeFlags, kValid); 116 101 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimePix.h
r3635 r3638 14 14 Float_t fSigmaConversion; // The sigma of conversion factor to Phe's (F-factor method) 15 15 16 enum { kExcluded, kValid }; 16 Byte_t fRelTimeFlags; // The bit-field for the class-own bits 17 18 enum { kValid }; // The possible bits to be set 17 19 18 20 public: … … 27 29 28 30 // Setters 29 void SetExcluded ( const Bool_t b = kTRUE );30 31 void SetValid( const Bool_t b = kTRUE ); 31 32 … … 39 40 Float_t GetTimePrecisionErr() const { return GetSigmaErr(); } 40 41 41 Bool_t IsExcluded() const;42 42 Bool_t IsValid() const; 43 43 -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc
r3374 r3638 246 246 for (int i=0; i<num; i++) 247 247 { 248 MCalibrationChargePix &calpix = ( *fCalCam)[i];248 MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i]; 249 249 250 250 const Float_t factor = fADC2Phot*calpix.GetMeanConversionBlindPixelMethod();
Note:
See TracChangeset
for help on using the changeset viewer.