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.24 by lantonel, Thu Apr 25 07:51:24 2013 UTC vs.
Revision 1.35 by wulsin, Fri May 31 09:05:53 2013 UTC

# Line 9 | Line 9
9   #include <fstream>
10   #include <iostream>
11   #include <algorithm>
12 + #include <regex>
13   #include "TH1.h"
14   #include "TH2.h"
15   #include "TH1D.h"
16   #include "TH2D.h"
17   #include "TLorentzVector.h"
18 + #include "TTree.h"
19  
20   #include "FWCore/Framework/interface/EDAnalyzer.h"
21   #include "FWCore/Framework/interface/Event.h"
# Line 43 | Line 45
45   #include "ProductArea/BNcollections/interface/BNtau.h"
46   #include "ProductArea/BNcollections/interface/BNgenjet.h"
47  
48 +
49   #include "OSUT3Analysis/AnaTools/interface/CutFlow.h"
50   #include "OSUT3Analysis/AnaTools/interface/PUWeight.h"
51   #include "OSUT3Analysis/AnaTools/interface/SFWeight.h"
52  
53 < #ifdef DISPLACED_SUSY
51 < #include "DisplacedSUSY/Configuration/interface/CTauWeight.h"
52 < #endif
53 > #include "OSUT3Analysis/AnaTools/interface/StopCTauWeight.h"
54  
55   using namespace std;
56  
# Line 61 | Line 62 | class OSUAnalysis : public edm::EDAnalyz
62  
63        void analyze (const edm::Event &, const edm::EventSetup &);
64        bool evaluateComparison (double, string, double);
65 <      bool evaluateTriggers   (vector<string>,const BNtriggerCollection*);
65 >      bool evaluateComparison (string, string, string);
66 >      bool evaluateTriggers   (vector<string>, vector<string>, const BNtriggerCollection*);
67        double applyFunction(string, double);
68  
69 <      double valueLookup (const BNjet* object, string variable, string function = "");
70 <      double valueLookup (const BNmuon* object, string variable, string function = "");
71 <      double valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function = "");
72 <      double valueLookup (const BNelectron* object, string variable, string function = "");
73 <      double valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function = "");
74 <      double valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function = "");
75 <      double valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function = "");
76 <      double valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function = "");
77 <      double valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function = "");
78 <      double valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function = "");
79 <      double valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function);
80 <      double valueLookup (const BNevent* object, string variable, string function = "");
81 <      double valueLookup (const BNtau* object, string variable, string function = "");
82 <      double valueLookup (const BNmet* object, string variable, string function = "");
83 <      double valueLookup (const BNtrack* object, string variable, string function = "");
84 <      double valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function = "");
85 <      double valueLookup (const BNgenjet* object, string variable, string function = "");
86 <      double valueLookup (const BNmcparticle* object, string variable, string function = "");
87 <      double valueLookup (const BNprimaryvertex* object, string variable, string function = "");
88 <      double valueLookup (const BNbxlumi* object, string variable, string function = "");
89 <      double valueLookup (const BNphoton* object, string variable, string function = "");
90 <      double valueLookup (const BNsupercluster* object, string variable, string function = "");
91 <
92 < #ifdef DISPLACED_SUSY
93 <      double valueLookup (const BNstop* object, string variable, string function = "");
94 < #endif
69 >      double valueLookup (const BNjet* object, string variable, string function, string &stringValue);
70 >      double valueLookup (const BNmuon* object, string variable, string function, string &stringValue);
71 >      double valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function, string &stringValue);
72 >      double valueLookup (const BNelectron* object, string variable, string function, string &stringValue);
73 >      double valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue);
74 >      double valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function, string &stringValue);
75 >      double valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue);
76 >      double valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function, string &stringValue);
77 >      double valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue);
78 >      double valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue);
79 >      double valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function, string &stringValue);
80 >      double valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function, string &stringValue);
81 >      double valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function, string &stringValue);
82 >      double valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function, string &stringValue);
83 >      double valueLookup (const BNevent* object, string variable, string function, string &stringValue);
84 >      double valueLookup (const BNtau* object, string variable, string function, string &stringValue);
85 >      double valueLookup (const BNmet* object, string variable, string function, string &stringValue);
86 >      double valueLookup (const BNtrack* object, string variable, string function, string &stringValue);
87 >      double valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function, string &stringValue);
88 >      double valueLookup (const BNgenjet* object, string variable, string function, string &stringValue);
89 >      double valueLookup (const BNmcparticle* object, string variable, string function, string &stringValue);
90 >      double valueLookup (const BNprimaryvertex* object, string variable, string function, string &stringValue);
91 >      double valueLookup (const BNbxlumi* object, string variable, string function, string &stringValue);
92 >      double valueLookup (const BNphoton* object, string variable, string function, string &stringValue);
93 >      double valueLookup (const BNsupercluster* object, string variable, string function, string &stringValue);
94 >      double valueLookup (const BNtrigobj* object, string variable, string function, string &stringValue);
95 >      double valueLookup (const BNelectron* object1, const BNtrigobj* object2, string variable, string function, string &stringValue);
96 >      double valueLookup (const BNmuon* object1, const BNtrigobj* object2, string variable, string function, string &stringValue);
97 >      double valueLookup (const BNstop* object, string variable, string function, string &stringValue);
98 >
99        int getTrkIsIso (const BNtrack* track1, const BNtrackCollection* trackColl);
100        double getTrkPtTrue (const BNtrack* track1, const BNmcparticleCollection* genPartColl);
101        double getTrkPtRes (const BNtrack* track1);
# Line 102 | Line 108 | class OSUAnalysis : public edm::EDAnalyz
108        //BNtrigobj
109  
110        vector<string> splitString (string);
111 <      void getTwoObjs(string tempInputCollection, string& obj1, string& obj2);
112 <      string getObjToGet(string obj);  
111 >      void getTwoObjs(string tempInputCollection, string& obj1, string& obj2);
112 >      string getObjToGet(string obj);
113  
114      private:
115  
# Line 136 | Line 142 | class OSUAnalysis : public edm::EDAnalyz
142        edm::InputTag photons_;
143        edm::InputTag superclusters_;
144        edm::InputTag triggers_;
145 <      std::string puFile_;
146 <      std::string deadEcalFile_;
147 <      std::string muonSFFile_;
148 <      std::string dataPU_;
149 <      std::string electronSFID_;
150 <      std::string muonSF_;
151 <      std::string dataset_;
152 <      std::string datasetType_;
145 >      edm::InputTag trigobjs_;
146 >      string puFile_;
147 >      string deadEcalFile_;
148 >      string muonSFFile_;
149 >      string dataPU_;
150 >      string electronSFID_;
151 >      string muonSF_;
152 >      string dataset_;
153 >      string datasetType_;
154        vector<edm::ParameterSet> channels_;
155        vector<edm::ParameterSet> histogramSets_;
156 +      vector<edm::ParameterSet> treeBranchSets_;  
157        bool plotAllObjectsInPassingEvents_;
158        bool doPileupReweighting_;
159 <      bool printEventInfo_;  
160 <      bool useTrackCaloRhoCorr_;  // to use the calo-based rho correction for the by-hand calculation of the track isolation energy
159 >      bool applyLeptonSF_;
160 >      bool printEventInfo_;
161 >      bool useTrackCaloRhoCorr_;  // to use the calo-based rho correction for the by-hand calculation of the track isolation energy
162        vector<double> stopCTau_;
163 <
163 >      bool GetPlotsAfterEachCut_;
164 >      
165        struct DeadEcal {
166          double etaEcal;
167          double phiEcal;
168        };
169  
170 <      std::vector<DeadEcal> DeadEcalVec;
170 >      vector<DeadEcal> DeadEcalVec;
171  
172  
173        //Collections
174        edm::Handle<BNtriggerCollection> triggers;
175 +      edm::Handle<BNtrigobjCollection> trigobjs;
176        edm::Handle<BNjetCollection> jets;
177        edm::Handle<BNmuonCollection> muons;
178        edm::Handle<BNelectronCollection> electrons;
# Line 175 | Line 186 | class OSUAnalysis : public edm::EDAnalyz
186        edm::Handle<BNbxlumiCollection> bxlumis;
187        edm::Handle<BNphotonCollection> photons;
188        edm::Handle<BNsuperclusterCollection> superclusters;
178 #ifdef DISPLACED_SUSY
189        edm::Handle<BNstopCollection> stops;
190 < #endif
191 <      edm::Handle<double> rhokt6CaloJetsHandle_;  
190 >
191 >      edm::Handle<double> rhokt6CaloJetsHandle_;
192  
193        flagMap cumulativeFlags;
194  
195 <      vector<map<string, TH1D*> > oneDHists_;
196 <      vector<map<string, TH2D*> > twoDHists_;
195 >      vector<vector<map<string, TH1D*>>> oneDHists_;
196 >      vector<vector<map<string, TH2D*>>> twoDHists_;
197 >      vector<TTree*> BNTrees_;  // one tree per channel  
198 >      /* vector<map<TString, double>> BNTreeVars_;  // the values of the branches in the TTree, for each of the channels */
199 >      /* double debugVar_;  // Warning:  must be double, not float, if assigning to a branch as a double.   */
200 >      /* vector<double> debugVars_;   */
201 >      /* double debugVarsArray_[100];   */
202 >      /* map<string, double> debugVarsMap_;   */
203 >      map<string, vector<float>> BNTreeBranchVals_;  // data structure to hold the values of the branches to be stored in the BNTrees_; the string is the name of a variable  
204  
205        edm::Service<TFileService> fs_;
206  
# Line 194 | Line 211 | class OSUAnalysis : public edm::EDAnalyz
211          string name;
212          string title;
213          vector<double> bins;
214 +        vector<double> variableBinsX;
215 +        vector<double> variableBinsY;
216          string inputCollection;
217          vector<string> inputVariables;
218        } histogram;
219  
220 +      typedef struct {
221 +        string name;
222 +        /* string title; */
223 +        /* vector<double> bins; */
224 +        /* vector<double> variableBinsX; */
225 +        /* vector<double> variableBinsY; */
226 +        string inputCollection;
227 +        //        vector<string> inputVariables;
228 +        string inputVariable;
229 +      } BranchSpecs;
230 +
231 +
232        struct cut {
233          string inputCollection;
234          vector<string> functions;
235          vector<string> variables;
236          vector<string> comparativeOperators;// >, <, =, etc.
237          vector<double> cutValues;
238 +        vector<string> cutStringValues;
239          vector<string> logicalOperators;//and, or
240          int numSubcuts;
241          int    numberRequired;
# Line 214 | Line 246 | class OSUAnalysis : public edm::EDAnalyz
246        struct channel {
247          string name;
248          vector<string> triggers;
249 +        vector<string> triggersToVeto;
250          vector<cut> cuts;
251        };
252  
# Line 222 | Line 255 | class OSUAnalysis : public edm::EDAnalyz
255        vector<string>  objectsToPlot;
256        vector<channel> channels;
257        vector<histogram> histograms;
258 +      vector<BranchSpecs> treeBranches_;
259  
260        PUWeight *puWeight_;
261        MuonSFWeight *muonSFWeight_;
262 +      double muonScaleFactor_;
263        ElectronSFWeight *electronSFWeight_;
264 < #ifdef DISPLACED_SUSY
265 <      CTauWeight *cTauWeight_;
266 < #endif
267 <      double cTauScaleFactor_;
264 >      double electronScaleFactor_;
265 >
266 >      StopCTauWeight *stopCTauWeight_;
267 >      double stopCTauScaleFactor_;
268  
269        template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string);
270        template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string);
271  
272 +      template <class InputCollection> void assignTreeBranch(BranchSpecs brSpecs, InputCollection inputCollection, vector<bool> flags);  
273        template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double);
274        template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
275        template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double);
276        template <class InputCollection1, class InputCollection2> void fill2DHistogram(TH2*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double);
277 <      bool getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1);  
277 >      bool getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1);
278  
279        template <class InputObject> int getGenMatchedParticleIndex(InputObject);
280        int getPdgIdBinValue(int);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines