CMS 3D CMS Logo

L1EventTreeProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1TriggerDPG/L1Ntuples
4 // Class: L1EventTreeProducer
5 //
13 //
14 // Original Author:
15 // Created:
16 // $Id: L1EventTreeProducer.cc,v 1.8 2012/08/29 12:44:03 jbrooke Exp $
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // framework
30 
31 // data formats
37 
38 // ROOT output stuff
41 #include "TTree.h"
42 
44 
45 //
46 // class declaration
47 //
48 
50 public:
51  explicit L1EventTreeProducer(const edm::ParameterSet&);
52  ~L1EventTreeProducer() override;
53 
54 private:
55  void beginJob(void) override;
56  void analyze(const edm::Event&, const edm::EventSetup&) override;
57  void endJob() override;
58 
59 public:
62 
63 private:
64  // output file
66 
67  // tree
68  TTree* tree_;
69 
71 
72  // EDM input tags
73  //edm::EDGetTokenT<l1t::EGammaBxCollection> egToken_;
74 };
75 
77  hltSource_ = consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("hltSource"));
78 
79  std::string puMCFile = iConfig.getUntrackedParameter<std::string>("puMCFile", "");
80  std::string puMCHist = iConfig.getUntrackedParameter<std::string>("puMCHist", "pileup");
81  std::string puDataFile = iConfig.getUntrackedParameter<std::string>("puDataFile", "");
82  std::string puDataHist = iConfig.getUntrackedParameter<std::string>("puDataHist", "pileup");
83 
84  bool useAvgVtx = iConfig.getUntrackedParameter<bool>("useAvgVtx", true);
85  double maxAllowedWeight = iConfig.getUntrackedParameter<double>("maxAllowedWeight", -1);
86 
90 
91  // set up output
92  tree_ = fs_->make<TTree>("L1EventTree", "L1EventTree");
93  tree_->Branch("Event", "L1Analysis::L1AnalysisEventDataFormat", &l1EventData, 32000, 3);
94 }
95 
97  // do anything here that needs to be done at desctruction time
98  // (e.g. close files, deallocate resources etc.)
99  delete l1Event;
100 }
101 
102 //
103 // member functions
104 //
105 
106 // ------------ method called to for each event ------------
108  if (!hltSource_.isUninitialized()) {
109  l1Event->Reset();
111  }
112  tree_->Fill();
113 }
114 
115 // ------------ method called once each job just before starting event loop ------------
117 
118 // ------------ method called once each job just after ending the event loop ------------
120 
121 //define this as a plug-in
L1Analysis::L1AnalysisEvent::Reset
void Reset()
Definition: L1AnalysisEvent.h:40
MessageLogger.h
edm::EDGetTokenT< edm::TriggerResults >
Muon.h
L1Analysis::L1AnalysisEvent::getData
L1AnalysisEventDataFormat * getData()
Definition: L1AnalysisEvent.h:41
Jet.h
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
l1EventTree_cfi.puDataHist
puDataHist
Definition: l1EventTree_cfi.py:8
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
L1EventTreeProducer::l1Event
L1Analysis::L1AnalysisEvent * l1Event
Definition: L1EventTreeProducer.cc:60
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
l1EventTree_cfi.useAvgVtx
useAvgVtx
Definition: l1EventTree_cfi.py:9
L1Analysis::L1AnalysisEvent
Definition: L1AnalysisEvent.h:27
EGamma.h
Service.h
edm::EDGetTokenT::isUninitialized
bool isUninitialized() const
Definition: EDGetToken.h:70
L1EventTreeProducer::beginJob
void beginJob(void) override
Definition: L1EventTreeProducer.cc:116
l1EventTree_cfi.puMCFile
puMCFile
Definition: l1EventTree_cfi.py:5
L1Analysis::L1AnalysisEventDataFormat
Definition: L1AnalysisEventDataFormat.h:16
l1EventTree_cfi.maxAllowedWeight
maxAllowedWeight
Definition: l1EventTree_cfi.py:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
L1EventTreeProducer::~L1EventTreeProducer
~L1EventTreeProducer() override
Definition: L1EventTreeProducer.cc:96
L1AnalysisEvent.h
L1EventTreeProducer
Definition: L1EventTreeProducer.cc:49
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
L1EventTreeProducer::L1EventTreeProducer
L1EventTreeProducer(const edm::ParameterSet &)
Definition: L1EventTreeProducer.cc:76
L1EventTreeProducer::tree_
TTree * tree_
Definition: L1EventTreeProducer.cc:68
edm::EventSetup
Definition: EventSetup.h:57
L1Analysis::L1AnalysisEvent::Set
void Set(const edm::Event &e, const edm::EDGetTokenT< edm::TriggerResults > &hlt_)
Definition: L1AnalysisEvent.cc:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
L1EventTreeProducer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: L1EventTreeProducer.cc:107
l1EventTree_cfi.puDataFile
puDataFile
Definition: l1EventTree_cfi.py:6
Frameworkfwd.h
L1EventTreeProducer::hltSource_
edm::EDGetTokenT< edm::TriggerResults > hltSource_
Definition: L1EventTreeProducer.cc:70
ParameterSet.h
L1EventTreeProducer::l1EventData
L1Analysis::L1AnalysisEventDataFormat * l1EventData
Definition: L1EventTreeProducer.cc:61
EtSum.h
L1EventTreeProducer::fs_
edm::Service< TFileService > fs_
Definition: L1EventTreeProducer.cc:65
edm::Event
Definition: Event.h:73
l1EventTree_cfi.puMCHist
puMCHist
Definition: l1EventTree_cfi.py:7
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
Tau.h
L1EventTreeProducer::endJob
void endJob() override
Definition: L1EventTreeProducer.cc:119