CMS 3D CMS Logo

CaloTruthAccumulator.cc
Go to the documentation of this file.
1 #define DEBUG false
2 
3 #if DEBUG
4 #pragma GCC diagnostic pop
5 #endif
6 
7 #include <iterator>
8 #include <memory>
9 
10 #include <numeric> // for std::accumulate
11 #include <unordered_map>
12 
21 
28 
37 
43 
49 
50 namespace {
51  using Index_t = unsigned;
52  using Barcode_t = int;
53  const std::string messageCategoryGraph_("CaloTruthAccumulatorGraphProducer");
54 } // namespace
55 
57 public:
59 
60 private:
61  void initializeEvent(const edm::Event &event, const edm::EventSetup &setup) override;
62  void accumulate(const edm::Event &event, const edm::EventSetup &setup) override;
63  void accumulate(const PileUpEventPrincipal &event, const edm::EventSetup &setup, edm::StreamID const &) override;
64  void finalizeEvent(edm::Event &event, const edm::EventSetup &setup) override;
65 
67  template <class T>
68  void accumulateEvent(const T &event,
69  const edm::EventSetup &setup,
70  const edm::Handle<edm::HepMCProduct> &hepMCproduct);
71 
74  template <class T>
75  void fillSimHits(std::vector<std::pair<DetId, const PCaloHit *>> &returnValue,
76  std::unordered_map<int, std::map<int, float>> &simTrackDetIdEnergyMap,
77  const T &event,
78  const edm::EventSetup &setup);
79 
81 
82  std::unordered_map<Index_t, float> m_detIdToTotalSimEnergy; // keep track of cell normalizations
83  std::unordered_multimap<Barcode_t, Index_t> m_simHitBarcodeToIndex;
84 
90  const unsigned int maximumPreviousBunchCrossing_;
96  const unsigned int maximumSubsequentBunchCrossing_;
97 
102 
103  std::vector<edm::InputTag> collectionTags_;
109 
111  const bool premixStage1_;
112 
113 public:
115  std::unique_ptr<SimClusterCollection> pSimClusters;
116  std::unique_ptr<CaloParticleCollection> pCaloParticles;
117  };
118 
119  struct calo_particles {
120  std::vector<uint32_t> sc_start_;
121  std::vector<uint32_t> sc_stop_;
122 
123  void swap(calo_particles &oth) {
124  sc_start_.swap(oth.sc_start_);
125  sc_stop_.swap(oth.sc_stop_);
126  }
127 
128  void clear() {
129  sc_start_.clear();
130  sc_stop_.clear();
131  }
132  };
133 
134 private:
135  const HGCalTopology *hgtopo_[3] = {nullptr, nullptr, nullptr};
136  const HGCalDDDConstants *hgddd_[3] = {nullptr, nullptr, nullptr};
137  const HcalDDDRecConstants *hcddd_ = nullptr;
140  // geometry type (0 pre-TDR; 1 TDR)
142  bool doHGCAL;
143 };
144 
145 /* Graph utility functions */
146 
147 namespace {
148  class CaloParticle_dfs_visitor : public boost::default_dfs_visitor {
149  public:
150  CaloParticle_dfs_visitor(CaloTruthAccumulator::OutputCollections &output,
152  std::unordered_multimap<Barcode_t, Index_t> &simHitBarcodeToIndex,
153  std::unordered_map<int, std::map<int, float>> &simTrackDetIdEnergyMap,
155  : output_(output),
156  caloParticles_(caloParticles),
157  simHitBarcodeToIndex_(simHitBarcodeToIndex),
158  simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap),
159  selector_(selector) {}
160  template <typename Vertex, typename Graph>
161  void discover_vertex(Vertex u, const Graph &g) {
162  // If we reach the vertex 0, it means that we are backtracking with respect
163  // to the first generation of stable particles: simply return;
164  // if (u == 0) return;
165  print_vertex(u, g);
166  auto const vertex_property = get(vertex_name, g, u);
167  if (!vertex_property.simTrack)
168  return;
169  auto trackIdx = vertex_property.simTrack->trackId();
170  IfLogDebug(DEBUG, messageCategoryGraph_)
171  << " Found " << simHitBarcodeToIndex_.count(trackIdx) << " associated simHits" << std::endl;
172  if (simHitBarcodeToIndex_.count(trackIdx)) {
173  output_.pSimClusters->emplace_back(*vertex_property.simTrack);
174  auto &simcluster = output_.pSimClusters->back();
175  std::unordered_map<uint32_t, float> acc_energy;
176  for (auto const &hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) {
177  acc_energy[hit_and_energy.first] += hit_and_energy.second;
178  }
179  for (auto const &hit_and_energy : acc_energy) {
180  simcluster.addRecHitAndFraction(hit_and_energy.first, hit_and_energy.second);
181  }
182  }
183  }
184  template <typename Edge, typename Graph>
185  void examine_edge(Edge e, const Graph &g) {
186  auto src = source(e, g);
187  auto vertex_property = get(vertex_name, g, src);
188  if (src == 0 or (vertex_property.simTrack == nullptr)) {
189  auto edge_property = get(edge_weight, g, e);
190  IfLogDebug(DEBUG, messageCategoryGraph_) << "Considering CaloParticle: " << edge_property.simTrack->trackId();
191  if (selector_(edge_property)) {
192  IfLogDebug(DEBUG, messageCategoryGraph_) << "Adding CaloParticle: " << edge_property.simTrack->trackId();
193  output_.pCaloParticles->emplace_back(*(edge_property.simTrack));
194  caloParticles_.sc_start_.push_back(output_.pSimClusters->size());
195  }
196  }
197  }
198 
199  template <typename Edge, typename Graph>
200  void finish_edge(Edge e, const Graph &g) {
201  auto src = source(e, g);
202  auto vertex_property = get(vertex_name, g, src);
203  if (src == 0 or (vertex_property.simTrack == nullptr)) {
204  auto edge_property = get(edge_weight, g, e);
205  if (selector_(edge_property)) {
206  caloParticles_.sc_stop_.push_back(output_.pSimClusters->size());
207  }
208  }
209  }
210 
211  private:
213  CaloTruthAccumulator::calo_particles &caloParticles_;
214  std::unordered_multimap<Barcode_t, Index_t> &simHitBarcodeToIndex_;
215  std::unordered_map<int, std::map<int, float>> &simTrackDetIdEnergyMap_;
216  Selector selector_;
217  };
218 } // namespace
219 
221  edm::ProducesCollector producesCollector,
223  : messageCategory_("CaloTruthAccumulator"),
224  maximumPreviousBunchCrossing_(config.getParameter<unsigned int>("maximumPreviousBunchCrossing")),
225  maximumSubsequentBunchCrossing_(config.getParameter<unsigned int>("maximumSubsequentBunchCrossing")),
226  simTrackLabel_(config.getParameter<edm::InputTag>("simTrackCollection")),
227  simVertexLabel_(config.getParameter<edm::InputTag>("simVertexCollection")),
228  collectionTags_(),
229  genParticleLabel_(config.getParameter<edm::InputTag>("genParticleCollection")),
230  hepMCproductLabel_(config.getParameter<edm::InputTag>("HepMCProductLabel")),
231  geomToken_(iC.esConsumes()),
232  minEnergy_(config.getParameter<double>("MinEnergy")),
233  maxPseudoRapidity_(config.getParameter<double>("MaxPseudoRapidity")),
234  premixStage1_(config.getParameter<bool>("premixStage1")),
235  geometryType_(-1),
236  doHGCAL(config.getParameter<bool>("doHGCAL")) {
237  producesCollector.produces<SimClusterCollection>("MergedCaloTruth");
238  producesCollector.produces<CaloParticleCollection>("MergedCaloTruth");
239  if (premixStage1_) {
240  producesCollector.produces<std::vector<std::pair<unsigned int, float>>>("MergedCaloTruth");
241  }
242 
243  iC.consumes<std::vector<SimTrack>>(simTrackLabel_);
244  iC.consumes<std::vector<SimVertex>>(simVertexLabel_);
245  iC.consumes<std::vector<reco::GenParticle>>(genParticleLabel_);
246  iC.consumes<std::vector<int>>(genParticleLabel_);
247  iC.consumes<std::vector<int>>(hepMCproductLabel_);
248 
249  // Fill the collection tags
250  const edm::ParameterSet &simHitCollectionConfig = config.getParameterSet("simHitCollections");
251  std::vector<std::string> parameterNames = simHitCollectionConfig.getParameterNames();
252 
253  for (auto const &parameterName : parameterNames) {
254  std::vector<edm::InputTag> tags = simHitCollectionConfig.getParameter<std::vector<edm::InputTag>>(parameterName);
255  collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end());
256  }
257 
258  for (auto const &collectionTag : collectionTags_) {
259  iC.consumes<std::vector<PCaloHit>>(collectionTag);
260  }
261 }
262 
264  output_.pSimClusters = std::make_unique<SimClusterCollection>();
265  output_.pCaloParticles = std::make_unique<CaloParticleCollection>();
266 
267  m_detIdToTotalSimEnergy.clear();
268 
269  if (geomWatcher_.check(setup)) {
270  auto const &geom = setup.getData(geomToken_);
271  const HGCalGeometry *eegeom = nullptr, *fhgeom = nullptr, *bhgeomnew = nullptr;
272  const HcalGeometry *bhgeom = nullptr;
273  bhgeom = static_cast<const HcalGeometry *>(geom.getSubdetectorGeometry(DetId::Hcal, HcalEndcap));
274 
275  if (doHGCAL) {
276  eegeom = static_cast<const HGCalGeometry *>(
277  geom.getSubdetectorGeometry(DetId::HGCalEE, ForwardSubdetector::ForwardEmpty));
278  // check if it's the new geometry
279  if (eegeom) {
280  geometryType_ = 1;
281  fhgeom = static_cast<const HGCalGeometry *>(
282  geom.getSubdetectorGeometry(DetId::HGCalHSi, ForwardSubdetector::ForwardEmpty));
283  bhgeomnew = static_cast<const HGCalGeometry *>(
284  geom.getSubdetectorGeometry(DetId::HGCalHSc, ForwardSubdetector::ForwardEmpty));
285  } else {
286  geometryType_ = 0;
287  eegeom = static_cast<const HGCalGeometry *>(geom.getSubdetectorGeometry(DetId::Forward, HGCEE));
288  fhgeom = static_cast<const HGCalGeometry *>(geom.getSubdetectorGeometry(DetId::Forward, HGCHEF));
289  bhgeom = static_cast<const HcalGeometry *>(geom.getSubdetectorGeometry(DetId::Hcal, HcalEndcap));
290  }
291  hgtopo_[0] = &(eegeom->topology());
292  hgtopo_[1] = &(fhgeom->topology());
293  if (bhgeomnew)
294  hgtopo_[2] = &(bhgeomnew->topology());
295 
296  for (unsigned i = 0; i < 3; ++i) {
297  if (hgtopo_[i])
298  hgddd_[i] = &(hgtopo_[i]->dddConstants());
299  }
300  }
301 
302  if (bhgeom) {
303  hcddd_ = bhgeom->topology().dddConstants();
304  }
305  }
306 }
307 
317  event.getByLabel(hepMCproductLabel_, hepmc);
318 
319  edm::LogInfo(messageCategory_) << " CaloTruthAccumulator::accumulate (signal)";
320  accumulateEvent(event, setup, hepmc);
321 }
322 
324  edm::EventSetup const &setup,
325  edm::StreamID const &) {
326  if (event.bunchCrossing() >= -static_cast<int>(maximumPreviousBunchCrossing_) &&
327  event.bunchCrossing() <= static_cast<int>(maximumSubsequentBunchCrossing_)) {
328  // simply create empty handle as we do not have a HepMCProduct in PU anyway
330  edm::LogInfo(messageCategory_) << " CaloTruthAccumulator::accumulate (pileup) bunchCrossing="
331  << event.bunchCrossing();
332  accumulateEvent(event, setup, hepmc);
333  } else {
334  edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing();
335  }
336 }
337 
339  edm::LogInfo(messageCategory_) << "Adding " << output_.pSimClusters->size() << " SimParticles and "
340  << output_.pCaloParticles->size() << " CaloParticles to the event.";
341 
342  // We need to normalize the hits and energies into hits and fractions (since
343  // we have looped over all pileup events)
344  // For premixing stage1 we keep the energies, they will be normalized to
345  // fractions in stage2
346 
347  if (premixStage1_) {
348  auto totalEnergies = std::make_unique<std::vector<std::pair<unsigned int, float>>>();
349  totalEnergies->reserve(m_detIdToTotalSimEnergy.size());
350  std::copy(m_detIdToTotalSimEnergy.begin(), m_detIdToTotalSimEnergy.end(), std::back_inserter(*totalEnergies));
351  std::sort(totalEnergies->begin(), totalEnergies->end());
352  event.put(std::move(totalEnergies), "MergedCaloTruth");
353  } else {
354  for (auto &sc : *(output_.pSimClusters)) {
355  auto hitsAndEnergies = sc.hits_and_fractions();
356  sc.clearHitsAndFractions();
357  sc.clearHitsEnergy();
358  for (auto &hAndE : hitsAndEnergies) {
359  const float totalenergy = m_detIdToTotalSimEnergy[hAndE.first];
360  float fraction = 0.;
361  if (totalenergy > 0)
362  fraction = hAndE.second / totalenergy;
363  else
365  << "TotalSimEnergy for hit " << hAndE.first << " is 0! The fraction for this hit cannot be computed.";
366  sc.addRecHitAndFraction(hAndE.first, fraction);
367  sc.addHitEnergy(hAndE.second);
368  }
369  }
370  }
371 
372  // save the SimCluster orphan handle so we can fill the calo particles
373  auto scHandle = event.put(std::move(output_.pSimClusters), "MergedCaloTruth");
374 
375  // now fill the calo particles
376  for (unsigned i = 0; i < output_.pCaloParticles->size(); ++i) {
377  auto &cp = (*output_.pCaloParticles)[i];
378  for (unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j) {
379  edm::Ref<SimClusterCollection> ref(scHandle, j);
380  cp.addSimCluster(ref);
381  }
382  }
383 
384  event.put(std::move(output_.pCaloParticles), "MergedCaloTruth");
385 
387 
388  std::unordered_map<Index_t, float>().swap(m_detIdToTotalSimEnergy);
389  std::unordered_multimap<Barcode_t, Index_t>().swap(m_simHitBarcodeToIndex);
390 }
391 
392 template <class T>
394  const edm::EventSetup &setup,
395  const edm::Handle<edm::HepMCProduct> &hepMCproduct) {
397  edm::Handle<std::vector<int>> hGenParticleIndices;
398 
399  event.getByLabel(simTrackLabel_, hSimTracks);
400  event.getByLabel(simVertexLabel_, hSimVertices);
401 
402  event.getByLabel(genParticleLabel_, hGenParticles);
403  event.getByLabel(genParticleLabel_, hGenParticleIndices);
404 
405  std::vector<std::pair<DetId, const PCaloHit *>> simHitPointers;
406  std::unordered_map<int, std::map<int, float>> simTrackDetIdEnergyMap;
407  fillSimHits(simHitPointers, simTrackDetIdEnergyMap, event, setup);
408 
409  // Clear maps from previous event fill them for this one
410  m_simHitBarcodeToIndex.clear();
411  for (unsigned int i = 0; i < simHitPointers.size(); ++i) {
412  m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(), i);
413  }
414 
415  auto const &tracks = *hSimTracks;
416  auto const &vertices = *hSimVertices;
417  std::unordered_map<int, int> trackid_to_track_index;
419  int idx = 0;
420 
421  IfLogDebug(DEBUG, messageCategory_) << " TRACKS" << std::endl;
422  for (auto const &t : tracks) {
423  IfLogDebug(DEBUG, messageCategory_) << " " << idx << "\t" << t.trackId() << "\t" << t << std::endl;
424  trackid_to_track_index[t.trackId()] = idx;
425  idx++;
426  }
427 
454  idx = 0;
455  std::vector<int> used_sim_tracks(tracks.size(), 0);
456  std::vector<int> collapsed_vertices(vertices.size(), 0);
457  IfLogDebug(DEBUG, messageCategory_) << " VERTICES" << std::endl;
458  for (auto const &v : vertices) {
459  IfLogDebug(DEBUG, messageCategory_) << " " << idx++ << "\t" << v << std::endl;
460  if (v.parentIndex() != -1) {
461  auto trk_idx = trackid_to_track_index[v.parentIndex()];
462  auto origin_vtx = tracks[trk_idx].vertIndex();
463  if (used_sim_tracks[trk_idx]) {
464  // collapse the vertex into the original first vertex we saw associated
465  // to this track. Omit adding the edge in order to avoid double
466  // counting of the very same particles and its associated hits.
467  collapsed_vertices[v.vertexId()] = used_sim_tracks[trk_idx];
468  continue;
469  }
470  // Perform the actual vertex collapsing, if needed.
471  if (collapsed_vertices[origin_vtx])
472  origin_vtx = collapsed_vertices[origin_vtx];
473  add_edge(origin_vtx,
474  v.vertexId(),
475  EdgeProperty(&tracks[trk_idx], simTrackDetIdEnergyMap[v.parentIndex()].size(), 0),
476  decay);
477  used_sim_tracks[trk_idx] = v.vertexId();
478  }
479  }
480  // Build the motherParticle property to each vertex
481  auto const &vertexMothersProp = get(vertex_name, decay);
482  // Now recover the particles that did not decay. Append them with an index
483  // bigger than the size of the generated vertices.
484  int offset = vertices.size();
485  for (size_t i = 0; i < tracks.size(); ++i) {
486  if (!used_sim_tracks[i]) {
487  auto origin_vtx = tracks[i].vertIndex();
488  // Perform the actual vertex collapsing, if needed.
489  if (collapsed_vertices[origin_vtx])
490  origin_vtx = collapsed_vertices[origin_vtx];
491  add_edge(
492  origin_vtx, offset, EdgeProperty(&tracks[i], simTrackDetIdEnergyMap[tracks[i].trackId()].size(), 0), decay);
493  // The properties for "fake" vertices associated to stable particles have
494  // to be set inside this loop, since they do not belong to the vertices
495  // collection and would be skipped by that loop (coming next)
496  put(vertexMothersProp, offset, VertexProperty(&tracks[i], 0));
497  offset++;
498  }
499  }
500  for (auto const &v : vertices) {
501  if (v.parentIndex() != -1) {
502  // Skip collapsed_vertices
503  if (collapsed_vertices[v.vertexId()])
504  continue;
505  put(vertexMothersProp, v.vertexId(), VertexProperty(&tracks[trackid_to_track_index[v.parentIndex()]], 0));
506  }
507  }
508  SimHitsAccumulator_dfs_visitor vis;
509  depth_first_search(decay, visitor(vis));
510  CaloParticle_dfs_visitor caloParticleCreator(
511  output_,
514  simTrackDetIdEnergyMap,
515  [&](EdgeProperty &edge_property) -> bool {
516  // Apply selection on SimTracks in order to promote them to be
517  // CaloParticles. The function returns TRUE if the particle satisfies
518  // the selection, FALSE otherwise. Therefore the correct logic to select
519  // the particle is to ask for TRUE as return value.
520  return (edge_property.cumulative_simHits != 0 and !edge_property.simTrack->noGenpart() and
521  edge_property.simTrack->momentum().E() > minEnergy_ and
522  std::abs(edge_property.simTrack->momentum().Eta()) < maxPseudoRapidity_);
523  });
524  depth_first_search(decay, visitor(caloParticleCreator));
525 
526 #if DEBUG
527  boost::write_graphviz(std::cout,
528  decay,
529  make_label_writer(make_transform_value_property_map(&graphviz_vertex, get(vertex_name, decay))),
530  make_label_writer(make_transform_value_property_map(&graphviz_edge, get(edge_weight, decay))));
531 #endif
532 }
533 
534 template <class T>
535 void CaloTruthAccumulator::fillSimHits(std::vector<std::pair<DetId, const PCaloHit *>> &returnValue,
536  std::unordered_map<int, std::map<int, float>> &simTrackDetIdEnergyMap,
537  const T &event,
538  const edm::EventSetup &setup) {
539  for (auto const &collectionTag : collectionTags_) {
541  const bool isHcal = (collectionTag.instance().find("HcalHits") != std::string::npos);
542  event.getByLabel(collectionTag, hSimHits);
543 
544  for (auto const &simHit : *hSimHits) {
545  DetId id(0);
546 
547  //Relabel as necessary for HGCAL
548  if (doHGCAL) {
549  const uint32_t simId = simHit.id();
550  if (geometryType_ == 1) {
551  // no test numbering in new geometry
552  id = simId;
553  } else if (isHcal) {
555  if (hid.subdet() == HcalEndcap)
556  id = hid;
557  } else {
558  int subdet, layer, cell, sec, subsec, zp;
559  HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell);
560  const HGCalDDDConstants *ddd = hgddd_[subdet - 3];
561  std::pair<int, int> recoLayerCell = ddd->simToReco(cell, layer, sec, hgtopo_[subdet - 3]->detectorType());
562  cell = recoLayerCell.first;
563  layer = recoLayerCell.second;
564  // skip simhits with bad barcodes or non-existant layers
565  if (layer == -1 || simHit.geantTrackId() == 0)
566  continue;
567  id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell);
568  }
569  } else {
570  id = simHit.id();
571  //Relabel all HCAL hits
572  if (isHcal) {
574  id = hid;
575  }
576  }
577 
578  if (id == DetId(0)) {
579  continue;
580  }
581  if (simHit.geantTrackId() == 0) {
582  continue;
583  }
584 
585  returnValue.emplace_back(id, &simHit);
586  simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy();
587  m_detIdToTotalSimEnergy[id.rawId()] += simHit.energy();
588  }
589  } // end of loop over InputTags
590 }
591 
592 // Register with the framework
size
Write out results.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unordered_multimap< Barcode_t, Index_t > m_simHitBarcodeToIndex
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Handle< std::vector< SimVertex > > hSimVertices
void fillSimHits(std::vector< std::pair< DetId, const PCaloHit *>> &returnValue, std::unordered_map< int, std::map< int, float >> &simTrackDetIdEnergyMap, const T &event, const edm::EventSetup &setup)
Fills the supplied vector with pointers to the SimHits, checking for bad modules if required...
void initializeEvent(const edm::Event &event, const edm::EventSetup &setup) override
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const HGCalTopology * hgtopo_[3]
const unsigned int maximumSubsequentBunchCrossing_
std::vector< edm::InputTag > collectionTags_
Definition: config.py:1
ForwardSubdetector
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
void put(edm::Event &evt, double value, const char *instanceName)
edm::ESWatcher< CaloGeometryRecord > geomWatcher_
const SimTrack * simTrack
Definition: DecayGraph.h:61
U second(std::pair< T, U > const &p)
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
edm::InputTag hepMCproductLabel_
Needed to add HepMC::GenVertex to SimVertex.
#define IfLogDebug(cond, cat)
const std::string messageCategory_
adjacency_list< listS, vecS, directedS, VertexMotherParticleProperty, EdgeParticleClustersProperty > DecayChain
Definition: DecayGraph.h:75
void accumulate(const edm::Event &event, const edm::EventSetup &setup) override
int cumulative_simHits
Definition: DecayGraph.h:63
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
CaloTruthAccumulator(const edm::ParameterSet &config, edm::ProducesCollector, edm::ConsumesCollector &iC)
std::unordered_map< Index_t, float > m_detIdToTotalSimEnergy
const edm::InputTag simVertexLabel_
DetId relabel(const uint32_t testId) const
Functor that operates on <T>
Definition: Selector.h:22
const HGCalDDDConstants * hgddd_[3]
const edm::InputTag simTrackLabel_
Log< level::Info, false > LogInfo
edm::Handle< std::vector< SimTrack > > hSimTracks
Definition: DetId.h:17
void accumulateEvent(const T &event, const edm::EventSetup &setup, const edm::Handle< edm::HepMCProduct > &hepMCproduct)
Both forms of accumulate() delegate to this templated method.
std::unique_ptr< CaloParticleCollection > pCaloParticles
bool noGenpart() const
Definition: SimTrack.h:38
const HcalDDDRecConstants * hcddd_
void finalizeEvent(edm::Event &event, const edm::EventSetup &setup) override
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
HLT enums.
#define DEFINE_DIGI_ACCUMULATOR(type)
std::vector< CaloParticle > CaloParticleCollection
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161
std::unique_ptr< SimClusterCollection > pSimClusters
Definition: output.py:1
Log< level::Warning, false > LogWarning
std::vector< SimCluster > SimClusterCollection
long double T
static std::string const source
Definition: EdmProvDump.cc:49
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)
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
const unsigned int maximumPreviousBunchCrossing_
#define DEBUG
const HcalTopology & topology() const
Definition: HcalGeometry.h:111