15 |
|
#include "TH1D.h" |
16 |
|
#include "TH2D.h" |
17 |
|
#include "TLorentzVector.h" |
18 |
+ |
#include "TVector3.h" |
19 |
+ |
#include "TVector2.h" |
20 |
|
#include "TTree.h" |
21 |
|
|
22 |
< |
#include "FWCore/Framework/interface/EDAnalyzer.h" |
22 |
> |
#include "FWCore/Framework/interface/EDProducer.h" |
23 |
|
#include "FWCore/Framework/interface/Event.h" |
24 |
|
#include "FWCore/Framework/interface/EventSetup.h" |
25 |
|
#include "FWCore/ParameterSet/interface/ParameterSet.h" |
51 |
|
#include "OSUT3Analysis/AnaTools/interface/CutFlow.h" |
52 |
|
#include "OSUT3Analysis/AnaTools/interface/PUWeight.h" |
53 |
|
#include "OSUT3Analysis/AnaTools/interface/SFWeight.h" |
54 |
< |
|
54 |
> |
#include "OSUT3Analysis/AnaTools/interface/BtagSFWeight.h" |
55 |
|
#include "OSUT3Analysis/AnaTools/interface/StopCTauWeight.h" |
56 |
|
|
57 |
|
using namespace std; |
58 |
|
|
59 |
< |
class OSUAnalysis : public edm::EDAnalyzer |
59 |
> |
class OSUAnalysis : public edm::EDProducer |
60 |
|
{ |
61 |
|
public: |
62 |
|
OSUAnalysis (const edm::ParameterSet &); |
63 |
|
~OSUAnalysis (); |
64 |
|
|
65 |
< |
void analyze (const edm::Event &, const edm::EventSetup &); |
65 |
> |
void produce (edm::Event &, const edm::EventSetup &); |
66 |
|
bool evaluateComparison (double, string, double); |
67 |
|
bool evaluateComparison (string, string, string); |
68 |
|
bool evaluateTriggers (vector<string>, vector<string>, const BNtriggerCollection*); |
75 |
|
double valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue); |
76 |
|
double valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function, string &stringValue); |
77 |
|
double valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue); |
78 |
+ |
double valueLookup (const BNelectron* object1, const BNphoton* object2, string variable, string function, string &stringValue); |
79 |
+ |
double valueLookup (const BNmuon* object1, const BNphoton* object2, string variable, string function, string &stringValue); |
80 |
+ |
double valueLookup (const BNmuon* object1, const BNevent* object2, string variable, string function, string &stringValue); |
81 |
+ |
double valueLookup (const BNphoton* object1, const BNjet* object2, string variable, string function, string &stringValue); |
82 |
|
double valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function, string &stringValue); |
83 |
|
double valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue); |
84 |
+ |
double valueLookup (const BNmet* object1, const BNjet* object2, string variable, string function, string &stringValue); |
85 |
+ |
double valueLookup (const BNtrack* object1, const BNjet* object2, string variable, string function, string &stringValue); |
86 |
|
double valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue); |
87 |
|
double valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function, string &stringValue); |
88 |
|
double valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function, string &stringValue); |
106 |
|
|
107 |
|
int getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl); |
108 |
|
double getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl); |
109 |
+ |
double getHt (const BNjetCollection* jetColl); |
110 |
|
double getTrkPtRes (const BNtrack* track1); |
111 |
|
double getTrkIsIso (const BNtrack* track1); |
112 |
|
double getTrkCaloTotRhoCorr(const BNtrack* track); |
113 |
+ |
double getTrkDepTrkRp5RhoCorr(const BNtrack* track); |
114 |
+ |
double getTrkDepTrkRp3RhoCorr(const BNtrack* track); |
115 |
|
void WriteDeadEcal (); |
116 |
|
int getTrkIsMatchedDeadEcal (const BNtrack* track1); |
117 |
|
|
128 |
|
//string holds input collection type |
129 |
|
//outer vector corresponds to each cut |
130 |
|
//inner vector corresponds to each object in input collection |
131 |
< |
//bool tells if object passes or fails cuts |
132 |
< |
typedef map<string, vector < vector<bool> > > flagMap; |
131 |
> |
//pair(bool) first bool counts towards the event passing, second bool determines whether to plot the object |
132 |
> |
typedef map<string, vector<vector<pair<bool,bool> > > > flagMap; |
133 |
> |
|
134 |
> |
typedef vector<pair<bool,bool> > flagPair; |
135 |
|
|
136 |
|
//counterMap: |
137 |
|
//string holds input collection type |
166 |
|
string datasetType_; |
167 |
|
vector<edm::ParameterSet> channels_; |
168 |
|
vector<edm::ParameterSet> histogramSets_; |
169 |
+ |
bool useEDMFormat_; |
170 |
|
vector<edm::ParameterSet> treeBranchSets_; |
171 |
|
bool plotAllObjectsInPassingEvents_; |
172 |
|
bool doPileupReweighting_; |
173 |
|
bool applyLeptonSF_; |
174 |
+ |
bool applyBtagSF_; |
175 |
+ |
int minBtag_; |
176 |
|
bool printEventInfo_; |
177 |
+ |
bool printAllTriggers_; |
178 |
|
bool useTrackCaloRhoCorr_; // to use the calo-based rho correction for the by-hand calculation of the track isolation energy |
179 |
|
vector<double> stopCTau_; |
180 |
|
bool GetPlotsAfterEachCut_; |
208 |
|
edm::Handle<double> rhokt6CaloJetsHandle_; |
209 |
|
|
210 |
|
flagMap cumulativeFlags; |
211 |
+ |
flagMap vetoFlags; |
212 |
|
|
213 |
|
vector<vector<map<string, TH1D*>>> oneDHists_; |
214 |
|
vector<vector<map<string, TH2D*>>> twoDHists_; |
215 |
|
vector<TTree*> BNTrees_; // one tree per channel |
198 |
– |
/* vector<map<TString, double>> BNTreeVars_; // the values of the branches in the TTree, for each of the channels */ |
199 |
– |
/* double debugVar_; // Warning: must be double, not float, if assigning to a branch as a double. */ |
200 |
– |
/* vector<double> debugVars_; */ |
201 |
– |
/* double debugVarsArray_[100]; */ |
202 |
– |
/* map<string, double> debugVarsMap_; */ |
216 |
|
map<string, vector<float>> BNTreeBranchVals_; // data structure to hold the values of the branches to be stored in the BNTrees_; the string is the name of a variable |
217 |
|
|
218 |
|
edm::Service<TFileService> fs_; |
232 |
|
|
233 |
|
typedef struct { |
234 |
|
string name; |
222 |
– |
/* string title; */ |
223 |
– |
/* vector<double> bins; */ |
224 |
– |
/* vector<double> variableBinsX; */ |
225 |
– |
/* vector<double> variableBinsY; */ |
235 |
|
string inputCollection; |
227 |
– |
// vector<string> inputVariables; |
236 |
|
string inputVariable; |
237 |
|
} BranchSpecs; |
238 |
|
|
245 |
|
vector<double> cutValues; |
246 |
|
vector<string> cutStringValues; |
247 |
|
vector<string> logicalOperators;//and, or |
248 |
< |
int numSubcuts; |
248 |
> |
int numSubcuts; |
249 |
|
int numberRequired; |
250 |
|
string eventComparativeOperator; |
251 |
|
string name; |
252 |
+ |
bool isVeto; |
253 |
|
}; |
254 |
|
|
255 |
|
struct channel { |
262 |
|
vector<string> objectsToGet; |
263 |
|
vector<string> objectsToCut; |
264 |
|
vector<string> objectsToPlot; |
265 |
+ |
vector<string> objectsToFlag; |
266 |
+ |
|
267 |
|
vector<channel> channels; |
268 |
|
vector<histogram> histograms; |
269 |
|
vector<BranchSpecs> treeBranches_; |
273 |
|
double muonScaleFactor_; |
274 |
|
ElectronSFWeight *electronSFWeight_; |
275 |
|
double electronScaleFactor_; |
276 |
+ |
BtagSFWeight *bTagSFWeight_; |
277 |
+ |
double bTagScaleFactor_; |
278 |
|
|
279 |
|
StopCTauWeight *stopCTauWeight_; |
280 |
|
double stopCTauScaleFactor_; |
281 |
|
|
282 |
+ |
ofstream* findEventsLog; |
283 |
+ |
bool isFirstEvent_; |
284 |
+ |
|
285 |
|
template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string); |
286 |
< |
template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string); |
286 |
> |
template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, flagPair, flagPair, string); |
287 |
> |
|
288 |
> |
template <class InputCollection> void assignTreeBranch(BranchSpecs brSpecs, InputCollection inputCollection, flagPair flags); |
289 |
> |
template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, flagPair, double); |
290 |
> |
template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, flagPair, flagPair, flagPair, double); |
291 |
> |
template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, flagPair, double); |
292 |
> |
template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, flagPair, flagPair, flagPair, double); |
293 |
> |
bool getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1, string flagType); |
294 |
> |
|
295 |
|
|
272 |
– |
template <class InputCollection> void assignTreeBranch(BranchSpecs brSpecs, InputCollection inputCollection, vector<bool> flags); |
273 |
– |
template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double); |
274 |
– |
template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double); |
275 |
– |
template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double); |
276 |
– |
template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double); |
277 |
– |
bool getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1); |
296 |
|
|
297 |
|
template <class InputObject> int getGenMatchedParticleIndex(InputObject); |
298 |
|
int getPdgIdBinValue(int); |
305 |
|
const BNmet *chosenMET (); |
306 |
|
const BNelectron *chosenElectron (); |
307 |
|
const BNmuon *chosenMuon (); |
308 |
+ |
double chosenHT (); |
309 |
+ |
pair<const BNmuon *, const BNmuon*> leadMuonPair (); |
310 |
+ |
pair<const BNelectron *, const BNelectron*> leadElectronPair (); |
311 |
|
|
312 |
|
}; |
313 |
|
|