15 |
|
#include "TH1D.h" |
16 |
|
#include "TH2D.h" |
17 |
|
#include "TLorentzVector.h" |
18 |
+ |
#include "TTree.h" |
19 |
|
|
20 |
< |
#include "FWCore/Framework/interface/EDAnalyzer.h" |
20 |
> |
#include "FWCore/Framework/interface/EDProducer.h" |
21 |
|
#include "FWCore/Framework/interface/Event.h" |
22 |
|
#include "FWCore/Framework/interface/EventSetup.h" |
23 |
|
#include "FWCore/ParameterSet/interface/ParameterSet.h" |
49 |
|
#include "OSUT3Analysis/AnaTools/interface/CutFlow.h" |
50 |
|
#include "OSUT3Analysis/AnaTools/interface/PUWeight.h" |
51 |
|
#include "OSUT3Analysis/AnaTools/interface/SFWeight.h" |
52 |
< |
|
52 |
> |
#include "OSUT3Analysis/AnaTools/interface/BtagSFWeight.h" |
53 |
|
#include "OSUT3Analysis/AnaTools/interface/StopCTauWeight.h" |
54 |
|
|
55 |
|
using namespace std; |
56 |
|
|
57 |
< |
class OSUAnalysis : public edm::EDAnalyzer |
57 |
> |
class OSUAnalysis : public edm::EDProducer |
58 |
|
{ |
59 |
|
public: |
60 |
|
OSUAnalysis (const edm::ParameterSet &); |
61 |
|
~OSUAnalysis (); |
62 |
|
|
63 |
< |
void analyze (const edm::Event &, const edm::EventSetup &); |
63 |
> |
void produce (edm::Event &, const edm::EventSetup &); |
64 |
|
bool evaluateComparison (double, string, double); |
65 |
|
bool evaluateComparison (string, string, string); |
66 |
|
bool evaluateTriggers (vector<string>, vector<string>, const BNtriggerCollection*); |
153 |
|
string datasetType_; |
154 |
|
vector<edm::ParameterSet> channels_; |
155 |
|
vector<edm::ParameterSet> histogramSets_; |
156 |
+ |
bool useEDMFormat_; |
157 |
+ |
vector<edm::ParameterSet> treeBranchSets_; |
158 |
|
bool plotAllObjectsInPassingEvents_; |
159 |
|
bool doPileupReweighting_; |
160 |
|
bool applyLeptonSF_; |
161 |
+ |
bool applyBtagSF_; |
162 |
+ |
int minBtag_; |
163 |
+ |
int maxBtag_; |
164 |
|
bool printEventInfo_; |
165 |
+ |
bool printAllTriggers_; |
166 |
|
bool useTrackCaloRhoCorr_; // to use the calo-based rho correction for the by-hand calculation of the track isolation energy |
167 |
|
vector<double> stopCTau_; |
168 |
|
bool GetPlotsAfterEachCut_; |
199 |
|
|
200 |
|
vector<vector<map<string, TH1D*>>> oneDHists_; |
201 |
|
vector<vector<map<string, TH2D*>>> twoDHists_; |
202 |
+ |
vector<TTree*> BNTrees_; // one tree per channel |
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 |
|
|
217 |
|
vector<string> inputVariables; |
218 |
|
} histogram; |
219 |
|
|
220 |
+ |
typedef struct { |
221 |
+ |
string name; |
222 |
+ |
string inputCollection; |
223 |
+ |
string inputVariable; |
224 |
+ |
} BranchSpecs; |
225 |
+ |
|
226 |
+ |
|
227 |
|
struct cut { |
228 |
|
string inputCollection; |
229 |
|
vector<string> functions; |
250 |
|
vector<string> objectsToPlot; |
251 |
|
vector<channel> channels; |
252 |
|
vector<histogram> histograms; |
253 |
+ |
vector<BranchSpecs> treeBranches_; |
254 |
|
|
255 |
|
PUWeight *puWeight_; |
256 |
|
MuonSFWeight *muonSFWeight_; |
257 |
|
double muonScaleFactor_; |
258 |
|
ElectronSFWeight *electronSFWeight_; |
259 |
|
double electronScaleFactor_; |
260 |
+ |
BtagSFWeight *bTagSFWeight_; |
261 |
+ |
double bTagScaleFactor_; |
262 |
|
|
263 |
|
StopCTauWeight *stopCTauWeight_; |
264 |
|
double stopCTauScaleFactor_; |
266 |
|
template <class InputCollection> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection, string); |
267 |
|
template <class InputCollection1, class InputCollection2> void setObjectFlags(cut &, uint, flagMap &, flagMap &, InputCollection1, InputCollection2, vector<bool>, vector<bool>, string); |
268 |
|
|
269 |
+ |
template <class InputCollection> void assignTreeBranch(BranchSpecs brSpecs, InputCollection inputCollection, vector<bool> flags); |
270 |
|
template <class InputCollection> void fill1DHistogram(TH1*, histogram, InputCollection, vector<bool>, double); |
271 |
|
template <class InputCollection1, class InputCollection2> void fill1DHistogram(TH1*, histogram, InputCollection1, InputCollection2, vector<bool>, vector<bool>, vector<bool>, double); |
272 |
|
template <class InputCollection> void fill2DHistogram(TH2*, histogram, InputCollection, vector<bool>, double); |