27 void simhits(
const edm::Event& e, std::unordered_map<uint32_t, double>& simhits_ee, std::unordered_map<uint32_t, double>& simhits_fh, std::unordered_map<uint32_t, double>& simhits_bh);
69 "HGCalTriggerNtupleHGCTriggerCells" );
99 tree.Branch(
"tc_n", &
tc_n_,
"tc_n/I");
100 tree.Branch(
"tc_id", &
tc_id_);
108 tree.Branch(
"tc_pt", &
tc_pt_);
112 tree.Branch(
"tc_eta", &
tc_eta_);
113 tree.Branch(
"tc_phi", &
tc_phi_);
114 tree.Branch(
"tc_x", &
tc_x_);
115 tree.Branch(
"tc_y", &
tc_y_);
116 tree.Branch(
"tc_z", &
tc_z_);
142 std::unordered_map<uint32_t, double> simhits_ee;
143 std::unordered_map<uint32_t, double> simhits_fh;
144 std::unordered_map<uint32_t, double> simhits_bh;
148 std::unordered_map<uint32_t, uint32_t> cell2cluster;
149 std::unordered_map<uint32_t, l1t::HGCalMulticlusterBxCollection::const_iterator> cell2multicluster;
150 for(
auto mcl_itr=multiclusters.
begin(0); mcl_itr!=multiclusters.
end(0); mcl_itr++)
153 for(
const auto& cl_ptr : mcl_itr->constituents())
156 for(
const auto& tc_ptr : cl_ptr.second->constituents())
158 cell2cluster.emplace(tc_ptr.second->detId(), cl_ptr.second->detId());
159 cell2multicluster.emplace(tc_ptr.second->detId(), mcl_itr);
167 for(
auto tc_itr=trigger_cells.
begin(0); tc_itr!=trigger_cells.
end(0); tc_itr++)
171 auto cl_itr = cell2cluster.find(tc_itr->detId());
172 auto mcl_itr = cell2multicluster.find(tc_itr->detId());
173 uint32_t cl_id = (cl_itr!=cell2cluster.end() ? cl_itr->second : 0);
174 uint32_t mcl_id = (mcl_itr!=cell2multicluster.end() ? mcl_itr->second->detId() : 0);
175 float mcl_pt = (mcl_itr!=cell2multicluster.end() ? mcl_itr->second->pt() : 0.);
181 tc_id_.emplace_back(tc_itr->detId());
188 tc_data_.emplace_back(tc_itr->hwPt());
191 tc_pt_.emplace_back(tc_itr->pt());
193 tc_eta_.emplace_back(tc_itr->eta());
194 tc_phi_.emplace_back(tc_itr->phi());
195 tc_x_.emplace_back(tc_itr->position().x());
196 tc_y_.emplace_back(tc_itr->position().y());
197 tc_z_.emplace_back(tc_itr->position().z());
206 int subdet =
id.subdetId();
214 auto itr = simhits_ee.find(c_id);
215 if(itr!=simhits_ee.end())
219 int layer = detid.
layer();
220 energy +=
calibrate(itr->second, thickness, layer);
226 auto itr = simhits_fh.find(c_id);
227 if(itr!=simhits_fh.end())
231 int layer = detid.
layer();
232 energy +=
calibrate(itr->second, thickness, layer);
238 auto itr = simhits_bh.find(c_id);
239 if(itr!=simhits_bh.end()) energy += itr->second;
259 double TeV2GeV = 1.e3;
265 simhits(
const edm::Event&
e, std::unordered_map<uint32_t, double>& simhits_ee, std::unordered_map<uint32_t, double>& simhits_fh, std::unordered_map<uint32_t, double>& simhits_bh)
278 int layer=0,cell=0, sec=0, subsec=0, zp=0,subdet=0;
280 for(
const auto& simhit : ee_simhits )
285 cell = recoLayerCell.first;
286 layer = recoLayerCell.second;
287 if (layer<0 || cell<0)
continue;
288 auto itr_insert = simhits_ee.emplace(
HGCalDetId(mysubdet,zp,layer,subsec,sec,cell), 0.);
289 itr_insert.first->second += simhit.energy();
293 layer=0; cell=0; sec=0; subsec=0; zp=0; subdet=0;
294 for(
const auto& simhit : fh_simhits )
299 cell = recoLayerCell.first;
300 layer = recoLayerCell.second;
301 if (layer<0 || cell<0)
continue;
302 auto itr_insert = simhits_fh.emplace(
HGCalDetId(mysubdet,zp,layer,subsec,sec,cell), 0.);
303 itr_insert.first->second += simhit.energy();
307 for(
const auto& simhit : bh_simhits )
311 auto itr_insert = simhits_bh.emplace(
id, 0.);
312 itr_insert.first->second += simhit.energy();
void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
std::vector< float > tc_energy_
std::vector< int > tc_cell_
const_iterator end(int bx) const
T getParameter(std::string const &) const
edm::ESHandle< HGCalTriggerGeometryBase > geometry_
std::vector< uint32_t > tc_data_
const HcalDDDRecConstants * dddConstants() const
std::vector< PCaloHit > PCaloHitContainer
virtual geom_set getCellsFromTriggerCell(const unsigned cell_det_id) const =0
void fill(const edm::Event &e, const edm::EventSetup &es) final
std::vector< int > tc_wafer_
std::vector< double > layerWeights_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const HGCalTopology & eeTopology() const
~HGCalTriggerNtupleHGCTriggerCells() override
HGCalTriggerNtupleHGCTriggerCells(const edm::ParameterSet &conf)
bool detectorType() const
double calibrate(double, int, int)
std::vector< int > tc_side_
std::vector< uint32_t > tc_id_
std::vector< float > tc_eta_
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
bool filter_cells_in_multiclusters_
const HcalTopology & bhTopology() const
edm::EDGetToken multiclusters_token_
edm::EDGetToken simhits_ee_token_
int wafer() const
get the wafer #
int waferTypeL(int wafer) const
std::vector< uint32_t > tc_cluster_id_
edm::EDGetToken trigger_cells_token_
HGCalTriggerTools triggerTools_
edm::EDGetToken simhits_bh_token_
std::vector< int > tc_wafertype_
const HGCalDDDConstants & dddConstants() const
std::vector< float > tc_multicluster_pt_
std::vector< double > thicknessCorrections_
std::vector< float > tc_phi_
edm::EDGetToken simhits_fh_token_
std::vector< float > tc_x_
std::vector< float > tc_pt_
std::vector< int > tc_subdet_
std::vector< float > tc_mipPt_
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< float > tc_y_
DetId relabel(const uint32_t testId) const
void simhits(const edm::Event &e, std::unordered_map< uint32_t, double > &simhits_ee, std::unordered_map< uint32_t, double > &simhits_fh, std::unordered_map< uint32_t, double > &simhits_bh)
std::vector< float > tc_z_
std::vector< double > fcPerMip_
std::vector< int > tc_layer_
const_iterator begin(int bx) const
std::vector< float > tc_simenergy_
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
std::vector< uint32_t > tc_multicluster_id_
const HGCalTopology & fhTopology() const
int layer() const
get the layer #