Changeset 5729 for trunk/MagicSoft
- Timestamp:
- 01/07/05 19:56:06 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MEnergyEstParam.h
r2225 r5729 58 58 void SetCoeffB(const TArrayD &arr); 59 59 60 void SetVariables(const TArrayD &arr) { SetCoeff(arr); } 61 60 62 Double_t GetCoeff(Int_t i) { return i<fA.GetSize()? fA[i] : fB[i-fA.GetSize()]; } 61 63 -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r5570 r5729 66 66 // SetPedestalFlag(MCalibrateData::kEvent) (calibration is done for each event) 67 67 // 68 // By calling SetNamePedestalCam() and/or SetNamePedPhotCam() you69 // can control the name of theMPedestalCam and/or MPedPhotCam container which is used.68 // By calling AddPedestal() you can control the name of the 69 // MPedestalCam and/or MPedPhotCam container which is used. 70 70 // 71 71 // Assume you want to calibrate "MPedestalCam" once and "MPedestalFromLoGain" [MPedestalCam] … … 76 76 // MCalibrateData cal2; 77 77 // cal2.SetCalibrationMode(MCalibrateData::kSkip); 78 // cal2.SetNamePedestalCam("MPedestalFromLoGain"); 79 // cal2.SetNamePedPhotCam("MPedPhotFromLoGain") 78 // cal2.AddPedestal("FromLoGain"); 80 79 // cal2.SetPedestalFlag(MCalibrateData::kEvent); 81 80 // … … 133 132 using namespace std; 134 133 135 const TString MCalibrateData::fgNamePedestalCam = "MPedestalCam";136 const TString MCalibrateData::fgNamePedPhotCam = "MPedPhotCam";137 138 134 // -------------------------------------------------------------------------- 139 135 // … … 145 141 // - fCalibrationMode to kDefault 146 142 // - fPedestalFlag to kNo 147 // - fNamePedADCRunContainer to "MPedestalCam"148 // - fNamePedPhotRunContainer to "MPedPhotCam"149 143 // 150 144 MCalibrateData::MCalibrateData(CalibrationMode_t calmode,const char *name, const char *title) 151 : fGeomCam(NULL), fPedestalMean(NULL), fPedestalRms(NULL), 152 fBadPixels(NULL), fCalibrations(NULL), fQEs(NULL), fSignals(NULL), 153 fPedPhot(NULL), fCerPhotEvt(NULL), fPedestalFlag(kNo) 145 : fGeomCam(NULL), fBadPixels(NULL), fCalibrations(NULL), 146 fQEs(NULL), fSignals(NULL), fCerPhotEvt(NULL), fPedestalFlag(kNo) 154 147 { 155 148 … … 159 152 SetCalibrationMode(calmode); 160 153 161 SetNamePedestalCam(); 162 SetNamePedPhotCam(); 154 fNamesPedestal.SetOwner(); 155 } 156 157 void MCalibrateData::AddPedestal(const char *name) 158 { 159 TString ped(name); 160 TString pho(name); 161 ped.Prepend("MPedestal"); 162 pho.Prepend("MPedPhot"); 163 164 fNamesPedestal.Add(new TNamed(ped, pho)); 165 } 166 167 void MCalibrateData::AddPedestal(const char *pedestal, const char *pedphot) 168 { 169 fNamesPedestal.Add(new TNamed(pedestal, pedphot)); 163 170 } 164 171 … … 226 233 } 227 234 228 //fPedestalMean = 0; 229 //fPedestalRms = 0; 230 fPedPhot = 0; 235 if (fNamesPedestal.GetSize()>0 && fPedestalFlag==kNo) 236 { 237 *fLog << warn << "Pedestal list contains entries, but mode is set to kNo... setting to kEvent." << endl; 238 fPedestalFlag = kEvent; 239 } 240 231 241 if (fPedestalFlag) 232 242 { 233 if (!fPedestalMean) 234 { 235 fPedestalMean = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCam), "MPedestalCam"); 236 if (!fPedestalMean) 243 if (fNamesPedestal.GetSize()==0) 244 { 245 *fLog << inf << "No container names specified... using default: MPedestalCam and MPedPhotCam." << endl; 246 AddPedestal(); 247 } 248 249 fPedestalCams.Clear(); 250 fPedPhotCams.Clear(); 251 252 TIter Next(&fNamesPedestal); 253 TObject *o=0; 254 while ((o=Next())) 255 { 256 TObject *pedcam = pList->FindObject(AddSerialNumber(o->GetName()), "MPedestalCam"); 257 if (!pedcam) 237 258 { 238 *fLog << err << AddSerialNumber( fNamePedestalCam) << " [MPedestalCam] not found ... aborting" << endl;259 *fLog << err << AddSerialNumber(o->GetName()) << " [MPedestalCam] not found ... aborting" << endl; 239 260 return kFALSE; 240 261 } 241 } 242 243 if (!fPedestalRms) 244 { 245 fPedestalRms = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCam), "MPedestalCam"); 246 if (!fPedestalRms) 247 { 248 *fLog << err << AddSerialNumber(fNamePedestalCam) << " [MPedestalCam] not found ... aborting" << endl; 262 TObject *pedphot = pList->FindCreateObj("MPedPhotCam", AddSerialNumber(o->GetTitle())); 263 if (!pedphot) 249 264 return kFALSE; 250 } 251 } 252 253 fPedPhot = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam", AddSerialNumber(fNamePedPhotCam)); 254 if (!fPedPhot) 255 return kFALSE; 265 266 fPedestalCams.Add(pedcam); 267 fPedPhotCams.Add(pedphot); 268 } 256 269 } 257 270 … … 281 294 282 295 // Sizes might have changed 283 if (fPedestalFlag && (Int_t)fPedestalMean->GetSize() != fSignals->GetSize())284 { 285 *fLog << err << "Size mismatch of MPedestalCam for Mean and MCalibrationCam... abort." << endl;286 return kFALSE;287 }288 289 if (fPedestalFlag && (Int_t)fPedestalRms->GetSize() != fSignals->GetSize())290 {291 *fLog << err << "Size mismatch of MPedestalCam for RMS and MCalibrationCam... abort." << endl;292 return kFALSE;296 if (fPedestalFlag) 297 { 298 TIter Next(&fPedestalCams); 299 MPedestalCam *cam=0; 300 while ((cam=(MPedestalCam*)Next())) 301 if ((Int_t)cam->GetSize() != fSignals->GetSize()) 302 { 303 *fLog << err << "Size mismatch of " << cam->GetDescriptor() << " and MCalibrationCam... abort." << endl; 304 return kFALSE; 305 } 293 306 } 294 307 … … 523 536 if (pedestal) 524 537 { 538 /* 525 539 // pedestals/(used FADC slices) in [ADC] counts 526 540 const Float_t pedes = (*fPedestalMean)[pixidx].GetPedestal() * slices; … … 534 548 535 549 (*fPedPhot)[pixidx].Set(pedphot, pedphotrms); 550 */ 551 TIter NextPed(&fPedestalCams); 552 TIter NextPhot(&fPedPhotCams); 553 554 MPedestalCam *pedestal = 0; 555 MPedPhotCam *pedphot = 0; 556 557 while ((pedestal=(MPedestalCam*)NextPed()) && 558 (pedphot =(MPedPhotCam*)NextPhot())) 559 { 560 // pedestals/(used FADC slices) in [ADC] counts 561 const Float_t pedes = (*pedestal)[pixidx].GetPedestal() * slices; 562 const Float_t pedrms = (*pedestal)[pixidx].GetPedestalRms() * sqrtslices; 563 564 // pedestals/(used FADC slices) in [number of photons] 565 const Float_t mean = pedes * calibConv; 566 const Float_t rms = pedrms * calibConv; 567 568 (*pedphot)[pixidx].Set(mean, rms); 569 pedphot->SetReadyToSave(); 570 } 536 571 } 537 572 } … … 542 577 return kCONTINUE; 543 578 } 544 545 if (pedestal)546 fPedPhot->SetReadyToSave();547 579 548 580 if (data) … … 610 642 } 611 643 612 if (fNamePedestalCam != fgNamePedestalCam) 613 { 614 out << " " << GetUniqueName() << ".SetNamePedestalCam("; 615 out << fNamePedestalCam << ");" << endl; 616 } 617 618 if (fNamePedPhotCam != fgNamePedPhotCam) 619 { 620 out << " " << GetUniqueName() << ".SetNamePedPhotCam("; 621 out << fNamePedPhotCam << ");" << endl; 644 TIter Next(&fNamesPedestal); 645 TObject *o=0; 646 while ((o=Next())) 647 { 648 out << " " << GetUniqueName() << ".AddPedestal(\""; 649 out << o->GetName() << "\", \"" << o->GetTitle() << "\");" << endl; 622 650 } 623 651 } -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
r5570 r5729 34 34 { 35 35 private: 36 static const TString fgNamePedestalCam; //! "MPedestalCam" 37 static const TString fgNamePedPhotCam; //! "MPedPhotCam" 36 MGeomCam *fGeomCam; //! Camera geometry container 37 MBadPixelsCam *fBadPixels; //! Bad Pixels information 38 MCalibrationChargeCam *fCalibrations; //! Calibration constants 39 MCalibrationQECam *fQEs; //! Quantum efficiencies 40 MExtractedSignalCam *fSignals; //! Integrated charge in FADCs counts 41 MCerPhotEvt *fCerPhotEvt; //! Cerenkov Photon Event used for calculation 38 42 39 MGeomCam *fGeomCam; //! Camera geometry container 40 MPedestalCam *fPedestalMean; //! Pedestals/slice [ADC counts] 41 MPedestalCam *fPedestalRms; //! Pedestals/slice [ADC counts] 42 MBadPixelsCam *fBadPixels; //! Bad Pixels information 43 MCalibrationChargeCam *fCalibrations; //! Calibration constants 44 MCalibrationQECam *fQEs; //! Quantum efficiencies 45 MExtractedSignalCam *fSignals; //! Integrated charge in FADCs counts 43 UShort_t fCalibrationMode; // Flag defining the calibration mode (CalibrationMode_t) 44 Byte_t fPedestalFlag; // Flags defining to calibrate the pedestal each event or each run 46 45 47 MPedPhotCam *fPedPhot; //! Pedestals/(used slices) [photons] 48 MCerPhotEvt *fCerPhotEvt; //! Cerenkov Photon Event used for calculation 49 50 UShort_t fCalibrationMode; // Flag defining the calibration mode (CalibrationMode_t) 51 Byte_t fPedestalFlag; // Flags defining to calibrate the pedestal each event or each run 52 53 TString fNamePedestalCam; // name of fPedestal 54 TString fNamePedPhotCam; // name of fPedPhot 46 TList fNamesPedestal; // Names of input and output pedestal conatainer 47 TList fPedestalCams; //! List of pointers to input MPedestalCam 48 TList fPedPhotCams; //! List of pointers to corresponding output MPedPhotCam 55 49 56 50 Int_t Calibrate(Bool_t data, Bool_t pedestal) const; … … 95 89 96 90 void SetCalibrationMode ( CalibrationMode_t calmode=kDefault ) { fCalibrationMode=calmode; } 97 98 void SetNamePedestalCam(const char *name=fgNamePedestalCam.Data())99 {100 fNamePedestalCam = name;101 }102 void SetPedestalCamMean(MPedestalCam *cam) { fPedestalMean = cam; }103 void SetPedestalCamRms(MPedestalCam *cam) { fPedestalRms = cam; }104 91 105 void SetNamePedPhotCam(const char *name=fgNamePedPhotCam.Data()) 106 { 107 fNamePedPhotCam = name; 108 } 109 92 void AddPedestal(const char *name="Cam"); 93 void AddPedestal(const char *pedestal, const char *pedphot); 94 110 95 ClassDef(MCalibrateData, 0) // Task to calibrate FADC counts into Cherenkov photons 111 96 };
Note:
See TracChangeset
for help on using the changeset viewer.