Changeset 4908 for trunk/MagicSoft
- Timestamp:
- 09/09/04 17:56:49 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4907 r4908 72 72 * mcalib/MHCalibrationTestTimeCam.cc 73 73 - able to recognize an *Intensity*Cam if in MParList 74 75 * mcalib/MCalibrationChargeCalc.[h,cc] 76 * mcalib/MCalibrationRelTimeCalc.[h,cc] 77 - able to recognize an *Intensity*Cam if in MParList 78 - set pulser pattern accordingly in Process from MRawEvtHeader 74 79 75 80 * msignal/MExtractor.cc -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r4882 r4908 194 194 #include "MParList.h" 195 195 196 #include "MRawRunHeader.h" 197 #include "MRawEvtPixelIter.h" 196 #include "MRawEvtHeader.h" 198 197 199 198 #include "MGeomCam.h" … … 203 202 #include "MPedestalCam.h" 204 203 #include "MPedestalPix.h" 204 205 #include "MCalibrationIntensityChargeCam.h" 205 206 206 207 #include "MCalibrationChargeCam.h" … … 260 261 // 261 262 MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title) 262 : fQECam(NULL), fGeom(NULL) 263 : fQECam(NULL), fGeom(NULL), fSignal(NULL), fHeader(NULL) 263 264 { 264 265 … … 307 308 fBadPixels = NULL; 308 309 fCam = NULL; 310 fIntensCam = NULL; 309 311 fBlindPixel = NULL; 310 312 fBlindCam = NULL; … … 312 314 fPedestals = NULL; 313 315 316 fPulserPattern = 0; 314 317 SetPulserColor ( MCalibrationCam::kNONE ); 315 318 … … 333 336 { 334 337 338 fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader"); 339 if (!fHeader) 340 { 341 *fLog << err << "MRawEvtHeader not found... abort." << endl; 342 return kFALSE; 343 } 344 335 345 // 336 346 // Containers that have to be there. … … 343 353 } 344 354 355 fSignal = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam"); 356 if (!fSignal) 357 { 358 *fLog << err << "MExtractedSignalCam not found... aborting" << endl; 359 return kFALSE; 360 } 361 345 362 // 346 363 // Containers that are created in case that they are not there. … … 360 377 } 361 378 362 363 // 364 // Check the pulser colour --> FIXME: this solution is only valid until the arrival of the DM's 365 // 366 if (fPulserColor == MCalibrationCam::kNONE) 367 { 368 *fLog << endl; 369 *fLog << err << GetDescriptor() 370 << ": No Pulser colour has been chosen. Since the installation of the IFAE pulser box," 371 << " you HAVE to provide the LEDs colour, otherwise there is no calibration. " << endl; 372 *fLog << "See e.g. the macro calibration.C " << endl; 379 fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader"); 380 if (!fHeader) 381 { 382 *fLog << err << "MRawEvtHeader not found... abort." << endl; 373 383 return kFALSE; 374 384 } 375 385 386 376 387 return kTRUE; 377 388 } … … 395 406 // It defines the PixId of every pixel in: 396 407 // 408 // - MCalibrationIntensityChargeCam 397 409 // - MCalibrationChargeCam 398 410 // - MCalibrationQECam … … 419 431 } 420 432 421 fCam = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam"); 422 if (!fCam) 423 { 424 *fLog << err << "Cannot find MCalibrationChargeCam... aborting" << endl; 425 *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl; 426 return kFALSE; 427 } 428 433 fIntensCam = (MCalibrationIntensityChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityChargeCam")); 434 if (fIntensCam) 435 *fLog << inf << "Found MCalibrationIntensityChargeCam ... " << endl; 436 else 437 { 438 fCam = (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam")); 439 if (!fCam) 440 { 441 *fLog << err << "Cannot find MCalibrationChargeCam ... abort." << endl; 442 *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl; 443 return kFALSE; 444 } 445 } 446 429 447 // 430 448 // Optional Containers … … 451 469 } 452 470 453 454 // 455 // Initialize the pulser colours 456 // 457 if (fCam->GetPulserColor() == MCalibrationCam::kNONE) 458 { 459 fCam->SetPulserColor( fPulserColor ); 460 461 if (fBlindPixel) 462 fBlindPixel->SetColor( fPulserColor ); 463 464 if (fBlindCam) 465 fBlindCam->SetColor( fPulserColor ); 466 467 if (fPINDiode) 468 fPINDiode->SetColor( fPulserColor ); 469 } 470 471 if (fPulserColor != fCam->GetPulserColor()) 472 { 473 *fLog << err << GetDescriptor() 474 << ": Pulser colour has changed w.r.t. last file in MCalibrationChargeCam" << endl; 475 *fLog << err << "This feature is not yet implemented, sorry ... aborting " << endl; 476 return kFALSE; 477 } 478 479 if (fBlindPixel) 480 if (fPulserColor != fBlindPixel->GetColor()) 481 { 482 *fLog << err << GetDescriptor() 483 << ": Pulser colour has changed w.r.t. last file in MCalibrationChargeBlindPix." << endl; 484 *fLog << err << "This feature is not yet implemented, sorry ... aborting " << endl; 485 return kFALSE; 486 } 487 488 if (fBlindCam) 489 if (fPulserColor != fBlindCam->GetColor()) 490 { 491 *fLog << err << GetDescriptor() 492 << ": Pulser colour has changed w.r.t. last file in MCalibrationChargeBlindCam." << endl; 493 *fLog << err << "This feature is not yet implemented, sorry ... aborting " << endl; 494 return kFALSE; 495 } 496 497 if (fPINDiode) 498 if (fPulserColor != fPINDiode->GetColor()) 499 { 500 *fLog << err << GetDescriptor() 501 << ": Pulser colour has changed w.r.t. last file in MCalibrationChargePINDiode." << endl; 502 *fLog << err << "This feature is not yet implemented, sorry ... aborting " << endl; 503 return kFALSE; 504 } 505 506 507 fNumHiGainSamples = fCam->GetNumHiGainFADCSlices(); 508 fNumLoGainSamples = fCam->GetNumLoGainFADCSlices(); 471 fNumHiGainSamples = fSignal->GetNumUsedHiGainFADCSlices(); 472 fNumLoGainSamples = fSignal->GetNumUsedLoGainFADCSlices(); 509 473 510 474 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples); … … 516 480 { 517 481 518 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam) [i]; 482 MCalibrationChargePix &pix = fIntensCam 483 ? (MCalibrationChargePix&)(*fIntensCam)[i] 484 : (MCalibrationChargePix&)(*fCam) [i]; 519 485 MCalibrationQEPix &pqe = (MCalibrationQEPix&) (*fQECam)[i]; 520 486 MBadPixelsPix &bad = (*fBadPixels)[i]; … … 539 505 // ---------------------------------------------------------------------------------- 540 506 // 541 // Nothing to be done in Process, but have a look at MHCalibrationChargeCam, instead507 // Set the correct colour to the charge containers 542 508 // 543 509 Int_t MCalibrationChargeCalc::Process() 544 510 { 511 512 const UInt_t pattern = fHeader->GetCalibrationPattern(); 513 514 if (pattern == fPulserPattern) 515 return kTRUE; 516 517 enum ColorCode_t 518 { 519 kSlot1Green = BIT(0), 520 kSlot2Green = BIT(1), 521 kSlot3Blue = BIT(2), 522 kSlot4UV = BIT(3), 523 kSlot5UV = BIT(4), 524 kSlot6Blue = BIT(5), 525 kSlot7Blue = BIT(6), 526 kSlot8Blue = BIT(7), 527 kSlot9AttBlue = BIT(8), 528 kSlot10Blue = BIT(9), 529 kSlot11Blue = BIT(10), 530 kSlot12UV = BIT(11), 531 kSlot13UV = BIT(12), 532 kSlot14Blue = BIT(13), 533 kSlot15Green = BIT(14), 534 kSlot16AttGreen = BIT(15), 535 kCT1Pulser = BIT(16), 536 kAnyGreen = kSlot1Green | kSlot2Green | kSlot15Green | kSlot16AttGreen, 537 kAnyUV = kSlot4UV | kSlot5UV | kSlot12UV | kSlot13UV, 538 kAnyBlue = kSlot3Blue | kSlot6Blue | kSlot7Blue | kSlot8Blue 539 | kSlot9AttBlue| kSlot10Blue | kSlot11Blue | kSlot14Blue 540 }; 541 542 // 543 // The pattern has changed, we have to initialize everything new!!! 544 // 545 *fLog << inf << " New pulser pattern: " ; 546 for (Int_t i=16; i>= 0; i--) 547 *fLog << (pattern >> i & 1); 548 *fLog << endl; 549 fPulserPattern = pattern; 550 551 // 552 // Now retrieve the colour and check if not various colours have been used 553 // 554 fPulserColor = MCalibrationCam::kNONE; 555 556 if (fPulserPattern & kAnyGreen ) 557 fPulserColor = MCalibrationCam::kGREEN; 558 559 if (fPulserPattern & kAnyBlue ) 560 if (fPulserColor != MCalibrationCam::kNONE) 561 { 562 *fLog << err << GetDescriptor() 563 << "Multiple colours used simultaneously in calibration file. Will skip this part!" << endl; 564 return kCONTINUE; 565 } 566 else 567 fPulserColor = MCalibrationCam::kBLUE; 568 569 if (fPulserPattern & kAnyUV ) 570 if (fPulserColor != MCalibrationCam::kNONE) 571 { 572 *fLog << err << GetDescriptor() 573 << "Multiple colours used simultaneously in calibration file. Will skip this part!" << endl; 574 return kCONTINUE; 575 } 576 else 577 fPulserColor = MCalibrationCam::kUV; 578 579 if (fPulserPattern & kCT1Pulser ) 580 if (fPulserColor != MCalibrationCam::kNONE) 581 { 582 *fLog << err << GetDescriptor() 583 << "Multiple colours used simultaneously in calibration file. Will skip this part!" << endl; 584 return kCONTINUE; 585 } 586 else 587 fPulserColor = MCalibrationCam::kCT1; 588 589 *fLog << inf << GetDescriptor() << ": Found new colour ... " << endl; 590 591 switch (fPulserColor) 592 { 593 case MCalibrationCam::kGREEN: *fLog << "Green."; break; 594 case MCalibrationCam::kBLUE: *fLog << "Blue."; break; 595 case MCalibrationCam::kUV: *fLog << "UV."; break; 596 case MCalibrationCam::kCT1: *fLog << "CT1."; break; 597 } 598 *fLog << endl; 599 600 // 601 // Initialize the pulser colours 602 // 603 if (fIntensCam) 604 fIntensCam->SetPulserColor( fPulserColor ); 605 else 606 fCam->SetPulserColor( fPulserColor ); 607 608 if (fBlindPixel) 609 fBlindPixel->SetColor( fPulserColor ); 610 611 if (fBlindCam) 612 fBlindCam->SetColor( fPulserColor ); 613 614 if (fPINDiode) 615 fPINDiode->SetColor( fPulserColor ); 616 545 617 return kTRUE; 546 618 } … … 570 642 // Call FinalizeUnsuitablePixels() 571 643 // 572 // Call MParContainer::SetReadyToSave() for f Cam, fQECam, fBadPixels and644 // Call MParContainer::SetReadyToSave() for fIntensCam, fCam, fQECam, fBadPixels and 573 645 // fBlindPixel and fPINDiode if they exist 574 646 // … … 608 680 { 609 681 610 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[pixid]; 682 MCalibrationChargePix &pix = fIntensCam 683 ? (MCalibrationChargePix&)(*fIntensCam)[pixid] 684 : (MCalibrationChargePix&)(*fCam)[pixid]; 611 685 // 612 686 // Check if the pixel has been excluded from the fits … … 643 717 644 718 const MPedestalPix &ped = fPedestals->GetAverageArea(aidx); 645 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 719 MCalibrationChargePix &pix = fIntensCam 720 ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx) 721 : (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 646 722 647 723 FinalizePedestals(ped,pix,aidx); 648 FinalizeCharges(pix, fCam->GetAverageBadArea(aidx),"area id"); 724 FinalizeCharges(pix, 725 fIntensCam ? fIntensCam->GetAverageBadArea(aidx) : fCam->GetAverageBadArea(aidx), 726 "area id"); 649 727 } 650 728 … … 656 734 const MPedestalPix &ped = fPedestals->GetAverageSector(sector); 657 735 658 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(sector); 736 MCalibrationChargePix &pix = fIntensCam 737 ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(sector) 738 : (MCalibrationChargePix&)fCam->GetAverageSector(sector); 659 739 FinalizePedestals(ped,pix, 0); 660 740 } … … 673 753 { 674 754 *fLog << warn << "Could not calculate the photons flux from the F-Factor method " << endl; 675 fCam->SetFFactorMethodValid(kFALSE); 755 if (fIntensCam) 756 fIntensCam->SetFFactorMethodValid(kFALSE); 757 else 758 fCam->SetFFactorMethodValid(kFALSE); 676 759 return kFALSE; 677 760 } 678 761 else 679 fCam->SetFFactorMethodValid(kTRUE); 762 if (fIntensCam) 763 fIntensCam->SetFFactorMethodValid(kTRUE); 764 else 765 fCam->SetFFactorMethodValid(kTRUE); 680 766 681 767 *fLog << endl; … … 721 807 FinalizeUnsuitablePixels(); 722 808 723 fCam ->SetReadyToSave(); 809 if (fIntensCam) 810 fIntensCam->SetReadyToSave(); 811 else 812 fCam ->SetReadyToSave(); 813 724 814 fQECam ->SetReadyToSave(); 725 815 fBadPixels->SetReadyToSave(); … … 923 1013 924 1014 MBadPixelsPix &bad = (*fBadPixels)[i]; 925 MCalibrationPix &pix = (*fCam)[i];1015 MCalibrationPix &pix = fIntensCam ? (*fIntensCam)[i] : (*fCam)[i]; 926 1016 927 1017 if (bad.IsUncalibrated( MBadPixelsPix::kChargeIsPedestal)) … … 990 1080 { 991 1081 992 const UInt_t npixels = fGeom->GetNumPixels();993 const UInt_t nareas = fGeom->GetNumAreas();994 const UInt_t nsectors = fGeom->GetNumSectors();1082 const Int_t npixels = fGeom->GetNumPixels(); 1083 const Int_t nareas = fGeom->GetNumAreas(); 1084 const Int_t nsectors = fGeom->GetNumSectors(); 995 1085 996 1086 TArrayF lowlim (nareas); … … 1010 1100 MHCamera camphes(*fGeom,"Camphes","Phes in Camera"); 1011 1101 1012 for (UInt_t i=0; i<npixels; i++) 1013 { 1014 1015 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam) [i]; 1102 for (Int_t i=0; i<npixels; i++) 1103 { 1104 1105 MCalibrationChargePix &pix = fIntensCam 1106 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1107 : (MCalibrationChargePix&)(*fCam) [i]; 1016 1108 MBadPixelsPix &bad = (*fBadPixels)[i]; 1017 1109 … … 1039 1131 } 1040 1132 1041 for ( UInt_t i=0; i<nareas; i++)1133 for (Int_t i=0; i<nareas; i++) 1042 1134 { 1043 1135 if (numareavalid[i] == 0) … … 1071 1163 upplim [i] = areaphes[i] + fPheErrLimit*TMath::Sqrt(areavars[i]); 1072 1164 1073 TArrayI area(1); 1074 area[0] = i; 1075 1076 TH1D *hist = camphes.ProjectionS(TArrayI(),area,"_py",100); 1165 TH1D *hist = camphes.ProjectionS(TArrayI(),TArrayI(1,&i),"_py",100); 1077 1166 hist->Fit("gaus","Q"); 1078 1167 const Float_t mean = hist->GetFunction("gaus")->GetParameter(1); … … 1081 1170 1082 1171 if (IsDebug()) 1083 camphes.DrawClone();1172 hist->DrawClone(); 1084 1173 1085 1174 if (ndf < 2) … … 1126 1215 // Set the conversion factor FADC counts to photo-electrons 1127 1216 // 1128 for (UInt_t i=0; i<npixels; i++) 1129 { 1130 1131 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 1217 for (Int_t i=0; i<npixels; i++) 1218 { 1219 1220 MCalibrationChargePix &pix = fIntensCam 1221 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1222 : (MCalibrationChargePix&)(*fCam)[i]; 1132 1223 1133 1224 if (!pix.IsFFactorMethodValid()) … … 1177 1268 *fLog << endl; 1178 1269 1179 for (UInt_t aidx=0; aidx<nareas; aidx++) 1180 { 1181 1182 MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 1270 for (Int_t aidx=0; aidx<nareas; aidx++) 1271 { 1272 1273 MCalibrationChargePix &apix = fIntensCam 1274 ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx) 1275 : (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 1183 1276 1184 1277 if (numareavalid[aidx] == 1) … … 1218 1311 *fLog << endl; 1219 1312 1220 for ( UInt_t sector=0; sector<nsectors; sector++)1313 for (Int_t sector=0; sector<nsectors; sector++) 1221 1314 { 1222 1315 … … 1237 1330 } 1238 1331 1239 MCalibrationChargePix &spix = (MCalibrationChargePix&)fCam->GetAverageSector(sector); 1332 MCalibrationChargePix &spix = fIntensCam 1333 ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(sector) 1334 : (MCalibrationChargePix&)fCam->GetAverageSector(sector); 1240 1335 1241 1336 if (sectorweights[sector] < 0. || sectorphes[sector] <= 0.) … … 1264 1359 // only excluded as: MBadPixelsPix::kChargeSigmaNotValid 1265 1360 // 1266 for (UInt_t i=0; i<npixels; i++) 1267 { 1268 1269 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 1361 for (Int_t i=0; i<npixels; i++) 1362 { 1363 1364 MCalibrationChargePix &pix = fIntensCam 1365 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1366 : (MCalibrationChargePix&)(*fCam)[i]; 1270 1367 MBadPixelsPix &bad = (*fBadPixels)[i]; 1271 1368 … … 1276 1373 { 1277 1374 const Int_t aidx = (*fGeom)[i].GetAidx(); 1278 MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 1375 MCalibrationChargePix &apix = fIntensCam 1376 ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx) 1377 : (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 1279 1378 pix.SetPheFFactorMethod ( apix.GetPheFFactorMethod() ); 1280 1379 pix.SetPheFFactorMethodVar( apix.GetPheFFactorMethodVar() ); … … 1417 1516 1418 1517 const Float_t photons = flux * (*fGeom)[0].GetA() / fQECam->GetPlexiglassQE(); 1419 fCam->SetNumPhotonsBlindPixelMethod(photons); 1518 if (fIntensCam) 1519 fIntensCam->SetNumPhotonsBlindPixelMethod(photons); 1520 else 1521 fCam->SetNumPhotonsBlindPixelMethod(photons); 1420 1522 1421 1523 const Float_t photrelvar = fluxvar / flux / flux + fQECam->GetPlexiglassQERelVar(); 1422 1524 if (photrelvar > 0.) 1423 fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 1525 if (fIntensCam) 1526 fIntensCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 1527 else 1528 fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 1424 1529 1425 1530 return kTRUE; … … 1529 1634 } 1530 1635 1531 MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCam->GetAverageArea(0); 1636 MCalibrationChargePix &avpix = fIntensCam 1637 ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(0) 1638 : (MCalibrationChargePix&)fCam->GetAverageArea(0); 1532 1639 MCalibrationQEPix &qepix = (MCalibrationQEPix&) fQECam->GetAverageArea(0); 1533 1640 … … 1549 1656 // Set the results in the MCalibrationChargeCam 1550 1657 // 1551 fCam->SetNumPhotonsFFactorMethod (avphotons); 1658 if (fIntensCam) 1659 fIntensCam->SetNumPhotonsFFactorMethod (avphotons); 1660 else 1661 fCam->SetNumPhotonsFFactorMethod (avphotons); 1662 1552 1663 if (avphotrelvar > 0.) 1553 fCam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 1664 if (fIntensCam) 1665 fIntensCam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 1666 else 1667 fCam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 1554 1668 1555 1669 TArrayF lowlim (nareas); … … 1566 1680 { 1567 1681 1568 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 1682 MCalibrationChargePix &pix = fIntensCam 1683 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1684 : (MCalibrationChargePix&)(*fCam)[i]; 1569 1685 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*fQECam)[i]; 1570 1686 MBadPixelsPix &bad = (*fBadPixels)[i]; … … 1681 1797 { 1682 1798 1683 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 1799 MCalibrationChargePix &pix = fIntensCam 1800 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1801 : (MCalibrationChargePix&)(*fCam)[i]; 1684 1802 MBadPixelsPix &bad = (*fBadPixels)[i]; 1685 1803 … … 1704 1822 { 1705 1823 1706 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 1824 MCalibrationChargePix &pix = fIntensCam 1825 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1826 : (MCalibrationChargePix&)(*fCam)[i]; 1707 1827 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*fQECam)[i]; 1708 1828 MBadPixelsPix &bad = (*fBadPixels)[i]; … … 1752 1872 const Float_t photons = fBlindPixel->GetFluxInsidePlexiglass() * (*fGeom)[0].GetA() 1753 1873 / fQECam->GetPlexiglassQE(); 1754 fCam->SetNumPhotonsBlindPixelMethod(photons); 1874 if (fIntensCam) 1875 fCam->SetNumPhotonsBlindPixelMethod(photons); 1876 else 1877 fCam->SetNumPhotonsBlindPixelMethod(photons); 1755 1878 1756 1879 const Float_t photrelvar = fBlindPixel->GetFluxInsidePlexiglassRelVar() 1757 1880 + fQECam->GetPlexiglassQERelVar(); 1758 1881 if (photrelvar > 0.) 1759 fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 1882 if (fIntensCam) 1883 fIntensCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 1884 else 1885 fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 1760 1886 } 1761 1887 } … … 1788 1914 } 1789 1915 1790 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 1916 MCalibrationChargePix &pix = fIntensCam 1917 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1918 : (MCalibrationChargePix&)(*fCam)[i]; 1791 1919 MGeomPix &geo = (*fGeom)[i]; 1792 1920 … … 1861 1989 } 1862 1990 1863 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 1991 MCalibrationChargePix &pix = fIntensCam 1992 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1993 : (MCalibrationChargePix&)(*fCam)[i]; 1864 1994 MGeomPix &geo = (*fGeom)[i]; 1865 1995 … … 1910 2040 // 1911 2041 // - Print out statistics about BadPixels of type UnsuitableType_t 1912 // - store numbers of bad pixels of each type in fCam 2042 // - store numbers of bad pixels of each type in fCam or fIntensCam 1913 2043 // 1914 2044 void MCalibrationChargeCalc::FinalizeUnsuitablePixels() … … 1950 2080 1951 2081 for (Int_t aidx=0; aidx<nareas; aidx++) 1952 fCam->SetNumUnsuitable(counts[aidx], aidx); 2082 if (fIntensCam) 2083 fIntensCam->SetNumUnsuitable(counts[aidx], aidx); 2084 else 2085 fCam->SetNumUnsuitable(counts[aidx], aidx); 1953 2086 1954 2087 if (fGeom->InheritsFrom("MGeomCamMagic")) … … 1969 2102 1970 2103 for (Int_t aidx=0; aidx<nareas; aidx++) 1971 fCam->SetNumUnreliable(counts[aidx], aidx); 2104 if (fIntensCam) 2105 fIntensCam->SetNumUnreliable(counts[aidx], aidx); 2106 else 2107 fCam->SetNumUnreliable(counts[aidx], aidx); 1972 2108 1973 2109 *fLog << " " << setw(7) << "Unreliable Pixels: " -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r4882 r4908 27 27 #endif 28 28 29 class MRawEvtData; 30 class MRawRunHeader; 29 class MRawEvtHeader; 31 30 class MPedestalCam; 32 31 class MPedestalPix; … … 36 35 class MCalibrationChargePix; 37 36 class MCalibrationChargeCam; 37 class MCalibrationIntensityChargeCam; 38 38 class MCalibrationQECam; 39 39 class MGeomCam; 40 40 class MExtractedSignalCam; 41 class MExtractedSignalBlindPixel;42 class MExtractedSignalPINDiode;43 41 class MBadPixelsCam; 44 42 class MTime; … … 68 66 Float_t fSqrtHiGainSamples; // Square root nr. High-Gain FADC slices used by extractor 69 67 Float_t fSqrtLoGainSamples; // Square root nr. Low -Gain FADC slices used by extractor 68 70 69 MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour 70 UInt_t fPulserPattern; // Calibration LEDs Pulser Pattern 71 71 72 Int_t fNumInnerFFactorMethodUsed; // Number of inner pixels used for F-Factor Method calibration 72 73 … … 80 81 81 82 // Pointers 82 MBadPixelsCam *fBadPixels; // Bad Pixels 83 MBadPixelsCam *fBadPixels; // Bad Pixels 84 MCalibrationIntensityChargeCam *fIntensCam; // Calibrated Charges of all pixels 83 85 MCalibrationChargeCam *fCam; // Calibrated Charges of all pixels 84 86 MCalibrationChargeBlindPix *fBlindPixel; // Calibrated Charges of the Blind Pixel … … 87 89 MCalibrationQECam *fQECam; // Calibrated Quantum Efficiencies of all pixels 88 90 MGeomCam *fGeom; //! Camera geometry 91 MExtractedSignalCam *fSignal; //! Extracted Signal 92 MRawEvtHeader *fHeader; //! Event header 89 93 MPedestalCam *fPedestals; //! Pedestals all pixels (calculated previously from ped.file) 90 94 -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
r4811 r4908 61 61 #include "MGeomPix.h" 62 62 63 #include "MCalibrationIntensityRelTimeCam.h" 64 63 65 #include "MCalibrationRelTimeCam.h" 64 66 #include "MCalibrationRelTimePix.h" … … 72 74 using namespace std; 73 75 74 const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 0.75;76 const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 1.0; 75 77 // -------------------------------------------------------------------------- 76 78 // … … 88 90 // 89 91 MCalibrationRelTimeCalc::MCalibrationRelTimeCalc(const char *name, const char *title) 90 : f BadPixels(NULL), fCam(NULL), fGeom(NULL)92 : fGeom(NULL) 91 93 { 92 94 … … 106 108 // Sets: 107 109 // - all flags to kFALSE 110 // - all pointers to NULL 108 111 // 109 112 void MCalibrationRelTimeCalc::Clear(const Option_t *o) 110 113 { 111 SkipHiLoGainCalibration( kFALSE ); 114 115 fBadPixels = NULL; 116 fCam = NULL; 117 fIntensCam = NULL; 118 112 119 } 113 120 … … 160 167 } 161 168 162 fCam = (MCalibrationRelTimeCam*)pList->FindObject("MCalibrationRelTimeCam"); 163 if (!fCam) 164 { 165 *fLog << err << "Cannot find MCalibrationRelTimeCam... aborting" << endl; 166 *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationRelTimeCam before..." << endl; 167 return kFALSE; 168 } 169 169 fIntensCam = (MCalibrationIntensityRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam")); 170 if (fIntensCam) 171 *fLog << inf << "Found MCalibrationIntensityRelTimeCam ... " << endl; 172 else 173 { 174 fCam = (MCalibrationRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam")); 175 if (!fCam) 176 { 177 *fLog << err << "Cannot find MCalibrationRelTimeCam ... abort." << endl; 178 *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationRelTimeCam before..." << endl; 179 return kFALSE; 180 } 181 } 170 182 171 183 UInt_t npixels = fGeom->GetNumPixels(); … … 174 186 { 175 187 176 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam) [i]; 177 MBadPixelsPix &bad = (*fBadPixels)[i]; 188 MCalibrationRelTimePix &pix = fIntensCam 189 ? (MCalibrationRelTimePix&)(*fIntensCam)[i] 190 : (MCalibrationRelTimePix&)(*fCam) [i]; 191 MBadPixelsPix &bad = (*fBadPixels)[i]; 178 192 179 193 pix.SetPixId(i); … … 184 198 continue; 185 199 } 186 200 201 if (IsDebug()) 202 pix.SetDebug(); 187 203 } 188 204 … … 245 261 FinalizeUnsuitablePixels(); 246 262 247 fCam ->SetReadyToSave(); 263 if (fIntensCam) 264 fIntensCam->SetReadyToSave(); 265 else 266 fCam ->SetReadyToSave(); 248 267 fBadPixels->SetReadyToSave(); 249 268 … … 321 340 { 322 341 323 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i]; 342 MCalibrationRelTimePix &pix = fIntensCam 343 ? (MCalibrationRelTimePix&)(*fIntensCam)[i] 344 : (MCalibrationRelTimePix&)(*fCam) [i]; 324 345 MBadPixelsPix &bad = (*fBadPixels)[i]; 325 346 … … 369 390 { 370 391 371 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i]; 392 MCalibrationRelTimePix &pix = fIntensCam 393 ? (MCalibrationRelTimePix&)(*fIntensCam)[i] 394 : (MCalibrationRelTimePix&)(*fCam) [i]; 372 395 MBadPixelsPix &bad = (*fBadPixels)[i]; 373 396 … … 378 401 continue; 379 402 380 const Float_t res = pix.GetTimePrecision();403 const Float_t res = pix.GetTimePrecision(); 381 404 const Int_t aidx = (*fGeom)[i].GetAidx(); 382 405 … … 408 431 { 409 432 410 MBadPixelsPix &bad = (*fBadPixels)[i]; 411 MCalibrationPix &pix = (*fCam)[i]; 433 MBadPixelsPix &bad = (*fBadPixels)[i]; 434 MCalibrationRelTimePix &pix = fIntensCam 435 ? (MCalibrationRelTimePix&)(*fIntensCam)[i] 436 : (MCalibrationRelTimePix&)(*fCam) [i]; 412 437 413 438 if (bad.IsUncalibrated( MBadPixelsPix::kDeviatingTimeResolution)) … … 430 455 // 431 456 // - Print out statistics about BadPixels of type UnsuitableType_t 432 // - store numbers of bad pixels of each type in f Cam457 // - store numbers of bad pixels of each type in fIntensCam or fCam 433 458 // 434 459 void MCalibrationRelTimeCalc::FinalizeUnsuitablePixels() … … 454 479 455 480 for (Int_t aidx=0; aidx<nareas; aidx++) 456 fCam->SetNumUnsuitable(counts[aidx], aidx); 481 if (fIntensCam) 482 fIntensCam->SetNumUnsuitable(counts[aidx], aidx); 483 else 484 fCam->SetNumUnsuitable(counts[aidx], aidx); 457 485 458 486 if (fGeom->InheritsFrom("MGeomCamMagic")) … … 473 501 474 502 for (Int_t aidx=0; aidx<nareas; aidx++) 475 fCam->SetNumUnreliable(counts[aidx], aidx); 503 if (fIntensCam) 504 fIntensCam->SetNumUnreliable(counts[aidx], aidx); 505 else 506 fCam->SetNumUnreliable(counts[aidx], aidx); 476 507 477 508 *fLog << " " << setw(7) << "Unreliable Pixels: " -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h
r4882 r4908 19 19 #endif 20 20 21 class MCalibrationIntensityRelTimeCam; 21 22 class MCalibrationRelTimeCam; 22 23 class MGeomCam; … … 30 31 31 32 // Variables 32 Float_t fRelTimeResolutionLimit; // Limit acceptance rel. time resolution (in FADC slices) 33 Byte_t fFlags; // Bit-field for the flags 34 35 TString fOutputPath; // Path to the output file 36 TString fOutputFile; // Name of the output file 33 Float_t fRelTimeResolutionLimit; // Limit acceptance rel. time resolution (in FADC slices) 34 TString fOutputPath; // Path to the output file 35 TString fOutputFile; // Name of the output file 37 36 38 37 // Pointers 39 MBadPixelsCam *fBadPixels; // Bad Pixels 40 MCalibrationRelTimeCam *fCam; // Calibrated RelTimes of all pixels 41 MGeomCam *fGeom; //! Camera geometry 38 MBadPixelsCam *fBadPixels; // Bad Pixels 39 MCalibrationIntensityRelTimeCam *fIntensCam; // Calibrated RelTimes for different intensities 40 MCalibrationRelTimeCam *fCam; // Calibrated RelTimes of all pixels 41 MGeomCam *fGeom; //! Camera geometry 42 42 43 // enums 44 enum { kHiLoGainCalibration }; 43 enum { kDebug }; // Possible flags 45 44 45 Byte_t fFlags; // Bit-field for the general flags 46 46 47 // functions 47 const char* GetOutputFile ();48 const char* GetOutputFile (); 48 49 void FinalizeAverageResolution(); 49 void FinalizeRelTimes ();50 void FinalizeBadPixels ();51 void FinalizeUnsuitablePixels ();50 void FinalizeRelTimes (); 51 void FinalizeBadPixels (); 52 void FinalizeUnsuitablePixels (); 52 53 53 54 void PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const; … … 64 65 void Clear(const Option_t *o=""); 65 66 66 void SetOutputPath ( TString path="." ); 67 void SetOutputFile ( TString file="TimeCalibStat.txt" ) { fOutputFile = file; } 68 void SetRelTimeResolutionLimit ( const Float_t f=fgRelTimeResolutionLimit ) { fRelTimeResolutionLimit = f; } 67 Bool_t IsDebug() const { return TESTBIT(fFlags,kDebug); } 69 68 70 void SkipHiLoGainCalibration ( const Bool_t b=kTRUE ) 71 { b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration); } 69 void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags,kDebug) : CLRBIT(fFlags,kDebug); } 70 void SetOutputPath ( TString path="." ); 71 void SetOutputFile ( TString file="TimeCalibStat.txt" ) { fOutputFile = file; } 72 void SetRelTimeResolutionLimit( const Float_t f=fgRelTimeResolutionLimit ) { fRelTimeResolutionLimit = f; } 72 73 73 74 ClassDef(MCalibrationRelTimeCalc, 1) // Task finalizing the relative time Calibration
Note:
See TracChangeset
for help on using the changeset viewer.