Changeset 2629 for trunk/MagicSoft
- Timestamp:
- 12/10/03 08:24:42 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/calibration.C
r2628 r2629 218 218 disp15.SetYTitle("Conversion Factor [Ph/FADC count]"); 219 219 220 disp1.SetPrettyPalette(); 221 disp3.SetPrettyPalette(); 222 disp5.SetPrettyPalette(); 223 disp6.SetPrettyPalette(); 224 disp7.SetPrettyPalette(); 225 disp8.SetPrettyPalette(); 226 disp9.SetPrettyPalette(); 227 disp10.SetPrettyPalette(); 228 disp11.SetPrettyPalette(); 229 disp12.SetPrettyPalette(); 230 disp13.SetPrettyPalette(); 231 disp14.SetPrettyPalette(); 232 disp15.SetPrettyPalette(); 233 234 235 220 236 MStatusDisplay *d2 = new MStatusDisplay; 221 237 -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc
r2627 r2629 107 107 108 108 109 if (fHi GainSaturation)109 if (fHist->UseLoGain()) 110 110 { 111 SetHiGainSaturation(); 112 111 113 if(!fHist->FitChargeLoGain()) 112 114 { -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
r2599 r2629 50 50 #include "MPedestalCam.h" 51 51 52 #include "MGeomCamMagic.h" 53 52 54 ClassImp(MPedCalcPedRun); 53 55 … … 61 63 AddToBranchList("fHiGainPixId"); 62 64 AddToBranchList("fHiGainFadcSamples"); 65 66 fCounter=0; 63 67 } 64 68 … … 75 79 if (!fPedestals) 76 80 return kFALSE; 81 82 MGeomCamMagic magiccam; 83 84 fSumx.Set(magiccam.GetNumPixels()); 85 fSumx2.Set(magiccam.GetNumPixels()); 86 87 for(UInt_t i=0;i<magiccam.GetNumPixels();i++) 88 { 89 fSumx.AddAt(0,i); 90 fSumx2.AddAt(0,i); 91 } 77 92 78 93 return kTRUE; … … 110 125 while (pixel.Next()) 111 126 { 112 Byte_t *ptr = pixel.GetHiGainSamples(); 113 const Byte_t *end = ptr + fRawEvt->GetNumHiGainSamples(); 127 Byte_t shift=(fNumHiGainSamples/2*2==fNumHiGainSamples) ? 0:1; 128 Byte_t *ptr = pixel.GetHiGainSamples(); 129 const Byte_t *end = ptr + fRawEvt->GetNumHiGainSamples()-shift; 114 130 115 131 const Float_t higainped = CalcHiGainMean(ptr, end); … … 118 134 const UInt_t pixid = pixel.GetPixelId(); 119 135 MPedestalPix &pix = (*fPedestals)[pixid]; 120 136 137 // cumulate the sum of pedestals and of pedestal squares 138 fSumx.AddAt(higainped+fSumx.At(pixid),pixid); 139 fSumx2.AddAt(GetSumx2(ptr, end)+fSumx2.At(pixid),pixid); 140 141 // set the value of the pedestal and rms computed from the processed event 121 142 pix.Set(higainped, higainrms); 122 123 } 143 } 144 145 146 fCounter++; 124 147 125 148 fPedestals->SetReadyToSave(); … … 128 151 } 129 152 153 Int_t MPedCalcPedRun::PostProcess() 154 { 155 // Compute pedestals and rms from the whole run 156 157 MRawEvtPixelIter pixel(fRawEvt); 158 159 while (pixel.Next()) 160 { 161 const UInt_t pixid = pixel.GetPixelId(); 162 MPedestalPix &pix = (*fPedestals)[pixid]; 163 164 const Int_t N = fCounter; 165 const Float_t sum = fSumx.At(pixid); 166 const Float_t sum2 = fSumx2.At(pixid); 167 const Float_t higainped = sum/N; 168 const Float_t higainrms = sqrt(1./(N-1.)*(sum2-sum*sum/N)); 169 pix.Set(higainped,higainrms); 170 171 } 172 return kTRUE; 173 174 } 175 176 130 177 Float_t MPedCalcPedRun::CalcHiGainMean(Byte_t *ptr, const Byte_t *end) const 131 178 { 132 179 Int_t sum=0; 180 Byte_t EvenNumSamples=(fNumHiGainSamples/2*2==fNumHiGainSamples) ? fNumHiGainSamples:fNumHiGainSamples-1; 133 181 134 182 do sum += *ptr; 135 183 while (++ptr != end); 136 137 return (Float_t)sum/fNumHiGainSamples; 184 185 return (Float_t)sum/EvenNumSamples; 186 } 187 188 189 190 Float_t MPedCalcPedRun::GetSumx2(Byte_t *ptr, const Byte_t *end) const 191 { 192 Float_t square = 0; 193 194 // Take an even number of time slices to avoid biases due to A/B effect 195 Byte_t EvenNumSamples=(fNumHiGainSamples/2*2==fNumHiGainSamples) ? fNumHiGainSamples:fNumHiGainSamples-1; 196 197 do 198 { 199 const Float_t val = (Float_t)(*ptr); 200 201 square += val*val; 202 } while (++ptr != end); 203 204 return square/EvenNumSamples; 138 205 } 139 206 … … 142 209 { 143 210 Float_t rms = 0; 211 Byte_t EvenNumSamples=(fNumHiGainSamples/2*2==fNumHiGainSamples) ? fNumHiGainSamples:fNumHiGainSamples-1; 144 212 145 213 do … … 150 218 } while (++ptr != end); 151 219 152 return sqrt(rms/fNumHiGainSamples); 153 } 220 return sqrt(rms/EvenNumSamples); 221 } 222 223 224 154 225 /* 155 226 Float_t MPedCalcPedRun::CalcHiGainMeanErr(Float_t higainrms) const -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.h
r2539 r2629 14 14 #endif 15 15 16 #include <TArrayF.h> 17 16 18 class MRawRunHeader; 17 19 class MRawEvtData; … … 22 24 Byte_t fNumHiGainSamples; 23 25 26 Int_t fCounter; // keep number of processed events 27 24 28 MRawRunHeader *fRunheader; // raw event run header 25 29 MRawEvtData *fRawEvt; // raw event data (time slices) 26 30 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera 27 31 32 TArrayF fSumx; // sum of values 33 TArrayF fSumx2; // sum of squared values 34 28 35 Float_t CalcHiGainMean(Byte_t *ptr, const Byte_t *end) const; 29 36 Float_t CalcHiGainRms(Byte_t *ptr, const Byte_t *end, Float_t higainped) const; 30 //Float_t CalcHiGainMeanErr(Float_t higainrms) const; 37 Float_t GetSumx2(Byte_t* ptr, const Byte_t* end) const; 38 //Float_t CalcHiGainMeanErr(Float_t higainrms) const; 31 39 //Float_t CalcHiGainRmsErr(Float_t higainrms) const; 32 40 … … 35 43 Int_t PreProcess(MParList *pList); 36 44 Int_t Process(); 45 Int_t PostProcess(); 37 46 38 47 public: -
trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc
r2627 r2629 264 264 } 265 265 266 267 Bool_t MHCalibrationPixel::UseLoGain() 268 { 269 270 if (fHChargeHiGain->GetEntries() > fHChargeLoGain->GetEntries()) 271 { 272 fUseLoGain = kFALSE; 273 return kFALSE; 274 } 275 else 276 { 277 fUseLoGain = kTRUE; 278 return kTRUE; 279 } 280 } 266 281 267 282 -
trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h
r2627 r2629 93 93 Bool_t FillChargevsNHiGain(Float_t q, Int_t n) { return fHChargevsNHiGain->Fill(n,q) > -1; } 94 94 95 void SetUseLoGain() { fUseLoGain = kTRUE; } 95 void SetUseLoGain() { fUseLoGain = kTRUE; } 96 Bool_t UseLoGain(); 96 97 97 98 const TH1F *GetHCharge() { return fHChargeHiGain; }
Note:
See TracChangeset
for help on using the changeset viewer.