Changeset 2728 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 12/20/03 13:46:17 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCalibrate.cc
r2726 r2728 24 24 25 25 ////////////////////////////////////////////////////////////////////////////// 26 // // 27 // MCalibrate // 28 // // 29 // This task takes the integrated charge from MExtractedSignal and apply // 30 // the calibration constants from MCalibraitionCam to the charge. Then // 31 // stores number of photons obtained in MCerPhotEvt. // 32 // // 33 // Input Containers: // 34 // // 35 // MGeomCam // 36 // MExtractedSingal // 37 // MCalibrationCam // 38 // // 39 // Output Containers: // 40 // // 41 // MCerPhotEvt // 42 // // 26 // 27 // MCalibrate 28 // 29 // This task takes the integrated charge from MExtractedSignal and apply 30 // the calibration constants from MCalibraitionCam to the charge. Then 31 // stores number of photons obtained in MCerPhotEvt. 32 // 33 // Input Containers: 34 // MExtractedSingal 35 // MCalibrationCam 36 // 37 // Output Containers: 38 // MCerPhotEvt 39 // 43 40 ////////////////////////////////////////////////////////////////////////////// 44 45 41 #include "MCalibrate.h" 46 42 #include "MCalibrationConfig.h" … … 74 70 MCalibrate::MCalibrate(const char *name, const char *title) 75 71 { 76 77 72 fName = name ? name : "MCalibrate"; 78 73 fTitle = title ? title : "Task to calculate the number of photons in one event"; 79 80 74 } 81 75 … … 94 88 Int_t MCalibrate::PreProcess(MParList *pList) 95 89 { 96 97 fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");98 if (!fGeomCam)99 {100 *fLog << err << dbginf << "MGeomCam not found ... aborting." << endl;101 return kFALSE;102 }103 104 90 fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam"); 105 91 if (!fSignals) 106 107 *fLog << err << dbginf <<"MExtractedSignalCam not found ... aborting" << endl;92 { 93 *fLog << err << "MExtractedSignalCam not found ... aborting" << endl; 108 94 return kFALSE; 109 95 } 110 96 111 97 fCalibrations = (MCalibrationCam*)pList->FindObject("MCalibrationCam"); 112 98 if (!fCalibrations) 113 114 *fLog << err << dbginf << "MCalibrationCam not found ... aborting." << endl;99 { 100 *fLog << err << "MCalibrationCam not found ... aborting." << endl; 115 101 return kFALSE; 116 102 } 117 103 118 104 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); 119 105 if (!fCerPhotEvt) 120 {121 *fLog << err << dbginf << "Cannot create MCerPhotEvt ... aborting" << endl;122 106 return kFALSE; 123 }124 107 125 108 return kTRUE; 126 109 } 127 128 110 129 111 // -------------------------------------------------------------------------- … … 132 114 Int_t MCalibrate::Process() 133 115 { 134 UInt_t imaxnumpix = fGeomCam->GetNumPixels(); 116 if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize()) 117 { 118 // FIXME: MExtractedSignal must be of variable size - 119 // like MCerPhotEvt - because we must be able 120 // to reduce size by zero supression 121 // For the moment this check could be done in ReInit... 122 *fLog << err << "MExtractedSignal and MCalibrationCam have different sizes... abort." << endl; 123 return kFALSE; 124 } 125 126 const UInt_t imaxnumpix = fSignals->GetSize(); 135 127 136 for (UInt_t pixid = 0; pixid < imaxnumpix; pixid++)128 for (UInt_t pixidx=0; pixidx<imaxnumpix; pixidx++) 137 129 { 138 MCalibrationPix &pix = (*fCalibrations)[pixid];130 const MCalibrationPix &pix = (*fCalibrations)[pixidx]; 139 131 132 if (!pix.IsBlindPixelMethodValid()) 133 continue; 140 134 141 if (pix.IsBlindPixelMethodValid()) 142 { 143 MExtractedSignalPix &sig = (*fSignals)[pixid]; 135 MExtractedSignalPix &sig = (*fSignals)[pixidx]; 144 136 145 146 137 Float_t signal; 138 Float_t signalErr = 0.; 147 139 148 if (sig.IsLoGainUsed()) 149 { 150 signal = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo(); 151 signalErr = signal*pix.GetConversionHiLoError(); 152 } 153 else 154 { 155 signal = sig.GetExtractedSignalHiGain(); 156 } 157 158 // Float_t calibrationConvertionFactor = pix.GetMeanConversionFFactorMethod(); 159 Float_t calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 160 Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod(); 140 if (sig.IsLoGainUsed()) 141 { 142 signal = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo(); 143 signalErr = signal*pix.GetConversionHiLoError(); 144 } 145 else 146 { 147 signal = sig.GetExtractedSignalHiGain(); 148 } 161 149 162 Float_t nphot = signal*calibrationConversionFactor; 163 Float_t nphotErr = signal*calibrationConversionFactorError 164 *signal*calibrationConversionFactorError; 165 nphotErr += signalErr*calibrationConversionFactor 166 *signalErr*calibrationConversionFactor; 150 // Float_t calibrationConvertionFactor = pix.GetMeanConversionFFactorMethod(); 151 const Float_t calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 152 const Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod(); 167 153 168 nphotErr = TMath::Sqrt(nphotErr); 154 const Float_t nphot = signal*calibrationConversionFactor; 155 Float_t nphotErr = signal*calibrationConversionFactorError 156 *signal*calibrationConversionFactorError; 157 nphotErr += signalErr*calibrationConversionFactor 158 *signalErr*calibrationConversionFactor; 169 159 170 fCerPhotEvt->AddPixel(pixid, nphot, nphotErr); 171 } 172 else 173 { 174 fCerPhotEvt->AddPixel(pixid, 0., 0.); 175 (*fCerPhotEvt)[pixid].SetPixelUnused(); 176 } 160 nphotErr = TMath::Sqrt(nphotErr); 161 162 fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr); 177 163 } 178 164 … … 182 168 return kTRUE; 183 169 } 184 -
trunk/MagicSoft/Mars/manalysis/MCalibrate.h
r2725 r2728 25 25 class MCalibrate : public MTask 26 26 { 27 28 MGeomCam *fGeomCam; // Geometry of the camera 27 private: 29 28 MCalibrationCam *fCalibrations; // Calibration constants 30 29 MExtractedSignalCam *fSignals; // Integrated charge in FADCs counts … … 40 39 MCalibrate(const char *name=NULL, const char *title=NULL); 41 40 42 void SetConversionHiLo(Float_t conv) 41 void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; } 43 42 44 43 ClassDef(MCalibrate, 0) // Task to calculate cerenkov photons using calibration constants -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h
r2725 r2728 68 68 void Clear(Option_t *o=""); 69 69 70 Float_t GetCharge() const { return fCharge; } 71 Float_t GetRSigmaSquare() const { return fRSigmaSquare; } 70 // Getter 71 Bool_t IsFitValid() const { return fFitValid; } 72 Bool_t IsFitted() const { return fFitted; } 73 Bool_t IsBlindPixelMethodValid() const { return fBlindPixelMethodValid; } 74 Bool_t IsFFactorMethodValid() const { return fFFactorMethodValid; } 75 Bool_t IsPINDiodeMethodValid() const { return fPINDiodeMethodValid; } 76 77 Float_t GetCharge() const { return fCharge; } 78 Float_t GetRSigmaSquare() const { return fRSigmaSquare; } 72 79 73 Float_t GetErrCharge() const{ return fErrCharge; }74 Float_t GetChargeProb() const{ return fChargeProb; }80 Float_t GetErrCharge() const { return fErrCharge; } 81 Float_t GetChargeProb() const { return fChargeProb; } 75 82 76 Float_t GetSigmaCharge() const { return fSigmaCharge; } 77 Float_t GetErrSigmaCharge() const { return fErrSigmaCharge; } 78 Float_t GetTime() const { return fTime; } 79 Float_t GetSigmaTime() const { return fSigmaTime; } 80 Float_t GetTimeChiSquare() const { return fTimeChiSquare; } 81 82 Float_t GetPed() const { return fPed; } 83 Float_t GetPedRms() const { return fPedRms; } 83 Float_t GetSigmaCharge() const { return fSigmaCharge; } 84 Float_t GetErrSigmaCharge() const { return fErrSigmaCharge; } 85 Float_t GetTime() const { return fTime; } 86 Float_t GetSigmaTime() const { return fSigmaTime; } 87 Float_t GetTimeChiSquare() const { return fTimeChiSquare; } 84 88 89 Float_t GetConversionHiLo() const { return fConversionHiLo; } 90 Float_t GetConversionHiLoError() const { return fConversionHiLoError; } 91 92 Float_t GetMeanConversionBlindPixelMethod() const { return fConversionBlindPixelMethod ; } 93 Float_t GetErrorConversionBlindPixelMethod() const { return fConversionErrorBlindPixelMethod ; } 94 Float_t GetSigmaConversionBlindPixelMethod() const { return fConversionSigmaBlindPixelMethod ; } 95 96 Float_t GetMeanConversionFFactorMethod() const { return fConversionFFactorMethod ; } 97 Float_t GetErrorConversionFFactorMethod() const { return fConversionErrorFFactorMethod ; } 98 Float_t GetSigmaConversionFFactorMethod() const { return fConversionSigmaFFactorMethod ; } 99 100 Float_t GetPheFFactorMethod() const { return fPheFFactorMethod; } 101 Float_t GetPheFFactorMethodError() const { return fPheFFactorMethodError; } 102 103 Float_t GetMeanConversionPINDiodeMethod() const { return fConversionPINDiodeMethod ; } 104 Float_t GetErrorConversionPINDiodeMethod() const { return fConversionErrorPINDiodeMethod ; } 105 Float_t GetSigmaConversionPINDiodeMethod() const { return fConversionSigmaPINDiodeMethod ; } 106 107 // FIXME: Remove this from stored data members 108 Float_t GetPed() const { return fPed; } 109 Float_t GetPedRms() const { return fPedRms; } 110 111 // Setter 85 112 void SetPedestal(Float_t ped, Float_t pedrms); 86 void SetHiGainSaturation() { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); }113 void SetHiGainSaturation() { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); } 87 114 88 void ApplyLoGainConversion(); 115 void SetConversionHiLo(Float_t c) { fConversionHiLo = c; } 116 void SetConversionHiLoError(Float_t e) { fConversionHiLoError = e; } 89 117 90 void SetConversionHiLo(Float_t c) { fConversionHiLo = c; } 91 void SetConversionHiLoError(Float_t e) { fConversionHiLoError = e; } 92 93 Float_t GetConversionHiLo() { return fConversionHiLo; } 94 Float_t GetConversionHiLoError() { return fConversionHiLoError; } 95 96 void SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig) 97 { 98 fConversionFFactorMethod = c; 99 fConversionErrorFFactorMethod = err; 100 fConversionSigmaFFactorMethod = sig; 101 } 102 void SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig) 103 { 104 fConversionBlindPixelMethod = c; 105 fConversionErrorBlindPixelMethod = err; 106 fConversionSigmaBlindPixelMethod = sig; 107 } 118 void SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig) 119 { 120 fConversionFFactorMethod = c; 121 fConversionErrorFFactorMethod = err; 122 fConversionSigmaFFactorMethod = sig; 123 } 124 void SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig) 125 { 126 fConversionBlindPixelMethod = c; 127 fConversionErrorBlindPixelMethod = err; 128 fConversionSigmaBlindPixelMethod = sig; 129 } 108 130 109 131 void SetConversionPINDiodeMethod(Float_t c, Float_t err, Float_t sig) 110 {111 112 fConversionErrorPINDiodeMethod = err; 113 fConversionSigmaPINDiodeMethod = sig; 114 132 { 133 fConversionPINDiodeMethod = c ; 134 fConversionErrorPINDiodeMethod = err; 135 fConversionSigmaPINDiodeMethod = sig; 136 } 115 137 116 Float_t GetMeanConversionBlindPixelMethod() const { return fConversionBlindPixelMethod ; } 117 Float_t GetErrorConversionBlindPixelMethod() const { return fConversionErrorBlindPixelMethod ; } 118 Float_t GetSigmaConversionBlindPixelMethod() const { return fConversionSigmaBlindPixelMethod ; } 138 void SetFitValid() { fFitValid = kTRUE; } 139 void SetFitted() { fFitted = kTRUE; } 140 void SetBlindPixelMethodValid(Bool_t b=kTRUE) { fBlindPixelMethodValid = b; } 141 void SetFFactorMethodValid(Bool_t b=kTRUE) { fFFactorMethodValid = b; } 142 void SetPINDiodeMethodValid(Bool_t b=kTRUE) { fPINDiodeMethodValid = b; } 119 143 120 Float_t GetMeanConversionFFactorMethod() const { return fConversionFFactorMethod ; } 121 Float_t GetErrorConversionFFactorMethod() const { return fConversionErrorFFactorMethod ; } 122 Float_t GetSigmaConversionFFactorMethod() const { return fConversionSigmaFFactorMethod ; } 123 124 Float_t GetPheFFactorMethod() const { return fPheFFactorMethod; } 125 Float_t GetPheFFactorMethodError() const { return fPheFFactorMethodError; } 126 127 Float_t GetMeanConversionPINDiodeMethod() const { return fConversionPINDiodeMethod ; } 128 Float_t GetErrorConversionPINDiodeMethod() const { return fConversionErrorPINDiodeMethod ; } 129 Float_t GetSigmaConversionPINDiodeMethod() const { return fConversionSigmaPINDiodeMethod ; } 144 // Unknown 145 void ApplyLoGainConversion(); 130 146 131 147 void SetChargesInGraph(Float_t qhi,Float_t qlo) { fHist->SetPointInGraph(qhi,qlo); } … … 139 155 Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) { return fHist->FillChargevsNLoGain(rq,t); } 140 156 141 Bool_t IsFitValid() { return fFitValid; } 142 Bool_t IsFitted() { return fFitted; } 143 Bool_t IsBlindPixelMethodValid() { return fBlindPixelMethodValid; } 144 Bool_t IsFFactorMethodValid() { return fFFactorMethodValid; } 145 Bool_t IsPINDiodeMethodValid() { return fPINDiodeMethodValid; } 146 147 void SetFitValid() { fFitValid = kTRUE; } 148 void SetFitted() { fFitted = kTRUE; } 149 void SetBlindPixelMethodValid(Bool_t b=kTRUE) { fBlindPixelMethodValid = b; } 150 void SetFFactorMethodValid(Bool_t b=kTRUE) { fFFactorMethodValid = b; } 151 void SetPINDiodeMethodValid(Bool_t b=kTRUE) { fPINDiodeMethodValid = b; } 152 157 // FIXME: Not necessary -> pixidx (not id anyhow!) == index in array! 158 // Only needed n histograms which have to move to an MH-class anyhow! 153 159 Int_t GetPixId() const { return fPixId; } 154 160 void DefinePixId(Int_t i); -
trunk/MagicSoft/Mars/manalysis/MExtractSignal.cc
r2725 r2728 56 56 // Default constructor. 57 57 // 58 MExtractSignal::MExtractSignal( const Byte_t first, const Byte_t last, const Byte_t logainshift,58 MExtractSignal::MExtractSignal(/*const Byte_t first, const Byte_t last, const Byte_t logainshift,*/ 59 59 const char *name, const char *title) 60 : fNumHiGainSamples(last-first+1), fNumLoGainSamples(last-first+1),60 : /*fNumHiGainSamples(last-first+1), fNumLoGainSamples(last-first+1),*/ 61 61 fSaturationLimit(254) 62 62 { … … 67 67 AddToBranchList("MRawEvtData.*"); 68 68 69 SetRange(); 70 /* 71 fFirst = first; 72 fLoGainFirst = first+logainshift; 73 74 fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples); 75 fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples); 76 */ 77 } 78 79 void MExtractSignal::SetRange(Byte_t first, Byte_t last, Byte_t logainshift) 80 { 81 fNumHiGainSamples = last-first+1; 82 fNumLoGainSamples = last-first+1; 83 69 84 fFirst = first; 70 85 fLoGainFirst = first+logainshift; 71 86 72 fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples); 73 fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples); 87 fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples); 88 fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples); 74 89 } 75 90 … … 87 102 Int_t MExtractSignal::PreProcess(MParList *pList) 88 103 { 89 90 104 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData"); 91 105 if (!fRawEvt) 92 106 { 93 *fLog << dbginf<< "MRawEvtData not found... aborting." << endl;107 *fLog << err << "MRawEvtData not found... aborting." << endl; 94 108 return kFALSE; 95 109 } … … 103 117 if (!fPedestals) 104 118 { 105 *fLog << err << dbginf << "Cannot find MPedestalCam... aborting" << endl;119 *fLog << err << "MPedestalCam not found... aborting" << endl; 106 120 return kFALSE; 107 121 } … … 118 132 Bool_t MExtractSignal::ReInit(MParList *pList ) 119 133 { 120 121 122 134 MGeomCam *cam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam")); 123 135 if (!cam) … … 127 139 } 128 140 141 // FIXME: This solution may change in the future, MExtractedSignal 142 // must be similar to MCerPhotEvt not to MPedestalCam 143 // (Have to think about the mean size of both solutions) 129 144 fSignals->InitSize(cam->GetNumPixels()); 130 145 131 132 fSignals->SetNumUsedFADCSlices(fNumHiGainSamples,fFirst,fFirst+fNumHiGainSamples-1, 133 fNumLoGainSamples,fFirst,fFirst+fNumLoGainSamples-1); 146 fSignals->SetNumUsedFADCSlices(fNumHiGainSamples, fFirst, fFirst+fNumHiGainSamples-1, 147 fNumLoGainSamples, fFirst, fFirst+fNumLoGainSamples-1); 134 148 135 149 return kTRUE; … … 144 158 Int_t MExtractSignal::Process() 145 159 { 146 147 160 MRawEvtPixelIter pixel(fRawEvt); 148 161 fSignals->Clear(); 149 162 150 163 while (pixel.Next()) 151 { 152 164 { 153 165 UShort_t satHi = 0; 154 166 UShort_t satLo = 0; … … 219 231 ); 220 232 221 pix.SetGainSaturation((satHi),satHi,satLo); 222 233 pix.SetGainSaturation(satHi, satHi, satLo); 234 235 // FIXME: Arrival time has to be stored in MArrivalTime! 223 236 if (satHi) 224 237 pix.SetArrivalTimes((Float_t)(midlo+fFirst),0.,0.); … … 233 246 return kTRUE; 234 247 } 235 236 Int_t MExtractSignal::PostProcess()237 {238 239 return kTRUE;240 241 } -
trunk/MagicSoft/Mars/manalysis/MExtractedSignalCam.h
r2699 r2728 7 7 8 8 class TClonesArray; 9 10 class MGeomCam;11 9 class MExtractedSignalPix; 12 10 … … 16 14 TClonesArray *fArray; // FIXME: Change TClonesArray away from a pointer? 17 15 16 // FIXME: Is it necessary to store this information for each event? 18 17 Byte_t fNumUsedHiGainFADCSlices; 19 18 Byte_t fNumUsedLoGainFADCSlices; … … 24 23 Byte_t fLastUsedSliceHiGain; 25 24 Byte_t fLastUsedSliceLoGain; 26 27 25 28 26 public: … … 47 45 48 46 void SetNumUsedFADCSlices(Byte_t numh, Byte_t firsth, Byte_t lasth, 49 Byte_t numl, Byte_t firstl, Byte_t lastl) 50 { 51 fNumUsedHiGainFADCSlices = numh; 52 fFirstUsedSliceHiGain = firsth; 53 fLastUsedSliceHiGain = lasth; 54 fNumUsedLoGainFADCSlices = numl; 55 fFirstUsedSliceLoGain = firstl; 56 fLastUsedSliceLoGain = lastl; 57 } 47 Byte_t numl, Byte_t firstl, Byte_t lastl) 48 { 49 // FIXME: Calculate the number of used slices from first/last 50 // to make sure, that the stored values are always 51 // consistent! 52 fNumUsedHiGainFADCSlices = numh; 53 fFirstUsedSliceHiGain = firsth; 54 fLastUsedSliceHiGain = lasth; 55 fNumUsedLoGainFADCSlices = numl; 56 fFirstUsedSliceLoGain = firstl; 57 fLastUsedSliceLoGain = lastl; 58 } 58 59 59 60 MExtractedSignalPix &operator[](Int_t i); -
trunk/MagicSoft/Mars/manalysis/MExtractedSignalPix.h
r2706 r2728 9 9 { 10 10 private: 11 11 // FIXME: We can only store ONE signal. Everything else takes 12 // too much storage space - will change in the future. 12 13 Float_t fExtractedSignalHiGain; // mean value of the extracted signal 13 14 Float_t fExtractedSignalHiGainError; // error of the mean value of the extracted signal 14 15 Float_t fExtractedSignalLoGain; // mean value of the extracted signal 15 16 Float_t fExtractedSignalLoGainError; // error of the mean value of the extracted signal 17 16 18 Bool_t fIsLoGainUsed; 17 19 Byte_t fNumHiGainSaturated; 18 20 Byte_t fNumLoGainSaturated; 19 21 22 // FIXME: Will be removed. Must be stored in MArrivalTime 20 23 Float_t fMeanArrivalTime; 21 24 Float_t fWidthArrivalTime;
Note:
See TracChangeset
for help on using the changeset viewer.