CMS 3D CMS Logo

HGCalTriggerNtupleHGCMulticlusters.cc
Go to the documentation of this file.
1 
6 
7 
8 
10 {
11 
12  public:
15  virtual void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) override final;
16  virtual void fill(const edm::Event& e, const edm::EventSetup& es) override final;
17 
18  private:
19  virtual void clear() override final;
20 
21 
23 
24  int cl3d_n_ ;
25  std::vector<float> cl3d_pt_;
26  std::vector<float> cl3d_energy_;
27  std::vector<float> cl3d_eta_;
28  std::vector<float> cl3d_phi_;
29  std::vector<int> cl3d_nclu_;
30 };
31 
34  "HGCalTriggerNtupleHGCMulticlusters" );
35 
36 
39 {
40 }
41 
42 void
44 initialize(TTree& tree, const edm::ParameterSet& conf, edm::ConsumesCollector&& collector)
45 {
46  multiclusters_token_ = collector.consumes<l1t::HGCalMulticlusterBxCollection>(conf.getParameter<edm::InputTag>("Multiclusters"));
47 
48  tree.Branch("cl3d_n", &cl3d_n_, "cl3d_n/I");
49  tree.Branch("cl3d_pt", &cl3d_pt_);
50  tree.Branch("cl3d_energy", &cl3d_energy_);
51  tree.Branch("cl3d_eta", &cl3d_eta_);
52  tree.Branch("cl3d_phi", &cl3d_phi_);
53  tree.Branch("cl3d_nclu", &cl3d_nclu_);
54 
55 }
56 
57 void
59 fill(const edm::Event& e, const edm::EventSetup& es)
60 {
61 
62  // retrieve clusters 3D
64  e.getByToken(multiclusters_token_, multiclusters_h);
65  const l1t::HGCalMulticlusterBxCollection& multiclusters = *multiclusters_h;
66 
67  // retrieve geometry
69  es.get<IdealGeometryRecord>().get(geometry);
70 
71  clear();
72  for(auto cl3d_itr=multiclusters.begin(0); cl3d_itr!=multiclusters.end(0); cl3d_itr++)
73  {
74  cl3d_n_++;
75  // physical values
76  cl3d_pt_.emplace_back(cl3d_itr->pt());
77  cl3d_energy_.emplace_back(cl3d_itr->energy());
78  cl3d_eta_.emplace_back(cl3d_itr->eta());
79  cl3d_phi_.emplace_back(cl3d_itr->phi());
80  cl3d_nclu_.emplace_back(cl3d_itr->constituents().size());
81  }
82 }
83 
84 
85 void
88 {
89  cl3d_n_ = 0;
90  cl3d_pt_.clear();
91  cl3d_energy_.clear();
92  cl3d_eta_.clear();
93  cl3d_phi_.clear();
94  cl3d_nclu_.clear();
95 
96 }
97 
98 
99 
100 
const_iterator end(int bx) const
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
virtual void fill(const edm::Event &e, const edm::EventSetup &es) override final
HGCalTriggerNtupleHGCMulticlusters(const edm::ParameterSet &conf)
virtual void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) override final
const T & get() const
Definition: EventSetup.h:56
ESHandle< TrackerGeometry > geometry
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: tree.py:1
const_iterator begin(int bx) const