ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.h
Revision: 1.22
Committed: Thu Apr 11 15:52:25 2013 UTC (12 years ago) by jbrinson
Content type: text/plain
Branch: MAIN
Changes since 1.21: +1 -0 lines
Log Message:
Added tau-track pair

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    
46     #include "OSUT3Analysis/AnaTools/interface/CutFlow.h"
47 lantonel 1.9 #include "OSUT3Analysis/AnaTools/interface/PUWeight.h"
48 ahart 1.16 #include "OSUT3Analysis/AnaTools/interface/SFWeight.h"
49 lantonel 1.1
50 ahart 1.21 #ifdef DISPLACED_SUSY
51     #include "DisplacedSUSY/Configuration/interface/CTauWeight.h"
52     #endif
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 lantonel 1.2 bool evaluateTriggers (vector<string>,const BNtriggerCollection*);
65 lantonel 1.3 double applyFunction(string, double);
66    
67 lantonel 1.4 double valueLookup (const BNjet* object, string variable, string function = "");
68     double valueLookup (const BNmuon* object, string variable, string function = "");
69 lantonel 1.10 double valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function = "");
70 lantonel 1.4 double valueLookup (const BNelectron* object, string variable, string function = "");
71 lantonel 1.10 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 jbrinson 1.19 double valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function = "");
74     double valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function = "");
75     double valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function = "");
76     double valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function = "");
77 jbrinson 1.22 double valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function);
78 lantonel 1.4 double valueLookup (const BNevent* object, string variable, string function = "");
79     double valueLookup (const BNtau* object, string variable, string function = "");
80     double valueLookup (const BNmet* object, string variable, string function = "");
81     double valueLookup (const BNtrack* object, string variable, string function = "");
82 wulsin 1.20 double valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function = "");
83 lantonel 1.4 double valueLookup (const BNgenjet* object, string variable, string function = "");
84     double valueLookup (const BNmcparticle* object, string variable, string function = "");
85     double valueLookup (const BNprimaryvertex* object, string variable, string function = "");
86     double valueLookup (const BNbxlumi* object, string variable, string function = "");
87     double valueLookup (const BNphoton* object, string variable, string function = "");
88     double valueLookup (const BNsupercluster* object, string variable, string function = "");
89 jbrinson 1.14
90 jbrinson 1.13 int getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl);
91 jbrinson 1.14 double getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl);
92     double getTrkPtRes (const BNtrack* track1);
93     double getTrkIsIso (const BNtrack* track1);
94 wulsin 1.20 double getTrkCaloTotRhoCorr(const BNtrack* track);
95 jbrinson 1.13 void WriteDeadEcal ();
96     int getTrkIsMatchedDeadEcal (const BNtrack* track1);
97    
98 lantonel 1.1 //BNskimbits
99     //BNtrigobj
100    
101     vector<string> splitString (string);
102    
103    
104     private:
105    
106     //flagMap:
107     //string holds input collection type
108     //outer vector corresponds to each cut
109     //inner vector corresponds to each object in input collection
110     //bool tells if object passes or fails cuts
111     typedef map<string, vector < vector<bool> > > flagMap;
112 ahart 1.16
113 lantonel 1.1 //counterMap:
114     //string holds input collection type
115     //vector corresponds to each cut
116     //int holds number of objects passing all cuts up to that point
117     typedef map<string ,vector <int> > counterMap;
118    
119     // Remember to define parameters to be retrieved from the configuration file.
120     edm::InputTag jets_;
121     edm::InputTag muons_;
122     edm::InputTag electrons_;
123     edm::InputTag events_;
124     edm::InputTag taus_;
125     edm::InputTag mets_;
126     edm::InputTag tracks_;
127     edm::InputTag genjets_;
128     edm::InputTag mcparticles_;
129 ahart 1.21 edm::InputTag stops_;
130 lantonel 1.1 edm::InputTag primaryvertexs_;
131     edm::InputTag bxlumis_;
132     edm::InputTag photons_;
133     edm::InputTag superclusters_;
134 lantonel 1.2 edm::InputTag triggers_;
135 lantonel 1.9 std::string puFile_;
136 jbrinson 1.13 std::string deadEcalFile_;
137 ahart 1.16 std::string muonSFFile_;
138 lantonel 1.9 std::string dataPU_;
139 ahart 1.16 std::string electronSFID_;
140     std::string muonSF_;
141 lantonel 1.9 std::string dataset_;
142     std::string datasetType_;
143 lantonel 1.1 vector<edm::ParameterSet> channels_;
144 lantonel 1.4 vector<edm::ParameterSet> histogramSets_;
145 lantonel 1.9 bool plotAllObjectsInPassingEvents_;
146 lantonel 1.15 bool doPileupReweighting_;
147 wulsin 1.18 bool printEventInfo_;
148 wulsin 1.20 bool useTrackCaloRhoCorr_; // to use the calo-based rho correction for the by-hand calculation of the track isolation energy
149 ahart 1.21 vector<double> stopCTau_;
150 lantonel 1.1
151 jbrinson 1.13 struct DeadEcal {
152 ahart 1.16 double etaEcal;
153     double phiEcal;
154 jbrinson 1.13 };
155 ahart 1.16
156 jbrinson 1.13 std::vector<DeadEcal> DeadEcalVec;
157    
158 jbrinson 1.14
159 jbrinson 1.13 //Collections
160 lantonel 1.11 edm::Handle<BNtriggerCollection> triggers;
161     edm::Handle<BNjetCollection> jets;
162     edm::Handle<BNmuonCollection> muons;
163     edm::Handle<BNelectronCollection> electrons;
164     edm::Handle<BNeventCollection> events;
165     edm::Handle<BNtauCollection> taus;
166     edm::Handle<BNmetCollection> mets;
167     edm::Handle<BNtrackCollection> tracks;
168     edm::Handle<BNgenjetCollection> genjets;
169     edm::Handle<BNmcparticleCollection> mcparticles;
170     edm::Handle<BNprimaryvertexCollection> primaryvertexs;
171     edm::Handle<BNbxlumiCollection> bxlumis;
172     edm::Handle<BNphotonCollection> photons;
173     edm::Handle<BNsuperclusterCollection> superclusters;
174 wulsin 1.20 edm::Handle<double> rhokt6CaloJetsHandle_;
175 lantonel 1.11
176 ahart 1.16 flagMap cumulativeFlags;
177 lantonel 1.8
178 lantonel 1.1 vector<map<string, TH1D*> > oneDHists_;
179 lantonel 1.6 vector<map<string, TH2D*> > twoDHists_;
180 lantonel 1.1
181     edm::Service<TFileService> fs_;
182    
183     CutFlow *masterCutFlow_;
184     vector<CutFlow *> cutFlows_;
185    
186 lantonel 1.4 typedef struct {
187 ahart 1.16 string name;
188     string title;
189     vector<double> bins;
190     string inputCollection;
191     vector<string> inputVariables;
192 lantonel 1.4 } histogram;
193 lantonel 1.1
194     struct cut {
195 ahart 1.16 string inputCollection;
196     vector<string> functions;
197     vector<string> variables;
198     vector<string> comparativeOperators;// >, <, =, etc.
199     vector<double> cutValues;
200     vector<string> logicalOperators;//and, or
201     int numSubcuts;
202     int numberRequired;
203     string eventComparativeOperator;
204     string name;
205 lantonel 1.1 };
206    
207     struct channel {
208 ahart 1.16 string name;
209     vector<string> triggers;
210     vector<cut> cuts;
211 lantonel 1.1 };
212    
213 lantonel 1.12 vector<string> objectsToGet;
214     vector<string> objectsToCut;
215 lantonel 1.4 vector<string> objectsToPlot;
216 lantonel 1.1 vector<channel> channels;
217 lantonel 1.4 vector<histogram> histograms;
218 lantonel 1.1
219 lantonel 1.9 PUWeight *puWeight_;
220 ahart 1.16 MuonSFWeight *muonSFWeight_;
221     ElectronSFWeight *electronSFWeight_;
222 ahart 1.21 #ifdef DISPLACED_SUSY
223     CTauWeight *cTauWeight_;
224     #endif
225     double cTauScaleFactor_;
226 lantonel 1.9
227 lantonel 1.1 template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string);
228 lantonel 1.12 template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string);
229    
230 lantonel 1.10 template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double);
231     template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
232     template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double);
233     template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
234 lantonel 1.1
235 lantonel 1.11 template <class InputObject> int getGenMatchedParticleIndex(InputObject);
236     int getPdgIdBinValue(int);
237     int findTauMotherIndex(const BNmcparticle*);
238    
239 jbrinson 1.17 template <class InputObject> double getGenDeltaRLowest(InputObject);
240    
241    
242 ahart 1.16 const BNprimaryvertex *chosenVertex ();
243     const BNmet *chosenMET ();
244     const BNelectron *chosenElectron ();
245     const BNmuon *chosenMuon ();
246 jbrinson 1.13
247 lantonel 1.1 };
248    
249     #endif