6 |
|
#include <Math/LorentzVector.h> |
7 |
|
|
8 |
|
#include "TString.h" |
9 |
+ |
#include "TH1.h" |
10 |
+ |
#include "TH1D.h" |
11 |
|
#include "TTree.h" |
12 |
|
#include "TFile.h" |
13 |
|
|
29 |
|
//--------------------------------------------------- Structure to store the whole event information in order to pass it to functions |
30 |
|
struct eventInfo{ |
31 |
|
vector<string> *DESYtriggerElMatchedTriggerFilter; |
32 |
< |
vector<string> *DESYtriggerMuMatchedTriggerFilter; |
32 |
> |
vector<string> *DESYtriggerMuMatchedTriggerFilter; |
33 |
|
map<string, string> *DESYtriggerNameMap; |
34 |
|
vector<int> *electronCharge; |
35 |
|
vector<LorentzM> *electronP4; |
41 |
|
vector<LorentzM> *muonP4; |
42 |
|
map<string, int> *prescaled; |
43 |
|
int Run; |
44 |
+ |
int PUInter; |
45 |
|
double PUWeight; |
46 |
|
map<string, bool> *triggered; |
47 |
+ |
vector<vector<TString> > triggerFilterEl; |
48 |
+ |
vector<vector<TString> > triggerFilterMu; |
49 |
|
double Weight; |
50 |
|
}; |
51 |
|
|
47 |
– |
|
52 |
|
//--------------------------------------------------- functions |
53 |
|
// void init(TString inputFileName); |
54 |
+ |
void handleTriggerMatchingInfo(eventInfo& evt); |
55 |
|
void initBranches(TTree *tree, eventInfo &event); |
56 |
< |
void initVariables(); |
56 |
> |
void investigateTriggerFilterMu(eventInfo& evt, map<TString, plotMaker> &plot, TString filterName); |
57 |
|
void Loop(TString inputFileName, TString outputFileName); |
58 |
+ |
void makeEfficiencyPlots(map<TString, plotMaker> &plot); |
59 |
|
void plotHistograms(eventInfo& evt, map<TString, plotMaker> &plot); |
60 |
|
void printElectronInfo(eventInfo& evt, ostream& os=cout); |
61 |
|
void printEventInfo(eventInfo& evt, ostream& os=cout); |
62 |
|
void printMuonInfo(eventInfo& evt, ostream& os=cout); |
63 |
+ |
void setEfficiencyErrors(TH1D* &eff, TH1D* &h_tag, TH1D* &h_probe); |
64 |
+ |
|
65 |
+ |
//--------------------------------------------------- global Variables |
66 |
+ |
vector<string> triggerFilterToCheckMu; |
67 |
+ |
vector<string> triggerFilterToCheckEl; |
68 |
+ |
//---------------------------------------- |
69 |
+ |
const Int_t binPt = 25; |
70 |
+ |
const Double_t lowPt = 0.; |
71 |
+ |
const Double_t upPt = 250.; |
72 |
+ |
//---------------------------------------- |
73 |
+ |
const Int_t binEta = 50; |
74 |
+ |
const Double_t lowEta = -2.5; |
75 |
+ |
const Double_t upEta = 2.5; |
76 |
+ |
//---------------------------------------- |
77 |
+ |
const Int_t binPU = 64; |
78 |
+ |
const Double_t lowPU = 0.; |
79 |
+ |
const Double_t upPU = 64.; |
80 |
+ |
|
81 |
|
|
82 |
|
|
83 |
|
//================================================================================= triggerStudy |
84 |
|
//main function which will be called |
85 |
|
//here, it is possible to run over multiple files and to estimate trigger efficiencies for different samples |
86 |
< |
void triggerStudy(TString inputFileName = "SusyCAF_Tree_9_1_UMa_out_tree.root"){ |
87 |
< |
// init(inputFileName); |
88 |
< |
//Loop(inputFileName, "TTJets.root"); |
89 |
< |
// Loop("SusyCAF_Tree_n722_3403013856_out_tree.root", "TTJets.root"); |
90 |
< |
Loop("TTJets_SUMMER12_TrigStudy-mu_noTail_Tree.root", "TTJets.root"); |
86 |
> |
void triggerStudy(TString inputFileName = "TTJets_mu_tree.root"){ |
87 |
> |
triggerFilterToCheckMu.push_back("hltL1sMu16Eta2p1"); |
88 |
> |
triggerFilterToCheckMu.push_back("hltL2fL1sMu16Eta2p1L1f0L2Filtered16Q"); |
89 |
> |
triggerFilterToCheckMu.push_back("hltL3crIsoL1sMu16Eta2p1L1f0L2f16QL3f20L3crIsoFiltered10"); |
90 |
> |
triggerFilterToCheckMu.push_back("hltIsoMu202p1TriCentralPFJet30MuCleaned"); |
91 |
> |
triggerFilterToCheckMu.push_back("hltIsoMu202p1TriCentralPFJet303020MuCleaned"); |
92 |
> |
triggerFilterToCheckMu.push_back("hltDiMuonGlb22Trk8DzFiltered0p2"); |
93 |
> |
triggerFilterToCheckMu.push_back("hltL3crIsoL1sMu14Eta2p1L1f0L2f16QL3f20L3crIsoRhoFiltered0p15"); |
94 |
> |
|
95 |
> |
|
96 |
> |
// triggerFilterToCheckEl.push_back("hltL1sL1SingleEG20orL1SingleEG22"); |
97 |
> |
// triggerFilterToCheckEl.push_back("hltEle25CaloIdVTTrkIdTCaloIsoTTrkIsoTTrackIsoFilter"); |
98 |
> |
// triggerFilterToCheckEl.push_back("hltEle25CaloIdVTCaloIsoTTrkIdTTrkIsoTTriCentralPFJet30EleCleaned"); |
99 |
> |
// triggerFilterToCheckEl.push_back("hltEle25CaloIdVTCaloIsoTTrkIdTTrkIsoTTriCentralPFNoPUJet30EleCleaned"); |
100 |
> |
// triggerFilterToCheckEl.push_back("hltEle25CaloIdVTCaloIsoTTrkIdTTrkIsoTTriCentralPFNoPUJet303020EleCleaned"); |
101 |
> |
|
102 |
> |
TH1::SetDefaultSumw2(); |
103 |
> |
|
104 |
> |
//Loop(inputFileName, outputFileName); |
105 |
> |
|
106 |
> |
inputFileName = "TTJets_mu_tree.root"; |
107 |
> |
inputFileName = "TTJets_el_tree.root"; |
108 |
> |
inputFileName = "DYJets_mu_tree.root"; |
109 |
> |
inputFileName = "DYJets_el_tree.root"; |
110 |
> |
|
111 |
> |
inputFileName = "TTJets_SUMMER12_TrigStudy-mu_noTail_Tree.root"; |
112 |
> |
//inputFileName = "TTJets_SUMMER12_TrigStudy-el_noTail_Tree.root"; |
113 |
> |
inputFileName = "DYJets_M-50_TrigStudy-mu_noTail_Tree.root"; |
114 |
> |
//inputFileName = "DYJets_M-50_TrigStudy-el_noTail_Tree.root"; |
115 |
> |
|
116 |
> |
TString dir =""; |
117 |
> |
dir ="/scratch/hh/current/cms/user/mstein/output/"; |
118 |
|
|
119 |
+ |
Loop(dir + inputFileName, "out_"+inputFileName); |
120 |
+ |
|
121 |
+ |
|
122 |
+ |
|
123 |
+ |
//Loop("/scratch/hh/current/cms/user/mstein/output/TTJets_SUMMER12_TrigStudy-mu_noTail_Tree.root", "out_TTJets_SUMMER12_TrigStudy-mu_noTail_Tree.root"); |
124 |
+ |
|
125 |
+ |
// init(inputFileName); |
126 |
+ |
// Loop("SusyCAF_Tree_n722_3403013856_out_tree.root", "TTJets.root"); |
127 |
+ |
//Loop("TTJets_SUMMER12_TrigStudy-mu_noTail_Tree.root", "TTJets.root"); |
128 |
|
//Loop(inputFileName, "Run2012C.root"); |
129 |
|
} |
130 |
|
|
134 |
|
plot["event"].addh1d("muMultiplicity", "muMultiplicity", "muon multiplicity", "events", 5, -0.5, 4.5, evt.muonP4->size(), evt.Weight); |
135 |
|
plot["event"].addh1d("elMultiplicity", "elMultiplicity", "electron multiplicity", "events", 5, -0.5, 4.5, evt.electronP4->size(), evt.Weight); |
136 |
|
plot["event"].addh1d("jetMultiplicity", "jetMultiplicity", "jet multiplicity", "events", 10, -0.5, 9.5, evt.jetP4->size(), evt.Weight); |
137 |
< |
|
138 |
< |
|
137 |
> |
|
138 |
> |
for(Int_t i=0,N=triggerFilterToCheckMu.size(); i<N; ++i){ |
139 |
> |
investigateTriggerFilterMu(evt, plot, triggerFilterToCheckMu.at(i)); |
140 |
> |
} |
141 |
> |
// for(Int_t i=0,N=triggerFilterToCheckEl.size(); i<N; ++i){ |
142 |
> |
// investigateTriggerFilterEl(evt, plot, triggerFilterToCheckEl.at(i)); |
143 |
> |
// } |
144 |
> |
} |
145 |
> |
|
146 |
> |
|
147 |
> |
//================================================================================= investigateTriggerFilterMu |
148 |
> |
// eff = 2*NTT / (2*NTT + NTP) |
149 |
> |
void investigateTriggerFilterMu(eventInfo& evt, map<TString, plotMaker> &plot, TString filterName){ |
150 |
> |
//create vector which stores, if a muon is matched to the trigger filter with the name "filterName" |
151 |
> |
vector<bool> matched; |
152 |
> |
vector<int> probeIndex; |
153 |
> |
for(Int_t i=0,N=evt.muonP4->size(); i<N; ++i){ |
154 |
> |
matched.push_back(false); |
155 |
> |
for(Int_t j=0,M=evt.triggerFilterMu.at(i).size(); j<M; ++j){ |
156 |
> |
if(filterName == evt.triggerFilterMu.at(i).at(j)){ |
157 |
> |
matched.back() = true; |
158 |
> |
break; |
159 |
> |
} |
160 |
> |
} |
161 |
> |
if(!matched.at(i)) probeIndex.push_back(i); |
162 |
> |
} |
163 |
|
|
164 |
+ |
if(probeIndex.size()>2){ |
165 |
+ |
cout<<"WARNING: Something is awkward with the number of Probe leptons: " << probeIndex.size() << endl; |
166 |
+ |
cout<<"The number of probe leptons is expected to be 1 or 2, because here a T&P method is applied!" << endl; |
167 |
+ |
} |
168 |
+ |
else if(probeIndex.size()==2) return; //make only plots if at least one Tag exists in an event |
169 |
|
|
170 |
< |
// for(Int_t i=0,N=muonP4->size(); i<N; ++i){ |
171 |
< |
// //cout<<"muonP4["<<i<<"] = " << (*muonP4)[i]<< endl; |
172 |
< |
// // myPlot.addh1d("MuPt", "MuPt", "p_T(#mu) [GeV]", "events", 100, 0., 300., muonP4->at(i).pt(), Weight); |
173 |
< |
// //myPlot.h1d ("MuPt", "MuPt", "p_T(#mu) [GeV]", "events", 100, 0., 300., muonP4->at(i).pt(), Weight); |
174 |
< |
// |
175 |
< |
// //cout<<"myPlot.h1d.size() = " << myPlot.h1d.size() << endl; |
176 |
< |
// |
177 |
< |
// } |
170 |
> |
//Fill the Tag histograms |
171 |
> |
//here, we have TWO Tag leptons -> use BOTH for the efficiency |
172 |
> |
if(probeIndex.size()==0){ |
173 |
> |
for(Int_t i=0,N=evt.muonP4->size(); i<N; ++i){ |
174 |
> |
plot[filterName].addh1d("pt_tag", "pt_tag", "p_{T}(tag) [GeV/c]", "events", binPt, lowPt, upPt, evt.muonP4->at(i).Pt(), evt.Weight); |
175 |
> |
plot[filterName].addh1d("eta_tag", "eta_tag", "#eta(tag)", "events", binEta, lowEta, upEta, evt.muonP4->at(i).eta(), evt.Weight); |
176 |
> |
} |
177 |
> |
//the factor of '2' is due to the fact, that there are two matched tag leptons |
178 |
> |
plot[filterName].addh1d("PUVertices_tag", "PUVertices_tag", "number of primary vertices (tag)", "events", binPU, lowPU, upPU, evt.PUInter, 2*evt.Weight); |
179 |
> |
} |
180 |
> |
|
181 |
> |
//Fill the Probe histograms |
182 |
> |
//here, we have ONE Tag lepton -> the probe is NOT matched to the trigger filter |
183 |
> |
if(probeIndex.size()==1){ |
184 |
> |
plot[filterName].addh1d("pt_probe", "pt_probe", "p_{T}(probe) [GeV/c]", "events", binPt, lowPt, upPt, evt.muonP4->at(probeIndex.back()).pt(), evt.Weight); |
185 |
> |
plot[filterName].addh1d("eta_probe", "eta_probe", "#eta(probe)", "events", binEta, lowEta, upEta, evt.muonP4->at(probeIndex.back()).eta(), evt.Weight); |
186 |
> |
plot[filterName].addh1d("PUVertices_probe", "PUVertices_probe", "number of primary vertices (probe)", "events", binPU, lowPU, upPU, evt.PUInter, evt.Weight); |
187 |
> |
} |
188 |
> |
} |
189 |
> |
|
190 |
> |
|
191 |
> |
//================================================================================= makeEfficiencyPlots |
192 |
> |
//eff = tag/(tag+probe) |
193 |
> |
void makeEfficiencyPlots(map<TString, plotMaker> &plot){ |
194 |
> |
cout<<"----------> Create efficiency histograms"<<endl; |
195 |
> |
|
196 |
> |
vector<string> allTriggerFiltersToCheck = triggerFilterToCheckMu; |
197 |
> |
for(Int_t i=0,N=triggerFilterToCheckEl.size(); i<N; ++i){ |
198 |
> |
allTriggerFiltersToCheck.push_back(triggerFilterToCheckEl.at(i)); |
199 |
> |
} |
200 |
> |
vector<string> histNames; |
201 |
> |
histNames.push_back("pt_tag"); |
202 |
> |
histNames.push_back("eta_tag"); |
203 |
> |
histNames.push_back("PUVertices_tag"); |
204 |
> |
|
205 |
> |
for(Int_t i=0,N=allTriggerFiltersToCheck.size(); i<N; ++i){ |
206 |
> |
TString triggerFilter = allTriggerFiltersToCheck.at(i); |
207 |
> |
for(Int_t j=0,M=histNames.size(); j<M; ++j){ |
208 |
> |
TString tagName = histNames.at(j); |
209 |
> |
TString probeName = histNames.at(j); |
210 |
> |
TString effName = histNames.at(j); |
211 |
> |
probeName.ReplaceAll("tag", "probe"); |
212 |
> |
effName.ReplaceAll("tag", "eff"); |
213 |
> |
if(plot[triggerFilter].isNewh1d(tagName)) continue; |
214 |
> |
if(plot[triggerFilter].isNewh1d(probeName)) continue; |
215 |
> |
|
216 |
> |
TH1D *h_tag = (TH1D*)(plot[triggerFilter].h1d[tagName])->Clone(); |
217 |
> |
TH1D *h_probe = (TH1D*)(plot[triggerFilter].h1d[probeName])->Clone(); |
218 |
> |
TH1D *den = (TH1D*)(h_tag)->Clone(); |
219 |
> |
den->Add((TH1D*)(h_probe)->Clone()); |
220 |
> |
|
221 |
> |
TH1D *eff = (TH1D*)(h_tag)->Clone(); |
222 |
> |
eff->Divide(den); |
223 |
> |
setEfficiencyErrors(eff, h_tag, h_probe); |
224 |
> |
|
225 |
> |
eff->SetName(effName); |
226 |
> |
eff->SetTitle(effName); |
227 |
> |
|
228 |
> |
TString xTitle_eff = eff->GetXaxis()->GetTitle(); |
229 |
> |
xTitle_eff.ReplaceAll("(tag)",""); |
230 |
> |
eff->GetXaxis()->SetTitle(xTitle_eff); |
231 |
> |
eff->GetYaxis()->SetTitle("efficiency"); |
232 |
> |
//eff->SetAxisRange(0.,1.,"Y"); |
233 |
> |
plot[triggerFilter].addh1d(eff); |
234 |
> |
} |
235 |
> |
} |
236 |
> |
} |
237 |
> |
|
238 |
> |
|
239 |
> |
//================================================================================= setEfficiencyErrors |
240 |
> |
// f(eff) = t/(t+p) |
241 |
> |
// df/dt = 1/(t+p) - t/(t+p)^2 |
242 |
> |
// df/dp = - t/(t+p)^2 |
243 |
> |
// eff_sig = sqrt(t_sig^2*(df/dt)^2 + p_sig^2*(df/dp)^2) |
244 |
> |
void setEfficiencyErrors(TH1D* &eff, TH1D* &h_tag, TH1D* &h_probe){ |
245 |
> |
if(h_tag->GetNbinsX() != h_probe->GetNbinsX()){ |
246 |
> |
cout<<"WARNING: the number of bins of the tag and probe histograms differ! The efficiency calculation might be depricated!"<<endl; |
247 |
> |
cout<<"Number of bins (Tag | Probe): " << h_tag->GetNbinsX() << " | " << h_probe->GetNbinsX() << endl; |
248 |
> |
} |
249 |
> |
if(h_tag->GetXaxis()->GetXmax() != h_probe->GetXaxis()->GetXmax()){ |
250 |
> |
cout<<"WARNING: the upper x-range of the tag and probe histograms differ! The efficiency calculation might be depricated!"<<endl; |
251 |
> |
cout<<"Number of bins (Tag | Probe): " << h_tag->GetXaxis()->GetXmax() << " | " << h_probe->GetXaxis()->GetXmax() << endl; |
252 |
> |
} |
253 |
> |
if(h_tag->GetXaxis()->GetXmin() != h_probe->GetXaxis()->GetXmin()){ |
254 |
> |
cout<<"WARNING: the lower x-range of the tag and probe histograms differ! The efficiency calculation might be depricated!"<<endl; |
255 |
> |
cout<<"Number of bins (Tag | Probe): " << h_tag->GetXaxis()->GetXmin() << " | " << h_probe->GetXaxis()->GetXmin() << endl; |
256 |
> |
} |
257 |
> |
//loop over single bins of histograms an set the efficiency error |
258 |
> |
for(Int_t i=1,N=h_tag->GetNbinsX(); i<=N; ++i){ |
259 |
> |
Double_t t = h_tag ->GetBinContent(i); |
260 |
> |
Double_t p = h_probe->GetBinContent(i); |
261 |
> |
Double_t t_sig = h_tag ->GetBinError(i); |
262 |
> |
Double_t p_sig = h_probe->GetBinError(i); |
263 |
> |
|
264 |
> |
if(eff->GetBinContent(i)==0.) continue; |
265 |
|
|
266 |
+ |
Double_t dedt = 1/(t+p)-t/((t+p)*(t+p)); |
267 |
+ |
Double_t dedp = -t/((t+p)*(t+p)); |
268 |
+ |
|
269 |
+ |
Double_t eff_sig = sqrt(t_sig*t_sig*dedt*dedt + p_sig*p_sig*dedp*dedp); |
270 |
+ |
eff->SetBinError(i, eff_sig); |
271 |
+ |
} |
272 |
|
} |
273 |
|
|
274 |
|
|
276 |
|
void Loop(TString inputFileName, TString outputFileName){ |
277 |
|
//timer.Start("Loop"); |
278 |
|
TString treeName = "trigStudyTree"; |
279 |
< |
map<TString, plotMaker> myPlots; |
98 |
< |
plotMaker myPlot; |
279 |
> |
map<TString, plotMaker> myPlots; |
280 |
|
|
281 |
|
//--------------------------------------------------- open file and read in leafs |
282 |
|
TFile* inputFile = new TFile(inputFileName,"READ"); |
283 |
|
if (!inputFile->IsOpen()) std::cout<<"Could not open file "<<inputFileName<<std::endl; |
284 |
|
TTree* inputTree= (TTree*)inputFile->Get(treeName); |
285 |
< |
inputTree->SetBranchStatus("*",0); |
105 |
< |
|
285 |
> |
|
286 |
|
eventInfo event; |
287 |
|
initBranches(inputTree, event); |
288 |
|
//--------------------------------------------------- Event Loop |
297 |
|
cout<<"-------------------------------------------------------------------------------"<<endl; |
298 |
|
cout<<endl; |
299 |
|
cout<<"Looping over events..."<<endl; |
300 |
+ |
// nEvents=50000; |
301 |
|
for (int iEvent=0; iEvent<nEvents; ++iEvent){ |
302 |
|
tools::progress(iEvent); |
303 |
|
inputTree->GetEntry(iEvent); |
304 |
+ |
handleTriggerMatchingInfo(event); |
305 |
|
// printEventInfo(event); |
306 |
< |
// printMuonInfo(event); |
307 |
< |
// printElectronInfo(event); |
306 |
> |
// printMuonInfo(event); |
307 |
> |
//printElectronInfo(event); |
308 |
|
plotHistograms(event, myPlots); |
309 |
|
//tools::progressReset(); |
310 |
|
} |
311 |
|
|
312 |
< |
// for (int iEvent=0; iEvent<3000; ++iEvent){ |
131 |
< |
// tools::progress(iEvent); |
132 |
< |
// inputTree->GetEntry(iEvent); |
133 |
< |
// //printEventInfo(event); |
134 |
< |
// //printMuonInfo(event); |
135 |
< |
// //printElectronInfo(event); |
136 |
< |
// //plotHistograms(event, myPlots); |
137 |
< |
// //tools::progressReset(); |
138 |
< |
// } |
139 |
< |
|
312 |
> |
makeEfficiencyPlots(myPlots); |
313 |
|
//--------------------------------------------------- Save all histograms in the appropriate folders |
314 |
|
TString option="RECREATE"; |
315 |
|
for(typename map<TString, plotMaker>::iterator it = myPlots.begin(); it != myPlots.end(); ++it){ |
320 |
|
} |
321 |
|
|
322 |
|
|
323 |
+ |
//================================================================================= handleTriggerMatchingInfo |
324 |
+ |
// converting the trigger Info to a more practical format: vector<string> --> vector<vector<string> > |
325 |
+ |
void handleTriggerMatchingInfo(eventInfo& evt){ |
326 |
+ |
evt.triggerFilterEl.clear(); |
327 |
+ |
evt.triggerFilterMu.clear(); |
328 |
+ |
//make simple check |
329 |
+ |
|
330 |
+ |
if(evt.electronP4->size() != evt.DESYtriggerElMatchedTriggerFilter->size()){ |
331 |
+ |
cout<<"WARNING: Size of electron vector does not correspond to size of matching info vector!"<<endl; |
332 |
+ |
cout<<"evt.electronP4->size() = " << evt.electronP4->size() << endl; |
333 |
+ |
cout<<"evt.DESYtriggerElMatchedTriggerFilter->size() = " << evt.DESYtriggerElMatchedTriggerFilter->size() << endl; |
334 |
+ |
|
335 |
+ |
tools::printVector("evt.electronP4", *(evt.electronP4)); |
336 |
+ |
tools::printVector("evt.DESYtriggerElMatchedTriggerFilter", *(evt.DESYtriggerElMatchedTriggerFilter)); |
337 |
+ |
|
338 |
+ |
return; |
339 |
+ |
} |
340 |
+ |
if(evt.muonP4->size() != evt.DESYtriggerMuMatchedTriggerFilter->size()){ |
341 |
+ |
cout<<"WARNING: Size of muon vector does not correspond to size of matching info vector!"<<endl; |
342 |
+ |
cout<<"evt.muonP4->size() = " << evt.muonP4->size() << endl; |
343 |
+ |
cout<<"evt.DESYtriggerMuMatchedTriggerFilter->size() = " << evt.DESYtriggerMuMatchedTriggerFilter->size() << endl; |
344 |
+ |
return; |
345 |
+ |
} |
346 |
+ |
|
347 |
+ |
for(Int_t i=0,N=evt.electronP4->size(); i<N; ++i){ |
348 |
+ |
evt.triggerFilterEl.push_back(tools::splitToWords(evt.DESYtriggerElMatchedTriggerFilter->at(i), ";")); |
349 |
+ |
//cout<<"evt.DESYtriggerElMatchedTriggerFilter->at("<<i<<") = " << evt.DESYtriggerElMatchedTriggerFilter->at(i) << endl; |
350 |
+ |
//tools::printVector<TString>("triggerFilterEl", evt.triggerFilterEl.at(i)); |
351 |
+ |
} |
352 |
+ |
// printMuonInfo(evt); |
353 |
+ |
// printElectronInfo(evt); |
354 |
+ |
|
355 |
+ |
//tools::printVector("evt.triggerFilterMu", evt.triggerFilterMu); |
356 |
+ |
// tools::printVector("evt.DESYtriggerMuMatchedTriggerFilter", *(evt.DESYtriggerMuMatchedTriggerFilter)); |
357 |
+ |
// tools::printVector("evt.muonP4", *(evt.muonP4)); |
358 |
+ |
|
359 |
+ |
for(Int_t i=0,N=evt.muonP4->size(); i<N; ++i){ |
360 |
+ |
evt.triggerFilterMu.push_back(tools::splitToWords(evt.DESYtriggerMuMatchedTriggerFilter->at(i), ";")); |
361 |
+ |
//cout<<"evt.DESYtriggerMuMatchedTriggerFilter->at("<<i<<") = " << evt.DESYtriggerMuMatchedTriggerFilter->at(i) << endl; |
362 |
+ |
//tools::printVector<TString>("triggerFilterMu", evt.triggerFilterMu.at(i)); |
363 |
+ |
} |
364 |
+ |
//cout<<"size: muonP4 | filterinfo = " |
365 |
+ |
//<<evt.muonP4->size() << " | " |
366 |
+ |
//<<evt.DESYtriggerMuMatchedTriggerFilter->size() |
367 |
+ |
//<<endl; |
368 |
+ |
} |
369 |
+ |
|
370 |
+ |
|
371 |
|
//================================================================================= initBranches |
372 |
|
void initBranches(TTree *tree, eventInfo& evt){ |
373 |
|
//--------------------------------------------------- initialize event info |
384 |
|
evt.muonP4 = 0; |
385 |
|
evt.prescaled = 0; |
386 |
|
evt.Run = 0; |
387 |
+ |
evt.PUInter = 0.; |
388 |
|
evt.PUWeight = 0.; |
389 |
|
evt.triggered = 0; |
390 |
|
evt.Weight = 0.; |
169 |
– |
|
170 |
– |
|
171 |
– |
// tree->SetBranchStatus("DESYtriggerElMatchedTriggerFilter", 1); |
172 |
– |
// tree->SetBranchStatus("DESYtriggerMuMatchedTriggerFilter", 1); |
173 |
– |
// tree->SetBranchStatus("DESYtriggerNameMap*", 1); |
174 |
– |
// tree->SetBranchStatus("electronCharge", 1); |
175 |
– |
// tree->SetBranchStatus("electronP4", 1); |
176 |
– |
// tree->SetBranchStatus("Event", 1); |
177 |
– |
// tree->SetBranchStatus("HT", 1); |
178 |
– |
// tree->SetBranchStatus("jetP4", 1); |
179 |
– |
// tree->SetBranchStatus("MET", 1); |
180 |
– |
// tree->SetBranchStatus("muonCharge", 1); |
181 |
– |
// tree->SetBranchStatus("muonP4", 1); |
182 |
– |
// tree->SetBranchStatus("prescaled", 1); |
183 |
– |
// tree->SetBranchStatus("Run", 1); |
184 |
– |
// tree->SetBranchStatus("PUWeight", 1); |
185 |
– |
// tree->SetBranchStatus("triggered", 1); |
186 |
– |
// tree->SetBranchStatus("Weight", 1); |
187 |
– |
|
188 |
– |
tree->SetBranchStatus("DESYtriggerElMatchedTriggerFilter*", 1); |
189 |
– |
tree->SetBranchStatus("DESYtriggerMuMatchedTriggerFilter*", 1); |
190 |
– |
tree->SetBranchStatus("DESYtriggerNameMap*", 1); |
191 |
– |
tree->SetBranchStatus("electronCharge*", 1); |
192 |
– |
tree->SetBranchStatus("electronP4*", 1); |
193 |
– |
tree->SetBranchStatus("Event*", 1); |
194 |
– |
tree->SetBranchStatus("HT*", 1); |
195 |
– |
tree->SetBranchStatus("jetP4*", 1); |
196 |
– |
tree->SetBranchStatus("MET*", 1); |
197 |
– |
tree->SetBranchStatus("muonCharge*", 1); |
198 |
– |
tree->SetBranchStatus("muonP4*", 1); |
199 |
– |
tree->SetBranchStatus("prescaled*", 1); |
200 |
– |
tree->SetBranchStatus("Run*", 1); |
201 |
– |
tree->SetBranchStatus("PUWeight*", 1); |
202 |
– |
tree->SetBranchStatus("triggered*", 1); |
203 |
– |
tree->SetBranchStatus("Weight*", 1); |
204 |
– |
|
205 |
– |
|
391 |
|
//--------------------------------------------------- assign branches to event structure |
392 |
|
tree->SetBranchAddress("DESYtriggerElMatchedTriggerFilter", &(evt.DESYtriggerElMatchedTriggerFilter)); |
393 |
|
tree->SetBranchAddress("DESYtriggerMuMatchedTriggerFilter",&(evt.DESYtriggerMuMatchedTriggerFilter)); |
402 |
|
tree->SetBranchAddress("muonP4",&(evt.muonP4)); |
403 |
|
tree->SetBranchAddress("prescaled",&(evt.prescaled)); |
404 |
|
tree->SetBranchAddress("Run",&(evt.Run)); |
405 |
+ |
tree->SetBranchAddress("PUInter",&(evt.PUInter)); |
406 |
|
tree->SetBranchAddress("PUWeight",&(evt.PUWeight)); |
407 |
|
tree->SetBranchAddress("triggered",&(evt.triggered)); |
408 |
|
tree->SetBranchAddress("Weight",&(evt.Weight)); |
223 |
– |
|
224 |
– |
|
225 |
– |
|
226 |
– |
|
227 |
– |
|
228 |
– |
|
229 |
– |
|
230 |
– |
// tree->SetBranchStatus("DESY*", 1); |
231 |
– |
// tree->SetBranchStatus("muonP4", 1); |
232 |
– |
// tree->SetBranchStatus("jetP4", 1); |
233 |
– |
// tree->SetBranchStatus("electronP4", 1); |
234 |
– |
// tree->SetBranchStatus("Weight", 1); |
235 |
– |
|
409 |
|
} |
410 |
|
|
411 |
|
|
421 |
|
os<<"Event = "<<evt.Event<<endl; |
422 |
|
os<<"Weight = "<<evt.Weight<<endl; |
423 |
|
os<<"PUWeight = "<<evt.PUWeight<<endl; |
424 |
+ |
os<<"PUInter = "<<evt.PUInter<<endl; |
425 |
|
os<<"-----------------------------------------"<<endl; |
426 |
|
os<<"HT = "<<evt.HT<<endl; |
427 |
|
os<<"MET = "<<evt.MET<<endl; |
472 |
|
os<<endl; |
473 |
|
} |
474 |
|
//------------------------ print matching info |
475 |
< |
vector<string> matchInfo = *(evt.DESYtriggerMuMatchedTriggerFilter); |
302 |
< |
for(Int_t i=0,N=matchInfo.size(); i<N; ++i){ |
303 |
< |
vector<TString> singleMatchInfo = tools::splitToWords(matchInfo[i], ";"); |
475 |
> |
for(Int_t i=0,N=evt.muonP4->size(); i<N; ++i){ |
476 |
|
os<<"----------------------------------------------------------------------------> Matches for muon "<<i<<":"<< |
477 |
< |
endl; |
478 |
< |
tools::printVector<TString>("matched TriggerFilter", singleMatchInfo, os); |
477 |
> |
endl; |
478 |
> |
tools::printVector<TString>("matched TriggerFilter", evt.triggerFilterMu.at(i), os); |
479 |
|
} |
480 |
|
os<<endl; |
481 |
|
} |
502 |
|
os<<endl; |
503 |
|
} |
504 |
|
//------------------------ print matching info |
505 |
< |
vector<string> matchInfo = *(evt.DESYtriggerElMatchedTriggerFilter); |
334 |
< |
for(Int_t i=0,N=matchInfo.size(); i<N; ++i){ |
335 |
< |
vector<TString> singleMatchInfo = tools::splitToWords(matchInfo[i], ";"); |
505 |
> |
for(Int_t i=0,N=evt.electronP4->size(); i<N; ++i){ |
506 |
|
os<<"----------------------------------------------------------------------------> Matches for electron "<<i<<":"<< |
507 |
< |
endl; |
508 |
< |
tools::printVector<TString>("matched TriggerFilter", singleMatchInfo, os); |
507 |
> |
endl; |
508 |
> |
tools::printVector<TString>("matched TriggerFilter", evt.triggerFilterEl.at(i), os); |
509 |
|
} |
510 |
|
os<<endl; |
511 |
|
} |
512 |
|
|
513 |
|
|
514 |
|
|
345 |
– |
//================================================================================= initVariables |
346 |
– |
void initVariables(){ |
347 |
– |
//cout<<"dataset = " << dataset << endl; |
348 |
– |
//Candidates .clear(); |
349 |
– |
} |
350 |
– |
|
351 |
– |
|
352 |
– |
|
353 |
– |
|
354 |
– |
|
515 |
|
|
516 |
|
|
517 |
|
|