9 |
|
#include <fstream> |
10 |
|
#include <iostream> |
11 |
|
#include <algorithm> |
12 |
+ |
#include <regex> |
13 |
|
#include "TH1.h" |
14 |
|
#include "TH2.h" |
15 |
|
#include "TH1D.h" |
44 |
|
#include "ProductArea/BNcollections/interface/BNtau.h" |
45 |
|
#include "ProductArea/BNcollections/interface/BNgenjet.h" |
46 |
|
|
47 |
+ |
|
48 |
|
#include "OSUT3Analysis/AnaTools/interface/CutFlow.h" |
49 |
|
#include "OSUT3Analysis/AnaTools/interface/PUWeight.h" |
50 |
+ |
#include "OSUT3Analysis/AnaTools/interface/SFWeight.h" |
51 |
|
|
52 |
< |
|
50 |
< |
|
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 = ""); |
69 |
< |
double valueLookup (const BNmuon* object, string variable, string function = ""); |
70 |
< |
double valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function = ""); |
71 |
< |
double valueLookup (const BNelectron* object, string variable, string function = ""); |
72 |
< |
double valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function = ""); |
73 |
< |
double valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function = ""); |
74 |
< |
double valueLookup (const BNevent* object, string variable, string function = ""); |
75 |
< |
double valueLookup (const BNtau* object, string variable, string function = ""); |
76 |
< |
double valueLookup (const BNmet* object, string variable, string function = ""); |
77 |
< |
double valueLookup (const BNtrack* object, string variable, string function = ""); |
78 |
< |
double valueLookup (const BNgenjet* object, string variable, string function = ""); |
79 |
< |
double valueLookup (const BNmcparticle* object, string variable, string function = ""); |
80 |
< |
double valueLookup (const BNprimaryvertex* object, string variable, string function = ""); |
81 |
< |
double valueLookup (const BNbxlumi* object, string variable, string function = ""); |
82 |
< |
double valueLookup (const BNphoton* object, string variable, string function = ""); |
83 |
< |
double valueLookup (const BNsupercluster* object, string variable, string function = ""); |
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 |
|
|
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 |
< |
std::string puFile_; |
145 |
< |
std::string deadEcalFile_; |
146 |
< |
std::string dataPU_; |
147 |
< |
std::string dataset_; |
148 |
< |
std::string datasetType_; |
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 |
< |
|
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 |
> |
bool GetPlotsAfterEachCut_; |
162 |
> |
|
163 |
|
struct DeadEcal { |
164 |
< |
double etaEcal; |
165 |
< |
double phiEcal; |
164 |
> |
double etaEcal; |
165 |
> |
double phiEcal; |
166 |
|
}; |
167 |
< |
|
168 |
< |
std::vector<DeadEcal> DeadEcalVec; |
167 |
> |
|
168 |
> |
vector<DeadEcal> DeadEcalVec; |
169 |
|
|
170 |
|
|
171 |
|
//Collections |
172 |
|
edm::Handle<BNtriggerCollection> triggers; |
173 |
+ |
edm::Handle<BNtrigobjCollection> trigobjs; |
174 |
|
edm::Handle<BNjetCollection> jets; |
175 |
|
edm::Handle<BNmuonCollection> muons; |
176 |
|
edm::Handle<BNelectronCollection> electrons; |
184 |
|
edm::Handle<BNbxlumiCollection> bxlumis; |
185 |
|
edm::Handle<BNphotonCollection> photons; |
186 |
|
edm::Handle<BNsuperclusterCollection> superclusters; |
187 |
+ |
edm::Handle<BNstopCollection> stops; |
188 |
|
|
189 |
< |
const BNprimaryvertex *chosenPrimaryVertex; |
189 |
> |
edm::Handle<double> rhokt6CaloJetsHandle_; |
190 |
|
|
191 |
+ |
flagMap cumulativeFlags; |
192 |
|
|
193 |
< |
vector<map<string, TH1D*> > oneDHists_; |
194 |
< |
vector<map<string, TH2D*> > twoDHists_; |
193 |
> |
vector<vector<map<string, TH1D*>>> oneDHists_; |
194 |
> |
vector<vector<map<string, TH2D*>>> twoDHists_; |
195 |
|
|
196 |
|
edm::Service<TFileService> fs_; |
197 |
|
|
199 |
|
vector<CutFlow *> cutFlows_; |
200 |
|
|
201 |
|
typedef struct { |
202 |
< |
string name; |
203 |
< |
string title; |
204 |
< |
vector<double> bins; |
205 |
< |
string inputCollection; |
206 |
< |
vector<string> inputVariables; |
202 |
> |
string name; |
203 |
> |
string title; |
204 |
> |
vector<double> bins; |
205 |
> |
vector<double> variableBinsX; |
206 |
> |
vector<double> variableBinsY; |
207 |
> |
string inputCollection; |
208 |
> |
vector<string> inputVariables; |
209 |
|
} histogram; |
210 |
|
|
211 |
|
struct cut { |
212 |
< |
string inputCollection; |
213 |
< |
vector<string> functions; |
214 |
< |
vector<string> variables; |
215 |
< |
vector<string> comparativeOperators;// >, <, =, etc. |
216 |
< |
vector<double> cutValues; |
217 |
< |
vector<string> logicalOperators;//and, or |
218 |
< |
int numSubcuts; |
219 |
< |
int numberRequired; |
220 |
< |
string eventComparativeOperator; |
221 |
< |
string name; |
212 |
> |
string inputCollection; |
213 |
> |
vector<string> functions; |
214 |
> |
vector<string> variables; |
215 |
> |
vector<string> comparativeOperators;// >, <, =, etc. |
216 |
> |
vector<double> cutValues; |
217 |
> |
vector<string> cutStringValues; |
218 |
> |
vector<string> logicalOperators;//and, or |
219 |
> |
int numSubcuts; |
220 |
> |
int numberRequired; |
221 |
> |
string eventComparativeOperator; |
222 |
> |
string name; |
223 |
|
}; |
224 |
|
|
225 |
|
struct channel { |
226 |
< |
string name; |
227 |
< |
vector<string> triggers; |
228 |
< |
vector<cut> cuts; |
226 |
> |
string name; |
227 |
> |
vector<string> triggers; |
228 |
> |
vector<cut> cuts; |
229 |
|
}; |
230 |
|
|
231 |
|
vector<string> objectsToGet; |
235 |
|
vector<histogram> histograms; |
236 |
|
|
237 |
|
PUWeight *puWeight_; |
238 |
+ |
MuonSFWeight *muonSFWeight_; |
239 |
+ |
double muonScaleFactor_; |
240 |
+ |
ElectronSFWeight *electronSFWeight_; |
241 |
+ |
double electronScaleFactor_; |
242 |
+ |
|
243 |
+ |
StopCTauWeight *stopCTauWeight_; |
244 |
+ |
double stopCTauScaleFactor_; |
245 |
|
|
246 |
|
template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string); |
247 |
|
template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string); |
250 |
|
template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double); |
251 |
|
template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double); |
252 |
|
template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double); |
253 |
+ |
bool getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1); |
254 |
|
|
255 |
|
template <class InputObject> int getGenMatchedParticleIndex(InputObject); |
256 |
|
int getPdgIdBinValue(int); |
257 |
|
int findTauMotherIndex(const BNmcparticle*); |
258 |
|
|
259 |
+ |
template <class InputObject> double getGenDeltaRLowest(InputObject); |
260 |
+ |
|
261 |
+ |
|
262 |
+ |
const BNprimaryvertex *chosenVertex (); |
263 |
+ |
const BNmet *chosenMET (); |
264 |
+ |
const BNelectron *chosenElectron (); |
265 |
+ |
const BNmuon *chosenMuon (); |
266 |
|
|
267 |
|
}; |
268 |
|
|