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