CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTriggerNtupleHGCDigis Class Reference
Inheritance diagram for HGCalTriggerNtupleHGCDigis:
HGCalTriggerNtupleBase

Public Member Functions

virtual void fill (const edm::Event &e, const edm::EventSetup &es) override final
 
 HGCalTriggerNtupleHGCDigis (const edm::ParameterSet &conf)
 
virtual void initialize (TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) override final
 
 ~HGCalTriggerNtupleHGCDigis ()
 
- Public Member Functions inherited from HGCalTriggerNtupleBase
 HGCalTriggerNtupleBase (const edm::ParameterSet &conf)
 
virtual ~HGCalTriggerNtupleBase ()
 

Private Member Functions

virtual void clear () override final
 
void simhits (const edm::Event &e, std::unordered_map< uint32_t, double > &simhits_ee, std::unordered_map< uint32_t, double > &simhits_fh)
 

Private Attributes

edm::EDGetToken ee_token_
 
edm::EDGetToken fh_token_
 
edm::ESHandle< HGCalGeometrygeom_ee
 
edm::ESHandle< HGCalGeometrygeom_fh
 
std::vector< int > hgcdigi_cell_
 
std::vector< uint32_t > hgcdigi_data_
 
std::vector< float > hgcdigi_eta_
 
std::vector< int > hgcdigi_id_
 
std::vector< int > hgcdigi_isadc_
 
std::vector< int > hgcdigi_layer_
 
int hgcdigi_n_
 
std::vector< float > hgcdigi_phi_
 
std::vector< int > hgcdigi_side_
 
std::vector< float > hgcdigi_simenergy_
 
std::vector< int > hgcdigi_subdet_
 
std::vector< int > hgcdigi_wafer_
 
std::vector< int > hgcdigi_wafertype_
 
std::vector< float > hgcdigi_z_
 
bool is_Simhit_comp_
 
edm::EDGetToken SimHits_inputee_
 
edm::EDGetToken SimHits_inputfh_
 
edm::ESHandle< HGCalTopologytopo_ee
 
edm::ESHandle< HGCalTopologytopo_fh
 

Additional Inherited Members

Detailed Description

Definition at line 12 of file HGCalTriggerNtupleHGCDigis.cc.

Constructor & Destructor Documentation

HGCalTriggerNtupleHGCDigis::HGCalTriggerNtupleHGCDigis ( const edm::ParameterSet conf)

Definition at line 55 of file HGCalTriggerNtupleHGCDigis.cc.

References edm::ParameterSet::getParameter(), initialize(), and is_Simhit_comp_.

56 {
57  is_Simhit_comp_ = conf.getParameter<bool>("isSimhitComp");
58 
59 }
T getParameter(std::string const &) const
HGCalTriggerNtupleBase(const edm::ParameterSet &conf)
HGCalTriggerNtupleHGCDigis::~HGCalTriggerNtupleHGCDigis ( )
inline

Definition at line 17 of file HGCalTriggerNtupleHGCDigis.cc.

References clear(), MillePedeFileConverter_cfg::e, fill(), initialize(), and simhits().

17 {};

Member Function Documentation

void HGCalTriggerNtupleHGCDigis::clear ( void  )
finaloverrideprivatevirtual

Implements HGCalTriggerNtupleBase.

Definition at line 227 of file HGCalTriggerNtupleHGCDigis.cc.

References hgcdigi_cell_, hgcdigi_data_, hgcdigi_eta_, hgcdigi_id_, hgcdigi_isadc_, hgcdigi_layer_, hgcdigi_n_, hgcdigi_phi_, hgcdigi_side_, hgcdigi_simenergy_, hgcdigi_subdet_, hgcdigi_wafer_, hgcdigi_wafertype_, hgcdigi_z_, and is_Simhit_comp_.

Referenced by fill(), simhits(), and ~HGCalTriggerNtupleHGCDigis().

228 {
229  hgcdigi_n_ = 0;
230  hgcdigi_id_.clear();
231  hgcdigi_subdet_.clear();
232  hgcdigi_side_.clear();
233  hgcdigi_layer_.clear();
234  hgcdigi_wafer_.clear();
235  hgcdigi_wafertype_.clear();
236  hgcdigi_cell_.clear();
237  hgcdigi_eta_.clear();
238  hgcdigi_phi_.clear();
239  hgcdigi_z_.clear();
240  hgcdigi_data_.clear();
241  hgcdigi_isadc_.clear();
242  if (is_Simhit_comp_) hgcdigi_simenergy_.clear();
243 }
std::vector< uint32_t > hgcdigi_data_
void HGCalTriggerNtupleHGCDigis::fill ( const edm::Event e,
const edm::EventSetup es 
)
finaloverridevirtual

Implements HGCalTriggerNtupleBase.

Definition at line 90 of file HGCalTriggerNtupleHGCDigis.cc.

References clear(), data, ee_token_, PV3DBase< T, PVType, FrameType >::eta(), fh_token_, geom_ee, geom_fh, edm::EventSetup::get(), edm::Event::getByToken(), HGCalGeometry::getPosition(), hgcdigi_cell_, hgcdigi_data_, hgcdigi_eta_, hgcdigi_id_, hgcdigi_isadc_, hgcdigi_layer_, hgcdigi_n_, hgcdigi_phi_, hgcdigi_side_, hgcdigi_simenergy_, hgcdigi_subdet_, hgcdigi_wafer_, hgcdigi_wafertype_, hgcdigi_z_, HGCEE, HGCHEF, hcalTTPDigis_cfi::id, is_Simhit_comp_, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, PV3DBase< T, PVType, FrameType >::phi(), simhits(), edm::SortedCollection< T, SORT >::size(), topo_ee, topo_fh, PV3DBase< T, PVType, FrameType >::z(), and HcalDigiParam_cfi::zside.

Referenced by initialize(), and ~HGCalTriggerNtupleHGCDigis().

91 {
92 
93  es.get<IdealGeometryRecord>().get("HGCalEESensitive", geom_ee);
94  es.get<IdealGeometryRecord>().get("HGCalHESiliconSensitive", geom_fh);
95  es.get<IdealGeometryRecord>().get("HGCalEESensitive",topo_ee);
96  es.get<IdealGeometryRecord>().get("HGCalHESiliconSensitive",topo_fh);
98  e.getByToken(ee_token_, ee_digis_h);
99  const HGCEEDigiCollection& ee_digis = *ee_digis_h;
101  e.getByToken(fh_token_, fh_digis_h);
102  const HGCHEDigiCollection& fh_digis = *fh_digis_h;
103 
104  // sim hit association
105  std::unordered_map<uint32_t, double> simhits_ee;
106  std::unordered_map<uint32_t, double> simhits_fh;
107  if (is_Simhit_comp_) simhits(e, simhits_ee, simhits_fh);
108 
109  clear();
110  hgcdigi_n_ = ee_digis.size() + fh_digis.size();
111  hgcdigi_id_.reserve(hgcdigi_n_);
112  hgcdigi_subdet_.reserve(hgcdigi_n_);
113  hgcdigi_side_.reserve(hgcdigi_n_);
114  hgcdigi_layer_.reserve(hgcdigi_n_);
115  hgcdigi_wafer_.reserve(hgcdigi_n_);
117  hgcdigi_cell_.reserve(hgcdigi_n_);
118  hgcdigi_eta_.reserve(hgcdigi_n_);
119  hgcdigi_phi_.reserve(hgcdigi_n_);
120  hgcdigi_z_.reserve(hgcdigi_n_);
121  hgcdigi_data_.reserve(hgcdigi_n_);
122  hgcdigi_isadc_.reserve(hgcdigi_n_);
124 
125  for(const auto& digi : ee_digis)
126  {
127  const HGCalDetId id(digi.id());
128  hgcdigi_id_.emplace_back(id.rawId());
130  hgcdigi_side_.emplace_back(id.zside());
131  hgcdigi_layer_.emplace_back(id.layer());
132  hgcdigi_wafer_.emplace_back(id.wafer());
133  hgcdigi_wafertype_.emplace_back(id.waferType());
134  hgcdigi_cell_.emplace_back(id.cell());
135  GlobalPoint cellpos = geom_ee->getPosition(id.rawId());
136  hgcdigi_eta_.emplace_back(cellpos.eta());
137  hgcdigi_phi_.emplace_back(cellpos.phi());
138  hgcdigi_z_.emplace_back(cellpos.z());
139  hgcdigi_data_.emplace_back(digi[2].data());
140  int is_adc=0;
141  if (!(digi[2].mode())) is_adc =1;
142  hgcdigi_isadc_.emplace_back(is_adc);
143  if (is_Simhit_comp_) {
144  double hit_energy=0;
145  auto itr = simhits_ee.find(id);
146  if(itr!=simhits_ee.end())hit_energy = itr->second;
147  hgcdigi_simenergy_.emplace_back(hit_energy);
148  }
149  }
150 
151  for(const auto& digi : fh_digis)
152  {
153  const HGCalDetId id(digi.id());
154  hgcdigi_id_.emplace_back(id.rawId());
156  hgcdigi_side_.emplace_back(id.zside());
157  hgcdigi_layer_.emplace_back(id.layer());
158  hgcdigi_wafer_.emplace_back(id.wafer());
159  hgcdigi_wafertype_.emplace_back(id.waferType());
160  hgcdigi_cell_.emplace_back(id.cell());
161  GlobalPoint cellpos = geom_fh->getPosition(id.rawId());
162  hgcdigi_eta_.emplace_back(cellpos.eta());
163  hgcdigi_phi_.emplace_back(cellpos.phi());
164  hgcdigi_z_.emplace_back(cellpos.z());
165  hgcdigi_data_.emplace_back(digi[2].data());
166  int is_adc=0;
167  if (!(digi[2].mode())) is_adc =1;
168  hgcdigi_isadc_.emplace_back(is_adc);
169  if (is_Simhit_comp_) {
170  double hit_energy=0;
171  auto itr = simhits_fh.find(id);
172  if(itr!=simhits_fh.end())hit_energy = itr->second;
173  hgcdigi_simenergy_.emplace_back(hit_energy);
174  }
175  }
176 }
edm::ESHandle< HGCalTopology > topo_fh
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::ESHandle< HGCalGeometry > geom_fh
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
edm::ESHandle< HGCalGeometry > geom_ee
GlobalPoint getPosition(const DetId &id) const
std::vector< uint32_t > hgcdigi_data_
T z() const
Definition: PV3DBase.h:64
void simhits(const edm::Event &e, std::unordered_map< uint32_t, double > &simhits_ee, std::unordered_map< uint32_t, double > &simhits_fh)
edm::ESHandle< HGCalTopology > topo_ee
const T & get() const
Definition: EventSetup.h:56
T eta() const
Definition: PV3DBase.h:76
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
size_type size() const
virtual void clear() override final
void HGCalTriggerNtupleHGCDigis::initialize ( TTree &  tree,
const edm::ParameterSet conf,
edm::ConsumesCollector &&  collector 
)
finaloverridevirtual

Implements HGCalTriggerNtupleBase.

Definition at line 63 of file HGCalTriggerNtupleHGCDigis.cc.

References ee_token_, fh_token_, fill(), edm::ParameterSet::getParameter(), hgcdigi_cell_, hgcdigi_data_, hgcdigi_eta_, hgcdigi_id_, hgcdigi_isadc_, hgcdigi_layer_, hgcdigi_n_, hgcdigi_phi_, hgcdigi_side_, hgcdigi_simenergy_, hgcdigi_subdet_, hgcdigi_wafer_, hgcdigi_wafertype_, hgcdigi_z_, is_Simhit_comp_, SimHits_inputee_, and SimHits_inputfh_.

Referenced by HGCalTriggerNtupleHGCDigis(), and ~HGCalTriggerNtupleHGCDigis().

64 {
65 
66  ee_token_ = collector.consumes<HGCEEDigiCollection>(conf.getParameter<edm::InputTag>("HGCDigisEE"));
67  fh_token_ = collector.consumes<HGCHEDigiCollection>(conf.getParameter<edm::InputTag>("HGCDigisFH"));
68  if (is_Simhit_comp_) {
71  }
72  tree.Branch("hgcdigi_n", &hgcdigi_n_, "hgcdigi_n/I");
73  tree.Branch("hgcdigi_id", &hgcdigi_id_);
74  tree.Branch("hgcdigi_subdet", &hgcdigi_subdet_);
75  tree.Branch("hgcdigi_zside", &hgcdigi_side_);
76  tree.Branch("hgcdigi_layer", &hgcdigi_layer_);
77  tree.Branch("hgcdigi_wafer", &hgcdigi_wafer_);
78  tree.Branch("hgcdigi_wafertype", &hgcdigi_wafertype_);
79  tree.Branch("hgcdigi_cell", &hgcdigi_cell_);
80  tree.Branch("hgcdigi_eta", &hgcdigi_eta_);
81  tree.Branch("hgcdigi_phi", &hgcdigi_phi_);
82  tree.Branch("hgcdigi_z", &hgcdigi_z_);
83  tree.Branch("hgcdigi_data", &hgcdigi_data_);
84  tree.Branch("hgcdigi_isadc", &hgcdigi_isadc_);
85  if (is_Simhit_comp_) tree.Branch("hgcdigi_simenergy", &hgcdigi_simenergy_);
86 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< PCaloHit > PCaloHitContainer
std::vector< uint32_t > hgcdigi_data_
Definition: tree.py:1
void HGCalTriggerNtupleHGCDigis::simhits ( const edm::Event e,
std::unordered_map< uint32_t, double > &  simhits_ee,
std::unordered_map< uint32_t, double > &  simhits_fh 
)
private

Definition at line 180 of file HGCalTriggerNtupleHGCDigis.cc.

References clear(), HGCalTopology::dddConstants(), HGCalTopology::detectorType(), edm::Event::getByToken(), SimHits_inputee_, SimHits_inputfh_, HGCalDDDConstants::simToReco(), topo_ee, topo_fh, and HGCalTestNumbering::unpackHexagonIndex().

Referenced by fill(), and ~HGCalTriggerNtupleHGCDigis().

181 {
182 
184  e.getByToken(SimHits_inputee_,ee_simhits_h);
185  const edm::PCaloHitContainer& ee_simhits = *ee_simhits_h;
187  e.getByToken(SimHits_inputfh_,fh_simhits_h);
188  const edm::PCaloHitContainer& fh_simhits = *fh_simhits_h;
189 
190  //EE
191  int layer=0,cell=0, sec=0, subsec=0, zp=0,subdet=0;
192  ForwardSubdetector mysubdet;
193 
194  for( const auto& simhit : ee_simhits ) {
195  HGCalTestNumbering::unpackHexagonIndex(simhit.id(), subdet, zp, layer, sec, subsec, cell);
196  mysubdet = (ForwardSubdetector)(subdet);
197  std::pair<int,int> recoLayerCell = topo_ee->dddConstants().simToReco(cell,layer,sec,topo_ee->detectorType());
198  cell = recoLayerCell.first;
199  layer = recoLayerCell.second;
200  if (layer<0 || cell<0) {
201  continue;
202  }
203  auto itr_insert = simhits_ee.emplace(HGCalDetId(mysubdet,zp,layer,subsec,sec,cell), 0.);
204  itr_insert.first->second += simhit.energy();
205  }
206 
207  // FH
208  layer=0; cell=0; sec=0; subsec=0; zp=0; subdet=0;
209 
210  for( const auto& simhit : fh_simhits ) {
211  HGCalTestNumbering::unpackHexagonIndex(simhit.id(), subdet, zp, layer, sec, subsec, cell);
212  mysubdet = (ForwardSubdetector)(subdet);
213  std::pair<int,int> recoLayerCell = topo_fh->dddConstants().simToReco(cell,layer,sec,topo_fh->detectorType());
214  cell = recoLayerCell.first;
215  layer = recoLayerCell.second;
216  if (layer<0 || cell<0) {
217  continue;
218  }
219  auto itr_insert = simhits_fh.emplace(HGCalDetId(mysubdet,zp,layer,subsec,sec,cell), 0.);
220  itr_insert.first->second += simhit.energy();
221  }
222 }
edm::ESHandle< HGCalTopology > topo_fh
std::vector< PCaloHit > PCaloHitContainer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
bool detectorType() const
ForwardSubdetector
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
edm::ESHandle< HGCalTopology > topo_ee
const HGCalDDDConstants & dddConstants() const
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)

Member Data Documentation

edm::EDGetToken HGCalTriggerNtupleHGCDigis::ee_token_
private

Definition at line 25 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by fill(), and initialize().

edm::EDGetToken HGCalTriggerNtupleHGCDigis::fh_token_
private

Definition at line 25 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by fill(), and initialize().

edm::ESHandle<HGCalGeometry> HGCalTriggerNtupleHGCDigis::geom_ee
private

Definition at line 44 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by fill().

edm::ESHandle<HGCalGeometry> HGCalTriggerNtupleHGCDigis::geom_fh
private

Definition at line 44 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by fill().

std::vector<int> HGCalTriggerNtupleHGCDigis::hgcdigi_cell_
private

Definition at line 36 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<uint32_t> HGCalTriggerNtupleHGCDigis::hgcdigi_data_
private

Definition at line 40 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCDigis::hgcdigi_eta_
private

Definition at line 37 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCDigis::hgcdigi_id_
private

Definition at line 30 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCDigis::hgcdigi_isadc_
private

Definition at line 41 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCDigis::hgcdigi_layer_
private

Definition at line 33 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

int HGCalTriggerNtupleHGCDigis::hgcdigi_n_
private

Definition at line 29 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCDigis::hgcdigi_phi_
private

Definition at line 38 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCDigis::hgcdigi_side_
private

Definition at line 32 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCDigis::hgcdigi_simenergy_
private

Definition at line 42 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCDigis::hgcdigi_subdet_
private

Definition at line 31 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCDigis::hgcdigi_wafer_
private

Definition at line 34 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCDigis::hgcdigi_wafertype_
private

Definition at line 35 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCDigis::hgcdigi_z_
private

Definition at line 39 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), and initialize().

bool HGCalTriggerNtupleHGCDigis::is_Simhit_comp_
private

Definition at line 26 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by clear(), fill(), HGCalTriggerNtupleHGCDigis(), and initialize().

edm::EDGetToken HGCalTriggerNtupleHGCDigis::SimHits_inputee_
private

Definition at line 27 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by initialize(), and simhits().

edm::EDGetToken HGCalTriggerNtupleHGCDigis::SimHits_inputfh_
private

Definition at line 27 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by initialize(), and simhits().

edm::ESHandle<HGCalTopology> HGCalTriggerNtupleHGCDigis::topo_ee
private

Definition at line 45 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by fill(), and simhits().

edm::ESHandle<HGCalTopology> HGCalTriggerNtupleHGCDigis::topo_fh
private

Definition at line 45 of file HGCalTriggerNtupleHGCDigis.cc.

Referenced by fill(), and simhits().