Changeset 6465 for trunk/MagicSoft/Mars/mtemp/mifae/macros
- Timestamp:
- 02/14/05 19:04:58 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/macros/computeCoeff.C
r6368 r6465 4 4 { 5 5 MEffAreaAndCoeffCalc calc; 6 calc.AddFile("/data/star_gamma_test.root"); 6 7 7 // initial MC files8 calc.AddFileToInitialMC("/data/camera_NCL/Gamma_zbin0_0_7_1000to1009_w0.root");9 calc.AddFileToInitialMC("/data/camera_NCL/Gamma_zbin0_0_7_1130to1139_w0.root");10 calc.AddFileToInitialMC("/data/camera_NCL/Gamma_zbin0_0_7_1520to1529_w0.root");11 calc.AddFileToInitialMC("/data/camera_NCL/Gamma_zbin0_90_7_1260to1269_w0.root");12 calc.AddFileToInitialMC("/data/camera_NCL/Gamma_zbin0_90_7_1390to1399_w0.root");13 calc.AddFileToInitialMC("/data/camera_NCL/Gamma_zbin0_90_7_1650to1659_w0.root");14 15 16 // files with remaining events after cuts (or where to apply cuts) see warning above17 calc.AddFileToFinalMC("/data/camera_CL/Gamma_zbin0_0_7_1000to1009_w0_cleaned4035.root");18 calc.AddFileToFinalMC("/data/camera_CL/Gamma_zbin0_0_7_1130to1139_w0_cleaned4035.root");19 calc.AddFileToFinalMC("/data/camera_CL/Gamma_zbin0_0_7_1520to1529_w0_cleaned4035.root");20 calc.AddFileToFinalMC("/data/camera_CL/Gamma_zbin0_90_7_1260to1269_w0_cleaned4035.root");21 calc.AddFileToFinalMC("/data/camera_CL/Gamma_zbin0_90_7_1390to1399_w0_cleaned4035.root");22 calc.AddFileToFinalMC("/data/camera_CL/Gamma_zbin0_90_7_1650to1659_w0_cleaned4035.root");23 24 25 // define the funtion of the desired spectrum26 calc.SetFunction("4.e9*pow(x,-2.6+1)",10.,10000.);27 calc.ComputeAllFactors();28 29 8 /************************************************/ 30 9 /* Build spectrum */ … … 32 11 /************************************************/ 33 12 const Int_t ebins = 10; // number of bins to build spectrum 34 const Int_t esubbins = 20; // number of subbins per big bin35 13 const Double_t emin=10; 36 const Double_t emax= 1000;14 const Double_t emax=600; 37 15 const Double_t logemin = TMath::Log10(emin); 38 16 const Double_t logemax = TMath::Log10(emax); 39 const Double_t de = (logemax-logemin)/ebins; // bin size (in log) 40 const Double_t desub = de/esubbins; // subbin size (in log) 41 const Int_t esbins = ebins*esubbins; // total number of subbins 17 calc.SetEbins(ebins); 18 // calc.SetEsubbins(1); 42 19 43 // remaining events after cuts 44 const UInt_t ncutfiles=6; 45 Char_t* cutName[ncutfiles]={ 46 "/data/camera_CL/Gamma_zbin0_0_7_1000to1009_w0_cleaned4035.root", 47 "/data/camera_CL/Gamma_zbin0_0_7_1130to1139_w0_cleaned4035.root", 48 "/data/camera_CL/Gamma_zbin0_0_7_1520to1529_w0_cleaned4035.root", 49 "/data/camera_CL/Gamma_zbin0_90_7_1260to1269_w0_cleaned4035.root", 50 "/data/camera_CL/Gamma_zbin0_90_7_1390to1399_w0_cleaned4035.root", 51 "/data/camera_CL/Gamma_zbin0_90_7_1650to1659_w0_cleaned4035.root" 52 }; 20 // define the funtion of the desired spectrum 21 calc.SetFunction("4.e9*pow(x,-2.6+1)",emin,emax); 22 calc.ComputeAllFactors(); 23 24 const UInt_t ncutfiles=1; 25 Char_t* cutName[ncutfiles]={"/data/star_gamma_test.root"}; 53 26 54 27 TChain* ccut = new TChain("Events"); 55 28 for(Int_t i = 0; i < ncutfiles; i++) 56 29 ccut->Add(cutName[i]); 57 ccut->SetAlias("logestenergy","log10(MHillas.fSize/15.)"); 58 const Int_t nentries = Int_t(ccut->GetEntries()); 59 60 MHillas* hillas; 61 MMcEvt* mcevt; 62 ccut->SetBranchStatus("*",0); 63 ccut->SetBranchStatus("MHillas.*",1); 64 ccut->SetBranchStatus("MMcEvt.*",1); 65 ccut->SetBranchAddress("MHillas.",&hillas); 66 ccut->SetBranchAddress("MMcEvt.",&mcevt); 30 ccut->SetAlias("logestenergy","log10(MHillas.fSize/0.18/15.)"); 31 ccut->SetAlias("theta","MMcEvt.fTelescopeTheta*180./3.14159"); 67 32 68 33 TH1D* hspec = new TH1D("hspec","Spectrum",ebins,logemin,logemax); 69 34 hspec->Sumw2(); 35 ccut->Draw("logestenergy>>hspec","theta<10","goff"); 70 36 71 for(Int_t i=0;i< nentries;i++)37 for(Int_t i=0;i<ebins;i++) 72 38 { 73 ccut->GetEntry(i); 74 75 // OJO!! Estimated energy will be taken directly from some input container 76 Float_t estim = hillas->GetSize()/15.; 77 78 UInt_t effabin = UInt_t((TMath::Log10(estim)-logemin)/desub); 79 UInt_t coefbin = UInt_t((TMath::Log10(estim)-logemin)/de); 80 81 Float_t effa = calc.GetEffectiveAreaHisto()->GetBinContent(effabin+1,1); 82 Float_t unfold = calc.GetCoefficientHisto()->GetBinContent(coefbin+1,1); 83 39 const Float_t uncorrval = hspec->GetBinContent(i+1); 40 const Float_t effa = calc.GetEffectiveAreaHisto()->GetBinContent(i+1,1); 41 const Float_t unfold = calc.GetCoefficientHisto()->GetBinContent(i+1,1); 42 Float_t corrval; 84 43 if(effa) 85 hspec->Fill(TMath::Log10(estim),unfold/effa*1e9); 86 } 44 corrval = uncorrval*unfold/effa; 45 else 46 corrval = 0; 47 hspec->SetBinContent(i+1,corrval); 48 } 87 49 88 50 // SAVE RESULTS
Note:
See TracChangeset
for help on using the changeset viewer.