ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.h
Revision: 1.11
Committed: Sun Mar 3 17:14:18 2013 UTC (12 years, 2 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.10: +21 -1 lines
Log Message:
moved object collections to be global variables, so they can be accessed by any function

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    
9 lantonel 1.6 #include "TH1.h"
10 lantonel 1.9 #include "TH2.h"
11 lantonel 1.1 #include "TH1D.h"
12     #include "TH2D.h"
13     #include "TLorentzVector.h"
14    
15     #include "FWCore/Framework/interface/EDAnalyzer.h"
16     #include "FWCore/Framework/interface/Event.h"
17     #include "FWCore/Framework/interface/EventSetup.h"
18     #include "FWCore/ParameterSet/interface/ParameterSet.h"
19     #include "FWCore/ServiceRegistry/interface/Service.h"
20     #include "DataFormats/Common/interface/Handle.h"
21     #include "CommonTools/UtilAlgos/interface/TFileService.h"
22     #include "FWCore/Framework/interface/MakerMacros.h"
23 lantonel 1.10 #include "DataFormats/Math/interface/deltaPhi.h"
24     #include "DataFormats/Math/interface/deltaR.h"
25 lantonel 1.1
26     #include "ProductArea/BNcollections/interface/BNbxlumi.h"
27     #include "ProductArea/BNcollections/interface/BNelectron.h"
28     #include "ProductArea/BNcollections/interface/BNevent.h"
29     #include "ProductArea/BNcollections/interface/BNjet.h"
30     #include "ProductArea/BNcollections/interface/BNmcparticle.h"
31     #include "ProductArea/BNcollections/interface/BNmet.h"
32     #include "ProductArea/BNcollections/interface/BNmuon.h"
33     #include "ProductArea/BNcollections/interface/BNphoton.h"
34     #include "ProductArea/BNcollections/interface/BNprimaryvertex.h"
35     #include "ProductArea/BNcollections/interface/BNskimbits.h"
36     #include "ProductArea/BNcollections/interface/BNsupercluster.h"
37     #include "ProductArea/BNcollections/interface/BNtrack.h"
38     #include "ProductArea/BNcollections/interface/BNtrigger.h"
39     #include "ProductArea/BNcollections/interface/BNtrigobj.h"
40     #include "ProductArea/BNcollections/interface/BNtau.h"
41     #include "ProductArea/BNcollections/interface/BNgenjet.h"
42    
43     #include "OSUT3Analysis/AnaTools/interface/CutFlow.h"
44 lantonel 1.9 #include "OSUT3Analysis/AnaTools/interface/PUWeight.h"
45 lantonel 1.1
46    
47    
48    
49     using namespace std;
50    
51     class OSUAnalysis : public edm::EDAnalyzer
52     {
53     public:
54     OSUAnalysis (const edm::ParameterSet &);
55     ~OSUAnalysis ();
56    
57     void analyze (const edm::Event &, const edm::EventSetup &);
58     bool evaluateComparison (double, string, double);
59 lantonel 1.2 bool evaluateTriggers (vector<string>,const BNtriggerCollection*);
60 lantonel 1.3 double applyFunction(string, double);
61    
62 lantonel 1.4 double valueLookup (const BNjet* object, string variable, string function = "");
63     double valueLookup (const BNmuon* object, string variable, string function = "");
64 lantonel 1.10 double valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function = "");
65 lantonel 1.4 double valueLookup (const BNelectron* object, string variable, string function = "");
66 lantonel 1.10 double valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function = "");
67     double valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function = "");
68 lantonel 1.4 double valueLookup (const BNevent* object, string variable, string function = "");
69     double valueLookup (const BNtau* object, string variable, string function = "");
70     double valueLookup (const BNmet* object, string variable, string function = "");
71     double valueLookup (const BNtrack* object, string variable, string function = "");
72     double valueLookup (const BNgenjet* object, string variable, string function = "");
73     double valueLookup (const BNmcparticle* object, string variable, string function = "");
74     double valueLookup (const BNprimaryvertex* object, string variable, string function = "");
75     double valueLookup (const BNbxlumi* object, string variable, string function = "");
76     double valueLookup (const BNphoton* object, string variable, string function = "");
77     double valueLookup (const BNsupercluster* object, string variable, string function = "");
78 lantonel 1.1 //BNskimbits
79     //BNtrigobj
80    
81     vector<string> splitString (string);
82    
83    
84     private:
85    
86     //flagMap:
87     //string holds input collection type
88     //outer vector corresponds to each cut
89     //inner vector corresponds to each object in input collection
90     //bool tells if object passes or fails cuts
91     typedef map<string, vector < vector<bool> > > flagMap;
92    
93     //counterMap:
94     //string holds input collection type
95     //vector corresponds to each cut
96     //int holds number of objects passing all cuts up to that point
97     typedef map<string ,vector <int> > counterMap;
98    
99     // Remember to define parameters to be retrieved from the configuration file.
100     edm::InputTag jets_;
101     edm::InputTag muons_;
102     edm::InputTag electrons_;
103     edm::InputTag events_;
104     edm::InputTag taus_;
105     edm::InputTag mets_;
106     edm::InputTag tracks_;
107     edm::InputTag genjets_;
108     edm::InputTag mcparticles_;
109     edm::InputTag primaryvertexs_;
110     edm::InputTag bxlumis_;
111     edm::InputTag photons_;
112     edm::InputTag superclusters_;
113 lantonel 1.2 edm::InputTag triggers_;
114 lantonel 1.9 std::string puFile_;
115     std::string dataPU_;
116     std::string dataset_;
117     std::string datasetType_;
118 lantonel 1.1 vector<edm::ParameterSet> channels_;
119 lantonel 1.4 vector<edm::ParameterSet> histogramSets_;
120 lantonel 1.9 bool plotAllObjectsInPassingEvents_;
121 lantonel 1.1
122 lantonel 1.11 edm::Handle<BNtriggerCollection> triggers;
123     edm::Handle<BNjetCollection> jets;
124     edm::Handle<BNmuonCollection> muons;
125     edm::Handle<BNelectronCollection> electrons;
126     edm::Handle<BNeventCollection> events;
127     edm::Handle<BNtauCollection> taus;
128     edm::Handle<BNmetCollection> mets;
129     edm::Handle<BNtrackCollection> tracks;
130     edm::Handle<BNgenjetCollection> genjets;
131     edm::Handle<BNmcparticleCollection> mcparticles;
132     edm::Handle<BNprimaryvertexCollection> primaryvertexs;
133     edm::Handle<BNbxlumiCollection> bxlumis;
134     edm::Handle<BNphotonCollection> photons;
135     edm::Handle<BNsuperclusterCollection> superclusters;
136    
137     const BNprimaryvertex *chosenPrimaryVertex;
138    
139 lantonel 1.8
140 lantonel 1.1 vector<map<string, TH1D*> > oneDHists_;
141 lantonel 1.6 vector<map<string, TH2D*> > twoDHists_;
142 lantonel 1.1
143     edm::Service<TFileService> fs_;
144    
145     CutFlow *masterCutFlow_;
146     vector<CutFlow *> cutFlows_;
147    
148 lantonel 1.4 typedef struct {
149     string name;
150     string title;
151     vector<double> bins;
152     string inputCollection;
153 lantonel 1.6 vector<string> inputVariables;
154 lantonel 1.4 } histogram;
155 lantonel 1.1
156     struct cut {
157     string inputCollection;
158 lantonel 1.10 vector<string> functions;
159     vector<string> variables;
160     vector<string> comparativeOperators;// >, <, =, etc.
161     vector<double> cutValues;
162     vector<string> logicalOperators;//and, or
163     int numSubcuts;
164 lantonel 1.1 int numberRequired;
165     string eventComparativeOperator;
166     string name;
167     };
168    
169     struct channel {
170     string name;
171 lantonel 1.2 vector<string> triggers;
172 lantonel 1.1 vector<cut> cuts;
173     };
174    
175 lantonel 1.4 vector<string> objectsToPlot;
176 lantonel 1.1 vector<string> allNecessaryObjects;
177     vector<channel> channels;
178 lantonel 1.4 vector<histogram> histograms;
179 lantonel 1.1
180 lantonel 1.9 PUWeight *puWeight_;
181    
182 lantonel 1.1 template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string);
183 lantonel 1.10 template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, string);
184     template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double);
185     template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
186     template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double);
187     template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
188 lantonel 1.1
189 lantonel 1.11 template <class InputObject> int getGenMatchedParticleIndex(InputObject);
190     int getPdgIdBinValue(int);
191     int findTauMotherIndex(const BNmcparticle*);
192    
193 lantonel 1.1
194     };
195    
196     #endif