CMS 3D CMS Logo

HGCalTriggerNtupleTowers.cc
Go to the documentation of this file.
5 
7 public:
10  void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final;
11  void fill(const edm::Event& e, const edm::EventSetup& es) final;
12 
13 private:
14  void clear() final;
15 
17 
18  int tower_n_;
19  std::vector<float> tower_pt_;
20  std::vector<float> tower_energy_;
21  std::vector<float> tower_eta_;
22  std::vector<float> tower_phi_;
23  std::vector<float> tower_etEm_;
24  std::vector<float> tower_etHad_;
25  std::vector<int> tower_iEta_;
26  std::vector<int> tower_iPhi_;
27 };
28 
30 
32  : HGCalTriggerNtupleBase(conf) {}
33 
35  const edm::ParameterSet& conf,
36  edm::ConsumesCollector&& collector) {
37  towers_token_ = collector.consumes<l1t::HGCalTowerBxCollection>(conf.getParameter<edm::InputTag>("Towers"));
38 
39  tree.Branch("tower_n", &tower_n_, "tower_n/I");
40  tree.Branch("tower_pt", &tower_pt_);
41  tree.Branch("tower_energy", &tower_energy_);
42  tree.Branch("tower_eta", &tower_eta_);
43  tree.Branch("tower_phi", &tower_phi_);
44  tree.Branch("tower_etEm", &tower_etEm_);
45  tree.Branch("tower_etHad", &tower_etHad_);
46  tree.Branch("tower_iEta", &tower_iEta_);
47  tree.Branch("tower_iPhi", &tower_iPhi_);
48 }
49 
51  // retrieve towers
53  e.getByToken(towers_token_, towers_h);
54  const l1t::HGCalTowerBxCollection& towers = *towers_h;
55 
56  // retrieve geometry
58  es.get<CaloGeometryRecord>().get(geometry);
59 
60  clear();
61  for (auto tower_itr = towers.begin(0); tower_itr != towers.end(0); tower_itr++) {
62  tower_n_++;
63  // physical values
64  tower_pt_.emplace_back(tower_itr->pt());
65  tower_energy_.emplace_back(tower_itr->energy());
66  tower_eta_.emplace_back(tower_itr->eta());
67  tower_phi_.emplace_back(tower_itr->phi());
68  tower_etEm_.emplace_back(tower_itr->etEm());
69  tower_etHad_.emplace_back(tower_itr->etHad());
70 
71  tower_iEta_.emplace_back(tower_itr->id().iEta());
72  tower_iPhi_.emplace_back(tower_itr->id().iPhi());
73  }
74 }
75 
77  tower_n_ = 0;
78  tower_pt_.clear();
79  tower_energy_.clear();
80  tower_eta_.clear();
81  tower_phi_.clear();
82  tower_etEm_.clear();
83  tower_etHad_.clear();
84  tower_iEta_.clear();
85  tower_iPhi_.clear();
86 }
const_iterator end(int bx) const
T getParameter(std::string const &) const
void fill(const edm::Event &e, const edm::EventSetup &es) final
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
HGCalTriggerNtupleHGCTowers(const edm::ParameterSet &conf)
ESHandle< TrackerGeometry > geometry
T get() const
Definition: EventSetup.h:71
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: tree.py:1
const_iterator begin(int bx) const
void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final