ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.h
Revision: 1.4
Committed: Thu Jan 31 22:05:56 2013 UTC (12 years, 3 months ago) by lantonel
Content type: text/plain
Branch: MAIN
Changes since 1.3: +25 -15 lines
Log Message:
moved the defining of histograms to the configuration level

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