CMS 3D CMS Logo

HGCalTriggerNtupleHGCPanels.cc
Go to the documentation of this file.
1 
7 
9 public:
12  void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final;
13  void fill(const edm::Event& e, const edm::EventSetup& es) final;
14 
15 private:
16  void clear() final;
17 
20 
21  int panel_n_;
22  std::vector<uint32_t> panel_id_;
27  std::vector<unsigned> panel_tc_n_;
28  std::vector<std::vector<uint32_t> > panel_tc_id_;
34 
35 private:
36  static const unsigned kPanel_offset_ = 0;
37  static const unsigned kPanel_mask_ = 0x1F;
38  static const unsigned kSector_offset_ = 5;
39  static const unsigned kSector_mask_ = 0x7;
40  static const unsigned kThird_offset_ = 4;
41  static const unsigned kThird_mask_ = 0x3;
42  static const unsigned kCell_mask_ = 0xF;
43 };
44 
46 
48  : HGCalTriggerNtupleBase(conf) {}
49 
51  const edm::ParameterSet& conf,
52  edm::ConsumesCollector&& collector) {
54  collector.consumes<l1t::HGCalTriggerCellBxCollection>(conf.getParameter<edm::InputTag>("TriggerCells"));
55 
56  tree.Branch("panel_n", &panel_n_, "panel_n/I");
57  tree.Branch("panel_id", &panel_id_);
58  tree.Branch("panel_zside", &panel_zside_);
59  tree.Branch("panel_layer", &panel_layer_);
60  tree.Branch("panel_sector", &panel_sector_);
61  tree.Branch("panel_number", &panel_number_);
62  tree.Branch("panel_tc_n", &panel_tc_n_);
63  tree.Branch("panel_tc_id", &panel_tc_id_);
64  tree.Branch("panel_tc_mod", &panel_tc_mod_);
65  tree.Branch("panel_tc_third", &panel_tc_third_);
66  tree.Branch("panel_tc_cell", &panel_tc_cell_);
67  tree.Branch("panel_tc_mipPt", &panel_tc_mipPt_);
68  tree.Branch("panel_tc_pt", &panel_tc_pt_);
69 }
70 
72  // retrieve trigger cells
74  e.getByToken(trigger_cells_token_, trigger_cells_h);
75  const l1t::HGCalTriggerCellBxCollection& trigger_cells = *trigger_cells_h;
76 
77  // retrieve geometry
79 
80  clear();
81 
82  // Regroup trigger cells by panel
83  std::unordered_map<uint32_t, vector<l1t::HGCalTriggerCellBxCollection::const_iterator> > panelids_tcs;
84  for (auto tc_itr = trigger_cells.begin(0); tc_itr != trigger_cells.end(0); tc_itr++) {
85  if (tc_itr->hwPt() > 0 && tc_itr->subdetId() != ForwardSubdetector::HGCHEB) {
86  HGCalDetId id(tc_itr->detId());
88  panelids_tcs[panelid].push_back(tc_itr);
89  }
90  }
91  for (const auto& panelid_tcs : panelids_tcs) {
92  panel_n_++;
93  HGCalDetId panelid(panelid_tcs.first);
94  int panel_sector = (panelid.wafer() >> kSector_offset_) & kSector_mask_;
95  int panel_number = (panelid.wafer() >> kPanel_offset_) & kPanel_mask_;
96  const auto& tcs = panelid_tcs.second;
97  panel_id_.emplace_back(panelid);
98  panel_zside_.emplace_back(panelid.zside());
99  panel_layer_.emplace_back(geometry_->triggerLayer(panelid));
100  panel_sector_.emplace_back(panel_sector);
101  panel_number_.emplace_back(panel_number);
102  panel_tc_n_.emplace_back(tcs.size());
103  panel_tc_id_.emplace_back();
104  panel_tc_mod_.emplace_back();
105  panel_tc_third_.emplace_back();
106  panel_tc_cell_.emplace_back();
107  panel_tc_mipPt_.emplace_back();
108  panel_tc_pt_.emplace_back();
109 
110  for (const auto& tc : tcs) {
111  panel_tc_id_.back().push_back(tc->detId());
112  panel_tc_mipPt_.back().push_back(tc->mipPt());
113  panel_tc_pt_.back().push_back(tc->pt());
114  HGCalDetId tc_detid(tc->detId());
115  unsigned module_id = tc_detid.wafer();
116  unsigned third_id = (tc_detid.cell() >> kThird_offset_) & kThird_mask_;
117  unsigned cell_id = tc_detid.cell() & kCell_mask_;
118  panel_tc_mod_.back().push_back(module_id);
119  panel_tc_third_.back().push_back(third_id);
120  panel_tc_cell_.back().push_back(cell_id);
121  }
122  }
123 }
124 
126  panel_n_ = 0;
127  panel_id_.clear();
128  panel_zside_.clear();
129  panel_layer_.clear();
130  panel_sector_.clear();
131  panel_number_.clear();
132  panel_tc_n_.clear();
133  panel_tc_id_.clear();
134  panel_tc_mod_.clear();
135  panel_tc_third_.clear();
136  panel_tc_cell_.clear();
137  panel_tc_mipPt_.clear();
138  panel_tc_pt_.clear();
139 }
HGCalTriggerNtupleHGCPanels::panel_tc_id_
std::vector< std::vector< uint32_t > > panel_tc_id_
Definition: HGCalTriggerNtupleHGCPanels.cc:28
HGCalTriggerGeometryBase
Definition: HGCalTriggerGeometryBase.h:19
HGCalTriggerNtupleHGCPanels::kPanel_mask_
static const unsigned kPanel_mask_
Definition: HGCalTriggerNtupleHGCPanels.cc:37
HGCalTriggerNtupleHGCPanels::panel_tc_mod_
std::vector< std::vector< uint32_t > > panel_tc_mod_
Definition: HGCalTriggerNtupleHGCPanels.cc:29
HGCalTriggerNtupleHGCPanels::kPanel_offset_
static const unsigned kPanel_offset_
Definition: HGCalTriggerNtupleHGCPanels.cc:36
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
tree
Definition: tree.py:1
HGCalTriggerNtupleHGCPanels::kCell_mask_
static const unsigned kCell_mask_
Definition: HGCalTriggerNtupleHGCPanels.cc:42
HGCalDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCalDetId.h:49
ESHandle
HGCalTriggerNtupleHGCPanels::kSector_mask_
static const unsigned kSector_mask_
Definition: HGCalTriggerNtupleHGCPanels.cc:39
HGCalTriggerNtupleHGCPanels::trigger_cells_token_
edm::EDGetToken trigger_cells_token_
Definition: HGCalTriggerNtupleHGCPanels.cc:18
HGCalTriggerNtupleHGCPanels::initialize
void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
Definition: HGCalTriggerNtupleHGCPanels.cc:50
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
HGCalTriggerNtupleHGCPanels::panel_n_
int panel_n_
Definition: HGCalTriggerNtupleHGCPanels.cc:21
BXVector
Definition: BXVector.h:15
HGCalTriggerNtupleBase
Definition: HGCalTriggerNtupleBase.h:10
HGCalTriggerNtupleHGCPanels::panel_tc_mipPt_
std::vector< std::vector< float > > panel_tc_mipPt_
Definition: HGCalTriggerNtupleHGCPanels.cc:32
HGCalTriggerGeometryBase::triggerLayer
virtual unsigned triggerLayer(const unsigned id) const =0
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
HGCalTriggerGeometryBase.h
HGCalTriggerNtupleHGCPanels::HGCalTriggerNtupleHGCPanels
HGCalTriggerNtupleHGCPanels(const edm::ParameterSet &conf)
Definition: HGCalTriggerNtupleHGCPanels.cc:47
Event
BXVector::begin
const_iterator begin(int bx) const
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
HGCalTriggerNtupleHGCPanels::panel_tc_cell_
std::vector< std::vector< uint32_t > > panel_tc_cell_
Definition: HGCalTriggerNtupleHGCPanels.cc:31
CaloGeometryRecord.h
HGCalTriggerNtupleHGCPanels::clear
void clear() final
Definition: HGCalTriggerNtupleHGCPanels.cc:125
HGCalTriggerNtupleHGCPanels::panel_tc_pt_
std::vector< std::vector< float > > panel_tc_pt_
Definition: HGCalTriggerNtupleHGCPanels.cc:33
HGCalTriggerNtupleHGCPanels
Definition: HGCalTriggerNtupleHGCPanels.cc:8
BXVector::end
const_iterator end(int bx) const
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalTriggerNtupleHGCPanels::kThird_mask_
static const unsigned kThird_mask_
Definition: HGCalTriggerNtupleHGCPanels.cc:41
ParameterSet
Definition: Functions.h:16
edmplugin::PluginFactory
Definition: PluginFactory.h:34
HGCalTriggerNtupleBase.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HGCalTriggerNtupleHGCPanels::panel_number_
std::vector< int > panel_number_
Definition: HGCalTriggerNtupleHGCPanels.cc:26
edm::EventSetup
Definition: EventSetup.h:57
HGCalTriggerNtupleHGCPanels::panel_tc_n_
std::vector< unsigned > panel_tc_n_
Definition: HGCalTriggerNtupleHGCPanels.cc:27
get
#define get
HGCalTriggerNtupleHGCPanels::panel_id_
std::vector< uint32_t > panel_id_
Definition: HGCalTriggerNtupleHGCPanels.cc:22
EDGetToken
HGCalDetId::wafer
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
HGCalDetId
Definition: HGCalDetId.h:8
HGCalDetId.h
HGCalTriggerGeometryBase::getModuleFromTriggerCell
virtual unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const =0
std
Definition: JetResolutionObject.h:76
HGCalTriggerNtupleHGCPanels::fill
void fill(const edm::Event &e, const edm::EventSetup &es) final
Definition: HGCalTriggerNtupleHGCPanels.cc:71
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
HGCalTriggerNtupleHGCPanels::kSector_offset_
static const unsigned kSector_offset_
Definition: HGCalTriggerNtupleHGCPanels.cc:38
HGCalTriggerNtupleHGCPanels::geometry_
edm::ESHandle< HGCalTriggerGeometryBase > geometry_
Definition: HGCalTriggerNtupleHGCPanels.cc:19
HGCalTriggerNtupleHGCPanels::~HGCalTriggerNtupleHGCPanels
~HGCalTriggerNtupleHGCPanels() override
Definition: HGCalTriggerNtupleHGCPanels.cc:11
HGCalTriggerNtupleHGCPanels::kThird_offset_
static const unsigned kThird_offset_
Definition: HGCalTriggerNtupleHGCPanels.cc:40
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalTriggerNtupleHGCPanels::panel_tc_third_
std::vector< std::vector< uint32_t > > panel_tc_third_
Definition: HGCalTriggerNtupleHGCPanels.cc:30
HGCalTriggerCell.h
HGCalTriggerNtupleHGCPanels::panel_layer_
std::vector< int > panel_layer_
Definition: HGCalTriggerNtupleHGCPanels.cc:24
EventSetup
edm::Event
Definition: Event.h:73
HGCalTriggerNtupleHGCPanels::panel_zside_
std::vector< int > panel_zside_
Definition: HGCalTriggerNtupleHGCPanels.cc:23
HGCalTriggerNtupleHGCPanels::panel_sector_
std::vector< int > panel_sector_
Definition: HGCalTriggerNtupleHGCPanels.cc:25
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
HGCHEB
Definition: ForwardSubdetector.h:10
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37