Changeset 2237 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 06/26/03 17:00:06 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCT1PadSchweizer.cc
r2206 r2237 293 293 continue; 294 294 295 fEvt->AddPixel(i, 0.0, (*fPed)[i].Get MeanRms());295 fEvt->AddPixel(i, 0.0, (*fPed)[i].GetPedestalRms()); 296 296 } 297 297 … … 543 543 544 544 MPedestalPix &ppix = (*fPed)[j]; 545 Double_t oldsigma = ppix.Get MeanRms();545 Double_t oldsigma = ppix.GetPedestalRms(); 546 546 Double_t oldsigma2 = oldsigma*oldsigma; 547 547 … … 691 691 Double_t oldphotons = pix.GetNumPhotons(); 692 692 Double_t newphotons = oldphotons + NSB; 693 pix.SetNumPhotons( newphotons);693 pix.SetNumPhotons(newphotons); 694 694 695 695 … … 700 700 // error: add sigma of padded noise quadratically 701 701 Double_t olderror = pix.GetErrorPhot(); 702 Double_t newerror = sqrt( olderror*olderror + addSig2);703 pix.SetErrorPhot( newerror);704 705 706 Double_t newsigma = sqrt( oldsigma2 + addSig2 );707 ppix.Set MeanRms( newsigma);708 709 fHSigmaPedestal->Fill( oldsigma, newsigma);702 Double_t newerror = sqrt(olderror*olderror + addSig2); 703 pix.SetErrorPhot(newerror); 704 705 706 Double_t newsigma = sqrt(oldsigma2 + addSig2); 707 ppix.SetPedestalRms(newsigma); 708 709 fHSigmaPedestal->Fill(oldsigma, newsigma); 710 710 } 711 711 //---------- end of loop over pixels --------------------------------- -
trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc
r2211 r2237 99 99 } 100 100 101 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");102 if (!fPedestals)103 {104 *fLog << dbginf << "MPedestalCam not found... aborting." << endl;105 return kFALSE;106 }107 108 101 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); 109 102 if (!fCerPhotEvt) 103 return kFALSE; 104 105 const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 106 if (!runheader) 107 *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl; 108 else 109 if (runheader->GetRunType() == kRTMonteCarlo) 110 { 111 fPedestals=NULL; 112 return kTRUE; 113 } 114 115 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 116 if (runheader && !fPedestals) 110 117 return kFALSE; 111 118 … … 184 191 const UInt_t pixid = pixel.GetPixelId(); 185 192 186 MPedestalPix &ped = (*fPedestals)[pixid];187 188 193 // 189 194 // sanity check (old MC files sometimes have pixids>577) 190 195 // 191 if ( !fPedestals->CheckBounds(pixid))196 if (fPedestals && !fPedestals->CheckBounds(pixid)) 192 197 { 193 198 *fLog << inf << "Pixel ID larger than camera... skipping event." << endl; … … 196 201 197 202 fCerPhotEvt->AddPixel(pixid, nphot, sigmaped/2.236); 198 ped.SetPedestal(pedes, sigmaped); 199 ped.SetPedestalRms(sigmaped/sqrt(fRawEvt->GetNumHiGainSamples()-5.), 200 sigmaped/sqrt(2.*(fRawEvt->GetNumHiGainSamples()-5))); 201 203 204 if (fPedestals) 205 (*fPedestals)[pixid].Set(pedes, sigmaped); 206 207 /* 208 ped.SetPedestalRms(sigmaped/sqrt(fRawEvt->GetNumHiGainSamples()-5.), 209 sigmaped/sqrt(2.*(fRawEvt->GetNumHiGainSamples()-5))); 210 */ 202 211 // FIXME! Handling of Lo Gains is missing! 203 212 } … … 206 215 fCerPhotEvt->SetReadyToSave(); 207 216 217 if (fPedestals) 218 fPedestals->SetReadyToSave(); 219 208 220 return kTRUE; 209 221 } -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
r2213 r2237 107 107 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 108 108 if (!fPedestals) 109 return kFALSE; 109 { 110 *fLog << dbginf << "MPedestalCam not found... aborting." << endl; 111 return kFALSE; 112 } 110 113 111 114 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); … … 148 151 } 149 152 150 if (runheader->GetRunType() != kRTMonteCarlo) 153 Bool_t fIsMcFile = runheader->GetRunType() == kRTMonteCarlo; 154 if (!fIsMcFile) 151 155 return kTRUE; 156 157 ScalePedestals(); 152 158 153 159 MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader"); … … 165 171 } 166 172 173 void MCerPhotCalc::ScalePedestals() 174 { 175 Int_t n = 577; //FIXME: fPedestals->GetNumPixel(); 176 177 for (int idx=0; idx<n; idx++) 178 { 179 MPedestalPix &ped = (*fPedestals)[idx]; 180 181 const Double_t offset = fEnableFix ? ped.GetPedestal()-0.5 : ped.GetPedestal(); 182 ped.Set(offset*fSumWeights, ped.GetPedestalRms()*fSumQuadWeights); 183 } 184 185 fPedestals->SetReadyToSave(); 186 } 187 167 188 // -------------------------------------------------------------------------- 168 189 // … … 174 195 //fCerPhotEvt->InitSize(fRawEvt->GetNumPixels()); 175 196 197 if (fIsMcFile) 198 ScalePedestals(); 199 176 200 MRawEvtPixelIter pixel(fRawEvt); 177 201 178 202 while (pixel.Next()) 179 203 { 180 const UInt_t pixid= pixel.GetPixelId();181 const MPedestalPix &ped = (*fPedestals)[pixid];204 const UInt_t idx = pixel.GetPixelId(); 205 MPedestalPix &ped = (*fPedestals)[idx]; 182 206 183 207 // 184 208 // sanity check (old MC files sometimes have pixids>577) 185 209 // 186 if (!fPedestals->CheckBounds( pixid))210 if (!fPedestals->CheckBounds(idx)) 187 211 { 188 *fLog << inf << "Pixel I Dlarger than camera... skipping event." << endl;212 *fLog << inf << "Pixel Index larger than camera... skipping event." << endl; 189 213 return kCONTINUE; 190 214 } 191 192 //193 // Mean pedestal:194 //195 const Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean();196 215 197 216 // … … 204 223 nphot += ptr[i]*fWeight[i]; 205 224 206 nphot -= mean*fSumWeights; 207 208 const Float_t nphoterr = ped.GetSigma()* fSumQuadWeights; 209 210 fCerPhotEvt->AddPixel(pixid, nphot, nphoterr); 225 nphot -= ped.GetPedestal(); 226 227 fCerPhotEvt->AddPixel(idx, nphot, 0); 211 228 212 229 // FIXME! Handling of Lo Gains is missing! -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h
r2213 r2237 31 31 32 32 Bool_t fEnableFix; // fix for a bug in files from older camera versions (<=40) 33 Bool_t fIsMcFile; 33 34 34 35 TArrayF fWeight; // Weights for adding up the ADC slices … … 42 43 43 44 Bool_t ReInit(MParList *pList); 45 void ScalePedestals(); 44 46 45 47 public: -
trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
r2206 r2237 138 138 139 139 const Float_t pedest = fMcPed->GetPedestal(i); 140 const Float_t pedrms = pedest/sqrt((float)num);140 //const Float_t pedrms = pedest/sqrt((float)num); 141 141 142 142 const Float_t sigma = fMcPed->GetPedestalRms(i); 143 const Float_t sigrms = sigma/sqrt(num*2.);143 //const Float_t sigrms = sigma/sqrt(num*2.); 144 144 145 pix.SetPedestal(pedest, sigma);146 pix.Set PedestalRms(pedrms, sigrms);145 //pix.SetPedestalRms(pedrms, sigrms); 146 pix.Set(pedest, sigma); 147 147 } 148 148 -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
r2206 r2237 215 215 MPedestalPix &pix = (*fPedCam)[i]; 216 216 217 const Float_t pedrms = pix.Get Sigma();217 const Float_t pedrms = pix.GetPedestalRms(); 218 218 const Float_t ratio = fGeom->GetPixRatio(i); 219 219 const Float_t ampl = fFadc->GetAmplitud(); 220 220 221 pix.Set Sigma(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl/ratio));221 pix.SetPedestalRms(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl/ratio)); 222 222 } 223 223 -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
r2206 r2237 95 95 const Float_t higainrms = CalcHiGainRms(ptr, end, higainped); 96 96 97 const Float_t higainpederr = CalcHiGainMeanErr(higainrms);98 const Float_t higainrmserr = CalcHiGainRmsErr(higainrms);97 //const Float_t higainpederr = CalcHiGainMeanErr(higainrms); 98 //const Float_t higainrmserr = CalcHiGainRmsErr(higainrms); 99 99 100 100 const UInt_t pixid = pixel.GetPixelId(); 101 101 MPedestalPix &pix = (*fPedestals)[pixid]; 102 102 103 pix.Set Pedestal(higainped, higainrms);104 pix.SetPedestalRms(higainpederr, higainrmserr);103 pix.Set(higainped, higainrms); 104 //pix.SetPedestalRms(higainpederr, higainrmserr); 105 105 } 106 106 … … 132 132 } while (++ptr != end); 133 133 134 return sqrt(rms/ (fNumHiGainSamples-1));134 return sqrt(rms/fNumHiGainSamples); 135 135 } 136 136 /* 137 137 Float_t MPedCalcPedRun::CalcHiGainMeanErr(Float_t higainrms) const 138 138 { … … 144 144 return higainrms/sqrt(2.*fNumHiGainSamples); 145 145 } 146 146 */ -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.h
r2206 r2237 26 26 Float_t CalcHiGainMean(Byte_t *ptr, const Byte_t *end) const; 27 27 Float_t CalcHiGainRms(Byte_t *ptr, const Byte_t *end, Float_t higainped) const; 28 Float_t CalcHiGainMeanErr(Float_t higainrms) const;29 Float_t CalcHiGainRmsErr(Float_t higainrms) const;28 //Float_t CalcHiGainMeanErr(Float_t higainrms) const; 29 //Float_t CalcHiGainRmsErr(Float_t higainrms) const; 30 30 31 31 Int_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
r2206 r2237 133 133 134 134 *fLog << id-1 << ": "; 135 *fLog << pix->GetMean() << " " << pix->GetSigma() << " "; 136 *fLog << pix->GetMeanRms() << " " << pix->GetSigmaRms() << endl; 135 *fLog << pix->GetPedestal() << " " << pix->GetPedestalRms() << endl; 137 136 } 138 137 } 139 138 140 Float_t MPedestalCam::Get MeanMin(const MGeomCam *geom) const139 Float_t MPedestalCam::GetPedestalMin(const MGeomCam *geom) const 141 140 { 142 141 if (fArray->GetEntries() <= 0) 143 142 return 50.; 144 143 145 Float_t minval = (*this)[0].Get Mean();144 Float_t minval = (*this)[0].GetPedestalRms(); 146 145 147 146 for (Int_t i=1; i<fArray->GetEntries(); i++) … … 149 148 const MPedestalPix &pix = (*this)[i]; 150 149 151 Float_t testval = pix.Get Mean();150 Float_t testval = pix.GetPedestalRms(); 152 151 153 152 if (geom) … … 160 159 } 161 160 162 Float_t MPedestalCam::Get MeanMax(const MGeomCam *geom) const161 Float_t MPedestalCam::GetPedestalMax(const MGeomCam *geom) const 163 162 { 164 163 if (fArray->GetEntries() <= 0) 165 164 return 50.; 166 165 167 Float_t maxval = (*this)[0].Get Mean();166 Float_t maxval = (*this)[0].GetPedestalRms(); 168 167 169 168 for (Int_t i=1; i<fArray->GetEntries(); i++) … … 171 170 const MPedestalPix &pix = (*this)[i]; 172 171 173 Float_t testval = pix.Get Mean();172 Float_t testval = pix.GetPedestalRms(); 174 173 175 174 if (geom) … … 184 183 Bool_t MPedestalCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const 185 184 { 186 val = (*this)[idx].GetMean()*cam.GetPixRatio(idx); 185 switch (type) 186 { 187 case 0: 188 val = (*this)[idx].GetPedestal(); 189 break; 190 case 1: 191 val = (*this)[idx].GetPedestalRms(); 192 break; 193 } 187 194 return kTRUE; 188 195 } -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
r2206 r2237 28 28 MPedestalPix &operator[](Int_t i) const; 29 29 30 Float_t Get MeanMin(const MGeomCam *cam) const;31 Float_t Get MeanMax(const MGeomCam *cam) const;30 Float_t GetPedestalMin(const MGeomCam *cam) const; 31 Float_t GetPedestalMax(const MGeomCam *cam) const; 32 32 33 33 Bool_t CheckBounds(Int_t i); -
trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc
r1540 r2237 48 48 void MPedestalPix::Clear(Option_t *o) 49 49 { 50 fMean = -1; 51 fSigma = -1; 52 fMeanRms = -1; 53 fSigmaRms = -1; 50 fPedestal = -1; 51 fPedestalRms = -1; 54 52 } 55 53 -
trunk/MagicSoft/Mars/manalysis/MPedestalPix.h
r1540 r2237 9 9 { 10 10 private: 11 Float_t fMean; // mean value of pedestal (PMT offset) 12 Float_t fSigma; // sigma (standard deviation) of pedestal 13 Float_t fMeanRms; // root mean square of pedestal 14 Float_t fSigmaRms; // root mean sqare of sigma of the pedestal 11 Float_t fPedestal; // mean value of pedestal (PMT offset) 12 Float_t fPedestalRms; // root mean square / sigma / standard deviation of pedestal 15 13 16 14 public: … … 19 17 void Clear(Option_t *o=""); 20 18 21 Float_t GetMean() const { return fMean; } 22 Float_t GetSigma() const { return fSigma; } 23 Float_t GetMeanRms() const { return fMeanRms; } 24 Float_t GetSigmaRms() const { return fSigmaRms; } 25 19 Float_t GetPedestal() const { return fPedestal; } 20 Float_t GetPedestalRms() const { return fPedestalRms; } 21 /* 26 22 void SetMean(Float_t f) { fMean = f; } 27 23 void SetSigma(Float_t f) { fSigma = f; } 28 24 void SetMeanRms(Float_t f) { fMeanRms = f; } 29 25 void SetSigmaRms(Float_t f) { fSigmaRms = f; } 26 */ 30 27 31 void SetPedestal(Float_t m, Float_t s) { fMean = m; fSigma = s; } 32 void SetPedestalRms(Float_t m, Float_t s) { fMeanRms = m; fSigmaRms = s; } 28 void SetPedestal(Float_t f) { fPedestal = f; } 29 void SetPedestalRms(Float_t f) { fPedestalRms = f; } 30 void Set(Float_t m, Float_t r) { fPedestal = m; fPedestalRms = r; } 33 31 34 Bool_t IsValid() const { return f Mean>=0||fSigma>=0||fMeanRms>=0||fSigmaRms>=0; }32 Bool_t IsValid() const { return fPedestal>=0||fPedestalRms>=0; } 35 33 36 34 ClassDef(MPedestalPix, 1) // Storage Container for Pedestal information of one pixel -
trunk/MagicSoft/Mars/manalysis/MSigmabar.cc
r2209 r2237 135 135 */ 136 136 137 const Int_t id = cerpix.GetPixId();138 const Double_t area = geom.GetPixRatio(id );139 140 if (id == 0)137 const Int_t idx = cerpix.GetPixId(); 138 const Double_t area = geom.GetPixRatio(idx); 139 140 if (idx == 0) 141 141 { 142 142 //*fLog << "MSigmabar : id = 0; pixel '0' is used, ignore it" … … 145 145 } 146 146 147 const MGeomPix &gpix = geom[id ];147 const MGeomPix &gpix = geom[idx]; 148 148 149 149 Int_t sector = (Int_t)(atan2(gpix.GetY(),gpix.GetX())*6 / (TMath::Pi()*2)); … … 152 152 153 153 // count only those pixels which have a sigma != 0.0 154 const Float_t sigma = ped[id ].GetMeanRms();154 const Float_t sigma = ped[idx].GetPedestalRms(); 155 155 156 156 if ( sigma <= 0 )
Note:
See TracChangeset
for help on using the changeset viewer.