1 |
#ifndef NtupleWriter_h
|
2 |
#define NtupleWriter_h
|
3 |
|
4 |
// system include files
|
5 |
#include <memory>
|
6 |
|
7 |
// user include files
|
8 |
|
9 |
#include "FWCore/Framework/interface/ESHandle.h"
|
10 |
#include "FWCore/Utilities/interface/InputTag.h"
|
11 |
#include "DataFormats/Common/interface/Handle.h"
|
12 |
|
13 |
#include "FWCore/Framework/interface/Frameworkfwd.h"
|
14 |
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
15 |
|
16 |
#include "FWCore/Framework/interface/Event.h"
|
17 |
#include "FWCore/Framework/interface/MakerMacros.h"
|
18 |
|
19 |
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
20 |
#include "FWCore/ServiceRegistry/interface/Service.h"
|
21 |
#include "CommonTools/UtilAlgos/interface/TFileService.h"
|
22 |
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
|
23 |
#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
|
24 |
#include "TTree.h"
|
25 |
#include "TMath.h"
|
26 |
#include "TLorentzVector.h"
|
27 |
|
28 |
#include "DataFormats/PatCandidates/interface/Electron.h"
|
29 |
#include "DataFormats/PatCandidates/interface/Muon.h"
|
30 |
#include "DataFormats/PatCandidates/interface/Tau.h"
|
31 |
#include "DataFormats/PatCandidates/interface/Jet.h"
|
32 |
#include "DataFormats/PatCandidates/interface/Photon.h"
|
33 |
#include "DataFormats/PatCandidates/interface/MET.h"
|
34 |
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
|
35 |
#include "SimDataFormats/GeneratorProducts/interface/PdfInfo.h"
|
36 |
#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
|
37 |
#include "DataFormats/Common/interface/TriggerResults.h"
|
38 |
#include "FWCore/Framework/interface/TriggerNamesService.h"
|
39 |
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
|
40 |
#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
|
41 |
#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h"
|
42 |
#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h"
|
43 |
#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h"
|
44 |
#include "RecoEgamma/EgammaTools/interface/ConversionTools.h"
|
45 |
#include "DataFormats/Luminosity/interface/LumiSummary.h"
|
46 |
|
47 |
#include "EGamma/EGammaAnalysisTools/interface/ElectronEffectiveArea.h"
|
48 |
|
49 |
#include "UHHAnalysis/NtupleWriter/Objects/Particle.h"
|
50 |
#include "UHHAnalysis/NtupleWriter/Objects/PFParticle.h"
|
51 |
#include "UHHAnalysis/NtupleWriter/Objects/Jet.h"
|
52 |
#include "UHHAnalysis/NtupleWriter/Objects/Electron.h"
|
53 |
#include "UHHAnalysis/NtupleWriter/Objects/Muon.h"
|
54 |
#include "UHHAnalysis/NtupleWriter/Objects/Tau.h"
|
55 |
#include "UHHAnalysis/NtupleWriter/Objects/Photon.h"
|
56 |
#include "UHHAnalysis/NtupleWriter/Objects/MET.h"
|
57 |
#include "UHHAnalysis/NtupleWriter/Objects/PrimaryVertex.h"
|
58 |
#include "UHHAnalysis/NtupleWriter/Objects/TopJet.h"
|
59 |
#include "UHHAnalysis/NtupleWriter/Objects/GenTopJet.h"
|
60 |
#include "UHHAnalysis/NtupleWriter/Objects/GenInfo.h"
|
61 |
#include "UHHAnalysis/NtupleWriter/Objects/GenParticle.h"
|
62 |
|
63 |
//
|
64 |
// class declaration
|
65 |
//
|
66 |
|
67 |
|
68 |
|
69 |
//allow Nmax different electron, muon, jet collections
|
70 |
const int Nmax=12;
|
71 |
|
72 |
class NtupleWriter : public edm::EDAnalyzer {
|
73 |
public:
|
74 |
explicit NtupleWriter(const edm::ParameterSet&);
|
75 |
~NtupleWriter();
|
76 |
|
77 |
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
|
78 |
|
79 |
private:
|
80 |
virtual void beginJob() ;
|
81 |
virtual void analyze(const edm::Event&, const edm::EventSetup&);
|
82 |
virtual void endJob() ;
|
83 |
|
84 |
virtual void beginRun(edm::Run const&, edm::EventSetup const&);
|
85 |
virtual void endRun(edm::Run const&, edm::EventSetup const&);
|
86 |
virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
|
87 |
//virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
|
88 |
|
89 |
/// fills constituents of the pat_jet into the Ntuple and stores a reference to those in the provided topjet
|
90 |
void StoreJetConstituents(const pat::Jet & pat_jet, Jet & topjet);
|
91 |
|
92 |
/// fill PF candidates from pf_cands to "pfparticles" collection in a cone of radius R0 around inpart (lepton, most likely)
|
93 |
void StorePFCandsInCone(Particle* part, const std::vector<reco::PFCandidate>& pf_cands, double R0);
|
94 |
|
95 |
// ----------member data ---------------------------
|
96 |
TFile *outfile;
|
97 |
TTree *tr;
|
98 |
TString fileName;
|
99 |
|
100 |
bool doElectrons;
|
101 |
bool doMuons;
|
102 |
bool doTaus;
|
103 |
bool doJets;
|
104 |
bool doGenJets;
|
105 |
bool doTopJets;
|
106 |
bool doTopJetsConstituents;
|
107 |
bool doGenTopJets;
|
108 |
bool doMET;
|
109 |
bool doPhotons;
|
110 |
bool doGenInfo;
|
111 |
bool doAllGenParticles;
|
112 |
bool doLumiInfo;
|
113 |
bool doPV;
|
114 |
bool doTrigger;
|
115 |
bool doTagInfos;
|
116 |
bool storePFsAroundLeptons;
|
117 |
|
118 |
int run;
|
119 |
int luminosityBlock;
|
120 |
int event;
|
121 |
bool isRealData;
|
122 |
//bool HBHENoiseFilterResult;
|
123 |
float rho;
|
124 |
|
125 |
float intgDelLumi;
|
126 |
float intgRecLumi;
|
127 |
float totalDelLumi;
|
128 |
float totalRecLumi;
|
129 |
|
130 |
edm::InputTag rho_source;
|
131 |
|
132 |
std::vector<std::string> electron_sources;
|
133 |
std::vector<Electron> eles[Nmax];
|
134 |
|
135 |
std::vector<std::string> muon_sources;
|
136 |
std::vector<Muon> mus[Nmax];
|
137 |
|
138 |
std::vector<std::string> tau_sources;
|
139 |
std::vector<Tau> taus[Nmax];
|
140 |
double tau_ptmin;
|
141 |
double tau_etamax;
|
142 |
|
143 |
std::vector<std::string> jet_sources;
|
144 |
std::vector<Jet> jets[Nmax];
|
145 |
double jet_ptmin;
|
146 |
double jet_etamax;
|
147 |
|
148 |
std::vector<std::string> genjet_sources;
|
149 |
std::vector<Particle> genjets[Nmax];
|
150 |
double genjet_ptmin;
|
151 |
double genjet_etamax;
|
152 |
|
153 |
std::vector<std::string> topjet_sources;
|
154 |
std::vector<TopJet> topjets[Nmax];
|
155 |
double topjet_ptmin;
|
156 |
double topjet_etamax;
|
157 |
|
158 |
std::vector<std::string> topjet_constituents_sources;
|
159 |
std::vector<PFParticle> pfparticles; // only one collection allowed!
|
160 |
|
161 |
std::vector<std::string> gentopjet_sources;
|
162 |
std::vector<GenTopJet> gentopjets[Nmax];
|
163 |
double gentopjet_ptmin;
|
164 |
double gentopjet_etamax;
|
165 |
|
166 |
std::vector<std::string> photon_sources;
|
167 |
std::vector<Photon> phs[Nmax];
|
168 |
|
169 |
std::vector<std::string> met_sources;
|
170 |
MET met[Nmax];
|
171 |
|
172 |
std::vector<std::string> pv_sources;
|
173 |
std::vector<PrimaryVertex> pvs[Nmax];
|
174 |
|
175 |
float beamspot_x0;
|
176 |
float beamspot_y0;
|
177 |
float beamspot_z0;
|
178 |
|
179 |
std::string pf_around_leptons_source;
|
180 |
|
181 |
edm::InputTag genparticle_source;
|
182 |
GenInfo genInfo;
|
183 |
std::vector<GenParticle> genps;
|
184 |
edm::InputTag SVComputer_;
|
185 |
std::vector<std::string> trigger_prefixes;
|
186 |
//std::map<std::string, bool> triggerResults;
|
187 |
std::vector<std::string> triggerNames;
|
188 |
std::vector<bool> triggerResults;
|
189 |
//std::vector<int> L1_prescale;
|
190 |
//std::vector<int> HLT_prescale;
|
191 |
|
192 |
//HLTConfigProvider hlt_cfg;
|
193 |
bool newrun;
|
194 |
bool previouslumiblockwasfilled;
|
195 |
|
196 |
};
|
197 |
|
198 |
|
199 |
#endif
|