CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CaloParticleDebugger Class Reference
Inheritance diagram for CaloParticleDebugger:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 CaloParticleDebugger (const edm::ParameterSet &)
 
 ~CaloParticleDebugger () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
void fillSimHits (std::map< int, float > &, const edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag caloParticles_
 
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticlesToken_
 
std::vector< edm::InputTagcollectionTags_
 
std::vector< edm::EDGetTokenT< std::vector< PCaloHit > > > collectionTagsToken_
 
edm::InputTag genBarcodes_
 
edm::EDGetTokenT< std::vector< int > > genBarcodesToken_
 
edm::InputTag genParticles_
 
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticlesToken_
 
int geometryType_ = 0
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomToken_
 
edm::InputTag simClusters_
 
edm::EDGetTokenT< std::vector< SimCluster > > simClustersToken_
 
edm::InputTag simTracks_
 
edm::EDGetTokenT< std::vector< SimTrack > > simTracksToken_
 
edm::InputTag simVertices_
 
edm::EDGetTokenT< std::vector< SimVertex > > simVerticesToken_
 
edm::InputTag trackingParticles_
 
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticlesToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 47 of file CaloParticleDebugger.cc.

Constructor & Destructor Documentation

◆ CaloParticleDebugger()

CaloParticleDebugger::CaloParticleDebugger ( const edm::ParameterSet iConfig)
explicit

Definition at line 91 of file CaloParticleDebugger.cc.

References caloParticles_, caloParticlesToken_, collectionTags_, collectionTagsToken_, edm::ConsumesCollector::consumes(), edm::EDConsumerBase::consumesCollector(), edm::ConsumesCollector::esConsumes(), genBarcodes_, genBarcodesToken_, genParticles_, genParticlesToken_, geomToken_, simClusters_, simClustersToken_, simTracks_, simTracksToken_, simVertices_, simVerticesToken_, trackingParticles_, and trackingParticlesToken_.

92  : simTracks_(iConfig.getParameter<edm::InputTag>("simTracks")),
93  genParticles_(iConfig.getParameter<edm::InputTag>("genParticles")),
94  genBarcodes_(iConfig.getParameter<edm::InputTag>("genBarcodes")),
95  simVertices_(iConfig.getParameter<edm::InputTag>("simVertices")),
96  trackingParticles_(iConfig.getParameter<edm::InputTag>("trackingParticles")),
97  caloParticles_(iConfig.getParameter<edm::InputTag>("caloParticles")),
98  simClusters_(iConfig.getParameter<edm::InputTag>("simClusters")),
99  collectionTags_(iConfig.getParameter<std::vector<edm::InputTag>>("collectionTags")) {
101  simTracksToken_ = iC.consumes<std::vector<SimTrack>>(simTracks_);
102  genParticlesToken_ = iC.consumes<std::vector<reco::GenParticle>>(genParticles_);
103  genBarcodesToken_ = iC.consumes<std::vector<int>>(genBarcodes_);
104  simVerticesToken_ = iC.consumes<std::vector<SimVertex>>(simVertices_);
105  trackingParticlesToken_ = iC.consumes<std::vector<TrackingParticle>>(trackingParticles_);
106  caloParticlesToken_ = iC.consumes<std::vector<CaloParticle>>(caloParticles_);
107  simClustersToken_ = iC.consumes<std::vector<SimCluster>>(simClusters_);
108  for (auto const& collectionTag : collectionTags_) {
109  collectionTagsToken_.push_back(iC.consumes<std::vector<PCaloHit>>(collectionTag));
110  }
112 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticlesToken_
edm::EDGetTokenT< std::vector< int > > genBarcodesToken_
edm::EDGetTokenT< std::vector< SimCluster > > simClustersToken_
std::vector< edm::EDGetTokenT< std::vector< PCaloHit > > > collectionTagsToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< std::vector< SimTrack > > simTracksToken_
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticlesToken_
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticlesToken_
edm::InputTag trackingParticles_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
std::vector< edm::InputTag > collectionTags_
edm::EDGetTokenT< std::vector< SimVertex > > simVerticesToken_

◆ ~CaloParticleDebugger()

CaloParticleDebugger::~CaloParticleDebugger ( )
override

Definition at line 114 of file CaloParticleDebugger.cc.

114 {}

Member Function Documentation

◆ analyze()

void CaloParticleDebugger::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 121 of file CaloParticleDebugger.cc.

References caloParticlesToken_, haddnano::cl, fillSimHits(), genBarcodesToken_, AJJGenJetFilter_cfi::genParticles, runTauDisplay::genParticlesH, genParticlesToken_, runTauDisplay::gp, mps_fire::i, iEvent, dqmiolumiharvest::j, edm::Handle< T >::product(), SimTracksters_cff::simclusters, simClustersToken_, simTracksToken_, simVerticesToken_, submitPVValidationJobs::t, cmsswSequenceInfo::tp, trackingParticlesToken_, DiMuonV_cfg::tracks, findQualityFiles::v, and AlignmentTracksFromVertexSelector_cfi::vertices.

121  {
122  using namespace edm;
123  using std::begin;
124  using std::end;
125 
128  edm::Handle<std::vector<int>> genBarcodesH;
130  edm::Handle<std::vector<TrackingParticle>> trackingParticlesH;
133 
134  iEvent.getByToken(simTracksToken_, simTracksH);
135  auto const& tracks = *simTracksH.product();
136 
138  auto const& genParticles = *genParticlesH.product();
139 
140  iEvent.getByToken(genBarcodesToken_, genBarcodesH);
141  auto const& genBarcodes = *genBarcodesH.product();
142 
143  iEvent.getByToken(simVerticesToken_, simVerticesH);
144  auto const& vertices = *simVerticesH.product();
145 
146  iEvent.getByToken(trackingParticlesToken_, trackingParticlesH);
147  auto const& trackingpart = *trackingParticlesH.product();
148 
149  iEvent.getByToken(caloParticlesToken_, caloParticlesH);
150  auto const& calopart = *caloParticlesH.product();
151 
152  iEvent.getByToken(simClustersToken_, simClustersH);
153  auto const& simclusters = *simClustersH.product();
154 
155  // Let's first fill in hits information
156  std::map<int, float> detIdToTotalSimEnergy;
157  fillSimHits(detIdToTotalSimEnergy, iEvent, iSetup);
158 
159  std::map<int, int> trackid_to_track_index;
160  LogVerbatim("CaloParticleDebuggerSimTracks") << "\n\n**Printing SimTracks information **";
161  LogVerbatim("CaloParticleDebuggerSimTracks") << "IDX\tTrackId\tPDGID\tMOMENTUM(x,y,z,E)\tVertexIdx\tGenPartIdx";
162  for (size_t i = 0; i < tracks.size(); ++i) {
163  auto const& t = tracks[i];
164  LogVerbatim("CaloParticleDebuggerSimTracks")
165  << i << "\t" << t.trackId() << "\t" << t << " Crossed Boundary: " << t.crossedBoundary()
166  << " Position Boundary: " << t.getPositionAtBoundary() << " Momentum Boundary: " << t.getMomentumAtBoundary()
167  << " Vtx: " << t.vertIndex() << " Momemtum Origin: " << t.momentum();
168  trackid_to_track_index[t.trackId()] = i;
169  }
170 
171  LogVerbatim("CaloParticleDebuggerGenParticles") << "\n\n**Printing GenParticles information **";
172  LogVerbatim("CaloParticleDebuggerGenParticles") << "BARCODE\tPDGID\tMOMENTUM(x,y,z)\tVertex(x,y,z)";
173  for (size_t i = 0; i < genParticles.size(); ++i) {
174  auto const& gp = genParticles[i];
175  LogVerbatim("CaloParticleDebuggerGenParticles")
176  << genBarcodes[i] << "\t" << gp.pdgId() << "\t" << gp.momentum() << "\t" << gp.vertex();
177  }
178 
179  LogVerbatim("CaloParticleDebuggerSimVertices") << "\n\n**Printing SimVertex information **";
180  LogVerbatim("CaloParticleDebuggerSimVertices") << "IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID";
181  for (size_t i = 0; i < vertices.size(); ++i) {
182  auto const& v = vertices[i];
183  LogVerbatim("CaloParticleDebuggerSimVertices") << i << "\t" << v;
184  }
185 
186  LogVerbatim("CaloParticleDebuggerTrackingParticles") << "\n\n**Printing TrackingParticles information **";
187  for (size_t i = 0; i < trackingpart.size(); ++i) {
188  auto const& tp = trackingpart[i];
189  LogVerbatim("CaloParticleDebuggerTrackingParticles") << i << "\t" << tp;
190  }
191 
192  LogVerbatim("CaloParticleDebuggerCaloParticles") << "\n\n**Printing CaloParticles information **";
193  for (size_t i = 0; i < calopart.size(); ++i) {
194  auto const& cp = calopart[i];
195  LogVerbatim("CaloParticleDebuggerCaloParticles") << "\n\n"
196  << i << "\tType: " << cp.pdgId() << "\tEnergy: " << cp.energy()
197  << "\tBarcode: " << cp.g4Tracks()[0].genpartIndex()
198  << " G4_trackID: " << cp.g4Tracks()[0].trackId(); // << cp ;
199  double total_sim_energy = 0.;
200  double total_cp_energy = 0.;
201  LogVerbatim("CaloParticleDebuggerCaloParticles") << "--> Overall simclusters in CP: " << cp.simClusters().size();
202  // All the next mess just to print the simClusters ordered
203  auto const& simcs = cp.simClusters();
204  for (size_t j = 0; j < simcs.size(); ++j) {
205  LogVerbatim("CaloParticleDebuggerCaloParticles") << *(simcs[j]);
206  }
207 
208  for (auto const& sc : cp.simClusters()) {
209  for (auto const& cl : sc->hits_and_fractions()) {
210  total_sim_energy += detIdToTotalSimEnergy[cl.first] * cl.second;
211  total_cp_energy += cp.energy() * cl.second;
212  }
213  }
214  LogVerbatim("CaloParticleDebuggerCaloParticles")
215  << "--> Overall SC energy (sum using sim energies): " << total_sim_energy;
216  LogVerbatim("CaloParticleDebuggerCaloParticles")
217  << "--> Overall SC energy (sum using CaloP energies): " << total_cp_energy;
218  }
219 
220  LogVerbatim("CaloParticleDebuggerSimClusters") << "\n\n**Printing SimClusters information **";
221  for (size_t i = 0; i < simclusters.size(); ++i) {
222  auto const& simcl = simclusters[i];
223  LogVerbatim("CaloParticleDebuggerSimClusters")
224  << "\n\n"
225  << i << "\tType: " << simcl.pdgId() << "\tEnergy: " << simcl.energy() << "\tKey: " << i; // << simcl ;
226  auto const& simtrack = simcl.g4Tracks()[0];
227  LogVerbatim("CaloParticleDebuggerSimClusters") << " Crossed Boundary: " << simtrack.crossedBoundary()
228  << " Position Boundary: " << simtrack.getPositionAtBoundary()
229  << " Momentum Boundary: " << simtrack.getMomentumAtBoundary();
230  double total_sim_energy = 0.;
231  LogVerbatim("CaloParticleDebuggerSimClusters") << "--> Overall simclusters's size: " << simcl.numberOfRecHits();
232  for (auto const& cl : simcl.hits_and_fractions()) {
233  total_sim_energy += detIdToTotalSimEnergy[cl.first] * cl.second;
234  }
235  LogVerbatim("CaloParticleDebuggerSimClusters") << simcl;
236  LogVerbatim("CaloParticleDebuggerSimClusters")
237  << "--> Overall SimCluster energy (sum using sim energies): " << total_sim_energy;
238  }
239 }
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticlesToken_
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< std::vector< int > > genBarcodesToken_
edm::EDGetTokenT< std::vector< SimCluster > > simClustersToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< std::vector< SimTrack > > simTracksToken_
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticlesToken_
void fillSimHits(std::map< int, float > &, const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticlesToken_
HLT enums.
edm::EDGetTokenT< std::vector< SimVertex > > simVerticesToken_

◆ beginJob()

void CaloParticleDebugger::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 242 of file CaloParticleDebugger.cc.

242 {}

◆ endJob()

void CaloParticleDebugger::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 245 of file CaloParticleDebugger.cc.

245 {}

◆ fillDescriptions()

void CaloParticleDebugger::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 326 of file CaloParticleDebugger.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

326  {
328  desc.add<edm::InputTag>("simTracks", edm::InputTag("g4SimHits"));
329  desc.add<edm::InputTag>("genParticles", edm::InputTag("genParticles"));
330  desc.add<edm::InputTag>("genBarcodes", edm::InputTag("genParticles"));
331  desc.add<edm::InputTag>("simVertices", edm::InputTag("g4SimHits"));
332  desc.add<edm::InputTag>("trackingParticles", edm::InputTag("mix", "MergedTrackTruth"));
333  desc.add<edm::InputTag>("caloParticles", edm::InputTag("mix", "MergedCaloTruth"));
334  desc.add<edm::InputTag>("simClusters", edm::InputTag("mix", "MergedCaloTruth"));
335  desc.add<std::vector<edm::InputTag>>("collectionTags",
336  {edm::InputTag("g4SimHits", "HGCHitsEE"),
337  edm::InputTag("g4SimHits", "HGCHitsHEfront"),
338  edm::InputTag("g4SimHits", "HcalHits")});
339  descriptions.add("caloParticleDebugger", desc);
340 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillSimHits()

void CaloParticleDebugger::fillSimHits ( std::map< int, float > &  detIdToTotalSimEnergy,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 247 of file CaloParticleDebugger.cc.

References cms::cuda::assert(), collectionTags_, collectionTagsToken_, HGCalTopology::dddConstants(), HcalTopology::dddConstants(), EcalMappingRecord_cfi::eegeom, DetId::Forward, ForwardEmpty, relativeConstraints::geom, geometryType_, geomToken_, edm::EventSetup::getHandle(), DetId::Hcal, HcalEndcap, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, HGCEE, HGCHEF, mps_fire::i, l1ctLayer2EG_cff::id, iEvent, nano_mu_digi_cff::layer, HcalHitRelabeller::relabel(), fileinputsource_cfi::sec, rpcPointValidation_cfi::simHit, HGCalDDDConstants::simToReco(), HcalDetId::subdet(), unpackBuffers-CaloStage2::token, HcalGeometry::topology(), and HGCalTestNumbering::unpackHexagonIndex().

Referenced by analyze().

249  {
250  // Taken needed quantities from the EventSetup
251  const auto& geom = iSetup.getHandle(geomToken_);
252  const HGCalGeometry *eegeom = nullptr, *fhgeom = nullptr, *bhgeomnew = nullptr;
253  const HcalGeometry* bhgeom = nullptr;
254  const HGCalDDDConstants* hgddd[3];
255  const HGCalTopology* hgtopo[3];
256  const HcalDDDRecConstants* hcddd = nullptr;
257  eegeom =
258  static_cast<const HGCalGeometry*>(geom->getSubdetectorGeometry(DetId::HGCalEE, ForwardSubdetector::ForwardEmpty));
259  //check if it's the new geometry
260  if (eegeom) {
261  geometryType_ = 1;
262  fhgeom = static_cast<const HGCalGeometry*>(
263  geom->getSubdetectorGeometry(DetId::HGCalHSi, ForwardSubdetector::ForwardEmpty));
264  bhgeomnew = static_cast<const HGCalGeometry*>(
265  geom->getSubdetectorGeometry(DetId::HGCalHSc, ForwardSubdetector::ForwardEmpty));
266  } else {
267  geometryType_ = 0;
268  eegeom = static_cast<const HGCalGeometry*>(geom->getSubdetectorGeometry(DetId::Forward, HGCEE));
269  fhgeom = static_cast<const HGCalGeometry*>(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF));
270  bhgeom = static_cast<const HcalGeometry*>(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap));
271  }
272  hgtopo[0] = &(eegeom->topology());
273  hgtopo[1] = &(fhgeom->topology());
274  if (bhgeomnew)
275  hgtopo[2] = &(bhgeomnew->topology());
276  else
277  hgtopo[2] = nullptr;
278 
279  for (unsigned i = 0; i < 3; ++i) {
280  if (hgtopo[i])
281  hgddd[i] = &(hgtopo[i]->dddConstants());
282  }
283 
284  if (bhgeom)
285  hcddd = bhgeom->topology().dddConstants();
286 
287  // loop over the collections
288  int token = 0;
289  for (auto const& collectionTag : collectionTags_) {
291  const bool isHcal = (collectionTag.instance().find("HcalHits") != std::string::npos);
292  iEvent.getByToken(collectionTagsToken_[token++], hSimHits);
293  for (auto const& simHit : *hSimHits) {
294  DetId id(0);
295  const uint32_t simId = simHit.id();
296  if (geometryType_ == 1) {
297  //no test numbering in new geometry
298  id = simId;
299  } else if (isHcal) {
300  assert(hcddd);
301  HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd);
302  if (hid.subdet() == HcalEndcap)
303  id = hid;
304  } else {
305  int subdet, layer, cell, sec, subsec, zp;
306  HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell);
307  const HGCalDDDConstants* ddd = hgddd[subdet - 3];
308  std::pair<int, int> recoLayerCell = ddd->simToReco(cell, layer, sec, hgtopo[subdet - 3]->detectorType());
309  cell = recoLayerCell.first;
310  layer = recoLayerCell.second;
311  // skip simhits with bad barcodes or non-existant layers
312  if (layer == -1 || simHit.geantTrackId() == 0)
313  continue;
314  id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell);
315  }
316 
317  if (DetId(0) == id)
318  continue;
319 
320  detIdToTotalSimEnergy[id.rawId()] += simHit.energy();
321  }
322  } // end of loop over InputTags
323 }
ForwardSubdetector
assert(be >=bs)
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
int iEvent
Definition: GenABIO.cc:224
std::vector< edm::EDGetTokenT< std::vector< PCaloHit > > > collectionTagsToken_
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
DetId relabel(const uint32_t testId) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
Definition: DetId.h:17
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
std::vector< edm::InputTag > collectionTags_
const HcalTopology & topology() const
Definition: HcalGeometry.h:111

Member Data Documentation

◆ caloParticles_

edm::InputTag CaloParticleDebugger::caloParticles_
private

Definition at line 64 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger().

◆ caloParticlesToken_

edm::EDGetTokenT<std::vector<CaloParticle> > CaloParticleDebugger::caloParticlesToken_
private

Definition at line 72 of file CaloParticleDebugger.cc.

Referenced by analyze(), and CaloParticleDebugger().

◆ collectionTags_

std::vector<edm::InputTag> CaloParticleDebugger::collectionTags_
private

Definition at line 66 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger(), and fillSimHits().

◆ collectionTagsToken_

std::vector<edm::EDGetTokenT<std::vector<PCaloHit> > > CaloParticleDebugger::collectionTagsToken_
private

Definition at line 74 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger(), and fillSimHits().

◆ genBarcodes_

edm::InputTag CaloParticleDebugger::genBarcodes_
private

Definition at line 61 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger().

◆ genBarcodesToken_

edm::EDGetTokenT<std::vector<int> > CaloParticleDebugger::genBarcodesToken_
private

Definition at line 69 of file CaloParticleDebugger.cc.

Referenced by analyze(), and CaloParticleDebugger().

◆ genParticles_

edm::InputTag CaloParticleDebugger::genParticles_
private

Definition at line 60 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger().

◆ genParticlesToken_

edm::EDGetTokenT<std::vector<reco::GenParticle> > CaloParticleDebugger::genParticlesToken_
private

Definition at line 68 of file CaloParticleDebugger.cc.

Referenced by analyze(), and CaloParticleDebugger().

◆ geometryType_

int CaloParticleDebugger::geometryType_ = 0
private

Definition at line 76 of file CaloParticleDebugger.cc.

Referenced by fillSimHits().

◆ geomToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> CaloParticleDebugger::geomToken_
private

Definition at line 75 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger(), and fillSimHits().

◆ simClusters_

edm::InputTag CaloParticleDebugger::simClusters_
private

Definition at line 65 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger().

◆ simClustersToken_

edm::EDGetTokenT<std::vector<SimCluster> > CaloParticleDebugger::simClustersToken_
private

Definition at line 73 of file CaloParticleDebugger.cc.

Referenced by analyze(), and CaloParticleDebugger().

◆ simTracks_

edm::InputTag CaloParticleDebugger::simTracks_
private

Definition at line 59 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger().

◆ simTracksToken_

edm::EDGetTokenT<std::vector<SimTrack> > CaloParticleDebugger::simTracksToken_
private

Definition at line 67 of file CaloParticleDebugger.cc.

Referenced by analyze(), and CaloParticleDebugger().

◆ simVertices_

edm::InputTag CaloParticleDebugger::simVertices_
private

Definition at line 62 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger().

◆ simVerticesToken_

edm::EDGetTokenT<std::vector<SimVertex> > CaloParticleDebugger::simVerticesToken_
private

Definition at line 70 of file CaloParticleDebugger.cc.

Referenced by analyze(), and CaloParticleDebugger().

◆ trackingParticles_

edm::InputTag CaloParticleDebugger::trackingParticles_
private

Definition at line 63 of file CaloParticleDebugger.cc.

Referenced by CaloParticleDebugger().

◆ trackingParticlesToken_

edm::EDGetTokenT<std::vector<TrackingParticle> > CaloParticleDebugger::trackingParticlesToken_
private

Definition at line 71 of file CaloParticleDebugger.cc.

Referenced by analyze(), and CaloParticleDebugger().