Changeset 1951 for trunk/MagicSoft/Mars/manalysis/MApplyPadding.cc
- Timestamp:
- 04/12/03 16:40:23 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MApplyPadding.cc
r1713 r1951 78 78 // Default constructor. 79 79 // 80 MApplyPadding::MApplyPadding(const char *name, const char *title) : fRunType(0), fGroup(0), fUseHistogram(kTRUE), fFixedSigmabar(0.0) 80 MApplyPadding::MApplyPadding(const char *name, const char *title) : fRunType(0), fGroup(0), fUseHistogram(kTRUE), fFixedSigmabar(0.0), fRnd(0) 81 81 { 82 82 fName = name ? name : "MApplyPadding"; … … 87 87 // -------------------------------------------------------------------------- 88 88 // 89 // Destructor.90 //91 MApplyPadding::~MApplyPadding()92 {93 //nothing yet94 }95 96 // --------------------------------------------------------------------------97 //98 89 // You can provide a TH1D* histogram containing the target Sigmabar in 99 90 // bins of theta. Be sure to use the same binning as for the analysis 100 91 // 101 Bool_tMApplyPadding::SetDefiningHistogram(TH1D *histo)92 void MApplyPadding::SetDefiningHistogram(TH1D *histo) 102 93 { 103 94 fHSigmabarMax = histo; 104 return kTRUE;105 95 } 106 96 … … 113 103 Bool_t MApplyPadding::PreProcess(MParList *pList) 114 104 { 115 fRnd = new TRandom3(0);116 117 105 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt"); 118 106 if (!fMcEvt) … … 163 151 if ((!fUseHistogram) && (fHSigmabarMax==NULL)) { 164 152 165 fHSigmabarMax = new TH1D ();153 fHSigmabarMax = new TH1D; 166 154 fHSigmabarMax->SetNameTitle("fHSigmabarMax","Sigmabarmax for this analysis"); 167 TAxis &x = *fHSigmabarMax->GetXaxis(); 168 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,03) 169 TString xtitle = x.GetTitle(); 170 #endif 171 fHSigmabarMax->SetBins(binstheta->GetNumBins(), 0, 1); 172 // Set the binning of the current histogram to the binning 173 // in one of the two given histograms 174 x.Set(binstheta->GetNumBins(), binstheta->GetEdges()); 175 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,03) 176 x.SetTitle(xtitle); 177 #endif 178 155 156 MH::SetBinning(fHSigmabarMax, binstheta); 157 179 158 // ------------------------------------------------- 180 159 // read in SigmabarParams … … 229 208 230 209 // Get sigmabar which we have to pad to 231 Double_t otherSig ;210 Double_t otherSig = fFixedSigmabar; 232 211 if (fUseHistogram) { 233 Int_t binNumber = fHSigmabarMax->GetXaxis()->FindBin(fMcEvt->GetT heta()*kRad2Deg);212 Int_t binNumber = fHSigmabarMax->GetXaxis()->FindBin(fMcEvt->GetTelescopeTheta()*kRad2Deg); 234 213 otherSig = fHSigmabarMax->GetBinContent(binNumber); 235 } else {236 otherSig = fFixedSigmabar;237 214 } 238 215 239 216 // Determine quadratic difference other-mine 240 Double_t quadraticDiff = otherSig*otherSig - mySig*mySig; 241 217 const Double_t quadraticDiff = otherSig*otherSig - mySig*mySig; 218 219 // crosscheck, should never happen 242 220 if (quadraticDiff < 0) { 243 221 *fLog << err << dbginf << "Event has higher Sigmabar="<<mySig<<" than Sigmabarmax="<<otherSig << " ...Skipping this event" <<endl; … … 248 226 249 227 // Pad if quadratic difference > 0 250 if (quadraticDiff > 0) {251 252 228 MPedestalCam newPed; 253 229 newPed.InitSize(fPed->GetSize()); … … 257 233 258 234 for (UInt_t i=0; i<npix; i++) { 259 MCerPhotPix pix = fEvt->operator[](i);235 MCerPhotPix &pix = (*fEvt)[i]; 260 236 if (!pix.IsPixelUsed()) 261 237 continue; 262 238 pix.SetNumPhotons(pix.GetNumPhotons() + 263 239 sqrt(quadraticDiff)* 264 fRnd ->Gaus(0.0, 1.0)/240 fRnd.Gaus(0.0, 1.0)/ 265 241 fCam->GetPixRatio(pix.GetPixId()) 266 242 ); … … 268 244 Double_t error = pix.GetErrorPhot(); 269 245 pix.SetErrorPhot(sqrt(error*error + quadraticDiff)); 270 MPedestalPix ppix = fPed->operator[](i); 271 MPedestalPix npix; 272 npix.SetSigma(sqrt(ppix.GetSigma()*ppix.GetSigma() + quadraticDiff)); 273 newPed[i]=npix; 246 MPedestalPix &ppix = (*fPed)[i]; 247 newPed[i].SetSigma(sqrt(ppix.GetSigma()*ppix.GetSigma() + quadraticDiff)); 274 248 } //for 275 249 // Calculate Sigmabar again and crosscheck … … 278 252 // fTest->Fill(otherSig,mySig); 279 253 return kTRUE; 280 } //if 281 return kFALSE; 282 } 283 284 Bool_t MApplyPadding::PostProcess() 285 { 286 // fTest->DrawClone(); 287 return kTRUE; 288 } 254 } 255
Note:
See TracChangeset
for help on using the changeset viewer.