DAS  3.0
Das Analysis System
Ntupliser.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "FWCore/Framework/interface/EDAnalyzer.h"
4 #include "FWCore/Framework/interface/EventSetup.h"
5 #include "FWCore/Framework/interface/ESHandle.h"
6 #include "FWCore/ServiceRegistry/interface/Service.h"
7 #include "FWCore/Common/interface/TriggerNames.h"
8 
9 #include "CommonTools/UtilAlgos/interface/TFileService.h"
10 
11 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
12 #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
13 
17 
18 #include "Parameters.h"
19 #include "helper.h"
20 #include "UserInfo.h"
21 
22 #include "TTree.h"
23 #include "TH1F.h"
24 
25 #include <boost/property_tree/ptree.hpp>
26 
27 class Ntupliser : public edm::EDAnalyzer
28 {
29 public:
30  typedef reco::Particle::LorentzVector LorentzVector;
31 
32  // default method in EDAnalyzer
33  explicit Ntupliser(edm::ParameterSet const& cfg);
34  virtual void beginJob() override;
35  virtual void beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) override;
36  virtual void endRun(edm::Run const& iRun, edm::EventSetup const& iSetup) override;
37  virtual void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) override;
38  virtual void endJob() override;
39  virtual ~Ntupliser() override;
40 
41 private:
42 
43  void reset ();
44  void initialise (edm::Event const& iEvent);
45  bool trigger (edm::Event const& iEvent);
46  void fillMET (edm::Event const& iEvent);
47  void getHLTjets (edm::Event const& iEvent);
48  template<typename MyJetCollection> void getGenJets (edm::Handle<MyJetCollection>& mygenjets);
49  void getRecJets ();
50  void getGenMuons ();
51  void getRecMuons ();
52  void getGenPhotons ();
53  void getRecPhotons ();
54  void getSecVertices ();
55  void getEventVariables (edm::Event const& iEvent);
56 
57  // configurable parameters
60 
61  // input objects
62  edm::Handle<reco::GenJetCollection> genjets;
63  edm::Handle<pat::JetCollection> recjets;
64  edm::Handle<edm::View<reco::Candidate>> genLeptons;
65  edm::Handle<pat::MuonCollection> recmuons;
66  edm::Handle<pat::PhotonCollection> recphotons;
67  edm::Handle<pat::METCollection> met;
68  edm::Handle<double> rho;
69  edm::Handle<reco::VertexCollection> recVtxs;
70  edm::Handle<edm::TriggerResults> triggerResults, metResults;
71  edm::Handle<pat::PackedTriggerPrescales> triggerPrescales,triggerPrescalesl1min, triggerPrescalesl1max;
72  edm::Handle<pat::TriggerObjectStandAloneCollection> triggerObjects;
73  edm::Handle<GenEventInfoProduct> genEvtInfo;
74  edm::Handle<reco::GenParticleCollection> genParticles;
75  edm::Handle<reco::JetFlavourInfoMatchingCollection> theJetFlavourInfos;
76  edm::Handle<std::vector<reco::VertexCompositePtrCandidate>> SVs;
77  edm::Handle<std::vector<PileupSummaryInfo>> pileupInfo;
78 #ifdef PS_WEIGHTS
79  edm::Handle<LHEEventProduct> lhe;
80 #endif
81 
82  // output file
83  edm::Service<TFileService> fs_;
84  TTree *tree;
86 
87  // output objects
88  std::vector<DAS::RecJet> *recJets_;
89  std::vector<DAS::FourVector> *HLTjets_;
90  std::vector<DAS::GenJet> *genJets_;
91  std::vector<DAS::RecMuon> *recMuons_;
92  std::vector<DAS::GenMuon> *genMuons_;
93  std::vector<DAS::RecPhoton> *recPhotons_;
94  std::vector<DAS::GenPhoton> *genPhotons_;
101 
102  boost::property_tree::ptree pileup_json;
103 };
Ntupliser::genjets
edm::Handle< reco::GenJetCollection > genjets
Definition: Ntupliser.h:62
Ntupliser::zbTrigger_
DAS::Trigger * zbTrigger_
Definition: Ntupliser.h:95
Ntupliser::metResults
edm::Handle< edm::TriggerResults > metResults
Definition: Ntupliser.h:70
Ntupliser::genPhotons_
std::vector< DAS::GenPhoton > * genPhotons_
Definition: Ntupliser.h:94
Ntupliser::getRecPhotons
void getRecPhotons()
Finds the reconstructed photons, and applies some hard cuts on the phase space.
Definition: Ntupliser.cc:184
Ntupliser::endJob
virtual void endJob() override
Definition: Ntupliser.cc:286
Ntupliser::recmuons
edm::Handle< pat::MuonCollection > recmuons
Definition: Ntupliser.h:65
Ntupliser
Definition: Ntupliser.h:28
Ntupliser::recEvent_
DAS::RecEvent * recEvent_
Definition: Ntupliser.h:97
Ntupliser::recPhotons_
std::vector< DAS::RecPhoton > * recPhotons_
Definition: Ntupliser.h:93
Ntupliser::met_
DAS::MET * met_
Definition: Ntupliser.h:98
DAS::Trigger
Definition: Event.h:71
Ntupliser::genMuons_
std::vector< DAS::GenMuon > * genMuons_
Definition: Ntupliser.h:92
Ntupliser::SVs
edm::Handle< std::vector< reco::VertexCompositePtrCandidate > > SVs
Definition: Ntupliser.h:76
Ntupliser::getRecMuons
void getRecMuons()
Finds the reconstructed muons, and applies some hard cuts on the phase space.
Definition: Ntupliser.cc:165
Ntupliser::pileup_
DAS::PileUp * pileup_
Definition: Ntupliser.h:99
DAS::RecEvent
Definition: Event.h:52
Ntupliser::recphotons
edm::Handle< pat::PhotonCollection > recphotons
Definition: Ntupliser.h:66
Ntupliser::pileup_json
boost::property_tree::ptree pileup_json
pileup "latest"
Definition: Ntupliser.h:102
Ntupliser::HLTjets_
std::vector< DAS::FourVector > * HLTjets_
Definition: Ntupliser.h:89
Event.h
Ntupliser::getHLTjets
void getHLTjets(edm::Event const &iEvent)
Finds HLT jets and simply stores them in a FourVector.
Definition: Ntupliser.cc:545
DAS::MET
Definition: Event.h:84
Ntupliser::primaryvertex_
DAS::PrimaryVertex * primaryvertex_
Definition: Ntupliser.h:100
Ntupliser::triggerPrescalesl1max
edm::Handle< pat::PackedTriggerPrescales > triggerPrescalesl1max
Definition: Ntupliser.h:71
Jet.h
Ntupliser::getGenMuons
void getGenMuons()
Finds the generated muons, and applies some hard cuts on the phase space.
Definition: Ntupliser.cc:79
Ntupliser::fs_
edm::Service< TFileService > fs_
Definition: Ntupliser.h:83
Ntupliser::met
edm::Handle< pat::METCollection > met
Definition: Ntupliser.h:67
Parameters.h
Ntupliser::endRun
virtual void endRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
Definition: Ntupliser.cc:295
Ntupliser::muonTrigger_
DAS::Trigger * muonTrigger_
Definition: Ntupliser.h:95
DAS::PileUp
Definition: Event.h:98
Ntupliser::~Ntupliser
virtual ~Ntupliser() override
Definition: Ntupliser.cc:678
Ntupliser::metainfo
Darwin::Tools::UserInfo metainfo
Definition: Ntupliser.h:85
Ntupliser::genLeptons
edm::Handle< edm::View< reco::Candidate > > genLeptons
Definition: Ntupliser.h:64
Ntupliser::getGenJets
void getGenJets(edm::Handle< MyJetCollection > &mygenjets)
Definition: Ntupliser.cc:143
Ntupliser::theJetFlavourInfos
edm::Handle< reco::JetFlavourInfoMatchingCollection > theJetFlavourInfos
Definition: Ntupliser.h:75
Ntupliser::h
DAS::Helper h
Definition: Ntupliser.h:59
DAS::Parameters
Definition: Parameters.h:53
Ntupliser::analyze
virtual void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: Ntupliser.cc:301
Ntupliser::recMuons_
std::vector< DAS::RecMuon > * recMuons_
Definition: Ntupliser.h:91
Ntupliser::triggerResults
edm::Handle< edm::TriggerResults > triggerResults
Definition: Ntupliser.h:70
Ntupliser::initialise
void initialise(edm::Event const &iEvent)
Called at the beginning of each new event.
Definition: Ntupliser.cc:386
Ntupliser::getGenPhotons
void getGenPhotons()
Finds the generated photons and applies some hard cuts to the phase space.
Definition: Ntupliser.cc:106
Ntupliser::rho
edm::Handle< double > rho
Definition: Ntupliser.h:68
Ntupliser::triggerPrescales
edm::Handle< pat::PackedTriggerPrescales > triggerPrescales
Definition: Ntupliser.h:71
Ntupliser::p
DAS::Parameters p
Definition: Ntupliser.h:58
Ntupliser_cfg.lhe
lhe
Definition: Ntupliser_cfg.py:271
Ntupliser::triggerPrescalesl1min
edm::Handle< pat::PackedTriggerPrescales > triggerPrescalesl1min
Definition: Ntupliser.h:71
Ntupliser::genEvtInfo
edm::Handle< GenEventInfoProduct > genEvtInfo
Definition: Ntupliser.h:73
Ntupliser::LorentzVector
reco::Particle::LorentzVector LorentzVector
Definition: Ntupliser.h:30
Ntupliser::fillMET
void fillMET(edm::Event const &iEvent)
Fill the MET flags to the array.
Definition: Ntupliser.cc:527
Ntupliser::recJets_
std::vector< DAS::RecJet > * recJets_
Definition: Ntupliser.h:88
Ntupliser::genEvent_
DAS::GenEvent * genEvent_
Definition: Ntupliser.h:96
Ntupliser::pileupInfo
edm::Handle< std::vector< PileupSummaryInfo > > pileupInfo
Definition: Ntupliser.h:77
Ntupliser::triggerObjects
edm::Handle< pat::TriggerObjectStandAloneCollection > triggerObjects
Definition: Ntupliser.h:72
Ntupliser::getEventVariables
void getEventVariables(edm::Event const &iEvent)
Definition: Ntupliser.cc:586
Ntupliser::recjets
edm::Handle< pat::JetCollection > recjets
Definition: Ntupliser.h:63
Ntupliser::jetTrigger_
DAS::Trigger * jetTrigger_
Definition: Ntupliser.h:95
DAS::Helper
Definition: helper.h:26
Ntupliser::Ntupliser
Ntupliser(edm::ParameterSet const &cfg)
Constructor, only initialising the members.
Definition: Ntupliser.cc:38
Ntupliser::genParticles
edm::Handle< reco::GenParticleCollection > genParticles
Definition: Ntupliser.h:74
Lepton.h
helper.h
Darwin::Tools::UserInfo
Generic meta-information for n-tuple (can be used out of Darwin).
Definition: UserInfo.h:52
Ntupliser::beginRun
virtual void beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
Definition: Ntupliser.cc:291
Ntupliser::tree
TTree * tree
Definition: Ntupliser.h:84
Ntupliser::reset
void reset()
Just a common method to reset all branches at each new event.
Definition: Ntupliser.cc:349
Ntupliser::beginJob
virtual void beginJob() override
Definition: Ntupliser.cc:230
Ntupliser::genJets_
std::vector< DAS::GenJet > * genJets_
Definition: Ntupliser.h:90
Ntupliser::recVtxs
edm::Handle< reco::VertexCollection > recVtxs
Definition: Ntupliser.h:69
Ntupliser::trigger
bool trigger(edm::Event const &iEvent)
Finds the bits corresponding to the HLT jet pt triggers.
Definition: Ntupliser.cc:452
DAS::PrimaryVertex
Definition: Event.h:119
DAS::GenEvent
Definition: Event.h:38
Ntupliser::getRecJets
void getRecJets()
Finds the reconstructed jets, and applies some hard cuts on the phase space.
Definition: Ntupliser.cc:204
Ntupliser::getSecVertices
void getSecVertices()