17 |
|
superclusters_ (cfg.getParameter<edm::InputTag> ("superclusters")), |
18 |
|
triggers_ (cfg.getParameter<edm::InputTag> ("triggers")), |
19 |
|
puFile_ (cfg.getParameter<std::string> ("puFile")), |
20 |
+ |
deadEcalFile_ (cfg.getParameter<std::string> ("deadEcalFile")), |
21 |
+ |
muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")), |
22 |
|
dataPU_ (cfg.getParameter<std::string> ("dataPU")), |
23 |
+ |
electronSFID_ (cfg.getParameter<std::string> ("electronSFID")), |
24 |
+ |
muonSF_ (cfg.getParameter<std::string> ("muonSF")), |
25 |
|
dataset_ (cfg.getParameter<std::string> ("dataset")), |
26 |
|
datasetType_ (cfg.getParameter<std::string> ("datasetType")), |
27 |
|
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")), |
28 |
|
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
29 |
< |
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")) |
29 |
> |
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
30 |
> |
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
31 |
> |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
32 |
> |
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")) |
33 |
|
|
34 |
|
{ |
35 |
|
|
36 |
|
TH1::SetDefaultSumw2 (); |
37 |
|
|
38 |
|
//create pile-up reweighting object, if necessary |
39 |
< |
if(datasetType_ != "data") puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
39 |
> |
if(datasetType_ != "data") { |
40 |
> |
if(doPileupReweighting_) puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
41 |
> |
// muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
42 |
> |
// electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
43 |
> |
} |
44 |
> |
|
45 |
|
|
46 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
47 |
|
// handle filling cut flow histograms. |
49 |
|
std::vector<TFileDirectory> directories; |
50 |
|
|
51 |
|
//always get vertex collection so we can assign the primary vertex in the event |
52 |
< |
allNecessaryObjects.push_back("primaryvertexs"); |
52 |
> |
objectsToGet.push_back("primaryvertexs"); |
53 |
> |
|
54 |
|
//always make the plot of number of primary verticex (to check pile-up reweighting) |
55 |
|
objectsToPlot.push_back("primaryvertexs"); |
56 |
|
|
57 |
|
//always get the MC particles to do GEN-matching |
58 |
< |
allNecessaryObjects.push_back("mcparticles"); |
58 |
> |
objectsToGet.push_back("mcparticles"); |
59 |
|
|
60 |
|
//always get the event collection to do pile-up reweighting |
61 |
< |
allNecessaryObjects.push_back("events"); |
61 |
> |
objectsToGet.push_back("events"); |
62 |
|
|
63 |
|
//parse the histogram definitions |
64 |
|
for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){ |
65 |
|
|
66 |
|
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
67 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
68 |
< |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
68 |
> |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
69 |
> |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
70 |
> |
objectsToGet.push_back(tempInputCollection); |
71 |
|
objectsToPlot.push_back(tempInputCollection); |
72 |
< |
allNecessaryObjects.push_back(tempInputCollection); |
72 |
> |
objectsToCut.push_back(tempInputCollection); |
73 |
|
} |
74 |
< |
else{//pair of objects, need to add them both to the things to allNecessaryObjects |
74 |
> |
else{//pair of objects, need to add them both to the things to objectsToGet |
75 |
|
int dashIndex = tempInputCollection.find("-"); |
76 |
|
int spaceIndex = tempInputCollection.find(" "); |
77 |
|
int secondWordLength = spaceIndex - dashIndex; |
78 |
< |
allNecessaryObjects.push_back(tempInputCollection); |
79 |
< |
allNecessaryObjects.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
80 |
< |
allNecessaryObjects.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
78 |
> |
objectsToGet.push_back(tempInputCollection); |
79 |
> |
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
80 |
> |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
81 |
|
objectsToPlot.push_back(tempInputCollection); |
82 |
|
objectsToPlot.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
83 |
|
objectsToPlot.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
84 |
< |
} |
84 |
> |
objectsToCut.push_back(tempInputCollection); |
85 |
> |
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
86 |
> |
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
87 |
> |
|
88 |
> |
} |
89 |
|
|
90 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
91 |
< |
|
91 |
> |
|
92 |
|
for(uint currentHistogram = 0; currentHistogram != histogramList_.size(); currentHistogram++){ |
93 |
|
|
94 |
|
histogram tempHistogram; |
97 |
|
tempHistogram.title = histogramList_.at(currentHistogram).getParameter<string>("title"); |
98 |
|
tempHistogram.bins = histogramList_.at(currentHistogram).getParameter<vector<double> >("bins"); |
99 |
|
tempHistogram.inputVariables = histogramList_.at(currentHistogram).getParameter<vector<string> >("inputVariables"); |
100 |
< |
|
100 |
> |
|
101 |
|
histograms.push_back(tempHistogram); |
102 |
|
|
103 |
|
} |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
+ |
//add histograms with the gen-matched id, mother id, and grandmother id |
112 |
+ |
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
113 |
+ |
|
114 |
+ |
string currentObject = objectsToPlot.at(currentObjectIndex); |
115 |
+ |
if(currentObject != "muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
116 |
+ |
|
117 |
+ |
histogram tempIdHisto; |
118 |
+ |
histogram tempMomIdHisto; |
119 |
+ |
histogram tempGmaIdHisto; |
120 |
+ |
histogram tempIdVsMomIdHisto; |
121 |
+ |
|
122 |
+ |
tempIdHisto.inputCollection = currentObject; |
123 |
+ |
tempMomIdHisto.inputCollection = currentObject; |
124 |
+ |
tempGmaIdHisto.inputCollection = currentObject; |
125 |
+ |
tempIdVsMomIdHisto.inputCollection = currentObject; |
126 |
+ |
|
127 |
+ |
currentObject = currentObject.substr(0, currentObject.size()-1); |
128 |
+ |
tempIdHisto.name = currentObject+"GenMatchId"; |
129 |
+ |
tempMomIdHisto.name = currentObject+"GenMatchMotherId"; |
130 |
+ |
tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId"; |
131 |
+ |
tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId"; |
132 |
+ |
|
133 |
+ |
currentObject.at(0) = toupper(currentObject.at(0)); |
134 |
+ |
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
135 |
+ |
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
136 |
+ |
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
137 |
+ |
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
138 |
+ |
|
139 |
+ |
int maxNum = 24; |
140 |
+ |
vector<double> binVector; |
141 |
+ |
binVector.push_back(maxNum); |
142 |
+ |
binVector.push_back(0); |
143 |
+ |
binVector.push_back(maxNum); |
144 |
+ |
|
145 |
+ |
tempIdHisto.bins = binVector; |
146 |
+ |
tempIdHisto.inputVariables.push_back("genMatchedId"); |
147 |
+ |
tempMomIdHisto.bins = binVector; |
148 |
+ |
tempMomIdHisto.inputVariables.push_back("genMatchedMotherId"); |
149 |
+ |
tempGmaIdHisto.bins = binVector; |
150 |
+ |
tempGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherId"); |
151 |
+ |
binVector.push_back(maxNum); |
152 |
+ |
binVector.push_back(0); |
153 |
+ |
binVector.push_back(maxNum); |
154 |
+ |
tempIdVsMomIdHisto.bins = binVector; |
155 |
+ |
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
156 |
+ |
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
157 |
+ |
|
158 |
+ |
histograms.push_back(tempIdHisto); |
159 |
+ |
histograms.push_back(tempMomIdHisto); |
160 |
+ |
histograms.push_back(tempGmaIdHisto); |
161 |
+ |
histograms.push_back(tempIdVsMomIdHisto); |
162 |
+ |
} |
163 |
+ |
|
164 |
|
|
165 |
|
channel tempChannel; |
166 |
|
//loop over all channels (event selections) |
179 |
|
triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers"); |
180 |
|
for(uint trigger = 0; trigger!= triggerNames.size(); trigger++) |
181 |
|
tempChannel.triggers.push_back(triggerNames.at(trigger)); |
182 |
< |
allNecessaryObjects.push_back("triggers"); |
182 |
> |
objectsToGet.push_back("triggers"); |
183 |
|
} |
184 |
|
|
185 |
|
|
198 |
|
twoDHists_.push_back(twoDhistoMap); |
199 |
|
|
200 |
|
|
201 |
+ |
|
202 |
|
//book all histograms included in the configuration |
203 |
|
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
204 |
|
histogram currentHistogram = histograms.at(currentHistogramIndex); |
206 |
|
int numInputVariables = currentHistogram.inputVariables.size(); |
207 |
|
|
208 |
|
if(numBinsElements != 3 && numBinsElements !=6) { |
209 |
< |
std::cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
210 |
< |
exit(0); |
209 |
> |
std::cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
210 |
> |
exit(0); |
211 |
|
} |
212 |
|
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
213 |
< |
std::cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
214 |
< |
exit(0); |
213 |
> |
std::cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
214 |
> |
exit(0); |
215 |
|
} |
216 |
|
else if(numBinsElements == 3){ |
217 |
< |
oneDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
217 |
> |
oneDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
218 |
|
} |
219 |
|
else if(numBinsElements == 6){ |
220 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2),currentHistogram.bins.at(3),currentHistogram.bins.at(4),currentHistogram.bins.at(5)); |
220 |
> |
twoDHists_.at(currentChannel)[currentHistogram.name] = directories.at(currentChannel).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2),currentHistogram.bins.at(3),currentHistogram.bins.at(4),currentHistogram.bins.at(5)); |
221 |
|
|
222 |
|
} |
223 |
|
|
224 |
|
|
225 |
+ |
if(currentHistogram.name.find("GenMatch")==std::string::npos) continue; |
226 |
+ |
|
227 |
+ |
// bin particle type |
228 |
+ |
// --- ------------- |
229 |
+ |
// 0 unmatched |
230 |
+ |
// 1 u |
231 |
+ |
// 2 d |
232 |
+ |
// 3 s |
233 |
+ |
// 4 c |
234 |
+ |
// 5 b |
235 |
+ |
// 6 t |
236 |
+ |
// 7 e |
237 |
+ |
// 8 mu |
238 |
+ |
// 9 tau |
239 |
+ |
// 10 nu |
240 |
+ |
// 11 g |
241 |
+ |
// 12 gamma |
242 |
+ |
// 13 Z |
243 |
+ |
// 14 W |
244 |
+ |
// 15 light meson |
245 |
+ |
// 16 K meson |
246 |
+ |
// 17 D meson |
247 |
+ |
// 18 B meson |
248 |
+ |
// 19 light baryon |
249 |
+ |
// 20 strange baryon |
250 |
+ |
// 21 charm baryon |
251 |
+ |
// 22 bottom baryon |
252 |
+ |
// 23 other |
253 |
+ |
|
254 |
+ |
vector<TString> labelArray; |
255 |
+ |
labelArray.push_back("unmatched"); |
256 |
+ |
labelArray.push_back("u"); |
257 |
+ |
labelArray.push_back("d"); |
258 |
+ |
labelArray.push_back("s"); |
259 |
+ |
labelArray.push_back("c"); |
260 |
+ |
labelArray.push_back("b"); |
261 |
+ |
labelArray.push_back("t"); |
262 |
+ |
labelArray.push_back("e"); |
263 |
+ |
labelArray.push_back("#mu"); |
264 |
+ |
labelArray.push_back("#tau"); |
265 |
+ |
labelArray.push_back("#nu"); |
266 |
+ |
labelArray.push_back("g"); |
267 |
+ |
labelArray.push_back("#gamma"); |
268 |
+ |
labelArray.push_back("Z"); |
269 |
+ |
labelArray.push_back("W"); |
270 |
+ |
labelArray.push_back("light meson"); |
271 |
+ |
labelArray.push_back("K meson"); |
272 |
+ |
labelArray.push_back("D meson"); |
273 |
+ |
labelArray.push_back("B meson"); |
274 |
+ |
labelArray.push_back("light baryon"); |
275 |
+ |
labelArray.push_back("strange baryon"); |
276 |
+ |
labelArray.push_back("charm baryon"); |
277 |
+ |
labelArray.push_back("bottom baryon"); |
278 |
+ |
labelArray.push_back("other"); |
279 |
+ |
|
280 |
+ |
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
281 |
+ |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) { |
282 |
+ |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
283 |
+ |
} |
284 |
+ |
else { |
285 |
+ |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
286 |
+ |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
287 |
+ |
} |
288 |
+ |
} |
289 |
+ |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) { |
290 |
+ |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
291 |
+ |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
292 |
+ |
} |
293 |
+ |
|
294 |
|
} |
295 |
< |
//book a histogram for the number of each object type to be plotted |
295 |
> |
|
296 |
> |
// Book a histogram for the number of each object type to be plotted. |
297 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
298 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
299 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
300 |
|
int maxNum = 10; |
302 |
|
else if(currentObject == "primaryvertexs") maxNum = 50; |
303 |
|
else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
304 |
|
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
305 |
< |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
306 |
< |
|
307 |
< |
currentObject.at(0) = toupper(currentObject.at(0)); |
305 |
> |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
306 |
> |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
307 |
> |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
308 |
> |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
309 |
> |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
310 |
> |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
311 |
> |
currentObject.at(0) = toupper(currentObject.at(0)); |
312 |
|
string histoName = "num" + currentObject; |
313 |
|
|
314 |
|
if(histoName == "numPrimaryvertexs"){ |
315 |
< |
string newHistoName = histoName + "BeforePileupCorrection"; |
316 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
317 |
< |
newHistoName = histoName + "AfterPileupCorrection"; |
318 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
315 |
> |
string newHistoName = histoName + "BeforePileupCorrection"; |
316 |
> |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
317 |
> |
newHistoName = histoName + "AfterPileupCorrection"; |
318 |
> |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
319 |
|
} |
320 |
|
else |
321 |
< |
oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
321 |
> |
oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
322 |
|
} |
323 |
|
|
324 |
|
|
325 |
+ |
|
326 |
+ |
|
327 |
|
//get list of cuts for this channel |
328 |
|
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
329 |
|
|
333 |
|
//store input collection for cut |
334 |
|
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
335 |
|
tempCut.inputCollection = tempInputCollection; |
336 |
< |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
337 |
< |
allNecessaryObjects.push_back(tempInputCollection); |
338 |
< |
} |
339 |
< |
else{//pair of objects, need to add them both to the things to allNecessaryObjects |
340 |
< |
int dashIndex = tempInputCollection.find("-"); |
341 |
< |
int spaceIndex = tempInputCollection.find(" "); |
342 |
< |
int secondWordLength = spaceIndex - dashIndex; |
343 |
< |
allNecessaryObjects.push_back(tempInputCollection); |
344 |
< |
allNecessaryObjects.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
345 |
< |
allNecessaryObjects.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
336 |
> |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
337 |
> |
objectsToGet.push_back(tempInputCollection); |
338 |
> |
objectsToCut.push_back(tempInputCollection); |
339 |
> |
} |
340 |
> |
else{//pair of objects, need to add them both to the things to objectsToGet |
341 |
> |
int dashIndex = tempInputCollection.find("-"); |
342 |
> |
int spaceIndex = tempInputCollection.find(" "); |
343 |
> |
int secondWordLength = spaceIndex - dashIndex; |
344 |
> |
objectsToGet.push_back(tempInputCollection); |
345 |
> |
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
346 |
> |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
347 |
> |
objectsToCut.push_back(tempInputCollection); |
348 |
> |
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
349 |
> |
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
350 |
|
|
351 |
|
} |
352 |
|
|
356 |
|
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
357 |
|
std::vector<string> cutStringVector = splitString(cutString); |
358 |
|
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
359 |
< |
std::cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
360 |
< |
exit(0); |
359 |
> |
std::cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
360 |
> |
exit(0); |
361 |
|
} |
362 |
|
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
363 |
|
for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,| |
364 |
< |
int indexOffset = 4 * subcutIndex; |
365 |
< |
string currentVariableString = cutStringVector.at(indexOffset); |
366 |
< |
if(currentVariableString.find("(")==std::string::npos){ |
367 |
< |
tempCut.functions.push_back("");//no function was specified |
368 |
< |
tempCut.variables.push_back(currentVariableString);// variable to cut on |
369 |
< |
} |
370 |
< |
else{ |
371 |
< |
tempCut.functions.push_back(currentVariableString.substr(0,currentVariableString.find("(")));//function comes before the "(" |
372 |
< |
string tempVariable = currentVariableString.substr(currentVariableString.find("(")+1);//get rest of string |
373 |
< |
tempCut.variables.push_back(tempVariable.substr(0,tempVariable.size()-1));//remove trailing ")" |
374 |
< |
} |
375 |
< |
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
376 |
< |
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
377 |
< |
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
364 |
> |
int indexOffset = 4 * subcutIndex; |
365 |
> |
string currentVariableString = cutStringVector.at(indexOffset); |
366 |
> |
if(currentVariableString.find("(")==std::string::npos){ |
367 |
> |
tempCut.functions.push_back("");//no function was specified |
368 |
> |
tempCut.variables.push_back(currentVariableString);// variable to cut on |
369 |
> |
} |
370 |
> |
else{ |
371 |
> |
tempCut.functions.push_back(currentVariableString.substr(0,currentVariableString.find("(")));//function comes before the "(" |
372 |
> |
string tempVariable = currentVariableString.substr(currentVariableString.find("(")+1);//get rest of string |
373 |
> |
tempCut.variables.push_back(tempVariable.substr(0,tempVariable.size()-1));//remove trailing ")" |
374 |
> |
} |
375 |
> |
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
376 |
> |
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
377 |
> |
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
378 |
|
} |
379 |
|
|
380 |
|
//get number of objects required to pass cut for event to pass |
381 |
|
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
382 |
|
std::vector<string> numberRequiredVector = splitString(numberRequiredString); |
383 |
|
if(numberRequiredVector.size()!=2){ |
384 |
< |
std::cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
384 |
> |
std::cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
385 |
|
exit(0); |
386 |
|
} |
387 |
|
|
416 |
|
}//end loop over channels |
417 |
|
|
418 |
|
|
419 |
< |
//make unique vector of objects we need to cut on (so we make sure to get them from the event) |
420 |
< |
sort( allNecessaryObjects.begin(), allNecessaryObjects.end() ); |
421 |
< |
allNecessaryObjects.erase( unique( allNecessaryObjects.begin(), allNecessaryObjects.end() ), allNecessaryObjects.end() ); |
419 |
> |
//make unique vector of objects we need to get from the event |
420 |
> |
sort( objectsToGet.begin(), objectsToGet.end() ); |
421 |
> |
objectsToGet.erase( unique( objectsToGet.begin(), objectsToGet.end() ), objectsToGet.end() ); |
422 |
> |
//make unique vector of objects we need to cut on |
423 |
> |
sort( objectsToCut.begin(), objectsToCut.end() ); |
424 |
> |
objectsToCut.erase( unique( objectsToCut.begin(), objectsToCut.end() ), objectsToCut.end() ); |
425 |
|
|
426 |
|
|
427 |
|
} |
439 |
|
OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
440 |
|
{ |
441 |
|
|
285 |
– |
|
442 |
|
// Retrieve necessary collections from the event. |
443 |
< |
edm::Handle<BNtriggerCollection> triggers; |
444 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "triggers") != allNecessaryObjects.end()) |
443 |
> |
|
444 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
445 |
|
event.getByLabel (triggers_, triggers); |
446 |
|
|
447 |
< |
edm::Handle<BNjetCollection> jets; |
292 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "jets") != allNecessaryObjects.end()) |
447 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
448 |
|
event.getByLabel (jets_, jets); |
449 |
|
|
450 |
< |
edm::Handle<BNmuonCollection> muons; |
296 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "muons") != allNecessaryObjects.end()) |
450 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
451 |
|
event.getByLabel (muons_, muons); |
452 |
|
|
453 |
< |
edm::Handle<BNelectronCollection> electrons; |
300 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "electrons") != allNecessaryObjects.end()) |
453 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
454 |
|
event.getByLabel (electrons_, electrons); |
455 |
|
|
456 |
< |
edm::Handle<BNeventCollection> events; |
304 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "events") != allNecessaryObjects.end()) |
456 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
457 |
|
event.getByLabel (events_, events); |
458 |
|
|
459 |
< |
edm::Handle<BNtauCollection> taus; |
308 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "taus") != allNecessaryObjects.end()) |
459 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
460 |
|
event.getByLabel (taus_, taus); |
461 |
|
|
462 |
< |
edm::Handle<BNmetCollection> mets; |
312 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "mets") != allNecessaryObjects.end()) |
462 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
463 |
|
event.getByLabel (mets_, mets); |
464 |
|
|
465 |
< |
edm::Handle<BNtrackCollection> tracks; |
316 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "tracks") != allNecessaryObjects.end()) |
465 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
466 |
|
event.getByLabel (tracks_, tracks); |
467 |
|
|
468 |
< |
edm::Handle<BNgenjetCollection> genjets; |
320 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "genjets") != allNecessaryObjects.end()) |
468 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
469 |
|
event.getByLabel (genjets_, genjets); |
470 |
|
|
471 |
< |
edm::Handle<BNmcparticleCollection> mcparticles; |
324 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "mcparticles") != allNecessaryObjects.end()) |
471 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
472 |
|
event.getByLabel (mcparticles_, mcparticles); |
473 |
|
|
474 |
< |
edm::Handle<BNprimaryvertexCollection> primaryvertexs; |
328 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "primaryvertexs") != allNecessaryObjects.end()) |
474 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
475 |
|
event.getByLabel (primaryvertexs_, primaryvertexs); |
476 |
|
|
477 |
< |
edm::Handle<BNbxlumiCollection> bxlumis; |
332 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "bxlumis") != allNecessaryObjects.end()) |
477 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
478 |
|
event.getByLabel (bxlumis_, bxlumis); |
479 |
|
|
480 |
< |
edm::Handle<BNphotonCollection> photons; |
336 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "photons") != allNecessaryObjects.end()) |
480 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
481 |
|
event.getByLabel (photons_, photons); |
482 |
|
|
483 |
< |
edm::Handle<BNsuperclusterCollection> superclusters; |
340 |
< |
if (std::find(allNecessaryObjects.begin(), allNecessaryObjects.end(), "superclusters") != allNecessaryObjects.end()) |
483 |
> |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
484 |
|
event.getByLabel (superclusters_, superclusters); |
485 |
|
|
486 |
+ |
if (useTrackCaloRhoCorr_) { |
487 |
+ |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
488 |
+ |
// This rho collection is not available in all BEANs. |
489 |
+ |
// For description of rho values for different jet reconstruction algorithms, see |
490 |
+ |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
491 |
+ |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
492 |
+ |
} |
493 |
+ |
|
494 |
|
|
495 |
|
//get pile-up event weight |
496 |
< |
double puScaleFactor = 0; |
497 |
< |
if(datasetType_ != "data") |
498 |
< |
puScaleFactor = puWeight_->at (events->at (0).numTruePV); |
348 |
< |
else |
349 |
< |
puScaleFactor = 1.00; |
496 |
> |
double scaleFactor = 1.00; |
497 |
> |
if(doPileupReweighting_ && datasetType_ != "data") |
498 |
> |
scaleFactor = puWeight_->at (events->at (0).numTruePV); |
499 |
|
|
500 |
|
|
501 |
|
//loop over all channels |
504 |
|
channel currentChannel = channels.at(currentChannelIndex); |
505 |
|
|
506 |
|
flagMap individualFlags; |
358 |
– |
flagMap cumulativeFlags; |
507 |
|
counterMap passingCounter; |
508 |
+ |
cumulativeFlags.clear (); |
509 |
|
|
510 |
|
bool triggerDecision = true; |
511 |
|
if(currentChannel.triggers.size() != 0){ //triggers specified |
514 |
|
} |
515 |
|
|
516 |
|
//loop over all cuts |
517 |
+ |
|
518 |
+ |
|
519 |
+ |
|
520 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
521 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
522 |
|
|
523 |
< |
for(uint currentObjectIndex = 0; currentObjectIndex != allNecessaryObjects.size(); currentObjectIndex++){ |
524 |
< |
string currentObject = allNecessaryObjects.at(currentObjectIndex); |
523 |
> |
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
524 |
> |
string currentObject = objectsToCut.at(currentObjectIndex); |
525 |
|
|
526 |
+ |
//initialize maps to get ready to set cuts |
527 |
|
individualFlags[currentObject].push_back (vector<bool> ()); |
528 |
|
cumulativeFlags[currentObject].push_back (vector<bool> ()); |
529 |
|
|
530 |
+ |
} |
531 |
+ |
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
532 |
+ |
string currentObject = objectsToCut.at(currentObjectIndex); |
533 |
+ |
|
534 |
+ |
int flagsForPairCutsIndex = max(int(currentCutIndex-1),0); |
535 |
+ |
|
536 |
|
|
537 |
|
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
538 |
|
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
548 |
|
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
549 |
|
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
550 |
|
|
392 |
– |
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(),"muon-muon pairs"); |
393 |
– |
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(),"electron-electron pairs"); |
394 |
– |
else if(currentObject == "electron-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),muons.product(),"electron-muon pairs"); |
551 |
|
|
552 |
+ |
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
553 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
554 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
555 |
+ |
"muon-muon pairs"); |
556 |
+ |
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
557 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
558 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
559 |
+ |
"electron-electron pairs"); |
560 |
+ |
else if(currentObject == "electron-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),muons.product(), \ |
561 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
562 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
563 |
+ |
"electron-muon pairs"); |
564 |
+ |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
565 |
+ |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
566 |
+ |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
567 |
+ |
"track-event pairs"); |
568 |
+ |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
569 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
570 |
+ |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
571 |
+ |
"electron-track pairs"); |
572 |
+ |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
573 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
574 |
+ |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
575 |
+ |
"muon-track pairs"); |
576 |
+ |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
577 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
578 |
+ |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
579 |
+ |
"muon-tau pairs"); |
580 |
+ |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),taus.product(), |
581 |
+ |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
582 |
+ |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
583 |
+ |
"tau-tau pairs"); |
584 |
+ |
|
585 |
+ |
|
586 |
|
} |
587 |
|
|
588 |
|
|
590 |
|
}//end loop over all cuts |
591 |
|
|
592 |
|
|
403 |
– |
|
593 |
|
//use cumulative flags to apply cuts at event level |
594 |
|
|
595 |
|
bool eventPassedAllCuts = true; |
598 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
599 |
|
|
600 |
|
|
601 |
+ |
|
602 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
603 |
|
|
604 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
606 |
|
int numberPassing = 0; |
607 |
|
|
608 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
609 |
< |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
609 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
610 |
|
} |
611 |
|
|
612 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
616 |
|
|
617 |
|
} |
618 |
|
|
619 |
< |
cutFlows_.at(currentChannelIndex)->fillCutFlow(puScaleFactor); |
619 |
> |
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
620 |
|
|
621 |
|
|
622 |
|
|
623 |
|
if(!eventPassedAllCuts)continue; |
624 |
|
|
625 |
< |
|
626 |
< |
|
627 |
< |
|
628 |
< |
//set position of primary vertex in event, in order to calculate quantities relative to it |
629 |
< |
primaryVertex_ = 0; |
630 |
< |
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back(); |
631 |
< |
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
442 |
< |
if(!vertexFlags.at(vertexIndex)) continue; |
443 |
< |
primaryVertex_ = new BNprimaryvertex (primaryvertexs->at (vertexIndex)); |
444 |
< |
break; |
625 |
> |
if (printEventInfo_) { |
626 |
> |
// Write information about event to screen, for testing purposes. |
627 |
> |
cout << "Event passed all cuts in channel " << currentChannel.name |
628 |
> |
<< ": run=" << events->at(0).run |
629 |
> |
<< " lumi=" << events->at(0).lumi |
630 |
> |
<< " event=" << events->at(0).evt |
631 |
> |
<< endl; |
632 |
|
} |
633 |
|
|
634 |
|
|
635 |
+ |
// if(datasetType_ != "data") { |
636 |
+ |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
637 |
+ |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
638 |
+ |
// } |
639 |
+ |
|
640 |
|
//filling histograms |
641 |
|
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
642 |
|
histogram currentHistogram = histograms.at(histogramIndex); |
643 |
|
|
644 |
|
if(currentHistogram.inputVariables.size() == 1){ |
645 |
< |
TH1D* histo; |
646 |
< |
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
647 |
< |
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),puScaleFactor); |
648 |
< |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),puScaleFactor); |
649 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(),\ |
650 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(),\ |
651 |
< |
cumulativeFlags.at("muon-muon pairs").back(),puScaleFactor); |
652 |
< |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),puScaleFactor); |
653 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
654 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
655 |
< |
cumulativeFlags.at("electron-electron pairs").back(),puScaleFactor); |
656 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
657 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
658 |
< |
cumulativeFlags.at("electron-muon pairs").back(),puScaleFactor); |
659 |
< |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),puScaleFactor); |
660 |
< |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),puScaleFactor); |
661 |
< |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),puScaleFactor); |
662 |
< |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),puScaleFactor); |
663 |
< |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),puScaleFactor); |
664 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),puScaleFactor); |
665 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),puScaleFactor); |
666 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),puScaleFactor); |
667 |
< |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),puScaleFactor); |
668 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),puScaleFactor); |
645 |
> |
TH1D* histo; |
646 |
> |
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
647 |
> |
|
648 |
> |
|
649 |
> |
|
650 |
> |
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
651 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
652 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
653 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
654 |
> |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
655 |
> |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
656 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
657 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
658 |
> |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
659 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
660 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
661 |
> |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
662 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
663 |
> |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
664 |
> |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
665 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
666 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
667 |
> |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
668 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
669 |
> |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
670 |
> |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
671 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
672 |
> |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
673 |
> |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
674 |
> |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
675 |
> |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
676 |
> |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
677 |
> |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
678 |
> |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
679 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
680 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
681 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
682 |
> |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
683 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
684 |
|
} |
685 |
|
else if(currentHistogram.inputVariables.size() == 2){ |
686 |
< |
TH2D* histo; |
687 |
< |
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
688 |
< |
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),puScaleFactor); |
482 |
< |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),puScaleFactor); |
483 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
484 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
485 |
< |
cumulativeFlags.at("muon-muon pairs").back(),puScaleFactor); |
486 |
< |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),puScaleFactor); |
487 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
488 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
489 |
< |
cumulativeFlags.at("electron-electron pairs").back(),puScaleFactor); |
490 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
491 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
492 |
< |
cumulativeFlags.at("electron-muon pairs").back(),puScaleFactor); |
493 |
< |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),puScaleFactor); |
494 |
< |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),puScaleFactor); |
495 |
< |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),puScaleFactor); |
496 |
< |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),puScaleFactor); |
497 |
< |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),puScaleFactor); |
498 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),puScaleFactor); |
499 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),puScaleFactor); |
500 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),puScaleFactor); |
501 |
< |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),puScaleFactor); |
502 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),puScaleFactor); |
503 |
< |
} |
504 |
< |
} |
686 |
> |
TH2D* histo; |
687 |
> |
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
688 |
> |
|
689 |
|
|
690 |
|
|
691 |
+ |
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
692 |
+ |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
693 |
+ |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
694 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
695 |
+ |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
696 |
+ |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
697 |
+ |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
698 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
699 |
+ |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
700 |
+ |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
701 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
702 |
+ |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
703 |
+ |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
704 |
+ |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
705 |
+ |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
706 |
+ |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
707 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
708 |
+ |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
709 |
+ |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
710 |
+ |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
711 |
+ |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
712 |
+ |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
713 |
+ |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
714 |
+ |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
715 |
+ |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
716 |
+ |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
717 |
+ |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
718 |
+ |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
719 |
+ |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
720 |
+ |
cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(), |
721 |
+ |
cumulativeFlags.at("track-event pairs").back(),scaleFactor); |
722 |
+ |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
723 |
+ |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
724 |
+ |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
725 |
+ |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
726 |
+ |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
727 |
+ |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
728 |
+ |
} |
729 |
+ |
} |
730 |
+ |
|
731 |
|
//fills histograms with the sizes of collections |
732 |
|
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
733 |
+ |
|
734 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
735 |
|
|
736 |
< |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
737 |
< |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
738 |
< |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
739 |
< |
string tempCurrentObject = currentObject; |
740 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
736 |
> |
string objectToPlot = ""; |
737 |
> |
|
738 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
739 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
740 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
741 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
742 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
743 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
744 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
745 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
746 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
747 |
> |
else objectToPlot = currentObject; |
748 |
> |
string tempCurrentObject = objectToPlot; |
749 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
750 |
|
string histoName = "num" + tempCurrentObject; |
751 |
|
|
752 |
|
|
753 |
< |
if(currentObject == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),puScaleFactor); |
754 |
< |
else if(currentObject == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),puScaleFactor); |
755 |
< |
else if(currentObject == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,puScaleFactor); |
756 |
< |
else if(currentObject == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),puScaleFactor); |
757 |
< |
else if(currentObject == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,puScaleFactor); |
758 |
< |
else if(currentObject == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),puScaleFactor); |
759 |
< |
else if(currentObject == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),puScaleFactor); |
760 |
< |
else if(currentObject == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),puScaleFactor); |
761 |
< |
else if(currentObject == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),puScaleFactor); |
762 |
< |
else if(currentObject == "tracks") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(tracks->size(),puScaleFactor); |
763 |
< |
else if(currentObject == "genjets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(genjets->size(),puScaleFactor); |
764 |
< |
else if(currentObject == "mcparticles") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mcparticles->size(),puScaleFactor); |
765 |
< |
else if(currentObject == "primaryvertexs"){ |
766 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
767 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),puScaleFactor); |
768 |
< |
} |
769 |
< |
else if(currentObject == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),puScaleFactor); |
770 |
< |
else if(currentObject == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),puScaleFactor); |
771 |
< |
else if(currentObject == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),puScaleFactor); |
753 |
> |
//set position of primary vertex in event, in order to calculate quantities relative to it |
754 |
> |
if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
755 |
> |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
756 |
> |
int numToPlot = 0; |
757 |
> |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
758 |
> |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
759 |
> |
} |
760 |
> |
if(objectToPlot == "primaryvertexs"){ |
761 |
> |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
762 |
> |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
763 |
> |
} |
764 |
> |
else { |
765 |
> |
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
766 |
> |
} |
767 |
> |
} |
768 |
> |
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
769 |
> |
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
770 |
> |
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
771 |
> |
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
772 |
> |
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
773 |
> |
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
774 |
> |
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
775 |
> |
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
776 |
> |
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
777 |
> |
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor); |
778 |
> |
else if(objectToPlot == "tracks") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(tracks->size(),scaleFactor); |
779 |
> |
else if(objectToPlot == "genjets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(genjets->size(),scaleFactor); |
780 |
> |
else if(objectToPlot == "mcparticles") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mcparticles->size(),scaleFactor); |
781 |
> |
else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),scaleFactor); |
782 |
> |
else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),scaleFactor); |
783 |
> |
else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),scaleFactor); |
784 |
> |
else if(objectToPlot == "primaryvertexs"){ |
785 |
> |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
786 |
> |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
787 |
> |
} |
788 |
|
|
789 |
< |
} |
540 |
< |
} //end loop over channel |
789 |
> |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
790 |
|
|
791 |
< |
masterCutFlow_->fillCutFlow(puScaleFactor); |
791 |
> |
} //end loop over channel |
792 |
|
|
793 |
+ |
masterCutFlow_->fillCutFlow(scaleFactor); |
794 |
|
|
795 |
+ |
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
796 |
|
|
546 |
– |
} |
797 |
|
|
798 |
|
|
799 |
|
bool |
988 |
|
else if(variable == "ecalIso") value = object->ecalIso; |
989 |
|
else if(variable == "hcalIso") value = object->hcalIso; |
990 |
|
else if(variable == "caloIso") value = object->caloIso; |
991 |
< |
else if(variable == "trackIsoDR03") value = object->trackIsoDR03; |
991 |
> |
else if(variable == "trackIsDR03") value = object->trackIsoDR03; |
992 |
|
else if(variable == "ecalIsoDR03") value = object->ecalIsoDR03; |
993 |
|
else if(variable == "hcalIsoDR03") value = object->hcalIsoDR03; |
994 |
|
else if(variable == "caloIsoDR03") value = object->caloIsoDR03; |
1127 |
|
else if(variable == "time_ndof") value = object->time_ndof; |
1128 |
|
|
1129 |
|
//user-defined variables |
1130 |
< |
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (primaryVertex_->xError, primaryVertex_->yError)); |
1131 |
< |
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (primaryVertex_->xError, primaryVertex_->yError)); |
1130 |
> |
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1131 |
> |
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1132 |
|
else if(variable == "detIso") value = (object->trackIsoDR03) / object->pt; |
1133 |
< |
else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt; |
1133 |
> |
else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt; |
1134 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIso + max(0.0, object->neutralHadronIso + object->photonIso - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1135 |
+ |
else if(variable == "metMT") { |
1136 |
+ |
const BNmet *met = chosenMET (); |
1137 |
+ |
if (met) |
1138 |
+ |
{ |
1139 |
+ |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1140 |
+ |
p2 (met->px, met->py, 0.0, met->pt); |
1141 |
+ |
|
1142 |
+ |
value = (p1 + p2).Mt (); |
1143 |
+ |
} |
1144 |
+ |
else |
1145 |
+ |
value = -999; |
1146 |
+ |
} |
1147 |
+ |
|
1148 |
+ |
|
1149 |
+ |
|
1150 |
+ |
else if(variable == "correctedD0VertexInEBPlus"){ |
1151 |
+ |
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
1152 |
+ |
else value = -999; |
1153 |
+ |
} |
1154 |
+ |
else if(variable == "correctedD0VertexOutEBPlus"){ |
1155 |
+ |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
1156 |
+ |
else value = -999; |
1157 |
+ |
} |
1158 |
+ |
else if(variable == "correctedD0VertexEEPlus"){ |
1159 |
+ |
if(fabs(object->eta) > 1.479 && object->eta > 0) value = object->correctedD0Vertex; |
1160 |
+ |
else value = -999; |
1161 |
+ |
} |
1162 |
+ |
|
1163 |
+ |
else if(variable == "correctedD0BeamspotInEBPlus"){ |
1164 |
+ |
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0; |
1165 |
+ |
else value = -999; |
1166 |
+ |
} |
1167 |
+ |
else if(variable == "correctedD0BeamspotOutEBPlus"){ |
1168 |
+ |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->eta > 0) value = object->correctedD0; |
1169 |
+ |
else value = -999; |
1170 |
+ |
} |
1171 |
+ |
else if(variable == "correctedD0BeamspotEEPlus"){ |
1172 |
+ |
if(fabs(object->eta) > 1.479 && object->eta > 0) value = object->correctedD0; |
1173 |
+ |
else value = -999; |
1174 |
+ |
} |
1175 |
+ |
|
1176 |
+ |
else if(variable == "correctedD0VertexInEBMinus"){ |
1177 |
+ |
if(fabs(object->eta) < 0.8 && object->eta < 0) value = object->correctedD0Vertex; |
1178 |
+ |
else value = -999; |
1179 |
+ |
} |
1180 |
+ |
else if(variable == "correctedD0VertexOutEBMinus"){ |
1181 |
+ |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->eta < 0) value = object->correctedD0Vertex; |
1182 |
+ |
else value = -999; |
1183 |
+ |
} |
1184 |
+ |
else if(variable == "correctedD0VertexEEMinus"){ |
1185 |
+ |
if(fabs(object->eta) > 1.479 && object->eta < 0) value = object->correctedD0Vertex; |
1186 |
+ |
else value = -999; |
1187 |
+ |
} |
1188 |
+ |
|
1189 |
+ |
else if(variable == "correctedD0BeamspotInEBMinus"){ |
1190 |
+ |
if(fabs(object->eta) < 0.8 && object->eta < 0) value = object->correctedD0; |
1191 |
+ |
else value = -999; |
1192 |
+ |
} |
1193 |
+ |
else if(variable == "correctedD0BeamspotOutEBMinus"){ |
1194 |
+ |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->eta < 0) value = object->correctedD0; |
1195 |
+ |
else value = -999; |
1196 |
+ |
} |
1197 |
+ |
else if(variable == "correctedD0BeamspotEEMinus"){ |
1198 |
+ |
if(fabs(object->eta) > 1.479 && object->eta < 0) value = object->correctedD0; |
1199 |
+ |
else value = -999; |
1200 |
+ |
} |
1201 |
+ |
|
1202 |
+ |
|
1203 |
+ |
else if(variable == "correctedD0VertexInEBPositiveCharge"){ |
1204 |
+ |
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
1205 |
+ |
else value = -999; |
1206 |
+ |
} |
1207 |
+ |
else if(variable == "correctedD0VertexOutEBPositiveCharge"){ |
1208 |
+ |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
1209 |
+ |
else value = -999; |
1210 |
+ |
} |
1211 |
+ |
else if(variable == "correctedD0VertexEEPositiveCharge"){ |
1212 |
+ |
if(fabs(object->eta) > 1.479 && object->charge > 0) value = object->correctedD0Vertex; |
1213 |
+ |
else value = -999; |
1214 |
+ |
} |
1215 |
+ |
|
1216 |
+ |
else if(variable == "correctedD0BeamspotInEBPositiveCharge"){ |
1217 |
+ |
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0; |
1218 |
+ |
else value = -999; |
1219 |
+ |
} |
1220 |
+ |
else if(variable == "correctedD0BeamspotOutEBPositiveCharge"){ |
1221 |
+ |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->charge > 0) value = object->correctedD0; |
1222 |
+ |
else value = -999; |
1223 |
+ |
} |
1224 |
+ |
else if(variable == "correctedD0BeamspotEEPositiveCharge"){ |
1225 |
+ |
if(fabs(object->eta) > 1.479 && object->charge > 0) value = object->correctedD0; |
1226 |
+ |
else value = -999; |
1227 |
+ |
} |
1228 |
+ |
|
1229 |
+ |
else if(variable == "correctedD0VertexInEBNegativeCharge"){ |
1230 |
+ |
if(fabs(object->eta) < 0.8 && object->charge < 0) value = object->correctedD0Vertex; |
1231 |
+ |
else value = -999; |
1232 |
+ |
} |
1233 |
+ |
else if(variable == "correctedD0VertexOutEBNegativeCharge"){ |
1234 |
+ |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->charge < 0) value = object->correctedD0Vertex; |
1235 |
+ |
else value = -999; |
1236 |
+ |
} |
1237 |
+ |
else if(variable == "correctedD0VertexEENegativeCharge"){ |
1238 |
+ |
if(fabs(object->eta) > 1.479 && object->charge < 0) value = object->correctedD0Vertex; |
1239 |
+ |
else value = -999; |
1240 |
+ |
} |
1241 |
+ |
|
1242 |
+ |
else if(variable == "correctedD0BeamspotInEBNegativeCharge"){ |
1243 |
+ |
if(fabs(object->eta) < 0.8 && object->charge < 0) value = object->correctedD0; |
1244 |
+ |
else value = -999; |
1245 |
+ |
} |
1246 |
+ |
else if(variable == "correctedD0BeamspotOutEBNegativeCharge"){ |
1247 |
+ |
if(fabs(object->eta) < 1.479 && fabs(object->eta) > 0.8 && object->charge < 0) value = object->correctedD0; |
1248 |
+ |
else value = -999; |
1249 |
+ |
} |
1250 |
+ |
else if(variable == "correctedD0BeamspotEENegativeCharge"){ |
1251 |
+ |
if(fabs(object->eta) > 1.479 && object->charge < 0) value = object->correctedD0; |
1252 |
+ |
else value = -999; |
1253 |
+ |
} |
1254 |
+ |
|
1255 |
+ |
|
1256 |
|
else if(variable == "tightID") { |
1257 |
< |
value = object->isGlobalMuon > 0 \ |
1258 |
< |
&& object->isPFMuon > 0 \ |
1259 |
< |
&& object->normalizedChi2 < 10 \ |
1260 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1261 |
< |
&& object->numberOfMatchedStations > 1 \ |
1262 |
< |
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1263 |
< |
&& fabs(object->correctedDZ) < 0.5 \ |
1264 |
< |
&& object->numberOfValidPixelHits > 0 \ |
1257 |
> |
value = object->isGlobalMuon > 0 \ |
1258 |
> |
&& object->isPFMuon > 0 \ |
1259 |
> |
&& object->normalizedChi2 < 10 \ |
1260 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1261 |
> |
&& object->numberOfMatchedStations > 1 \ |
1262 |
> |
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1263 |
> |
&& fabs(object->correctedDZ) < 0.5 \ |
1264 |
> |
&& object->numberOfValidPixelHits > 0 \ |
1265 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1266 |
|
} |
1267 |
|
else if(variable == "tightIDdisplaced"){ |
1268 |
< |
value = object->isGlobalMuon > 0 \ |
1269 |
< |
&& object->normalizedChi2 < 10 \ |
1270 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1271 |
< |
&& object->numberOfMatchedStations > 1 \ |
1272 |
< |
&& object->numberOfValidPixelHits > 0 \ |
1268 |
> |
value = object->isGlobalMuon > 0 \ |
1269 |
> |
&& object->normalizedChi2 < 10 \ |
1270 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1271 |
> |
&& object->numberOfMatchedStations > 1 \ |
1272 |
> |
&& object->numberOfValidPixelHits > 0 \ |
1273 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1274 |
|
} |
1275 |
|
|
1276 |
< |
// else if(variable == "genMatchedID"){ |
1277 |
< |
// value = getGenMatchedParticle(object)->id; |
1278 |
< |
// } |
1279 |
< |
// else if(variable == "genMatchedMotherID"){ |
1280 |
< |
// value = getGenMatchedParticle(object)->motherId; |
1281 |
< |
// } |
1282 |
< |
// else if(variable == "genMatchedGrandmotherID"){ |
1283 |
< |
// value = getGenMatchedParticle(object)->grandMotherId; |
1284 |
< |
// } |
1276 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1277 |
> |
|
1278 |
> |
else if(variable == "genMatchedPdgId"){ |
1279 |
> |
int index = getGenMatchedParticleIndex(object); |
1280 |
> |
if(index == -1) value = 0; |
1281 |
> |
else value = mcparticles->at(index).id; |
1282 |
> |
} |
1283 |
> |
|
1284 |
> |
else if(variable == "genMatchedId"){ |
1285 |
> |
int index = getGenMatchedParticleIndex(object); |
1286 |
> |
if(index == -1) value = 0; |
1287 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
1288 |
> |
} |
1289 |
> |
else if(variable == "genMatchedMotherId"){ |
1290 |
> |
int index = getGenMatchedParticleIndex(object); |
1291 |
> |
if(index == -1) value = 0; |
1292 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1293 |
> |
} |
1294 |
> |
else if(variable == "genMatchedMotherIdReverse"){ |
1295 |
> |
int index = getGenMatchedParticleIndex(object); |
1296 |
> |
if(index == -1) value = 23; |
1297 |
> |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1298 |
> |
} |
1299 |
> |
else if(variable == "genMatchedGrandmotherId"){ |
1300 |
> |
int index = getGenMatchedParticleIndex(object); |
1301 |
> |
if(index == -1) value = 0; |
1302 |
> |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1303 |
> |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1304 |
> |
if(motherIndex == -1) value = 0; |
1305 |
> |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1306 |
> |
} |
1307 |
> |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1308 |
> |
} |
1309 |
|
|
1310 |
|
|
1311 |
|
|
1479 |
|
else if(variable == "passConvVeto") value = object->passConvVeto; |
1480 |
|
|
1481 |
|
//user-defined variables |
1482 |
< |
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (primaryVertex_->xError, primaryVertex_->yError)); |
1483 |
< |
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (primaryVertex_->xError, primaryVertex_->yError)); |
1482 |
> |
else if(variable == "correctedD0VertexErr") value = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1483 |
> |
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1484 |
|
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
1485 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1486 |
< |
else if(variable == "correctedD0VertexInEB"){ |
1487 |
< |
if(fabs(object->eta) < 0.8) value = object->correctedD0Vertex; |
1486 |
> |
else if(variable == "metMT") { |
1487 |
> |
const BNmet *met = chosenMET (); |
1488 |
> |
if (met) |
1489 |
> |
{ |
1490 |
> |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1491 |
> |
p2 (met->px, met->py, 0.0, met->pt); |
1492 |
> |
|
1493 |
> |
value = (p1 + p2).Mt (); |
1494 |
> |
} |
1495 |
> |
else |
1496 |
> |
value = -999; |
1497 |
> |
} |
1498 |
> |
|
1499 |
> |
else if(variable == "correctedD0VertexEEPositiveChargeLowPt"){ |
1500 |
> |
if(fabs(object->eta) > 1.479 && object->charge > 0 && object->pt > 45) value = object->correctedD0Vertex; |
1501 |
|
else value = -999; |
1502 |
|
} |
1503 |
< |
else if(variable == "correctedD0VertexOutEB"){ |
1504 |
< |
if(object->isEB && fabs(object->eta) > 0.8) value = object->correctedD0Vertex; |
1503 |
> |
else if(variable == "correctedD0VertexEEPositiveChargeHighPt"){ |
1504 |
> |
if(fabs(object->eta) > 1.479 && object->charge > 0 && object->pt < 45) value = object->correctedD0Vertex; |
1505 |
|
else value = -999; |
1506 |
|
} |
1507 |
< |
else if(variable == "correctedD0VertexEE"){ |
1508 |
< |
if(object->isEE) value = object->correctedD0Vertex; |
1507 |
> |
|
1508 |
> |
else if(variable == "correctedD0VertexInEBPlus"){ |
1509 |
> |
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
1510 |
> |
else value = -999; |
1511 |
> |
} |
1512 |
> |
else if(variable == "correctedD0VertexOutEBPlus"){ |
1513 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->eta > 0) value = object->correctedD0Vertex; |
1514 |
> |
else value = -999; |
1515 |
> |
} |
1516 |
> |
else if(variable == "correctedD0VertexEEPlus"){ |
1517 |
> |
if(object->isEE && object->eta > 0) value = object->correctedD0Vertex; |
1518 |
|
else value = -999; |
1519 |
|
} |
1520 |
|
|
1521 |
< |
else if(variable == "correctedD0BeamspotInEB"){ |
1522 |
< |
if(fabs(object->eta) < 0.8) value = object->correctedD0; |
1521 |
> |
else if(variable == "correctedD0BeamspotInEBPlus"){ |
1522 |
> |
if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0; |
1523 |
|
else value = -999; |
1524 |
|
} |
1525 |
< |
else if(variable == "correctedD0BeamspotOutEB"){ |
1526 |
< |
if(object->isEB && fabs(object->eta) > 0.8) value = object->correctedD0; |
1525 |
> |
else if(variable == "correctedD0BeamspotOutEBPlus"){ |
1526 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->eta > 0) value = object->correctedD0; |
1527 |
|
else value = -999; |
1528 |
|
} |
1529 |
< |
else if(variable == "correctedD0BeamspotEE"){ |
1530 |
< |
if(object->isEE) value = object->correctedD0; |
1529 |
> |
else if(variable == "correctedD0BeamspotEEPlus"){ |
1530 |
> |
if(object->isEE && object->eta > 0) value = object->correctedD0; |
1531 |
|
else value = -999; |
1532 |
|
} |
1533 |
|
|
1534 |
< |
else if(variable == "correctedD0OriginInEB"){ |
1535 |
< |
if(fabs(object->eta) < 0.8) value = object->tkD0; |
1534 |
> |
else if(variable == "correctedD0VertexInEBMinus"){ |
1535 |
> |
if(fabs(object->eta) < 0.8 && object->eta < 0) value = object->correctedD0Vertex; |
1536 |
|
else value = -999; |
1537 |
|
} |
1538 |
< |
else if(variable == "correctedD0OriginOutEB"){ |
1539 |
< |
if(object->isEB && fabs(object->eta) > 0.8) value = object->tkD0; |
1538 |
> |
else if(variable == "correctedD0VertexOutEBMinus"){ |
1539 |
> |
if(object->isEB && fabs(object->eta) > 0.8 && object->eta < 0) value = object->correctedD0Vertex; |
1540 |
|
else value = -999; |
1541 |
|
} |
1542 |
< |
else if(variable == "correctedD0OriginEE"){ |
1543 |
< |
if(object->isEE) value = object->tkD0; |
1542 |
> |
else if(variable == "correctedD0VertexEEMinus"){ |
1543 |
> |
if(object->isEE && object->eta < 0) value = object->correctedD0Vertex; |
1544 |
|
else value = -999; |
1545 |
|
} |
1546 |
|
|
1547 |
+ |
else if(variable == "correctedD0BeamspotInEBMinus"){ |
1548 |
+ |
if(fabs(object->eta) < 0.8 && object->eta < 0) value = object->correctedD0; |
1549 |
+ |
else value = -999; |
1550 |
+ |
} |
1551 |
+ |
else if(variable == "correctedD0BeamspotOutEBMinus"){ |
1552 |
+ |
if(object->isEB && fabs(object->eta) > 0.8 && object->eta < 0) value = object->correctedD0; |
1553 |
+ |
else value = -999; |
1554 |
+ |
} |
1555 |
+ |
else if(variable == "correctedD0BeamspotEEMinus"){ |
1556 |
+ |
if(object->isEE && object->eta < 0) value = object->correctedD0; |
1557 |
+ |
else value = -999; |
1558 |
+ |
} |
1559 |
+ |
|
1560 |
+ |
else if(variable == "tightID"){ |
1561 |
+ |
if (object->isEB) |
1562 |
+ |
{ |
1563 |
+ |
value = fabs(object->delEtaIn) < 0.004 \ |
1564 |
+ |
&& fabs (object->delPhiIn) < 0.03 \ |
1565 |
+ |
&& object->scSigmaIEtaIEta < 0.01 \ |
1566 |
+ |
&& object->hadOverEm < 0.12 \ |
1567 |
+ |
&& fabs (object->correctedD0Vertex) < 0.02 \ |
1568 |
+ |
&& fabs (object->correctedDZ) < 0.1 \ |
1569 |
+ |
&& object->absInvEMinusInvPin < 0.05 \ |
1570 |
+ |
&& object->passConvVeto; |
1571 |
+ |
} |
1572 |
+ |
else |
1573 |
+ |
{ |
1574 |
+ |
value = fabs(object->delEtaIn) < 0.005 \ |
1575 |
+ |
&& fabs (object->delPhiIn) < 0.02 \ |
1576 |
+ |
&& object->scSigmaIEtaIEta < 0.03 \ |
1577 |
+ |
&& object->hadOverEm < 0.10 \ |
1578 |
+ |
&& fabs (object->correctedD0Vertex) < 0.02 \ |
1579 |
+ |
&& fabs (object->correctedDZ) < 0.1 \ |
1580 |
+ |
&& object->absInvEMinusInvPin < 0.05 \ |
1581 |
+ |
&& object->passConvVeto; |
1582 |
+ |
} |
1583 |
+ |
} |
1584 |
+ |
|
1585 |
+ |
else if(variable == "correctedD0VertexInEBPositiveCharge"){ |
1586 |
+ |
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
1587 |
+ |
else value = -999; |
1588 |
+ |
} |
1589 |
+ |
else if(variable == "correctedD0VertexOutEBPositiveCharge"){ |
1590 |
+ |
if(object->isEB && fabs(object->eta) > 0.8 && object->charge > 0) value = object->correctedD0Vertex; |
1591 |
+ |
else value = -999; |
1592 |
+ |
} |
1593 |
+ |
else if(variable == "correctedD0VertexEEPositiveCharge"){ |
1594 |
+ |
if(object->isEE && object->charge > 0) value = object->correctedD0Vertex; |
1595 |
+ |
else value = -999; |
1596 |
+ |
} |
1597 |
+ |
|
1598 |
+ |
else if(variable == "correctedD0BeamspotInEBPositiveCharge"){ |
1599 |
+ |
if(fabs(object->eta) < 0.8 && object->charge > 0) value = object->correctedD0; |
1600 |
+ |
else value = -999; |
1601 |
+ |
} |
1602 |
+ |
else if(variable == "correctedD0BeamspotOutEBPositiveCharge"){ |
1603 |
+ |
if(object->isEB && fabs(object->eta) > 0.8 && object->charge > 0) value = object->correctedD0; |
1604 |
+ |
else value = -999; |
1605 |
+ |
} |
1606 |
+ |
else if(variable == "correctedD0BeamspotEEPositiveCharge"){ |
1607 |
+ |
if(object->isEE && object->charge > 0) value = object->correctedD0; |
1608 |
+ |
else value = -999; |
1609 |
+ |
} |
1610 |
+ |
|
1611 |
+ |
else if(variable == "correctedD0VertexInEBNegativeCharge"){ |
1612 |
+ |
if(fabs(object->eta) < 0.8 && object->charge < 0) value = object->correctedD0Vertex; |
1613 |
+ |
else value = -999; |
1614 |
+ |
} |
1615 |
+ |
else if(variable == "correctedD0VertexOutEBNegativeCharge"){ |
1616 |
+ |
if(object->isEB && fabs(object->eta) > 0.8 && object->charge < 0) value = object->correctedD0Vertex; |
1617 |
+ |
else value = -999; |
1618 |
+ |
} |
1619 |
+ |
else if(variable == "correctedD0VertexEENegativeCharge"){ |
1620 |
+ |
if(object->isEE && object->charge < 0) value = object->correctedD0Vertex; |
1621 |
+ |
else value = -999; |
1622 |
+ |
} |
1623 |
+ |
|
1624 |
+ |
else if(variable == "correctedD0BeamspotInEBNegativeCharge"){ |
1625 |
+ |
if(fabs(object->eta) < 0.8 && object->charge < 0) value = object->correctedD0; |
1626 |
+ |
else value = -999; |
1627 |
+ |
} |
1628 |
+ |
else if(variable == "correctedD0BeamspotOutEBNegativeCharge"){ |
1629 |
+ |
if(object->isEB && fabs(object->eta) > 0.8 && object->charge < 0) value = object->correctedD0; |
1630 |
+ |
else value = -999; |
1631 |
+ |
} |
1632 |
+ |
else if(variable == "correctedD0BeamspotEENegativeCharge"){ |
1633 |
+ |
if(object->isEE && object->charge < 0) value = object->correctedD0; |
1634 |
+ |
else value = -999; |
1635 |
+ |
} |
1636 |
+ |
|
1637 |
+ |
|
1638 |
|
else if(variable == "tightIDdisplaced"){ |
1639 |
|
if (object->isEB) |
1640 |
|
{ |
1641 |
< |
value = fabs(object->delEtaIn) < 0.004 \ |
1642 |
< |
&& fabs (object->delPhiIn) < 0.03 \ |
1641 |
> |
value = fabs(object->delEtaIn) < 0.004 \ |
1642 |
> |
&& fabs (object->delPhiIn) < 0.03 \ |
1643 |
|
&& object->scSigmaIEtaIEta < 0.01 \ |
1644 |
|
&& object->hadOverEm < 0.12 \ |
1645 |
< |
&& object->absInvEMinusInvPin < 0.05; |
1645 |
> |
&& object->absInvEMinusInvPin < 0.05; |
1646 |
|
} |
1647 |
|
else |
1648 |
|
{ |
1649 |
< |
value = fabs (object->delEtaIn) < 0.005 \ |
1650 |
< |
&& fabs (object->delPhiIn) < 0.02 \ |
1649 |
> |
value = fabs (object->delEtaIn) < 0.005 \ |
1650 |
> |
&& fabs (object->delPhiIn) < 0.02 \ |
1651 |
|
&& object->scSigmaIEtaIEta < 0.03 \ |
1652 |
|
&& object->hadOverEm < 0.10 \ |
1653 |
< |
&& object->absInvEMinusInvPin < 0.05; |
1653 |
> |
&& object->absInvEMinusInvPin < 0.05; |
1654 |
|
} |
1655 |
|
} |
1656 |
|
|
1657 |
+ |
|
1658 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1659 |
+ |
|
1660 |
+ |
else if(variable == "genMatchedPdgId"){ |
1661 |
+ |
int index = getGenMatchedParticleIndex(object); |
1662 |
+ |
if(index == -1) value = 0; |
1663 |
+ |
else value = mcparticles->at(index).id; |
1664 |
+ |
} |
1665 |
+ |
|
1666 |
+ |
|
1667 |
+ |
else if(variable == "genMatchedId"){ |
1668 |
+ |
int index = getGenMatchedParticleIndex(object); |
1669 |
+ |
if(index == -1) value = 0; |
1670 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
1671 |
+ |
} |
1672 |
+ |
else if(variable == "genMatchedMotherId"){ |
1673 |
+ |
int index = getGenMatchedParticleIndex(object); |
1674 |
+ |
if(index == -1) value = 0; |
1675 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1676 |
+ |
} |
1677 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1678 |
+ |
int index = getGenMatchedParticleIndex(object); |
1679 |
+ |
if(index == -1) value = 23; |
1680 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1681 |
+ |
} |
1682 |
+ |
else if(variable == "genMatchedGrandmotherId"){ |
1683 |
+ |
int index = getGenMatchedParticleIndex(object); |
1684 |
+ |
if(index == -1) value = 0; |
1685 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1686 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1687 |
+ |
if(motherIndex == -1) value = 0; |
1688 |
+ |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1689 |
+ |
} |
1690 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1691 |
+ |
} |
1692 |
+ |
|
1693 |
+ |
|
1694 |
+ |
|
1695 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1696 |
|
|
1697 |
|
value = applyFunction(function, value); |
1769 |
|
else if(variable == "id1") value = object->id1; |
1770 |
|
else if(variable == "id2") value = object->id2; |
1771 |
|
else if(variable == "evt") value = object->evt; |
1772 |
+ |
else if(variable == "puScaleFactor"){ |
1773 |
+ |
if(datasetType_ != "data") |
1774 |
+ |
value = puWeight_->at (events->at (0).numTruePV); |
1775 |
+ |
else |
1776 |
+ |
value = 1.0; |
1777 |
+ |
} |
1778 |
+ |
else if(variable == "muonScaleFactor"){ |
1779 |
+ |
if(datasetType_ != "data") |
1780 |
+ |
// value = muonSFWeight_->at (chosenMuon ()->eta); |
1781 |
+ |
value = 1.0; |
1782 |
+ |
else |
1783 |
+ |
value = 1.0; |
1784 |
+ |
} |
1785 |
+ |
else if(variable == "electronScaleFactor"){ |
1786 |
+ |
if(datasetType_ != "data") |
1787 |
+ |
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1788 |
+ |
value = 1.0; |
1789 |
+ |
else |
1790 |
+ |
value = 1.0; |
1791 |
+ |
} |
1792 |
|
|
1793 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1794 |
|
|
1843 |
|
else if(variable == "leadingTrackValid") value = object->leadingTrackValid; |
1844 |
|
|
1845 |
|
|
1846 |
+ |
|
1847 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1848 |
+ |
|
1849 |
+ |
else if(variable == "genMatchedPdgId"){ |
1850 |
+ |
int index = getGenMatchedParticleIndex(object); |
1851 |
+ |
if(index == -1) value = 0; |
1852 |
+ |
else value = mcparticles->at(index).id; |
1853 |
+ |
} |
1854 |
+ |
|
1855 |
+ |
else if(variable == "genMatchedId"){ |
1856 |
+ |
int index = getGenMatchedParticleIndex(object); |
1857 |
+ |
if(index == -1) value = 0; |
1858 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
1859 |
+ |
} |
1860 |
+ |
else if(variable == "genMatchedMotherId"){ |
1861 |
+ |
int index = getGenMatchedParticleIndex(object); |
1862 |
+ |
if(index == -1) value = 0; |
1863 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
1864 |
+ |
} |
1865 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
1866 |
+ |
int index = getGenMatchedParticleIndex(object); |
1867 |
+ |
if(index == -1) value = 23; |
1868 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1869 |
+ |
} |
1870 |
+ |
else if(variable == "genMatchedGrandmotherId"){ |
1871 |
+ |
int index = getGenMatchedParticleIndex(object); |
1872 |
+ |
if(index == -1) value = 0; |
1873 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1874 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1875 |
+ |
if(motherIndex == -1) value = 0; |
1876 |
+ |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1877 |
+ |
} |
1878 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1879 |
+ |
} |
1880 |
+ |
|
1881 |
+ |
|
1882 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1883 |
|
|
1884 |
|
value = applyFunction(function, value); |
1962 |
|
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){ |
1963 |
|
|
1964 |
|
double value = 0.0; |
1965 |
< |
|
1965 |
> |
double pMag = sqrt(object->pt * object->pt + |
1966 |
> |
object->pz * object->pz); |
1967 |
> |
|
1968 |
|
if(variable == "pt") value = object->pt; |
1969 |
|
else if(variable == "px") value = object->px; |
1970 |
|
else if(variable == "py") value = object->py; |
1984 |
|
else if(variable == "isHighPurity") value = object->isHighPurity; |
1985 |
|
|
1986 |
|
|
1987 |
+ |
//additional BNs info for disappTrks |
1988 |
+ |
else if(variable == "isGoodPtResolution") value = object->isGoodPtResolution; |
1989 |
+ |
else if(variable == "caloEMDeltaRp3") value = object->caloEMDeltaRp3; |
1990 |
+ |
else if(variable == "caloHadDeltaRp3") value = object->caloHadDeltaRp3; |
1991 |
+ |
else if(variable == "caloEMDeltaRp4") value = object->caloEMDeltaRp4; |
1992 |
+ |
else if(variable == "caloHadDeltaRp4") value = object->caloHadDeltaRp4; |
1993 |
+ |
else if(variable == "caloEMDeltaRp5") value = object->caloEMDeltaRp5; |
1994 |
+ |
else if(variable == "caloHadDeltaRp5") value = object->caloHadDeltaRp5; |
1995 |
+ |
else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter; |
1996 |
+ |
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
1997 |
+ |
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
1998 |
+ |
|
1999 |
+ |
|
2000 |
+ |
//user defined variables |
2001 |
+ |
else if(variable == "d0wrtBS") value = (object->vx-events->at(0).BSx)*object->py/object->pt - (object->vy-events->at(0).BSy)*object->px/object->pt; |
2002 |
+ |
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2003 |
+ |
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2004 |
+ |
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2005 |
+ |
else if(variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2006 |
+ |
else if(variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2007 |
+ |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2008 |
+ |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2009 |
+ |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2010 |
+ |
else if(variable == "ptError") value = object->ptError; |
2011 |
+ |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2012 |
+ |
else if (variable == "d0wrtPV"){ |
2013 |
+ |
double vx = object->vx - chosenVertex ()->x, |
2014 |
+ |
vy = object->vy - chosenVertex ()->y, |
2015 |
+ |
px = object->px, |
2016 |
+ |
py = object->py, |
2017 |
+ |
pt = object->pt; |
2018 |
+ |
value = (-vx * py + vy * px) / pt; |
2019 |
+ |
} |
2020 |
+ |
else if (variable == "dZwrtPV"){ |
2021 |
+ |
double vx = object->vx - chosenVertex ()->x, |
2022 |
+ |
vy = object->vy - chosenVertex ()->y, |
2023 |
+ |
vz = object->vz - chosenVertex ()->z, |
2024 |
+ |
px = object->px, |
2025 |
+ |
py = object->py, |
2026 |
+ |
pz = object->pz, |
2027 |
+ |
pt = object->pt; |
2028 |
+ |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2029 |
+ |
} |
2030 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2031 |
+ |
|
2032 |
+ |
else if(variable == "genMatchedPdgId"){ |
2033 |
+ |
int index = getGenMatchedParticleIndex(object); |
2034 |
+ |
if(index == -1) value = 0; |
2035 |
+ |
else value = mcparticles->at(index).id; |
2036 |
+ |
} |
2037 |
+ |
|
2038 |
+ |
|
2039 |
+ |
else if(variable == "genMatchedId"){ |
2040 |
+ |
int index = getGenMatchedParticleIndex(object); |
2041 |
+ |
if(index == -1) value = 0; |
2042 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
2043 |
+ |
} |
2044 |
+ |
else if(variable == "genMatchedMotherId"){ |
2045 |
+ |
int index = getGenMatchedParticleIndex(object); |
2046 |
+ |
if(index == -1) value = 0; |
2047 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2048 |
+ |
} |
2049 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
2050 |
+ |
int index = getGenMatchedParticleIndex(object); |
2051 |
+ |
if(index == -1) value = 23; |
2052 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2053 |
+ |
} |
2054 |
+ |
else if(variable == "genMatchedGrandmotherId"){ |
2055 |
+ |
int index = getGenMatchedParticleIndex(object); |
2056 |
+ |
if(index == -1) value = 0; |
2057 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2058 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2059 |
+ |
if(motherIndex == -1) value = 0; |
2060 |
+ |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2061 |
+ |
} |
2062 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2063 |
+ |
} |
2064 |
+ |
|
2065 |
+ |
|
2066 |
+ |
|
2067 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2068 |
|
|
2069 |
|
value = applyFunction(function, value); |
2191 |
|
|
2192 |
|
//user-defined variables |
2193 |
|
else if (variable == "d0"){ |
2194 |
< |
double vx = object->vx - primaryVertex_->x, |
2195 |
< |
vy = object->vy - primaryVertex_->y, |
2194 |
> |
double vx = object->vx - chosenVertex ()->x, |
2195 |
> |
vy = object->vy - chosenVertex ()->y, |
2196 |
|
px = object->px, |
2197 |
|
py = object->py, |
2198 |
|
pt = object->pt; |
2199 |
|
value = (-vx * py + vy * px) / pt; |
2200 |
|
} |
2201 |
|
else if (variable == "dz"){ |
2202 |
< |
double vx = object->vx - primaryVertex_->x, |
2203 |
< |
vy = object->vy - primaryVertex_->y, |
2204 |
< |
vz = object->vz - primaryVertex_->z, |
2202 |
> |
double vx = object->vx - chosenVertex ()->x, |
2203 |
> |
vy = object->vy - chosenVertex ()->y, |
2204 |
> |
vz = object->vz - chosenVertex ()->z, |
2205 |
|
px = object->px, |
2206 |
|
py = object->py, |
2207 |
|
pz = object->pz, |
2212 |
|
value = sqrt(object->vx*object->vx + object->vy*object->vy); |
2213 |
|
} |
2214 |
|
else if(variable == "deltaV0"){ |
2215 |
< |
value = sqrt((object->vx-primaryVertex_->x)*(object->vx-primaryVertex_->x) + (object->vy-primaryVertex_->y)*(object->vy-primaryVertex_->y)); |
2215 |
> |
value = sqrt((object->vx-chosenVertex ()->x)*(object->vx-chosenVertex ()->x) + (object->vy-chosenVertex ()->y)*(object->vy-chosenVertex ()->y)); |
2216 |
|
} |
2217 |
|
else if (variable == "deltaVx"){ |
2218 |
< |
value = object->vx - primaryVertex_->x; |
2218 |
> |
value = object->vx - chosenVertex ()->x; |
2219 |
|
} |
2220 |
|
else if (variable == "deltaVy"){ |
2221 |
< |
value = object->vy - primaryVertex_->y; |
2221 |
> |
value = object->vy - chosenVertex ()->y; |
2222 |
|
} |
2223 |
|
else if (variable == "deltaVz"){ |
2224 |
< |
value = object->vz - primaryVertex_->z; |
2224 |
> |
value = object->vz - chosenVertex ()->z; |
2225 |
|
} |
2226 |
|
|
2227 |
|
|
2352 |
|
else if(variable == "seedRecoFlag") value = object->seedRecoFlag; |
2353 |
|
|
2354 |
|
|
2355 |
+ |
|
2356 |
+ |
|
2357 |
+ |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2358 |
+ |
|
2359 |
+ |
else if(variable == "genMatchedPdgId"){ |
2360 |
+ |
int index = getGenMatchedParticleIndex(object); |
2361 |
+ |
if(index == -1) value = 0; |
2362 |
+ |
else value = mcparticles->at(index).id; |
2363 |
+ |
} |
2364 |
+ |
|
2365 |
+ |
|
2366 |
+ |
|
2367 |
+ |
else if(variable == "genMatchedId"){ |
2368 |
+ |
int index = getGenMatchedParticleIndex(object); |
2369 |
+ |
if(index == -1) value = 0; |
2370 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).id); |
2371 |
+ |
} |
2372 |
+ |
else if(variable == "genMatchedMotherId"){ |
2373 |
+ |
int index = getGenMatchedParticleIndex(object); |
2374 |
+ |
if(index == -1) value = 0; |
2375 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).motherId); |
2376 |
+ |
} |
2377 |
+ |
else if(variable == "genMatchedMotherIdReverse"){ |
2378 |
+ |
int index = getGenMatchedParticleIndex(object); |
2379 |
+ |
if(index == -1) value = 23; |
2380 |
+ |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2381 |
+ |
} |
2382 |
+ |
else if(variable == "genMatchedGrandmotherId"){ |
2383 |
+ |
int index = getGenMatchedParticleIndex(object); |
2384 |
+ |
if(index == -1) value = 0; |
2385 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2386 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2387 |
+ |
if(motherIndex == -1) value = 0; |
2388 |
+ |
else value = getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2389 |
+ |
} |
2390 |
+ |
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2391 |
+ |
} |
2392 |
+ |
|
2393 |
+ |
|
2394 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2395 |
|
|
2396 |
|
value = applyFunction(function, value); |
2426 |
|
|
2427 |
|
double value = 0.0; |
2428 |
|
|
2429 |
< |
if(variable == "deltaPhi") value = deltaPhi(object1->phi,object2->phi); |
2429 |
> |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2430 |
> |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2431 |
|
else if(variable == "invMass"){ |
2432 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2433 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2434 |
|
value = (fourVector1 + fourVector2).M(); |
2435 |
|
} |
2436 |
+ |
else if(variable == "pt"){ |
2437 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2438 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2439 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2440 |
+ |
} |
2441 |
+ |
else if(variable == "threeDAngle") |
2442 |
+ |
{ |
2443 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2444 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2445 |
+ |
value = (threeVector1.Angle(threeVector2)); |
2446 |
+ |
} |
2447 |
+ |
else if(variable == "alpha") |
2448 |
+ |
{ |
2449 |
+ |
static const double pi = 3.1415926535897932384626433832795028841971693993751058; |
2450 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2451 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2452 |
+ |
value = (pi-threeVector1.Angle(threeVector2)); |
2453 |
+ |
} |
2454 |
|
else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex; |
2455 |
|
else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex); |
2456 |
|
else if(variable == "d0Sign"){ |
2459 |
|
else if (d0Sign > 0) value = 0.5; |
2460 |
|
else value = -999; |
2461 |
|
} |
2462 |
+ |
else if(variable == "chargeProduct"){ |
2463 |
+ |
value = object1->charge*object2->charge; |
2464 |
+ |
} |
2465 |
|
else if(variable == "muon1CorrectedD0Vertex"){ |
2466 |
|
value = object1->correctedD0Vertex; |
2467 |
|
} |
2468 |
|
else if(variable == "muon2CorrectedD0Vertex"){ |
2469 |
|
value = object2->correctedD0Vertex; |
2470 |
|
} |
2471 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2472 |
< |
|
2471 |
> |
else if(variable == "muon1timeAtIpInOut"){ |
2472 |
> |
value = object1->timeAtIpInOut; |
2473 |
> |
} |
2474 |
> |
else if(variable == "muon2timeAtIpInOut"){ |
2475 |
> |
value = object2->timeAtIpInOut; |
2476 |
> |
} |
2477 |
> |
else if(variable == "muon1correctedD0") |
2478 |
> |
{ |
2479 |
> |
value = object1->correctedD0; |
2480 |
> |
} |
2481 |
> |
else if(variable == "muon2correctedD0") |
2482 |
> |
{ |
2483 |
> |
value = object2->correctedD0; |
2484 |
> |
} |
2485 |
|
|
2486 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2487 |
|
|
2488 |
|
value = applyFunction(function, value); |
2489 |
|
|
2495 |
|
|
2496 |
|
double value = 0.0; |
2497 |
|
|
2498 |
< |
if(variable == "deltaPhi") value = deltaPhi(object1->phi,object2->phi); |
2498 |
> |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2499 |
> |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2500 |
|
else if(variable == "invMass"){ |
2501 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2502 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2503 |
|
value = (fourVector1 + fourVector2).M(); |
2504 |
|
} |
2505 |
+ |
else if(variable == "pt"){ |
2506 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2507 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2508 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2509 |
+ |
} |
2510 |
+ |
else if(variable == "threeDAngle") |
2511 |
+ |
{ |
2512 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2513 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2514 |
+ |
value = (threeVector1.Angle(threeVector2)); |
2515 |
+ |
} |
2516 |
|
else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex; |
2517 |
|
else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex); |
2518 |
|
else if(variable == "d0Sign"){ |
2521 |
|
else if (d0Sign > 0) value = 0.5; |
2522 |
|
else value = -999; |
2523 |
|
} |
2524 |
+ |
else if(variable == "chargeProduct"){ |
2525 |
+ |
value = object1->charge*object2->charge; |
2526 |
+ |
} |
2527 |
|
else if(variable == "electron1CorrectedD0Vertex"){ |
2528 |
|
value = object1->correctedD0Vertex; |
2529 |
|
} |
2530 |
|
else if(variable == "electron2CorrectedD0Vertex"){ |
2531 |
|
value = object2->correctedD0Vertex; |
2532 |
|
} |
2533 |
+ |
else if(variable == "electron1CorrectedD0"){ |
2534 |
+ |
value = object1->correctedD0; |
2535 |
+ |
} |
2536 |
+ |
else if(variable == "electron2CorrectedD0"){ |
2537 |
+ |
value = object2->correctedD0; |
2538 |
+ |
} |
2539 |
+ |
|
2540 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2541 |
|
|
2542 |
|
value = applyFunction(function, value); |
2549 |
|
|
2550 |
|
double value = 0.0; |
2551 |
|
|
2552 |
< |
if(variable == "deltaPhi") value = deltaPhi(object1->phi,object2->phi); |
2552 |
> |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2553 |
> |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2554 |
|
else if(variable == "invMass"){ |
2555 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2556 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2557 |
|
value = (fourVector1 + fourVector2).M(); |
2558 |
|
} |
2559 |
+ |
else if(variable == "pt"){ |
2560 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2561 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2562 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
2563 |
+ |
} |
2564 |
+ |
else if(variable == "threeDAngle") |
2565 |
+ |
{ |
2566 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
2567 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
2568 |
+ |
value = (threeVector1.Angle(threeVector2)); |
2569 |
+ |
} |
2570 |
|
else if(variable == "deltaCorrectedD0Vertex") value = object1->correctedD0Vertex - object2->correctedD0Vertex; |
2571 |
|
else if(variable == "deltaAbsCorrectedD0Vertex") value = fabs(object1->correctedD0Vertex) - fabs(object2->correctedD0Vertex); |
2572 |
|
else if(variable == "d0Sign"){ |
2575 |
|
else if (d0Sign > 0) value = 0.5; |
2576 |
|
else value = -999; |
2577 |
|
} |
2578 |
+ |
else if(variable == "chargeProduct"){ |
2579 |
+ |
value = object1->charge*object2->charge; |
2580 |
+ |
} |
2581 |
|
else if(variable == "electronCorrectedD0Vertex"){ |
2582 |
|
value = object1->correctedD0Vertex; |
2583 |
|
} |
2584 |
|
else if(variable == "muonCorrectedD0Vertex"){ |
2585 |
|
value = object2->correctedD0Vertex; |
2586 |
|
} |
2587 |
+ |
else if(variable == "electronCorrectedD0"){ |
2588 |
+ |
value = object1->correctedD0; |
2589 |
+ |
} |
2590 |
+ |
else if(variable == "muonCorrectedD0"){ |
2591 |
+ |
value = object2->correctedD0; |
2592 |
+ |
} |
2593 |
+ |
else if(variable == "electronDetIso"){ |
2594 |
+ |
value = (object1->trackIso) / object1->pt; |
2595 |
+ |
} |
2596 |
+ |
else if(variable == "muonDetIso"){ |
2597 |
+ |
value = (object2->trackIsoDR03) / object2->pt; |
2598 |
+ |
} |
2599 |
+ |
|
2600 |
|
|
2601 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2602 |
|
|
2606 |
|
} |
2607 |
|
|
2608 |
|
|
2609 |
+ |
double |
2610 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){ |
2611 |
+ |
double electronMass = 0.000511; |
2612 |
+ |
double value = 0.0; |
2613 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
2614 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
2615 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2616 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2617 |
+ |
else if(variable == "invMass"){ |
2618 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
2619 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
2620 |
+ |
|
2621 |
+ |
value = (fourVector1 + fourVector2).M(); |
2622 |
+ |
} |
2623 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2624 |
+ |
value = applyFunction(function, value); |
2625 |
+ |
return value; |
2626 |
+ |
} |
2627 |
+ |
|
2628 |
+ |
|
2629 |
+ |
|
2630 |
+ |
double |
2631 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){ |
2632 |
+ |
double pionMass = 0.140; |
2633 |
+ |
double muonMass = 0.106; |
2634 |
+ |
double value = 0.0; |
2635 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
2636 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
2637 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2638 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2639 |
+ |
else if(variable == "invMass"){ |
2640 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
2641 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass ); |
2642 |
+ |
|
2643 |
+ |
value = (fourVector1 + fourVector2).M(); |
2644 |
+ |
} |
2645 |
+ |
|
2646 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2647 |
+ |
value = applyFunction(function, value); |
2648 |
+ |
return value; |
2649 |
+ |
} |
2650 |
+ |
|
2651 |
+ |
|
2652 |
+ |
double |
2653 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){ |
2654 |
+ |
double value = 0.0; |
2655 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2656 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2657 |
+ |
else if(variable == "invMass"){ |
2658 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2659 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2660 |
+ |
value = (fourVector1 + fourVector2).M(); |
2661 |
+ |
} |
2662 |
+ |
|
2663 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2664 |
+ |
value = applyFunction(function, value); |
2665 |
+ |
return value; |
2666 |
+ |
} |
2667 |
+ |
|
2668 |
+ |
|
2669 |
+ |
double |
2670 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){ |
2671 |
+ |
double value = 0.0; |
2672 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2673 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2674 |
+ |
else if(variable == "invMass"){ |
2675 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2676 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2677 |
+ |
value = (fourVector1 + fourVector2).M(); |
2678 |
+ |
} |
2679 |
+ |
|
2680 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2681 |
+ |
value = applyFunction(function, value); |
2682 |
+ |
return value; |
2683 |
+ |
} |
2684 |
+ |
|
2685 |
+ |
|
2686 |
+ |
double |
2687 |
+ |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){ |
2688 |
+ |
|
2689 |
+ |
double value = 0.0; |
2690 |
+ |
double pMag = sqrt(object1->pt * object1->pt + |
2691 |
+ |
object1->pz * object1->pz); |
2692 |
+ |
|
2693 |
+ |
if (variable == "numPV") value = object2->numPV; |
2694 |
+ |
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
2695 |
+ |
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
2696 |
+ |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
2697 |
+ |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
2698 |
+ |
|
2699 |
+ |
else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
2700 |
+ |
|
2701 |
+ |
value = applyFunction(function, value); |
2702 |
+ |
|
2703 |
+ |
return value; |
2704 |
+ |
|
2705 |
+ |
} |
2706 |
+ |
|
2707 |
+ |
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
2708 |
+ |
// Return true iff no other tracks are found in this cone. |
2709 |
+ |
int |
2710 |
+ |
OSUAnalysis::getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl){ |
2711 |
+ |
for(BNtrackCollection::const_iterator track2 = trackColl->begin(); track2 !=trackColl->end(); track2++){ |
2712 |
+ |
if(track1->eta == track2->eta && track1->phi == track2->phi) continue; // Do not compare the track to itself. |
2713 |
+ |
double deltaRtrk = deltaR(track1->eta, track1->phi, track2->eta, track2->phi); |
2714 |
+ |
if(deltaRtrk < 0.5) return 0; |
2715 |
+ |
} |
2716 |
+ |
return 1; |
2717 |
+ |
|
2718 |
+ |
} |
2719 |
+ |
|
2720 |
+ |
|
2721 |
+ |
double |
2722 |
+ |
OSUAnalysis::getTrkPtRes (const BNtrack* track1){ |
2723 |
+ |
|
2724 |
+ |
double ptTrue = getTrkPtTrue(track1, mcparticles.product()); |
2725 |
+ |
double PtRes = (track1->pt - ptTrue) / ptTrue; |
2726 |
+ |
|
2727 |
+ |
return PtRes; |
2728 |
+ |
|
2729 |
+ |
} |
2730 |
+ |
|
2731 |
+ |
|
2732 |
+ |
double |
2733 |
+ |
OSUAnalysis::getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl){ |
2734 |
+ |
double value = -99; |
2735 |
+ |
double genDeltaRLowest = 999; |
2736 |
+ |
|
2737 |
+ |
for (BNmcparticleCollection::const_iterator genPart = genPartColl->begin(); genPart !=genPartColl->end(); genPart++){ |
2738 |
+ |
double genDeltaRtemp = deltaR(genPart->eta, genPart->phi,track1->eta, track1->phi); |
2739 |
+ |
if (genDeltaRtemp < genDeltaRLowest) { |
2740 |
+ |
genDeltaRLowest = genDeltaRtemp; |
2741 |
+ |
if (genDeltaRLowest < 0.05) { // Only consider it truth-matched if DeltaR<0.15. |
2742 |
+ |
double ptTrue = genPart->pt; |
2743 |
+ |
value = ptTrue; |
2744 |
+ |
} |
2745 |
+ |
} |
2746 |
+ |
} |
2747 |
+ |
|
2748 |
+ |
return value; |
2749 |
+ |
|
2750 |
+ |
} |
2751 |
+ |
|
2752 |
+ |
double |
2753 |
+ |
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
2754 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
2755 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
2756 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
2757 |
+ |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
2758 |
+ |
// return -99; |
2759 |
+ |
// } |
2760 |
+ |
double radDeltaRCone = 0.5; |
2761 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
2762 |
+ |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
2763 |
+ |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
2764 |
+ |
return caloTotRhoCorrCalo; |
2765 |
+ |
|
2766 |
+ |
} |
2767 |
+ |
|
2768 |
+ |
|
2769 |
+ |
|
2770 |
+ |
|
2771 |
+ |
//creates a map of the dead Ecal channels in the barrel and endcap |
2772 |
+ |
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
2773 |
+ |
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
2774 |
+ |
void |
2775 |
+ |
OSUAnalysis::WriteDeadEcal (){ |
2776 |
+ |
double etaEcal, phiEcal; |
2777 |
+ |
ifstream DeadEcalFile(deadEcalFile_); |
2778 |
+ |
if(!DeadEcalFile) { |
2779 |
+ |
cout << "Error: DeadEcalFile has not been found." << endl; |
2780 |
+ |
return; |
2781 |
+ |
} |
2782 |
+ |
if(DeadEcalVec.size()!= 0){ |
2783 |
+ |
cout << "Error: DeadEcalVec has a nonzero size" << endl; |
2784 |
+ |
return; |
2785 |
+ |
} |
2786 |
+ |
while(!DeadEcalFile.eof()) |
2787 |
+ |
{ |
2788 |
+ |
DeadEcalFile >> etaEcal >> phiEcal; |
2789 |
+ |
DeadEcal newChan; |
2790 |
+ |
newChan.etaEcal = etaEcal; |
2791 |
+ |
newChan.phiEcal = phiEcal; |
2792 |
+ |
DeadEcalVec.push_back(newChan); |
2793 |
+ |
} |
2794 |
+ |
if(DeadEcalVec.size() == 0) cout << "Warning: No dead Ecal channels have been found." << endl; |
2795 |
+ |
} |
2796 |
+ |
|
2797 |
+ |
//if a track is found within dR<0.05 of a dead Ecal channel value = 1, otherwise value = 0 |
2798 |
+ |
int |
2799 |
+ |
OSUAnalysis::getTrkIsMatchedDeadEcal (const BNtrack* track1){ |
2800 |
+ |
double deltaRLowest = 999; |
2801 |
+ |
int value = 0; |
2802 |
+ |
if (DeadEcalVec.size() == 0) WriteDeadEcal(); |
2803 |
+ |
for(std::vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
2804 |
+ |
double eta = ecal->etaEcal; |
2805 |
+ |
double phi = ecal->phiEcal; |
2806 |
+ |
double deltaRtemp = deltaR(eta, track1->eta, phi, track1->phi); |
2807 |
+ |
if(deltaRtemp < deltaRLowest) deltaRLowest = deltaRtemp; |
2808 |
+ |
} |
2809 |
+ |
if (deltaRLowest<0.05) {value = 1;} |
2810 |
+ |
else {value = 0;} |
2811 |
+ |
return value; |
2812 |
+ |
} |
2813 |
+ |
|
2814 |
+ |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
2815 |
+ |
template <class InputObject> |
2816 |
+ |
double OSUAnalysis::getGenDeltaRLowest(InputObject object){ |
2817 |
+ |
double genDeltaRLowest = 999.; |
2818 |
+ |
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
2819 |
+ |
double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi); |
2820 |
+ |
if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp; |
2821 |
+ |
} |
2822 |
+ |
return genDeltaRLowest; |
2823 |
+ |
} |
2824 |
+ |
|
2825 |
|
double |
2826 |
|
OSUAnalysis::applyFunction(string function, double value){ |
2827 |
|
|
2828 |
|
if(function == "abs") value = fabs(value); |
2829 |
|
else if(function == "fabs") value = fabs(value); |
2830 |
< |
|
2830 |
> |
else if(function == "log10") value = log10(value); |
2831 |
> |
else if(function == "log") value = log10(value); |
2832 |
|
|
2833 |
|
else if(function == "") value = value; |
2834 |
|
else{std::cout << "WARNING: invalid function '" << function << "'\n";} |
2841 |
|
template <class InputCollection> |
2842 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
2843 |
|
|
2844 |
+ |
|
2845 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
2846 |
|
|
2847 |
+ |
|
2848 |
|
bool decision = true;//object passes if this cut doesn't cut on that type of object |
2849 |
|
|
2850 |
+ |
|
2851 |
|
if(currentCut.inputCollection == inputType){ |
2852 |
|
|
2853 |
|
vector<bool> subcutDecisions; |
2854 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
2855 |
< |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
2856 |
< |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
2855 |
> |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
2856 |
> |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
2857 |
|
} |
2858 |
|
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
2859 |
|
else{ |
2860 |
< |
bool tempDecision = true; |
2861 |
< |
for( int subcutIndex = 0;subcutIndex != currentCut.numSubcuts-1; subcutIndex++){ |
2862 |
< |
if(currentCut.logicalOperators.at(subcutIndex) == "&" || currentCut.logicalOperators.at(subcutIndex) == "&&") |
2863 |
< |
tempDecision = subcutDecisions.at(subcutIndex) && subcutDecisions.at(subcutIndex+1); |
2864 |
< |
else if(currentCut.logicalOperators.at(subcutIndex) == "|"|| currentCut.logicalOperators.at(subcutIndex) == "||") |
2860 |
> |
bool tempDecision = true; |
2861 |
> |
for( int subcutIndex = 0;subcutIndex != currentCut.numSubcuts-1; subcutIndex++){ |
2862 |
> |
if(currentCut.logicalOperators.at(subcutIndex) == "&" || currentCut.logicalOperators.at(subcutIndex) == "&&") |
2863 |
> |
tempDecision = subcutDecisions.at(subcutIndex) && subcutDecisions.at(subcutIndex+1); |
2864 |
> |
else if(currentCut.logicalOperators.at(subcutIndex) == "|"|| currentCut.logicalOperators.at(subcutIndex) == "||") |
2865 |
|
tempDecision = subcutDecisions.at(subcutIndex) || subcutDecisions.at(subcutIndex+1); |
2866 |
< |
} |
2867 |
< |
decision = tempDecision; |
2866 |
> |
} |
2867 |
> |
decision = tempDecision; |
2868 |
|
} |
2869 |
|
} |
2870 |
|
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
2871 |
|
|
2872 |
+ |
|
2873 |
|
//set flags for objects that pass each cut AND all the previous cuts |
2874 |
|
bool previousCumulativeFlag = true; |
2875 |
|
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
2878 |
|
} |
2879 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
2880 |
|
|
2881 |
+ |
|
2882 |
|
} |
2883 |
|
|
2884 |
|
} |
2886 |
|
|
2887 |
|
template <class InputCollection1, class InputCollection2> |
2888 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, \ |
2889 |
< |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, string inputType){ |
2889 |
> |
InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, string inputType){ |
2890 |
|
|
2891 |
|
|
2892 |
|
bool sameObjects = false; |
2893 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
2894 |
|
|
2895 |
< |
int counter = 0; |
2895 |
> |
|
2896 |
> |
int counter = 0; |
2897 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
2898 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
2899 |
< |
|
2899 |
> |
|
2900 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
2901 |
|
|
2902 |
|
|
2904 |
|
|
2905 |
|
if(currentCut.inputCollection == inputType){ |
2906 |
|
|
2907 |
< |
vector<bool> subcutDecisions; |
2908 |
< |
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
2909 |
< |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
2910 |
< |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
2911 |
< |
} |
2907 |
> |
vector<bool> subcutDecisions; |
2908 |
> |
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
2909 |
> |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
2910 |
> |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
2911 |
> |
} |
2912 |
|
|
2913 |
< |
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
2914 |
< |
else{ |
2915 |
< |
bool tempDecision = true; |
2916 |
< |
for( int subcutIndex = 0;subcutIndex != currentCut.numSubcuts-1; subcutIndex++){ |
2917 |
< |
if(currentCut.logicalOperators.at(subcutIndex) == "&" || currentCut.logicalOperators.at(subcutIndex) == "&&") |
2918 |
< |
tempDecision = subcutDecisions.at(subcutIndex) && subcutDecisions.at(subcutIndex+1); |
2919 |
< |
else if(currentCut.logicalOperators.at(subcutIndex) == "|"|| currentCut.logicalOperators.at(subcutIndex) == "||") |
2920 |
< |
tempDecision = subcutDecisions.at(subcutIndex) || subcutDecisions.at(subcutIndex+1); |
2921 |
< |
} |
2922 |
< |
decision = tempDecision; |
2923 |
< |
} |
2913 |
> |
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
2914 |
> |
else{ |
2915 |
> |
bool tempDecision = subcutDecisions.at(0); |
2916 |
> |
for( int subcutIndex = 1; subcutIndex < currentCut.numSubcuts; subcutIndex++){ |
2917 |
> |
if(currentCut.logicalOperators.at(subcutIndex-1) == "&" || currentCut.logicalOperators.at(subcutIndex-1) == "&&") |
2918 |
> |
tempDecision = tempDecision && subcutDecisions.at(subcutIndex); |
2919 |
> |
else if(currentCut.logicalOperators.at(subcutIndex-1) == "|"|| currentCut.logicalOperators.at(subcutIndex-1) == "||") |
2920 |
> |
tempDecision = tempDecision || subcutDecisions.at(subcutIndex); |
2921 |
> |
} |
2922 |
> |
decision = tempDecision; |
2923 |
> |
} |
2924 |
|
} |
2925 |
|
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
2926 |
< |
|
2926 |
> |
|
2927 |
|
//set flags for objects that pass each cut AND all the previous cuts |
2928 |
|
bool previousCumulativeFlag = true; |
2929 |
|
for(uint previousCutIndex = 0; previousCutIndex != currentCutIndex; previousCutIndex++){ |
2930 |
< |
if(previousCumulativeFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter)) previousCumulativeFlag = true; |
2931 |
< |
else{ previousCumulativeFlag = false; break;} |
2930 |
> |
if(previousCumulativeFlag && individualFlags.at(inputType).at(previousCutIndex).at(counter)) previousCumulativeFlag = true; |
2931 |
> |
else{ previousCumulativeFlag = false; break;} |
2932 |
|
} |
2933 |
< |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
2933 |
> |
//apply flags for the components of the composite object as well |
2934 |
> |
bool currentCumulativeFlag = true; |
2935 |
> |
if(flags1.size() == 0 && flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision; |
2936 |
> |
else if(flags1.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags2.at(object2); |
2937 |
> |
else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1); |
2938 |
> |
else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2); |
2939 |
> |
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag); |
2940 |
|
|
2941 |
< |
counter++; |
2941 |
> |
counter++; |
2942 |
|
} |
2943 |
< |
|
2943 |
> |
|
2944 |
|
} |
2945 |
|
|
2946 |
|
|
2948 |
|
|
2949 |
|
|
2950 |
|
template <class InputCollection> |
2951 |
< |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double puScaleFactor){ |
2951 |
> |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double scaleFactor){ |
2952 |
|
|
2953 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
2954 |
|
|
2958 |
|
string inputVariable = ""; |
2959 |
|
string function = ""; |
2960 |
|
if(currentString.find("(")==std::string::npos){ |
2961 |
< |
inputVariable = currentString;// variable to cut on |
2961 |
> |
inputVariable = currentString;// variable to cut on |
2962 |
|
} |
2963 |
|
else{ |
2964 |
< |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
2965 |
< |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
2966 |
< |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
2964 |
> |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
2965 |
> |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
2966 |
> |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
2967 |
|
} |
2968 |
|
|
2969 |
|
double value = valueLookup(&inputCollection->at(object), inputVariable, function); |
2970 |
< |
histo->Fill(value,puScaleFactor); |
2970 |
> |
histo->Fill(value,scaleFactor); |
2971 |
|
|
2972 |
+ |
if (printEventInfo_) { |
2973 |
+ |
// Write information about event to screen, for testing purposes. |
2974 |
+ |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
2975 |
+ |
} |
2976 |
+ |
|
2977 |
|
} |
1936 |
– |
|
2978 |
|
} |
2979 |
|
|
2980 |
|
template <class InputCollection1, class InputCollection2> |
2981 |
< |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, vector<bool> pairFlags, double puScaleFactor){ |
2981 |
> |
void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, vector<bool> pairFlags, double scaleFactor){ |
2982 |
|
|
2983 |
|
bool sameObjects = false; |
2984 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
2985 |
|
|
2986 |
< |
int counter = 0; |
2986 |
> |
int pairCounter = 0; |
2987 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
2988 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
2989 |
< |
|
2989 |
> |
|
2990 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
2991 |
|
|
2992 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
2993 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
2994 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
2995 |
< |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(counter)) continue; |
2995 |
> |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue; |
2996 |
|
|
2997 |
|
string currentString = parameters.inputVariables.at(0); |
2998 |
|
string inputVariable = ""; |
2999 |
|
string function = ""; |
3000 |
|
if(currentString.find("(")==std::string::npos){ |
3001 |
< |
inputVariable = currentString;// variable to cut on |
3001 |
> |
inputVariable = currentString;// variable to cut on |
3002 |
|
} |
3003 |
|
else{ |
3004 |
< |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3005 |
< |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3006 |
< |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3004 |
> |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3005 |
> |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3006 |
> |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3007 |
|
} |
3008 |
< |
|
3008 |
> |
|
3009 |
|
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3010 |
< |
histo->Fill(value,puScaleFactor); |
3010 |
> |
histo->Fill(value,scaleFactor); |
3011 |
|
|
3012 |
< |
counter++; |
3012 |
> |
pairCounter++; |
3013 |
|
} |
3014 |
|
} |
3015 |
|
|
3017 |
|
|
3018 |
|
|
3019 |
|
template <class InputCollection> |
3020 |
< |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double puScaleFactor){ |
3020 |
> |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double scaleFactor){ |
3021 |
|
|
3022 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
3023 |
|
|
3027 |
|
string inputVariable = ""; |
3028 |
|
string function = ""; |
3029 |
|
if(currentString.find("(")==std::string::npos){ |
3030 |
< |
inputVariable = currentString;// variable to cut on |
3030 |
> |
inputVariable = currentString;// variable to cut on |
3031 |
|
} |
3032 |
|
else{ |
3033 |
< |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3034 |
< |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3035 |
< |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3033 |
> |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3034 |
> |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3035 |
> |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3036 |
|
} |
3037 |
|
double valueX = valueLookup(&inputCollection->at(object), inputVariable, function); |
3038 |
|
|
3040 |
|
inputVariable = ""; |
3041 |
|
function = ""; |
3042 |
|
if(currentString.find("(")==std::string::npos){ |
3043 |
< |
inputVariable = currentString;// variable to cut on |
3043 |
> |
inputVariable = currentString;// variable to cut on |
3044 |
|
} |
3045 |
|
else{ |
3046 |
< |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3047 |
< |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3048 |
< |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3046 |
> |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3047 |
> |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3048 |
> |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3049 |
|
} |
3050 |
|
|
3051 |
|
double valueY = valueLookup(&inputCollection->at(object), inputVariable, function); |
3052 |
|
|
3053 |
< |
histo->Fill(valueX,valueY,puScaleFactor); |
3053 |
> |
histo->Fill(valueX,valueY,scaleFactor); |
3054 |
|
|
3055 |
|
} |
3056 |
|
|
3057 |
|
} |
3058 |
|
|
3059 |
|
template <class InputCollection1, class InputCollection2> |
3060 |
< |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, vector<bool> pairFlags, double puScaleFactor){ |
3060 |
> |
void OSUAnalysis::fill2DHistogram(TH2* histo, histogram parameters, InputCollection1 inputCollection1, InputCollection2 inputCollection2, vector<bool> flags1, vector<bool> flags2, vector<bool> pairFlags, double scaleFactor){ |
3061 |
|
|
3062 |
|
bool sameObjects = false; |
3063 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3064 |
|
|
3065 |
< |
int counter = 0; |
3065 |
> |
int pairCounter = 0; |
3066 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3067 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3068 |
< |
|
3068 |
> |
|
3069 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3070 |
|
|
3071 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3072 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3073 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3074 |
< |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(counter)) continue; |
3074 |
> |
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue; |
3075 |
|
|
3076 |
|
string currentString = parameters.inputVariables.at(0); |
3077 |
|
string inputVariable = ""; |
3078 |
|
string function = ""; |
3079 |
|
if(currentString.find("(")==std::string::npos){ |
3080 |
< |
inputVariable = currentString;// variable to cut on |
3080 |
> |
inputVariable = currentString;// variable to cut on |
3081 |
|
} |
3082 |
|
else{ |
3083 |
< |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3084 |
< |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3085 |
< |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3083 |
> |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3084 |
> |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3085 |
> |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3086 |
|
} |
3087 |
|
double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3088 |
|
|
3090 |
|
inputVariable = ""; |
3091 |
|
function = ""; |
3092 |
|
if(currentString.find("(")==std::string::npos){ |
3093 |
< |
inputVariable = currentString;// variable to cut on |
3093 |
> |
inputVariable = currentString;// variable to cut on |
3094 |
|
} |
3095 |
|
else{ |
3096 |
< |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3097 |
< |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3098 |
< |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3096 |
> |
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3097 |
> |
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3098 |
> |
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3099 |
|
} |
3100 |
|
double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3101 |
|
|
3102 |
|
|
3103 |
< |
histo->Fill(valueX,valueY,puScaleFactor); |
3103 |
> |
histo->Fill(valueX,valueY,scaleFactor); |
3104 |
> |
|
3105 |
> |
pairCounter++; |
3106 |
|
|
2064 |
– |
counter++; |
3107 |
|
} |
3108 |
|
} |
3109 |
|
|
3110 |
|
} |
3111 |
|
|
3112 |
|
|
3113 |
< |
// template <class InputObject> |
3114 |
< |
// BNmcparticle* getGenMatchedParticle(InputObject object){ |
3113 |
> |
template <class InputObject> |
3114 |
> |
int OSUAnalysis::getGenMatchedParticleIndex(InputObject object){ |
3115 |
|
|
3116 |
< |
// BNmcparticle bestMatch; |
3117 |
< |
// std::cout << bestMatch.energy() << std:endl; |
2076 |
< |
// for(BNmcparticleCollection::const_iterator mcparticle = mcParticles_->begin (); mcparticle != mcParticles_->end (); mcparticle++){ |
3116 |
> |
int bestMatchIndex = -1; |
3117 |
> |
double bestMatchDeltaR = 999; |
3118 |
|
|
3119 |
< |
// } |
2079 |
< |
// return bestMatch; |
2080 |
< |
// } |
3119 |
> |
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
3120 |
|
|
3121 |
+ |
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
3122 |
+ |
if(currentDeltaR > 0.05) continue; |
3123 |
+ |
// cout << std::setprecision(3) << std::setw(20) |
3124 |
+ |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3125 |
+ |
// << std::setw(20) |
3126 |
+ |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3127 |
+ |
// << std::setw(20) |
3128 |
+ |
// << "\tdeltaR = " << currentDeltaR |
3129 |
+ |
// << std::setprecision(1) |
3130 |
+ |
// << std::setw(20) |
3131 |
+ |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
3132 |
+ |
// << std::setw(20) |
3133 |
+ |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
3134 |
+ |
// << std::setw(20) |
3135 |
+ |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3136 |
+ |
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
3137 |
+ |
bestMatchIndex = mcparticle - mcparticles->begin(); |
3138 |
+ |
bestMatchDeltaR = currentDeltaR; |
3139 |
+ |
} |
3140 |
|
|
3141 |
< |
DEFINE_FWK_MODULE(OSUAnalysis); |
3141 |
> |
} |
3142 |
> |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
3143 |
> |
// else cout << "no match found..." << endl; |
3144 |
> |
return bestMatchIndex; |
3145 |
|
|
3146 |
+ |
} |
3147 |
+ |
|
3148 |
+ |
|
3149 |
+ |
int OSUAnalysis::findTauMotherIndex(const BNmcparticle* tau){ |
3150 |
+ |
|
3151 |
+ |
int bestMatchIndex = -1; |
3152 |
+ |
double bestMatchDeltaR = 999; |
3153 |
+ |
|
3154 |
+ |
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
3155 |
+ |
|
3156 |
+ |
if(fabs(mcparticle->id) != 15 || mcparticle->status !=3) continue; |
3157 |
+ |
|
3158 |
+ |
double currentDeltaR = deltaR(tau->eta,tau->phi,mcparticle->eta,mcparticle->phi); |
3159 |
+ |
if(currentDeltaR > 0.05) continue; |
3160 |
+ |
|
3161 |
+ |
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
3162 |
+ |
bestMatchIndex = mcparticle - mcparticles->begin(); |
3163 |
+ |
bestMatchDeltaR = currentDeltaR; |
3164 |
+ |
} |
3165 |
+ |
|
3166 |
+ |
} |
3167 |
+ |
|
3168 |
+ |
return bestMatchIndex; |
3169 |
+ |
} |
3170 |
+ |
|
3171 |
+ |
|
3172 |
+ |
// bin particle type |
3173 |
+ |
// --- ------------- |
3174 |
+ |
// 0 unmatched |
3175 |
+ |
// 1 u |
3176 |
+ |
// 2 d |
3177 |
+ |
// 3 s |
3178 |
+ |
// 4 c |
3179 |
+ |
// 5 b |
3180 |
+ |
// 6 t |
3181 |
+ |
// 7 e |
3182 |
+ |
// 8 mu |
3183 |
+ |
// 9 tau |
3184 |
+ |
// 10 nu |
3185 |
+ |
// 11 g |
3186 |
+ |
// 12 gamma |
3187 |
+ |
// 13 Z |
3188 |
+ |
// 14 W |
3189 |
+ |
// 15 light meson |
3190 |
+ |
// 16 K meson |
3191 |
+ |
// 17 D meson |
3192 |
+ |
// 18 B meson |
3193 |
+ |
// 19 light baryon |
3194 |
+ |
// 20 strange baryon |
3195 |
+ |
// 21 charm baryon |
3196 |
+ |
// 22 bottom baryon |
3197 |
+ |
// 23 other |
3198 |
+ |
|
3199 |
+ |
int OSUAnalysis::getPdgIdBinValue(int pdgId){ |
3200 |
+ |
|
3201 |
+ |
int binValue = -999; |
3202 |
+ |
int absPdgId = fabs(pdgId); |
3203 |
+ |
if(pdgId == -1) binValue = 0; |
3204 |
+ |
else if(absPdgId <= 6 ) binValue = absPdgId; |
3205 |
+ |
else if(absPdgId == 11 ) binValue = 7; |
3206 |
+ |
else if(absPdgId == 13 ) binValue = 8; |
3207 |
+ |
else if(absPdgId == 15 ) binValue = 9; |
3208 |
+ |
else if(absPdgId == 12 || absPdgId == 14 || absPdgId == 16 ) binValue = 10; |
3209 |
+ |
else if(absPdgId == 21 ) binValue = 11; |
3210 |
+ |
else if(absPdgId == 22 ) binValue = 12; |
3211 |
+ |
else if(absPdgId == 23 ) binValue = 13; |
3212 |
+ |
else if(absPdgId == 24 ) binValue = 14; |
3213 |
+ |
else if(absPdgId > 100 && absPdgId < 300 && absPdgId != 130 ) binValue = 15; |
3214 |
+ |
else if( absPdgId == 130 || (absPdgId > 300 && absPdgId < 400) ) binValue = 16; |
3215 |
+ |
else if(absPdgId > 400 && absPdgId < 500 ) binValue = 17; |
3216 |
+ |
else if(absPdgId > 500 && absPdgId < 600 ) binValue = 18; |
3217 |
+ |
else if(absPdgId > 1000 && absPdgId < 3000 ) binValue = 19; |
3218 |
+ |
else if(absPdgId > 3000 && absPdgId < 4000 ) binValue = 20; |
3219 |
+ |
else if(absPdgId > 4000 && absPdgId < 5000 ) binValue = 21; |
3220 |
+ |
else if(absPdgId > 5000 && absPdgId < 6000 ) binValue = 22; |
3221 |
+ |
|
3222 |
+ |
else binValue = 23; |
3223 |
+ |
|
3224 |
+ |
return binValue; |
3225 |
+ |
|
3226 |
+ |
} |
3227 |
+ |
|
3228 |
+ |
const BNprimaryvertex * |
3229 |
+ |
OSUAnalysis::chosenVertex () |
3230 |
+ |
{ |
3231 |
+ |
const BNprimaryvertex *chosenVertex = 0; |
3232 |
+ |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
3233 |
+ |
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() : |
3234 |
+ |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
3235 |
+ |
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
3236 |
+ |
if(!vertexFlags.at(vertexIndex)) continue; |
3237 |
+ |
chosenVertex = & primaryvertexs->at(vertexIndex); |
3238 |
+ |
break; |
3239 |
+ |
} |
3240 |
+ |
} |
3241 |
+ |
else { |
3242 |
+ |
chosenVertex = &primaryvertexs->at(0); |
3243 |
+ |
} |
3244 |
|
|
3245 |
+ |
return chosenVertex; |
3246 |
+ |
} |
3247 |
+ |
|
3248 |
+ |
const BNmet * |
3249 |
+ |
OSUAnalysis::chosenMET () |
3250 |
+ |
{ |
3251 |
+ |
const BNmet *chosenMET = 0; |
3252 |
+ |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
3253 |
+ |
vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() : |
3254 |
+ |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
3255 |
+ |
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
3256 |
+ |
if(!metFlags.at(metIndex)) continue; |
3257 |
+ |
chosenMET = & mets->at(metIndex); |
3258 |
+ |
break; |
3259 |
+ |
} |
3260 |
+ |
} |
3261 |
+ |
else { |
3262 |
+ |
chosenMET = &mets->at(0); |
3263 |
+ |
} |
3264 |
+ |
|
3265 |
+ |
return chosenMET; |
3266 |
+ |
} |
3267 |
+ |
|
3268 |
+ |
const BNelectron * |
3269 |
+ |
OSUAnalysis::chosenElectron () |
3270 |
+ |
{ |
3271 |
+ |
const BNelectron *chosenElectron = 0; |
3272 |
+ |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
3273 |
+ |
vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() : |
3274 |
+ |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
3275 |
+ |
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
3276 |
+ |
if(!electronFlags.at(electronIndex)) continue; |
3277 |
+ |
chosenElectron = & electrons->at(electronIndex); |
3278 |
+ |
break; |
3279 |
+ |
} |
3280 |
+ |
} |
3281 |
+ |
else { |
3282 |
+ |
chosenElectron = &electrons->at(0); |
3283 |
+ |
} |
3284 |
+ |
|
3285 |
+ |
return chosenElectron; |
3286 |
+ |
} |
3287 |
+ |
|
3288 |
+ |
const BNmuon * |
3289 |
+ |
OSUAnalysis::chosenMuon () |
3290 |
+ |
{ |
3291 |
+ |
const BNmuon *chosenMuon = 0; |
3292 |
+ |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
3293 |
+ |
vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() : |
3294 |
+ |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
3295 |
+ |
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
3296 |
+ |
if(!muonFlags.at(muonIndex)) continue; |
3297 |
+ |
chosenMuon = & muons->at(muonIndex); |
3298 |
+ |
break; |
3299 |
+ |
} |
3300 |
+ |
} |
3301 |
+ |
else { |
3302 |
+ |
chosenMuon = &muons->at(0); |
3303 |
+ |
} |
3304 |
+ |
|
3305 |
+ |
return chosenMuon; |
3306 |
+ |
} |
3307 |
+ |
|
3308 |
+ |
|
3309 |
+ |
DEFINE_FWK_MODULE(OSUAnalysis); |