ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.h
Revision: 1.9
Committed: Wed Feb 13 12:51:21 2013 UTC (12 years, 2 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.8: +12 -5 lines
Log Message:
added pile-up reweighting

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    
24     #include "ProductArea/BNcollections/interface/BNbxlumi.h"
25     #include "ProductArea/BNcollections/interface/BNelectron.h"
26     #include "ProductArea/BNcollections/interface/BNevent.h"
27     #include "ProductArea/BNcollections/interface/BNjet.h"
28     #include "ProductArea/BNcollections/interface/BNmcparticle.h"
29     #include "ProductArea/BNcollections/interface/BNmet.h"
30     #include "ProductArea/BNcollections/interface/BNmuon.h"
31     #include "ProductArea/BNcollections/interface/BNphoton.h"
32     #include "ProductArea/BNcollections/interface/BNprimaryvertex.h"
33     #include "ProductArea/BNcollections/interface/BNskimbits.h"
34     #include "ProductArea/BNcollections/interface/BNsupercluster.h"
35     #include "ProductArea/BNcollections/interface/BNtrack.h"
36     #include "ProductArea/BNcollections/interface/BNtrigger.h"
37     #include "ProductArea/BNcollections/interface/BNtrigobj.h"
38     #include "ProductArea/BNcollections/interface/BNtau.h"
39     #include "ProductArea/BNcollections/interface/BNgenjet.h"
40    
41     #include "OSUT3Analysis/AnaTools/interface/CutFlow.h"
42 lantonel 1.9 #include "OSUT3Analysis/AnaTools/interface/PUWeight.h"
43 lantonel 1.1
44    
45    
46    
47     using namespace std;
48    
49     class OSUAnalysis : public edm::EDAnalyzer
50     {
51     public:
52     OSUAnalysis (const edm::ParameterSet &);
53     ~OSUAnalysis ();
54    
55     void analyze (const edm::Event &, const edm::EventSetup &);
56     bool evaluateComparison (double, string, double);
57 lantonel 1.2 bool evaluateTriggers (vector<string>,const BNtriggerCollection*);
58 lantonel 1.3 double applyFunction(string, double);
59    
60 lantonel 1.4 double valueLookup (const BNjet* object, string variable, string function = "");
61     double valueLookup (const BNmuon* object, string variable, string function = "");
62     double valueLookup (const BNelectron* object, string variable, string function = "");
63     double valueLookup (const BNevent* object, string variable, string function = "");
64     double valueLookup (const BNtau* object, string variable, string function = "");
65     double valueLookup (const BNmet* object, string variable, string function = "");
66     double valueLookup (const BNtrack* object, string variable, string function = "");
67     double valueLookup (const BNgenjet* object, string variable, string function = "");
68     double valueLookup (const BNmcparticle* object, string variable, string function = "");
69     double valueLookup (const BNprimaryvertex* object, string variable, string function = "");
70     double valueLookup (const BNbxlumi* object, string variable, string function = "");
71     double valueLookup (const BNphoton* object, string variable, string function = "");
72     double valueLookup (const BNsupercluster* object, string variable, string function = "");
73 lantonel 1.1 //BNskimbits
74     //BNtrigobj
75    
76     vector<string> splitString (string);
77    
78    
79     private:
80    
81     //flagMap:
82     //string holds input collection type
83     //outer vector corresponds to each cut
84     //inner vector corresponds to each object in input collection
85     //bool tells if object passes or fails cuts
86     typedef map<string, vector < vector<bool> > > flagMap;
87    
88     //counterMap:
89     //string holds input collection type
90     //vector corresponds to each cut
91     //int holds number of objects passing all cuts up to that point
92     typedef map<string ,vector <int> > counterMap;
93    
94     // Remember to define parameters to be retrieved from the configuration file.
95     edm::InputTag jets_;
96     edm::InputTag muons_;
97     edm::InputTag electrons_;
98     edm::InputTag events_;
99     edm::InputTag taus_;
100     edm::InputTag mets_;
101     edm::InputTag tracks_;
102     edm::InputTag genjets_;
103     edm::InputTag mcparticles_;
104     edm::InputTag primaryvertexs_;
105     edm::InputTag bxlumis_;
106     edm::InputTag photons_;
107     edm::InputTag superclusters_;
108 lantonel 1.2 edm::InputTag triggers_;
109 lantonel 1.9 std::string puFile_;
110     std::string dataPU_;
111     std::string dataset_;
112     std::string datasetType_;
113 lantonel 1.1 vector<edm::ParameterSet> channels_;
114 lantonel 1.4 vector<edm::ParameterSet> histogramSets_;
115 lantonel 1.9 bool plotAllObjectsInPassingEvents_;
116 lantonel 1.1
117 lantonel 1.9 BNprimaryvertex *primaryVertex_;
118 lantonel 1.8
119 lantonel 1.1 vector<map<string, TH1D*> > oneDHists_;
120 lantonel 1.6 vector<map<string, TH2D*> > twoDHists_;
121 lantonel 1.1
122     edm::Service<TFileService> fs_;
123    
124     CutFlow *masterCutFlow_;
125     vector<CutFlow *> cutFlows_;
126    
127 lantonel 1.4 typedef struct {
128     string name;
129     string title;
130     vector<double> bins;
131     string inputCollection;
132 lantonel 1.6 vector<string> inputVariables;
133 lantonel 1.4 string function;
134     } histogram;
135 lantonel 1.1
136     struct cut {
137     string inputCollection;
138     string variable;
139     string comparativeOperator;
140 lantonel 1.2 string function;
141 lantonel 1.1 double cutValue;
142     int numberRequired;
143     string eventComparativeOperator;
144     string name;
145     };
146    
147     struct channel {
148     string name;
149 lantonel 1.2 vector<string> triggers;
150 lantonel 1.1 vector<cut> cuts;
151     };
152    
153 lantonel 1.4 vector<string> objectsToPlot;
154 lantonel 1.1 vector<string> allNecessaryObjects;
155     vector<channel> channels;
156 lantonel 1.4 vector<histogram> histograms;
157 lantonel 1.1
158 lantonel 1.9 PUWeight *puWeight_;
159    
160 lantonel 1.1 template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string);
161 lantonel 1.9 template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double);
162     template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double);
163 lantonel 1.1
164    
165    
166     };
167    
168     #endif