CMS 3D CMS Logo

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