17 |
|
photons_ (cfg.getParameter<edm::InputTag> ("photons")), |
18 |
|
superclusters_ (cfg.getParameter<edm::InputTag> ("superclusters")), |
19 |
|
triggers_ (cfg.getParameter<edm::InputTag> ("triggers")), |
20 |
< |
puFile_ (cfg.getParameter<std::string> ("puFile")), |
21 |
< |
deadEcalFile_ (cfg.getParameter<std::string> ("deadEcalFile")), |
22 |
< |
muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")), |
23 |
< |
dataPU_ (cfg.getParameter<std::string> ("dataPU")), |
24 |
< |
electronSFID_ (cfg.getParameter<std::string> ("electronSFID")), |
25 |
< |
muonSF_ (cfg.getParameter<std::string> ("muonSF")), |
26 |
< |
dataset_ (cfg.getParameter<std::string> ("dataset")), |
27 |
< |
datasetType_ (cfg.getParameter<std::string> ("datasetType")), |
20 |
> |
trigobjs_ (cfg.getParameter<edm::InputTag> ("trigobjs")), |
21 |
> |
puFile_ (cfg.getParameter<string> ("puFile")), |
22 |
> |
deadEcalFile_ (cfg.getParameter<string> ("deadEcalFile")), |
23 |
> |
muonSFFile_ (cfg.getParameter<string> ("muonSFFile")), |
24 |
> |
dataPU_ (cfg.getParameter<string> ("dataPU")), |
25 |
> |
electronSFID_ (cfg.getParameter<string> ("electronSFID")), |
26 |
> |
muonSF_ (cfg.getParameter<string> ("muonSF")), |
27 |
> |
dataset_ (cfg.getParameter<string> ("dataset")), |
28 |
> |
datasetType_ (cfg.getParameter<string> ("datasetType")), |
29 |
|
channels_ (cfg.getParameter<vector<edm::ParameterSet> >("channels")), |
30 |
|
histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")), |
31 |
+ |
treeBranchSets_ (cfg.getParameter<vector<edm::ParameterSet> >("treeBranchSets")), |
32 |
|
plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")), |
33 |
|
doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")), |
34 |
< |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
34 |
> |
applyLeptonSF_ (cfg.getParameter<bool> ("applyLeptonSF")), |
35 |
> |
applyBtagSF_ (cfg.getParameter<bool> ("applyBtagSF")), |
36 |
> |
minBtag_ (cfg.getParameter<int> ("minBtag")), |
37 |
> |
maxBtag_ (cfg.getParameter<int> ("maxBtag")), |
38 |
> |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
39 |
> |
printAllTriggers_ (cfg.getParameter<bool> ("printAllTriggers")), |
40 |
|
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")), |
41 |
< |
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")) |
42 |
< |
|
43 |
< |
{ |
41 |
> |
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")), |
42 |
> |
GetPlotsAfterEachCut_ (cfg.getParameter<bool> ("GetPlotsAfterEachCut")) |
43 |
> |
{ |
44 |
|
|
45 |
|
TH1::SetDefaultSumw2 (); |
46 |
|
|
47 |
|
//create pile-up reweighting object, if necessary |
48 |
|
if(datasetType_ != "data") { |
49 |
|
if(doPileupReweighting_) puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
50 |
< |
// muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
51 |
< |
// electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
50 |
> |
if (applyLeptonSF_){ |
51 |
> |
muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
52 |
> |
electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
53 |
> |
} |
54 |
> |
if (applyBtagSF_){ |
55 |
> |
bTagSFWeight_ = new BtagSFWeight; |
56 |
> |
} |
57 |
|
} |
58 |
< |
#ifdef DISPLACED_SUSY |
59 |
< |
if (datasetType_ == "signalMC") |
48 |
< |
cTauWeight_ = new CTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
49 |
< |
#endif |
58 |
> |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
59 |
> |
stopCTauWeight_ = new StopCTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
60 |
|
|
61 |
|
|
62 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
63 |
|
// handle filling cut flow histograms. |
64 |
|
masterCutFlow_ = new CutFlow (fs_); |
55 |
– |
std::vector<TFileDirectory> directories; |
65 |
|
|
66 |
|
//always get vertex collection so we can assign the primary vertex in the event |
67 |
|
objectsToGet.push_back("primaryvertexs"); |
59 |
– |
|
60 |
– |
//always make the plot of number of primary vertices (to check pile-up reweighting) |
68 |
|
objectsToPlot.push_back("primaryvertexs"); |
69 |
+ |
objectsToCut.push_back("primaryvertexs"); |
70 |
+ |
|
71 |
|
|
72 |
|
//always get the MC particles to do GEN-matching |
73 |
|
objectsToGet.push_back("mcparticles"); |
75 |
|
//always get the event collection to do pile-up reweighting |
76 |
|
objectsToGet.push_back("events"); |
77 |
|
|
78 |
+ |
|
79 |
+ |
// Parse the tree variable definitions. |
80 |
+ |
for (uint iBranchSet = 0; iBranchSet<treeBranchSets_.size(); iBranchSet++) { |
81 |
+ |
string tempInputCollection = treeBranchSets_.at(iBranchSet).getParameter<string> ("inputCollection"); |
82 |
+ |
if(tempInputCollection.find("pairs")!=string::npos) { cout << "Warning: tree filling is not configured for pairs of objects, so will not work for collection: " << tempInputCollection << endl; } |
83 |
+ |
objectsToGet.push_back(tempInputCollection); |
84 |
+ |
objectsToCut.push_back(tempInputCollection); |
85 |
+ |
|
86 |
+ |
vector<string> branchList(treeBranchSets_.at(iBranchSet).getParameter<vector<string> >("branches")); |
87 |
+ |
|
88 |
+ |
for (uint iBranch = 0; iBranch<branchList.size(); iBranch++) { |
89 |
+ |
BranchSpecs br; |
90 |
+ |
br.inputCollection = tempInputCollection; |
91 |
+ |
br.inputVariable = branchList.at(iBranch); |
92 |
+ |
TString newName = TString(br.inputCollection) + "_" + TString(br.inputVariable); |
93 |
+ |
br.name = string(newName.Data()); |
94 |
+ |
treeBranches_.push_back(br); |
95 |
+ |
} |
96 |
+ |
|
97 |
+ |
} // end for (uint iBranchSet = 0; iBranchSet<treeBranchSets_.size(); iBranchSet++) { |
98 |
+ |
|
99 |
+ |
|
100 |
|
//parse the histogram definitions |
101 |
|
for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){ |
102 |
|
|
103 |
|
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
104 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
105 |
+ |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
106 |
+ |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
107 |
|
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
108 |
|
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
109 |
< |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
110 |
< |
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
111 |
< |
int spaceIndex = tempInputCollection.find(" "); |
112 |
< |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
113 |
< |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
109 |
> |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
110 |
> |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
111 |
> |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
112 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
113 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
114 |
> |
int spaceIndex = tempInputCollection.find(" "); |
115 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
116 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
117 |
|
} |
118 |
|
else{ |
119 |
< |
objectsToGet.push_back(tempInputCollection); |
119 |
> |
objectsToGet.push_back(tempInputCollection); |
120 |
|
} |
121 |
|
objectsToPlot.push_back(tempInputCollection); |
122 |
|
objectsToCut.push_back(tempInputCollection); |
123 |
< |
} |
124 |
< |
else{//pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
89 |
< |
string obj1; |
123 |
> |
} else { //pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
124 |
> |
string obj1; |
125 |
|
string obj2; |
126 |
|
getTwoObjs(tempInputCollection, obj1, obj2); |
127 |
< |
string obj2ToGet = getObjToGet(obj2); |
127 |
> |
string obj2ToGet = getObjToGet(obj2); |
128 |
|
objectsToCut.push_back(tempInputCollection); |
129 |
|
objectsToCut.push_back(obj1); |
130 |
< |
objectsToCut.push_back(obj2); |
130 |
> |
objectsToCut.push_back(obj2); |
131 |
|
objectsToPlot.push_back(tempInputCollection); |
132 |
|
objectsToPlot.push_back(obj1); |
133 |
< |
objectsToPlot.push_back(obj2); |
133 |
> |
objectsToPlot.push_back(obj2); |
134 |
|
objectsToGet.push_back(tempInputCollection); |
135 |
|
objectsToGet.push_back(obj1); |
136 |
|
objectsToGet.push_back(obj2ToGet); |
137 |
+ |
} // end else |
138 |
+ |
|
139 |
|
|
103 |
– |
} |
140 |
|
|
141 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
142 |
|
|
143 |
|
for(uint currentHistogram = 0; currentHistogram != histogramList_.size(); currentHistogram++){ |
144 |
|
|
145 |
+ |
vector<double> defaultValue; |
146 |
+ |
defaultValue.push_back (-1.0); |
147 |
+ |
|
148 |
|
histogram tempHistogram; |
149 |
|
tempHistogram.inputCollection = tempInputCollection; |
150 |
|
tempHistogram.name = histogramList_.at(currentHistogram).getParameter<string>("name"); |
151 |
|
tempHistogram.title = histogramList_.at(currentHistogram).getParameter<string>("title"); |
152 |
< |
tempHistogram.bins = histogramList_.at(currentHistogram).getParameter<vector<double> >("bins"); |
152 |
> |
tempHistogram.bins = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("bins", defaultValue); |
153 |
> |
tempHistogram.variableBinsX = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsX", defaultValue); |
154 |
> |
tempHistogram.variableBinsY = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsY", defaultValue); |
155 |
|
tempHistogram.inputVariables = histogramList_.at(currentHistogram).getParameter<vector<string> >("inputVariables"); |
156 |
|
|
157 |
|
histograms.push_back(tempHistogram); |
158 |
|
|
159 |
|
} |
160 |
< |
} |
160 |
> |
} // for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){ |
161 |
> |
|
162 |
|
//make unique vector of objects we need to plot (so we can book a histogram with the number of each object) |
163 |
|
sort( objectsToPlot.begin(), objectsToPlot.end() ); |
164 |
|
objectsToPlot.erase( unique( objectsToPlot.begin(), objectsToPlot.end() ), objectsToPlot.end() ); |
169 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
170 |
|
|
171 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
172 |
< |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
172 |
> |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
173 |
|
|
174 |
|
histogram tempIdHisto; |
175 |
|
histogram tempMomIdHisto; |
176 |
|
histogram tempGmaIdHisto; |
177 |
|
histogram tempIdVsMomIdHisto; |
178 |
+ |
histogram tempIdVsGmaIdHisto; |
179 |
|
|
180 |
|
tempIdHisto.inputCollection = currentObject; |
181 |
|
tempMomIdHisto.inputCollection = currentObject; |
182 |
|
tempGmaIdHisto.inputCollection = currentObject; |
183 |
|
tempIdVsMomIdHisto.inputCollection = currentObject; |
184 |
+ |
tempIdVsGmaIdHisto.inputCollection = currentObject; |
185 |
|
|
186 |
|
if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
187 |
+ |
if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
188 |
|
|
189 |
|
currentObject = currentObject.substr(0, currentObject.size()-1); |
190 |
|
tempIdHisto.name = currentObject+"GenMatchId"; |
191 |
|
tempMomIdHisto.name = currentObject+"GenMatchMotherId"; |
192 |
|
tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId"; |
193 |
|
tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId"; |
194 |
+ |
tempIdVsGmaIdHisto.name = currentObject+"GenMatchIdVsGrandmotherId"; |
195 |
|
|
196 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
197 |
|
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
198 |
|
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
199 |
|
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
200 |
|
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
201 |
+ |
tempIdVsGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother vs. Particle;Particle;Grandmother"; |
202 |
+ |
|
203 |
|
|
204 |
< |
int maxNum = 24; |
204 |
> |
int maxNum = 25; |
205 |
|
vector<double> binVector; |
206 |
|
binVector.push_back(maxNum); |
207 |
|
binVector.push_back(0); |
219 |
|
tempIdVsMomIdHisto.bins = binVector; |
220 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
221 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
222 |
+ |
tempIdVsGmaIdHisto.bins = binVector; |
223 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedId"); |
224 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherIdReverse"); |
225 |
|
|
226 |
|
histograms.push_back(tempIdHisto); |
227 |
|
histograms.push_back(tempMomIdHisto); |
228 |
|
histograms.push_back(tempGmaIdHisto); |
229 |
|
histograms.push_back(tempIdVsMomIdHisto); |
230 |
+ |
histograms.push_back(tempIdVsGmaIdHisto); |
231 |
|
} |
232 |
|
|
233 |
|
|
243 |
|
//set triggers for this channel |
244 |
|
vector<string> triggerNames; |
245 |
|
triggerNames.clear(); |
246 |
+ |
vector<string> triggerToVetoNames; |
247 |
+ |
triggerToVetoNames.clear(); |
248 |
+ |
|
249 |
|
tempChannel.triggers.clear(); |
250 |
+ |
tempChannel.triggersToVeto.clear(); |
251 |
|
if(channels_.at(currentChannel).exists("triggers")){ |
252 |
|
triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers"); |
253 |
|
for(uint trigger = 0; trigger!= triggerNames.size(); trigger++) |
254 |
|
tempChannel.triggers.push_back(triggerNames.at(trigger)); |
255 |
|
objectsToGet.push_back("triggers"); |
256 |
|
} |
257 |
< |
|
257 |
> |
if(channels_.at(currentChannel).exists("triggersToVeto")){ |
258 |
> |
triggerToVetoNames = channels_.at(currentChannel).getParameter<vector<string> >("triggersToVeto"); |
259 |
> |
for(uint trigger = 0; trigger!= triggerToVetoNames.size(); trigger++) |
260 |
> |
tempChannel.triggersToVeto.push_back(triggerToVetoNames.at(trigger)); |
261 |
> |
objectsToGet.push_back("triggers"); |
262 |
> |
} |
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
//create cutFlow for this channel |
267 |
|
cutFlows_.push_back (new CutFlow (fs_, channelName)); |
268 |
< |
|
269 |
< |
//book a directory in the output file with the name of the channel |
209 |
< |
TFileDirectory subDir = fs_->mkdir( channelName ); |
210 |
< |
directories.push_back(subDir); |
211 |
< |
|
212 |
< |
std::map<std::string, TH1D*> oneDhistoMap; |
213 |
< |
oneDHists_.push_back(oneDhistoMap); |
214 |
< |
std::map<std::string, TH2D*> twoDhistoMap; |
215 |
< |
twoDHists_.push_back(twoDhistoMap); |
216 |
< |
|
217 |
< |
|
218 |
< |
|
219 |
< |
//book all histograms included in the configuration |
220 |
< |
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
221 |
< |
histogram currentHistogram = histograms.at(currentHistogramIndex); |
222 |
< |
int numBinsElements = currentHistogram.bins.size(); |
223 |
< |
int numInputVariables = currentHistogram.inputVariables.size(); |
224 |
< |
|
225 |
< |
if(numBinsElements != 3 && numBinsElements !=6) { |
226 |
< |
std::cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
227 |
< |
exit(0); |
228 |
< |
} |
229 |
< |
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
230 |
< |
std::cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
231 |
< |
exit(0); |
232 |
< |
} |
233 |
< |
else if(numBinsElements == 3){ |
234 |
< |
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)); |
235 |
< |
} |
236 |
< |
else if(numBinsElements == 6){ |
237 |
< |
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)); |
238 |
< |
|
239 |
< |
} |
240 |
< |
|
241 |
< |
|
242 |
< |
if(currentHistogram.name.find("GenMatch")==std::string::npos) continue; |
243 |
< |
|
244 |
< |
// bin particle type |
245 |
< |
// --- ------------- |
246 |
< |
// 0 unmatched |
247 |
< |
// 1 u |
248 |
< |
// 2 d |
249 |
< |
// 3 s |
250 |
< |
// 4 c |
251 |
< |
// 5 b |
252 |
< |
// 6 t |
253 |
< |
// 7 e |
254 |
< |
// 8 mu |
255 |
< |
// 9 tau |
256 |
< |
// 10 nu |
257 |
< |
// 11 g |
258 |
< |
// 12 gamma |
259 |
< |
// 13 Z |
260 |
< |
// 14 W |
261 |
< |
// 15 light meson |
262 |
< |
// 16 K meson |
263 |
< |
// 17 D meson |
264 |
< |
// 18 B meson |
265 |
< |
// 19 light baryon |
266 |
< |
// 20 strange baryon |
267 |
< |
// 21 charm baryon |
268 |
< |
// 22 bottom baryon |
269 |
< |
// 23 other |
270 |
< |
|
271 |
< |
vector<TString> labelArray; |
272 |
< |
labelArray.push_back("unmatched"); |
273 |
< |
labelArray.push_back("u"); |
274 |
< |
labelArray.push_back("d"); |
275 |
< |
labelArray.push_back("s"); |
276 |
< |
labelArray.push_back("c"); |
277 |
< |
labelArray.push_back("b"); |
278 |
< |
labelArray.push_back("t"); |
279 |
< |
labelArray.push_back("e"); |
280 |
< |
labelArray.push_back("#mu"); |
281 |
< |
labelArray.push_back("#tau"); |
282 |
< |
labelArray.push_back("#nu"); |
283 |
< |
labelArray.push_back("g"); |
284 |
< |
labelArray.push_back("#gamma"); |
285 |
< |
labelArray.push_back("Z"); |
286 |
< |
labelArray.push_back("W"); |
287 |
< |
labelArray.push_back("light meson"); |
288 |
< |
labelArray.push_back("K meson"); |
289 |
< |
labelArray.push_back("D meson"); |
290 |
< |
labelArray.push_back("B meson"); |
291 |
< |
labelArray.push_back("light baryon"); |
292 |
< |
labelArray.push_back("strange baryon"); |
293 |
< |
labelArray.push_back("charm baryon"); |
294 |
< |
labelArray.push_back("bottom baryon"); |
295 |
< |
labelArray.push_back("other"); |
296 |
< |
|
297 |
< |
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
298 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) { |
299 |
< |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
300 |
< |
} |
301 |
< |
else { |
302 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
303 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
304 |
< |
} |
305 |
< |
} |
306 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) { |
307 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
308 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
309 |
< |
} |
310 |
< |
|
311 |
< |
} |
312 |
< |
|
313 |
< |
// Book a histogram for the number of each object type to be plotted. |
314 |
< |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
315 |
< |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
316 |
< |
string currentObject = objectsToPlot.at(currentObjectIndex); |
317 |
< |
int maxNum = 10; |
318 |
< |
if(currentObject == "mcparticles") maxNum = 50; |
319 |
< |
else if(currentObject == "primaryvertexs") maxNum = 50; |
320 |
< |
|
321 |
< |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
322 |
< |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
323 |
< |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
324 |
< |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
325 |
< |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
326 |
< |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
327 |
< |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
328 |
< |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
329 |
< |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
330 |
< |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
331 |
< |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
332 |
< |
|
333 |
< |
currentObject.at(0) = toupper(currentObject.at(0)); |
334 |
< |
string histoName = "num" + currentObject; |
335 |
< |
|
336 |
< |
if(histoName == "numPrimaryvertexs"){ |
337 |
< |
string newHistoName = histoName + "BeforePileupCorrection"; |
338 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
339 |
< |
newHistoName = histoName + "AfterPileupCorrection"; |
340 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
341 |
< |
} |
342 |
< |
else |
343 |
< |
oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
344 |
< |
} |
345 |
< |
|
346 |
< |
|
347 |
< |
|
348 |
< |
|
268 |
> |
vector<TFileDirectory> directories; //vector of directories in the output file. |
269 |
> |
vector<string> subSubDirNames;//subdirectories in each channel. |
270 |
|
//get list of cuts for this channel |
271 |
|
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
272 |
|
|
273 |
+ |
|
274 |
|
//loop over and parse all cuts |
275 |
|
for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){ |
276 |
|
cut tempCut; |
277 |
|
//store input collection for cut |
278 |
|
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
279 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
280 |
+ |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
281 |
+ |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
282 |
|
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
283 |
|
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
284 |
+ |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
285 |
+ |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
286 |
+ |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
287 |
|
tempCut.inputCollection = tempInputCollection; |
288 |
< |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
289 |
< |
if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object |
290 |
< |
int spaceIndex = tempInputCollection.find(" "); |
291 |
< |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
292 |
< |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
293 |
< |
} |
294 |
< |
else{ |
295 |
< |
objectsToGet.push_back(tempInputCollection); |
296 |
< |
} |
297 |
< |
objectsToCut.push_back(tempInputCollection); |
288 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
289 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
290 |
> |
int spaceIndex = tempInputCollection.find(" "); |
291 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
292 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
293 |
> |
} |
294 |
> |
else{ |
295 |
> |
objectsToGet.push_back(tempInputCollection); |
296 |
> |
} |
297 |
> |
objectsToCut.push_back(tempInputCollection); |
298 |
|
} |
299 |
|
else{//pair of objects, need to add them both to objectsToGet |
300 |
< |
string obj1; |
301 |
< |
string obj2; |
302 |
< |
getTwoObjs(tempInputCollection, obj1, obj2); |
303 |
< |
string obj2ToGet = getObjToGet(obj2); |
300 |
> |
string obj1; |
301 |
> |
string obj2; |
302 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
303 |
> |
string obj2ToGet = getObjToGet(obj2); |
304 |
|
objectsToCut.push_back(tempInputCollection); |
305 |
|
objectsToCut.push_back(obj1); |
306 |
< |
objectsToCut.push_back(obj2); |
306 |
> |
objectsToCut.push_back(obj2); |
307 |
|
objectsToGet.push_back(tempInputCollection); |
308 |
|
objectsToGet.push_back(obj1); |
309 |
|
objectsToGet.push_back(obj2ToGet); |
314 |
|
|
315 |
|
//split cut string into parts and store them |
316 |
|
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
317 |
< |
std::vector<string> cutStringVector = splitString(cutString); |
317 |
> |
vector<string> cutStringVector = splitString(cutString); |
318 |
|
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
319 |
< |
std::cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
319 |
> |
cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
320 |
|
exit(0); |
321 |
|
} |
322 |
|
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
323 |
|
for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,| |
324 |
|
int indexOffset = 4 * subcutIndex; |
325 |
|
string currentVariableString = cutStringVector.at(indexOffset); |
326 |
< |
if(currentVariableString.find("(")==std::string::npos){ |
326 |
> |
if(currentVariableString.find("(")==string::npos){ |
327 |
|
tempCut.functions.push_back("");//no function was specified |
328 |
|
tempCut.variables.push_back(currentVariableString);// variable to cut on |
329 |
|
} |
334 |
|
} |
335 |
|
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
336 |
|
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
337 |
+ |
tempCut.cutStringValues.push_back(cutStringVector.at(indexOffset+2));// string value to pass cut |
338 |
|
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
339 |
|
} |
340 |
|
|
341 |
|
//get number of objects required to pass cut for event to pass |
342 |
|
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
343 |
< |
std::vector<string> numberRequiredVector = splitString(numberRequiredString); |
343 |
> |
vector<string> numberRequiredVector = splitString(numberRequiredString); |
344 |
|
if(numberRequiredVector.size()!=2){ |
345 |
< |
std::cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
345 |
> |
cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
346 |
|
exit(0); |
347 |
|
} |
348 |
|
|
350 |
|
tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut |
351 |
|
tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make |
352 |
|
|
353 |
< |
|
353 |
> |
//Set up vectors to store the directories and subDIrectories for each channel. |
354 |
> |
string subSubDirName; |
355 |
|
string tempCutName; |
356 |
|
if(cuts_.at(currentCut).exists("alias")){ |
357 |
|
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
358 |
+ |
subSubDirName = "After " + cuts_.at(currentCut).getParameter<string> ("alias") + " Cut Applied"; |
359 |
|
} |
360 |
|
else{ |
361 |
|
//construct string for cutflow table |
363 |
|
string collectionString = plural ? tempInputCollection : tempInputCollection.substr(0, tempInputCollection.size()-1); |
364 |
|
string cutName = numberRequiredString + " " + collectionString + " with " + cutString; |
365 |
|
tempCutName = cutName; |
366 |
+ |
subSubDirName = "After " + numberRequiredString + " " + collectionString + " with " + cutString + " Cut Applied"; |
367 |
|
} |
368 |
+ |
|
369 |
+ |
subSubDirNames.push_back(subSubDirName); |
370 |
|
tempCut.name = tempCutName; |
371 |
|
|
372 |
|
tempChannel.cuts.push_back(tempCut); |
374 |
|
|
375 |
|
}//end loop over cuts |
376 |
|
|
377 |
+ |
vector<map<string, TH1D*>> oneDHistsTmp; |
378 |
+ |
vector<map<string, TH2D*>> twoDHistsTmp; |
379 |
+ |
//book a directory in the output file with the name of the channel |
380 |
+ |
TFileDirectory subDir = fs_->mkdir( channelName ); |
381 |
+ |
//loop over the cuts to set up subdirectory for each cut if GetPlotsAfterEachCut_ is true. |
382 |
+ |
if(GetPlotsAfterEachCut_){ |
383 |
+ |
for( uint currentDir=0; currentDir != subSubDirNames.size(); currentDir++){ |
384 |
+ |
TFileDirectory subSubDir = subDir.mkdir( subSubDirNames[currentDir] ); |
385 |
+ |
directories.push_back(subSubDir); |
386 |
+ |
map<string, TH1D*> oneDhistoMap; |
387 |
+ |
oneDHistsTmp.push_back(oneDhistoMap); |
388 |
+ |
map<string, TH2D*> twoDhistoMap; |
389 |
+ |
twoDHistsTmp.push_back(twoDhistoMap); |
390 |
+ |
} |
391 |
+ |
oneDHists_.push_back(oneDHistsTmp); |
392 |
+ |
twoDHists_.push_back(twoDHistsTmp); |
393 |
+ |
} |
394 |
+ |
//only set up directories with names of the channels if GetPlotsAfterEachCut_ is false. |
395 |
+ |
else{ |
396 |
+ |
map<string, TH1D*> oneDhistoMap; |
397 |
+ |
oneDHistsTmp.push_back(oneDhistoMap); |
398 |
+ |
map<string, TH2D*> twoDhistoMap; |
399 |
+ |
twoDHistsTmp.push_back(twoDhistoMap); |
400 |
+ |
oneDHists_.push_back(oneDHistsTmp); |
401 |
+ |
twoDHists_.push_back(twoDHistsTmp); |
402 |
+ |
directories.push_back(subDir); |
403 |
+ |
|
404 |
+ |
} |
405 |
+ |
|
406 |
+ |
|
407 |
+ |
//book all histograms included in the configuration |
408 |
+ |
for(uint currentDir = 0; currentDir != directories.size(); currentDir++){//loop over all the directories. |
409 |
+ |
|
410 |
+ |
TTree* newTree = directories.at(currentDir).make<TTree> (TString("BNTree_"+channelLabel), TString("BNTree_"+channelLabel)); |
411 |
+ |
BNTrees_.push_back(newTree); |
412 |
+ |
for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++){ |
413 |
+ |
BranchSpecs currentVar = treeBranches_.at(iBranch); |
414 |
+ |
vector<float> newVec; |
415 |
+ |
BNTreeBranchVals_[currentVar.name] = newVec; |
416 |
+ |
BNTrees_.back()->Branch(TString(currentVar.name), &BNTreeBranchVals_.at(currentVar.name)); |
417 |
+ |
} // end for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++){ |
418 |
+ |
|
419 |
+ |
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
420 |
+ |
|
421 |
+ |
histogram currentHistogram = histograms.at(currentHistogramIndex); |
422 |
+ |
int numBinsElements = currentHistogram.bins.size(); |
423 |
+ |
int numInputVariables = currentHistogram.inputVariables.size(); |
424 |
+ |
int numBinEdgesX = currentHistogram.variableBinsX.size(); |
425 |
+ |
int numBinEdgesY = currentHistogram.variableBinsY.size(); |
426 |
+ |
|
427 |
+ |
if(numBinsElements == 1){ |
428 |
+ |
if(numBinEdgesX > 1){ |
429 |
+ |
if(numBinEdgesY > 1) |
430 |
+ |
numBinsElements = 6; |
431 |
+ |
else |
432 |
+ |
numBinsElements = 3; |
433 |
+ |
} |
434 |
+ |
} |
435 |
+ |
if(numBinsElements != 3 && numBinsElements !=6){ |
436 |
+ |
cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
437 |
+ |
exit(0); |
438 |
+ |
} |
439 |
+ |
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
440 |
+ |
cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
441 |
+ |
exit(0); |
442 |
+ |
} |
443 |
+ |
else if(numBinsElements == 3){ |
444 |
+ |
if (currentHistogram.bins.size () == 3) |
445 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, currentHistogram.bins.at(0), currentHistogram.bins.at(1), currentHistogram.bins.at(2)); |
446 |
+ |
else |
447 |
+ |
{ |
448 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data ()); |
449 |
+ |
} |
450 |
+ |
} |
451 |
+ |
else if(numBinsElements == 6){ |
452 |
+ |
if (currentHistogram.bins.size () == 6) |
453 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).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)); |
454 |
+ |
else |
455 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH2D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data (), numBinEdgesY - 1, currentHistogram.variableBinsY.data ()); |
456 |
+ |
} |
457 |
+ |
|
458 |
+ |
|
459 |
+ |
if(currentHistogram.name.find("GenMatch")==string::npos) continue; |
460 |
+ |
|
461 |
+ |
// bin particle type |
462 |
+ |
// --- ------------- |
463 |
+ |
// 0 unmatched |
464 |
+ |
// 1 u |
465 |
+ |
// 2 d |
466 |
+ |
// 3 s |
467 |
+ |
// 4 c |
468 |
+ |
// 5 b |
469 |
+ |
// 6 t |
470 |
+ |
// 7 e |
471 |
+ |
// 8 mu |
472 |
+ |
// 9 tau |
473 |
+ |
// 10 nu |
474 |
+ |
// 11 g |
475 |
+ |
// 12 gamma |
476 |
+ |
// 13 Z |
477 |
+ |
// 14 W |
478 |
+ |
// 15 light meson |
479 |
+ |
// 16 K meson |
480 |
+ |
// 17 D meson |
481 |
+ |
// 18 B meson |
482 |
+ |
// 19 light baryon |
483 |
+ |
// 20 strange baryon |
484 |
+ |
// 21 charm baryon |
485 |
+ |
// 22 bottom baryon |
486 |
+ |
// 23 QCD string |
487 |
+ |
// 24 other |
488 |
+ |
|
489 |
+ |
vector<TString> labelArray; |
490 |
+ |
labelArray.push_back("unmatched"); |
491 |
+ |
labelArray.push_back("u"); |
492 |
+ |
labelArray.push_back("d"); |
493 |
+ |
labelArray.push_back("s"); |
494 |
+ |
labelArray.push_back("c"); |
495 |
+ |
labelArray.push_back("b"); |
496 |
+ |
labelArray.push_back("t"); |
497 |
+ |
labelArray.push_back("e"); |
498 |
+ |
labelArray.push_back("#mu"); |
499 |
+ |
labelArray.push_back("#tau"); |
500 |
+ |
labelArray.push_back("#nu"); |
501 |
+ |
labelArray.push_back("g"); |
502 |
+ |
labelArray.push_back("#gamma"); |
503 |
+ |
labelArray.push_back("Z"); |
504 |
+ |
labelArray.push_back("W"); |
505 |
+ |
labelArray.push_back("light meson"); |
506 |
+ |
labelArray.push_back("K meson"); |
507 |
+ |
labelArray.push_back("D meson"); |
508 |
+ |
labelArray.push_back("B meson"); |
509 |
+ |
labelArray.push_back("light baryon"); |
510 |
+ |
labelArray.push_back("strange baryon"); |
511 |
+ |
labelArray.push_back("charm baryon"); |
512 |
+ |
labelArray.push_back("bottom baryon"); |
513 |
+ |
labelArray.push_back("QCD string"); |
514 |
+ |
labelArray.push_back("other"); |
515 |
+ |
|
516 |
+ |
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
517 |
+ |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==string::npos) { |
518 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
519 |
+ |
} |
520 |
+ |
else { |
521 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
522 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
523 |
+ |
} |
524 |
+ |
} |
525 |
+ |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=string::npos) { |
526 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
527 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
528 |
+ |
} |
529 |
+ |
|
530 |
+ |
} // end for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
531 |
+ |
|
532 |
+ |
|
533 |
+ |
// Book a histogram for the number of each object type to be plotted. |
534 |
+ |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
535 |
+ |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
536 |
+ |
string currentObject = objectsToPlot.at(currentObjectIndex); |
537 |
+ |
int maxNum = 10; |
538 |
+ |
if(currentObject == "mcparticles") maxNum = 50; |
539 |
+ |
else if(currentObject == "primaryvertexs") maxNum = 50; |
540 |
+ |
|
541 |
+ |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
542 |
+ |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
543 |
+ |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
544 |
+ |
else if(currentObject == "secondary jets") currentObject = "secondaryJets"; |
545 |
+ |
else if(currentObject == "jet-jet pairs") currentObject = "dijetPairs"; |
546 |
+ |
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
547 |
+ |
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
548 |
+ |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
549 |
+ |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
550 |
+ |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
551 |
+ |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
552 |
+ |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
553 |
+ |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
554 |
+ |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
555 |
+ |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
556 |
+ |
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
557 |
+ |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
558 |
+ |
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
559 |
+ |
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
560 |
+ |
|
561 |
+ |
currentObject.at(0) = toupper(currentObject.at(0)); |
562 |
+ |
string histoName = "num" + currentObject; |
563 |
+ |
|
564 |
+ |
if(histoName == "numPrimaryvertexs"){ |
565 |
+ |
string newHistoName = histoName + "BeforePileupCorrection"; |
566 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
567 |
+ |
newHistoName = histoName + "AfterPileupCorrection"; |
568 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[newHistoName] = directories.at(currentDir).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
569 |
+ |
} |
570 |
+ |
else |
571 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
572 |
+ |
} |
573 |
+ |
}//end of loop over directories |
574 |
|
channels.push_back(tempChannel); |
575 |
|
tempChannel.cuts.clear(); |
446 |
– |
|
576 |
|
}//end loop over channels |
577 |
|
|
578 |
|
|
584 |
|
objectsToCut.erase( unique( objectsToCut.begin(), objectsToCut.end() ), objectsToCut.end() ); |
585 |
|
|
586 |
|
|
587 |
< |
} |
587 |
> |
} // end constructor OSUAnalysis::OSUAnalysis() |
588 |
> |
|
589 |
|
|
590 |
|
OSUAnalysis::~OSUAnalysis () |
591 |
|
{ |
592 |
+ |
|
593 |
|
// Destroying the CutFlow objects causes the cut flow numbers and time |
594 |
|
// information to be printed to standard output. |
595 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
603 |
|
|
604 |
|
// Retrieve necessary collections from the event. |
605 |
|
|
606 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
606 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
607 |
|
event.getByLabel (triggers_, triggers); |
608 |
|
|
609 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
609 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) |
610 |
> |
event.getByLabel (trigobjs_, trigobjs); |
611 |
> |
|
612 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
613 |
|
event.getByLabel (jets_, jets); |
614 |
|
|
615 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
615 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
616 |
|
event.getByLabel (muons_, muons); |
617 |
|
|
618 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
618 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
619 |
|
event.getByLabel (electrons_, electrons); |
620 |
|
|
621 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
621 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
622 |
|
event.getByLabel (events_, events); |
623 |
|
|
624 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
624 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
625 |
|
event.getByLabel (taus_, taus); |
626 |
|
|
627 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
627 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
628 |
|
event.getByLabel (mets_, mets); |
629 |
|
|
630 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
630 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
631 |
|
event.getByLabel (tracks_, tracks); |
632 |
|
|
633 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
633 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
634 |
|
event.getByLabel (genjets_, genjets); |
635 |
|
|
636 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
636 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
637 |
|
event.getByLabel (mcparticles_, mcparticles); |
638 |
|
|
639 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
639 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
640 |
|
event.getByLabel (primaryvertexs_, primaryvertexs); |
641 |
|
|
642 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
642 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
643 |
|
event.getByLabel (bxlumis_, bxlumis); |
644 |
|
|
645 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
645 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
646 |
|
event.getByLabel (photons_, photons); |
647 |
|
|
648 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
648 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
649 |
|
event.getByLabel (superclusters_, superclusters); |
650 |
|
|
651 |
< |
if (useTrackCaloRhoCorr_) { |
652 |
< |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
653 |
< |
// This rho collection is not available in all BEANs. |
651 |
> |
if (datasetType_ == "signalMC"){ |
652 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) |
653 |
> |
event.getByLabel (stops_, stops); |
654 |
> |
} |
655 |
> |
|
656 |
> |
if (useTrackCaloRhoCorr_) { |
657 |
> |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
658 |
> |
// This rho collection is not available in all BEANs. |
659 |
|
// For description of rho values for different jet reconstruction algorithms, see |
660 |
< |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
661 |
< |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
660 |
> |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
661 |
> |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
662 |
|
} |
663 |
|
|
664 |
+ |
double masterScaleFactor = 1.0; |
665 |
|
|
666 |
|
//get pile-up event weight |
667 |
< |
double scaleFactor = 1.00; |
668 |
< |
if(doPileupReweighting_ && datasetType_ != "data") |
669 |
< |
scaleFactor = puWeight_->at (events->at (0).numTruePV); |
670 |
< |
|
671 |
< |
cTauScaleFactor_ = 1.0; |
672 |
< |
#ifdef DISPLACED_SUSY |
673 |
< |
if (datasetType_ == "signalMC") |
674 |
< |
cTauScaleFactor_ = cTauWeight_->at (event); |
675 |
< |
#endif |
676 |
< |
scaleFactor *= cTauScaleFactor_; |
667 |
> |
if (doPileupReweighting_ && datasetType_ != "data") { |
668 |
> |
//for "data" datasets, the numTruePV is always set to -1 |
669 |
> |
if (events->at(0).numTruePV < 0) cout << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. Turning off pile-up reweighting." << endl; |
670 |
> |
else masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
671 |
> |
} |
672 |
> |
|
673 |
> |
stopCTauScaleFactor_ = 1.0; |
674 |
> |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
675 |
> |
stopCTauScaleFactor_ = stopCTauWeight_->at (event); |
676 |
> |
masterScaleFactor *= stopCTauScaleFactor_; |
677 |
|
|
678 |
|
//loop over all channels |
679 |
|
|
684 |
|
counterMap passingCounter; |
685 |
|
cumulativeFlags.clear (); |
686 |
|
|
687 |
+ |
for (map<string, vector<float>>::iterator iter = BNTreeBranchVals_.begin(); |
688 |
+ |
iter != BNTreeBranchVals_.end(); iter++) { |
689 |
+ |
iter->second.clear(); // clear array |
690 |
+ |
} |
691 |
+ |
|
692 |
|
bool triggerDecision = true; |
693 |
< |
if(currentChannel.triggers.size() != 0){ //triggers specified |
694 |
< |
triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product()); |
693 |
> |
if(currentChannel.triggers.size() != 0 || currentChannel.triggersToVeto.size() != 0){ //triggers specified |
694 |
> |
triggerDecision = evaluateTriggers(currentChannel.triggers, currentChannel.triggersToVeto, triggers.product()); |
695 |
|
cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision; |
696 |
|
} |
697 |
|
|
698 |
|
//loop over all cuts |
554 |
– |
|
555 |
– |
|
556 |
– |
|
699 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
700 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
559 |
– |
|
701 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
702 |
|
string currentObject = objectsToCut.at(currentObjectIndex); |
703 |
|
|
712 |
|
int flagsForPairCutsIndex = max(int(currentCutIndex-1),0); |
713 |
|
|
714 |
|
|
715 |
< |
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
716 |
< |
|
717 |
< |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
577 |
< |
|
715 |
> |
if (currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
716 |
> |
else if(currentObject == "secondary jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets"); |
717 |
> |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
718 |
|
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
719 |
+ |
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
720 |
|
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
721 |
|
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
722 |
|
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
728 |
|
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
729 |
|
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
730 |
|
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
731 |
+ |
else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs"); |
732 |
+ |
|
733 |
|
|
734 |
|
|
735 |
|
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
738 |
|
"muon-muon pairs"); |
739 |
|
|
740 |
|
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
741 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
742 |
< |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
743 |
< |
"muon-secondary muon pairs"); |
741 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
742 |
> |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
743 |
> |
"muon-secondary muon pairs"); |
744 |
> |
|
745 |
> |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
746 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
747 |
> |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
748 |
> |
"electron-secondary electron pairs"); |
749 |
|
|
750 |
|
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
751 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
755 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
756 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
757 |
|
"electron-muon pairs"); |
758 |
< |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
759 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
760 |
< |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
761 |
< |
"track-event pairs"); |
762 |
< |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
763 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
764 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
765 |
< |
"electron-track pairs"); |
766 |
< |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
767 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
768 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
769 |
< |
"muon-track pairs"); |
770 |
< |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
771 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
772 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
773 |
< |
"muon-tau pairs"); |
774 |
< |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(), |
775 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
776 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
777 |
< |
"tau-tau pairs"); |
778 |
< |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
758 |
> |
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
759 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
760 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
761 |
> |
"jet-jet pairs"); |
762 |
> |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
763 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
764 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
765 |
> |
"electron-jet pairs"); |
766 |
> |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
767 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
768 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
769 |
> |
"muon-jet pairs"); |
770 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
771 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
772 |
> |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
773 |
> |
"track-event pairs"); |
774 |
> |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
775 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
776 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
777 |
> |
"electron-track pairs"); |
778 |
> |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
779 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
780 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
781 |
> |
"muon-track pairs"); |
782 |
> |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
783 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
784 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
785 |
> |
"muon-tau pairs"); |
786 |
> |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(), |
787 |
|
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
788 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
789 |
< |
"tau-track pairs"); |
790 |
< |
|
791 |
< |
|
788 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
789 |
> |
"tau-tau pairs"); |
790 |
> |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
791 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
792 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
793 |
> |
"tau-track pairs"); |
794 |
> |
else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(), |
795 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
796 |
> |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
797 |
> |
"electron-trigobj pairs"); |
798 |
> |
else if(currentObject == "muon-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(), |
799 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
800 |
> |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
801 |
> |
"muon-trigobj pairs"); |
802 |
> |
|
803 |
> |
if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops"); |
804 |
|
} |
805 |
|
|
806 |
|
|
807 |
|
|
808 |
|
}//end loop over all cuts |
641 |
– |
|
642 |
– |
|
809 |
|
//use cumulative flags to apply cuts at event level |
810 |
|
|
811 |
|
bool eventPassedAllCuts = true; |
812 |
< |
|
812 |
> |
//a vector to store cumulative cut descisions after each cut. |
813 |
> |
vector<bool> eventPassedPreviousCuts; |
814 |
|
//apply trigger (true if none were specified) |
815 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
816 |
|
|
650 |
– |
|
817 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
818 |
|
|
819 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
821 |
|
int numberPassing = 0; |
822 |
|
|
823 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
824 |
< |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
824 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
825 |
|
} |
826 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
827 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
828 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
829 |
< |
|
829 |
> |
eventPassedPreviousCuts.push_back(eventPassedAllCuts); |
830 |
|
} |
831 |
+ |
double scaleFactor = masterScaleFactor; |
832 |
|
|
833 |
< |
// if(datasetType_ != "data") { |
834 |
< |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
835 |
< |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
836 |
< |
// } |
837 |
< |
|
833 |
> |
muonScaleFactor_ = electronScaleFactor_ = bTagScaleFactor_ = 1.0; |
834 |
> |
if(applyLeptonSF_ && datasetType_ != "data"){ |
835 |
> |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
836 |
> |
vector<bool> muonFlags; |
837 |
> |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
838 |
> |
if (cumulativeFlags.at("muons").at(i).size()){ |
839 |
> |
muonFlags = cumulativeFlags.at("muons").at(i); |
840 |
> |
break; |
841 |
> |
} |
842 |
> |
} |
843 |
> |
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
844 |
> |
if(!muonFlags.at(muonIndex)) continue; |
845 |
> |
muonScaleFactor_ *= muonSFWeight_->at (muons->at(muonIndex).eta); |
846 |
> |
} |
847 |
> |
} |
848 |
> |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
849 |
> |
vector<bool> electronFlags; |
850 |
> |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
851 |
> |
if (cumulativeFlags.at("electrons").at(i).size()){ |
852 |
> |
electronFlags = cumulativeFlags.at("electrons").at(i); |
853 |
> |
break; |
854 |
> |
} |
855 |
> |
} |
856 |
> |
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
857 |
> |
if(!electronFlags.at(electronIndex)) continue; |
858 |
> |
electronScaleFactor_ *= electronSFWeight_->at (electrons->at(electronIndex).eta, electrons->at(electronIndex).pt); |
859 |
> |
} |
860 |
> |
} |
861 |
> |
} |
862 |
> |
if(applyBtagSF_ && datasetType_ != "data"){ |
863 |
> |
if(cumulativeFlags.find ("jets") != cumulativeFlags.end ()){ |
864 |
> |
vector<bool> jetFlags; |
865 |
> |
vector<double> jetSFs; |
866 |
> |
for (int i = cumulativeFlags.at("jets").size() - 1; i >= 0; i--){ |
867 |
> |
if (cumulativeFlags.at("jets").at(i).size()){ |
868 |
> |
jetFlags = cumulativeFlags.at("jets").at(i); |
869 |
> |
break; |
870 |
> |
} |
871 |
> |
} |
872 |
> |
for (uint jetIndex = 0; jetIndex != jetFlags.size(); jetIndex++){ |
873 |
> |
if(!jetFlags.at(jetIndex)) continue; |
874 |
> |
double jetSFTmp = bTagSFWeight_->sflookup(jets->at(jetIndex).btagCombinedSecVertex, jets->at(jetIndex).pt); |
875 |
> |
jetSFs.push_back(jetSFTmp); |
876 |
> |
} |
877 |
> |
bTagScaleFactor_ *= bTagSFWeight_->weight( jetSFs, minBtag_, maxBtag_ ); |
878 |
> |
} |
879 |
> |
} |
880 |
> |
scaleFactor *= muonScaleFactor_; |
881 |
> |
scaleFactor *= electronScaleFactor_; |
882 |
> |
scaleFactor *= bTagScaleFactor_; |
883 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
884 |
|
|
673 |
– |
|
674 |
– |
|
675 |
– |
if(!eventPassedAllCuts)continue; |
676 |
– |
|
885 |
|
if (printEventInfo_) { |
886 |
< |
// Write information about event to screen, for testing purposes. |
887 |
< |
cout << "Event passed all cuts in channel " << currentChannel.name |
888 |
< |
<< ": run=" << events->at(0).run |
889 |
< |
<< " lumi=" << events->at(0).lumi |
890 |
< |
<< " event=" << events->at(0).evt |
891 |
< |
<< endl; |
886 |
> |
// Write information about event to screen, for testing purposes. |
887 |
> |
cout << "Event passed all cuts in channel " << currentChannel.name |
888 |
> |
<< ": run=" << events->at(0).run |
889 |
> |
<< " lumi=" << events->at(0).lumi |
890 |
> |
<< " event=" << events->at(0).evt |
891 |
> |
<< endl; |
892 |
|
} |
893 |
|
|
894 |
|
|
895 |
|
//filling histograms |
896 |
< |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
897 |
< |
histogram currentHistogram = histograms.at(histogramIndex); |
898 |
< |
|
899 |
< |
if(currentHistogram.inputVariables.size() == 1){ |
900 |
< |
TH1D* histo; |
693 |
< |
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
694 |
< |
|
695 |
< |
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
696 |
< |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
697 |
< |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
698 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
699 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
700 |
< |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
701 |
< |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
702 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
703 |
< |
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
704 |
< |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
705 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
706 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
707 |
< |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
708 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
709 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
710 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
711 |
< |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
712 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
713 |
< |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
714 |
< |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
715 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
716 |
< |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
717 |
< |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
718 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
719 |
< |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
720 |
< |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
721 |
< |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
722 |
< |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
723 |
< |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
724 |
< |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(), |
725 |
< |
cumulativeFlags.at("tau-track pairs").back(),scaleFactor); |
726 |
< |
|
727 |
< |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
728 |
< |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
729 |
< |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
730 |
< |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
731 |
< |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
732 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
733 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
734 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
735 |
< |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
736 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
737 |
< |
} |
738 |
< |
else if(currentHistogram.inputVariables.size() == 2){ |
739 |
< |
TH2D* histo; |
740 |
< |
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
741 |
< |
|
742 |
< |
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
743 |
< |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
744 |
< |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor); |
745 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
746 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
747 |
< |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
748 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
749 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \ |
750 |
< |
cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor); |
751 |
< |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
752 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
753 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
754 |
< |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
755 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
756 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
757 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
758 |
< |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
759 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
760 |
< |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
761 |
< |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
762 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
763 |
< |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
764 |
< |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
765 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
766 |
< |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
767 |
< |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
768 |
< |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
769 |
< |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
770 |
< |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
771 |
< |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(), |
772 |
< |
cumulativeFlags.at("tau-track pairs").back(),scaleFactor); |
773 |
< |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
774 |
< |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
775 |
< |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
776 |
< |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
777 |
< |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
778 |
< |
cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(), |
779 |
< |
cumulativeFlags.at("track-event pairs").back(),scaleFactor); |
780 |
< |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
781 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
782 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
783 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
784 |
< |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
785 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
896 |
> |
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the directories in each channel. |
897 |
> |
uint currentDir; |
898 |
> |
if (!GetPlotsAfterEachCut_) { currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size(); } //if GetPlotsAfterEachCut_ is false, set currentDir point to the last cut. |
899 |
> |
else{ |
900 |
> |
currentDir = currentCut; |
901 |
|
} |
902 |
< |
} |
902 |
> |
if(eventPassedPreviousCuts.at(currentDir)){ |
903 |
|
|
904 |
+ |
// Assign BNTree variables |
905 |
+ |
for (uint iBranch = 0; iBranch != treeBranches_.size(); iBranch++) { |
906 |
+ |
BranchSpecs brSpecs = treeBranches_.at(iBranch); |
907 |
+ |
string coll = brSpecs.inputCollection; |
908 |
+ |
if (cumulativeFlags.count(coll) == 0) cout << "Error: no flags found for collection: " << coll << ", will cause a seg fault" << endl; |
909 |
+ |
|
910 |
+ |
if (coll == "jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).at(currentDir)); |
911 |
+ |
else if(coll == "secondary jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).at(currentDir)); |
912 |
+ |
else if(coll == "muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).at(currentDir)); |
913 |
+ |
else if(coll == "secondary muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).at(currentDir)); |
914 |
+ |
else if(coll == "electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).at(currentDir)); |
915 |
+ |
else if(coll == "secondary electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).at(currentDir)); |
916 |
+ |
else if(coll == "events") assignTreeBranch(brSpecs,events.product(), cumulativeFlags.at(coll).at(currentDir)); |
917 |
+ |
else if(coll == "taus") assignTreeBranch(brSpecs,taus.product(), cumulativeFlags.at(coll).at(currentDir)); |
918 |
+ |
else if(coll == "mets") assignTreeBranch(brSpecs,mets.product(), cumulativeFlags.at(coll).at(currentDir)); |
919 |
+ |
else if(coll == "tracks") assignTreeBranch(brSpecs,tracks.product(), cumulativeFlags.at(coll).at(currentDir)); |
920 |
+ |
else if(coll == "genjets") assignTreeBranch(brSpecs,genjets.product(), cumulativeFlags.at(coll).at(currentDir)); |
921 |
+ |
else if(coll == "mcparticles") assignTreeBranch(brSpecs,mcparticles.product(), cumulativeFlags.at(coll).at(currentDir)); |
922 |
+ |
else if(coll == "primaryvertexs") assignTreeBranch(brSpecs,primaryvertexs.product(),cumulativeFlags.at(coll).at(currentDir)); |
923 |
+ |
else if(coll == "bxlumis") assignTreeBranch(brSpecs,bxlumis.product(), cumulativeFlags.at(coll).at(currentDir)); |
924 |
+ |
else if(coll == "photons") assignTreeBranch(brSpecs,photons.product(), cumulativeFlags.at(coll).at(currentDir)); |
925 |
+ |
else if(coll == "superclusters") assignTreeBranch(brSpecs,superclusters.product(), cumulativeFlags.at(coll).at(currentDir)); |
926 |
+ |
else if(coll == "trigobjs") assignTreeBranch(brSpecs,trigobjs.product(), cumulativeFlags.at(coll).at(currentDir)); |
927 |
+ |
else if(coll == "stops" |
928 |
+ |
&& datasetType_ == "signalMC") assignTreeBranch(brSpecs,stops.product(), cumulativeFlags.at(coll).at(currentDir)); |
929 |
+ |
} // end loop over branches |
930 |
+ |
|
931 |
+ |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
932 |
+ |
histogram currentHistogram = histograms.at(histogramIndex); |
933 |
+ |
|
934 |
+ |
if (cumulativeFlags.count(currentHistogram.inputCollection) == 0) cout << "Error: no flags found for collection: " << currentHistogram.inputCollection << ", will cause a seg fault" << endl; |
935 |
+ |
|
936 |
+ |
if(currentHistogram.inputVariables.size() == 1){ |
937 |
+ |
TH1D* histo; |
938 |
+ |
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
939 |
+ |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
940 |
+ |
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
941 |
+ |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
942 |
+ |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
943 |
+ |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
944 |
+ |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
945 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
946 |
+ |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
947 |
+ |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
948 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
949 |
+ |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
950 |
+ |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
951 |
+ |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
952 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir),\ |
953 |
+ |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
954 |
+ |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(),\ |
955 |
+ |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir),\ |
956 |
+ |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
957 |
+ |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
958 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
959 |
+ |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
960 |
+ |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
961 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), |
962 |
+ |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
963 |
+ |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
964 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
965 |
+ |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
966 |
+ |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
967 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
968 |
+ |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
969 |
+ |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
970 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
971 |
+ |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
972 |
+ |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
973 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
974 |
+ |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
975 |
+ |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
976 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
977 |
+ |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
978 |
+ |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
979 |
+ |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
980 |
+ |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
981 |
+ |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
982 |
+ |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
983 |
+ |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
984 |
+ |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
985 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
986 |
+ |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
987 |
+ |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
988 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
989 |
+ |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
990 |
+ |
|
991 |
+ |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
992 |
+ |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
993 |
+ |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
994 |
+ |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
995 |
+ |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
996 |
+ |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
997 |
+ |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
998 |
+ |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
999 |
+ |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1000 |
+ |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1001 |
+ |
else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1002 |
+ |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1003 |
+ |
} |
1004 |
+ |
else if(currentHistogram.inputVariables.size() == 2){ |
1005 |
+ |
TH2D* histo; |
1006 |
+ |
histo = twoDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
1007 |
+ |
if (currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
1008 |
+ |
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
1009 |
+ |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
1010 |
+ |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
1011 |
+ |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1012 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1013 |
+ |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
1014 |
+ |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
1015 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
1016 |
+ |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
1017 |
+ |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
1018 |
+ |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
1019 |
+ |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1020 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
1021 |
+ |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1022 |
+ |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1023 |
+ |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1024 |
+ |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1025 |
+ |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1026 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1027 |
+ |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1028 |
+ |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
1029 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1030 |
+ |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1031 |
+ |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1032 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1033 |
+ |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1034 |
+ |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1035 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1036 |
+ |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1037 |
+ |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
1038 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1039 |
+ |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1040 |
+ |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
1041 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1042 |
+ |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1043 |
+ |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
1044 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1045 |
+ |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1046 |
+ |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
1047 |
+ |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1048 |
+ |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1049 |
+ |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
1050 |
+ |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1051 |
+ |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1052 |
+ |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
1053 |
+ |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1054 |
+ |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1055 |
+ |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
1056 |
+ |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1057 |
+ |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1058 |
+ |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1059 |
+ |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1060 |
+ |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1061 |
+ |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1062 |
+ |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
1063 |
+ |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
1064 |
+ |
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
1065 |
+ |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1066 |
+ |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1067 |
+ |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
1068 |
+ |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
1069 |
+ |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1070 |
+ |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1071 |
+ |
else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1072 |
+ |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1073 |
+ |
} |
1074 |
+ |
|
1075 |
+ |
} |
1076 |
|
|
1077 |
|
|
1078 |
< |
//fills histograms with the sizes of collections |
1079 |
< |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
1080 |
< |
|
1081 |
< |
string currentObject = objectsToPlot.at(currentObjectIndex); |
1082 |
< |
|
1083 |
< |
string objectToPlot = ""; |
1084 |
< |
|
1085 |
< |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
1086 |
< |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
1087 |
< |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
1088 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
1089 |
< |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
1090 |
< |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1091 |
< |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1092 |
< |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
1093 |
< |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
1094 |
< |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
1095 |
< |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1096 |
< |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1097 |
< |
else objectToPlot = currentObject; |
1098 |
< |
|
1099 |
< |
string tempCurrentObject = objectToPlot; |
1100 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
1101 |
< |
string histoName = "num" + tempCurrentObject; |
1102 |
< |
|
1103 |
< |
//set position of primary vertex in event, in order to calculate quantities relative to it |
1104 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
1105 |
< |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
1106 |
< |
int numToPlot = 0; |
1107 |
< |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1108 |
< |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
1109 |
< |
} |
1110 |
< |
if(objectToPlot == "primaryvertexs"){ |
1111 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1112 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1113 |
< |
} |
1114 |
< |
else { |
1115 |
< |
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
1116 |
< |
} |
1117 |
< |
} |
1118 |
< |
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
1119 |
< |
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
1120 |
< |
else if(objectToPlot == "secondaryMuons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
1121 |
< |
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
1122 |
< |
else if(objectToPlot == "muonSecondaryMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
1123 |
< |
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
1124 |
< |
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
1125 |
< |
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
1126 |
< |
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
1127 |
< |
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
1128 |
< |
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
1129 |
< |
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor); |
1130 |
< |
else if(objectToPlot == "tracks") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(tracks->size(),scaleFactor); |
1131 |
< |
else if(objectToPlot == "genjets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(genjets->size(),scaleFactor); |
1132 |
< |
else if(objectToPlot == "mcparticles") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mcparticles->size(),scaleFactor); |
1133 |
< |
else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),scaleFactor); |
847 |
< |
else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),scaleFactor); |
848 |
< |
else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),scaleFactor); |
849 |
< |
else if(objectToPlot == "primaryvertexs"){ |
850 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
851 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
852 |
< |
} |
1078 |
> |
//fills histograms with the sizes of collections |
1079 |
> |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
1080 |
> |
|
1081 |
> |
string currentObject = objectsToPlot.at(currentObjectIndex); |
1082 |
> |
string objectToPlot = ""; |
1083 |
> |
|
1084 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
1085 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
1086 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
1087 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
1088 |
> |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
1089 |
> |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
1090 |
> |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
1091 |
> |
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
1092 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
1093 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1094 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1095 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
1096 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
1097 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
1098 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1099 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1100 |
> |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
1101 |
> |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
1102 |
> |
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
1103 |
> |
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
1104 |
> |
else objectToPlot = currentObject; |
1105 |
> |
|
1106 |
> |
string tempCurrentObject = objectToPlot; |
1107 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
1108 |
> |
string histoName = "num" + tempCurrentObject; |
1109 |
> |
|
1110 |
> |
//set position of primary vertex in event, in order to calculate quantities relative to it |
1111 |
> |
if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
1112 |
> |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1113 |
> |
int numToPlot = 0; |
1114 |
> |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1115 |
> |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
1116 |
> |
} |
1117 |
> |
if(objectToPlot == "primaryvertexs"){ |
1118 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1119 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1120 |
> |
} |
1121 |
> |
else { |
1122 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1123 |
> |
} |
1124 |
> |
} |
1125 |
> |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1126 |
> |
|
1127 |
> |
if (!BNTrees_.at(currentChannelIndex)) { cout << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
1128 |
> |
BNTrees_.at(currentChannelIndex)->Fill(); // only fill if event has passed cuts |
1129 |
> |
|
1130 |
> |
} // end if(eventPassedPreviousCuts.at(currentDir)){ |
1131 |
> |
} // end loop over cuts |
1132 |
> |
|
1133 |
> |
} // end loop over channel |
1134 |
|
|
854 |
– |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
1135 |
|
|
1136 |
< |
} //end loop over channel |
1136 |
> |
masterCutFlow_->fillCutFlow(masterScaleFactor); |
1137 |
|
|
858 |
– |
masterCutFlow_->fillCutFlow(scaleFactor); |
1138 |
|
|
1139 |
|
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
1140 |
|
|
1151 |
|
else if(comparison == "==") return testValue == cutValue; |
1152 |
|
else if(comparison == "=") return testValue == cutValue; |
1153 |
|
else if(comparison == "!=") return testValue != cutValue; |
1154 |
< |
else {std::cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1154 |
> |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1155 |
|
|
1156 |
|
} |
1157 |
|
|
1158 |
|
bool |
1159 |
< |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){ |
1159 |
> |
OSUAnalysis::evaluateComparison (string testValue, string comparison, string cutValue){ |
1160 |
|
|
1161 |
+ |
|
1162 |
+ |
if(comparison == ">") return testValue > cutValue; |
1163 |
+ |
else if(comparison == ">=") return testValue >= cutValue; |
1164 |
+ |
else if(comparison == "<") return testValue < cutValue; |
1165 |
+ |
else if(comparison == "<=") return testValue <= cutValue; |
1166 |
+ |
else if(comparison == "==") return testValue == cutValue; |
1167 |
+ |
else if(comparison == "=") return testValue == cutValue; |
1168 |
+ |
else if(comparison == "!=") return testValue != cutValue; |
1169 |
+ |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1170 |
+ |
|
1171 |
+ |
} |
1172 |
+ |
|
1173 |
+ |
bool |
1174 |
+ |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, vector<string> triggersToVeto, const BNtriggerCollection* triggerCollection){ |
1175 |
+ |
|
1176 |
+ |
//initialize to false until a chosen trigger is passed |
1177 |
|
bool triggerDecision = false; |
1178 |
|
|
1179 |
< |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++) |
1180 |
< |
{ |
1181 |
< |
if(trigger->pass != 1) continue; |
1182 |
< |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++) |
1183 |
< |
{ |
1184 |
< |
if(trigger->name.find(triggersToTest.at(triggerName))!=std::string::npos){ |
1185 |
< |
triggerDecision = true; |
1186 |
< |
} |
1187 |
< |
} |
1188 |
< |
} |
1189 |
< |
return triggerDecision; |
1179 |
> |
if (printAllTriggers_) cout << "Printing list of all available triggers (which this event may or may not pass):" << endl; |
1180 |
> |
//loop over all triggers defined in the event |
1181 |
> |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++){ |
1182 |
> |
|
1183 |
> |
if (printAllTriggers_) cout << " " << trigger->name << endl; |
1184 |
> |
|
1185 |
> |
//we're only interested in triggers that actually passed |
1186 |
> |
if(trigger->pass != 1) continue; |
1187 |
> |
|
1188 |
> |
//if the event passes one of the veto triggers, exit and return false |
1189 |
> |
for(uint triggerName = 0; triggerName != triggersToVeto.size(); triggerName++){ |
1190 |
> |
if(trigger->name.find(triggersToVeto.at(triggerName))!=string::npos) return false; |
1191 |
> |
} |
1192 |
> |
//if the event passes one of the chosen triggers, set triggerDecision to true |
1193 |
> |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++){ |
1194 |
> |
if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos) triggerDecision = true; |
1195 |
> |
} |
1196 |
> |
} |
1197 |
> |
|
1198 |
> |
printAllTriggers_ = false; // only print triggers once, not every event |
1199 |
|
|
1200 |
+ |
//if none of the veto triggers fired: |
1201 |
+ |
//return the OR of all the chosen triggers |
1202 |
+ |
if (triggersToTest.size() != 0) return triggerDecision; |
1203 |
+ |
//or if no triggers were defined return true |
1204 |
+ |
else return true; |
1205 |
|
} |
1206 |
|
|
1207 |
< |
std::vector<std::string> |
1207 |
> |
|
1208 |
> |
vector<string> |
1209 |
|
OSUAnalysis::splitString (string inputString){ |
1210 |
|
|
1211 |
< |
std::stringstream stringStream(inputString); |
1212 |
< |
std::istream_iterator<std::string> begin(stringStream); |
1213 |
< |
std::istream_iterator<std::string> end; |
1214 |
< |
std::vector<std::string> stringVector(begin, end); |
1211 |
> |
stringstream stringStream(inputString); |
1212 |
> |
istream_iterator<string> begin(stringStream); |
1213 |
> |
istream_iterator<string> end; |
1214 |
> |
vector<string> stringVector(begin, end); |
1215 |
|
return stringVector; |
1216 |
|
|
1217 |
|
} |
1218 |
|
|
1219 |
|
|
1220 |
|
void OSUAnalysis::getTwoObjs(string tempInputCollection, string& obj1, string& obj2) { |
1221 |
< |
// Set two object strings from the tempInputCollection string, |
1222 |
< |
// For example, if tempInputCollection is "electron-muon pairs", |
1223 |
< |
// then obj1 = "electrons" and obj2 = "muons". |
1224 |
< |
// Note that the objects have an "s" appended. |
1221 |
> |
// Set two object strings from the tempInputCollection string, |
1222 |
> |
// For example, if tempInputCollection is "electron-muon pairs", |
1223 |
> |
// then obj1 = "electrons" and obj2 = "muons". |
1224 |
> |
// Note that the objects have an "s" appended. |
1225 |
|
|
1226 |
|
int dashIndex = tempInputCollection.find("-"); |
1227 |
|
int spaceIndex = tempInputCollection.find_last_of(" "); |
1228 |
|
int secondWordLength = spaceIndex - dashIndex; |
1229 |
< |
obj1 = tempInputCollection.substr(0,dashIndex) + "s"; |
1229 |
> |
obj1 = tempInputCollection.substr(0,dashIndex) + "s"; |
1230 |
|
obj2 = tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"; |
1231 |
< |
|
1232 |
< |
} |
1231 |
> |
|
1232 |
> |
} |
1233 |
|
|
1234 |
|
|
1235 |
|
string OSUAnalysis::getObjToGet(string obj) { |
1236 |
|
// Return the string corresponding to the object to get for the given obj string. |
1237 |
< |
// Right now this only handles the case in which obj contains "secondary", |
1238 |
< |
// e.g, "secondary muons". |
1239 |
< |
// Note that "s" is NOT appended. |
930 |
< |
|
931 |
< |
if (obj.find("secondary")==std::string::npos) return obj; // "secondary" is not found |
932 |
< |
int firstSpaceIndex = obj.find_first_of(" "); |
933 |
< |
return obj.substr(firstSpaceIndex+1,obj.length()-1); |
1237 |
> |
// Right now this only handles the case in which obj contains "secondary", |
1238 |
> |
// e.g, "secondary muons". |
1239 |
> |
// Note that "s" is NOT appended. |
1240 |
|
|
1241 |
< |
} |
1241 |
> |
if (obj.find("secondary")==string::npos) return obj; // "secondary" is not found |
1242 |
> |
int firstSpaceIndex = obj.find_first_of(" "); |
1243 |
> |
return obj.substr(firstSpaceIndex+1,obj.length()-1); |
1244 |
|
|
1245 |
+ |
} |
1246 |
|
|
1247 |
|
|
1248 |
+ |
//!jet valueLookup |
1249 |
|
double |
1250 |
< |
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){ |
1250 |
> |
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function, string &stringValue){ |
1251 |
|
|
1252 |
|
double value = 0.0; |
1253 |
|
if(variable == "energy") value = object->energy; |
1367 |
|
else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased; |
1368 |
|
|
1369 |
|
|
1370 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1370 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1371 |
|
|
1372 |
|
value = applyFunction(function, value); |
1373 |
|
|
1375 |
|
} |
1376 |
|
|
1377 |
|
|
1378 |
< |
|
1378 |
> |
//!muon valueLookup |
1379 |
|
double |
1380 |
< |
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){ |
1380 |
> |
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function, string &stringValue){ |
1381 |
|
|
1382 |
|
double value = 0.0; |
1383 |
|
if(variable == "energy") value = object->energy; |
1538 |
|
else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt; |
1539 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIso + max(0.0, object->neutralHadronIso + object->photonIso - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1540 |
|
else if(variable == "metMT") { |
1541 |
< |
const BNmet *met = chosenMET (); |
1232 |
< |
if (met) |
1541 |
> |
if (const BNmet *met = chosenMET ()) |
1542 |
|
{ |
1543 |
< |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1544 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1236 |
< |
|
1237 |
< |
value = (p1 + p2).Mt (); |
1543 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1544 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1545 |
|
} |
1546 |
|
else |
1547 |
|
value = -999; |
1659 |
|
value = object->isGlobalMuon > 0 \ |
1660 |
|
&& object->isPFMuon > 0 \ |
1661 |
|
&& object->normalizedChi2 < 10 \ |
1662 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1662 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1663 |
|
&& object->numberOfMatchedStations > 1 \ |
1664 |
|
&& fabs(object->correctedD0Vertex) < 0.2 \ |
1665 |
|
&& fabs(object->correctedDZ) < 0.5 \ |
1668 |
|
} |
1669 |
|
else if(variable == "tightIDdisplaced"){ |
1670 |
|
value = object->isGlobalMuon > 0 \ |
1671 |
+ |
&& object->isPFMuon > 0 \ |
1672 |
|
&& object->normalizedChi2 < 10 \ |
1673 |
< |
&& object->numberOfValidMuonHits > 0 \ |
1673 |
> |
&& object->numberOfValidMuonHits > 0 \ |
1674 |
|
&& object->numberOfMatchedStations > 1 \ |
1675 |
|
&& object->numberOfValidPixelHits > 0 \ |
1676 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1677 |
|
} |
1678 |
|
|
1679 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1679 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1680 |
|
|
1681 |
|
else if(variable == "genMatchedPdgId"){ |
1682 |
|
int index = getGenMatchedParticleIndex(object); |
1696 |
|
} |
1697 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
1698 |
|
int index = getGenMatchedParticleIndex(object); |
1699 |
< |
if(index == -1) value = 23; |
1700 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1699 |
> |
if(index == -1) value = 24; |
1700 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).motherId); |
1701 |
|
} |
1702 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1703 |
|
int index = getGenMatchedParticleIndex(object); |
1709 |
|
} |
1710 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1711 |
|
} |
1712 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1713 |
+ |
int index = getGenMatchedParticleIndex(object); |
1714 |
+ |
if(index == -1) value = 24; |
1715 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1716 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1717 |
+ |
if(motherIndex == -1) value = 24; |
1718 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1719 |
+ |
} |
1720 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1721 |
+ |
} |
1722 |
+ |
else if(variable == "pfMuonsFromVertex"){ |
1723 |
+ |
double d0Error, dzError; |
1724 |
+ |
|
1725 |
+ |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1726 |
+ |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
1727 |
+ |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
1728 |
+ |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
1729 |
+ |
|| fabs (object->correctedDZ / dzError) > 99.0; |
1730 |
+ |
value = (object->isStandAloneMuon && !object->isTrackerMuon && !object->isGlobalMuon) || !value; |
1731 |
+ |
} |
1732 |
|
|
1733 |
|
|
1734 |
|
|
1735 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1735 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1736 |
|
|
1737 |
|
value = applyFunction(function, value); |
1738 |
|
|
1739 |
|
return value; |
1740 |
|
} |
1741 |
|
|
1742 |
< |
|
1742 |
> |
//!electron valueLookup |
1743 |
|
double |
1744 |
< |
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){ |
1744 |
> |
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function, string &stringValue){ |
1745 |
|
|
1746 |
|
double value = 0.0; |
1747 |
|
if(variable == "energy") value = object->energy; |
1907 |
|
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
1908 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1909 |
|
else if(variable == "metMT") { |
1910 |
< |
const BNmet *met = chosenMET (); |
1583 |
< |
if (met) |
1910 |
> |
if (const BNmet *met = chosenMET ()) |
1911 |
|
{ |
1912 |
< |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1913 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1587 |
< |
|
1588 |
< |
value = (p1 + p2).Mt (); |
1912 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1913 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1914 |
|
} |
1915 |
|
else |
1916 |
|
value = -999; |
2075 |
|
} |
2076 |
|
|
2077 |
|
|
2078 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2078 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2079 |
|
|
2080 |
|
else if(variable == "genMatchedPdgId"){ |
2081 |
|
int index = getGenMatchedParticleIndex(object); |
2096 |
|
} |
2097 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2098 |
|
int index = getGenMatchedParticleIndex(object); |
2099 |
< |
if(index == -1) value = 23; |
2100 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2099 |
> |
if(index == -1) value = 24; |
2100 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2101 |
|
} |
2102 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2103 |
|
int index = getGenMatchedParticleIndex(object); |
2109 |
|
} |
2110 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2111 |
|
} |
2112 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2113 |
+ |
int index = getGenMatchedParticleIndex(object); |
2114 |
+ |
if(index == -1) value = 24; |
2115 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2116 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2117 |
+ |
if(motherIndex == -1) value = 24; |
2118 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2119 |
+ |
} |
2120 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2121 |
+ |
} |
2122 |
+ |
else if(variable == "pfElectronsFromVertex"){ |
2123 |
+ |
double d0Error, dzError; |
2124 |
+ |
|
2125 |
+ |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2126 |
+ |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
2127 |
+ |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
2128 |
+ |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
2129 |
+ |
|| fabs (object->correctedDZ / dzError) > 99.0; |
2130 |
+ |
value = !value; |
2131 |
+ |
} |
2132 |
|
|
2133 |
|
|
2134 |
|
|
2135 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2135 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2136 |
|
|
2137 |
|
value = applyFunction(function, value); |
2138 |
|
|
2139 |
|
return value; |
2140 |
|
} |
2141 |
|
|
2142 |
< |
|
2142 |
> |
//!event valueLookup |
2143 |
|
double |
2144 |
< |
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){ |
2144 |
> |
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function, string &stringValue){ |
2145 |
|
|
2146 |
|
double value = 0.0; |
2147 |
|
|
2210 |
|
else if(variable == "id2") value = object->id2; |
2211 |
|
else if(variable == "evt") value = object->evt; |
2212 |
|
else if(variable == "puScaleFactor"){ |
2213 |
< |
if(datasetType_ != "data") |
2213 |
> |
if(doPileupReweighting_ && datasetType_ != "data") |
2214 |
|
value = puWeight_->at (events->at (0).numTruePV); |
2215 |
|
else |
2216 |
|
value = 1.0; |
2217 |
|
} |
2218 |
< |
else if(variable == "muonScaleFactor"){ |
2219 |
< |
if(datasetType_ != "data") |
2220 |
< |
// value = muonSFWeight_->at (chosenMuon ()->eta); |
2221 |
< |
value = 1.0; |
2222 |
< |
else |
1878 |
< |
value = 1.0; |
1879 |
< |
} |
1880 |
< |
else if(variable == "electronScaleFactor"){ |
1881 |
< |
if(datasetType_ != "data") |
1882 |
< |
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1883 |
< |
value = 1.0; |
1884 |
< |
else |
1885 |
< |
value = 1.0; |
1886 |
< |
} |
1887 |
< |
else if(variable == "cTauScaleFactor") |
1888 |
< |
value = cTauScaleFactor_; |
1889 |
< |
|
1890 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2218 |
> |
else if(variable == "muonScaleFactor") value = muonScaleFactor_; |
2219 |
> |
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2220 |
> |
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2221 |
> |
else if(variable == "bTagScaleFactor") value = bTagScaleFactor_; |
2222 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2223 |
|
|
2224 |
|
value = applyFunction(function, value); |
2225 |
|
|
2226 |
|
return value; |
2227 |
|
} |
2228 |
|
|
2229 |
+ |
//!tau valueLookup |
2230 |
|
double |
2231 |
< |
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){ |
2231 |
> |
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function, string &stringValue){ |
2232 |
|
|
2233 |
|
double value = 0.0; |
2234 |
|
|
2274 |
|
|
2275 |
|
|
2276 |
|
|
2277 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2277 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2278 |
|
|
2279 |
|
else if(variable == "genMatchedPdgId"){ |
2280 |
|
int index = getGenMatchedParticleIndex(object); |
2294 |
|
} |
2295 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2296 |
|
int index = getGenMatchedParticleIndex(object); |
2297 |
< |
if(index == -1) value = 23; |
2298 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2297 |
> |
if(index == -1) value = 24; |
2298 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2299 |
|
} |
2300 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2301 |
|
int index = getGenMatchedParticleIndex(object); |
2307 |
|
} |
2308 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2309 |
|
} |
2310 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2311 |
+ |
int index = getGenMatchedParticleIndex(object); |
2312 |
+ |
if(index == -1) value = 24; |
2313 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2314 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2315 |
+ |
if(motherIndex == -1) value = 24; |
2316 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2317 |
+ |
} |
2318 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2319 |
+ |
} |
2320 |
|
|
2321 |
|
|
2322 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2322 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2323 |
|
|
2324 |
|
value = applyFunction(function, value); |
2325 |
|
|
2326 |
|
return value; |
2327 |
|
} |
2328 |
|
|
2329 |
+ |
//!met valueLookup |
2330 |
|
double |
2331 |
< |
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){ |
2331 |
> |
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function, string &stringValue){ |
2332 |
|
|
2333 |
|
double value = 0.0; |
2334 |
|
|
2392 |
|
else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt; |
2393 |
|
else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi; |
2394 |
|
|
2395 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2395 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2396 |
|
|
2397 |
|
value = applyFunction(function, value); |
2398 |
|
|
2399 |
|
return value; |
2400 |
|
} |
2401 |
|
|
2402 |
+ |
//!track valueLookup |
2403 |
|
double |
2404 |
< |
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){ |
2404 |
> |
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function, string &stringValue){ |
2405 |
|
|
2406 |
|
double value = 0.0; |
2407 |
|
double pMag = sqrt(object->pt * object->pt + |
2408 |
< |
object->pz * object->pz); |
2409 |
< |
|
2408 |
> |
object->pz * object->pz); |
2409 |
> |
|
2410 |
|
if(variable == "pt") value = object->pt; |
2411 |
|
else if(variable == "px") value = object->px; |
2412 |
|
else if(variable == "py") value = object->py; |
2427 |
|
|
2428 |
|
|
2429 |
|
//additional BNs info for disappTrks |
2085 |
– |
else if(variable == "isGoodPtResolution") value = object->isGoodPtResolution; |
2430 |
|
else if(variable == "caloEMDeltaRp3") value = object->caloEMDeltaRp3; |
2431 |
|
else if(variable == "caloHadDeltaRp3") value = object->caloHadDeltaRp3; |
2432 |
|
else if(variable == "caloEMDeltaRp4") value = object->caloEMDeltaRp4; |
2433 |
|
else if(variable == "caloHadDeltaRp4") value = object->caloHadDeltaRp4; |
2434 |
|
else if(variable == "caloEMDeltaRp5") value = object->caloEMDeltaRp5; |
2435 |
|
else if(variable == "caloHadDeltaRp5") value = object->caloHadDeltaRp5; |
2436 |
+ |
else if(variable == "nTracksRp5") value = object->nTracksRp5; |
2437 |
|
else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter; |
2438 |
|
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
2439 |
|
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
2440 |
< |
|
2440 |
> |
else if(variable == "depTrkRp5") value = object->depTrkRp5; |
2441 |
|
|
2442 |
|
//user defined variables |
2443 |
|
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; |
2444 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2445 |
+ |
else if(variable == "depTrkRp5MinusPt") value = (object->depTrkRp5 - object->pt); |
2446 |
|
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2447 |
|
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2448 |
< |
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2449 |
< |
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2448 |
> |
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2449 |
> |
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2450 |
|
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2451 |
|
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2452 |
|
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2453 |
|
else if(variable == "ptError") value = object->ptError; |
2454 |
|
else if(variable == "ptRes") value = getTrkPtRes(object); |
2455 |
< |
else if (variable == "d0wrtPV"){ |
2456 |
< |
double vx = object->vx - chosenVertex ()->x, |
2457 |
< |
vy = object->vy - chosenVertex ()->y, |
2458 |
< |
px = object->px, |
2459 |
< |
py = object->py, |
2460 |
< |
pt = object->pt; |
2461 |
< |
value = (-vx * py + vy * px) / pt; |
2462 |
< |
} |
2463 |
< |
else if (variable == "dZwrtPV"){ |
2464 |
< |
double vx = object->vx - chosenVertex ()->x, |
2465 |
< |
vy = object->vy - chosenVertex ()->y, |
2466 |
< |
vz = object->vz - chosenVertex ()->z, |
2467 |
< |
px = object->px, |
2468 |
< |
py = object->py, |
2469 |
< |
pz = object->pz, |
2470 |
< |
pt = object->pt; |
2471 |
< |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2472 |
< |
} |
2473 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2455 |
> |
else if (variable == "d0wrtPV"){ |
2456 |
> |
double vx = object->vx - chosenVertex ()->x, |
2457 |
> |
vy = object->vy - chosenVertex ()->y, |
2458 |
> |
px = object->px, |
2459 |
> |
py = object->py, |
2460 |
> |
pt = object->pt; |
2461 |
> |
value = (-vx * py + vy * px) / pt; |
2462 |
> |
} |
2463 |
> |
else if (variable == "dZwrtPV"){ |
2464 |
> |
double vx = object->vx - chosenVertex ()->x, |
2465 |
> |
vy = object->vy - chosenVertex ()->y, |
2466 |
> |
vz = object->vz - chosenVertex ()->z, |
2467 |
> |
px = object->px, |
2468 |
> |
py = object->py, |
2469 |
> |
pz = object->pz, |
2470 |
> |
pt = object->pt; |
2471 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2472 |
> |
} |
2473 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2474 |
|
|
2475 |
|
else if(variable == "genMatchedPdgId"){ |
2476 |
|
int index = getGenMatchedParticleIndex(object); |
2491 |
|
} |
2492 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2493 |
|
int index = getGenMatchedParticleIndex(object); |
2494 |
< |
if(index == -1) value = 23; |
2495 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2494 |
> |
if(index == -1) value = 24; |
2495 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2496 |
|
} |
2497 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2498 |
|
int index = getGenMatchedParticleIndex(object); |
2504 |
|
} |
2505 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2506 |
|
} |
2507 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2508 |
+ |
int index = getGenMatchedParticleIndex(object); |
2509 |
+ |
if(index == -1) value = 24; |
2510 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2511 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2512 |
+ |
if(motherIndex == -1) value = 24; |
2513 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2514 |
+ |
} |
2515 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2516 |
+ |
} |
2517 |
|
|
2518 |
|
|
2519 |
|
|
2520 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2520 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2521 |
|
|
2522 |
|
value = applyFunction(function, value); |
2523 |
|
|
2524 |
|
return value; |
2525 |
|
} |
2526 |
|
|
2527 |
+ |
//!genjet valueLookup |
2528 |
|
double |
2529 |
< |
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){ |
2529 |
> |
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function, string &stringValue){ |
2530 |
|
|
2531 |
|
double value = 0.0; |
2532 |
|
|
2546 |
|
else if(variable == "charge") value = object->charge; |
2547 |
|
|
2548 |
|
|
2549 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2549 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2550 |
|
|
2551 |
|
value = applyFunction(function, value); |
2552 |
|
|
2553 |
|
return value; |
2554 |
|
} |
2555 |
|
|
2556 |
+ |
//!mcparticle valueLookup |
2557 |
|
double |
2558 |
< |
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){ |
2558 |
> |
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function, string &stringValue){ |
2559 |
|
|
2560 |
|
double value = 0.0; |
2561 |
|
|
2680 |
|
} |
2681 |
|
|
2682 |
|
|
2683 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2683 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2684 |
|
|
2685 |
|
value = applyFunction(function, value); |
2686 |
|
|
2687 |
|
return value; |
2688 |
|
} |
2689 |
|
|
2690 |
+ |
//!primaryvertex valueLookup |
2691 |
|
double |
2692 |
< |
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){ |
2692 |
> |
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function, string &stringValue){ |
2693 |
|
|
2694 |
|
double value = 0.0; |
2695 |
|
|
2708 |
|
else if(variable == "isGood") value = object->isGood; |
2709 |
|
|
2710 |
|
|
2711 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2711 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2712 |
|
|
2713 |
|
value = applyFunction(function, value); |
2714 |
|
|
2715 |
|
return value; |
2716 |
|
} |
2717 |
|
|
2718 |
+ |
//!bxlumi valueLookup |
2719 |
|
double |
2720 |
< |
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){ |
2720 |
> |
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function, string &stringValue){ |
2721 |
|
|
2722 |
|
double value = 0.0; |
2723 |
|
|
2726 |
|
else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now; |
2727 |
|
|
2728 |
|
|
2729 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2729 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2730 |
|
|
2731 |
|
value = applyFunction(function, value); |
2732 |
|
|
2733 |
|
return value; |
2734 |
|
} |
2735 |
|
|
2736 |
+ |
//!photon valueLookup |
2737 |
|
double |
2738 |
< |
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){ |
2738 |
> |
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function, string &stringValue){ |
2739 |
|
|
2740 |
|
double value = 0.0; |
2741 |
|
|
2810 |
|
else if(variable == "seedRecoFlag") value = object->seedRecoFlag; |
2811 |
|
|
2812 |
|
|
2452 |
– |
|
2813 |
|
|
2814 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2814 |
> |
|
2815 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2816 |
|
|
2817 |
|
else if(variable == "genMatchedPdgId"){ |
2818 |
|
int index = getGenMatchedParticleIndex(object); |
2834 |
|
} |
2835 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2836 |
|
int index = getGenMatchedParticleIndex(object); |
2837 |
< |
if(index == -1) value = 23; |
2838 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2837 |
> |
if(index == -1) value = 24; |
2838 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2839 |
|
} |
2840 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2841 |
|
int index = getGenMatchedParticleIndex(object); |
2847 |
|
} |
2848 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2849 |
|
} |
2850 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2851 |
+ |
int index = getGenMatchedParticleIndex(object); |
2852 |
+ |
if(index == -1) value = 24; |
2853 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2854 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2855 |
+ |
if(motherIndex == -1) value = 24; |
2856 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2857 |
+ |
} |
2858 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2859 |
+ |
} |
2860 |
|
|
2861 |
|
|
2862 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2862 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2863 |
|
|
2864 |
|
value = applyFunction(function, value); |
2865 |
|
|
2866 |
|
return value; |
2867 |
|
} |
2868 |
|
|
2869 |
+ |
//!supercluster valueLookup |
2870 |
|
double |
2871 |
< |
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){ |
2871 |
> |
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function, string &stringValue){ |
2872 |
|
|
2873 |
|
double value = 0.0; |
2874 |
|
|
2882 |
|
else if(variable == "theta") value = object->theta; |
2883 |
|
|
2884 |
|
|
2885 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2885 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2886 |
|
|
2887 |
|
value = applyFunction(function, value); |
2888 |
|
|
2889 |
|
return value; |
2890 |
|
} |
2891 |
|
|
2892 |
+ |
//!trigobj valueLookup |
2893 |
+ |
double |
2894 |
+ |
OSUAnalysis::valueLookup (const BNtrigobj* object, string variable, string function, string &stringValue){ |
2895 |
+ |
|
2896 |
+ |
double value = 0.0; |
2897 |
|
|
2898 |
+ |
if(variable == "pt") value = object->pt; |
2899 |
+ |
else if(variable == "eta") value = object->eta; |
2900 |
+ |
else if(variable == "phi") value = object->phi; |
2901 |
+ |
else if(variable == "px") value = object->px; |
2902 |
+ |
else if(variable == "py") value = object->py; |
2903 |
+ |
else if(variable == "pz") value = object->pz; |
2904 |
+ |
else if(variable == "et") value = object->et; |
2905 |
+ |
else if(variable == "energy") value = object->energy; |
2906 |
+ |
else if(variable == "etTotal") value = object->etTotal; |
2907 |
+ |
else if(variable == "id") value = object->id; |
2908 |
+ |
else if(variable == "charge") value = object->charge; |
2909 |
+ |
else if(variable == "isIsolated") value = object->isIsolated; |
2910 |
+ |
else if(variable == "isMip") value = object->isMip; |
2911 |
+ |
else if(variable == "isForward") value = object->isForward; |
2912 |
+ |
else if(variable == "isRPC") value = object->isRPC; |
2913 |
+ |
else if(variable == "bx") value = object->bx; |
2914 |
+ |
else if(variable == "filter") { |
2915 |
+ |
if ((stringValue = object->filter) == "") |
2916 |
+ |
stringValue = "none"; // stringValue should only be empty if value is filled |
2917 |
+ |
} |
2918 |
+ |
|
2919 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2920 |
+ |
|
2921 |
+ |
value = applyFunction(function, value); |
2922 |
+ |
|
2923 |
+ |
return value; |
2924 |
+ |
} |
2925 |
+ |
|
2926 |
+ |
//!muon-muon pair valueLookup |
2927 |
|
double |
2928 |
< |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function){ |
2928 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function, string &stringValue){ |
2929 |
|
|
2930 |
|
double value = 0.0; |
2931 |
|
|
2987 |
|
value = object2->correctedD0; |
2988 |
|
} |
2989 |
|
|
2990 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2990 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2991 |
|
|
2992 |
|
value = applyFunction(function, value); |
2993 |
|
|
2994 |
|
return value; |
2995 |
|
} |
2996 |
|
|
2997 |
+ |
//!electron-electron pair valueLookup |
2998 |
|
double |
2999 |
< |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function){ |
2999 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue){ |
3000 |
|
|
3001 |
|
double value = 0.0; |
3002 |
|
|
3043 |
|
value = object2->correctedD0; |
3044 |
|
} |
3045 |
|
|
3046 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3046 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3047 |
|
|
3048 |
|
value = applyFunction(function, value); |
3049 |
|
|
3050 |
|
return value; |
3051 |
|
} |
3052 |
< |
|
3052 |
> |
//!electron-muon pair valueLookup |
3053 |
|
double |
3054 |
< |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function){ |
3054 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function, string &stringValue){ |
3055 |
|
|
3056 |
|
double value = 0.0; |
3057 |
|
|
3109 |
|
else if(variable == "muonRelPFdBetaIso"){ |
3110 |
|
value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt; |
3111 |
|
} |
3112 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3113 |
+ |
value = applyFunction(function, value); |
3114 |
|
|
3115 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3115 |
> |
return value; |
3116 |
> |
} |
3117 |
|
|
3118 |
+ |
//!electron-jet pair valueLookup |
3119 |
+ |
double |
3120 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3121 |
+ |
|
3122 |
+ |
double value = 0.0; |
3123 |
+ |
|
3124 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3125 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3126 |
+ |
else if(variable == "jetEta") value = object2->eta; |
3127 |
+ |
else if(variable == "jetPhi") value = object2->phi; |
3128 |
+ |
else if(variable == "electronEta") value = object1->eta; |
3129 |
+ |
else if(variable == "electronPhi") value = object1->phi; |
3130 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3131 |
+ |
else if(variable == "invMass"){ |
3132 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3133 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3134 |
+ |
value = (fourVector1 + fourVector2).M(); |
3135 |
+ |
} |
3136 |
+ |
else if(variable == "pt"){ |
3137 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3138 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3139 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3140 |
+ |
} |
3141 |
+ |
else if(variable == "threeDAngle") |
3142 |
+ |
{ |
3143 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3144 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3145 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3146 |
+ |
} |
3147 |
+ |
else if(variable == "chargeProduct"){ |
3148 |
+ |
value = object1->charge*object2->charge; |
3149 |
+ |
} |
3150 |
+ |
|
3151 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3152 |
|
value = applyFunction(function, value); |
3153 |
|
|
3154 |
|
return value; |
3155 |
|
} |
3156 |
|
|
3157 |
+ |
//!muon-jet pair valueLookup |
3158 |
+ |
double |
3159 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3160 |
+ |
|
3161 |
+ |
double value = 0.0; |
3162 |
|
|
3163 |
< |
double |
3164 |
< |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){ |
3165 |
< |
double electronMass = 0.000511; |
3166 |
< |
double value = 0.0; |
3167 |
< |
TLorentzVector fourVector1(0, 0, 0, 0); |
2719 |
< |
TLorentzVector fourVector2(0, 0, 0, 0); |
2720 |
< |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3163 |
> |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3164 |
> |
else if(variable == "jetEta") value = object2->eta; |
3165 |
> |
else if(variable == "jetPhi") value = object2->phi; |
3166 |
> |
else if(variable == "muonEta") value = object1->eta; |
3167 |
> |
else if(variable == "muonPhi") value = object1->phi; |
3168 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3169 |
< |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3170 |
< |
else if(variable == "invMass"){ |
3171 |
< |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
3172 |
< |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
3173 |
< |
|
3174 |
< |
value = (fourVector1 + fourVector2).M(); |
3169 |
> |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3170 |
> |
else if(variable == "invMass"){ |
3171 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3172 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3173 |
> |
value = (fourVector1 + fourVector2).M(); |
3174 |
> |
} |
3175 |
> |
else if(variable == "pt"){ |
3176 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3177 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3178 |
> |
value = (fourVector1 + fourVector2).Pt(); |
3179 |
|
} |
3180 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3181 |
< |
value = applyFunction(function, value); |
3182 |
< |
return value; |
3180 |
> |
else if(variable == "threeDAngle") |
3181 |
> |
{ |
3182 |
> |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3183 |
> |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3184 |
> |
value = (threeVector1.Angle(threeVector2)); |
3185 |
> |
} |
3186 |
> |
else if(variable == "chargeProduct"){ |
3187 |
> |
value = object1->charge*object2->charge; |
3188 |
> |
} |
3189 |
> |
|
3190 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3191 |
> |
value = applyFunction(function, value); |
3192 |
> |
|
3193 |
> |
return value; |
3194 |
> |
} |
3195 |
> |
|
3196 |
> |
//!jet-jet pair valueLookup |
3197 |
> |
double |
3198 |
> |
OSUAnalysis::valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3199 |
> |
|
3200 |
> |
double value = 0.0; |
3201 |
> |
|
3202 |
> |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3203 |
> |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3204 |
> |
else if(variable == "absDeltaPt") value = fabs(object1->pt - object2->pt); |
3205 |
> |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3206 |
> |
else if(variable == "invMass"){ |
3207 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3208 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3209 |
> |
value = (fourVector1 + fourVector2).M(); |
3210 |
> |
} |
3211 |
> |
else if(variable == "pt"){ |
3212 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3213 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3214 |
> |
value = (fourVector1 + fourVector2).Pt(); |
3215 |
> |
} |
3216 |
> |
else if(variable == "threeDAngle") |
3217 |
> |
{ |
3218 |
> |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3219 |
> |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3220 |
> |
value = (threeVector1.Angle(threeVector2)); |
3221 |
> |
} |
3222 |
> |
else if(variable == "chargeProduct"){ |
3223 |
> |
value = object1->charge*object2->charge; |
3224 |
> |
} |
3225 |
> |
|
3226 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3227 |
> |
value = applyFunction(function, value); |
3228 |
> |
|
3229 |
> |
return value; |
3230 |
|
} |
3231 |
+ |
//!electron-track pair valueLookup |
3232 |
+ |
double |
3233 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3234 |
+ |
double electronMass = 0.000511; |
3235 |
+ |
double value = 0.0; |
3236 |
+ |
TLorentzVector fourVector1(0, 0, 0, 0); |
3237 |
+ |
TLorentzVector fourVector2(0, 0, 0, 0); |
3238 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3239 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3240 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3241 |
+ |
else if(variable == "invMass"){ |
3242 |
+ |
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
3243 |
+ |
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
3244 |
+ |
|
3245 |
+ |
value = (fourVector1 + fourVector2).M(); |
3246 |
+ |
} |
3247 |
+ |
else if(variable == "chargeProduct"){ |
3248 |
+ |
value = object1->charge*object2->charge; |
3249 |
+ |
} |
3250 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3251 |
+ |
value = applyFunction(function, value); |
3252 |
+ |
return value; |
3253 |
|
|
3254 |
+ |
} |
3255 |
|
|
3256 |
|
|
3257 |
+ |
//!muon-track pair valueLookup |
3258 |
|
double |
3259 |
< |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){ |
3259 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3260 |
|
double pionMass = 0.140; |
3261 |
|
double muonMass = 0.106; |
3262 |
|
double value = 0.0; |
3271 |
|
|
3272 |
|
value = (fourVector1 + fourVector2).M(); |
3273 |
|
} |
3274 |
+ |
else if(variable == "chargeProduct"){ |
3275 |
+ |
value = object1->charge*object2->charge; |
3276 |
+ |
} |
3277 |
|
|
3278 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3279 |
|
value = applyFunction(function, value); |
3280 |
|
return value; |
3281 |
|
} |
3282 |
|
|
3283 |
< |
|
3283 |
> |
//!tau-tau pair valueLookup |
3284 |
|
double |
3285 |
< |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){ |
3285 |
> |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function, string &stringValue){ |
3286 |
|
double value = 0.0; |
3287 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3288 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3293 |
|
value = (fourVector1 + fourVector2).M(); |
3294 |
|
} |
3295 |
|
|
3296 |
+ |
else if(variable == "chargeProduct"){ |
3297 |
+ |
value = object1->charge*object2->charge; |
3298 |
+ |
} |
3299 |
+ |
|
3300 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3301 |
|
value = applyFunction(function, value); |
3302 |
|
return value; |
3303 |
|
} |
3304 |
|
|
3305 |
< |
|
3305 |
> |
//!muon-tau pair valueLookup |
3306 |
|
double |
3307 |
< |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){ |
3307 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function, string &stringValue){ |
3308 |
|
double value = 0.0; |
3309 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3310 |
|
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3315 |
|
value = (fourVector1 + fourVector2).M(); |
3316 |
|
} |
3317 |
|
|
3318 |
+ |
else if(variable == "chargeProduct"){ |
3319 |
+ |
value = object1->charge*object2->charge; |
3320 |
+ |
} |
3321 |
+ |
|
3322 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3323 |
|
value = applyFunction(function, value); |
3324 |
|
return value; |
3325 |
|
} |
3326 |
|
|
3327 |
+ |
//!tau-track pair valueLookup |
3328 |
|
double |
3329 |
< |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function){ |
3329 |
> |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3330 |
|
double value = 0.0; |
3331 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3332 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3333 |
+ |
else if(variable == "chargeProduct"){ |
3334 |
+ |
value = object1->charge*object2->charge; |
3335 |
+ |
} |
3336 |
|
|
3337 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3338 |
|
value = applyFunction(function, value); |
3340 |
|
} |
3341 |
|
|
3342 |
|
|
3343 |
< |
|
3343 |
> |
//!track-event pair valueLookup |
3344 |
|
double |
3345 |
< |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){ |
3345 |
> |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function, string &stringValue){ |
3346 |
|
|
3347 |
|
double value = 0.0; |
3348 |
|
double pMag = sqrt(object1->pt * object1->pt + |
3349 |
< |
object1->pz * object1->pz); |
3349 |
> |
object1->pz * object1->pz); |
3350 |
|
|
3351 |
|
if (variable == "numPV") value = object2->numPV; |
3352 |
|
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
3353 |
|
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
3354 |
< |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
3355 |
< |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
3354 |
> |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
3355 |
> |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
3356 |
|
|
3357 |
< |
else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3357 |
> |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3358 |
|
|
3359 |
|
value = applyFunction(function, value); |
3360 |
|
|
3361 |
|
return value; |
3362 |
|
|
3363 |
< |
} |
3363 |
> |
} |
3364 |
> |
|
3365 |
> |
//!electron-trigobj pair valueLookup |
3366 |
> |
double |
3367 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){ |
3368 |
> |
|
3369 |
> |
double value = 0.0; |
3370 |
> |
|
3371 |
> |
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3372 |
> |
else if (variable == "match"){ |
3373 |
> |
if (deltaR(object1->eta,object1->phi,object2->eta,object2->phi) < 0.2 && abs(object2->id) == 11) |
3374 |
> |
stringValue = object2->filter; |
3375 |
> |
else |
3376 |
> |
stringValue = "none"; |
3377 |
> |
} |
3378 |
> |
|
3379 |
> |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3380 |
> |
|
3381 |
> |
value = applyFunction(function, value); |
3382 |
> |
|
3383 |
> |
return value; |
3384 |
> |
|
3385 |
> |
} |
3386 |
> |
|
3387 |
> |
//!muon-trigobj pair valueLookup |
3388 |
> |
double |
3389 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){ |
3390 |
> |
|
3391 |
> |
double value = 0.0; |
3392 |
> |
|
3393 |
> |
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3394 |
> |
|
3395 |
> |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3396 |
> |
|
3397 |
> |
value = applyFunction(function, value); |
3398 |
> |
|
3399 |
> |
return value; |
3400 |
> |
|
3401 |
> |
} |
3402 |
> |
|
3403 |
> |
//!stop valueLookup |
3404 |
> |
double |
3405 |
> |
OSUAnalysis::valueLookup (const BNstop* object, string variable, string function, string &stringValue){ |
3406 |
> |
|
3407 |
> |
|
3408 |
> |
double value = 0.0; |
3409 |
> |
|
3410 |
> |
if(variable == "ctau") value = object->ctau; |
3411 |
> |
|
3412 |
> |
else if (variable == "d0"){ |
3413 |
> |
double vx = object->vx - chosenVertex ()->x, |
3414 |
> |
vy = object->vy - chosenVertex ()->y, |
3415 |
> |
px = object->px, |
3416 |
> |
py = object->py, |
3417 |
> |
pt = object->pt; |
3418 |
> |
value = (-vx * py + vy * px) / pt; |
3419 |
> |
} |
3420 |
> |
|
3421 |
> |
else if (variable == "dz"){ |
3422 |
> |
double vx = object->vx - chosenVertex ()->x, |
3423 |
> |
vy = object->vy - chosenVertex ()->y, |
3424 |
> |
vz = object->vz - chosenVertex ()->z, |
3425 |
> |
px = object->px, |
3426 |
> |
py = object->py, |
3427 |
> |
pz = object->pz, |
3428 |
> |
pt = object->pt; |
3429 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3430 |
> |
} |
3431 |
> |
|
3432 |
> |
else if (variable == "minD0"){ |
3433 |
> |
double minD0=999; |
3434 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3435 |
> |
double vx = object->vx - vertex->x, |
3436 |
> |
vy = object->vy - vertex->y, |
3437 |
> |
px = object->px, |
3438 |
> |
py = object->py, |
3439 |
> |
pt = object->pt; |
3440 |
> |
value = (-vx * py + vy * px) / pt; |
3441 |
> |
if(abs(value) < abs(minD0)) minD0 = value; |
3442 |
> |
} |
3443 |
> |
value = minD0; |
3444 |
> |
} |
3445 |
> |
else if (variable == "minDz"){ |
3446 |
> |
double minDz=999; |
3447 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3448 |
> |
double vx = object->vx - vertex->x, |
3449 |
> |
vy = object->vy - vertex->y, |
3450 |
> |
vz = object->vz - vertex->z, |
3451 |
> |
px = object->px, |
3452 |
> |
py = object->py, |
3453 |
> |
pz = object->pz, |
3454 |
> |
pt = object->pt; |
3455 |
> |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3456 |
> |
if(abs(value) < abs(minDz)) minDz = value; |
3457 |
> |
} |
3458 |
> |
value = minDz; |
3459 |
> |
} |
3460 |
> |
else if(variable == "distToVertex"){ |
3461 |
> |
value = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3462 |
> |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3463 |
> |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3464 |
> |
} |
3465 |
> |
else if (variable == "minDistToVertex"){ |
3466 |
> |
double minDistToVertex=999; |
3467 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3468 |
> |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3469 |
> |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3470 |
> |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3471 |
> |
|
3472 |
> |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3473 |
> |
} |
3474 |
> |
value = minDistToVertex; |
3475 |
> |
} |
3476 |
> |
else if (variable == "distToVertexDifference"){ |
3477 |
> |
double minDistToVertex=999; |
3478 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3479 |
> |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3480 |
> |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3481 |
> |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3482 |
> |
|
3483 |
> |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3484 |
> |
} |
3485 |
> |
double distToChosenVertex = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3486 |
> |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3487 |
> |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3488 |
> |
|
3489 |
> |
value = distToChosenVertex - minDistToVertex; |
3490 |
> |
} |
3491 |
> |
|
3492 |
> |
else if (variable == "closestVertexRank"){ |
3493 |
> |
double minDistToVertex=999; |
3494 |
> |
int vertex_rank = 0; |
3495 |
> |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3496 |
> |
vertex_rank++; |
3497 |
> |
int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3498 |
> |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3499 |
> |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3500 |
> |
|
3501 |
> |
if(abs(dist) < abs(minDistToVertex)){ |
3502 |
> |
value = vertex_rank; |
3503 |
> |
minDistToVertex = dist; |
3504 |
> |
} |
3505 |
> |
} |
3506 |
> |
} |
3507 |
> |
|
3508 |
> |
|
3509 |
> |
|
3510 |
> |
|
3511 |
> |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3512 |
> |
|
3513 |
> |
value = applyFunction(function, value); |
3514 |
> |
|
3515 |
> |
return value; |
3516 |
> |
|
3517 |
> |
} |
3518 |
> |
|
3519 |
> |
|
3520 |
> |
|
3521 |
|
|
3522 |
|
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
3523 |
|
// Return true iff no other tracks are found in this cone. |
3566 |
|
|
3567 |
|
double |
3568 |
|
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
3569 |
< |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
3570 |
< |
if (!useTrackCaloRhoCorr_) return -99; |
3571 |
< |
// if (!rhokt6CaloJetsHandle_) { |
3572 |
< |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
3573 |
< |
// return -99; |
3569 |
> |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
3570 |
> |
if (!useTrackCaloRhoCorr_) return -99; |
3571 |
> |
// if (!rhokt6CaloJetsHandle_) { |
3572 |
> |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
3573 |
> |
// return -99; |
3574 |
|
// } |
3575 |
< |
double radDeltaRCone = 0.5; |
3576 |
< |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
3577 |
< |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
3578 |
< |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
3579 |
< |
return caloTotRhoCorrCalo; |
3580 |
< |
|
3575 |
> |
double radDeltaRCone = 0.5; |
3576 |
> |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
3577 |
> |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
3578 |
> |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
3579 |
> |
return caloTotRhoCorrCalo; |
3580 |
> |
|
3581 |
|
} |
3582 |
|
|
3583 |
|
|
3615 |
|
double deltaRLowest = 999; |
3616 |
|
int value = 0; |
3617 |
|
if (DeadEcalVec.size() == 0) WriteDeadEcal(); |
3618 |
< |
for(std::vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
3618 |
> |
for(vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
3619 |
|
double eta = ecal->etaEcal; |
3620 |
|
double phi = ecal->phiEcal; |
3621 |
< |
double deltaRtemp = deltaR(eta, track1->eta, phi, track1->phi); |
3621 |
> |
double deltaRtemp = deltaR(eta, phi, track1->eta, track1->phi); |
3622 |
|
if(deltaRtemp < deltaRLowest) deltaRLowest = deltaRtemp; |
3623 |
|
} |
3624 |
|
if (deltaRLowest<0.05) {value = 1;} |
3626 |
|
return value; |
3627 |
|
} |
3628 |
|
|
3629 |
< |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
3629 |
> |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
3630 |
|
template <class InputObject> |
3631 |
|
double OSUAnalysis::getGenDeltaRLowest(InputObject object){ |
3632 |
|
double genDeltaRLowest = 999.; |
3646 |
|
else if(function == "log") value = log10(value); |
3647 |
|
|
3648 |
|
else if(function == "") value = value; |
3649 |
< |
else{std::cout << "WARNING: invalid function '" << function << "'\n";} |
3649 |
> |
else{cout << "WARNING: invalid function '" << function << "'\n";} |
3650 |
|
|
3651 |
|
return value; |
3652 |
|
|
3655 |
|
|
3656 |
|
template <class InputCollection> |
3657 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
3658 |
< |
|
3659 |
< |
if (currentCut.inputCollection.find("pair")!=std::string::npos) { |
3660 |
< |
string obj1, obj2; |
3658 |
> |
|
3659 |
> |
if (currentCut.inputCollection.find("pair")!=string::npos) { |
3660 |
> |
string obj1, obj2; |
3661 |
|
getTwoObjs(currentCut.inputCollection, obj1, obj2); |
3662 |
|
if (inputType==obj1 || |
3663 |
< |
inputType==obj2) { |
3663 |
> |
inputType==obj2) { |
3664 |
|
// Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection, |
3665 |
< |
// and the inputType is a member of the pair. |
3666 |
< |
// The cut will instead be applied when the setObjectFlags() is called for the paired collection. |
3667 |
< |
// For example, if currentCut.inputCollection==electron-muon pairs, |
3668 |
< |
// then the flags should not be set here when inputType==muons or inputType==electrons. |
3669 |
< |
return; |
3670 |
< |
} |
3671 |
< |
} |
3665 |
> |
// and the inputType is a member of the pair. |
3666 |
> |
// The cut will instead be applied when the setObjectFlags() is called for the paired collection. |
3667 |
> |
// For example, if currentCut.inputCollection==electron-muon pairs, |
3668 |
> |
// then the flags should not be set here when inputType==muons or inputType==electrons. |
3669 |
> |
return; |
3670 |
> |
} |
3671 |
> |
} |
3672 |
|
|
3673 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
3674 |
|
|
3678 |
|
|
3679 |
|
vector<bool> subcutDecisions; |
3680 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
3681 |
< |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
3682 |
< |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3681 |
> |
string stringValue = ""; |
3682 |
> |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
3683 |
> |
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3684 |
> |
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
3685 |
|
|
3686 |
|
} |
3687 |
|
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
3720 |
|
bool sameObjects = false; |
3721 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3722 |
|
|
3723 |
< |
// Get the strings for the two objects that make up the pair. |
3724 |
< |
string obj1Type, obj2Type; |
3723 |
> |
// Get the strings for the two objects that make up the pair. |
3724 |
> |
string obj1Type, obj2Type; |
3725 |
|
getTwoObjs(inputType, obj1Type, obj2Type); |
3726 |
|
bool isTwoTypesOfObject = true; |
3727 |
< |
if (obj1Type==obj2Type) isTwoTypesOfObject = false; |
3727 |
> |
if (obj1Type==obj2Type) isTwoTypesOfObject = false; |
3728 |
|
|
3729 |
< |
// Initialize the flags for individual objects to all be false, if the cut is on the pair. |
3730 |
< |
// Set them to true later, if any paired object passes (in which case both of its constituents should pass). |
3731 |
< |
if (currentCut.inputCollection == inputType) { |
3729 |
> |
// Initialize the flags for individual objects to all be false, if the cut is on the pair. |
3730 |
> |
// Set them to true later, if any paired object passes (in which case both of its constituents should pass). |
3731 |
> |
if (currentCut.inputCollection == inputType) { |
3732 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++) { |
3733 |
< |
individualFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3733 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3734 |
|
cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3735 |
|
} |
3736 |
< |
if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first. |
3736 |
> |
if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first. |
3737 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++) { |
3738 |
< |
individualFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3739 |
< |
cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3738 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3739 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3740 |
|
} |
3741 |
|
} |
3742 |
|
} |
3743 |
< |
|
3743 |
> |
|
3744 |
|
int counter = 0; |
3745 |
|
|
3746 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3755 |
|
|
3756 |
|
vector<bool> subcutDecisions; |
3757 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
3758 |
< |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
3759 |
< |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3758 |
> |
string stringValue = ""; |
3759 |
> |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
3760 |
> |
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3761 |
> |
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
3762 |
|
} |
3763 |
|
|
3764 |
|
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
3773 |
|
decision = tempDecision; |
3774 |
|
} |
3775 |
|
} |
3776 |
< |
// if (decision) isPassObj1.at(object1) = true; |
3777 |
< |
// if (decision) isPassObj2.at(object2) = true; |
3778 |
< |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3779 |
< |
if (decision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3780 |
< |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true; |
3781 |
< |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true; |
3782 |
< |
} |
3776 |
> |
// if (decision) isPassObj1.at(object1) = true; |
3777 |
> |
// if (decision) isPassObj2.at(object2) = true; |
3778 |
> |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3779 |
> |
if (decision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3780 |
> |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true; |
3781 |
> |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true; |
3782 |
> |
} |
3783 |
|
|
3784 |
|
//set flags for objects that pass each cut AND all the previous cuts |
3785 |
|
bool previousCumulativeFlag = true; |
3794 |
|
else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1); |
3795 |
|
else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2); |
3796 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag); |
3797 |
< |
if (currentCumulativeFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3798 |
< |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1); |
3799 |
< |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2); |
3797 |
> |
if (currentCumulativeFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3798 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1); |
3799 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2); |
3800 |
|
} |
3801 |
|
counter++; |
3802 |
|
|
3803 |
< |
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3804 |
< |
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3803 |
> |
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++) |
3804 |
> |
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++) |
3805 |
|
|
3806 |
|
} |
3807 |
|
|
3808 |
|
|
3809 |
|
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1) { |
3810 |
< |
// Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for |
3811 |
< |
// all cuts up to currentCutIndex |
3812 |
< |
bool previousCumulativeFlag = true; |
3813 |
< |
for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) { |
3810 |
> |
// Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for |
3811 |
> |
// all cuts up to currentCutIndex |
3812 |
> |
bool previousCumulativeFlag = true; |
3813 |
> |
for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) { |
3814 |
|
if (previousCumulativeFlag && individualFlags.at(obj1Type).at(previousCutIndex).at(object1)) previousCumulativeFlag = true; |
3815 |
< |
else { |
3816 |
< |
previousCumulativeFlag = false; break; |
3815 |
> |
else { |
3816 |
> |
previousCumulativeFlag = false; break; |
3817 |
|
} |
3818 |
|
} |
3819 |
< |
return previousCumulativeFlag; |
3820 |
< |
} |
3819 |
> |
return previousCumulativeFlag; |
3820 |
> |
} |
3821 |
> |
|
3822 |
> |
|
3823 |
> |
|
3824 |
> |
template <class InputCollection> |
3825 |
> |
void OSUAnalysis::assignTreeBranch(BranchSpecs parameters, InputCollection inputCollection, vector<bool> flags){ |
3826 |
> |
// This function is similar to fill1DHistogram(), but instead of filling a histogram it assigns a value to a variable for the BNTree |
3827 |
> |
|
3828 |
> |
if (BNTreeBranchVals_.count(parameters.name)==0) cout << "Error[assignTreeBranch]: trying to assign value to " << parameters.name << " that does not have a branch set up. Will likely seg fault." << endl; |
3829 |
> |
for (uint object = 0; object != inputCollection->size(); object++) { |
3830 |
> |
|
3831 |
> |
if (!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
3832 |
> |
|
3833 |
> |
string inputVariable = parameters.inputVariable; |
3834 |
> |
string function = ""; |
3835 |
> |
string stringValue = ""; |
3836 |
> |
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3837 |
> |
BNTreeBranchVals_.at(parameters.name).push_back(value); |
3838 |
> |
|
3839 |
> |
} |
3840 |
> |
} |
3841 |
|
|
3842 |
|
|
3843 |
|
template <class InputCollection> |
3850 |
|
string currentString = parameters.inputVariables.at(0); |
3851 |
|
string inputVariable = ""; |
3852 |
|
string function = ""; |
3853 |
< |
if(currentString.find("(")==std::string::npos){ |
3853 |
> |
if(currentString.find("(")==string::npos){ |
3854 |
|
inputVariable = currentString;// variable to cut on |
3855 |
|
} |
3856 |
|
else{ |
3857 |
|
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3858 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3859 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3860 |
< |
} |
3860 |
> |
} |
3861 |
|
|
3862 |
< |
double value = valueLookup(&inputCollection->at(object), inputVariable, function); |
3863 |
< |
histo->Fill(value,scaleFactor); |
3862 |
> |
string stringValue = ""; |
3863 |
> |
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3864 |
> |
histo->Fill(value,scaleFactor); |
3865 |
|
|
3866 |
|
if (printEventInfo_) { |
3867 |
< |
// Write information about event to screen, for testing purposes. |
3868 |
< |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
3867 |
> |
// Write information about event to screen, for testing purposes. |
3868 |
> |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
3869 |
|
} |
3870 |
< |
|
3870 |
> |
|
3871 |
|
} |
3872 |
|
} |
3873 |
|
|
3892 |
|
string currentString = parameters.inputVariables.at(0); |
3893 |
|
string inputVariable = ""; |
3894 |
|
string function = ""; |
3895 |
< |
if(currentString.find("(")==std::string::npos){ |
3895 |
> |
if(currentString.find("(")==string::npos){ |
3896 |
|
inputVariable = currentString;// variable to cut on |
3897 |
|
} |
3898 |
|
else{ |
3901 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3902 |
|
} |
3903 |
|
|
3904 |
< |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3904 |
> |
string stringValue = ""; |
3905 |
> |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
3906 |
|
histo->Fill(value,scaleFactor); |
3907 |
|
|
3908 |
|
} |
3918 |
|
|
3919 |
|
if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
3920 |
|
|
3921 |
+ |
string stringValue = ""; |
3922 |
|
string currentString = parameters.inputVariables.at(0); |
3923 |
|
string inputVariable = ""; |
3924 |
|
string function = ""; |
3925 |
< |
if(currentString.find("(")==std::string::npos){ |
3925 |
> |
if(currentString.find("(")==string::npos){ |
3926 |
|
inputVariable = currentString;// variable to cut on |
3927 |
|
} |
3928 |
|
else{ |
3930 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3931 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3932 |
|
} |
3933 |
< |
double valueX = valueLookup(&inputCollection->at(object), inputVariable, function); |
3933 |
> |
double valueX = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3934 |
|
|
3935 |
|
currentString = parameters.inputVariables.at(1); |
3936 |
|
inputVariable = ""; |
3937 |
|
function = ""; |
3938 |
< |
if(currentString.find("(")==std::string::npos){ |
3938 |
> |
if(currentString.find("(")==string::npos){ |
3939 |
|
inputVariable = currentString;// variable to cut on |
3940 |
|
} |
3941 |
|
else{ |
3944 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3945 |
|
} |
3946 |
|
|
3947 |
< |
double valueY = valueLookup(&inputCollection->at(object), inputVariable, function); |
3947 |
> |
double valueY = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3948 |
|
|
3949 |
|
histo->Fill(valueX,valueY,scaleFactor); |
3950 |
|
|
3971 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3972 |
|
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue; |
3973 |
|
|
3974 |
+ |
string stringValue = ""; |
3975 |
|
string currentString = parameters.inputVariables.at(0); |
3976 |
|
string inputVariable = ""; |
3977 |
|
string function = ""; |
3978 |
< |
if(currentString.find("(")==std::string::npos){ |
3978 |
> |
if(currentString.find("(")==string::npos){ |
3979 |
|
inputVariable = currentString;// variable to cut on |
3980 |
|
} |
3981 |
|
else{ |
3983 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3984 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3985 |
|
} |
3986 |
< |
double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3986 |
> |
double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
3987 |
|
|
3988 |
|
currentString = parameters.inputVariables.at(1); |
3989 |
|
inputVariable = ""; |
3990 |
|
function = ""; |
3991 |
< |
if(currentString.find("(")==std::string::npos){ |
3991 |
> |
if(currentString.find("(")==string::npos){ |
3992 |
|
inputVariable = currentString;// variable to cut on |
3993 |
|
} |
3994 |
|
else{ |
3996 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3997 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3998 |
|
} |
3999 |
< |
double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3999 |
> |
double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
4000 |
|
|
4001 |
|
|
4002 |
|
histo->Fill(valueX,valueY,scaleFactor); |
4017 |
|
|
4018 |
|
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
4019 |
|
if(currentDeltaR > 0.05) continue; |
4020 |
< |
// cout << std::setprecision(3) << std::setw(20) |
4020 |
> |
// cout << setprecision(3) << setw(20) |
4021 |
|
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
4022 |
< |
// << std::setw(20) |
4022 |
> |
// << setw(20) |
4023 |
|
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
4024 |
< |
// << std::setw(20) |
4024 |
> |
// << setw(20) |
4025 |
|
// << "\tdeltaR = " << currentDeltaR |
4026 |
< |
// << std::setprecision(1) |
4027 |
< |
// << std::setw(20) |
4026 |
> |
// << setprecision(1) |
4027 |
> |
// << setw(20) |
4028 |
|
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
4029 |
< |
// << std::setw(20) |
4029 |
> |
// << setw(20) |
4030 |
|
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
4031 |
< |
// << std::setw(20) |
4031 |
> |
// << setw(20) |
4032 |
|
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
4033 |
|
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
4034 |
|
bestMatchIndex = mcparticle - mcparticles->begin(); |
4091 |
|
// 20 strange baryon |
4092 |
|
// 21 charm baryon |
4093 |
|
// 22 bottom baryon |
4094 |
< |
// 23 other |
4094 |
> |
// 23 QCD string |
4095 |
> |
// 24 other |
4096 |
|
|
4097 |
|
int OSUAnalysis::getPdgIdBinValue(int pdgId){ |
4098 |
|
|
4116 |
|
else if(absPdgId > 3000 && absPdgId < 4000 ) binValue = 20; |
4117 |
|
else if(absPdgId > 4000 && absPdgId < 5000 ) binValue = 21; |
4118 |
|
else if(absPdgId > 5000 && absPdgId < 6000 ) binValue = 22; |
4119 |
+ |
else if(absPdgId == 92 ) binValue = 23; |
4120 |
|
|
4121 |
< |
else binValue = 23; |
4121 |
> |
else binValue = 24; |
4122 |
|
|
4123 |
|
return binValue; |
4124 |
|
|
4128 |
|
OSUAnalysis::chosenVertex () |
4129 |
|
{ |
4130 |
|
const BNprimaryvertex *chosenVertex = 0; |
4131 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
4132 |
< |
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() : |
4133 |
< |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
4131 |
> |
if(cumulativeFlags.find ("primaryvertexs") != cumulativeFlags.end ()){ |
4132 |
> |
vector<bool> vertexFlags; |
4133 |
> |
for (int i = cumulativeFlags.at("primaryvertexs").size() - 1; i >= 0; i--){ |
4134 |
> |
if (cumulativeFlags.at("primaryvertexs").at(i).size()){ |
4135 |
> |
vertexFlags = cumulativeFlags.at("primaryvertexs").at(i); |
4136 |
> |
break; |
4137 |
> |
} |
4138 |
> |
} |
4139 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
4140 |
|
if(!vertexFlags.at(vertexIndex)) continue; |
4141 |
|
chosenVertex = & primaryvertexs->at(vertexIndex); |
4142 |
|
break; |
4143 |
|
} |
4144 |
|
} |
4145 |
< |
else { |
4146 |
< |
chosenVertex = &primaryvertexs->at(0); |
3418 |
< |
} |
4145 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "primaryvertexs") != objectsToGet.end ()) |
4146 |
> |
chosenVertex = & primaryvertexs->at (0); |
4147 |
|
|
4148 |
|
return chosenVertex; |
4149 |
|
} |
4152 |
|
OSUAnalysis::chosenMET () |
4153 |
|
{ |
4154 |
|
const BNmet *chosenMET = 0; |
4155 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
4156 |
< |
vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() : |
4157 |
< |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
4155 |
> |
if(cumulativeFlags.find ("mets") != cumulativeFlags.end ()){ |
4156 |
> |
vector<bool> metFlags; |
4157 |
> |
for (int i = cumulativeFlags.at("mets").size() - 1; i >= 0; i--){ |
4158 |
> |
if (cumulativeFlags.at("mets").at(i).size()){ |
4159 |
> |
metFlags = cumulativeFlags.at("mets").at(i); |
4160 |
> |
break; |
4161 |
> |
} |
4162 |
> |
} |
4163 |
|
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
4164 |
|
if(!metFlags.at(metIndex)) continue; |
4165 |
|
chosenMET = & mets->at(metIndex); |
4166 |
|
break; |
4167 |
|
} |
4168 |
|
} |
4169 |
< |
else { |
4170 |
< |
chosenMET = &mets->at(0); |
3438 |
< |
} |
4169 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "mets") != objectsToGet.end ()) |
4170 |
> |
chosenMET = & mets->at (0); |
4171 |
|
|
4172 |
|
return chosenMET; |
4173 |
|
} |
4176 |
|
OSUAnalysis::chosenElectron () |
4177 |
|
{ |
4178 |
|
const BNelectron *chosenElectron = 0; |
4179 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
4180 |
< |
vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() : |
4181 |
< |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
4179 |
> |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
4180 |
> |
vector<bool> electronFlags; |
4181 |
> |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
4182 |
> |
if (cumulativeFlags.at("electrons").at(i).size()){ |
4183 |
> |
electronFlags = cumulativeFlags.at("electrons").at(i); |
4184 |
> |
break; |
4185 |
> |
} |
4186 |
> |
} |
4187 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
4188 |
|
if(!electronFlags.at(electronIndex)) continue; |
4189 |
|
chosenElectron = & electrons->at(electronIndex); |
4190 |
|
break; |
4191 |
|
} |
4192 |
|
} |
4193 |
< |
else { |
4194 |
< |
chosenElectron = &electrons->at(0); |
3458 |
< |
} |
4193 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "electrons") != objectsToGet.end ()) |
4194 |
> |
chosenElectron = & electrons->at (0); |
4195 |
|
|
4196 |
|
return chosenElectron; |
4197 |
|
} |
4200 |
|
OSUAnalysis::chosenMuon () |
4201 |
|
{ |
4202 |
|
const BNmuon *chosenMuon = 0; |
4203 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
4204 |
< |
vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() : |
4205 |
< |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
4203 |
> |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
4204 |
> |
vector<bool> muonFlags; |
4205 |
> |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
4206 |
> |
if (cumulativeFlags.at("muons").at(i).size()){ |
4207 |
> |
muonFlags = cumulativeFlags.at("muons").at(i); |
4208 |
> |
break; |
4209 |
> |
} |
4210 |
> |
} |
4211 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
4212 |
|
if(!muonFlags.at(muonIndex)) continue; |
4213 |
|
chosenMuon = & muons->at(muonIndex); |
4214 |
|
break; |
4215 |
|
} |
4216 |
|
} |
4217 |
< |
else { |
4218 |
< |
chosenMuon = &muons->at(0); |
3478 |
< |
} |
4217 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "muons") != objectsToGet.end ()) |
4218 |
> |
chosenMuon = & muons->at (0); |
4219 |
|
|
4220 |
|
return chosenMuon; |
4221 |
|
} |
4222 |
|
|
3483 |
– |
|
4223 |
|
DEFINE_FWK_MODULE(OSUAnalysis); |