ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.h
Revision: 1.27
Committed: Wed May 1 16:18:54 2013 UTC (12 years ago) by biliu
Content type: text/plain
Branch: MAIN
Changes since 1.26: +1 -0 lines
Log Message:
Add jet-jet pair into the head file

File Contents

# User Rev Content
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 lantonel 1.6 #include "TH1.h"
13 lantonel 1.9 #include "TH2.h"
14 lantonel 1.1 #include "TH1D.h"
15     #include "TH2D.h"
16     #include "TLorentzVector.h"
17    
18     #include "FWCore/Framework/interface/EDAnalyzer.h"
19     #include "FWCore/Framework/interface/Event.h"
20     #include "FWCore/Framework/interface/EventSetup.h"
21     #include "FWCore/ParameterSet/interface/ParameterSet.h"
22     #include "FWCore/ServiceRegistry/interface/Service.h"
23     #include "DataFormats/Common/interface/Handle.h"
24     #include "CommonTools/UtilAlgos/interface/TFileService.h"
25     #include "FWCore/Framework/interface/MakerMacros.h"
26 lantonel 1.10 #include "DataFormats/Math/interface/deltaPhi.h"
27     #include "DataFormats/Math/interface/deltaR.h"
28 lantonel 1.1
29     #include "ProductArea/BNcollections/interface/BNbxlumi.h"
30     #include "ProductArea/BNcollections/interface/BNelectron.h"
31     #include "ProductArea/BNcollections/interface/BNevent.h"
32     #include "ProductArea/BNcollections/interface/BNjet.h"
33     #include "ProductArea/BNcollections/interface/BNmcparticle.h"
34     #include "ProductArea/BNcollections/interface/BNmet.h"
35     #include "ProductArea/BNcollections/interface/BNmuon.h"
36     #include "ProductArea/BNcollections/interface/BNphoton.h"
37     #include "ProductArea/BNcollections/interface/BNprimaryvertex.h"
38     #include "ProductArea/BNcollections/interface/BNskimbits.h"
39     #include "ProductArea/BNcollections/interface/BNsupercluster.h"
40     #include "ProductArea/BNcollections/interface/BNtrack.h"
41     #include "ProductArea/BNcollections/interface/BNtrigger.h"
42     #include "ProductArea/BNcollections/interface/BNtrigobj.h"
43     #include "ProductArea/BNcollections/interface/BNtau.h"
44     #include "ProductArea/BNcollections/interface/BNgenjet.h"
45 lantonel 1.26 #include "ProductArea/BNcollections/interface/BNstop.h"
46    
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.21 #ifdef DISPLACED_SUSY
53     #include "DisplacedSUSY/Configuration/interface/CTauWeight.h"
54     #endif
55 lantonel 1.1
56     using namespace std;
57    
58     class OSUAnalysis : public edm::EDAnalyzer
59     {
60     public:
61     OSUAnalysis (const edm::ParameterSet &);
62     ~OSUAnalysis ();
63    
64     void analyze (const edm::Event &, const edm::EventSetup &);
65     bool evaluateComparison (double, string, double);
66 lantonel 1.2 bool evaluateTriggers (vector<string>,const BNtriggerCollection*);
67 lantonel 1.3 double applyFunction(string, double);
68    
69 lantonel 1.4 double valueLookup (const BNjet* object, string variable, string function = "");
70     double valueLookup (const BNmuon* object, string variable, string function = "");
71 lantonel 1.10 double valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function = "");
72 lantonel 1.4 double valueLookup (const BNelectron* object, string variable, string function = "");
73 lantonel 1.10 double valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function = "");
74     double valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function = "");
75 lantonel 1.25 double valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function = "");
76 jbrinson 1.19 double valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function = "");
77 lantonel 1.25 double valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function = "");
78 jbrinson 1.19 double valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function = "");
79     double valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function = "");
80     double valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function = "");
81 jbrinson 1.22 double valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function);
82 biliu 1.27 double valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function = "");
83 lantonel 1.4 double valueLookup (const BNevent* object, string variable, string function = "");
84     double valueLookup (const BNtau* object, string variable, string function = "");
85     double valueLookup (const BNmet* object, string variable, string function = "");
86     double valueLookup (const BNtrack* object, string variable, string function = "");
87 wulsin 1.20 double valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function = "");
88 lantonel 1.4 double valueLookup (const BNgenjet* object, string variable, string function = "");
89     double valueLookup (const BNmcparticle* object, string variable, string function = "");
90     double valueLookup (const BNprimaryvertex* object, string variable, string function = "");
91     double valueLookup (const BNbxlumi* object, string variable, string function = "");
92     double valueLookup (const BNphoton* object, string variable, string function = "");
93     double valueLookup (const BNsupercluster* object, string variable, string function = "");
94 lantonel 1.26 double valueLookup (const BNstop* object, string variable, string function = "");
95 jbrinson 1.14
96 jbrinson 1.13 int getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl);
97 jbrinson 1.14 double getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl);
98     double getTrkPtRes (const BNtrack* track1);
99     double getTrkIsIso (const BNtrack* track1);
100 wulsin 1.20 double getTrkCaloTotRhoCorr(const BNtrack* track);
101 jbrinson 1.13 void WriteDeadEcal ();
102     int getTrkIsMatchedDeadEcal (const BNtrack* track1);
103    
104 lantonel 1.1 //BNskimbits
105     //BNtrigobj
106    
107     vector<string> splitString (string);
108 wulsin 1.23 void getTwoObjs(string tempInputCollection, string& obj1, string& obj2);
109     string getObjToGet(string obj);
110 lantonel 1.1
111     private:
112    
113     //flagMap:
114     //string holds input collection type
115     //outer vector corresponds to each cut
116     //inner vector corresponds to each object in input collection
117     //bool tells if object passes or fails cuts
118     typedef map<string, vector < vector<bool> > > flagMap;
119 ahart 1.16
120 lantonel 1.1 //counterMap:
121     //string holds input collection type
122     //vector corresponds to each cut
123     //int holds number of objects passing all cuts up to that point
124     typedef map<string ,vector <int> > counterMap;
125    
126     // Remember to define parameters to be retrieved from the configuration file.
127     edm::InputTag jets_;
128     edm::InputTag muons_;
129     edm::InputTag electrons_;
130     edm::InputTag events_;
131     edm::InputTag taus_;
132     edm::InputTag mets_;
133     edm::InputTag tracks_;
134     edm::InputTag genjets_;
135     edm::InputTag mcparticles_;
136 ahart 1.21 edm::InputTag stops_;
137 lantonel 1.1 edm::InputTag primaryvertexs_;
138     edm::InputTag bxlumis_;
139     edm::InputTag photons_;
140     edm::InputTag superclusters_;
141 lantonel 1.2 edm::InputTag triggers_;
142 lantonel 1.9 std::string puFile_;
143 jbrinson 1.13 std::string deadEcalFile_;
144 ahart 1.16 std::string muonSFFile_;
145 lantonel 1.9 std::string dataPU_;
146 ahart 1.16 std::string electronSFID_;
147     std::string muonSF_;
148 lantonel 1.9 std::string dataset_;
149     std::string datasetType_;
150 lantonel 1.1 vector<edm::ParameterSet> channels_;
151 lantonel 1.4 vector<edm::ParameterSet> histogramSets_;
152 lantonel 1.9 bool plotAllObjectsInPassingEvents_;
153 lantonel 1.15 bool doPileupReweighting_;
154 wulsin 1.18 bool printEventInfo_;
155 wulsin 1.20 bool useTrackCaloRhoCorr_; // to use the calo-based rho correction for the by-hand calculation of the track isolation energy
156 ahart 1.21 vector<double> stopCTau_;
157 lantonel 1.1
158 jbrinson 1.13 struct DeadEcal {
159 ahart 1.16 double etaEcal;
160     double phiEcal;
161 jbrinson 1.13 };
162 ahart 1.16
163 jbrinson 1.13 std::vector<DeadEcal> DeadEcalVec;
164    
165 jbrinson 1.14
166 jbrinson 1.13 //Collections
167 lantonel 1.11 edm::Handle<BNtriggerCollection> triggers;
168     edm::Handle<BNjetCollection> jets;
169     edm::Handle<BNmuonCollection> muons;
170     edm::Handle<BNelectronCollection> electrons;
171     edm::Handle<BNeventCollection> events;
172     edm::Handle<BNtauCollection> taus;
173     edm::Handle<BNmetCollection> mets;
174     edm::Handle<BNtrackCollection> tracks;
175     edm::Handle<BNgenjetCollection> genjets;
176     edm::Handle<BNmcparticleCollection> mcparticles;
177     edm::Handle<BNprimaryvertexCollection> primaryvertexs;
178     edm::Handle<BNbxlumiCollection> bxlumis;
179     edm::Handle<BNphotonCollection> photons;
180     edm::Handle<BNsuperclusterCollection> superclusters;
181 lantonel 1.24 edm::Handle<BNstopCollection> stops;
182 lantonel 1.26
183 wulsin 1.20 edm::Handle<double> rhokt6CaloJetsHandle_;
184 lantonel 1.11
185 ahart 1.16 flagMap cumulativeFlags;
186 lantonel 1.8
187 lantonel 1.1 vector<map<string, TH1D*> > oneDHists_;
188 lantonel 1.6 vector<map<string, TH2D*> > twoDHists_;
189 lantonel 1.1
190     edm::Service<TFileService> fs_;
191    
192     CutFlow *masterCutFlow_;
193     vector<CutFlow *> cutFlows_;
194    
195 lantonel 1.4 typedef struct {
196 ahart 1.16 string name;
197     string title;
198     vector<double> bins;
199     string inputCollection;
200     vector<string> inputVariables;
201 lantonel 1.4 } histogram;
202 lantonel 1.1
203     struct cut {
204 ahart 1.16 string inputCollection;
205     vector<string> functions;
206     vector<string> variables;
207     vector<string> comparativeOperators;// >, <, =, etc.
208     vector<double> cutValues;
209     vector<string> logicalOperators;//and, or
210     int numSubcuts;
211     int numberRequired;
212     string eventComparativeOperator;
213     string name;
214 lantonel 1.1 };
215    
216     struct channel {
217 ahart 1.16 string name;
218     vector<string> triggers;
219     vector<cut> cuts;
220 lantonel 1.1 };
221    
222 lantonel 1.12 vector<string> objectsToGet;
223     vector<string> objectsToCut;
224 lantonel 1.4 vector<string> objectsToPlot;
225 lantonel 1.1 vector<channel> channels;
226 lantonel 1.4 vector<histogram> histograms;
227 lantonel 1.1
228 lantonel 1.9 PUWeight *puWeight_;
229 ahart 1.16 MuonSFWeight *muonSFWeight_;
230     ElectronSFWeight *electronSFWeight_;
231 ahart 1.21 #ifdef DISPLACED_SUSY
232     CTauWeight *cTauWeight_;
233     #endif
234     double cTauScaleFactor_;
235 lantonel 1.9
236 lantonel 1.1 template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string);
237 lantonel 1.12 template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string);
238    
239 lantonel 1.10 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 wulsin 1.23 bool getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1);
244 lantonel 1.1
245 lantonel 1.11 template <class InputObject> int getGenMatchedParticleIndex(InputObject);
246     int getPdgIdBinValue(int);
247     int findTauMotherIndex(const BNmcparticle*);
248    
249 jbrinson 1.17 template <class InputObject> double getGenDeltaRLowest(InputObject);
250    
251    
252 ahart 1.16 const BNprimaryvertex *chosenVertex ();
253     const BNmet *chosenMET ();
254     const BNelectron *chosenElectron ();
255     const BNmuon *chosenMuon ();
256 jbrinson 1.13
257 lantonel 1.1 };
258    
259     #endif