6 |
|
#include <string> |
7 |
|
#include <vector> |
8 |
|
|
9 |
+ |
#include <fstream> |
10 |
+ |
#include <iostream> |
11 |
+ |
#include <algorithm> |
12 |
+ |
#include <regex> |
13 |
+ |
#include "TH1.h" |
14 |
+ |
#include "TH2.h" |
15 |
|
#include "TH1D.h" |
16 |
|
#include "TH2D.h" |
17 |
|
#include "TLorentzVector.h" |
24 |
|
#include "DataFormats/Common/interface/Handle.h" |
25 |
|
#include "CommonTools/UtilAlgos/interface/TFileService.h" |
26 |
|
#include "FWCore/Framework/interface/MakerMacros.h" |
27 |
+ |
#include "DataFormats/Math/interface/deltaPhi.h" |
28 |
+ |
#include "DataFormats/Math/interface/deltaR.h" |
29 |
|
|
30 |
|
#include "ProductArea/BNcollections/interface/BNbxlumi.h" |
31 |
|
#include "ProductArea/BNcollections/interface/BNelectron.h" |
44 |
|
#include "ProductArea/BNcollections/interface/BNtau.h" |
45 |
|
#include "ProductArea/BNcollections/interface/BNgenjet.h" |
46 |
|
|
39 |
– |
#include "OSUT3Analysis/AnaTools/interface/CutFlow.h" |
40 |
– |
|
47 |
|
|
48 |
+ |
#include "OSUT3Analysis/AnaTools/interface/CutFlow.h" |
49 |
+ |
#include "OSUT3Analysis/AnaTools/interface/PUWeight.h" |
50 |
+ |
#include "OSUT3Analysis/AnaTools/interface/SFWeight.h" |
51 |
|
|
52 |
+ |
#include "OSUT3Analysis/AnaTools/interface/StopCTauWeight.h" |
53 |
|
|
54 |
|
using namespace std; |
55 |
|
|
61 |
|
|
62 |
|
void analyze (const edm::Event &, const edm::EventSetup &); |
63 |
|
bool evaluateComparison (double, string, double); |
64 |
+ |
bool evaluateComparison (string, string, string); |
65 |
+ |
bool evaluateTriggers (vector<string>,const BNtriggerCollection*); |
66 |
+ |
double applyFunction(string, double); |
67 |
+ |
|
68 |
+ |
double valueLookup (const BNjet* object, string variable, string function, string &stringValue); |
69 |
+ |
double valueLookup (const BNmuon* object, string variable, string function, string &stringValue); |
70 |
+ |
double valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function, string &stringValue); |
71 |
+ |
double valueLookup (const BNelectron* object, string variable, string function, string &stringValue); |
72 |
+ |
double valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue); |
73 |
+ |
double valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function, string &stringValue); |
74 |
+ |
double valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue); |
75 |
+ |
double valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function, string &stringValue); |
76 |
+ |
double valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue); |
77 |
+ |
double valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue); |
78 |
+ |
double valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function, string &stringValue); |
79 |
+ |
double valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function, string &stringValue); |
80 |
+ |
double valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function, string &stringValue); |
81 |
+ |
double valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function, string &stringValue); |
82 |
+ |
double valueLookup (const BNevent* object, string variable, string function, string &stringValue); |
83 |
+ |
double valueLookup (const BNtau* object, string variable, string function, string &stringValue); |
84 |
+ |
double valueLookup (const BNmet* object, string variable, string function, string &stringValue); |
85 |
+ |
double valueLookup (const BNtrack* object, string variable, string function, string &stringValue); |
86 |
+ |
double valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function, string &stringValue); |
87 |
+ |
double valueLookup (const BNgenjet* object, string variable, string function, string &stringValue); |
88 |
+ |
double valueLookup (const BNmcparticle* object, string variable, string function, string &stringValue); |
89 |
+ |
double valueLookup (const BNprimaryvertex* object, string variable, string function, string &stringValue); |
90 |
+ |
double valueLookup (const BNbxlumi* object, string variable, string function, string &stringValue); |
91 |
+ |
double valueLookup (const BNphoton* object, string variable, string function, string &stringValue); |
92 |
+ |
double valueLookup (const BNsupercluster* object, string variable, string function, string &stringValue); |
93 |
+ |
double valueLookup (const BNtrigobj* object, string variable, string function, string &stringValue); |
94 |
+ |
double valueLookup (const BNelectron* object1, const BNtrigobj* object2, string variable, string function, string &stringValue); |
95 |
+ |
double valueLookup (const BNmuon* object1, const BNtrigobj* object2, string variable, string function, string &stringValue); |
96 |
+ |
double valueLookup (const BNstop* object, string variable, string function, string &stringValue); |
97 |
+ |
|
98 |
+ |
int getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl); |
99 |
+ |
double getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl); |
100 |
+ |
double getTrkPtRes (const BNtrack* track1); |
101 |
+ |
double getTrkIsIso (const BNtrack* track1); |
102 |
+ |
double getTrkCaloTotRhoCorr(const BNtrack* track); |
103 |
+ |
void WriteDeadEcal (); |
104 |
+ |
int getTrkIsMatchedDeadEcal (const BNtrack* track1); |
105 |
|
|
55 |
– |
double valueLookup (const BNjet*, string); |
56 |
– |
double valueLookup (const BNmuon*, string); |
57 |
– |
double valueLookup (const BNelectron*, string); |
58 |
– |
double valueLookup (const BNevent*, string); |
59 |
– |
double valueLookup (const BNtau*, string); |
60 |
– |
double valueLookup (const BNmet*, string); |
61 |
– |
double valueLookup (const BNtrack*, string); |
62 |
– |
double valueLookup (const BNgenjet*, string); |
63 |
– |
double valueLookup (const BNmcparticle*, string); |
64 |
– |
double valueLookup (const BNprimaryvertex*, string); |
65 |
– |
double valueLookup (const BNbxlumi*, string); |
66 |
– |
double valueLookup (const BNphoton*, string); |
67 |
– |
double valueLookup (const BNsupercluster*, string); |
106 |
|
//BNskimbits |
69 |
– |
//BNtrigger |
107 |
|
//BNtrigobj |
108 |
|
|
109 |
|
vector<string> splitString (string); |
110 |
< |
|
110 |
> |
void getTwoObjs(string tempInputCollection, string& obj1, string& obj2); |
111 |
> |
string getObjToGet(string obj); |
112 |
|
|
113 |
|
private: |
114 |
|
|
118 |
|
//inner vector corresponds to each object in input collection |
119 |
|
//bool tells if object passes or fails cuts |
120 |
|
typedef map<string, vector < vector<bool> > > flagMap; |
121 |
< |
|
121 |
> |
|
122 |
|
//counterMap: |
123 |
|
//string holds input collection type |
124 |
|
//vector corresponds to each cut |
135 |
|
edm::InputTag tracks_; |
136 |
|
edm::InputTag genjets_; |
137 |
|
edm::InputTag mcparticles_; |
138 |
+ |
edm::InputTag stops_; |
139 |
|
edm::InputTag primaryvertexs_; |
140 |
|
edm::InputTag bxlumis_; |
141 |
|
edm::InputTag photons_; |
142 |
|
edm::InputTag superclusters_; |
143 |
+ |
edm::InputTag triggers_; |
144 |
+ |
edm::InputTag trigobjs_; |
145 |
+ |
string puFile_; |
146 |
+ |
string deadEcalFile_; |
147 |
+ |
string muonSFFile_; |
148 |
+ |
string dataPU_; |
149 |
+ |
string electronSFID_; |
150 |
+ |
string muonSF_; |
151 |
+ |
string dataset_; |
152 |
+ |
string datasetType_; |
153 |
+ |
vector<edm::ParameterSet> channels_; |
154 |
+ |
vector<edm::ParameterSet> histogramSets_; |
155 |
+ |
bool plotAllObjectsInPassingEvents_; |
156 |
+ |
bool doPileupReweighting_; |
157 |
+ |
bool applyLeptonSF_; |
158 |
+ |
bool printEventInfo_; |
159 |
+ |
bool useTrackCaloRhoCorr_; // to use the calo-based rho correction for the by-hand calculation of the track isolation energy |
160 |
+ |
vector<double> stopCTau_; |
161 |
+ |
|
162 |
+ |
struct DeadEcal { |
163 |
+ |
double etaEcal; |
164 |
+ |
double phiEcal; |
165 |
+ |
}; |
166 |
|
|
167 |
+ |
vector<DeadEcal> DeadEcalVec; |
168 |
|
|
169 |
< |
vector<edm::ParameterSet> channels_; |
169 |
> |
|
170 |
> |
//Collections |
171 |
> |
edm::Handle<BNtriggerCollection> triggers; |
172 |
> |
edm::Handle<BNtrigobjCollection> trigobjs; |
173 |
> |
edm::Handle<BNjetCollection> jets; |
174 |
> |
edm::Handle<BNmuonCollection> muons; |
175 |
> |
edm::Handle<BNelectronCollection> electrons; |
176 |
> |
edm::Handle<BNeventCollection> events; |
177 |
> |
edm::Handle<BNtauCollection> taus; |
178 |
> |
edm::Handle<BNmetCollection> mets; |
179 |
> |
edm::Handle<BNtrackCollection> tracks; |
180 |
> |
edm::Handle<BNgenjetCollection> genjets; |
181 |
> |
edm::Handle<BNmcparticleCollection> mcparticles; |
182 |
> |
edm::Handle<BNprimaryvertexCollection> primaryvertexs; |
183 |
> |
edm::Handle<BNbxlumiCollection> bxlumis; |
184 |
> |
edm::Handle<BNphotonCollection> photons; |
185 |
> |
edm::Handle<BNsuperclusterCollection> superclusters; |
186 |
> |
edm::Handle<BNstopCollection> stops; |
187 |
> |
|
188 |
> |
edm::Handle<double> rhokt6CaloJetsHandle_; |
189 |
> |
|
190 |
> |
flagMap cumulativeFlags; |
191 |
|
|
192 |
|
vector<map<string, TH1D*> > oneDHists_; |
193 |
+ |
vector<map<string, TH2D*> > twoDHists_; |
194 |
|
|
195 |
|
edm::Service<TFileService> fs_; |
196 |
|
|
197 |
|
CutFlow *masterCutFlow_; |
198 |
|
vector<CutFlow *> cutFlows_; |
199 |
|
|
200 |
+ |
typedef struct { |
201 |
+ |
string name; |
202 |
+ |
string title; |
203 |
+ |
vector<double> bins; |
204 |
+ |
vector<double> variableBinsX; |
205 |
+ |
vector<double> variableBinsY; |
206 |
+ |
string inputCollection; |
207 |
+ |
vector<string> inputVariables; |
208 |
+ |
} histogram; |
209 |
|
|
210 |
|
struct cut { |
211 |
< |
string inputCollection; |
212 |
< |
string variable; |
213 |
< |
string comparativeOperator; |
214 |
< |
double cutValue; |
215 |
< |
int numberRequired; |
216 |
< |
string eventComparativeOperator; |
217 |
< |
string name; |
211 |
> |
string inputCollection; |
212 |
> |
vector<string> functions; |
213 |
> |
vector<string> variables; |
214 |
> |
vector<string> comparativeOperators;// >, <, =, etc. |
215 |
> |
vector<double> cutValues; |
216 |
> |
vector<string> cutStringValues; |
217 |
> |
vector<string> logicalOperators;//and, or |
218 |
> |
int numSubcuts; |
219 |
> |
int numberRequired; |
220 |
> |
string eventComparativeOperator; |
221 |
> |
string name; |
222 |
|
}; |
223 |
|
|
224 |
|
struct channel { |
225 |
< |
string name; |
226 |
< |
vector<cut> cuts; |
227 |
< |
vector<string> inputCollections; |
225 |
> |
string name; |
226 |
> |
vector<string> triggers; |
227 |
> |
vector<cut> cuts; |
228 |
|
}; |
229 |
|
|
230 |
< |
vector<string> allNecessaryObjects; |
230 |
> |
vector<string> objectsToGet; |
231 |
> |
vector<string> objectsToCut; |
232 |
> |
vector<string> objectsToPlot; |
233 |
|
vector<channel> channels; |
234 |
+ |
vector<histogram> histograms; |
235 |
+ |
|
236 |
+ |
PUWeight *puWeight_; |
237 |
+ |
MuonSFWeight *muonSFWeight_; |
238 |
+ |
ElectronSFWeight *electronSFWeight_; |
239 |
+ |
|
240 |
+ |
StopCTauWeight *stopCTauWeight_; |
241 |
+ |
double stopCTauScaleFactor_; |
242 |
|
|
243 |
|
template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string); |
244 |
+ |
template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string); |
245 |
+ |
|
246 |
+ |
template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double); |
247 |
+ |
template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double); |
248 |
+ |
template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double); |
249 |
+ |
template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double); |
250 |
+ |
bool getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1); |
251 |
+ |
|
252 |
+ |
template <class InputObject> int getGenMatchedParticleIndex(InputObject); |
253 |
+ |
int getPdgIdBinValue(int); |
254 |
+ |
int findTauMotherIndex(const BNmcparticle*); |
255 |
+ |
|
256 |
+ |
template <class InputObject> double getGenDeltaRLowest(InputObject); |
257 |
|
|
258 |
|
|
259 |
+ |
const BNprimaryvertex *chosenVertex (); |
260 |
+ |
const BNmet *chosenMET (); |
261 |
+ |
const BNelectron *chosenElectron (); |
262 |
+ |
const BNmuon *chosenMuon (); |
263 |
|
|
264 |
|
}; |
265 |
|
|