ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/NtupleWriter/interface/NtupleWriter.h
Revision: 1.21
Committed: Thu Jun 20 15:03:50 2013 UTC (11 years, 10 months ago) by jott
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.20: +6 -2 lines
Log Message:
cleanup of code duplication, esp. for jet variables and for pfcandidate saving

File Contents

# User Rev Content
1 peiffer 1.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 peiffer 1.5 #include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h"
42     #include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h"
43     #include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h"
44 peiffer 1.7 #include "RecoEgamma/EgammaTools/interface/ConversionTools.h"
45     #include "DataFormats/Luminosity/interface/LumiSummary.h"
46 peiffer 1.1
47 peiffer 1.16 #include "EGamma/EGammaAnalysisTools/interface/ElectronEffectiveArea.h"
48    
49 peiffer 1.13 #include "UHHAnalysis/NtupleWriter/Objects/Particle.h"
50 rkogler 1.19 #include "UHHAnalysis/NtupleWriter/Objects/PFParticle.h"
51 peiffer 1.13 #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 rkogler 1.19 #include "UHHAnalysis/NtupleWriter/Objects/GenTopJet.h"
60 peiffer 1.13 #include "UHHAnalysis/NtupleWriter/Objects/GenInfo.h"
61     #include "UHHAnalysis/NtupleWriter/Objects/GenParticle.h"
62 peiffer 1.5
63 peiffer 1.1 //
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 jott 1.21 //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 rkogler 1.20 void StorePFCandsInCone(Particle* part, const std::vector<reco::PFCandidate>& pf_cands, double R0);
94 peiffer 1.1
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 peiffer 1.18 bool doGenJets;
105 peiffer 1.1 bool doTopJets;
106 rkogler 1.19 bool doTopJetsConstituents;
107 peiffer 1.9 bool doGenTopJets;
108 peiffer 1.1 bool doMET;
109     bool doPhotons;
110     bool doGenInfo;
111 peiffer 1.8 bool doAllGenParticles;
112 peiffer 1.7 bool doLumiInfo;
113 peiffer 1.1 bool doPV;
114 peiffer 1.6 bool doTrigger;
115 eusai 1.17 bool doTagInfos;
116 rkogler 1.20 bool storePFsAroundLeptons;
117 peiffer 1.1
118 peiffer 1.12 int run;
119     int luminosityBlock;
120 peiffer 1.1 int event;
121     bool isRealData;
122 peiffer 1.14 //bool HBHENoiseFilterResult;
123     float rho;
124 peiffer 1.1
125 peiffer 1.7 float intgDelLumi;
126     float intgRecLumi;
127     float totalDelLumi;
128     float totalRecLumi;
129    
130 peiffer 1.14 edm::InputTag rho_source;
131    
132 peiffer 1.1 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 peiffer 1.18 std::vector<std::string> genjet_sources;
149     std::vector<Particle> genjets[Nmax];
150     double genjet_ptmin;
151     double genjet_etamax;
152    
153 peiffer 1.1 std::vector<std::string> topjet_sources;
154     std::vector<TopJet> topjets[Nmax];
155     double topjet_ptmin;
156     double topjet_etamax;
157    
158 rkogler 1.19 std::vector<std::string> topjet_constituents_sources;
159     std::vector<PFParticle> pfparticles; // only one collection allowed!
160    
161 peiffer 1.9 std::vector<std::string> gentopjet_sources;
162 rkogler 1.19 std::vector<GenTopJet> gentopjets[Nmax];
163 peiffer 1.9 double gentopjet_ptmin;
164     double gentopjet_etamax;
165    
166 peiffer 1.1 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 rkogler 1.20 std::string pf_around_leptons_source;
180    
181 peiffer 1.16 edm::InputTag genparticle_source;
182 peiffer 1.1 GenInfo genInfo;
183     std::vector<GenParticle> genps;
184 eusai 1.17 edm::InputTag SVComputer_;
185 peiffer 1.1 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 rkogler 1.19 //std::vector<int> L1_prescale;
190     //std::vector<int> HLT_prescale;
191 peiffer 1.1
192 peiffer 1.15 //HLTConfigProvider hlt_cfg;
193 peiffer 1.1 bool newrun;
194 peiffer 1.7 bool previouslumiblockwasfilled;
195 peiffer 1.5
196 peiffer 1.1 };
197    
198    
199     #endif