30 std::unordered_map<uint32_t, double>& simhits_ee,
31 std::unordered_map<uint32_t, double>& simhits_fh,
32 std::unordered_map<uint32_t, double>& simhits_bh);
95 keV2fC_(conf.getParameter<double>(
"keV2fC")),
96 fcPerMip_(conf.getParameter<
std::vector<double>>(
"fcPerMip")),
121 auto withPrefix([&prefix, &bname](
char const* vname) ->
char const* {
122 bname = prefix +
"_" + vname;
123 return bname.c_str();
126 tree.Branch(withPrefix(
"n"), &
tc_n_, (prefix +
"_n/I").c_str());
127 tree.Branch(withPrefix(
"id"), &
tc_id_);
128 tree.Branch(withPrefix(
"subdet"), &
tc_subdet_);
129 tree.Branch(withPrefix(
"zside"), &
tc_side_);
130 tree.Branch(withPrefix(
"layer"), &
tc_layer_);
131 tree.Branch(withPrefix(
"wafer"), &
tc_wafer_);
132 tree.Branch(withPrefix(
"waferu"), &
tc_waferu_);
133 tree.Branch(withPrefix(
"waferv"), &
tc_waferv_);
137 tree.Branch(withPrefix(
"cell"), &
tc_cell_);
138 tree.Branch(withPrefix(
"cellu"), &
tc_cellu_);
139 tree.Branch(withPrefix(
"cellv"), &
tc_cellv_);
140 tree.Branch(withPrefix(
"data"), &
tc_data_);
143 tree.Branch(withPrefix(
"pt"), &
tc_pt_);
144 tree.Branch(withPrefix(
"mipPt"), &
tc_mipPt_);
145 tree.Branch(withPrefix(
"energy"), &
tc_energy_);
148 tree.Branch(withPrefix(
"eta"), &
tc_eta_);
149 tree.Branch(withPrefix(
"phi"), &
tc_phi_);
150 tree.Branch(withPrefix(
"x"), &
tc_x_);
151 tree.Branch(withPrefix(
"y"), &
tc_y_);
152 tree.Branch(withPrefix(
"z"), &
tc_z_);
175 std::unordered_map<uint32_t, double> simhits_ee;
176 std::unordered_map<uint32_t, double> simhits_fh;
177 std::unordered_map<uint32_t, double> simhits_bh;
179 simhits(e, simhits_ee, simhits_fh, simhits_bh);
182 std::unordered_map<uint32_t, unsigned> cell_to_genparticle;
185 for (
auto& keyval : *caloparticles_map_h) {
186 for (
auto& tcref : keyval.val)
187 cell_to_genparticle.emplace(tcref->detId(), keyval.key->g4Tracks().at(0).genpartIndex() - 1);
192 std::unordered_map<uint32_t, uint32_t> cell2cluster;
193 std::unordered_map<uint32_t, l1t::HGCalMulticlusterBxCollection::const_iterator> cell2multicluster;
194 for (
auto mcl_itr = multiclusters.
begin(0); mcl_itr != multiclusters.
end(0); mcl_itr++) {
196 for (
const auto& cl_ptr : mcl_itr->constituents()) {
198 for (
const auto& tc_ptr : cl_ptr.second->constituents()) {
199 cell2cluster.emplace(tc_ptr.second->detId(), cl_ptr.second->detId());
200 cell2multicluster.emplace(tc_ptr.second->detId(), mcl_itr);
208 for (
auto tc_itr = trigger_cells.
begin(0); tc_itr != trigger_cells.
end(0); tc_itr++) {
209 if (tc_itr->hwPt() > 0) {
210 auto cl_itr = cell2cluster.find(tc_itr->detId());
211 auto mcl_itr = cell2multicluster.find(tc_itr->detId());
212 uint32_t cl_id = (cl_itr != cell2cluster.end() ? cl_itr->second : 0);
213 uint32_t mcl_id = (mcl_itr != cell2multicluster.end() ? mcl_itr->second->detId() : 0);
214 float mcl_pt = (mcl_itr != cell2multicluster.end() ? mcl_itr->second->pt() : 0.);
222 int panel_sector = -999;
223 int panel_number = -999;
227 panel_number = panelIdHGCal.
wafer();
234 panel_sector = panelIdSci.
iphi();
235 panel_number = panelIdSci.
ietaAbs();
239 tc_id_.emplace_back(tc_itr->detId());
268 tc_data_.emplace_back(tc_itr->hwPt());
273 tc_pt_.emplace_back(tc_itr->pt());
275 tc_eta_.emplace_back(tc_itr->eta());
276 tc_phi_.emplace_back(tc_itr->phi());
277 tc_x_.emplace_back(tc_itr->position().x());
278 tc_y_.emplace_back(tc_itr->position().y());
279 tc_z_.emplace_back(tc_itr->position().z());
292 auto itr = simhits_ee.find(c_id);
293 if (itr != simhits_ee.end())
294 energy +=
calibrate(itr->second, thickness, layer);
296 auto itr = simhits_fh.find(c_id);
297 if (itr != simhits_fh.end())
298 energy +=
calibrate(itr->second, thickness, layer);
300 auto itr = simhits_bh.find(c_id);
301 if (itr != simhits_bh.end())
302 energy += itr->second;
310 auto itr(cell_to_genparticle.find(tc_itr->detId()));
311 if (itr == cell_to_genparticle.end())
323 double TeV2GeV = 1.e3;
328 std::unordered_map<uint32_t, double>& simhits_ee,
329 std::unordered_map<uint32_t, double>& simhits_fh,
330 std::unordered_map<uint32_t, double>& simhits_bh) {
342 for (
const auto& simhit : ee_simhits) {
346 auto itr_insert = simhits_ee.emplace(
id, 0.);
347 itr_insert.first->second += simhit.energy();
350 for (
const auto& simhit : fh_simhits) {
354 auto itr_insert = simhits_fh.emplace(
id, 0.);
355 itr_insert.first->second += simhit.energy();
358 for (
const auto& simhit : bh_simhits) {
363 auto itr_insert = simhits_bh.emplace(
id, 0.);
364 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
std::vector< int > tc_cellv_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ESHandle< HGCalTriggerGeometryBase > geometry_
std::vector< uint32_t > tc_data_
std::vector< uint32_t > tc_compressedCharge_
std::vector< PCaloHit > PCaloHitContainer
std::vector< int > tc_panel_sector_
virtual geom_set getCellsFromTriggerCell(const unsigned cell_det_id) const =0
HGCalTriggerSubdetector subdet() const
get the subdetector
std::vector< int > tc_waferv_
void fill(const edm::Event &e, const edm::EventSetup &es) final
static const unsigned kPanelOffset_
std::vector< int > tc_wafer_
std::vector< double > layerWeights_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const HGCalTopology & eeTopology() const
~HGCalTriggerNtupleHGCTriggerCells() override
int triggerCellU() const
get the cell #'s in u,v or in x,y
HGCalTriggerNtupleHGCTriggerCells(const edm::ParameterSet &conf)
std::vector< int > tc_panel_number_
int type() const
get the type
static const unsigned kPanelMask_
DetId::Detector subdet() const
get the subdetector
int type() const
get the type
std::vector< int > tc_side_
std::vector< uint32_t > tc_id_
std::vector< float > tc_eta_
bool filter_cells_in_multiclusters_
std::vector< int > tc_waferu_
const HcalTopology & bhTopology() const
edm::EDGetToken multiclusters_token_
std::vector< uint32_t > tc_uncompressedCharge_
edm::EDGetToken simhits_ee_token_
int iphi() const
get the phi index
int wafer() const
get the wafer #
std::vector< uint32_t > tc_cluster_id_
std::vector< int > tc_cellu_
edm::EDGetToken trigger_cells_token_
static const unsigned kSectorMask_
HGCalTriggerTools triggerTools_
edm::EDGetToken simhits_bh_token_
std::vector< int > tc_wafertype_
int cell() const
get the absolute value of the cell #'s in x and y
virtual unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const =0
std::vector< float > tc_multicluster_pt_
const HGCalTopology & hscTopology() const
std::vector< double > thicknessCorrections_
std::vector< float > tc_phi_
bool isV9Geometry() const
edm::EDGetToken simhits_fh_token_
std::vector< float > tc_x_
std::vector< float > tc_pt_
edm::EDGetToken caloparticles_map_token_
std::vector< int > tc_subdet_
std::vector< int > tc_genparticle_index_
std::vector< float > tc_mipPt_
int waferType() const
get the wafer type
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< float > tc_y_
double calibrate(double, int, unsigned)
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 const unsigned kSectorOffset_
edm::AssociationMap< edm::OneToMany< CaloParticleCollection, l1t::HGCalTriggerCellBxCollection > > CaloToCellsMap
std::vector< uint32_t > tc_multicluster_id_
const HGCalTopology & fhTopology() const