11 |
|
tracks_ (cfg.getParameter<edm::InputTag> ("tracks")), |
12 |
|
genjets_ (cfg.getParameter<edm::InputTag> ("genjets")), |
13 |
|
mcparticles_ (cfg.getParameter<edm::InputTag> ("mcparticles")), |
14 |
+ |
stops_ (cfg.getParameter<edm::InputTag> ("stops")), |
15 |
|
primaryvertexs_ (cfg.getParameter<edm::InputTag> ("primaryvertexs")), |
16 |
|
bxlumis_ (cfg.getParameter<edm::InputTag> ("bxlumis")), |
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 |
< |
|
23 |
< |
muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")), |
24 |
< |
dataPU_ (cfg.getParameter<std::string> ("dataPU")), |
25 |
< |
electronSFID_ (cfg.getParameter<std::string> ("electronSFID")), |
26 |
< |
muonSF_ (cfg.getParameter<std::string> ("muonSF")), |
27 |
< |
dataset_ (cfg.getParameter<std::string> ("dataset")), |
28 |
< |
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 |
> |
printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")), |
36 |
> |
useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")), |
37 |
> |
stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau")), |
38 |
> |
GetPlotsAfterEachCut_ (cfg.getParameter<bool> ("GetPlotsAfterEachCut")) |
39 |
|
{ |
40 |
|
|
41 |
|
TH1::SetDefaultSumw2 (); |
43 |
|
//create pile-up reweighting object, if necessary |
44 |
|
if(datasetType_ != "data") { |
45 |
|
if(doPileupReweighting_) puWeight_ = new PUWeight (puFile_, dataPU_, dataset_); |
46 |
< |
// muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
47 |
< |
// electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
46 |
> |
if (applyLeptonSF_){ |
47 |
> |
muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_); |
48 |
> |
electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_); |
49 |
> |
} |
50 |
|
} |
51 |
+ |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
52 |
+ |
stopCTauWeight_ = new StopCTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_); |
53 |
|
|
54 |
|
|
55 |
|
// Construct Cutflow Objects. These store the results of cut decisions and |
56 |
|
// handle filling cut flow histograms. |
57 |
|
masterCutFlow_ = new CutFlow (fs_); |
48 |
– |
std::vector<TFileDirectory> directories; |
58 |
|
|
59 |
|
//always get vertex collection so we can assign the primary vertex in the event |
60 |
|
objectsToGet.push_back("primaryvertexs"); |
52 |
– |
|
53 |
– |
//always make the plot of number of primary verticex (to check pile-up reweighting) |
61 |
|
objectsToPlot.push_back("primaryvertexs"); |
62 |
+ |
objectsToCut.push_back("primaryvertexs"); |
63 |
+ |
|
64 |
|
|
65 |
|
//always get the MC particles to do GEN-matching |
66 |
|
objectsToGet.push_back("mcparticles"); |
68 |
|
//always get the event collection to do pile-up reweighting |
69 |
|
objectsToGet.push_back("events"); |
70 |
|
|
71 |
+ |
|
72 |
+ |
// Parse the tree variable definitions. |
73 |
+ |
for (uint iBranchSet = 0; iBranchSet<treeBranchSets_.size(); iBranchSet++) { |
74 |
+ |
string tempInputCollection = treeBranchSets_.at(iBranchSet).getParameter<string> ("inputCollection"); |
75 |
+ |
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; } |
76 |
+ |
objectsToGet.push_back(tempInputCollection); |
77 |
+ |
objectsToCut.push_back(tempInputCollection); |
78 |
+ |
|
79 |
+ |
vector<string> branchList(treeBranchSets_.at(iBranchSet).getParameter<vector<string> >("branches")); |
80 |
+ |
|
81 |
+ |
for (uint iBranch = 0; iBranch<branchList.size(); iBranch++) { |
82 |
+ |
BranchSpecs br; |
83 |
+ |
br.inputCollection = tempInputCollection; |
84 |
+ |
br.inputVariable = branchList.at(iBranch); |
85 |
+ |
TString newName = TString(br.inputCollection) + "_" + TString(br.inputVariable); |
86 |
+ |
br.name = string(newName.Data()); |
87 |
+ |
treeBranches_.push_back(br); |
88 |
+ |
} |
89 |
+ |
|
90 |
+ |
} // end for (uint iBranchSet = 0; iBranchSet<treeBranchSets_.size(); iBranchSet++) { |
91 |
+ |
|
92 |
+ |
|
93 |
|
//parse the histogram definitions |
94 |
|
for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){ |
95 |
|
|
96 |
|
string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection"); |
97 |
|
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
98 |
< |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
99 |
< |
objectsToGet.push_back(tempInputCollection); |
98 |
> |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
99 |
> |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
100 |
> |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
101 |
> |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
102 |
> |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
103 |
> |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
104 |
> |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
105 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
106 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
107 |
> |
int spaceIndex = tempInputCollection.find(" "); |
108 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
109 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
110 |
> |
} |
111 |
> |
else{ |
112 |
> |
objectsToGet.push_back(tempInputCollection); |
113 |
> |
} |
114 |
|
objectsToPlot.push_back(tempInputCollection); |
115 |
|
objectsToCut.push_back(tempInputCollection); |
116 |
< |
} |
117 |
< |
else{//pair of objects, need to add them both to the things to objectsToGet |
118 |
< |
int dashIndex = tempInputCollection.find("-"); |
119 |
< |
int spaceIndex = tempInputCollection.find(" "); |
120 |
< |
int secondWordLength = spaceIndex - dashIndex; |
76 |
< |
objectsToGet.push_back(tempInputCollection); |
77 |
< |
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
78 |
< |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
79 |
< |
objectsToPlot.push_back(tempInputCollection); |
80 |
< |
objectsToPlot.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
81 |
< |
objectsToPlot.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
116 |
> |
} else { //pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut |
117 |
> |
string obj1; |
118 |
> |
string obj2; |
119 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
120 |
> |
string obj2ToGet = getObjToGet(obj2); |
121 |
|
objectsToCut.push_back(tempInputCollection); |
122 |
< |
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
123 |
< |
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
122 |
> |
objectsToCut.push_back(obj1); |
123 |
> |
objectsToCut.push_back(obj2); |
124 |
> |
objectsToPlot.push_back(tempInputCollection); |
125 |
> |
objectsToPlot.push_back(obj1); |
126 |
> |
objectsToPlot.push_back(obj2); |
127 |
> |
objectsToGet.push_back(tempInputCollection); |
128 |
> |
objectsToGet.push_back(obj1); |
129 |
> |
objectsToGet.push_back(obj2ToGet); |
130 |
> |
} // end else |
131 |
> |
|
132 |
|
|
86 |
– |
} |
133 |
|
|
134 |
|
vector<edm::ParameterSet> histogramList_ (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms")); |
135 |
|
|
136 |
|
for(uint currentHistogram = 0; currentHistogram != histogramList_.size(); currentHistogram++){ |
137 |
|
|
138 |
+ |
vector<double> defaultValue; |
139 |
+ |
defaultValue.push_back (-1.0); |
140 |
+ |
|
141 |
|
histogram tempHistogram; |
142 |
|
tempHistogram.inputCollection = tempInputCollection; |
143 |
|
tempHistogram.name = histogramList_.at(currentHistogram).getParameter<string>("name"); |
144 |
|
tempHistogram.title = histogramList_.at(currentHistogram).getParameter<string>("title"); |
145 |
< |
tempHistogram.bins = histogramList_.at(currentHistogram).getParameter<vector<double> >("bins"); |
145 |
> |
tempHistogram.bins = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("bins", defaultValue); |
146 |
> |
tempHistogram.variableBinsX = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsX", defaultValue); |
147 |
> |
tempHistogram.variableBinsY = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsY", defaultValue); |
148 |
|
tempHistogram.inputVariables = histogramList_.at(currentHistogram).getParameter<vector<string> >("inputVariables"); |
149 |
|
|
150 |
|
histograms.push_back(tempHistogram); |
151 |
|
|
152 |
|
} |
153 |
< |
} |
153 |
> |
} // for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++){ |
154 |
> |
|
155 |
|
//make unique vector of objects we need to plot (so we can book a histogram with the number of each object) |
156 |
|
sort( objectsToPlot.begin(), objectsToPlot.end() ); |
157 |
|
objectsToPlot.erase( unique( objectsToPlot.begin(), objectsToPlot.end() ), objectsToPlot.end() ); |
162 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
163 |
|
|
164 |
|
string currentObject = objectsToPlot.at(currentObjectIndex); |
165 |
< |
if(currentObject != "muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
165 |
> |
if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue; |
166 |
|
|
167 |
|
histogram tempIdHisto; |
168 |
|
histogram tempMomIdHisto; |
169 |
|
histogram tempGmaIdHisto; |
170 |
|
histogram tempIdVsMomIdHisto; |
171 |
+ |
histogram tempIdVsGmaIdHisto; |
172 |
|
|
173 |
|
tempIdHisto.inputCollection = currentObject; |
174 |
|
tempMomIdHisto.inputCollection = currentObject; |
175 |
|
tempGmaIdHisto.inputCollection = currentObject; |
176 |
|
tempIdVsMomIdHisto.inputCollection = currentObject; |
177 |
+ |
tempIdVsGmaIdHisto.inputCollection = currentObject; |
178 |
+ |
|
179 |
+ |
if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
180 |
+ |
if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
181 |
|
|
182 |
|
currentObject = currentObject.substr(0, currentObject.size()-1); |
183 |
|
tempIdHisto.name = currentObject+"GenMatchId"; |
184 |
|
tempMomIdHisto.name = currentObject+"GenMatchMotherId"; |
185 |
|
tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId"; |
186 |
|
tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId"; |
187 |
+ |
tempIdVsGmaIdHisto.name = currentObject+"GenMatchIdVsGrandmotherId"; |
188 |
|
|
189 |
|
currentObject.at(0) = toupper(currentObject.at(0)); |
190 |
|
tempIdHisto.title = currentObject+" Gen-matched Particle"; |
191 |
|
tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother"; |
192 |
|
tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother"; |
193 |
|
tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother"; |
194 |
+ |
tempIdVsGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother vs. Particle;Particle;Grandmother"; |
195 |
|
|
196 |
< |
int maxNum = 24; |
196 |
> |
|
197 |
> |
int maxNum = 25; |
198 |
|
vector<double> binVector; |
199 |
|
binVector.push_back(maxNum); |
200 |
|
binVector.push_back(0); |
212 |
|
tempIdVsMomIdHisto.bins = binVector; |
213 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId"); |
214 |
|
tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse"); |
215 |
+ |
tempIdVsGmaIdHisto.bins = binVector; |
216 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedId"); |
217 |
+ |
tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherIdReverse"); |
218 |
|
|
219 |
|
histograms.push_back(tempIdHisto); |
220 |
|
histograms.push_back(tempMomIdHisto); |
221 |
|
histograms.push_back(tempGmaIdHisto); |
222 |
|
histograms.push_back(tempIdVsMomIdHisto); |
223 |
+ |
histograms.push_back(tempIdVsGmaIdHisto); |
224 |
|
} |
225 |
|
|
226 |
|
|
236 |
|
//set triggers for this channel |
237 |
|
vector<string> triggerNames; |
238 |
|
triggerNames.clear(); |
239 |
+ |
vector<string> triggerToVetoNames; |
240 |
+ |
triggerToVetoNames.clear(); |
241 |
+ |
|
242 |
|
tempChannel.triggers.clear(); |
243 |
+ |
tempChannel.triggersToVeto.clear(); |
244 |
|
if(channels_.at(currentChannel).exists("triggers")){ |
245 |
|
triggerNames = channels_.at(currentChannel).getParameter<vector<string> >("triggers"); |
246 |
|
for(uint trigger = 0; trigger!= triggerNames.size(); trigger++) |
247 |
|
tempChannel.triggers.push_back(triggerNames.at(trigger)); |
248 |
|
objectsToGet.push_back("triggers"); |
249 |
|
} |
250 |
< |
|
250 |
> |
if(channels_.at(currentChannel).exists("triggersToVeto")){ |
251 |
> |
triggerToVetoNames = channels_.at(currentChannel).getParameter<vector<string> >("triggersToVeto"); |
252 |
> |
for(uint trigger = 0; trigger!= triggerToVetoNames.size(); trigger++) |
253 |
> |
tempChannel.triggersToVeto.push_back(triggerToVetoNames.at(trigger)); |
254 |
> |
objectsToGet.push_back("triggers"); |
255 |
> |
} |
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
//create cutFlow for this channel |
260 |
|
cutFlows_.push_back (new CutFlow (fs_, channelName)); |
261 |
< |
|
262 |
< |
//book a directory in the output file with the name of the channel |
190 |
< |
TFileDirectory subDir = fs_->mkdir( channelName ); |
191 |
< |
directories.push_back(subDir); |
192 |
< |
|
193 |
< |
std::map<std::string, TH1D*> oneDhistoMap; |
194 |
< |
oneDHists_.push_back(oneDhistoMap); |
195 |
< |
std::map<std::string, TH2D*> twoDhistoMap; |
196 |
< |
twoDHists_.push_back(twoDhistoMap); |
197 |
< |
|
198 |
< |
|
199 |
< |
|
200 |
< |
//book all histograms included in the configuration |
201 |
< |
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
202 |
< |
histogram currentHistogram = histograms.at(currentHistogramIndex); |
203 |
< |
int numBinsElements = currentHistogram.bins.size(); |
204 |
< |
int numInputVariables = currentHistogram.inputVariables.size(); |
205 |
< |
|
206 |
< |
if(numBinsElements != 3 && numBinsElements !=6) { |
207 |
< |
std::cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
208 |
< |
exit(0); |
209 |
< |
} |
210 |
< |
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
211 |
< |
std::cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
212 |
< |
exit(0); |
213 |
< |
} |
214 |
< |
else if(numBinsElements == 3){ |
215 |
< |
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)); |
216 |
< |
} |
217 |
< |
else if(numBinsElements == 6){ |
218 |
< |
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)); |
219 |
< |
|
220 |
< |
} |
221 |
< |
|
222 |
< |
|
223 |
< |
if(currentHistogram.name.find("GenMatch")==std::string::npos) continue; |
224 |
< |
|
225 |
< |
// bin particle type |
226 |
< |
// --- ------------- |
227 |
< |
// 0 unmatched |
228 |
< |
// 1 u |
229 |
< |
// 2 d |
230 |
< |
// 3 s |
231 |
< |
// 4 c |
232 |
< |
// 5 b |
233 |
< |
// 6 t |
234 |
< |
// 7 e |
235 |
< |
// 8 mu |
236 |
< |
// 9 tau |
237 |
< |
// 10 nu |
238 |
< |
// 11 g |
239 |
< |
// 12 gamma |
240 |
< |
// 13 Z |
241 |
< |
// 14 W |
242 |
< |
// 15 light meson |
243 |
< |
// 16 K meson |
244 |
< |
// 17 D meson |
245 |
< |
// 18 B meson |
246 |
< |
// 19 light baryon |
247 |
< |
// 20 strange baryon |
248 |
< |
// 21 charm baryon |
249 |
< |
// 22 bottom baryon |
250 |
< |
// 23 other |
251 |
< |
|
252 |
< |
vector<TString> labelArray; |
253 |
< |
labelArray.push_back("unmatched"); |
254 |
< |
labelArray.push_back("u"); |
255 |
< |
labelArray.push_back("d"); |
256 |
< |
labelArray.push_back("s"); |
257 |
< |
labelArray.push_back("c"); |
258 |
< |
labelArray.push_back("b"); |
259 |
< |
labelArray.push_back("t"); |
260 |
< |
labelArray.push_back("e"); |
261 |
< |
labelArray.push_back("#mu"); |
262 |
< |
labelArray.push_back("#tau"); |
263 |
< |
labelArray.push_back("#nu"); |
264 |
< |
labelArray.push_back("g"); |
265 |
< |
labelArray.push_back("#gamma"); |
266 |
< |
labelArray.push_back("Z"); |
267 |
< |
labelArray.push_back("W"); |
268 |
< |
labelArray.push_back("light meson"); |
269 |
< |
labelArray.push_back("K meson"); |
270 |
< |
labelArray.push_back("D meson"); |
271 |
< |
labelArray.push_back("B meson"); |
272 |
< |
labelArray.push_back("light baryon"); |
273 |
< |
labelArray.push_back("strange baryon"); |
274 |
< |
labelArray.push_back("charm baryon"); |
275 |
< |
labelArray.push_back("bottom baryon"); |
276 |
< |
labelArray.push_back("other"); |
277 |
< |
|
278 |
< |
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
279 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) { |
280 |
< |
oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
281 |
< |
} |
282 |
< |
else { |
283 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
284 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
285 |
< |
} |
286 |
< |
} |
287 |
< |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) { |
288 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
289 |
< |
twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
290 |
< |
} |
291 |
< |
|
292 |
< |
} |
293 |
< |
|
294 |
< |
//book a histogram for the number of each object type to be plotted |
295 |
< |
|
296 |
< |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
297 |
< |
string currentObject = objectsToPlot.at(currentObjectIndex); |
298 |
< |
int maxNum = 10; |
299 |
< |
if(currentObject == "mcparticles") maxNum = 50; |
300 |
< |
else if(currentObject == "primaryvertexs") maxNum = 50; |
301 |
< |
else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
302 |
< |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
303 |
< |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
304 |
< |
|
305 |
< |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
306 |
< |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
307 |
< |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
308 |
< |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
309 |
< |
|
310 |
< |
currentObject.at(0) = toupper(currentObject.at(0)); |
311 |
< |
string histoName = "num" + currentObject; |
312 |
< |
|
313 |
< |
if(histoName == "numPrimaryvertexs"){ |
314 |
< |
string newHistoName = histoName + "BeforePileupCorrection"; |
315 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+" Before Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
316 |
< |
newHistoName = histoName + "AfterPileupCorrection"; |
317 |
< |
oneDHists_.at(currentChannel)[newHistoName] = directories.at(currentChannel).make<TH1D> (TString(newHistoName),channelLabel+" channel: Number of Selected "+currentObject+ " After Pileup Correction; # "+currentObject, maxNum, 0, maxNum); |
318 |
< |
} |
319 |
< |
else |
320 |
< |
oneDHists_.at(currentChannel)[histoName] = directories.at(currentChannel).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
321 |
< |
} |
322 |
< |
|
323 |
< |
|
324 |
< |
|
325 |
< |
|
261 |
> |
vector<TFileDirectory> directories; //vector of directories in the output file. |
262 |
> |
vector<string> subSubDirNames;//subdirectories in each channel. |
263 |
|
//get list of cuts for this channel |
264 |
|
vector<edm::ParameterSet> cuts_ (channels_.at(currentChannel).getParameter<vector<edm::ParameterSet> >("cuts")); |
265 |
|
|
266 |
+ |
|
267 |
|
//loop over and parse all cuts |
268 |
|
for(uint currentCut = 0; currentCut != cuts_.size(); currentCut++){ |
269 |
|
cut tempCut; |
270 |
|
//store input collection for cut |
271 |
|
string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection"); |
272 |
+ |
if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs"; |
273 |
+ |
if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs"; |
274 |
+ |
if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs"; |
275 |
+ |
if(tempInputCollection == "event-track pairs") tempInputCollection = "track-event pairs"; |
276 |
+ |
if(tempInputCollection == "secondary muon-muon pairs") tempInputCollection = "muon-secondary muon pairs"; |
277 |
+ |
if(tempInputCollection == "secondary electron-electron pairs") tempInputCollection = "electron-secondary electron pairs"; |
278 |
+ |
if(tempInputCollection == "trigobj-electron pairs") tempInputCollection = "electron-trigobj pairs"; |
279 |
+ |
if(tempInputCollection == "trigobj-muon pairs") tempInputCollection = "muon-trigobj pairs"; |
280 |
|
tempCut.inputCollection = tempInputCollection; |
281 |
< |
if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object |
282 |
< |
objectsToGet.push_back(tempInputCollection); |
281 |
> |
if(tempInputCollection.find("pairs")==string::npos){ //just a single object |
282 |
> |
if(tempInputCollection.find("secondary")!=string::npos){//secondary object |
283 |
> |
int spaceIndex = tempInputCollection.find(" "); |
284 |
> |
int secondWordLength = tempInputCollection.size() - spaceIndex; |
285 |
> |
objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength)); |
286 |
> |
} |
287 |
> |
else{ |
288 |
> |
objectsToGet.push_back(tempInputCollection); |
289 |
> |
} |
290 |
|
objectsToCut.push_back(tempInputCollection); |
291 |
|
} |
292 |
< |
else{//pair of objects, need to add them both to the things to objectsToGet |
293 |
< |
int dashIndex = tempInputCollection.find("-"); |
294 |
< |
int spaceIndex = tempInputCollection.find(" "); |
295 |
< |
int secondWordLength = spaceIndex - dashIndex; |
296 |
< |
objectsToGet.push_back(tempInputCollection); |
344 |
< |
objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
345 |
< |
objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
292 |
> |
else{//pair of objects, need to add them both to objectsToGet |
293 |
> |
string obj1; |
294 |
> |
string obj2; |
295 |
> |
getTwoObjs(tempInputCollection, obj1, obj2); |
296 |
> |
string obj2ToGet = getObjToGet(obj2); |
297 |
|
objectsToCut.push_back(tempInputCollection); |
298 |
< |
objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s"); |
299 |
< |
objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"); |
298 |
> |
objectsToCut.push_back(obj1); |
299 |
> |
objectsToCut.push_back(obj2); |
300 |
> |
objectsToGet.push_back(tempInputCollection); |
301 |
> |
objectsToGet.push_back(obj1); |
302 |
> |
objectsToGet.push_back(obj2ToGet); |
303 |
|
|
304 |
|
} |
305 |
|
|
307 |
|
|
308 |
|
//split cut string into parts and store them |
309 |
|
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
310 |
< |
std::vector<string> cutStringVector = splitString(cutString); |
310 |
> |
vector<string> cutStringVector = splitString(cutString); |
311 |
|
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
312 |
< |
std::cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
312 |
> |
cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
313 |
|
exit(0); |
314 |
|
} |
315 |
|
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
316 |
|
for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,| |
317 |
|
int indexOffset = 4 * subcutIndex; |
318 |
|
string currentVariableString = cutStringVector.at(indexOffset); |
319 |
< |
if(currentVariableString.find("(")==std::string::npos){ |
319 |
> |
if(currentVariableString.find("(")==string::npos){ |
320 |
|
tempCut.functions.push_back("");//no function was specified |
321 |
|
tempCut.variables.push_back(currentVariableString);// variable to cut on |
322 |
|
} |
327 |
|
} |
328 |
|
tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make |
329 |
|
tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut |
330 |
+ |
tempCut.cutStringValues.push_back(cutStringVector.at(indexOffset+2));// string value to pass cut |
331 |
|
if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or) |
332 |
|
} |
333 |
|
|
334 |
|
//get number of objects required to pass cut for event to pass |
335 |
|
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
336 |
< |
std::vector<string> numberRequiredVector = splitString(numberRequiredString); |
336 |
> |
vector<string> numberRequiredVector = splitString(numberRequiredString); |
337 |
|
if(numberRequiredVector.size()!=2){ |
338 |
< |
std::cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
338 |
> |
cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
339 |
|
exit(0); |
340 |
|
} |
341 |
|
|
343 |
|
tempCut.numberRequired = numberRequiredInt;// number of objects required to pass the cut |
344 |
|
tempCut.eventComparativeOperator = numberRequiredVector.at(0);// comparison to make |
345 |
|
|
346 |
< |
|
346 |
> |
//Set up vectors to store the directories and subDIrectories for each channel. |
347 |
> |
string subSubDirName; |
348 |
|
string tempCutName; |
349 |
|
if(cuts_.at(currentCut).exists("alias")){ |
350 |
|
tempCutName = cuts_.at(currentCut).getParameter<string> ("alias"); |
351 |
+ |
subSubDirName = "After " + cuts_.at(currentCut).getParameter<string> ("alias") + " Cut Applied"; |
352 |
|
} |
353 |
|
else{ |
354 |
|
//construct string for cutflow table |
356 |
|
string collectionString = plural ? tempInputCollection : tempInputCollection.substr(0, tempInputCollection.size()-1); |
357 |
|
string cutName = numberRequiredString + " " + collectionString + " with " + cutString; |
358 |
|
tempCutName = cutName; |
359 |
+ |
subSubDirName = "After " + numberRequiredString + " " + collectionString + " with " + cutString + " Cut Applied"; |
360 |
|
} |
403 |
– |
tempCut.name = tempCutName; |
361 |
|
|
362 |
+ |
subSubDirNames.push_back(subSubDirName); |
363 |
+ |
tempCut.name = tempCutName; |
364 |
|
|
365 |
|
tempChannel.cuts.push_back(tempCut); |
366 |
|
|
367 |
|
|
409 |
– |
|
368 |
|
}//end loop over cuts |
369 |
|
|
370 |
+ |
vector<map<string, TH1D*>> oneDHistsTmp; |
371 |
+ |
vector<map<string, TH2D*>> twoDHistsTmp; |
372 |
+ |
//book a directory in the output file with the name of the channel |
373 |
+ |
TFileDirectory subDir = fs_->mkdir( channelName ); |
374 |
+ |
//loop over the cuts to set up subdirectory for each cut if GetPlotsAfterEachCut_ is true. |
375 |
+ |
if(GetPlotsAfterEachCut_){ |
376 |
+ |
for( uint currentDir=0; currentDir != subSubDirNames.size(); currentDir++){ |
377 |
+ |
TFileDirectory subSubDir = subDir.mkdir( subSubDirNames[currentDir] ); |
378 |
+ |
directories.push_back(subSubDir); |
379 |
+ |
map<string, TH1D*> oneDhistoMap; |
380 |
+ |
oneDHistsTmp.push_back(oneDhistoMap); |
381 |
+ |
map<string, TH2D*> twoDhistoMap; |
382 |
+ |
twoDHistsTmp.push_back(twoDhistoMap); |
383 |
+ |
} |
384 |
+ |
oneDHists_.push_back(oneDHistsTmp); |
385 |
+ |
twoDHists_.push_back(twoDHistsTmp); |
386 |
+ |
} |
387 |
+ |
//only set up directories with names of the channels if GetPlotsAfterEachCut_ is false. |
388 |
+ |
else{ |
389 |
+ |
map<string, TH1D*> oneDhistoMap; |
390 |
+ |
oneDHistsTmp.push_back(oneDhistoMap); |
391 |
+ |
map<string, TH2D*> twoDhistoMap; |
392 |
+ |
twoDHistsTmp.push_back(twoDhistoMap); |
393 |
+ |
oneDHists_.push_back(oneDHistsTmp); |
394 |
+ |
twoDHists_.push_back(twoDHistsTmp); |
395 |
+ |
directories.push_back(subDir); |
396 |
+ |
|
397 |
+ |
} |
398 |
+ |
|
399 |
+ |
|
400 |
+ |
//book all histograms included in the configuration |
401 |
+ |
for(uint currentDir = 0; currentDir != directories.size(); currentDir++){//loop over all the directories. |
402 |
+ |
|
403 |
+ |
TTree* newTree = directories.at(currentDir).make<TTree> (TString("BNTree_"+channelLabel), TString("BNTree_"+channelLabel)); |
404 |
+ |
BNTrees_.push_back(newTree); |
405 |
+ |
for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++){ |
406 |
+ |
BranchSpecs currentVar = treeBranches_.at(iBranch); |
407 |
+ |
vector<float> newVec; |
408 |
+ |
BNTreeBranchVals_[currentVar.name] = newVec; |
409 |
+ |
BNTrees_.back()->Branch(TString(currentVar.name), &BNTreeBranchVals_.at(currentVar.name)); |
410 |
+ |
} // end for (uint iBranch = 0; iBranch < treeBranches_.size(); iBranch++){ |
411 |
+ |
|
412 |
+ |
for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
413 |
+ |
|
414 |
+ |
histogram currentHistogram = histograms.at(currentHistogramIndex); |
415 |
+ |
int numBinsElements = currentHistogram.bins.size(); |
416 |
+ |
int numInputVariables = currentHistogram.inputVariables.size(); |
417 |
+ |
int numBinEdgesX = currentHistogram.variableBinsX.size(); |
418 |
+ |
int numBinEdgesY = currentHistogram.variableBinsY.size(); |
419 |
+ |
|
420 |
+ |
if(numBinsElements == 1){ |
421 |
+ |
if(numBinEdgesX > 1){ |
422 |
+ |
if(numBinEdgesY > 1) |
423 |
+ |
numBinsElements = 6; |
424 |
+ |
else |
425 |
+ |
numBinsElements = 3; |
426 |
+ |
} |
427 |
+ |
} |
428 |
+ |
if(numBinsElements != 3 && numBinsElements !=6){ |
429 |
+ |
cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
430 |
+ |
exit(0); |
431 |
+ |
} |
432 |
+ |
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
433 |
+ |
cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
434 |
+ |
exit(0); |
435 |
+ |
} |
436 |
+ |
else if(numBinsElements == 3){ |
437 |
+ |
if (currentHistogram.bins.size () == 3) |
438 |
+ |
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)); |
439 |
+ |
else |
440 |
+ |
{ |
441 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name] = directories.at(currentDir).make<TH1D> (TString(currentHistogram.name),channelLabel+" channel: "+currentHistogram.title, numBinEdgesX - 1, currentHistogram.variableBinsX.data ()); |
442 |
+ |
} |
443 |
+ |
} |
444 |
+ |
else if(numBinsElements == 6){ |
445 |
+ |
if (currentHistogram.bins.size () == 6) |
446 |
+ |
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)); |
447 |
+ |
else |
448 |
+ |
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 ()); |
449 |
+ |
} |
450 |
+ |
|
451 |
+ |
|
452 |
+ |
if(currentHistogram.name.find("GenMatch")==string::npos) continue; |
453 |
+ |
|
454 |
+ |
// bin particle type |
455 |
+ |
// --- ------------- |
456 |
+ |
// 0 unmatched |
457 |
+ |
// 1 u |
458 |
+ |
// 2 d |
459 |
+ |
// 3 s |
460 |
+ |
// 4 c |
461 |
+ |
// 5 b |
462 |
+ |
// 6 t |
463 |
+ |
// 7 e |
464 |
+ |
// 8 mu |
465 |
+ |
// 9 tau |
466 |
+ |
// 10 nu |
467 |
+ |
// 11 g |
468 |
+ |
// 12 gamma |
469 |
+ |
// 13 Z |
470 |
+ |
// 14 W |
471 |
+ |
// 15 light meson |
472 |
+ |
// 16 K meson |
473 |
+ |
// 17 D meson |
474 |
+ |
// 18 B meson |
475 |
+ |
// 19 light baryon |
476 |
+ |
// 20 strange baryon |
477 |
+ |
// 21 charm baryon |
478 |
+ |
// 22 bottom baryon |
479 |
+ |
// 23 QCD string |
480 |
+ |
// 24 other |
481 |
+ |
|
482 |
+ |
vector<TString> labelArray; |
483 |
+ |
labelArray.push_back("unmatched"); |
484 |
+ |
labelArray.push_back("u"); |
485 |
+ |
labelArray.push_back("d"); |
486 |
+ |
labelArray.push_back("s"); |
487 |
+ |
labelArray.push_back("c"); |
488 |
+ |
labelArray.push_back("b"); |
489 |
+ |
labelArray.push_back("t"); |
490 |
+ |
labelArray.push_back("e"); |
491 |
+ |
labelArray.push_back("#mu"); |
492 |
+ |
labelArray.push_back("#tau"); |
493 |
+ |
labelArray.push_back("#nu"); |
494 |
+ |
labelArray.push_back("g"); |
495 |
+ |
labelArray.push_back("#gamma"); |
496 |
+ |
labelArray.push_back("Z"); |
497 |
+ |
labelArray.push_back("W"); |
498 |
+ |
labelArray.push_back("light meson"); |
499 |
+ |
labelArray.push_back("K meson"); |
500 |
+ |
labelArray.push_back("D meson"); |
501 |
+ |
labelArray.push_back("B meson"); |
502 |
+ |
labelArray.push_back("light baryon"); |
503 |
+ |
labelArray.push_back("strange baryon"); |
504 |
+ |
labelArray.push_back("charm baryon"); |
505 |
+ |
labelArray.push_back("bottom baryon"); |
506 |
+ |
labelArray.push_back("QCD string"); |
507 |
+ |
labelArray.push_back("other"); |
508 |
+ |
|
509 |
+ |
for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){ |
510 |
+ |
if(currentHistogram.name.find("GenMatchIdVsMotherId")==string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==string::npos) { |
511 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
512 |
+ |
} |
513 |
+ |
else { |
514 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1)); |
515 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin)); |
516 |
+ |
} |
517 |
+ |
} |
518 |
+ |
if(currentHistogram.name.find("GenMatchIdVsMotherId")!=string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=string::npos) { |
519 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetXaxis()->CenterTitle(); |
520 |
+ |
twoDHists_.at(currentChannel).at(currentDir)[currentHistogram.name]->GetYaxis()->CenterTitle(); |
521 |
+ |
} |
522 |
+ |
|
523 |
+ |
} // end for(uint currentHistogramIndex = 0; currentHistogramIndex != histograms.size(); currentHistogramIndex++){ |
524 |
+ |
|
525 |
+ |
|
526 |
+ |
// Book a histogram for the number of each object type to be plotted. |
527 |
+ |
// Name of objectToPlot here must match the name specified in OSUAnalysis::analyze(). |
528 |
+ |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
529 |
+ |
string currentObject = objectsToPlot.at(currentObjectIndex); |
530 |
+ |
int maxNum = 10; |
531 |
+ |
if(currentObject == "mcparticles") maxNum = 50; |
532 |
+ |
else if(currentObject == "primaryvertexs") maxNum = 50; |
533 |
+ |
|
534 |
+ |
if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs"; |
535 |
+ |
else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs"; |
536 |
+ |
else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs"; |
537 |
+ |
else if(currentObject == "secondary jets") currentObject = "secondaryJets"; |
538 |
+ |
else if(currentObject == "jet-jet pairs") currentObject = "dijetPairs"; |
539 |
+ |
else if(currentObject == "electron-jet pairs") currentObject = "electronJetPairs"; |
540 |
+ |
else if(currentObject == "muon-jet pairs") currentObject = "muonJetPairs"; |
541 |
+ |
else if(currentObject == "track-event pairs") currentObject = "trackEventPairs"; |
542 |
+ |
else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs"; |
543 |
+ |
else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs"; |
544 |
+ |
else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs"; |
545 |
+ |
else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs"; |
546 |
+ |
else if(currentObject == "tau-track pairs") currentObject = "tauTrackPairs"; |
547 |
+ |
else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs"; |
548 |
+ |
else if(currentObject == "secondary muons") currentObject = "secondaryMuons"; |
549 |
+ |
else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs"; |
550 |
+ |
else if(currentObject == "secondary electrons") currentObject = "secondaryElectrons"; |
551 |
+ |
else if(currentObject == "electron-trigobj pairs") currentObject = "electronTrigobjPairs"; |
552 |
+ |
else if(currentObject == "muon-trigobj pairs") currentObject = "muonTrigobjPairs"; |
553 |
+ |
|
554 |
+ |
currentObject.at(0) = toupper(currentObject.at(0)); |
555 |
+ |
string histoName = "num" + currentObject; |
556 |
+ |
|
557 |
+ |
if(histoName == "numPrimaryvertexs"){ |
558 |
+ |
string newHistoName = histoName + "BeforePileupCorrection"; |
559 |
+ |
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); |
560 |
+ |
newHistoName = histoName + "AfterPileupCorrection"; |
561 |
+ |
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); |
562 |
+ |
} |
563 |
+ |
else |
564 |
+ |
oneDHists_.at(currentChannel).at(currentDir)[histoName] = directories.at(currentDir).make<TH1D> (TString(histoName),channelLabel+" channel: Number of Selected "+currentObject+"; # "+currentObject, maxNum, 0, maxNum); |
565 |
+ |
} |
566 |
+ |
}//end of loop over directories |
567 |
|
channels.push_back(tempChannel); |
568 |
|
tempChannel.cuts.clear(); |
414 |
– |
|
569 |
|
}//end loop over channels |
570 |
|
|
571 |
|
|
581 |
|
|
582 |
|
OSUAnalysis::~OSUAnalysis () |
583 |
|
{ |
584 |
+ |
|
585 |
+ |
// for (uint iTree=0; iTree<BNTrees_.size(); iTree++) { |
586 |
+ |
// if (!BNTrees_.at(iTree)) { cout << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
587 |
+ |
// cout << "Debug: Executing AutoSave." << endl; |
588 |
+ |
// BNTrees_.at(iTree)->AutoSave("Overwrite"); // Save at end of job, to prevent duplicate key. |
589 |
+ |
// } |
590 |
+ |
|
591 |
|
// Destroying the CutFlow objects causes the cut flow numbers and time |
592 |
|
// information to be printed to standard output. |
593 |
|
for(uint currentChannel = 0; currentChannel != channels_.size(); currentChannel++){ |
601 |
|
|
602 |
|
// Retrieve necessary collections from the event. |
603 |
|
|
604 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
604 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) |
605 |
|
event.getByLabel (triggers_, triggers); |
606 |
|
|
607 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
607 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) |
608 |
> |
event.getByLabel (trigobjs_, trigobjs); |
609 |
> |
|
610 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) |
611 |
|
event.getByLabel (jets_, jets); |
612 |
|
|
613 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
613 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) |
614 |
|
event.getByLabel (muons_, muons); |
615 |
|
|
616 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
616 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) |
617 |
|
event.getByLabel (electrons_, electrons); |
618 |
|
|
619 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
619 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) |
620 |
|
event.getByLabel (events_, events); |
621 |
|
|
622 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
622 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) |
623 |
|
event.getByLabel (taus_, taus); |
624 |
|
|
625 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
625 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) |
626 |
|
event.getByLabel (mets_, mets); |
627 |
|
|
628 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
628 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) |
629 |
|
event.getByLabel (tracks_, tracks); |
630 |
|
|
631 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
631 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) |
632 |
|
event.getByLabel (genjets_, genjets); |
633 |
|
|
634 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
634 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) |
635 |
|
event.getByLabel (mcparticles_, mcparticles); |
636 |
|
|
637 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
637 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) |
638 |
|
event.getByLabel (primaryvertexs_, primaryvertexs); |
639 |
|
|
640 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
640 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) |
641 |
|
event.getByLabel (bxlumis_, bxlumis); |
642 |
|
|
643 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
643 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) |
644 |
|
event.getByLabel (photons_, photons); |
645 |
|
|
646 |
< |
if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
646 |
> |
if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) |
647 |
|
event.getByLabel (superclusters_, superclusters); |
648 |
|
|
649 |
+ |
if (datasetType_ == "signalMC"){ |
650 |
+ |
if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) |
651 |
+ |
event.getByLabel (stops_, stops); |
652 |
+ |
} |
653 |
+ |
|
654 |
+ |
if (useTrackCaloRhoCorr_) { |
655 |
+ |
// Used only for pile-up correction of by-hand calculation of isolation energy. |
656 |
+ |
// This rho collection is not available in all BEANs. |
657 |
+ |
// For description of rho values for different jet reconstruction algorithms, see |
658 |
+ |
// https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms |
659 |
+ |
event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_); |
660 |
+ |
} |
661 |
+ |
|
662 |
+ |
double masterScaleFactor = 1.0; |
663 |
+ |
|
664 |
|
//get pile-up event weight |
665 |
< |
double scaleFactor = 1.00; |
666 |
< |
if(doPileupReweighting_ && datasetType_ != "data") |
667 |
< |
scaleFactor = puWeight_->at (events->at (0).numTruePV); |
665 |
> |
if (doPileupReweighting_ && datasetType_ != "data") { |
666 |
> |
//for "data" datasets, the numTruePV is always set to -1 |
667 |
> |
if (events->at(0).numTruePV < 0) cout << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. Turning off pile-up reweighting." << endl; |
668 |
> |
else masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
669 |
> |
} |
670 |
|
|
671 |
+ |
stopCTauScaleFactor_ = 1.0; |
672 |
+ |
if (datasetType_ == "signalMC" && regex_match (dataset_, regex ("stop.*to.*_.*mm.*"))) |
673 |
+ |
stopCTauScaleFactor_ = stopCTauWeight_->at (event); |
674 |
+ |
masterScaleFactor *= stopCTauScaleFactor_; |
675 |
|
|
676 |
|
//loop over all channels |
677 |
|
|
682 |
|
counterMap passingCounter; |
683 |
|
cumulativeFlags.clear (); |
684 |
|
|
685 |
+ |
for (map<string, vector<float>>::iterator iter = BNTreeBranchVals_.begin(); |
686 |
+ |
iter != BNTreeBranchVals_.end(); iter++) { |
687 |
+ |
iter->second.clear(); // clear array |
688 |
+ |
} |
689 |
+ |
|
690 |
|
bool triggerDecision = true; |
691 |
< |
if(currentChannel.triggers.size() != 0){ //triggers specified |
692 |
< |
triggerDecision = evaluateTriggers(currentChannel.triggers,triggers.product()); |
691 |
> |
if(currentChannel.triggers.size() != 0 || currentChannel.triggersToVeto.size() != 0){ //triggers specified |
692 |
> |
triggerDecision = evaluateTriggers(currentChannel.triggers, currentChannel.triggersToVeto, triggers.product()); |
693 |
|
cutFlows_.at(currentChannelIndex)->at ("trigger") = triggerDecision; |
694 |
|
} |
695 |
|
|
696 |
|
//loop over all cuts |
507 |
– |
|
508 |
– |
|
509 |
– |
|
697 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
698 |
|
cut currentCut = currentChannel.cuts.at(currentCutIndex); |
512 |
– |
|
699 |
|
for(uint currentObjectIndex = 0; currentObjectIndex != objectsToCut.size(); currentObjectIndex++){ |
700 |
|
string currentObject = objectsToCut.at(currentObjectIndex); |
701 |
|
|
710 |
|
int flagsForPairCutsIndex = max(int(currentCutIndex-1),0); |
711 |
|
|
712 |
|
|
713 |
< |
if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
714 |
< |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
713 |
> |
if (currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets"); |
714 |
> |
else if(currentObject == "secondary jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets"); |
715 |
> |
else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons"); |
716 |
> |
else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons"); |
717 |
> |
else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons"); |
718 |
|
else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons"); |
719 |
|
else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events"); |
720 |
|
else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus"); |
726 |
|
else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis"); |
727 |
|
else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons"); |
728 |
|
else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters"); |
729 |
+ |
else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs"); |
730 |
+ |
|
731 |
|
|
732 |
|
|
733 |
|
else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
734 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
735 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
736 |
|
"muon-muon pairs"); |
737 |
+ |
|
738 |
+ |
else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \ |
739 |
+ |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
740 |
+ |
cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \ |
741 |
+ |
"muon-secondary muon pairs"); |
742 |
+ |
|
743 |
+ |
else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
744 |
+ |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
745 |
+ |
cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \ |
746 |
+ |
"electron-secondary electron pairs"); |
747 |
+ |
|
748 |
|
else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \ |
749 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
750 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
753 |
|
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
754 |
|
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
755 |
|
"electron-muon pairs"); |
756 |
< |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), \ |
757 |
< |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
758 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), \ |
759 |
< |
"electron-track pairs"); |
760 |
< |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), \ |
761 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
762 |
< |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), \ |
763 |
< |
"muon-track pairs"); |
764 |
< |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), \ |
765 |
< |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
766 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), \ |
767 |
< |
"muon-tau pairs"); |
768 |
< |
|
769 |
< |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),taus.product(), \ |
770 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), \ |
771 |
< |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), \ |
772 |
< |
"tau-tau pairs"); |
773 |
< |
|
756 |
> |
else if(currentObject == "jet-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),jets.product(), \ |
757 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
758 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
759 |
> |
"jet-jet pairs"); |
760 |
> |
else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \ |
761 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \ |
762 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
763 |
> |
"electron-jet pairs"); |
764 |
> |
else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \ |
765 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \ |
766 |
> |
cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \ |
767 |
> |
"muon-jet pairs"); |
768 |
> |
else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), |
769 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
770 |
> |
cumulativeFlags.at("events").at(flagsForPairCutsIndex), |
771 |
> |
"track-event pairs"); |
772 |
> |
else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), |
773 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
774 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
775 |
> |
"electron-track pairs"); |
776 |
> |
else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), |
777 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
778 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
779 |
> |
"muon-track pairs"); |
780 |
> |
else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), |
781 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
782 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
783 |
> |
"muon-tau pairs"); |
784 |
> |
else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(), |
785 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
786 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
787 |
> |
"tau-tau pairs"); |
788 |
> |
else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(), |
789 |
> |
cumulativeFlags.at("taus").at(flagsForPairCutsIndex), |
790 |
> |
cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), |
791 |
> |
"tau-track pairs"); |
792 |
> |
else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(), |
793 |
> |
cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), |
794 |
> |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
795 |
> |
"electron-trigobj pairs"); |
796 |
> |
else if(currentObject == "muon-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(), |
797 |
> |
cumulativeFlags.at("muons").at(flagsForPairCutsIndex), |
798 |
> |
cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex), |
799 |
> |
"muon-trigobj pairs"); |
800 |
|
|
801 |
+ |
if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops"); |
802 |
|
} |
803 |
|
|
804 |
|
|
805 |
|
|
806 |
|
}//end loop over all cuts |
578 |
– |
|
579 |
– |
|
807 |
|
//use cumulative flags to apply cuts at event level |
808 |
|
|
809 |
|
bool eventPassedAllCuts = true; |
810 |
< |
|
810 |
> |
//a vector to store cumulative cut descisions after each cut. |
811 |
> |
vector<bool> eventPassedPreviousCuts; |
812 |
|
//apply trigger (true if none were specified) |
813 |
|
eventPassedAllCuts = eventPassedAllCuts && triggerDecision; |
814 |
|
|
587 |
– |
|
588 |
– |
|
815 |
|
for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){ |
816 |
|
|
817 |
|
//loop over all objects and count how many passed the cumulative selection up to this point |
819 |
|
int numberPassing = 0; |
820 |
|
|
821 |
|
for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){ |
822 |
< |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
822 |
> |
if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++; |
823 |
|
} |
598 |
– |
|
824 |
|
bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired); |
825 |
|
cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision; |
601 |
– |
|
826 |
|
eventPassedAllCuts = eventPassedAllCuts && cutDecision; |
827 |
+ |
eventPassedPreviousCuts.push_back(eventPassedAllCuts); |
828 |
+ |
} |
829 |
+ |
double scaleFactor = masterScaleFactor; |
830 |
|
|
831 |
+ |
muonScaleFactor_ = electronScaleFactor_ = 1.0; |
832 |
+ |
if(applyLeptonSF_ && datasetType_ != "data"){ |
833 |
+ |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
834 |
+ |
vector<bool> muonFlags; |
835 |
+ |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
836 |
+ |
if (cumulativeFlags.at("muons").at(i).size()){ |
837 |
+ |
muonFlags = cumulativeFlags.at("muons").at(i); |
838 |
+ |
break; |
839 |
+ |
} |
840 |
+ |
} |
841 |
+ |
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
842 |
+ |
if(!muonFlags.at(muonIndex)) continue; |
843 |
+ |
muonScaleFactor_ *= muonSFWeight_->at (muons->at(muonIndex).eta); |
844 |
+ |
} |
845 |
+ |
} |
846 |
+ |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
847 |
+ |
vector<bool> electronFlags; |
848 |
+ |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
849 |
+ |
if (cumulativeFlags.at("electrons").at(i).size()){ |
850 |
+ |
electronFlags = cumulativeFlags.at("electrons").at(i); |
851 |
+ |
break; |
852 |
+ |
} |
853 |
+ |
} |
854 |
+ |
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
855 |
+ |
if(!electronFlags.at(electronIndex)) continue; |
856 |
+ |
electronScaleFactor_ *= electronSFWeight_->at (electrons->at(electronIndex).eta, electrons->at(electronIndex).pt); |
857 |
+ |
} |
858 |
+ |
} |
859 |
|
} |
860 |
+ |
scaleFactor *= muonScaleFactor_; |
861 |
+ |
scaleFactor *= electronScaleFactor_; |
862 |
|
|
863 |
|
cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor); |
864 |
|
|
608 |
– |
|
609 |
– |
|
610 |
– |
if(!eventPassedAllCuts)continue; |
611 |
– |
|
865 |
|
if (printEventInfo_) { |
866 |
< |
// Write information about event to screen, for testing purposes. |
867 |
< |
cout << "Event passed all cuts in channel " << currentChannel.name |
868 |
< |
<< ": run=" << events->at(0).run |
869 |
< |
<< " lumi=" << events->at(0).lumi |
870 |
< |
<< " event=" << events->at(0).evt |
871 |
< |
<< endl; |
866 |
> |
// Write information about event to screen, for testing purposes. |
867 |
> |
cout << "Event passed all cuts in channel " << currentChannel.name |
868 |
> |
<< ": run=" << events->at(0).run |
869 |
> |
<< " lumi=" << events->at(0).lumi |
870 |
> |
<< " event=" << events->at(0).evt |
871 |
> |
<< endl; |
872 |
|
} |
873 |
|
|
874 |
|
|
622 |
– |
// if(datasetType_ != "data") { |
623 |
– |
// scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta); |
624 |
– |
// scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
625 |
– |
// } |
626 |
– |
|
875 |
|
//filling histograms |
876 |
< |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
877 |
< |
histogram currentHistogram = histograms.at(histogramIndex); |
878 |
< |
|
879 |
< |
if(currentHistogram.inputVariables.size() == 1){ |
880 |
< |
TH1D* histo; |
633 |
< |
histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name); |
634 |
< |
|
635 |
< |
|
636 |
< |
|
637 |
< |
if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
638 |
< |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
639 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
640 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
641 |
< |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
642 |
< |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
643 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
644 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\ |
645 |
< |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
646 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
647 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), |
648 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
649 |
< |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), \ |
650 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), |
651 |
< |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
652 |
< |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), \ |
653 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), |
654 |
< |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
655 |
< |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), \ |
656 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), |
657 |
< |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
658 |
< |
|
659 |
< |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), \ |
660 |
< |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), |
661 |
< |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
662 |
< |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
663 |
< |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
664 |
< |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
665 |
< |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
666 |
< |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
667 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
668 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
669 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
670 |
< |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
671 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
672 |
< |
} |
673 |
< |
else if(currentHistogram.inputVariables.size() == 2){ |
674 |
< |
TH2D* histo; |
675 |
< |
histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name); |
676 |
< |
|
677 |
< |
|
678 |
< |
|
679 |
< |
if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor); |
680 |
< |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor); |
681 |
< |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
682 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \ |
683 |
< |
cumulativeFlags.at("muon-muon pairs").back(),scaleFactor); |
684 |
< |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor); |
685 |
< |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
686 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \ |
687 |
< |
cumulativeFlags.at("electron-electron pairs").back(),scaleFactor); |
688 |
< |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
689 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \ |
690 |
< |
cumulativeFlags.at("electron-muon pairs").back(),scaleFactor); |
691 |
< |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), \ |
692 |
< |
cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), \ |
693 |
< |
cumulativeFlags.at("electron-track pairs").back(),scaleFactor); |
694 |
< |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), \ |
695 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), \ |
696 |
< |
cumulativeFlags.at("muon-track pairs").back(),scaleFactor); |
697 |
< |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), \ |
698 |
< |
cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), \ |
699 |
< |
cumulativeFlags.at("muon-tau pairs").back(),scaleFactor); |
700 |
< |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), \ |
701 |
< |
cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), \ |
702 |
< |
cumulativeFlags.at("tau-tau pairs").back(),scaleFactor); |
703 |
< |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor); |
704 |
< |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor); |
705 |
< |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor); |
706 |
< |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor); |
707 |
< |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor); |
708 |
< |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor); |
709 |
< |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor); |
710 |
< |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor); |
711 |
< |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor); |
712 |
< |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor); |
713 |
< |
} |
714 |
< |
} |
715 |
< |
|
716 |
< |
//fills histograms with the sizes of collections |
717 |
< |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
718 |
< |
string currentObject = objectsToPlot.at(currentObjectIndex); |
719 |
< |
|
720 |
< |
string objectToPlot = ""; |
721 |
< |
|
722 |
< |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
723 |
< |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
724 |
< |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
725 |
< |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
726 |
< |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
727 |
< |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
728 |
< |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
729 |
< |
else objectToPlot = currentObject; |
730 |
< |
string tempCurrentObject = objectToPlot; |
731 |
< |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
732 |
< |
string histoName = "num" + tempCurrentObject; |
733 |
< |
|
734 |
< |
|
735 |
< |
|
736 |
< |
|
737 |
< |
//set position of primary vertex in event, in order to calculate quantities relative to it |
738 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
739 |
< |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back(); |
740 |
< |
int numToPlot = 0; |
741 |
< |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
742 |
< |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
743 |
< |
} |
744 |
< |
if(objectToPlot == "primaryvertexs"){ |
745 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
746 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
747 |
< |
} |
748 |
< |
else |
749 |
< |
oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor); |
750 |
< |
} |
751 |
< |
else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor); |
752 |
< |
else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor); |
753 |
< |
else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor); |
754 |
< |
else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor); |
755 |
< |
else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor); |
756 |
< |
else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor); |
757 |
< |
else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor); |
758 |
< |
else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor); |
759 |
< |
else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor); |
760 |
< |
else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor); |
761 |
< |
else if(objectToPlot == "tracks") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(tracks->size(),scaleFactor); |
762 |
< |
else if(objectToPlot == "genjets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(genjets->size(),scaleFactor); |
763 |
< |
else if(objectToPlot == "mcparticles") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mcparticles->size(),scaleFactor); |
764 |
< |
else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),scaleFactor); |
765 |
< |
else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),scaleFactor); |
766 |
< |
else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),scaleFactor); |
767 |
< |
else if(objectToPlot == "primaryvertexs"){ |
768 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
769 |
< |
oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
876 |
> |
for(uint currentCut = 0; currentCut != oneDHists_.at(currentChannelIndex).size(); currentCut++){//loop over all the directories in each channel. |
877 |
> |
uint currentDir; |
878 |
> |
if (!GetPlotsAfterEachCut_) { currentDir = currentChannel.cuts.size() - oneDHists_.at(currentChannelIndex).size(); } //if GetPlotsAfterEachCut_ is false, set currentDir point to the last cut. |
879 |
> |
else{ |
880 |
> |
currentDir = currentCut; |
881 |
|
} |
882 |
+ |
if(eventPassedPreviousCuts.at(currentDir)){ |
883 |
|
|
884 |
< |
} |
884 |
> |
// Assign BNTree variables |
885 |
> |
for (uint iBranch = 0; iBranch != treeBranches_.size(); iBranch++) { |
886 |
> |
BranchSpecs brSpecs = treeBranches_.at(iBranch); |
887 |
> |
string coll = brSpecs.inputCollection; |
888 |
> |
if (cumulativeFlags.count(coll) == 0) cout << "Error: no flags found for collection: " << coll << ", will cause a seg fault" << endl; |
889 |
> |
|
890 |
> |
if (coll == "jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).at(currentDir)); |
891 |
> |
else if(coll == "secondary jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).at(currentDir)); |
892 |
> |
else if(coll == "muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).at(currentDir)); |
893 |
> |
else if(coll == "secondary muons") assignTreeBranch(brSpecs,muons.product(), cumulativeFlags.at(coll).at(currentDir)); |
894 |
> |
else if(coll == "electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).at(currentDir)); |
895 |
> |
else if(coll == "secondary electrons") assignTreeBranch(brSpecs,electrons.product(), cumulativeFlags.at(coll).at(currentDir)); |
896 |
> |
else if(coll == "events") assignTreeBranch(brSpecs,events.product(), cumulativeFlags.at(coll).at(currentDir)); |
897 |
> |
else if(coll == "taus") assignTreeBranch(brSpecs,taus.product(), cumulativeFlags.at(coll).at(currentDir)); |
898 |
> |
else if(coll == "mets") assignTreeBranch(brSpecs,mets.product(), cumulativeFlags.at(coll).at(currentDir)); |
899 |
> |
else if(coll == "tracks") assignTreeBranch(brSpecs,tracks.product(), cumulativeFlags.at(coll).at(currentDir)); |
900 |
> |
else if(coll == "genjets") assignTreeBranch(brSpecs,genjets.product(), cumulativeFlags.at(coll).at(currentDir)); |
901 |
> |
else if(coll == "mcparticles") assignTreeBranch(brSpecs,mcparticles.product(), cumulativeFlags.at(coll).at(currentDir)); |
902 |
> |
else if(coll == "primaryvertexs") assignTreeBranch(brSpecs,primaryvertexs.product(),cumulativeFlags.at(coll).at(currentDir)); |
903 |
> |
else if(coll == "bxlumis") assignTreeBranch(brSpecs,bxlumis.product(), cumulativeFlags.at(coll).at(currentDir)); |
904 |
> |
else if(coll == "photons") assignTreeBranch(brSpecs,photons.product(), cumulativeFlags.at(coll).at(currentDir)); |
905 |
> |
else if(coll == "superclusters") assignTreeBranch(brSpecs,superclusters.product(), cumulativeFlags.at(coll).at(currentDir)); |
906 |
> |
else if(coll == "trigobjs") assignTreeBranch(brSpecs,trigobjs.product(), cumulativeFlags.at(coll).at(currentDir)); |
907 |
> |
else if(coll == "stops" |
908 |
> |
&& datasetType_ == "signalMC") assignTreeBranch(brSpecs,stops.product(), cumulativeFlags.at(coll).at(currentDir)); |
909 |
> |
} // end loop over branches |
910 |
> |
|
911 |
> |
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
912 |
> |
histogram currentHistogram = histograms.at(histogramIndex); |
913 |
> |
|
914 |
> |
if (cumulativeFlags.count(currentHistogram.inputCollection) == 0) cout << "Error: no flags found for collection: " << currentHistogram.inputCollection << ", will cause a seg fault" << endl; |
915 |
> |
|
916 |
> |
if(currentHistogram.inputVariables.size() == 1){ |
917 |
> |
TH1D* histo; |
918 |
> |
histo = oneDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
919 |
> |
if (currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
920 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
921 |
> |
else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
922 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
923 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
924 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
925 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
926 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
927 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
928 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
929 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
930 |
> |
else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
931 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\ |
932 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir),\ |
933 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
934 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill1DHistogram(histo,currentHistogram,jets.product(),jets.product(),\ |
935 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir),\ |
936 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
937 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
938 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
939 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
940 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \ |
941 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), |
942 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
943 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \ |
944 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
945 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
946 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \ |
947 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), |
948 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
949 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), |
950 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
951 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
952 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), |
953 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
954 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
955 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), |
956 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
957 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
958 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), |
959 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
960 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
961 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(), |
962 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
963 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
964 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(), |
965 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
966 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
967 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(), |
968 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
969 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
970 |
> |
|
971 |
> |
else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
972 |
> |
else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
973 |
> |
else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
974 |
> |
else if(currentHistogram.inputCollection == "tracks") fill1DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
975 |
> |
else if(currentHistogram.inputCollection == "genjets") fill1DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
976 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill1DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
977 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill1DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
978 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
979 |
> |
else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
980 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
981 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
982 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
983 |
> |
} |
984 |
> |
else if(currentHistogram.inputVariables.size() == 2){ |
985 |
> |
TH2D* histo; |
986 |
> |
histo = twoDHists_.at(currentChannelIndex).at(currentCut).at(currentHistogram.name); |
987 |
> |
if (currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").at(currentDir),scaleFactor); |
988 |
> |
else if(currentHistogram.inputCollection == "secondary jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor); |
989 |
> |
else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor); |
990 |
> |
else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor); |
991 |
> |
else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
992 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
993 |
> |
cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor); |
994 |
> |
else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \ |
995 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("secondary muons").at(currentDir), \ |
996 |
> |
cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor); |
997 |
> |
else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").at(currentDir),scaleFactor); |
998 |
> |
else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor); |
999 |
> |
else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1000 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("electrons").at(currentDir), \ |
1001 |
> |
cumulativeFlags.at("electron-electron pairs").at(currentDir),scaleFactor); |
1002 |
> |
else if(currentHistogram.inputCollection == "jet-jet pairs") fill2DHistogram(histo,currentHistogram,jets.product(),jets.product(), \ |
1003 |
> |
cumulativeFlags.at("jets").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1004 |
> |
cumulativeFlags.at("jet-jet pairs").at(currentDir),scaleFactor); |
1005 |
> |
else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \ |
1006 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("secondary electrons").at(currentDir), \ |
1007 |
> |
cumulativeFlags.at("electron-secondary electron pairs").at(currentDir),scaleFactor); |
1008 |
> |
else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \ |
1009 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("muons").at(currentDir), \ |
1010 |
> |
cumulativeFlags.at("electron-muon pairs").at(currentDir),scaleFactor); |
1011 |
> |
else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \ |
1012 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1013 |
> |
cumulativeFlags.at("electron-jet pairs").at(currentDir),scaleFactor); |
1014 |
> |
else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \ |
1015 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("jets").at(currentDir), \ |
1016 |
> |
cumulativeFlags.at("muon-jet pairs").at(currentDir),scaleFactor); |
1017 |
> |
else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), |
1018 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1019 |
> |
cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor); |
1020 |
> |
else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), |
1021 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1022 |
> |
cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor); |
1023 |
> |
else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), |
1024 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1025 |
> |
cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor); |
1026 |
> |
else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), |
1027 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("taus").at(currentDir), |
1028 |
> |
cumulativeFlags.at("tau-tau pairs").at(currentDir),scaleFactor); |
1029 |
> |
else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(), |
1030 |
> |
cumulativeFlags.at("taus").at(currentDir),cumulativeFlags.at("tracks").at(currentDir), |
1031 |
> |
cumulativeFlags.at("tau-track pairs").at(currentDir),scaleFactor); |
1032 |
> |
else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(), |
1033 |
> |
cumulativeFlags.at("electrons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1034 |
> |
cumulativeFlags.at("electron-trigobj pairs").at(currentDir),scaleFactor); |
1035 |
> |
else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(), |
1036 |
> |
cumulativeFlags.at("muons").at(currentDir),cumulativeFlags.at("trigobjs").at(currentDir), |
1037 |
> |
cumulativeFlags.at("muon-trigobj pairs").at(currentDir),scaleFactor); |
1038 |
> |
else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").at(currentDir),scaleFactor); |
1039 |
> |
else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").at(currentDir),scaleFactor); |
1040 |
> |
else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").at(currentDir),scaleFactor); |
1041 |
> |
else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").at(currentDir),scaleFactor); |
1042 |
> |
else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(), |
1043 |
> |
cumulativeFlags.at("tracks").at(currentDir),cumulativeFlags.at("events").at(currentDir), |
1044 |
> |
cumulativeFlags.at("track-event pairs").at(currentDir),scaleFactor); |
1045 |
> |
else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").at(currentDir),scaleFactor); |
1046 |
> |
else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").at(currentDir),scaleFactor); |
1047 |
> |
else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").at(currentDir),scaleFactor); |
1048 |
> |
else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").at(currentDir),scaleFactor); |
1049 |
> |
else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").at(currentDir),scaleFactor); |
1050 |
> |
else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").at(currentDir),scaleFactor); |
1051 |
> |
else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").at(currentDir),scaleFactor); |
1052 |
> |
else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").at(currentDir),scaleFactor); |
1053 |
> |
} |
1054 |
> |
|
1055 |
> |
} |
1056 |
|
|
1057 |
|
|
1058 |
+ |
//fills histograms with the sizes of collections |
1059 |
+ |
for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){ |
1060 |
|
|
1061 |
+ |
string currentObject = objectsToPlot.at(currentObjectIndex); |
1062 |
+ |
string objectToPlot = ""; |
1063 |
|
|
1064 |
< |
} //end loop over channel |
1064 |
> |
// Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis(). |
1065 |
> |
if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs"; |
1066 |
> |
else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs"; |
1067 |
> |
else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs"; |
1068 |
> |
else if(currentObject == "electron-jet pairs") objectToPlot = "electronJetPairs"; |
1069 |
> |
else if(currentObject == "muon-jet pairs") objectToPlot = "muonJetPairs"; |
1070 |
> |
else if(currentObject == "jet-jet pairs") objectToPlot = "dijetPairs"; |
1071 |
> |
else if(currentObject == "secondary jets") objectToPlot = "secondaryJets"; |
1072 |
> |
else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs"; |
1073 |
> |
else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs"; |
1074 |
> |
else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs"; |
1075 |
> |
else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs"; |
1076 |
> |
else if(currentObject == "tau-track pairs") objectToPlot = "tauTrackPairs"; |
1077 |
> |
else if(currentObject == "track-event pairs") objectToPlot = "trackEventPairs"; |
1078 |
> |
else if(currentObject == "muon-secondary muon pairs") objectToPlot = "muonSecondaryMuonPairs"; |
1079 |
> |
else if(currentObject == "secondary muons") objectToPlot = "secondaryMuons"; |
1080 |
> |
else if(currentObject == "electron-secondary electron pairs") objectToPlot = "electronSecondaryElectronPairs"; |
1081 |
> |
else if(currentObject == "secondary electrons") objectToPlot = "secondaryElectrons"; |
1082 |
> |
else if(currentObject == "electron-trigobj pairs") objectToPlot = "electronTrigobjPairs"; |
1083 |
> |
else if(currentObject == "muon-trigobj pairs") objectToPlot = "muonTrigobjPairs"; |
1084 |
> |
else objectToPlot = currentObject; |
1085 |
> |
|
1086 |
> |
string tempCurrentObject = objectToPlot; |
1087 |
> |
tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0)); |
1088 |
> |
string histoName = "num" + tempCurrentObject; |
1089 |
> |
|
1090 |
> |
//set position of primary vertex in event, in order to calculate quantities relative to it |
1091 |
> |
if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) { |
1092 |
> |
vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).at(currentDir); |
1093 |
> |
int numToPlot = 0; |
1094 |
> |
for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){ |
1095 |
> |
if(lastCutFlags.at(currentFlag)) numToPlot++; |
1096 |
> |
} |
1097 |
> |
if(objectToPlot == "primaryvertexs"){ |
1098 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size()); |
1099 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor); |
1100 |
> |
} |
1101 |
> |
else { |
1102 |
> |
oneDHists_.at(currentChannelIndex).at(currentCut).at(histoName)->Fill(numToPlot,scaleFactor); |
1103 |
> |
} |
1104 |
> |
} |
1105 |
> |
} // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++) |
1106 |
> |
|
1107 |
> |
if (!BNTrees_.at(currentChannelIndex)) { cout << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
1108 |
> |
BNTrees_.at(currentChannelIndex)->Fill(); // only fill if event has passed cuts |
1109 |
|
|
1110 |
< |
masterCutFlow_->fillCutFlow(scaleFactor); |
1110 |
> |
} // end if(eventPassedPreviousCuts.at(currentDir)){ |
1111 |
> |
} // end loop over cuts |
1112 |
> |
|
1113 |
> |
} // end loop over channel |
1114 |
|
|
1115 |
|
|
1116 |
+ |
masterCutFlow_->fillCutFlow(masterScaleFactor); |
1117 |
+ |
|
1118 |
+ |
|
1119 |
+ |
} // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup) |
1120 |
|
|
783 |
– |
} |
1121 |
|
|
1122 |
|
|
1123 |
|
bool |
1131 |
|
else if(comparison == "==") return testValue == cutValue; |
1132 |
|
else if(comparison == "=") return testValue == cutValue; |
1133 |
|
else if(comparison == "!=") return testValue != cutValue; |
1134 |
< |
else {std::cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1134 |
> |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1135 |
|
|
1136 |
|
} |
1137 |
|
|
1138 |
|
bool |
1139 |
< |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, const BNtriggerCollection* triggerCollection){ |
1139 |
> |
OSUAnalysis::evaluateComparison (string testValue, string comparison, string cutValue){ |
1140 |
> |
|
1141 |
|
|
1142 |
+ |
if(comparison == ">") return testValue > cutValue; |
1143 |
+ |
else if(comparison == ">=") return testValue >= cutValue; |
1144 |
+ |
else if(comparison == "<") return testValue < cutValue; |
1145 |
+ |
else if(comparison == "<=") return testValue <= cutValue; |
1146 |
+ |
else if(comparison == "==") return testValue == cutValue; |
1147 |
+ |
else if(comparison == "=") return testValue == cutValue; |
1148 |
+ |
else if(comparison == "!=") return testValue != cutValue; |
1149 |
+ |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1150 |
+ |
|
1151 |
+ |
} |
1152 |
+ |
|
1153 |
+ |
bool |
1154 |
+ |
OSUAnalysis::evaluateTriggers (vector<string> triggersToTest, vector<string> triggersToVeto, const BNtriggerCollection* triggerCollection){ |
1155 |
+ |
|
1156 |
+ |
//initialize to false until a chosen trigger is passed |
1157 |
|
bool triggerDecision = false; |
1158 |
|
|
1159 |
< |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++) |
1160 |
< |
{ |
808 |
< |
if(trigger->pass != 1) continue; |
809 |
< |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++) |
810 |
< |
{ |
811 |
< |
if(trigger->name.find(triggersToTest.at(triggerName))!=std::string::npos){ |
812 |
< |
triggerDecision = true; |
813 |
< |
} |
814 |
< |
} |
815 |
< |
} |
816 |
< |
return triggerDecision; |
1159 |
> |
//loop over all triggers defined in the event |
1160 |
> |
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++){ |
1161 |
|
|
1162 |
+ |
//we're only interested in triggers that actually passed |
1163 |
+ |
if(trigger->pass != 1) continue; |
1164 |
+ |
|
1165 |
+ |
//if the event passes one of the veto triggers, exit and return false |
1166 |
+ |
for(uint triggerName = 0; triggerName != triggersToVeto.size(); triggerName++){ |
1167 |
+ |
if(trigger->name.find(triggersToVeto.at(triggerName))!=string::npos) return false; |
1168 |
+ |
} |
1169 |
+ |
//if the event passes one of the chosen triggers, set triggerDecision to true |
1170 |
+ |
for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++){ |
1171 |
+ |
if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos) triggerDecision = true; |
1172 |
+ |
} |
1173 |
+ |
} |
1174 |
+ |
//if none of the veto triggers fired: |
1175 |
+ |
//return the OR of all the chosen triggers |
1176 |
+ |
if (triggersToTest.size() != 0) return triggerDecision; |
1177 |
+ |
//or if no triggers were defined return true |
1178 |
+ |
else return true; |
1179 |
|
} |
1180 |
|
|
1181 |
< |
std::vector<std::string> |
1181 |
> |
|
1182 |
> |
vector<string> |
1183 |
|
OSUAnalysis::splitString (string inputString){ |
1184 |
|
|
1185 |
< |
std::stringstream stringStream(inputString); |
1186 |
< |
std::istream_iterator<std::string> begin(stringStream); |
1187 |
< |
std::istream_iterator<std::string> end; |
1188 |
< |
std::vector<std::string> stringVector(begin, end); |
1185 |
> |
stringstream stringStream(inputString); |
1186 |
> |
istream_iterator<string> begin(stringStream); |
1187 |
> |
istream_iterator<string> end; |
1188 |
> |
vector<string> stringVector(begin, end); |
1189 |
|
return stringVector; |
1190 |
|
|
1191 |
|
} |
1192 |
|
|
1193 |
+ |
|
1194 |
+ |
void OSUAnalysis::getTwoObjs(string tempInputCollection, string& obj1, string& obj2) { |
1195 |
+ |
// Set two object strings from the tempInputCollection string, |
1196 |
+ |
// For example, if tempInputCollection is "electron-muon pairs", |
1197 |
+ |
// then obj1 = "electrons" and obj2 = "muons". |
1198 |
+ |
// Note that the objects have an "s" appended. |
1199 |
+ |
|
1200 |
+ |
int dashIndex = tempInputCollection.find("-"); |
1201 |
+ |
int spaceIndex = tempInputCollection.find_last_of(" "); |
1202 |
+ |
int secondWordLength = spaceIndex - dashIndex; |
1203 |
+ |
obj1 = tempInputCollection.substr(0,dashIndex) + "s"; |
1204 |
+ |
obj2 = tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s"; |
1205 |
+ |
|
1206 |
+ |
} |
1207 |
+ |
|
1208 |
+ |
|
1209 |
+ |
string OSUAnalysis::getObjToGet(string obj) { |
1210 |
+ |
// Return the string corresponding to the object to get for the given obj string. |
1211 |
+ |
// Right now this only handles the case in which obj contains "secondary", |
1212 |
+ |
// e.g, "secondary muons". |
1213 |
+ |
// Note that "s" is NOT appended. |
1214 |
+ |
|
1215 |
+ |
if (obj.find("secondary")==string::npos) return obj; // "secondary" is not found |
1216 |
+ |
int firstSpaceIndex = obj.find_first_of(" "); |
1217 |
+ |
return obj.substr(firstSpaceIndex+1,obj.length()-1); |
1218 |
+ |
|
1219 |
+ |
} |
1220 |
+ |
|
1221 |
+ |
|
1222 |
+ |
//!jet valueLookup |
1223 |
|
double |
1224 |
< |
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){ |
1224 |
> |
OSUAnalysis::valueLookup (const BNjet* object, string variable, string function, string &stringValue){ |
1225 |
|
|
1226 |
|
double value = 0.0; |
1227 |
|
if(variable == "energy") value = object->energy; |
1341 |
|
else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased; |
1342 |
|
|
1343 |
|
|
1344 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1344 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1345 |
|
|
1346 |
|
value = applyFunction(function, value); |
1347 |
|
|
1349 |
|
} |
1350 |
|
|
1351 |
|
|
1352 |
< |
|
1352 |
> |
//!muon valueLookup |
1353 |
|
double |
1354 |
< |
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){ |
1354 |
> |
OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function, string &stringValue){ |
1355 |
|
|
1356 |
|
double value = 0.0; |
1357 |
|
if(variable == "energy") value = object->energy; |
1512 |
|
else if(variable == "relPFdBetaIso") value = (object->pfIsoR04SumChargedHadronPt + max(0.0, object->pfIsoR04SumNeutralHadronEt + object->pfIsoR04SumPhotonEt - 0.5*object->pfIsoR04SumPUPt)) / object->pt; |
1513 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIso + max(0.0, object->neutralHadronIso + object->photonIso - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1514 |
|
else if(variable == "metMT") { |
1515 |
< |
const BNmet *met = chosenMET (); |
1124 |
< |
if (met) |
1515 |
> |
if (const BNmet *met = chosenMET ()) |
1516 |
|
{ |
1517 |
< |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1518 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1128 |
< |
|
1129 |
< |
value = (p1 + p2).Mt (); |
1517 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1518 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1519 |
|
} |
1520 |
|
else |
1521 |
|
value = -999; |
1642 |
|
} |
1643 |
|
else if(variable == "tightIDdisplaced"){ |
1644 |
|
value = object->isGlobalMuon > 0 \ |
1645 |
+ |
&& object->isPFMuon > 0 \ |
1646 |
|
&& object->normalizedChi2 < 10 \ |
1647 |
|
&& object->numberOfValidMuonHits > 0 \ |
1648 |
|
&& object->numberOfMatchedStations > 1 \ |
1650 |
|
&& object->numberOfLayersWithMeasurement > 5; |
1651 |
|
} |
1652 |
|
|
1653 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1653 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
1654 |
|
|
1655 |
|
else if(variable == "genMatchedPdgId"){ |
1656 |
|
int index = getGenMatchedParticleIndex(object); |
1670 |
|
} |
1671 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
1672 |
|
int index = getGenMatchedParticleIndex(object); |
1673 |
< |
if(index == -1) value = 23; |
1674 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
1673 |
> |
if(index == -1) value = 24; |
1674 |
> |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).motherId); |
1675 |
|
} |
1676 |
|
else if(variable == "genMatchedGrandmotherId"){ |
1677 |
|
int index = getGenMatchedParticleIndex(object); |
1683 |
|
} |
1684 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1685 |
|
} |
1686 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
1687 |
+ |
int index = getGenMatchedParticleIndex(object); |
1688 |
+ |
if(index == -1) value = 24; |
1689 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
1690 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
1691 |
+ |
if(motherIndex == -1) value = 24; |
1692 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
1693 |
+ |
} |
1694 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
1695 |
+ |
} |
1696 |
+ |
else if(variable == "pfMuonsFromVertex"){ |
1697 |
+ |
double d0Error, dzError; |
1698 |
|
|
1699 |
+ |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
1700 |
+ |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
1701 |
+ |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
1702 |
+ |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
1703 |
+ |
|| fabs (object->correctedDZ / dzError) > 99.0; |
1704 |
+ |
value = (object->isStandAloneMuon && !object->isTrackerMuon && !object->isGlobalMuon) || !value; |
1705 |
+ |
} |
1706 |
|
|
1707 |
|
|
1708 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1708 |
> |
|
1709 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1710 |
|
|
1711 |
|
value = applyFunction(function, value); |
1712 |
|
|
1713 |
|
return value; |
1714 |
|
} |
1715 |
|
|
1716 |
< |
|
1716 |
> |
//!electron valueLookup |
1717 |
|
double |
1718 |
< |
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){ |
1718 |
> |
OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function, string &stringValue){ |
1719 |
|
|
1720 |
|
double value = 0.0; |
1721 |
|
if(variable == "energy") value = object->energy; |
1881 |
|
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
1882 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt; |
1883 |
|
else if(variable == "metMT") { |
1884 |
< |
const BNmet *met = chosenMET (); |
1475 |
< |
if (met) |
1884 |
> |
if (const BNmet *met = chosenMET ()) |
1885 |
|
{ |
1886 |
< |
TLorentzVector p1 (object->px, object->py, object->pz, object->energy), |
1887 |
< |
p2 (met->px, met->py, 0.0, met->pt); |
1479 |
< |
|
1480 |
< |
value = (p1 + p2).Mt (); |
1886 |
> |
double dPhi = deltaPhi (object->phi, met->phi); |
1887 |
> |
value = sqrt (2 * object->pt * met->pt * (1 - cos (dPhi))); |
1888 |
|
} |
1889 |
|
else |
1890 |
|
value = -999; |
2049 |
|
} |
2050 |
|
|
2051 |
|
|
2052 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2052 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2053 |
|
|
2054 |
|
else if(variable == "genMatchedPdgId"){ |
2055 |
|
int index = getGenMatchedParticleIndex(object); |
2070 |
|
} |
2071 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2072 |
|
int index = getGenMatchedParticleIndex(object); |
2073 |
< |
if(index == -1) value = 23; |
2074 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2073 |
> |
if(index == -1) value = 24; |
2074 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2075 |
|
} |
2076 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2077 |
|
int index = getGenMatchedParticleIndex(object); |
2083 |
|
} |
2084 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2085 |
|
} |
2086 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2087 |
+ |
int index = getGenMatchedParticleIndex(object); |
2088 |
+ |
if(index == -1) value = 24; |
2089 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2090 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2091 |
+ |
if(motherIndex == -1) value = 24; |
2092 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2093 |
+ |
} |
2094 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2095 |
+ |
} |
2096 |
+ |
else if(variable == "pfElectronsFromVertex"){ |
2097 |
+ |
double d0Error, dzError; |
2098 |
|
|
2099 |
+ |
d0Error = hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2100 |
+ |
dzError = hypot (object->tkDZerr, chosenVertex ()->zError); |
2101 |
+ |
value = fabs (object->correctedD0Vertex) > 0.2 || fabs (object->correctedDZ) > 0.5 |
2102 |
+ |
|| fabs (object->correctedD0Vertex / d0Error) > 99.0 |
2103 |
+ |
|| fabs (object->correctedDZ / dzError) > 99.0; |
2104 |
+ |
value = !value; |
2105 |
+ |
} |
2106 |
|
|
2107 |
|
|
2108 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2108 |
> |
|
2109 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2110 |
|
|
2111 |
|
value = applyFunction(function, value); |
2112 |
|
|
2113 |
|
return value; |
2114 |
|
} |
2115 |
|
|
2116 |
< |
|
2116 |
> |
//!event valueLookup |
2117 |
|
double |
2118 |
< |
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){ |
2118 |
> |
OSUAnalysis::valueLookup (const BNevent* object, string variable, string function, string &stringValue){ |
2119 |
|
|
2120 |
|
double value = 0.0; |
2121 |
|
|
2184 |
|
else if(variable == "id2") value = object->id2; |
2185 |
|
else if(variable == "evt") value = object->evt; |
2186 |
|
else if(variable == "puScaleFactor"){ |
2187 |
< |
if(datasetType_ != "data") |
2187 |
> |
if(doPileupReweighting_ && datasetType_ != "data") |
2188 |
|
value = puWeight_->at (events->at (0).numTruePV); |
2189 |
|
else |
2190 |
|
value = 1.0; |
2191 |
|
} |
2192 |
< |
else if(variable == "muonScaleFactor"){ |
2193 |
< |
if(datasetType_ != "data") |
2194 |
< |
// value = muonSFWeight_->at (chosenMuon ()->eta); |
1768 |
< |
value = 1.0; |
1769 |
< |
else |
1770 |
< |
value = 1.0; |
1771 |
< |
} |
1772 |
< |
else if(variable == "electronScaleFactor"){ |
1773 |
< |
if(datasetType_ != "data") |
1774 |
< |
// value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt); |
1775 |
< |
value = 1.0; |
1776 |
< |
else |
1777 |
< |
value = 1.0; |
1778 |
< |
} |
2192 |
> |
else if(variable == "muonScaleFactor") value = muonScaleFactor_; |
2193 |
> |
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2194 |
> |
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2195 |
|
|
2196 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2196 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2197 |
|
|
2198 |
|
value = applyFunction(function, value); |
2199 |
|
|
2200 |
|
return value; |
2201 |
|
} |
2202 |
|
|
2203 |
+ |
//!tau valueLookup |
2204 |
|
double |
2205 |
< |
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){ |
2205 |
> |
OSUAnalysis::valueLookup (const BNtau* object, string variable, string function, string &stringValue){ |
2206 |
|
|
2207 |
|
double value = 0.0; |
2208 |
|
|
2248 |
|
|
2249 |
|
|
2250 |
|
|
2251 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2251 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2252 |
|
|
2253 |
|
else if(variable == "genMatchedPdgId"){ |
2254 |
|
int index = getGenMatchedParticleIndex(object); |
2268 |
|
} |
2269 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2270 |
|
int index = getGenMatchedParticleIndex(object); |
2271 |
< |
if(index == -1) value = 23; |
2272 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2271 |
> |
if(index == -1) value = 24; |
2272 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2273 |
|
} |
2274 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2275 |
|
int index = getGenMatchedParticleIndex(object); |
2281 |
|
} |
2282 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2283 |
|
} |
2284 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2285 |
+ |
int index = getGenMatchedParticleIndex(object); |
2286 |
+ |
if(index == -1) value = 24; |
2287 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2288 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2289 |
+ |
if(motherIndex == -1) value = 24; |
2290 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2291 |
+ |
} |
2292 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2293 |
+ |
} |
2294 |
|
|
2295 |
|
|
2296 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2296 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2297 |
|
|
2298 |
|
value = applyFunction(function, value); |
2299 |
|
|
2300 |
|
return value; |
2301 |
|
} |
2302 |
|
|
2303 |
+ |
//!met valueLookup |
2304 |
|
double |
2305 |
< |
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){ |
2305 |
> |
OSUAnalysis::valueLookup (const BNmet* object, string variable, string function, string &stringValue){ |
2306 |
|
|
2307 |
|
double value = 0.0; |
2308 |
|
|
2366 |
|
else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt; |
2367 |
|
else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi; |
2368 |
|
|
2369 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2369 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2370 |
|
|
2371 |
|
value = applyFunction(function, value); |
2372 |
|
|
2373 |
|
return value; |
2374 |
|
} |
2375 |
|
|
2376 |
+ |
//!track valueLookup |
2377 |
|
double |
2378 |
< |
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){ |
2378 |
> |
OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function, string &stringValue){ |
2379 |
|
|
2380 |
|
double value = 0.0; |
2381 |
|
double pMag = sqrt(object->pt * object->pt + |
2382 |
< |
object->pz * object->pz); |
2382 |
> |
object->pz * object->pz); |
2383 |
|
|
2384 |
|
if(variable == "pt") value = object->pt; |
2385 |
|
else if(variable == "px") value = object->px; |
2401 |
|
|
2402 |
|
|
2403 |
|
//additional BNs info for disappTrks |
1975 |
– |
else if(variable == "isGoodPtResolution") value = object->isGoodPtResolution; |
2404 |
|
else if(variable == "caloEMDeltaRp3") value = object->caloEMDeltaRp3; |
2405 |
|
else if(variable == "caloHadDeltaRp3") value = object->caloHadDeltaRp3; |
2406 |
|
else if(variable == "caloEMDeltaRp4") value = object->caloEMDeltaRp4; |
2407 |
|
else if(variable == "caloHadDeltaRp4") value = object->caloHadDeltaRp4; |
2408 |
|
else if(variable == "caloEMDeltaRp5") value = object->caloEMDeltaRp5; |
2409 |
|
else if(variable == "caloHadDeltaRp5") value = object->caloHadDeltaRp5; |
2410 |
+ |
else if(variable == "nTracksRp5") value = object->nTracksRp5; |
2411 |
|
else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter; |
2412 |
|
else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner; |
2413 |
|
else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle; |
2414 |
< |
|
2414 |
> |
else if(variable == "depTrkRp5") value = object->depTrkRp5; |
2415 |
|
|
2416 |
|
//user defined variables |
2417 |
|
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; |
2418 |
|
else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz; |
2419 |
< |
else if(variable == "caloTotDeltaRp5") value =(object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2420 |
< |
else if(variable == "caloTotDeltaRp5ByP") value =( (object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2421 |
< |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2422 |
< |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2423 |
< |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2424 |
< |
else if(variable == "ptError") value = object->ptError; |
2425 |
< |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2426 |
< |
|
2419 |
> |
else if(variable == "depTrkRp5MinusPt") value = (object->depTrkRp5 - object->pt); |
2420 |
> |
else if(variable == "caloTotDeltaRp5") value = (object->caloHadDeltaRp5 + object->caloEMDeltaRp5); |
2421 |
> |
else if(variable == "caloTotDeltaRp5ByP") value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag); |
2422 |
> |
else if(variable == "caloTotDeltaRp5RhoCorr") value = getTrkCaloTotRhoCorr(object); |
2423 |
> |
else if(variable == "caloTotDeltaRp5ByPRhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag; |
2424 |
> |
else if(variable == "isIso") value = getTrkIsIso(object, tracks.product()); |
2425 |
> |
else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object); |
2426 |
> |
else if(variable == "ptErrorByPt") value = (object->ptError/object->pt); |
2427 |
> |
else if(variable == "ptError") value = object->ptError; |
2428 |
> |
else if(variable == "ptRes") value = getTrkPtRes(object); |
2429 |
|
else if (variable == "d0wrtPV"){ |
2430 |
|
double vx = object->vx - chosenVertex ()->x, |
2431 |
|
vy = object->vy - chosenVertex ()->y, |
2444 |
|
pt = object->pt; |
2445 |
|
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
2446 |
|
} |
2447 |
< |
|
2017 |
< |
|
2018 |
< |
|
2019 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2447 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2448 |
|
|
2449 |
|
else if(variable == "genMatchedPdgId"){ |
2450 |
|
int index = getGenMatchedParticleIndex(object); |
2452 |
|
else value = mcparticles->at(index).id; |
2453 |
|
} |
2454 |
|
|
2455 |
+ |
|
2456 |
|
else if(variable == "genMatchedId"){ |
2457 |
|
int index = getGenMatchedParticleIndex(object); |
2458 |
|
if(index == -1) value = 0; |
2465 |
|
} |
2466 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2467 |
|
int index = getGenMatchedParticleIndex(object); |
2468 |
< |
if(index == -1) value = 23; |
2469 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2468 |
> |
if(index == -1) value = 24; |
2469 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2470 |
|
} |
2471 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2472 |
|
int index = getGenMatchedParticleIndex(object); |
2478 |
|
} |
2479 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2480 |
|
} |
2481 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2482 |
+ |
int index = getGenMatchedParticleIndex(object); |
2483 |
+ |
if(index == -1) value = 24; |
2484 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2485 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2486 |
+ |
if(motherIndex == -1) value = 24; |
2487 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2488 |
+ |
} |
2489 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2490 |
+ |
} |
2491 |
|
|
2492 |
|
|
2493 |
|
|
2494 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2494 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2495 |
|
|
2496 |
|
value = applyFunction(function, value); |
2497 |
|
|
2498 |
|
return value; |
2499 |
|
} |
2500 |
|
|
2501 |
+ |
//!genjet valueLookup |
2502 |
|
double |
2503 |
< |
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){ |
2503 |
> |
OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function, string &stringValue){ |
2504 |
|
|
2505 |
|
double value = 0.0; |
2506 |
|
|
2520 |
|
else if(variable == "charge") value = object->charge; |
2521 |
|
|
2522 |
|
|
2523 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2523 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2524 |
|
|
2525 |
|
value = applyFunction(function, value); |
2526 |
|
|
2527 |
|
return value; |
2528 |
|
} |
2529 |
|
|
2530 |
+ |
//!mcparticle valueLookup |
2531 |
|
double |
2532 |
< |
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){ |
2532 |
> |
OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function, string &stringValue){ |
2533 |
|
|
2534 |
|
double value = 0.0; |
2535 |
|
|
2654 |
|
} |
2655 |
|
|
2656 |
|
|
2657 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2657 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2658 |
|
|
2659 |
|
value = applyFunction(function, value); |
2660 |
|
|
2661 |
|
return value; |
2662 |
|
} |
2663 |
|
|
2664 |
+ |
//!primaryvertex valueLookup |
2665 |
|
double |
2666 |
< |
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){ |
2666 |
> |
OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function, string &stringValue){ |
2667 |
|
|
2668 |
|
double value = 0.0; |
2669 |
|
|
2682 |
|
else if(variable == "isGood") value = object->isGood; |
2683 |
|
|
2684 |
|
|
2685 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2685 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2686 |
|
|
2687 |
|
value = applyFunction(function, value); |
2688 |
|
|
2689 |
|
return value; |
2690 |
|
} |
2691 |
|
|
2692 |
+ |
//!bxlumi valueLookup |
2693 |
|
double |
2694 |
< |
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){ |
2694 |
> |
OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function, string &stringValue){ |
2695 |
|
|
2696 |
|
double value = 0.0; |
2697 |
|
|
2700 |
|
else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now; |
2701 |
|
|
2702 |
|
|
2703 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2703 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2704 |
|
|
2705 |
|
value = applyFunction(function, value); |
2706 |
|
|
2707 |
|
return value; |
2708 |
|
} |
2709 |
|
|
2710 |
+ |
//!photon valueLookup |
2711 |
|
double |
2712 |
< |
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){ |
2712 |
> |
OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function, string &stringValue){ |
2713 |
|
|
2714 |
|
double value = 0.0; |
2715 |
|
|
2782 |
|
else if(variable == "isEEGap") value = object->isEEGap; |
2783 |
|
else if(variable == "hasPixelSeed") value = object->hasPixelSeed; |
2784 |
|
else if(variable == "seedRecoFlag") value = object->seedRecoFlag; |
2341 |
– |
|
2785 |
|
|
2786 |
< |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2786 |
> |
|
2787 |
> |
|
2788 |
> |
|
2789 |
> |
else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object); |
2790 |
|
|
2791 |
|
else if(variable == "genMatchedPdgId"){ |
2792 |
|
int index = getGenMatchedParticleIndex(object); |
2793 |
|
if(index == -1) value = 0; |
2794 |
|
else value = mcparticles->at(index).id; |
2795 |
|
} |
2796 |
+ |
|
2797 |
+ |
|
2798 |
+ |
|
2799 |
|
else if(variable == "genMatchedId"){ |
2800 |
|
int index = getGenMatchedParticleIndex(object); |
2801 |
|
if(index == -1) value = 0; |
2808 |
|
} |
2809 |
|
else if(variable == "genMatchedMotherIdReverse"){ |
2810 |
|
int index = getGenMatchedParticleIndex(object); |
2811 |
< |
if(index == -1) value = 23; |
2812 |
< |
else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2811 |
> |
if(index == -1) value = 24; |
2812 |
> |
else value = 24 -getPdgIdBinValue(mcparticles->at(index).motherId); |
2813 |
|
} |
2814 |
|
else if(variable == "genMatchedGrandmotherId"){ |
2815 |
|
int index = getGenMatchedParticleIndex(object); |
2821 |
|
} |
2822 |
|
else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2823 |
|
} |
2824 |
+ |
else if(variable == "genMatchedGrandmotherIdReverse"){ |
2825 |
+ |
int index = getGenMatchedParticleIndex(object); |
2826 |
+ |
if(index == -1) value = 24; |
2827 |
+ |
else if(fabs(mcparticles->at(index).motherId) == 15){ |
2828 |
+ |
int motherIndex = findTauMotherIndex(&mcparticles->at(index)); |
2829 |
+ |
if(motherIndex == -1) value = 24; |
2830 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId); |
2831 |
+ |
} |
2832 |
+ |
else value = 24 - getPdgIdBinValue(mcparticles->at(index).grandMotherId); |
2833 |
+ |
} |
2834 |
|
|
2835 |
|
|
2836 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2836 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2837 |
|
|
2838 |
|
value = applyFunction(function, value); |
2839 |
|
|
2840 |
|
return value; |
2841 |
|
} |
2842 |
|
|
2843 |
+ |
//!supercluster valueLookup |
2844 |
|
double |
2845 |
< |
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){ |
2845 |
> |
OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function, string &stringValue){ |
2846 |
|
|
2847 |
|
double value = 0.0; |
2848 |
|
|
2856 |
|
else if(variable == "theta") value = object->theta; |
2857 |
|
|
2858 |
|
|
2859 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2859 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2860 |
|
|
2861 |
|
value = applyFunction(function, value); |
2862 |
|
|
2863 |
|
return value; |
2864 |
|
} |
2865 |
|
|
2866 |
+ |
//!trigobj valueLookup |
2867 |
+ |
double |
2868 |
+ |
OSUAnalysis::valueLookup (const BNtrigobj* object, string variable, string function, string &stringValue){ |
2869 |
+ |
|
2870 |
+ |
double value = 0.0; |
2871 |
+ |
|
2872 |
+ |
if(variable == "pt") value = object->pt; |
2873 |
+ |
else if(variable == "eta") value = object->eta; |
2874 |
+ |
else if(variable == "phi") value = object->phi; |
2875 |
+ |
else if(variable == "px") value = object->px; |
2876 |
+ |
else if(variable == "py") value = object->py; |
2877 |
+ |
else if(variable == "pz") value = object->pz; |
2878 |
+ |
else if(variable == "et") value = object->et; |
2879 |
+ |
else if(variable == "energy") value = object->energy; |
2880 |
+ |
else if(variable == "etTotal") value = object->etTotal; |
2881 |
+ |
else if(variable == "id") value = object->id; |
2882 |
+ |
else if(variable == "charge") value = object->charge; |
2883 |
+ |
else if(variable == "isIsolated") value = object->isIsolated; |
2884 |
+ |
else if(variable == "isMip") value = object->isMip; |
2885 |
+ |
else if(variable == "isForward") value = object->isForward; |
2886 |
+ |
else if(variable == "isRPC") value = object->isRPC; |
2887 |
+ |
else if(variable == "bx") value = object->bx; |
2888 |
+ |
else if(variable == "filter") { |
2889 |
+ |
if ((stringValue = object->filter) == "") |
2890 |
+ |
stringValue = "none"; // stringValue should only be empty if value is filled |
2891 |
+ |
} |
2892 |
+ |
|
2893 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2894 |
+ |
|
2895 |
+ |
value = applyFunction(function, value); |
2896 |
+ |
|
2897 |
+ |
return value; |
2898 |
+ |
} |
2899 |
|
|
2900 |
+ |
//!muon-muon pair valueLookup |
2901 |
|
double |
2902 |
< |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function){ |
2902 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function, string &stringValue){ |
2903 |
|
|
2904 |
|
double value = 0.0; |
2905 |
|
|
2906 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2907 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2908 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2909 |
|
else if(variable == "invMass"){ |
2910 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2914 |
|
else if(variable == "pt"){ |
2915 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2916 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2917 |
< |
value = (fourVector1 + fourVector2).Et(); |
2917 |
> |
value = (fourVector1 + fourVector2).Pt(); |
2918 |
|
} |
2919 |
|
else if(variable == "threeDAngle") |
2920 |
|
{ |
2946 |
|
else if(variable == "muon2CorrectedD0Vertex"){ |
2947 |
|
value = object2->correctedD0Vertex; |
2948 |
|
} |
2949 |
< |
else if(variable == "muon1timeAtIpInOut"){ |
2949 |
> |
else if(variable == "muon1timeAtIpInOut"){ |
2950 |
|
value = object1->timeAtIpInOut; |
2951 |
|
} |
2952 |
< |
else if(variable == "muon2timeAtIpInOut"){ |
2952 |
> |
else if(variable == "muon2timeAtIpInOut"){ |
2953 |
|
value = object2->timeAtIpInOut; |
2954 |
|
} |
2955 |
< |
else if(variable == "muon1correctedD0") |
2956 |
< |
{ |
2957 |
< |
value = object1->correctedD0; |
2958 |
< |
} |
2959 |
< |
else if(variable == "muon2correctedD0") |
2960 |
< |
{ |
2961 |
< |
value = object2->correctedD0; |
2962 |
< |
} |
2955 |
> |
else if(variable == "muon1correctedD0") |
2956 |
> |
{ |
2957 |
> |
value = object1->correctedD0; |
2958 |
> |
} |
2959 |
> |
else if(variable == "muon2correctedD0") |
2960 |
> |
{ |
2961 |
> |
value = object2->correctedD0; |
2962 |
> |
} |
2963 |
|
|
2964 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2964 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2965 |
|
|
2966 |
|
value = applyFunction(function, value); |
2967 |
|
|
2968 |
|
return value; |
2969 |
|
} |
2970 |
|
|
2971 |
+ |
//!electron-electron pair valueLookup |
2972 |
|
double |
2973 |
< |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function){ |
2973 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue){ |
2974 |
|
|
2975 |
|
double value = 0.0; |
2976 |
|
|
2977 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
2978 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
2979 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
2980 |
|
else if(variable == "invMass"){ |
2981 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2985 |
|
else if(variable == "pt"){ |
2986 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
2987 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
2988 |
< |
value = (fourVector1 + fourVector2).Et(); |
2988 |
> |
value = (fourVector1 + fourVector2).Pt(); |
2989 |
|
} |
2990 |
|
else if(variable == "threeDAngle") |
2991 |
|
{ |
3017 |
|
value = object2->correctedD0; |
3018 |
|
} |
3019 |
|
|
3020 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3020 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3021 |
|
|
3022 |
|
value = applyFunction(function, value); |
3023 |
|
|
3024 |
|
return value; |
3025 |
|
} |
3026 |
< |
|
3026 |
> |
//!electron-muon pair valueLookup |
3027 |
|
double |
3028 |
< |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function){ |
3028 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function, string &stringValue){ |
3029 |
|
|
3030 |
|
double value = 0.0; |
3031 |
|
|
3032 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3033 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3034 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3035 |
|
else if(variable == "invMass"){ |
3036 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3040 |
|
else if(variable == "pt"){ |
3041 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3042 |
|
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3043 |
< |
value = (fourVector1 + fourVector2).Et(); |
3043 |
> |
value = (fourVector1 + fourVector2).Pt(); |
3044 |
|
} |
3045 |
|
else if(variable == "threeDAngle") |
3046 |
|
{ |
3077 |
|
else if(variable == "muonDetIso"){ |
3078 |
|
value = (object2->trackIsoDR03) / object2->pt; |
3079 |
|
} |
3080 |
+ |
else if(variable == "electronRelPFrhoIso"){ |
3081 |
+ |
value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt; |
3082 |
+ |
} |
3083 |
+ |
else if(variable == "muonRelPFdBetaIso"){ |
3084 |
+ |
value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt; |
3085 |
+ |
} |
3086 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3087 |
+ |
value = applyFunction(function, value); |
3088 |
|
|
3089 |
+ |
return value; |
3090 |
+ |
} |
3091 |
|
|
3092 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3092 |
> |
//!electron-jet pair valueLookup |
3093 |
> |
double |
3094 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3095 |
> |
|
3096 |
> |
double value = 0.0; |
3097 |
> |
|
3098 |
> |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3099 |
> |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3100 |
> |
else if(variable == "jetEta") value = object2->eta; |
3101 |
> |
else if(variable == "jetPhi") value = object2->phi; |
3102 |
> |
else if(variable == "electronEta") value = object1->eta; |
3103 |
> |
else if(variable == "electronPhi") value = object1->phi; |
3104 |
> |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3105 |
> |
else if(variable == "invMass"){ |
3106 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3107 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3108 |
> |
value = (fourVector1 + fourVector2).M(); |
3109 |
> |
} |
3110 |
> |
else if(variable == "pt"){ |
3111 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3112 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3113 |
> |
value = (fourVector1 + fourVector2).Pt(); |
3114 |
> |
} |
3115 |
> |
else if(variable == "threeDAngle") |
3116 |
> |
{ |
3117 |
> |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3118 |
> |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3119 |
> |
value = (threeVector1.Angle(threeVector2)); |
3120 |
> |
} |
3121 |
> |
else if(variable == "chargeProduct"){ |
3122 |
> |
value = object1->charge*object2->charge; |
3123 |
> |
} |
3124 |
> |
|
3125 |
> |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3126 |
> |
value = applyFunction(function, value); |
3127 |
> |
|
3128 |
> |
return value; |
3129 |
> |
} |
3130 |
> |
|
3131 |
> |
//!muon-jet pair valueLookup |
3132 |
> |
double |
3133 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3134 |
> |
|
3135 |
> |
double value = 0.0; |
3136 |
> |
|
3137 |
> |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3138 |
> |
else if(variable == "jetEta") value = object2->eta; |
3139 |
> |
else if(variable == "jetPhi") value = object2->phi; |
3140 |
> |
else if(variable == "muonEta") value = object1->eta; |
3141 |
> |
else if(variable == "muonPhi") value = object1->phi; |
3142 |
> |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3143 |
> |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3144 |
> |
else if(variable == "invMass"){ |
3145 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3146 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3147 |
> |
value = (fourVector1 + fourVector2).M(); |
3148 |
> |
} |
3149 |
> |
else if(variable == "pt"){ |
3150 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3151 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3152 |
> |
value = (fourVector1 + fourVector2).Pt(); |
3153 |
> |
} |
3154 |
> |
else if(variable == "threeDAngle") |
3155 |
> |
{ |
3156 |
> |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3157 |
> |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3158 |
> |
value = (threeVector1.Angle(threeVector2)); |
3159 |
> |
} |
3160 |
> |
else if(variable == "chargeProduct"){ |
3161 |
> |
value = object1->charge*object2->charge; |
3162 |
> |
} |
3163 |
|
|
3164 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3165 |
|
value = applyFunction(function, value); |
3166 |
|
|
3167 |
|
return value; |
3168 |
|
} |
3169 |
|
|
3170 |
+ |
//!jet-jet pair valueLookup |
3171 |
+ |
double |
3172 |
+ |
OSUAnalysis::valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function, string &stringValue){ |
3173 |
|
|
3174 |
+ |
double value = 0.0; |
3175 |
+ |
|
3176 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3177 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3178 |
+ |
else if(variable == "absDeltaPt") value = fabs(object1->pt - object2->pt); |
3179 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3180 |
+ |
else if(variable == "invMass"){ |
3181 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3182 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3183 |
+ |
value = (fourVector1 + fourVector2).M(); |
3184 |
+ |
} |
3185 |
+ |
else if(variable == "pt"){ |
3186 |
+ |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3187 |
+ |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3188 |
+ |
value = (fourVector1 + fourVector2).Pt(); |
3189 |
+ |
} |
3190 |
+ |
else if(variable == "threeDAngle") |
3191 |
+ |
{ |
3192 |
+ |
TVector3 threeVector1(object1->px, object1->py, object1->pz); |
3193 |
+ |
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3194 |
+ |
value = (threeVector1.Angle(threeVector2)); |
3195 |
+ |
} |
3196 |
+ |
else if(variable == "chargeProduct"){ |
3197 |
+ |
value = object1->charge*object2->charge; |
3198 |
+ |
} |
3199 |
+ |
|
3200 |
+ |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3201 |
+ |
value = applyFunction(function, value); |
3202 |
+ |
|
3203 |
+ |
return value; |
3204 |
+ |
} |
3205 |
+ |
//!electron-track pair valueLookup |
3206 |
|
double |
3207 |
< |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){ |
3207 |
> |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3208 |
|
double electronMass = 0.000511; |
3209 |
|
double value = 0.0; |
3210 |
< |
TLorentzVector fourVector1(0, 0, 0, 0); |
3211 |
< |
TLorentzVector fourVector2(0, 0, 0, 0); |
3210 |
> |
TLorentzVector fourVector1(0, 0, 0, 0); |
3211 |
> |
TLorentzVector fourVector2(0, 0, 0, 0); |
3212 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3213 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3214 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3215 |
|
else if(variable == "invMass"){ |
3216 |
|
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass); |
3217 |
|
fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass ); |
3218 |
< |
|
3218 |
> |
|
3219 |
|
value = (fourVector1 + fourVector2).M(); |
3220 |
|
} |
3221 |
< |
|
3221 |
> |
else if(variable == "chargeProduct"){ |
3222 |
> |
value = object1->charge*object2->charge; |
3223 |
> |
} |
3224 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3225 |
|
value = applyFunction(function, value); |
3226 |
|
return value; |
3227 |
+ |
|
3228 |
|
} |
3229 |
|
|
3230 |
+ |
|
3231 |
+ |
//!muon-track pair valueLookup |
3232 |
|
double |
3233 |
< |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){ |
3233 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3234 |
|
double pionMass = 0.140; |
3235 |
|
double muonMass = 0.106; |
3236 |
|
double value = 0.0; |
3237 |
|
TLorentzVector fourVector1(0, 0, 0, 0); |
3238 |
|
TLorentzVector fourVector2(0, 0, 0, 0); |
3239 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3240 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3241 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3242 |
|
else if(variable == "invMass"){ |
3243 |
|
fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass); |
3245 |
|
|
3246 |
|
value = (fourVector1 + fourVector2).M(); |
3247 |
|
} |
3248 |
+ |
else if(variable == "chargeProduct"){ |
3249 |
+ |
value = object1->charge*object2->charge; |
3250 |
+ |
} |
3251 |
|
|
3252 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3253 |
|
value = applyFunction(function, value); |
3254 |
|
return value; |
3255 |
|
} |
3256 |
|
|
3257 |
< |
|
3257 |
> |
//!tau-tau pair valueLookup |
3258 |
|
double |
3259 |
< |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){ |
3259 |
> |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function, string &stringValue){ |
3260 |
|
double value = 0.0; |
3261 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3262 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3263 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3264 |
|
else if(variable == "invMass"){ |
3265 |
< |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3266 |
< |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3267 |
< |
value = (fourVector1 + fourVector2).M(); |
3265 |
> |
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3266 |
> |
TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy); |
3267 |
> |
value = (fourVector1 + fourVector2).M(); |
3268 |
> |
} |
3269 |
> |
|
3270 |
> |
else if(variable == "chargeProduct"){ |
3271 |
> |
value = object1->charge*object2->charge; |
3272 |
|
} |
3273 |
|
|
3274 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3276 |
|
return value; |
3277 |
|
} |
3278 |
|
|
3279 |
+ |
//!muon-tau pair valueLookup |
3280 |
|
double |
3281 |
< |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){ |
3281 |
> |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function, string &stringValue){ |
3282 |
|
double value = 0.0; |
3283 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3284 |
+ |
else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta); |
3285 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3286 |
|
else if(variable == "invMass"){ |
3287 |
|
TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy); |
3289 |
|
value = (fourVector1 + fourVector2).M(); |
3290 |
|
} |
3291 |
|
|
3292 |
+ |
else if(variable == "chargeProduct"){ |
3293 |
+ |
value = object1->charge*object2->charge; |
3294 |
+ |
} |
3295 |
+ |
|
3296 |
+ |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3297 |
+ |
value = applyFunction(function, value); |
3298 |
+ |
return value; |
3299 |
+ |
} |
3300 |
+ |
|
3301 |
+ |
//!tau-track pair valueLookup |
3302 |
+ |
double |
3303 |
+ |
OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function, string &stringValue){ |
3304 |
+ |
double value = 0.0; |
3305 |
+ |
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3306 |
+ |
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3307 |
+ |
else if(variable == "chargeProduct"){ |
3308 |
+ |
value = object1->charge*object2->charge; |
3309 |
+ |
} |
3310 |
+ |
|
3311 |
|
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3312 |
|
value = applyFunction(function, value); |
3313 |
|
return value; |
3314 |
|
} |
3315 |
|
|
3316 |
|
|
3317 |
+ |
//!track-event pair valueLookup |
3318 |
+ |
double |
3319 |
+ |
OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function, string &stringValue){ |
3320 |
+ |
|
3321 |
+ |
double value = 0.0; |
3322 |
+ |
double pMag = sqrt(object1->pt * object1->pt + |
3323 |
+ |
object1->pz * object1->pz); |
3324 |
+ |
|
3325 |
+ |
if (variable == "numPV") value = object2->numPV; |
3326 |
+ |
else if (variable == "caloTotDeltaRp5") value = (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5); |
3327 |
+ |
else if (variable == "caloTotDeltaRp5ByP") value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag); |
3328 |
+ |
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
3329 |
+ |
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
3330 |
+ |
|
3331 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3332 |
+ |
|
3333 |
+ |
value = applyFunction(function, value); |
3334 |
+ |
|
3335 |
+ |
return value; |
3336 |
+ |
|
3337 |
+ |
} |
3338 |
+ |
|
3339 |
+ |
//!electron-trigobj pair valueLookup |
3340 |
+ |
double |
3341 |
+ |
OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){ |
3342 |
+ |
|
3343 |
+ |
double value = 0.0; |
3344 |
+ |
|
3345 |
+ |
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3346 |
+ |
else if (variable == "match"){ |
3347 |
+ |
if (deltaR(object1->eta,object1->phi,object2->eta,object2->phi) < 0.2 && abs(object2->id) == 11) |
3348 |
+ |
stringValue = object2->filter; |
3349 |
+ |
else |
3350 |
+ |
stringValue = "none"; |
3351 |
+ |
} |
3352 |
+ |
|
3353 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3354 |
+ |
|
3355 |
+ |
value = applyFunction(function, value); |
3356 |
+ |
|
3357 |
+ |
return value; |
3358 |
+ |
|
3359 |
+ |
} |
3360 |
+ |
|
3361 |
+ |
//!muon-trigobj pair valueLookup |
3362 |
+ |
double |
3363 |
+ |
OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){ |
3364 |
+ |
|
3365 |
+ |
double value = 0.0; |
3366 |
+ |
|
3367 |
+ |
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3368 |
+ |
|
3369 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3370 |
+ |
|
3371 |
+ |
value = applyFunction(function, value); |
3372 |
+ |
|
3373 |
+ |
return value; |
3374 |
+ |
|
3375 |
+ |
} |
3376 |
+ |
|
3377 |
+ |
//!stop valueLookup |
3378 |
+ |
double |
3379 |
+ |
OSUAnalysis::valueLookup (const BNstop* object, string variable, string function, string &stringValue){ |
3380 |
+ |
|
3381 |
+ |
|
3382 |
+ |
double value = 0.0; |
3383 |
+ |
|
3384 |
+ |
if(variable == "ctau") value = object->ctau; |
3385 |
+ |
|
3386 |
+ |
else if (variable == "d0"){ |
3387 |
+ |
double vx = object->vx - chosenVertex ()->x, |
3388 |
+ |
vy = object->vy - chosenVertex ()->y, |
3389 |
+ |
px = object->px, |
3390 |
+ |
py = object->py, |
3391 |
+ |
pt = object->pt; |
3392 |
+ |
value = (-vx * py + vy * px) / pt; |
3393 |
+ |
} |
3394 |
+ |
|
3395 |
+ |
else if (variable == "dz"){ |
3396 |
+ |
double vx = object->vx - chosenVertex ()->x, |
3397 |
+ |
vy = object->vy - chosenVertex ()->y, |
3398 |
+ |
vz = object->vz - chosenVertex ()->z, |
3399 |
+ |
px = object->px, |
3400 |
+ |
py = object->py, |
3401 |
+ |
pz = object->pz, |
3402 |
+ |
pt = object->pt; |
3403 |
+ |
value = vz - (vx * px + vy * py)/pt * (pz/pt); |
3404 |
+ |
} |
3405 |
+ |
|
3406 |
+ |
else if (variable == "minD0"){ |
3407 |
+ |
double minD0=999; |
3408 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3409 |
+ |
double vx = object->vx - vertex->x, |
3410 |
+ |
vy = object->vy - vertex->y, |
3411 |
+ |
px = object->px, |
3412 |
+ |
py = object->py, |
3413 |
+ |
pt = object->pt; |
3414 |
+ |
value = (-vx * py + vy * px) / pt; |
3415 |
+ |
if(abs(value) < abs(minD0)) minD0 = value; |
3416 |
+ |
} |
3417 |
+ |
value = minD0; |
3418 |
+ |
} |
3419 |
+ |
else if (variable == "minDz"){ |
3420 |
+ |
double minDz=999; |
3421 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3422 |
+ |
double vx = object->vx - vertex->x, |
3423 |
+ |
vy = object->vy - vertex->y, |
3424 |
+ |
vz = object->vz - vertex->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 |
+ |
if(abs(value) < abs(minDz)) minDz = value; |
3431 |
+ |
} |
3432 |
+ |
value = minDz; |
3433 |
+ |
} |
3434 |
+ |
else if(variable == "distToVertex"){ |
3435 |
+ |
value = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3436 |
+ |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3437 |
+ |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3438 |
+ |
} |
3439 |
+ |
else if (variable == "minDistToVertex"){ |
3440 |
+ |
double minDistToVertex=999; |
3441 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3442 |
+ |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3443 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3444 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3445 |
+ |
|
3446 |
+ |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3447 |
+ |
} |
3448 |
+ |
value = minDistToVertex; |
3449 |
+ |
} |
3450 |
+ |
else if (variable == "distToVertexDifference"){ |
3451 |
+ |
double minDistToVertex=999; |
3452 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3453 |
+ |
value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3454 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3455 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3456 |
+ |
|
3457 |
+ |
if(abs(value) < abs(minDistToVertex)) minDistToVertex = value; |
3458 |
+ |
} |
3459 |
+ |
double distToChosenVertex = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \ |
3460 |
+ |
(object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \ |
3461 |
+ |
(object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z)); |
3462 |
+ |
|
3463 |
+ |
value = distToChosenVertex - minDistToVertex; |
3464 |
+ |
} |
3465 |
+ |
|
3466 |
+ |
else if (variable == "closestVertexRank"){ |
3467 |
+ |
double minDistToVertex=999; |
3468 |
+ |
int vertex_rank = 0; |
3469 |
+ |
for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){ |
3470 |
+ |
vertex_rank++; |
3471 |
+ |
int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \ |
3472 |
+ |
(object->vy-vertex->y)*(object->vy-vertex->y) + \ |
3473 |
+ |
(object->vz-vertex->z)*(object->vz-vertex->z)); |
3474 |
+ |
|
3475 |
+ |
if(abs(dist) < abs(minDistToVertex)){ |
3476 |
+ |
value = vertex_rank; |
3477 |
+ |
minDistToVertex = dist; |
3478 |
+ |
} |
3479 |
+ |
} |
3480 |
+ |
} |
3481 |
+ |
|
3482 |
+ |
|
3483 |
+ |
|
3484 |
+ |
|
3485 |
+ |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3486 |
+ |
|
3487 |
+ |
value = applyFunction(function, value); |
3488 |
+ |
|
3489 |
+ |
return value; |
3490 |
+ |
|
3491 |
+ |
} |
3492 |
+ |
|
3493 |
+ |
|
3494 |
+ |
|
3495 |
|
|
3496 |
|
// Calculate the number of tracks in cone of DeltaR<0.5 around track1. |
3497 |
|
// Return true iff no other tracks are found in this cone. |
3538 |
|
|
3539 |
|
} |
3540 |
|
|
3541 |
+ |
double |
3542 |
+ |
OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) { |
3543 |
+ |
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
3544 |
+ |
if (!useTrackCaloRhoCorr_) return -99; |
3545 |
+ |
// if (!rhokt6CaloJetsHandle_) { |
3546 |
+ |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
3547 |
+ |
// return -99; |
3548 |
+ |
// } |
3549 |
+ |
double radDeltaRCone = 0.5; |
3550 |
+ |
double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2); // Define effective area as pi*r^2, where r is radius of DeltaR cone. |
3551 |
+ |
double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5; |
3552 |
+ |
double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets); |
3553 |
+ |
return caloTotRhoCorrCalo; |
3554 |
+ |
|
3555 |
+ |
} |
3556 |
+ |
|
3557 |
+ |
|
3558 |
+ |
|
3559 |
+ |
|
3560 |
|
//creates a map of the dead Ecal channels in the barrel and endcap |
3561 |
|
//to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here: |
3562 |
|
//http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup |
3589 |
|
double deltaRLowest = 999; |
3590 |
|
int value = 0; |
3591 |
|
if (DeadEcalVec.size() == 0) WriteDeadEcal(); |
3592 |
< |
for(std::vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
3592 |
> |
for(vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){ |
3593 |
|
double eta = ecal->etaEcal; |
3594 |
|
double phi = ecal->phiEcal; |
3595 |
< |
double deltaRtemp = deltaR(eta, track1->eta, phi, track1->phi); |
3595 |
> |
double deltaRtemp = deltaR(eta, phi, track1->eta, track1->phi); |
3596 |
|
if(deltaRtemp < deltaRLowest) deltaRLowest = deltaRtemp; |
3597 |
|
} |
3598 |
|
if (deltaRLowest<0.05) {value = 1;} |
3600 |
|
return value; |
3601 |
|
} |
3602 |
|
|
3603 |
< |
|
2757 |
< |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
3603 |
> |
// Returns the smallest DeltaR between the object and any generated true particle in the event. |
3604 |
|
template <class InputObject> |
3605 |
|
double OSUAnalysis::getGenDeltaRLowest(InputObject object){ |
3606 |
|
double genDeltaRLowest = 999.; |
3607 |
|
for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){ |
3608 |
|
double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi); |
3609 |
|
if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp; |
3610 |
< |
} |
3610 |
> |
} |
3611 |
|
return genDeltaRLowest; |
3612 |
|
} |
3613 |
|
|
2768 |
– |
|
3614 |
|
double |
3615 |
|
OSUAnalysis::applyFunction(string function, double value){ |
3616 |
|
|
3620 |
|
else if(function == "log") value = log10(value); |
3621 |
|
|
3622 |
|
else if(function == "") value = value; |
3623 |
< |
else{std::cout << "WARNING: invalid function '" << function << "'\n";} |
3623 |
> |
else{cout << "WARNING: invalid function '" << function << "'\n";} |
3624 |
|
|
3625 |
|
return value; |
3626 |
|
|
3630 |
|
template <class InputCollection> |
3631 |
|
void OSUAnalysis::setObjectFlags(cut ¤tCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){ |
3632 |
|
|
3633 |
+ |
if (currentCut.inputCollection.find("pair")!=string::npos) { |
3634 |
+ |
string obj1, obj2; |
3635 |
+ |
getTwoObjs(currentCut.inputCollection, obj1, obj2); |
3636 |
+ |
if (inputType==obj1 || |
3637 |
+ |
inputType==obj2) { |
3638 |
+ |
// Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection, |
3639 |
+ |
// and the inputType is a member of the pair. |
3640 |
+ |
// The cut will instead be applied when the setObjectFlags() is called for the paired collection. |
3641 |
+ |
// For example, if currentCut.inputCollection==electron-muon pairs, |
3642 |
+ |
// then the flags should not be set here when inputType==muons or inputType==electrons. |
3643 |
+ |
return; |
3644 |
+ |
} |
3645 |
+ |
} |
3646 |
|
|
3647 |
|
for (uint object = 0; object != inputCollection->size(); object++){ |
3648 |
|
|
2791 |
– |
|
3649 |
|
bool decision = true;//object passes if this cut doesn't cut on that type of object |
3650 |
|
|
2794 |
– |
|
3651 |
|
if(currentCut.inputCollection == inputType){ |
3652 |
|
|
3653 |
|
vector<bool> subcutDecisions; |
3654 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
3655 |
< |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
3656 |
< |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3655 |
> |
string stringValue = ""; |
3656 |
> |
double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
3657 |
> |
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3658 |
> |
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
3659 |
> |
|
3660 |
|
} |
3661 |
|
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
3662 |
|
else{ |
3670 |
|
decision = tempDecision; |
3671 |
|
} |
3672 |
|
} |
2814 |
– |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3673 |
|
|
3674 |
+ |
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3675 |
|
|
3676 |
|
//set flags for objects that pass each cut AND all the previous cuts |
3677 |
|
bool previousCumulativeFlag = true; |
3681 |
|
} |
3682 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision); |
3683 |
|
|
2825 |
– |
|
3684 |
|
} |
3685 |
|
|
3686 |
|
} |
3694 |
|
bool sameObjects = false; |
3695 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3696 |
|
|
3697 |
+ |
// Get the strings for the two objects that make up the pair. |
3698 |
+ |
string obj1Type, obj2Type; |
3699 |
+ |
getTwoObjs(inputType, obj1Type, obj2Type); |
3700 |
+ |
bool isTwoTypesOfObject = true; |
3701 |
+ |
if (obj1Type==obj2Type) isTwoTypesOfObject = false; |
3702 |
+ |
|
3703 |
+ |
// Initialize the flags for individual objects to all be false, if the cut is on the pair. |
3704 |
+ |
// Set them to true later, if any paired object passes (in which case both of its constituents should pass). |
3705 |
+ |
if (currentCut.inputCollection == inputType) { |
3706 |
+ |
for (uint object1 = 0; object1 != inputCollection1->size(); object1++) { |
3707 |
+ |
individualFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3708 |
+ |
cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(false); |
3709 |
+ |
} |
3710 |
+ |
if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first. |
3711 |
+ |
for (uint object2 = 0; object2 != inputCollection2->size(); object2++) { |
3712 |
+ |
individualFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3713 |
+ |
cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false); |
3714 |
+ |
} |
3715 |
+ |
} |
3716 |
+ |
} |
3717 |
|
|
3718 |
|
int counter = 0; |
3719 |
+ |
|
3720 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3721 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3722 |
|
|
3729 |
|
|
3730 |
|
vector<bool> subcutDecisions; |
3731 |
|
for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){ |
3732 |
< |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex)); |
3733 |
< |
subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3732 |
> |
string stringValue = ""; |
3733 |
> |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue); |
3734 |
> |
if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex))); |
3735 |
> |
else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex))); |
3736 |
|
} |
3737 |
|
|
3738 |
|
if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0); |
3747 |
|
decision = tempDecision; |
3748 |
|
} |
3749 |
|
} |
3750 |
+ |
// if (decision) isPassObj1.at(object1) = true; |
3751 |
+ |
// if (decision) isPassObj2.at(object2) = true; |
3752 |
|
individualFlags.at(inputType).at(currentCutIndex).push_back(decision); |
3753 |
+ |
if (decision && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3754 |
+ |
individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true; |
3755 |
+ |
individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true; |
3756 |
+ |
} |
3757 |
|
|
3758 |
|
//set flags for objects that pass each cut AND all the previous cuts |
3759 |
|
bool previousCumulativeFlag = true; |
3768 |
|
else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1); |
3769 |
|
else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2); |
3770 |
|
cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag); |
3771 |
< |
|
3771 |
> |
if (currentCumulativeFlag && currentCut.inputCollection == inputType) { // only set the flags for the individual objects if the pair object is being cut on |
3772 |
> |
cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1); |
3773 |
> |
cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2); |
3774 |
> |
} |
3775 |
|
counter++; |
2886 |
– |
} |
3776 |
|
|
3777 |
+ |
} // end for (uint object2 = 0; object2 != inputCollection2->size(); object2++) |
3778 |
+ |
} // end for (uint object1 = 0; object1 != inputCollection1->size(); object1++) |
3779 |
+ |
|
3780 |
+ |
} |
3781 |
+ |
|
3782 |
+ |
|
3783 |
+ |
bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1) { |
3784 |
+ |
// Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for |
3785 |
+ |
// all cuts up to currentCutIndex |
3786 |
+ |
bool previousCumulativeFlag = true; |
3787 |
+ |
for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) { |
3788 |
+ |
if (previousCumulativeFlag && individualFlags.at(obj1Type).at(previousCutIndex).at(object1)) previousCumulativeFlag = true; |
3789 |
+ |
else { |
3790 |
+ |
previousCumulativeFlag = false; break; |
3791 |
+ |
} |
3792 |
|
} |
3793 |
+ |
return previousCumulativeFlag; |
3794 |
+ |
} |
3795 |
+ |
|
3796 |
+ |
|
3797 |
+ |
|
3798 |
+ |
template <class InputCollection> |
3799 |
+ |
void OSUAnalysis::assignTreeBranch(BranchSpecs parameters, InputCollection inputCollection, vector<bool> flags){ |
3800 |
+ |
// This function is similar to fill1DHistogram(), but instead of filling a histogram it assigns a value to a variable for the BNTree |
3801 |
+ |
|
3802 |
+ |
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; |
3803 |
+ |
for (uint object = 0; object != inputCollection->size(); object++) { |
3804 |
|
|
3805 |
+ |
if (!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
3806 |
|
|
3807 |
+ |
string inputVariable = parameters.inputVariable; |
3808 |
+ |
string function = ""; |
3809 |
+ |
string stringValue = ""; |
3810 |
+ |
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3811 |
+ |
BNTreeBranchVals_.at(parameters.name).push_back(value); |
3812 |
+ |
|
3813 |
+ |
} |
3814 |
|
} |
3815 |
|
|
3816 |
|
|
3824 |
|
string currentString = parameters.inputVariables.at(0); |
3825 |
|
string inputVariable = ""; |
3826 |
|
string function = ""; |
3827 |
< |
if(currentString.find("(")==std::string::npos){ |
3827 |
> |
if(currentString.find("(")==string::npos){ |
3828 |
|
inputVariable = currentString;// variable to cut on |
3829 |
|
} |
3830 |
|
else{ |
3831 |
|
function = currentString.substr(0,currentString.find("("));//function comes before the "(" |
3832 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3833 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3834 |
< |
} |
3834 |
> |
} |
3835 |
|
|
3836 |
< |
double value = valueLookup(&inputCollection->at(object), inputVariable, function); |
3837 |
< |
histo->Fill(value,scaleFactor); |
3836 |
> |
string stringValue = ""; |
3837 |
> |
double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3838 |
> |
histo->Fill(value,scaleFactor); |
3839 |
|
|
3840 |
|
if (printEventInfo_) { |
3841 |
< |
// Write information about event to screen, for testing purposes. |
3842 |
< |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
3841 |
> |
// Write information about event to screen, for testing purposes. |
3842 |
> |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
3843 |
|
} |
3844 |
< |
|
3844 |
> |
|
3845 |
|
} |
3846 |
|
} |
3847 |
|
|
3851 |
|
bool sameObjects = false; |
3852 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3853 |
|
|
3854 |
< |
int pairCounter = 0; |
3854 |
> |
int pairCounter = -1; |
3855 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3856 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3857 |
|
|
3858 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3859 |
|
|
3860 |
+ |
pairCounter++; |
3861 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3862 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3863 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3866 |
|
string currentString = parameters.inputVariables.at(0); |
3867 |
|
string inputVariable = ""; |
3868 |
|
string function = ""; |
3869 |
< |
if(currentString.find("(")==std::string::npos){ |
3869 |
> |
if(currentString.find("(")==string::npos){ |
3870 |
|
inputVariable = currentString;// variable to cut on |
3871 |
|
} |
3872 |
|
else{ |
3875 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3876 |
|
} |
3877 |
|
|
3878 |
< |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3878 |
> |
string stringValue = ""; |
3879 |
> |
double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
3880 |
|
histo->Fill(value,scaleFactor); |
3881 |
|
|
2956 |
– |
pairCounter++; |
3882 |
|
} |
3883 |
|
} |
3884 |
|
|
3892 |
|
|
3893 |
|
if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue; |
3894 |
|
|
3895 |
+ |
string stringValue = ""; |
3896 |
|
string currentString = parameters.inputVariables.at(0); |
3897 |
|
string inputVariable = ""; |
3898 |
|
string function = ""; |
3899 |
< |
if(currentString.find("(")==std::string::npos){ |
3899 |
> |
if(currentString.find("(")==string::npos){ |
3900 |
|
inputVariable = currentString;// variable to cut on |
3901 |
|
} |
3902 |
|
else{ |
3904 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3905 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3906 |
|
} |
3907 |
< |
double valueX = valueLookup(&inputCollection->at(object), inputVariable, function); |
3907 |
> |
double valueX = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3908 |
|
|
3909 |
|
currentString = parameters.inputVariables.at(1); |
3910 |
|
inputVariable = ""; |
3911 |
|
function = ""; |
3912 |
< |
if(currentString.find("(")==std::string::npos){ |
3912 |
> |
if(currentString.find("(")==string::npos){ |
3913 |
|
inputVariable = currentString;// variable to cut on |
3914 |
|
} |
3915 |
|
else{ |
3918 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3919 |
|
} |
3920 |
|
|
3921 |
< |
double valueY = valueLookup(&inputCollection->at(object), inputVariable, function); |
3921 |
> |
double valueY = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue); |
3922 |
|
|
3923 |
|
histo->Fill(valueX,valueY,scaleFactor); |
3924 |
|
|
3932 |
|
bool sameObjects = false; |
3933 |
|
if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true; |
3934 |
|
|
3935 |
< |
int pairCounter = 0; |
3935 |
> |
int pairCounter = -1; |
3936 |
|
for (uint object1 = 0; object1 != inputCollection1->size(); object1++){ |
3937 |
|
for (uint object2 = 0; object2 != inputCollection2->size(); object2++){ |
3938 |
|
|
3939 |
|
if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same |
3940 |
|
|
3941 |
+ |
pairCounter++; |
3942 |
+ |
|
3943 |
|
//only take objects which have passed all cuts and pairs which have passed all cuts |
3944 |
|
if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue; |
3945 |
|
if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue; |
3946 |
|
if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue; |
3947 |
|
|
3948 |
+ |
string stringValue = ""; |
3949 |
|
string currentString = parameters.inputVariables.at(0); |
3950 |
|
string inputVariable = ""; |
3951 |
|
string function = ""; |
3952 |
< |
if(currentString.find("(")==std::string::npos){ |
3952 |
> |
if(currentString.find("(")==string::npos){ |
3953 |
|
inputVariable = currentString;// variable to cut on |
3954 |
|
} |
3955 |
|
else{ |
3957 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3958 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3959 |
|
} |
3960 |
< |
double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3960 |
> |
double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
3961 |
|
|
3962 |
|
currentString = parameters.inputVariables.at(1); |
3963 |
|
inputVariable = ""; |
3964 |
|
function = ""; |
3965 |
< |
if(currentString.find("(")==std::string::npos){ |
3965 |
> |
if(currentString.find("(")==string::npos){ |
3966 |
|
inputVariable = currentString;// variable to cut on |
3967 |
|
} |
3968 |
|
else{ |
3970 |
|
inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string |
3971 |
|
inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")" |
3972 |
|
} |
3973 |
< |
double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function); |
3973 |
> |
double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue); |
3974 |
|
|
3975 |
|
|
3976 |
|
histo->Fill(valueX,valueY,scaleFactor); |
3977 |
|
|
3049 |
– |
pairCounter++; |
3050 |
– |
|
3978 |
|
} |
3979 |
|
} |
3980 |
|
|
3991 |
|
|
3992 |
|
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
3993 |
|
if(currentDeltaR > 0.05) continue; |
3994 |
< |
// cout << std::setprecision(3) << std::setw(20) |
3995 |
< |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3996 |
< |
// << std::setw(20) |
3997 |
< |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3998 |
< |
// << std::setw(20) |
3999 |
< |
// << "\tdeltaR = " << currentDeltaR |
4000 |
< |
// << std::setprecision(1) |
4001 |
< |
// << std::setw(20) |
4002 |
< |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
4003 |
< |
// << std::setw(20) |
4004 |
< |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
4005 |
< |
// << std::setw(20) |
4006 |
< |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
3994 |
> |
// cout << setprecision(3) << setw(20) |
3995 |
> |
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
3996 |
> |
// << setw(20) |
3997 |
> |
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
3998 |
> |
// << setw(20) |
3999 |
> |
// << "\tdeltaR = " << currentDeltaR |
4000 |
> |
// << setprecision(1) |
4001 |
> |
// << setw(20) |
4002 |
> |
// << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id |
4003 |
> |
// << setw(20) |
4004 |
> |
// << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId |
4005 |
> |
// << setw(20) |
4006 |
> |
// << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl; |
4007 |
|
if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){ |
4008 |
|
bestMatchIndex = mcparticle - mcparticles->begin(); |
4009 |
|
bestMatchDeltaR = currentDeltaR; |
4010 |
|
} |
4011 |
|
|
4012 |
|
} |
4013 |
< |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
4014 |
< |
// else cout << "no match found..." << endl; |
4013 |
> |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
4014 |
> |
// else cout << "no match found..." << endl; |
4015 |
|
return bestMatchIndex; |
4016 |
|
|
4017 |
|
} |
4065 |
|
// 20 strange baryon |
4066 |
|
// 21 charm baryon |
4067 |
|
// 22 bottom baryon |
4068 |
< |
// 23 other |
4068 |
> |
// 23 QCD string |
4069 |
> |
// 24 other |
4070 |
|
|
4071 |
|
int OSUAnalysis::getPdgIdBinValue(int pdgId){ |
4072 |
|
|
4090 |
|
else if(absPdgId > 3000 && absPdgId < 4000 ) binValue = 20; |
4091 |
|
else if(absPdgId > 4000 && absPdgId < 5000 ) binValue = 21; |
4092 |
|
else if(absPdgId > 5000 && absPdgId < 6000 ) binValue = 22; |
4093 |
+ |
else if(absPdgId == 92 ) binValue = 23; |
4094 |
|
|
4095 |
< |
else binValue = 23; |
4095 |
> |
else binValue = 24; |
4096 |
|
|
4097 |
|
return binValue; |
4098 |
|
|
4102 |
|
OSUAnalysis::chosenVertex () |
4103 |
|
{ |
4104 |
|
const BNprimaryvertex *chosenVertex = 0; |
4105 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) { |
4106 |
< |
vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() : |
4107 |
< |
cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2); |
4105 |
> |
if(cumulativeFlags.find ("primaryvertexs") != cumulativeFlags.end ()){ |
4106 |
> |
vector<bool> vertexFlags; |
4107 |
> |
for (int i = cumulativeFlags.at("primaryvertexs").size() - 1; i >= 0; i--){ |
4108 |
> |
if (cumulativeFlags.at("primaryvertexs").at(i).size()){ |
4109 |
> |
vertexFlags = cumulativeFlags.at("primaryvertexs").at(i); |
4110 |
> |
break; |
4111 |
> |
} |
4112 |
> |
} |
4113 |
|
for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){ |
4114 |
|
if(!vertexFlags.at(vertexIndex)) continue; |
4115 |
|
chosenVertex = & primaryvertexs->at(vertexIndex); |
4116 |
|
break; |
4117 |
|
} |
4118 |
|
} |
4119 |
< |
else { |
4120 |
< |
chosenVertex = &primaryvertexs->at(0); |
3187 |
< |
} |
4119 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "primaryvertexs") != objectsToGet.end ()) |
4120 |
> |
chosenVertex = & primaryvertexs->at (0); |
4121 |
|
|
4122 |
|
return chosenVertex; |
4123 |
|
} |
4126 |
|
OSUAnalysis::chosenMET () |
4127 |
|
{ |
4128 |
|
const BNmet *chosenMET = 0; |
4129 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) { |
4130 |
< |
vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() : |
4131 |
< |
cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2); |
4129 |
> |
if(cumulativeFlags.find ("mets") != cumulativeFlags.end ()){ |
4130 |
> |
vector<bool> metFlags; |
4131 |
> |
for (int i = cumulativeFlags.at("mets").size() - 1; i >= 0; i--){ |
4132 |
> |
if (cumulativeFlags.at("mets").at(i).size()){ |
4133 |
> |
metFlags = cumulativeFlags.at("mets").at(i); |
4134 |
> |
break; |
4135 |
> |
} |
4136 |
> |
} |
4137 |
|
for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){ |
4138 |
|
if(!metFlags.at(metIndex)) continue; |
4139 |
|
chosenMET = & mets->at(metIndex); |
4140 |
|
break; |
4141 |
|
} |
4142 |
|
} |
4143 |
< |
else { |
4144 |
< |
chosenMET = &mets->at(0); |
3207 |
< |
} |
4143 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "mets") != objectsToGet.end ()) |
4144 |
> |
chosenMET = & mets->at (0); |
4145 |
|
|
4146 |
|
return chosenMET; |
4147 |
|
} |
4150 |
|
OSUAnalysis::chosenElectron () |
4151 |
|
{ |
4152 |
|
const BNelectron *chosenElectron = 0; |
4153 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) { |
4154 |
< |
vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() : |
4155 |
< |
cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2); |
4153 |
> |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
4154 |
> |
vector<bool> electronFlags; |
4155 |
> |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
4156 |
> |
if (cumulativeFlags.at("electrons").at(i).size()){ |
4157 |
> |
electronFlags = cumulativeFlags.at("electrons").at(i); |
4158 |
> |
break; |
4159 |
> |
} |
4160 |
> |
} |
4161 |
|
for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){ |
4162 |
|
if(!electronFlags.at(electronIndex)) continue; |
4163 |
|
chosenElectron = & electrons->at(electronIndex); |
4164 |
|
break; |
4165 |
|
} |
4166 |
|
} |
4167 |
< |
else { |
4168 |
< |
chosenElectron = &electrons->at(0); |
3227 |
< |
} |
4167 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "electrons") != objectsToGet.end ()) |
4168 |
> |
chosenElectron = & electrons->at (0); |
4169 |
|
|
4170 |
|
return chosenElectron; |
4171 |
|
} |
4174 |
|
OSUAnalysis::chosenMuon () |
4175 |
|
{ |
4176 |
|
const BNmuon *chosenMuon = 0; |
4177 |
< |
if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) { |
4178 |
< |
vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() : |
4179 |
< |
cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2); |
4177 |
> |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
4178 |
> |
vector<bool> muonFlags; |
4179 |
> |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
4180 |
> |
if (cumulativeFlags.at("muons").at(i).size()){ |
4181 |
> |
muonFlags = cumulativeFlags.at("muons").at(i); |
4182 |
> |
break; |
4183 |
> |
} |
4184 |
> |
} |
4185 |
|
for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){ |
4186 |
|
if(!muonFlags.at(muonIndex)) continue; |
4187 |
|
chosenMuon = & muons->at(muonIndex); |
4188 |
|
break; |
4189 |
|
} |
4190 |
|
} |
4191 |
< |
else { |
4192 |
< |
chosenMuon = &muons->at(0); |
3247 |
< |
} |
4191 |
> |
else if (find (objectsToGet.begin (), objectsToGet.end (), "muons") != objectsToGet.end ()) |
4192 |
> |
chosenMuon = & muons->at (0); |
4193 |
|
|
4194 |
|
return chosenMuon; |
4195 |
|
} |
4196 |
|
|
3252 |
– |
|
4197 |
|
DEFINE_FWK_MODULE(OSUAnalysis); |