File indexing completed on 2024-04-06 12:18:49
0001 {
0002 #include <strstream.h>
0003 #include <iomanip.h>
0004
0005 TH1F::SetDefaultSumw2();
0006
0007
0008 Double_t MCEtCut = 0.;
0009 Double_t EtCut = 20.;
0010 Double_t IEcalCut = 2.5;
0011 Double_t IHcalBarrelCut = 8.;
0012 Double_t IHcalEndcapCut = 6.;
0013 Double_t ItrackCut = 3.;
0014
0015
0016 TString MCEtCutString = "PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEt > ";
0017 MCEtCutString += MCEtCut;
0018 TString l1MatchCutString = "PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.l1Match";
0019 TString EtCutString = "PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.Et > ";
0020 EtCutString += EtCut;
0021 TString IEcalCutString = "PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.IEcal < ";
0022 IEcalCutString += IEcalCut;
0023 TString IHcalCutString = "(PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.IHcal < ";
0024 IHcalCutString += IHcalBarrelCut;
0025 IHcalCutString += " && fabs(PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.eta) < 1.5) || (PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.IHcal < ";
0026 IHcalCutString += IHcalEndcapCut;
0027 IHcalCutString += " && fabs(PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.eta) > 1.5 && fabs(PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.eta) < 2.5)";
0028 TString ItrackCutString = "PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.Itrack < ";
0029 ItrackCutString += ItrackCut;
0030
0031 TString l1MatchCutPathString = "(" + l1MatchCutString + ")";
0032 TString EtCutPathString = "(" + l1MatchCutPathString + ")&&(" + EtCutString + ")";
0033 TString IEcalCutPathString = "(" + EtCutPathString + ")&&(" + IEcalCutString + ")";
0034 TString IHcalCutPathString = "(" + IEcalCutPathString + ")&&(" + IHcalCutString + ")";
0035 TString ItrackCutPathString = "(" + IHcalCutPathString + ")&&(" + ItrackCutString + ")";
0036
0037 TString l1MatchCutPathMCString = "(" + l1MatchCutString + ")&&(" + MCEtCutString + ")";
0038 TString EtCutPathMCString = "(" + EtCutPathString + ")&&(" + MCEtCutString + ")";
0039 TString IEcalCutPathMCString = "(" + IEcalCutPathString + ")&&(" + MCEtCutString + ")";
0040 TString IHcalCutPathMCString = "(" + IHcalCutPathString + ")&&(" + MCEtCutString + ")";
0041 TString ItrackCutPathMCString = "(" + ItrackCutPathString + ")&&(" + MCEtCutString + ")";
0042
0043 TFile *file = new TFile("../test/ZEE-HLTEgamma.root");
0044 TTree *allEvents = Events->CloneTree();
0045
0046 TH1F *l1NumEt = new TH1F("l1NumEt", "Efficiency vs. Et", 100, 0, 150);
0047 allEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEt>>l1NumEt",MCEtCutString);
0048 TH1F *l1NumEta = new TH1F("l1NumEta", "Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0049 allEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEta>>l1NumEta",MCEtCutString);
0050 TH1F *l1NumPhi = new TH1F("l1NumPhi", "Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0051 allEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcPhi>>l1NumPhi",MCEtCutString);
0052 Long64_t total = allEvents->GetEntries();
0053 Long64_t pass0 = allEvents->GetEntries("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.Et > -999.");
0054
0055
0056 TTree *l1MatchEvents = CopyTreeMulti(l1MatchCutPathString, allEvents, 2);
0057
0058 TH1F *l1MatchNumEt = new TH1F("l1MatchNumEt", "L1 Match Efficiency vs. Et", 100, 0, 150);
0059 l1MatchEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEt>>l1MatchNumEt",l1MatchCutPathMCString);
0060 TH1F *l1MatchHistEt = new TH1F("l1MatchHistEt", "L1 Match Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0061 l1MatchHistEt->Divide(l1MatchNumEt, l1NumEt, 1, 1, "B");
0062
0063 TH1F *l1MatchNumEta = new TH1F("l1MatchNumEta", "L1 Match Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0064 l1MatchEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEta>>l1MatchNumEta",l1MatchCutPathMCString);
0065 TH1F *l1MatchHistEta = new TH1F("l1MatchHistEta", "L1 Match Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0066 l1MatchHistEta->Divide(l1MatchNumEta, l1NumEta, 1, 1, "B");
0067
0068 TH1F *l1MatchNumPhi = new TH1F("l1MatchNumPhi", "L1 Match Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0069 l1MatchEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcPhi>>l1MatchNumPhi",l1MatchCutPathMCString);
0070 TH1F *l1MatchHistPhi = new TH1F("l1MatchHistPhi", "L1 Match Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0071 l1MatchHistPhi->Divide(l1MatchNumPhi, l1NumPhi, 1, 1, "B");
0072 Long64_t pass1 = l1MatchEvents->GetEntries();
0073
0074
0075 TTree *EtEvents = CopyTreeMulti(EtCutPathString, allEvents, 2);
0076
0077 TH1F *EtNumEt = new TH1F("EtNumEt", "Et Cut Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0078 EtEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEt>>EtNumEt",EtCutPathMCString);
0079 TH1F *EtHistEt = new TH1F("EtHistEt", "Et Cut Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0080 EtHistEt->Divide(EtNumEt, l1MatchNumEt, 1, 1, "B");
0081
0082 TH1F *EtNumEta = new TH1F("EtNumEta", "Et Cut Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0083 EtEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEta>>EtNumEta",EtCutPathMCString);
0084 TH1F *EtHistEta = new TH1F("EtHistEta", "Et Cut Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0085 EtHistEta->Divide(EtNumEta, l1MatchNumEta, 1, 1, "B");
0086
0087 TH1F *EtNumPhi = new TH1F("EtNumPhi", "Et Cut Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0088 EtEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcPhi>>EtNumPhi",EtCutPathMCString);
0089 TH1F *EtHistPhi = new TH1F("EtHistPhi", "Et Cut Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0090 EtHistPhi->Divide(EtNumPhi, l1MatchNumPhi, 1, 1, "B");
0091 Long64_t pass2 = EtEvents->GetEntries();
0092
0093 TTree *IEcalEvents = CopyTreeMulti(IEcalCutPathString, allEvents, 2);
0094
0095 TH1F *IEcalNumEt = new TH1F("IEcalNumEt", "Ecal Isolation Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0096 IEcalEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEt>>IEcalNumEt",IEcalCutPathMCString);
0097 TH1F *IEcalHistEt = new TH1F("IEcalHistEt", "Ecal Isolation Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0098 IEcalHistEt->Divide(IEcalNumEt, EtNumEt, 1, 1, "B");
0099
0100 TH1F *IEcalNumEta = new TH1F("IEcalNumEta", "Ecal Isolation Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0101 IEcalEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEta>>IEcalNumEta",IEcalCutPathMCString);
0102 TH1F *IEcalHistEta = new TH1F("IEcalHistEta", "Ecal Isolation Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0103 IEcalHistEta->Divide(IEcalNumEta, EtNumEta, 1, 1, "B");
0104
0105 TH1F *IEcalNumPhi = new TH1F("IEcalNumPhi", "Ecal Isolation Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0106 IEcalEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcPhi>>IEcalNumPhi",IEcalCutPathMCString);
0107 TH1F *IEcalHistPhi = new TH1F("IEcalHistPhi", "Ecal Isolation Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0108 IEcalHistPhi->Divide(IEcalNumPhi, EtNumPhi, 1, 1, "B");
0109 Long64_t pass3 = IEcalEvents->GetEntries();
0110
0111 TTree *IHcalEvents = CopyTreeMulti(IHcalCutPathString, allEvents, 2);
0112
0113 TH1F *IHcalNumEt = new TH1F("IHcalNumEt", "Hcal Isolation Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0114 IHcalEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEt>>IHcalNumEt",IHcalCutPathMCString);
0115 TH1F *IHcalHistEt = new TH1F("IHcalHistEt", "Hcal Isolation Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0116 IHcalHistEt->Divide(IHcalNumEt, EtNumEt, 1, 1, "B");
0117
0118 TH1F *IHcalNumEta = new TH1F("IHcalNumEta", "Hcal Isolation Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0119 IHcalEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEta>>IHcalNumEta",IHcalCutPathMCString);
0120 TH1F *IHcalHistEta = new TH1F("IHcalHistEta", "Hcal Isolation Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0121 IHcalHistEta->Divide(IHcalNumEta, EtNumEta, 1, 1, "B");
0122
0123 TH1F *IHcalNumPhi = new TH1F("IHcalNumPhi", "Hcal Isolation Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0124 IHcalEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcPhi>>IHcalNumPhi",IHcalCutPathMCString);
0125 TH1F *IHcalHistPhi = new TH1F("IHcalHistPhi", "Hcal Isolation Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0126 IHcalHistPhi->Divide(IHcalNumPhi, EtNumPhi, 1, 1, "B");
0127 Long64_t pass4 = IHcalEvents->GetEntries();
0128
0129 TTree *ItrackEvents = CopyTreeMulti(ItrackCutPathString, allEvents, 2);
0130
0131 TH1F *ItrackNumEt = new TH1F("ItrackNumEt", "Track Isolation Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0132 ItrackEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEt>>ItrackNumEt",ItrackCutPathMCString);
0133 TH1F *ItrackHistEt = new TH1F("ItrackHistEt", "Track Isolation Efficiency vs. Et;Et (GeV);Eff.", 100, 0, 150);
0134 ItrackHistEt->Divide(ItrackNumEt, EtNumEt, 1, 1, "B");
0135
0136 TH1F *ItrackNumEta = new TH1F("ItrackNumEta", "Track Isolation Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0137 ItrackEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcEta>>ItrackNumEta",ItrackCutPathMCString);
0138 TH1F *ItrackHistEta = new TH1F("ItrackHistEta", "Track Isolation Efficiency vs. eta;eta;Eff.", 100, -2.5, 2.5);
0139 ItrackHistEta->Divide(ItrackNumEta, EtNumEta, 1, 1, "B");
0140
0141 TH1F *ItrackNumPhi = new TH1F("ItrackNumPhi", "Track Isolation Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0142 ItrackEvents->Draw("PhotHLTCutVarss_hltCutVars_DoublePhots_EGAMMAHLT.obj.mcPhi>>ItrackNumPhi",ItrackCutPathMCString);
0143 TH1F *ItrackHistPhi = new TH1F("ItrackHistPhi", "Track Isolation Efficiency vs. phi;phi;Eff.", 100, 0, 6.2832);
0144 ItrackHistPhi->Divide(ItrackNumPhi, EtNumPhi, 1, 1, "B");
0145 Long64_t pass5 = ItrackEvents->GetEntries();
0146
0147 Double_t eff0 = (Double_t)pass0 / (Double_t)total;
0148 Double_t eff1 = (Double_t)pass1 / (Double_t)pass0;
0149 Double_t eff2 = (Double_t)pass2 / (Double_t)pass1;
0150 Double_t eff3 = (Double_t)pass3 / (Double_t)pass2;
0151 Double_t eff4 = (Double_t)pass4 / (Double_t)pass3;
0152 Double_t eff5 = (Double_t)pass5 / (Double_t)pass4;
0153 Double_t eff = (Double_t)pass5 / (Double_t)pass0;
0154
0155 cout.setf(ios::left);
0156 cout<<setw(25)<<"L1 Pass: "<<setw(15)<<pass0<<setw(25)<<"MC eta + L1 Efficiency: "<<eff0<<endl;
0157 cout<<setw(25)<<"L1 Match Pass: "<<setw(15)<<pass1<<setw(25)<<"L1 Match Efficiency: "<<eff1<<endl;
0158 cout<<setw(25)<<"Et Pass: "<<setw(15)<<pass2<<setw(25)<<"Et Efficiency: "<<setw(15)<<eff2<<endl;
0159 cout<<setw(25)<<"IEcal Pass: "<<setw(15)<<pass3<<setw(25)<<"IEcal Efficiency: "<<setw(15)<<eff3<<endl;
0160 cout<<setw(25)<<"IHcal Pass: "<<setw(15)<<pass4<<setw(25)<<"IHcal Efficiency: "<<setw(15)<<eff4<<endl;
0161 cout<<setw(25)<<"Itrack Pass: "<<setw(15)<<pass5<<setw(25)<<"Itrack Efficiency: "<<setw(15)<<eff5<<endl;
0162 cout<<"--"<<endl;
0163 cout<<"HLT Efficiency: "<<eff<<endl;
0164
0165 TCanvas *myCanvas = new TCanvas("myCanvas", "Double Photon Efficiencies vs. Et", 1500, 1000);
0166 myCanvas->Divide(3,2);
0167 myCanvas->cd(1);
0168 l1MatchHistEt->Draw("e");
0169 myCanvas->cd(2);
0170 EtHistEt->Draw("e");
0171 myCanvas->cd(3);
0172 IEcalHistEt->Draw("e");
0173 myCanvas->cd(4);
0174 IHcalHistEt->Draw("e");
0175 myCanvas->cd(5);
0176 ItrackHistEt->Draw("e");
0177 myCanvas->Print("images/EffVEtDP.gif");
0178 myCanvas->cd(1);
0179 l1MatchHistEta->Draw("e");
0180 myCanvas->cd(2);
0181 EtHistEta->Draw("e");
0182 myCanvas->cd(3);
0183 IEcalHistEta->Draw("e");
0184 myCanvas->cd(4);
0185 IHcalHistEta->Draw("e");
0186 myCanvas->cd(5);
0187 ItrackHistEta->Draw("e");
0188 myCanvas->Print("images/EffVEtaDP.gif");
0189 myCanvas->cd(1);
0190 l1MatchHistPhi->Draw("e");
0191 myCanvas->cd(2);
0192 EtHistPhi->Draw("e");
0193 myCanvas->cd(3);
0194 IEcalHistPhi->Draw("e");
0195 myCanvas->cd(4);
0196 IHcalHistPhi->Draw("e");
0197 myCanvas->cd(5);
0198 ItrackHistPhi->Draw("e");
0199 myCanvas->Print("images/EffVPhiDP.gif");
0200
0201 file->Close();
0202 gROOT->Reset();
0203 }