CMS 3D CMS Logo

HGCalTriggerNtupleManager.cc
Go to the documentation of this file.
10 
12 {
13  public:
14  typedef std::unique_ptr<HGCalTriggerNtupleBase> ntuple_ptr;
15 
16  public:
17  explicit HGCalTriggerNtupleManager(const edm::ParameterSet& conf);
19  virtual void beginRun(const edm::Run&, const edm::EventSetup&) {};
20  virtual void analyze(const edm::Event&, const edm::EventSetup&);
21 
22  private:
24  std::vector<ntuple_ptr> hgc_ntuples_;
25  TTree* tree_;
26 };
27 
28 
30 
31 
34 {
35  tree_ = file_service_->make<TTree>("HGCalTriggerNtuple","HGCalTriggerNtuple");
36  const std::vector<edm::ParameterSet> ntuple_cfgs = conf.getParameterSetVector("Ntuples");
37  for(const auto& ntuple_cfg : ntuple_cfgs)
38  {
39  const std::string& ntuple_name = ntuple_cfg.getParameter<std::string>("NtupleName");
40  hgc_ntuples_.emplace_back( HGCalTriggerNtupleFactory::get()->create(ntuple_name, ntuple_cfg) );
41  hgc_ntuples_.back()->initialize(*tree_, ntuple_cfg , consumesCollector());
42  }
43 }
44 
45 
46 void
48 analyze(const edm::Event& e, const edm::EventSetup& es)
49 {
50  for(auto& hgc_ntuple : hgc_ntuples_)
51  {
52  hgc_ntuple->fill(e,es);
53  }
54  tree_->Fill();
55 }
56 
VParameterSet const & getParameterSetVector(std::string const &name) const
def create(alignables, pedeDump, additionalData, outputFile, config)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::Service< TFileService > file_service_
std::unique_ptr< HGCalTriggerNtupleBase > ntuple_ptr
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
HGCalTriggerNtupleManager(const edm::ParameterSet &conf)
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
T get(const Candidate &c)
Definition: component.h:55
std::vector< ntuple_ptr > hgc_ntuples_
Definition: Run.h:43