CMS 3D CMS Logo

HGCalTriggerNtupleHGCTriggerSums.cc
Go to the documentation of this file.
1 
10 
12 public:
15  void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final;
16  void fill(const edm::Event& e, const edm::EventSetup& es) final;
17 
18 private:
19  void clear() final;
20 
22 
25 
26  static constexpr unsigned kPanelOffset_ = 0;
27  static constexpr unsigned kPanelMask_ = 0x7F;
28  static constexpr unsigned kSectorOffset_ = 7;
29  static constexpr unsigned kSectorMask_ = 0x7;
30 
31  int ts_n_;
32  std::vector<uint32_t> ts_id_;
40  std::vector<uint32_t> ts_data_;
41  std::vector<float> ts_mipPt_;
42  std::vector<float> ts_pt_;
44  std::vector<float> ts_eta_;
45  std::vector<float> ts_phi_;
46  std::vector<float> ts_x_;
47  std::vector<float> ts_y_;
48  std::vector<float> ts_z_;
49 };
50 
52 
54  : HGCalTriggerNtupleBase(conf) {}
55 
57  const edm::ParameterSet& conf,
58  edm::ConsumesCollector&& collector) {
60  collector.consumes<l1t::HGCalTriggerSumsBxCollection>(conf.getParameter<edm::InputTag>("TriggerSums"));
61 
62  std::string prefix(conf.getUntrackedParameter<std::string>("Prefix", "ts"));
63 
64  std::string bname;
65  auto withPrefix([&prefix, &bname](char const* vname) -> char const* {
66  bname = prefix + "_" + vname;
67  return bname.c_str();
68  });
69 
70  tree.Branch(withPrefix("n"), &ts_n_, (prefix + "_n/I").c_str());
71  tree.Branch(withPrefix("id"), &ts_id_);
72  tree.Branch(withPrefix("subdet"), &ts_subdet_);
73  tree.Branch(withPrefix("zside"), &ts_side_);
74  tree.Branch(withPrefix("layer"), &ts_layer_);
75  tree.Branch(withPrefix("wafer"), &ts_wafer_);
76  tree.Branch(withPrefix("wafertype"), &ts_wafertype_);
77  tree.Branch(withPrefix("panel_number"), &ts_panel_number_);
78  tree.Branch(withPrefix("panel_sector"), &ts_panel_sector_);
79  tree.Branch(withPrefix("data"), &ts_data_);
80  tree.Branch(withPrefix("pt"), &ts_pt_);
81  tree.Branch(withPrefix("mipPt"), &ts_mipPt_);
82  tree.Branch(withPrefix("energy"), &ts_energy_);
83  tree.Branch(withPrefix("eta"), &ts_eta_);
84  tree.Branch(withPrefix("phi"), &ts_phi_);
85  tree.Branch(withPrefix("x"), &ts_x_);
86  tree.Branch(withPrefix("y"), &ts_y_);
87  tree.Branch(withPrefix("z"), &ts_z_);
88 }
89 
91  // retrieve trigger cells
93  e.getByToken(trigger_sums_token_, trigger_sums_h);
94  const l1t::HGCalTriggerSumsBxCollection& trigger_sums = *trigger_sums_h;
95 
96  // retrieve geometry
98 
100 
101  clear();
102  for (auto ts_itr = trigger_sums.begin(0); ts_itr != trigger_sums.end(0); ts_itr++) {
103  if (ts_itr->pt() > 0) {
104  ts_n_++;
105  // hardware data
106  DetId panelId(ts_itr->detId());
107  int panel_sector = -999;
108  int panel_number = -999;
109  if (panelId.det() == DetId::Forward) {
110  HGCalDetId panelIdHGCal(panelId);
111  if (panelId.subdetId() == ForwardSubdetector::HGCHEB) {
112  panel_number = panelIdHGCal.wafer();
113  } else {
114  panel_sector = (panelIdHGCal.wafer() >> kSectorOffset_) & kSectorMask_;
115  panel_number = (panelIdHGCal.wafer() >> kPanelOffset_) & kPanelMask_;
116  }
117  } else if (panelId.det() == DetId::HGCalHSc) {
118  HGCScintillatorDetId panelIdSci(panelId);
119  panel_sector = panelIdSci.iphi();
120  panel_number = panelIdSci.ietaAbs();
121  }
122  ts_panel_number_.emplace_back(panel_number);
123  ts_panel_sector_.emplace_back(panel_sector);
124  ts_id_.emplace_back(ts_itr->detId());
125  ts_side_.emplace_back(triggerTools_.zside(panelId));
126  ts_layer_.emplace_back(triggerTools_.layerWithOffset(panelId));
127  // V9 detids
128  if (panelId.det() == DetId::HGCalTrigger) {
129  HGCalTriggerDetId idv9(panelId);
130  ts_subdet_.emplace_back(idv9.subdet());
131  ts_wafertype_.emplace_back(idv9.type());
132  } else if (panelId.det() == DetId::HGCalHSc) {
133  HGCScintillatorDetId idv9(panelId);
134  ts_subdet_.emplace_back(idv9.subdet());
135  ts_wafertype_.emplace_back(idv9.type());
136  }
137  // V8 detids
138  else {
139  HGCalDetId idv8(panelId);
140  ts_subdet_.emplace_back(panelId.subdetId());
141  ts_wafer_.emplace_back(idv8.wafer());
142  ts_wafertype_.emplace_back(idv8.waferType());
143  }
144  ts_data_.emplace_back(ts_itr->hwPt());
145  ts_mipPt_.emplace_back(ts_itr->mipPt());
146  // physical values
147  ts_pt_.emplace_back(ts_itr->pt());
148  ts_energy_.emplace_back(ts_itr->energy());
149  ts_eta_.emplace_back(ts_itr->eta());
150  ts_phi_.emplace_back(ts_itr->phi());
151  ts_x_.emplace_back(ts_itr->position().x());
152  ts_y_.emplace_back(ts_itr->position().y());
153  ts_z_.emplace_back(ts_itr->position().z());
154  }
155  }
156 }
157 
159  ts_n_ = 0;
160  ts_id_.clear();
161  ts_subdet_.clear();
162  ts_side_.clear();
163  ts_layer_.clear();
164  ts_wafer_.clear();
165  ts_wafertype_.clear();
166  ts_panel_number_.clear();
167  ts_panel_sector_.clear();
168  ts_data_.clear();
169  ts_mipPt_.clear();
170  ts_pt_.clear();
171  ts_energy_.clear();
172  ts_eta_.clear();
173  ts_phi_.clear();
174  ts_x_.clear();
175  ts_y_.clear();
176  ts_z_.clear();
177 }
HGCalTriggerTools.h
HGCalTriggerGeometryBase
Definition: HGCalTriggerGeometryBase.h:19
HGCScintillatorDetId::subdet
DetId::Detector subdet() const
get the subdetector
Definition: HGCScintillatorDetId.h:40
HGCalTriggerTools::eventSetup
void eventSetup(const edm::EventSetup &)
Definition: HGCalTriggerTools.cc:35
HGCalTriggerNtupleHGCTriggerSums::kSectorMask_
static constexpr unsigned kSectorMask_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:29
DetId::HGCalTrigger
Definition: DetId.h:35
HGCScintillatorDetId::iphi
int iphi() const
get the phi index
Definition: HGCScintillatorDetId.cc:58
HGCalTriggerNtupleHGCTriggerSums::kSectorOffset_
static constexpr unsigned kSectorOffset_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:28
HGCalTriggerNtupleHGCTriggerSums::ts_mipPt_
std::vector< float > ts_mipPt_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:41
HGCalTriggerNtupleHGCTriggerSums::ts_n_
int ts_n_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:31
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
HGCalTriggerNtupleHGCTriggerSums
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:11
tree
Definition: tree.py:1
AssociationMap.h
ESHandle
HGCalTriggerNtupleHGCTriggerSums::ts_z_
std::vector< float > ts_z_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:48
HGCalTriggerSums.h
HGCalTriggerNtupleHGCTriggerSums::ts_energy_
std::vector< float > ts_energy_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:43
HGCalTriggerNtupleHGCTriggerSums::clear
void clear() final
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:158
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
HGCalTriggerNtupleHGCTriggerSums::ts_panel_sector_
std::vector< int > ts_panel_sector_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:37
HGCalTriggerNtupleHGCTriggerSums::initialize
void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:56
BXVector
Definition: BXVector.h:15
HGCalTriggerNtupleBase
Definition: HGCalTriggerNtupleBase.h:10
DetId
Definition: DetId.h:17
HGCalTriggerNtupleHGCTriggerSums::geometry_
edm::ESHandle< HGCalTriggerGeometryBase > geometry_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:24
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
HGCalTriggerNtupleHGCTriggerSums::fill
void fill(const edm::Event &e, const edm::EventSetup &es) final
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:90
HGCalTriggerNtupleHGCTriggerSums::ts_pt_
std::vector< float > ts_pt_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:42
HGCalTriggerGeometryBase.h
HGCalTriggerNtupleHGCTriggerSums::ts_phi_
std::vector< float > ts_phi_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:45
HGCScintillatorDetId::ietaAbs
int ietaAbs() const
Definition: HGCScintillatorDetId.h:56
HGCalTriggerNtupleHGCTriggerSums::ts_eta_
std::vector< float > ts_eta_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:44
HGCalTriggerNtupleHGCTriggerSums::kPanelOffset_
static constexpr unsigned kPanelOffset_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:26
HGCalTriggerNtupleHGCTriggerSums::ts_panel_number_
std::vector< int > ts_panel_number_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:36
Event
HGCalTriggerTools::layerWithOffset
unsigned layerWithOffset(const DetId &) const
Definition: HGCalTriggerTools.cc:134
HGCalTriggerTools::zside
int zside(const DetId &) const
Definition: HGCalTriggerTools.cc:210
HGCalTriggerNtupleHGCTriggerSums::ts_id_
std::vector< uint32_t > ts_id_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:32
BXVector::begin
const_iterator begin(int bx) const
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
HGCalTriggerNtupleHGCTriggerSums::ts_x_
std::vector< float > ts_x_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:46
CaloGeometryRecord.h
HGCalTriggerDetId
Definition: HGCalTriggerDetId.h:26
HGCalTriggerNtupleHGCTriggerSums::~HGCalTriggerNtupleHGCTriggerSums
~HGCalTriggerNtupleHGCTriggerSums() override
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:14
HGCalDetId::waferType
int waferType() const
get the wafer type
Definition: HGCalDetId.h:43
BXVector::end
const_iterator end(int bx) const
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalTriggerDetId::subdet
HGCalTriggerSubdetector subdet() const
get the subdetector
Definition: HGCalTriggerDetId.h:42
ParameterSet
Definition: Functions.h:16
HGCalTriggerNtupleHGCTriggerSums::trigger_sums_token_
edm::EDGetToken trigger_sums_token_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:23
edmplugin::PluginFactory
Definition: PluginFactory.h:34
HGCalTriggerNtupleBase.h
HGCScintillatorDetId::type
int type() const
get/set the type
Definition: HGCScintillatorDetId.h:43
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HGCalTriggerNtupleHGCTriggerSums::ts_layer_
std::vector< int > ts_layer_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:35
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
HGCalTriggerNtupleHGCTriggerSums::HGCalTriggerNtupleHGCTriggerSums
HGCalTriggerNtupleHGCTriggerSums(const edm::ParameterSet &conf)
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:53
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EDGetToken
HGCalDetId::wafer
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
HGCalDetId
Definition: HGCalDetId.h:8
HGCalTriggerNtupleHGCTriggerSums::kPanelMask_
static constexpr unsigned kPanelMask_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:27
HGCalTriggerNtupleHGCTriggerSums::ts_side_
std::vector< int > ts_side_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:34
HGCalDetId.h
std
Definition: JetResolutionObject.h:76
HGCalTriggerNtupleHGCTriggerSums::ts_wafertype_
std::vector< int > ts_wafertype_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:39
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:23
DetId::HGCalHSc
Definition: DetId.h:34
HGCalTriggerNtupleHGCTriggerSums::ts_data_
std::vector< uint32_t > ts_data_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:40
HGCalTriggerNtupleHGCTriggerSums::ts_y_
std::vector< float > ts_y_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:47
HGCalTriggerNtupleHGCTriggerSums::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:21
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalTriggerNtupleHGCTriggerSums::ts_wafer_
std::vector< int > ts_wafer_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:38
HGCalTriggerTools
Definition: HGCalTriggerTools.h:32
HGCalTriggerDetId::type
int type() const
get the type
Definition: HGCalTriggerDetId.h:47
EventSetup
HGCalTriggerNtupleHGCTriggerSums::ts_subdet_
std::vector< int > ts_subdet_
Definition: HGCalTriggerNtupleHGCTriggerSums.cc:33
DetId::Forward
Definition: DetId.h:30
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
hcallasereventfilter2012_cfi.prefix
prefix
Definition: hcallasereventfilter2012_cfi.py:10
HGCalTriggerDetId.h
HGCHEB
Definition: ForwardSubdetector.h:10
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37