Changeset 9359 for trunk/MagicSoft/Mars/mhflux
- Timestamp:
- 02/20/09 00:39:31 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mhflux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc
r9301 r9359 19 19 ! Author(s): Harald Kornmayer 1/2001 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 821 ! Copyright: MAGIC Software Development, 2000-2009 22 22 ! 23 23 ! … … 67 67 // 68 68 MHCollectionArea::MHCollectionArea(const char *name, const char *title) 69 : fMcEvt(0), f McAreaRadius(-1), fIsExtern(kFALSE)69 : fMcEvt(0), fHeader(0), fMcAreaRadius(-1), fIsExtern(kFALSE) 70 70 { 71 71 // initialize the histogram for the distribution r vs E … … 148 148 MH::SetBinomialErrors(fHEnergy, *hsel, *hall); 149 149 #endif 150 151 fHEnergy.Scale(totalarea);150 if (fMcAreaRadius>0) 151 fHEnergy.Scale(totalarea); 152 152 153 153 delete hsel; … … 161 161 if (!fIsExtern) 162 162 fHistAll.Reset(); 163 164 fHeader = (MMcRunHeader*)pl->FindObject("MMcRunHeader"); 165 if (!fHeader) 166 { 167 *fLog << err << "MMcRunHeader not found... abort." << endl; 168 return kFALSE; 169 } 163 170 164 171 fMcEvt = (MMcEvt*)pl->FindObject("MMcEvt"); … … 202 209 } 203 210 211 void MHCollectionArea::GetImpactMax() 212 { 213 if (fHeader->GetImpactMax()<=fMcAreaRadius*100) 214 return; 215 216 fMcAreaRadius = 0.01*fHeader->GetImpactMax(); // cm->m 217 *fLog << inf << "Maximum simulated impact: " << fMcAreaRadius << "m" << endl; 218 } 219 204 220 Bool_t MHCollectionArea::ReInit(MParList *plist) 205 221 { 206 MMcRunHeader *runheader = (MMcRunHeader*)plist->FindObject("MMcRunHeader"); 207 if (!runheader) 208 { 209 *fLog << err << "MMcRunHeader not found... abort." << endl; 210 return kFALSE; 211 } 212 213 if (runheader->GetImpactMax()>fMcAreaRadius*100) 214 { 215 fMcAreaRadius = 0.01*runheader->GetImpactMax(); // cm->m 216 *fLog << inf << "Maximum simulated impact: " << fMcAreaRadius << "m" << endl; 217 } 218 219 if (fCorsikaVersion!=0 && fCorsikaVersion!=runheader->GetCorsikaVersion()) 222 GetImpactMax(); 223 224 if (fCorsikaVersion!=0 && fCorsikaVersion!=fHeader->GetCorsikaVersion()) 220 225 { 221 226 *fLog << warn; 222 227 *fLog << "Warning - Read files have different Corsika versions..." << endl; 223 *fLog << " Last file=" << fCorsikaVersion << " New file=" << runheader->GetCorsikaVersion() << endl;224 } 225 fCorsikaVersion = runheader->GetCorsikaVersion();228 *fLog << " Last file=" << fCorsikaVersion << " New file=" << fHeader->GetCorsikaVersion() << endl; 229 } 230 fCorsikaVersion = fHeader->GetCorsikaVersion(); 226 231 227 232 if (fIsExtern) 228 233 return kTRUE; 229 234 230 fTotalNumSimulatedShowers += runheader->GetNumSimulatedShowers();235 fTotalNumSimulatedShowers += fHeader->GetNumSimulatedShowers(); 231 236 *fLog << inf << "Total Number of Simulated showers: " << fTotalNumSimulatedShowers << endl; 232 237 233 fAllEvtsTriggered |= runheader->GetAllEvtsTriggered();238 fAllEvtsTriggered |= fHeader->GetAllEvtsTriggered(); 234 239 *fLog << inf << "Only triggered events avail: " << (fAllEvtsTriggered?"yes":"no") << endl; 235 240 … … 248 253 const Float_t emax = crh->GetEUppLim(); 249 254 const Float_t expo = 1 + crh->GetSlopeSpec(); 250 const Float_t k = runheader->GetNumSimulatedShowers() /255 const Float_t k = fHeader->GetNumSimulatedShowers() / 251 256 (pow(emax,expo) - pow(emin,expo)); 252 257 … … 271 276 272 277 const Float_t energy = (e1+e2)/2.; 273 fHistAll.Fill(20, energy, events); 278 for (int j=0; j<TMath::Nint(events); j++) 279 fHistAll.Fill(0., energy); 274 280 // you have MMcRunHeader.fShowerThetaMin and MMcRunHeader.fShowerThetaMax 275 281 } … … 280 286 void MHCollectionArea::Paint(Option_t *option) 281 287 { 282 if (TString(option)=="paint3") 283 { 284 /* 285 TH1 *h = dynamic_cast<TH1*>(gPad->FindObject("Efficiency")); 286 if (h) 287 { 288 const TString txt = Form("N/N_{0}=%.2f", 289 GetCollectionAreaEff(), 290 GetCollectionAreaAbs(), fMcAreaRadius); 291 292 TLatex text(0.31, 0.95, txt); 293 text.SetBit(TLatex::kTextNDC); 294 text.SetTextSize(0.04); 295 text.Paint();*/ 296 return; 297 } 298 if (TString(option)=="paint4") 299 { 300 //const TString txt = Form("A_{eff}=%.0fm^{2} A_{abs}=%.0fm^{2} r=%.0fm", 301 // GetCollectionAreaEff(), 302 // GetCollectionAreaAbs(), fMcAreaRadius); 288 if (TString(option)=="paint4" && fMcAreaRadius>0) 289 { 303 290 const TString txt = MString::Format("r_{max}=%.0fm --> A_{max}=%.0fm^{2}", 304 291 fMcAreaRadius, GetCollectionAreaAbs()); … … 445 432 MH::SetBinomialErrors(*h, *h2, *h1); 446 433 #endif 447 h->SetNameTitle("Efficiency", " Combined cut and trigger efficiency");434 h->SetNameTitle("Efficiency", "Efficiency"); 448 435 h->SetDirectory(NULL); 449 AppendPad("paint3");436 //AppendPad("paint3"); 450 437 } 451 438 else … … 477 464 Bool_t MHCollectionArea::Finalize() 478 465 { 466 GetImpactMax(); 467 479 468 *fLog << all << "Maximum simulated impact found: " << fMcAreaRadius << "m" << endl; 480 469 -
trunk/MagicSoft/Mars/mhflux/MHCollectionArea.h
r9153 r9359 16 16 class MMcEvt; 17 17 class MParameterD; 18 class MMcRunHeader; 18 19 19 20 class MHCollectionArea : public MH … … 21 22 private: 22 23 MMcEvt *fMcEvt; //! 24 MMcRunHeader *fHeader; //! 23 25 //MParameterD *fEnergy; //! 24 26 … … 35 37 Bool_t fIsExtern; 36 38 39 void GetImpactMax(); 37 40 void Calc(TH2D &hsel, TH2D &hall); 38 41 void CalcEfficiency();
Note:
See TracChangeset
for help on using the changeset viewer.