22 std::unordered_map<uint32_t,
double>& simhits_ee,
23 std::unordered_map<uint32_t,
double>& simhits_fh,
24 std::unordered_map<uint32_t,
double>& simhits_bh);
72 is_Simhit_comp_ = conf.getParameter<
bool>(
"isSimhitComp");
73 digiBXselect_ = conf.getParameter<std::vector<unsigned int>>(
"digiBXselect");
75 if (digiBXselect_.empty()) {
76 throw cms::Exception(
"BadInitialization") <<
"digiBXselect vector is empty";
78 if (*std::max_element(digiBXselect_.begin(), digiBXselect_.end()) >= kDigiSize_) {
80 <<
"digiBXselect vector requests a BX outside of maximum size of digis (" << kDigiSize_ <<
" BX)";
83 std::sort(digiBXselect_.begin(), digiBXselect_.end());
84 if (
std::unique(digiBXselect_.begin(), digiBXselect_.end()) != digiBXselect_.end()) {
85 throw cms::Exception(
"BadInitialization") <<
"digiBXselect vector contains duplicate BX values";
106 tree.Branch(
"hgcdigi_n", &
hgcdigi_n_,
"hgcdigi_n/I");
116 auto withBX([&bname](
char const* vname,
unsigned int bx) ->
char const* {
118 return bname.c_str();
132 tree.Branch(
"bhdigi_n", &
bhdigi_n_,
"bhdigi_n/I");
165 std::unordered_map<uint32_t, double> simhits_ee;
166 std::unordered_map<uint32_t, double> simhits_fh;
167 std::unordered_map<uint32_t, double> simhits_bh;
169 simhits(e, simhits_ee, simhits_fh, simhits_bh);
209 for (
const auto& digi : ee_digis) {
230 double hit_energy = 0;
231 auto itr = simhits_ee.find(
id);
232 if (itr != simhits_ee.end())
233 hit_energy = itr->second;
238 for (
const auto& digi : fh_digis) {
259 double hit_energy = 0;
260 auto itr = simhits_fh.find(
id);
261 if (itr != simhits_fh.end())
262 hit_energy = itr->second;
267 for (
const auto& digi : bh_digis) {
285 double hit_energy = 0;
286 auto itr = simhits_bh.find(
id);
287 if (itr != simhits_bh.end())
288 hit_energy = itr->second;
295 std::unordered_map<uint32_t, double>& simhits_ee,
296 std::unordered_map<uint32_t, double>& simhits_fh,
297 std::unordered_map<uint32_t, double>& simhits_bh) {
309 for (
const auto& simhit : ee_simhits) {
313 auto itr_insert = simhits_ee.emplace(
id, 0.);
314 itr_insert.first->second += simhit.energy();
317 for (
const auto& simhit : fh_simhits) {
321 auto itr_insert = simhits_fh.emplace(
id, 0.);
322 itr_insert.first->second += simhit.energy();
325 for (
const auto& simhit : bh_simhits) {
329 auto itr_insert = simhits_bh.emplace(
id, 0.);
330 itr_insert.first->second += simhit.energy();
std::vector< int > hgcdigi_subdet_
std::vector< PCaloHit > PCaloHitContainer
edm::EDGetToken ee_token_
std::vector< std::vector< uint32_t > > bhdigi_data_
std::vector< float > bhdigi_eta_
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< float > hgcdigi_eta_
std::vector< int > hgcdigi_waferu_
const HGCalGeometry * eeGeometry() const
const HGCalTopology & eeTopology() const
static constexpr unsigned kDigiSize_
edm::EDGetToken SimHits_inputfh_
Geom::Phi< T > phi() const
std::string to_string(const V &value)
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< int > bhdigi_id_
std::vector< int > hgcdigi_layer_
edm::ESHandle< HGCalTriggerGeometryBase > geometry
HGCalTriggerTools triggerTools_
std::vector< int > bhdigi_side_
std::vector< float > bhdigi_phi_
void fill(const edm::Event &e, const HGCalTriggerNtupleEventSetup &es) final
std::vector< int > hgcdigi_side_
void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
std::vector< std::vector< int > > bhdigi_isadc_
std::vector< int > bhdigi_ieta_
edm::EDGetToken SimHits_inputee_
HGCalTriggerNtupleHGCDigis(const edm::ParameterSet &conf)
std::vector< float > hgcdigi_phi_
std::vector< float > hgcdigi_z_
const HGCalGeometry * hsiGeometry() const
std::vector< int > hgcdigi_waferv_
const HGCalGeometry * hscGeometry() const
const HGCalTopology & hscTopology() const
T const * product() const
T getParameter(std::string const &) const
std::vector< float > bhdigi_z_
char data[epos_bytes_allocation]
std::vector< std::vector< int > > hgcdigi_isadc_
edm::EDGetToken bh_token_
GlobalPoint getPosition(const DetId &id, bool debug=false) const
std::vector< int > hgcdigi_cellv_
std::vector< int > hgcdigi_cellu_
std::vector< int > bhdigi_subdet_
std::vector< std::vector< uint32_t > > hgcdigi_data_
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< float > bhdigi_simenergy_
std::vector< int > hgcdigi_id_
std::vector< int > hgcdigi_wafertype_
edm::EDGetToken fh_token_
std::vector< int > bhdigi_layer_
edm::EDGetToken SimHits_inputbh_
std::vector< int > bhdigi_iphi_
std::vector< unsigned int > digiBXselect_
const HGCalTopology & fhTopology() const
std::vector< float > hgcdigi_simenergy_
~HGCalTriggerNtupleHGCDigis() override