ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.h
(Generate patch)

Comparing UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.h (file contents):
Revision 1.1 by lantonel, Mon Jan 21 10:39:36 2013 UTC vs.
Revision 1.21 by ahart, Thu Apr 11 00:56:49 2013 UTC

# Line 6 | Line 6
6   #include <string>
7   #include <vector>
8  
9 + #include <fstream>
10 + #include <iostream>
11 + #include <algorithm>
12 + #include "TH1.h"
13 + #include "TH2.h"
14   #include "TH1D.h"
15   #include "TH2D.h"
16   #include "TLorentzVector.h"
# Line 18 | Line 23
23   #include "DataFormats/Common/interface/Handle.h"
24   #include "CommonTools/UtilAlgos/interface/TFileService.h"
25   #include "FWCore/Framework/interface/MakerMacros.h"
26 + #include "DataFormats/Math/interface/deltaPhi.h"
27 + #include "DataFormats/Math/interface/deltaR.h"
28  
29   #include "ProductArea/BNcollections/interface/BNbxlumi.h"
30   #include "ProductArea/BNcollections/interface/BNelectron.h"
# Line 37 | Line 44
44   #include "ProductArea/BNcollections/interface/BNgenjet.h"
45  
46   #include "OSUT3Analysis/AnaTools/interface/CutFlow.h"
47 + #include "OSUT3Analysis/AnaTools/interface/PUWeight.h"
48 + #include "OSUT3Analysis/AnaTools/interface/SFWeight.h"
49  
50 <
51 <
50 > #ifdef DISPLACED_SUSY
51 > #include "DisplacedSUSY/Configuration/interface/CTauWeight.h"
52 > #endif
53  
54   using namespace std;
55  
# Line 51 | Line 61 | class OSUAnalysis : public edm::EDAnalyz
61  
62        void analyze (const edm::Event &, const edm::EventSetup &);
63        bool evaluateComparison (double, string, double);
64 +      bool evaluateTriggers   (vector<string>,const BNtriggerCollection*);
65 +      double applyFunction(string, double);
66 +
67 +      double valueLookup (const BNjet* object, string variable, string function = "");
68 +      double valueLookup (const BNmuon* object, string variable, string function = "");
69 +      double valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function = "");
70 +      double valueLookup (const BNelectron* object, string variable, string function = "");
71 +      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 +      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 +      double valueLookup (const BNevent* object, string variable, string function = "");
78 +      double valueLookup (const BNtau* object, string variable, string function = "");
79 +      double valueLookup (const BNmet* object, string variable, string function = "");
80 +      double valueLookup (const BNtrack* object, string variable, string function = "");
81 +      double valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function = "");
82 +      double valueLookup (const BNgenjet* object, string variable, string function = "");
83 +      double valueLookup (const BNmcparticle* object, string variable, string function = "");
84 +      double valueLookup (const BNprimaryvertex* object, string variable, string function = "");
85 +      double valueLookup (const BNbxlumi* object, string variable, string function = "");
86 +      double valueLookup (const BNphoton* object, string variable, string function = "");
87 +      double valueLookup (const BNsupercluster* object, string variable, string function = "");
88 +
89 +      int getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl);
90 +      double getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl);
91 +      double getTrkPtRes (const BNtrack* track1);
92 +      double getTrkIsIso (const BNtrack* track1);
93 +      double getTrkCaloTotRhoCorr(const BNtrack* track);
94 +      void WriteDeadEcal ();
95 +      int getTrkIsMatchedDeadEcal (const BNtrack* track1);
96  
55      double valueLookup (const BNjet*, string);
56      double valueLookup (const BNmuon*, string);
57      double valueLookup (const BNelectron*, string);
58      double valueLookup (const BNevent*, string);
59      double valueLookup (const BNtau*, string);
60      double valueLookup (const BNmet*, string);
61      double valueLookup (const BNtrack*, string);
62      double valueLookup (const BNgenjet*, string);
63      double valueLookup (const BNmcparticle*, string);
64      double valueLookup (const BNprimaryvertex*, string);
65      double valueLookup (const BNbxlumi*, string);
66      double valueLookup (const BNphoton*, string);
67      double valueLookup (const BNsupercluster*, string);
97        //BNskimbits
69      //BNtrigger
98        //BNtrigobj
99  
100        vector<string> splitString (string);
# Line 80 | Line 108 | class OSUAnalysis : public edm::EDAnalyz
108        //inner vector corresponds to each object in input collection
109        //bool         tells if object passes or fails cuts
110        typedef map<string, vector < vector<bool> > > flagMap;
111 <      
111 >
112        //counterMap:
113        //string holds input collection type
114        //vector corresponds to each cut
# Line 97 | Line 125 | class OSUAnalysis : public edm::EDAnalyz
125        edm::InputTag tracks_;
126        edm::InputTag genjets_;
127        edm::InputTag mcparticles_;
128 +      edm::InputTag stops_;
129        edm::InputTag primaryvertexs_;
130        edm::InputTag bxlumis_;
131        edm::InputTag photons_;
132        edm::InputTag superclusters_;
133 +      edm::InputTag triggers_;
134 +      std::string puFile_;
135 +      std::string deadEcalFile_;
136 +      std::string muonSFFile_;
137 +      std::string dataPU_;
138 +      std::string electronSFID_;
139 +      std::string muonSF_;
140 +      std::string dataset_;
141 +      std::string datasetType_;
142 +      vector<edm::ParameterSet> channels_;
143 +      vector<edm::ParameterSet> histogramSets_;
144 +      bool plotAllObjectsInPassingEvents_;
145 +      bool doPileupReweighting_;
146 +      bool printEventInfo_;  
147 +      bool useTrackCaloRhoCorr_;  // to use the calo-based rho correction for the by-hand calculation of the track isolation energy
148 +      vector<double> stopCTau_;
149 +
150 +      struct DeadEcal {
151 +        double etaEcal;
152 +        double phiEcal;
153 +      };
154  
155 +      std::vector<DeadEcal> DeadEcalVec;
156  
157 <      vector<edm::ParameterSet> channels_;
157 >
158 >      //Collections
159 >      edm::Handle<BNtriggerCollection> triggers;
160 >      edm::Handle<BNjetCollection> jets;
161 >      edm::Handle<BNmuonCollection> muons;
162 >      edm::Handle<BNelectronCollection> electrons;
163 >      edm::Handle<BNeventCollection> events;
164 >      edm::Handle<BNtauCollection> taus;
165 >      edm::Handle<BNmetCollection> mets;
166 >      edm::Handle<BNtrackCollection> tracks;
167 >      edm::Handle<BNgenjetCollection> genjets;
168 >      edm::Handle<BNmcparticleCollection> mcparticles;
169 >      edm::Handle<BNprimaryvertexCollection> primaryvertexs;
170 >      edm::Handle<BNbxlumiCollection> bxlumis;
171 >      edm::Handle<BNphotonCollection> photons;
172 >      edm::Handle<BNsuperclusterCollection> superclusters;
173 >      edm::Handle<double> rhokt6CaloJetsHandle_;  
174 >
175 >      flagMap cumulativeFlags;
176  
177        vector<map<string, TH1D*> > oneDHists_;
178 +      vector<map<string, TH2D*> > twoDHists_;
179  
180        edm::Service<TFileService> fs_;
181  
182        CutFlow *masterCutFlow_;
183        vector<CutFlow *> cutFlows_;
184  
185 +      typedef struct {
186 +        string name;
187 +        string title;
188 +        vector<double> bins;
189 +        string inputCollection;
190 +        vector<string> inputVariables;
191 +      } histogram;
192  
193        struct cut {
194 <        string inputCollection;
195 <        string variable;
196 <        string comparativeOperator;
197 <        double cutValue;
198 <        int    numberRequired;
199 <        string eventComparativeOperator;
200 <        string name;
194 >        string inputCollection;
195 >        vector<string> functions;
196 >        vector<string> variables;
197 >        vector<string> comparativeOperators;// >, <, =, etc.
198 >        vector<double> cutValues;
199 >        vector<string> logicalOperators;//and, or
200 >        int numSubcuts;
201 >        int    numberRequired;
202 >        string eventComparativeOperator;
203 >        string name;
204        };
205  
206        struct channel {
207 <        string name;
208 <        vector<cut> cuts;
209 <        vector<string> inputCollections;
207 >        string name;
208 >        vector<string> triggers;
209 >        vector<cut> cuts;
210        };
211  
212 <      vector<string>  allNecessaryObjects;
212 >      vector<string>  objectsToGet;
213 >      vector<string>  objectsToCut;
214 >      vector<string>  objectsToPlot;
215        vector<channel> channels;
216 +      vector<histogram> histograms;
217 +
218 +      PUWeight *puWeight_;
219 +      MuonSFWeight *muonSFWeight_;
220 +      ElectronSFWeight *electronSFWeight_;
221 + #ifdef DISPLACED_SUSY
222 +      CTauWeight *cTauWeight_;
223 + #endif
224 +      double cTauScaleFactor_;
225  
226        template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string);
227 +      template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string);
228 +
229 +      template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double);
230 +      template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
231 +      template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double);
232 +      template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
233 +
234 +      template <class InputObject> int getGenMatchedParticleIndex(InputObject);
235 +      int getPdgIdBinValue(int);
236 +      int findTauMotherIndex(const BNmcparticle*);
237 +
238 +      template <class InputObject> double getGenDeltaRLowest(InputObject);
239  
240  
241 +      const BNprimaryvertex *chosenVertex ();
242 +      const BNmet *chosenMET ();
243 +      const BNelectron *chosenElectron ();
244 +      const BNmuon *chosenMuon ();
245  
246    };
247  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines