1 |
lantonel |
1.1 |
#ifndef OSU_ANALYSIS
|
2 |
|
|
|
3 |
|
|
#define OSU_ANALYSIS
|
4 |
|
|
|
5 |
|
|
#include <map>
|
6 |
|
|
#include <string>
|
7 |
|
|
#include <vector>
|
8 |
jbrinson |
1.13 |
|
9 |
|
|
#include <fstream>
|
10 |
|
|
#include <iostream>
|
11 |
lantonel |
1.12 |
#include <algorithm>
|
12 |
ahart |
1.29 |
#include <regex>
|
13 |
lantonel |
1.6 |
#include "TH1.h"
|
14 |
lantonel |
1.9 |
#include "TH2.h"
|
15 |
lantonel |
1.1 |
#include "TH1D.h"
|
16 |
|
|
#include "TH2D.h"
|
17 |
|
|
#include "TLorentzVector.h"
|
18 |
|
|
|
19 |
|
|
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
20 |
|
|
#include "FWCore/Framework/interface/Event.h"
|
21 |
|
|
#include "FWCore/Framework/interface/EventSetup.h"
|
22 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
23 |
|
|
#include "FWCore/ServiceRegistry/interface/Service.h"
|
24 |
|
|
#include "DataFormats/Common/interface/Handle.h"
|
25 |
|
|
#include "CommonTools/UtilAlgos/interface/TFileService.h"
|
26 |
|
|
#include "FWCore/Framework/interface/MakerMacros.h"
|
27 |
lantonel |
1.10 |
#include "DataFormats/Math/interface/deltaPhi.h"
|
28 |
|
|
#include "DataFormats/Math/interface/deltaR.h"
|
29 |
lantonel |
1.1 |
|
30 |
|
|
#include "ProductArea/BNcollections/interface/BNbxlumi.h"
|
31 |
|
|
#include "ProductArea/BNcollections/interface/BNelectron.h"
|
32 |
|
|
#include "ProductArea/BNcollections/interface/BNevent.h"
|
33 |
|
|
#include "ProductArea/BNcollections/interface/BNjet.h"
|
34 |
|
|
#include "ProductArea/BNcollections/interface/BNmcparticle.h"
|
35 |
|
|
#include "ProductArea/BNcollections/interface/BNmet.h"
|
36 |
|
|
#include "ProductArea/BNcollections/interface/BNmuon.h"
|
37 |
|
|
#include "ProductArea/BNcollections/interface/BNphoton.h"
|
38 |
|
|
#include "ProductArea/BNcollections/interface/BNprimaryvertex.h"
|
39 |
|
|
#include "ProductArea/BNcollections/interface/BNskimbits.h"
|
40 |
|
|
#include "ProductArea/BNcollections/interface/BNsupercluster.h"
|
41 |
|
|
#include "ProductArea/BNcollections/interface/BNtrack.h"
|
42 |
|
|
#include "ProductArea/BNcollections/interface/BNtrigger.h"
|
43 |
|
|
#include "ProductArea/BNcollections/interface/BNtrigobj.h"
|
44 |
|
|
#include "ProductArea/BNcollections/interface/BNtau.h"
|
45 |
|
|
#include "ProductArea/BNcollections/interface/BNgenjet.h"
|
46 |
lantonel |
1.26 |
|
47 |
lantonel |
1.1 |
|
48 |
|
|
#include "OSUT3Analysis/AnaTools/interface/CutFlow.h"
|
49 |
lantonel |
1.9 |
#include "OSUT3Analysis/AnaTools/interface/PUWeight.h"
|
50 |
ahart |
1.16 |
#include "OSUT3Analysis/AnaTools/interface/SFWeight.h"
|
51 |
lantonel |
1.1 |
|
52 |
ahart |
1.29 |
#include "OSUT3Analysis/AnaTools/interface/StopCTauWeight.h"
|
53 |
lantonel |
1.1 |
|
54 |
|
|
using namespace std;
|
55 |
|
|
|
56 |
|
|
class OSUAnalysis : public edm::EDAnalyzer
|
57 |
|
|
{
|
58 |
|
|
public:
|
59 |
|
|
OSUAnalysis (const edm::ParameterSet &);
|
60 |
|
|
~OSUAnalysis ();
|
61 |
|
|
|
62 |
|
|
void analyze (const edm::Event &, const edm::EventSetup &);
|
63 |
|
|
bool evaluateComparison (double, string, double);
|
64 |
ahart |
1.31 |
bool evaluateComparison (string, string, string);
|
65 |
lantonel |
1.2 |
bool evaluateTriggers (vector<string>,const BNtriggerCollection*);
|
66 |
lantonel |
1.3 |
double applyFunction(string, double);
|
67 |
|
|
|
68 |
ahart |
1.31 |
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 |
jbrinson |
1.14 |
|
98 |
jbrinson |
1.13 |
int getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl);
|
99 |
jbrinson |
1.14 |
double getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl);
|
100 |
|
|
double getTrkPtRes (const BNtrack* track1);
|
101 |
|
|
double getTrkIsIso (const BNtrack* track1);
|
102 |
wulsin |
1.20 |
double getTrkCaloTotRhoCorr(const BNtrack* track);
|
103 |
jbrinson |
1.13 |
void WriteDeadEcal ();
|
104 |
|
|
int getTrkIsMatchedDeadEcal (const BNtrack* track1);
|
105 |
|
|
|
106 |
lantonel |
1.1 |
//BNskimbits
|
107 |
|
|
//BNtrigobj
|
108 |
|
|
|
109 |
|
|
vector<string> splitString (string);
|
110 |
ahart |
1.31 |
void getTwoObjs(string tempInputCollection, string& obj1, string& obj2);
|
111 |
|
|
string getObjToGet(string obj);
|
112 |
lantonel |
1.1 |
|
113 |
|
|
private:
|
114 |
|
|
|
115 |
|
|
//flagMap:
|
116 |
|
|
//string holds input collection type
|
117 |
|
|
//outer vector corresponds to each cut
|
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 |
ahart |
1.16 |
|
122 |
lantonel |
1.1 |
//counterMap:
|
123 |
|
|
//string holds input collection type
|
124 |
|
|
//vector corresponds to each cut
|
125 |
|
|
//int holds number of objects passing all cuts up to that point
|
126 |
|
|
typedef map<string ,vector <int> > counterMap;
|
127 |
|
|
|
128 |
|
|
// Remember to define parameters to be retrieved from the configuration file.
|
129 |
|
|
edm::InputTag jets_;
|
130 |
|
|
edm::InputTag muons_;
|
131 |
|
|
edm::InputTag electrons_;
|
132 |
|
|
edm::InputTag events_;
|
133 |
|
|
edm::InputTag taus_;
|
134 |
|
|
edm::InputTag mets_;
|
135 |
|
|
edm::InputTag tracks_;
|
136 |
|
|
edm::InputTag genjets_;
|
137 |
|
|
edm::InputTag mcparticles_;
|
138 |
ahart |
1.21 |
edm::InputTag stops_;
|
139 |
lantonel |
1.1 |
edm::InputTag primaryvertexs_;
|
140 |
|
|
edm::InputTag bxlumis_;
|
141 |
|
|
edm::InputTag photons_;
|
142 |
|
|
edm::InputTag superclusters_;
|
143 |
lantonel |
1.2 |
edm::InputTag triggers_;
|
144 |
ahart |
1.31 |
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 |
lantonel |
1.1 |
vector<edm::ParameterSet> channels_;
|
154 |
lantonel |
1.4 |
vector<edm::ParameterSet> histogramSets_;
|
155 |
lantonel |
1.9 |
bool plotAllObjectsInPassingEvents_;
|
156 |
lantonel |
1.15 |
bool doPileupReweighting_;
|
157 |
ahart |
1.28 |
bool applyLeptonSF_;
|
158 |
ahart |
1.31 |
bool printEventInfo_;
|
159 |
|
|
bool useTrackCaloRhoCorr_; // to use the calo-based rho correction for the by-hand calculation of the track isolation energy
|
160 |
ahart |
1.21 |
vector<double> stopCTau_;
|
161 |
lantonel |
1.1 |
|
162 |
jbrinson |
1.13 |
struct DeadEcal {
|
163 |
ahart |
1.16 |
double etaEcal;
|
164 |
|
|
double phiEcal;
|
165 |
jbrinson |
1.13 |
};
|
166 |
ahart |
1.16 |
|
167 |
ahart |
1.31 |
vector<DeadEcal> DeadEcalVec;
|
168 |
jbrinson |
1.13 |
|
169 |
jbrinson |
1.14 |
|
170 |
jbrinson |
1.13 |
//Collections
|
171 |
lantonel |
1.11 |
edm::Handle<BNtriggerCollection> triggers;
|
172 |
ahart |
1.31 |
edm::Handle<BNtrigobjCollection> trigobjs;
|
173 |
lantonel |
1.11 |
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 |
lantonel |
1.24 |
edm::Handle<BNstopCollection> stops;
|
187 |
lantonel |
1.26 |
|
188 |
ahart |
1.31 |
edm::Handle<double> rhokt6CaloJetsHandle_;
|
189 |
lantonel |
1.11 |
|
190 |
ahart |
1.16 |
flagMap cumulativeFlags;
|
191 |
lantonel |
1.8 |
|
192 |
lantonel |
1.1 |
vector<map<string, TH1D*> > oneDHists_;
|
193 |
lantonel |
1.6 |
vector<map<string, TH2D*> > twoDHists_;
|
194 |
lantonel |
1.1 |
|
195 |
|
|
edm::Service<TFileService> fs_;
|
196 |
|
|
|
197 |
|
|
CutFlow *masterCutFlow_;
|
198 |
|
|
vector<CutFlow *> cutFlows_;
|
199 |
|
|
|
200 |
lantonel |
1.4 |
typedef struct {
|
201 |
ahart |
1.16 |
string name;
|
202 |
|
|
string title;
|
203 |
|
|
vector<double> bins;
|
204 |
ahart |
1.30 |
vector<double> variableBinsX;
|
205 |
|
|
vector<double> variableBinsY;
|
206 |
ahart |
1.16 |
string inputCollection;
|
207 |
|
|
vector<string> inputVariables;
|
208 |
lantonel |
1.4 |
} histogram;
|
209 |
lantonel |
1.1 |
|
210 |
|
|
struct cut {
|
211 |
ahart |
1.16 |
string inputCollection;
|
212 |
|
|
vector<string> functions;
|
213 |
|
|
vector<string> variables;
|
214 |
|
|
vector<string> comparativeOperators;// >, <, =, etc.
|
215 |
|
|
vector<double> cutValues;
|
216 |
ahart |
1.31 |
vector<string> cutStringValues;
|
217 |
ahart |
1.16 |
vector<string> logicalOperators;//and, or
|
218 |
|
|
int numSubcuts;
|
219 |
|
|
int numberRequired;
|
220 |
|
|
string eventComparativeOperator;
|
221 |
|
|
string name;
|
222 |
lantonel |
1.1 |
};
|
223 |
|
|
|
224 |
|
|
struct channel {
|
225 |
ahart |
1.16 |
string name;
|
226 |
|
|
vector<string> triggers;
|
227 |
|
|
vector<cut> cuts;
|
228 |
lantonel |
1.1 |
};
|
229 |
|
|
|
230 |
lantonel |
1.12 |
vector<string> objectsToGet;
|
231 |
|
|
vector<string> objectsToCut;
|
232 |
lantonel |
1.4 |
vector<string> objectsToPlot;
|
233 |
lantonel |
1.1 |
vector<channel> channels;
|
234 |
lantonel |
1.4 |
vector<histogram> histograms;
|
235 |
lantonel |
1.1 |
|
236 |
lantonel |
1.9 |
PUWeight *puWeight_;
|
237 |
ahart |
1.16 |
MuonSFWeight *muonSFWeight_;
|
238 |
ahart |
1.32 |
double muonScaleFactor_;
|
239 |
ahart |
1.16 |
ElectronSFWeight *electronSFWeight_;
|
240 |
ahart |
1.32 |
double electronScaleFactor_;
|
241 |
ahart |
1.29 |
|
242 |
|
|
StopCTauWeight *stopCTauWeight_;
|
243 |
|
|
double stopCTauScaleFactor_;
|
244 |
lantonel |
1.9 |
|
245 |
lantonel |
1.1 |
template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string);
|
246 |
lantonel |
1.12 |
template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string);
|
247 |
|
|
|
248 |
lantonel |
1.10 |
template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double);
|
249 |
|
|
template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
|
250 |
|
|
template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double);
|
251 |
|
|
template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
|
252 |
ahart |
1.31 |
bool getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1);
|
253 |
lantonel |
1.1 |
|
254 |
lantonel |
1.11 |
template <class InputObject> int getGenMatchedParticleIndex(InputObject);
|
255 |
|
|
int getPdgIdBinValue(int);
|
256 |
|
|
int findTauMotherIndex(const BNmcparticle*);
|
257 |
|
|
|
258 |
jbrinson |
1.17 |
template <class InputObject> double getGenDeltaRLowest(InputObject);
|
259 |
|
|
|
260 |
|
|
|
261 |
ahart |
1.16 |
const BNprimaryvertex *chosenVertex ();
|
262 |
|
|
const BNmet *chosenMET ();
|
263 |
|
|
const BNelectron *chosenElectron ();
|
264 |
|
|
const BNmuon *chosenMuon ();
|
265 |
jbrinson |
1.13 |
|
266 |
lantonel |
1.1 |
};
|
267 |
|
|
|
268 |
|
|
#endif
|