CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
CaloTruthAccumulator Class Reference
Inheritance diagram for CaloTruthAccumulator:
DigiAccumulatorMixMod

Classes

struct  calo_particles
 
struct  OutputCollections
 

Public Member Functions

 CaloTruthAccumulator (const edm::ParameterSet &config, edm::ProducesCollector, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual PileupMixingContentgetEventPileupInfo ()
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual void StorePileupInformation (std::vector< int > &numInteractionList, std::vector< int > &bunchCrossingList, std::vector< float > &TrueInteractionList, std::vector< edm::EventID > &eventList, int bunchSpace)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Member Functions

void accumulate (const edm::Event &event, const edm::EventSetup &setup) override
 
void accumulate (const PileUpEventPrincipal &event, const edm::EventSetup &setup, edm::StreamID const &) override
 
template<class T >
void accumulateEvent (const T &event, const edm::EventSetup &setup, const edm::Handle< edm::HepMCProduct > &hepMCproduct)
 Both forms of accumulate() delegate to this templated method. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
template<class T >
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. More...
 
void finalizeEvent (edm::Event &event, const edm::EventSetup &setup) override
 
void initializeEvent (const edm::Event &event, const edm::EventSetup &setup) override
 

Private Attributes

std::vector< edm::InputTagcollectionTags_
 
bool doHGCAL
 
edm::InputTag genParticleLabel_
 
int geometryType_
 
const HcalDDDRecConstantshcddd_ = nullptr
 
edm::InputTag hepMCproductLabel_
 Needed to add HepMC::GenVertex to SimVertex. More...
 
const HGCalDDDConstantshgddd_ [3] = {nullptr, nullptr, nullptr}
 
const HGCalTopologyhgtopo_ [3] = {nullptr, nullptr, nullptr}
 
edm::Handle< std::vector< SimTrack > > hSimTracks
 
edm::Handle< std::vector< SimVertex > > hSimVertices
 
calo_particles m_caloParticles
 
std::unordered_map< Index_t, float > m_detIdToTotalSimEnergy
 
std::unordered_multimap< Barcode_t, Index_t > m_simHitBarcodeToIndex
 
const unsigned int maximumPreviousBunchCrossing_
 
const unsigned int maximumSubsequentBunchCrossing_
 
const double maxPseudoRapidity_
 
const std::string messageCategory_
 
const double minEnergy_
 
OutputCollections output_
 
const bool premixStage1_
 
const edm::InputTag simTrackLabel_
 
const edm::InputTag simVertexLabel_
 

Detailed Description

Definition at line 124 of file CaloTruthAccumulator.cc.

Constructor & Destructor Documentation

◆ CaloTruthAccumulator()

CaloTruthAccumulator::CaloTruthAccumulator ( const edm::ParameterSet config,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
explicit

Definition at line 358 of file CaloTruthAccumulator.cc.

361  : messageCategory_("CaloTruthAccumulator"),
362  maximumPreviousBunchCrossing_(config.getParameter<unsigned int>("maximumPreviousBunchCrossing")),
363  maximumSubsequentBunchCrossing_(config.getParameter<unsigned int>("maximumSubsequentBunchCrossing")),
364  simTrackLabel_(config.getParameter<edm::InputTag>("simTrackCollection")),
365  simVertexLabel_(config.getParameter<edm::InputTag>("simVertexCollection")),
366  collectionTags_(),
367  genParticleLabel_(config.getParameter<edm::InputTag>("genParticleCollection")),
368  hepMCproductLabel_(config.getParameter<edm::InputTag>("HepMCProductLabel")),
369  minEnergy_(config.getParameter<double>("MinEnergy")),
370  maxPseudoRapidity_(config.getParameter<double>("MaxPseudoRapidity")),
371  premixStage1_(config.getParameter<bool>("premixStage1")),
372  geometryType_(-1),
373  doHGCAL(config.getParameter<bool>("doHGCAL")) {
374  producesCollector.produces<SimClusterCollection>("MergedCaloTruth");
375  producesCollector.produces<CaloParticleCollection>("MergedCaloTruth");
376  if (premixStage1_) {
377  producesCollector.produces<std::vector<std::pair<unsigned int, float>>>("MergedCaloTruth");
378  }
379 
380  iC.consumes<std::vector<SimTrack>>(simTrackLabel_);
381  iC.consumes<std::vector<SimVertex>>(simVertexLabel_);
382  iC.consumes<std::vector<reco::GenParticle>>(genParticleLabel_);
383  iC.consumes<std::vector<int>>(genParticleLabel_);
384  iC.consumes<std::vector<int>>(hepMCproductLabel_);
385 
386  // Fill the collection tags
387  const edm::ParameterSet &simHitCollectionConfig = config.getParameterSet("simHitCollections");
388  std::vector<std::string> parameterNames = simHitCollectionConfig.getParameterNames();
389 
390  for (auto const &parameterName : parameterNames) {
391  std::vector<edm::InputTag> tags = simHitCollectionConfig.getParameter<std::vector<edm::InputTag>>(parameterName);
392  collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end());
393  }
394 
395  for (auto const &collectionTag : collectionTags_) {
396  iC.consumes<std::vector<PCaloHit>>(collectionTag);
397  }
398 }

References collectionTags_, edm::ConsumesCollector::consumes(), genParticleLabel_, hepMCproductLabel_, premixStage1_, edm::ProducesCollector::produces(), simTrackLabel_, simVertexLabel_, and triggerMatcherToHLTDebug_cfi::tags.

Member Function Documentation

◆ accumulate() [1/2]

void CaloTruthAccumulator::accumulate ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Create handle to edm::HepMCProduct here because event.getByLabel with edm::HepMCProduct only works for edm::Event but not for PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call T::value_type and T::iterator (where T is the type of the object one wants to get a handle to) which is only implemented for container-like objects like std::vector but not for edm::HepMCProduct!

Implements DigiAccumulatorMixMod.

Definition at line 453 of file CaloTruthAccumulator.cc.

453  {
455  event.getByLabel(hepMCproductLabel_, hepmc);
456 
457  edm::LogInfo(messageCategory_) << " CaloTruthAccumulator::accumulate (signal)";
458  accumulateEvent(event, setup, hepmc);
459 }

References accumulateEvent(), hepMCproductLabel_, messageCategory_, and singleTopDQM_cfi::setup.

◆ accumulate() [2/2]

void CaloTruthAccumulator::accumulate ( const PileUpEventPrincipal event,
const edm::EventSetup setup,
edm::StreamID const &   
)
overrideprivatevirtual

Implements DigiAccumulatorMixMod.

Definition at line 461 of file CaloTruthAccumulator.cc.

463  {
464  if (event.bunchCrossing() >= -static_cast<int>(maximumPreviousBunchCrossing_) &&
465  event.bunchCrossing() <= static_cast<int>(maximumSubsequentBunchCrossing_)) {
466  // simply create empty handle as we do not have a HepMCProduct in PU anyway
468  edm::LogInfo(messageCategory_) << " CaloTruthAccumulator::accumulate (pileup) bunchCrossing="
469  << event.bunchCrossing();
470  accumulateEvent(event, setup, hepmc);
471  } else {
472  edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing();
473  }
474 }

References accumulateEvent(), maximumPreviousBunchCrossing_, maximumSubsequentBunchCrossing_, messageCategory_, and singleTopDQM_cfi::setup.

◆ accumulateEvent()

template<class T >
void CaloTruthAccumulator::accumulateEvent ( const T event,
const edm::EventSetup setup,
const edm::Handle< edm::HepMCProduct > &  hepMCproduct 
)
private

Both forms of accumulate() delegate to this templated method.

Build the main decay graph and assign the SimTrack to each edge. The graph built here will only contain the particles that have a decay vertex associated to them. In order to recover also the particles that will not decay, we need to keep track of the SimTrack used here and add, a-posteriori, the ones not used, associating a ghost vertex (starting from the highest simulated vertex number), in order to build the edge and identify them immediately as stable (i.e. not decayed).

To take into account the multi-bremsstrahlung effects in which a single particle is emitting photons in different vertices keeping the same track index, we also collapsed those vertices into 1 unique vertex. The other approach of fully representing the decay chain keeping the same track index would have the problem of over-counting the contributions of that track, especially in terms of hits.

The 2 auxiliary vectors are structured as follow:

  1. used_sim_tracks is a vector that has the same size as the overall number of simulated tracks. The associated integer is the vertexId of the decaying vertex for that track.
  2. collapsed_vertices is a vector that has the same size as the overall number of simulated vertices. The vector's index is the vertexId itself, the associated value is the vertexId of the vertex on which this should collapse.

Definition at line 531 of file CaloTruthAccumulator.cc.

533  {
535  edm::Handle<std::vector<int>> hGenParticleIndices;
536 
537  event.getByLabel(simTrackLabel_, hSimTracks);
538  event.getByLabel(simVertexLabel_, hSimVertices);
539 
540  event.getByLabel(genParticleLabel_, hGenParticles);
541  event.getByLabel(genParticleLabel_, hGenParticleIndices);
542 
543  std::vector<std::pair<DetId, const PCaloHit *>> simHitPointers;
544  std::unordered_map<int, std::map<int, float>> simTrackDetIdEnergyMap;
545  fillSimHits(simHitPointers, simTrackDetIdEnergyMap, event, setup);
546 
547  // Clear maps from previous event fill them for this one
548  m_simHitBarcodeToIndex.clear();
549  for (unsigned int i = 0; i < simHitPointers.size(); ++i) {
550  m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(), i);
551  }
552 
553  auto const &tracks = *hSimTracks;
554  auto const &vertices = *hSimVertices;
555  std::unordered_map<int, int> trackid_to_track_index;
557  int idx = 0;
558 
559  IfLogDebug(DEBUG, messageCategory_) << " TRACKS" << std::endl;
560  for (auto const &t : tracks) {
561  IfLogDebug(DEBUG, messageCategory_) << " " << idx << "\t" << t.trackId() << "\t" << t << std::endl;
562  trackid_to_track_index[t.trackId()] = idx;
563  idx++;
564  }
565 
592  idx = 0;
593  std::vector<int> used_sim_tracks(tracks.size(), 0);
594  std::vector<int> collapsed_vertices(vertices.size(), 0);
595  IfLogDebug(DEBUG, messageCategory_) << " VERTICES" << std::endl;
596  for (auto const &v : vertices) {
597  IfLogDebug(DEBUG, messageCategory_) << " " << idx++ << "\t" << v << std::endl;
598  if (v.parentIndex() != -1) {
599  auto trk_idx = trackid_to_track_index[v.parentIndex()];
600  auto origin_vtx = tracks[trk_idx].vertIndex();
601  if (used_sim_tracks[trk_idx]) {
602  // collapse the vertex into the original first vertex we saw associated
603  // to this track. Omit adding the edge in order to avoid double
604  // counting of the very same particles and its associated hits.
605  collapsed_vertices[v.vertexId()] = used_sim_tracks[trk_idx];
606  continue;
607  }
608  // Perform the actual vertex collapsing, if needed.
609  if (collapsed_vertices[origin_vtx])
610  origin_vtx = collapsed_vertices[origin_vtx];
611  add_edge(origin_vtx,
612  v.vertexId(),
613  EdgeProperty(&tracks[trk_idx], simTrackDetIdEnergyMap[v.parentIndex()].size(), 0),
614  decay);
615  used_sim_tracks[trk_idx] = v.vertexId();
616  }
617  }
618  // Build the motherParticle property to each vertex
619  auto const &vertexMothersProp = get(vertex_name, decay);
620  // Now recover the particles that did not decay. Append them with an index
621  // bigger than the size of the generated vertices.
622  int offset = vertices.size();
623  for (size_t i = 0; i < tracks.size(); ++i) {
624  if (!used_sim_tracks[i]) {
625  auto origin_vtx = tracks[i].vertIndex();
626  // Perform the actual vertex collapsing, if needed.
627  if (collapsed_vertices[origin_vtx])
628  origin_vtx = collapsed_vertices[origin_vtx];
629  add_edge(
630  origin_vtx, offset, EdgeProperty(&tracks[i], simTrackDetIdEnergyMap[tracks[i].trackId()].size(), 0), decay);
631  // The properties for "fake" vertices associated to stable particles have
632  // to be set inside this loop, since they do not belong to the vertices
633  // collection and would be skipped by that loop (coming next)
634  put(vertexMothersProp, offset, VertexProperty(&tracks[i], 0));
635  offset++;
636  }
637  }
638  for (auto const &v : vertices) {
639  if (v.parentIndex() != -1) {
640  // Skip collapsed_vertices
641  if (collapsed_vertices[v.vertexId()])
642  continue;
643  put(vertexMothersProp, v.vertexId(), VertexProperty(&tracks[trackid_to_track_index[v.parentIndex()]], 0));
644  }
645  }
646  SimHitsAccumulator_dfs_visitor vis;
647  depth_first_search(decay, visitor(vis));
648  CaloParticle_dfs_visitor caloParticleCreator(
649  output_,
652  simTrackDetIdEnergyMap,
653  [&](EdgeProperty &edge_property) -> bool {
654  // Apply selection on SimTracks in order to promote them to be
655  // CaloParticles. The function returns TRUE if the particle satisfies
656  // the selection, FALSE otherwise. Therefore the correct logic to select
657  // the particle is to ask for TRUE as return value.
658  return (edge_property.cumulative_simHits != 0 and !edge_property.simTrack->noGenpart() and
659  edge_property.simTrack->momentum().E() > minEnergy_ and
660  std::abs(edge_property.simTrack->momentum().Eta()) < maxPseudoRapidity_);
661  });
662  depth_first_search(decay, visitor(caloParticleCreator));
663 
664 #if DEBUG
665  boost::write_graphviz(std::cout,
666  decay,
667  make_label_writer(make_transform_value_property_map(&graphviz_vertex, get(vertex_name, decay))),
668  make_label_writer(make_transform_value_property_map(&graphviz_edge, get(edge_weight, decay))));
669 #endif
670 }

References funct::abs(), gather_cfg::cout, EdgeProperty::cumulative_simHits, DEBUG, PA_ZEESkim_cff::decay, fillSimHits(), genParticleLabel_, get, hSimTracks, hSimVertices, mps_fire::i, charmTagsComputerCvsB_cfi::idx, IfLogDebug, m_caloParticles, m_simHitBarcodeToIndex, maxPseudoRapidity_, messageCategory_, minEnergy_, CoreSimTrack::momentum(), SimTrack::noGenpart(), hltrates_dqm_sourceclient-live_cfg::offset, output_, put(), edm::second(), singleTopDQM_cfi::setup, EdgeProperty::simTrack, simTrackLabel_, simVertexLabel_, findQualityFiles::size, OrderedSet::t, PDWG_EXOHSCP_cff::tracks, findQualityFiles::v, pwdgSkimBPark_cfi::vertices, and runTauDisplay::vis.

Referenced by accumulate().

◆ beginLuminosityBlock()

void CaloTruthAccumulator::beginLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Reimplemented from DigiAccumulatorMixMod.

Definition at line 400 of file CaloTruthAccumulator.cc.

400  {
402  iSetup.get<CaloGeometryRecord>().get(geom);
403  const HGCalGeometry *eegeom = nullptr, *fhgeom = nullptr, *bhgeomnew = nullptr;
404  const HcalGeometry *bhgeom = nullptr;
405  bhgeom = static_cast<const HcalGeometry *>(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap));
406 
407  if (doHGCAL) {
408  eegeom = static_cast<const HGCalGeometry *>(
409  geom->getSubdetectorGeometry(DetId::HGCalEE, ForwardSubdetector::ForwardEmpty));
410  // check if it's the new geometry
411  if (eegeom) {
412  geometryType_ = 1;
413  fhgeom = static_cast<const HGCalGeometry *>(
414  geom->getSubdetectorGeometry(DetId::HGCalHSi, ForwardSubdetector::ForwardEmpty));
415  bhgeomnew = static_cast<const HGCalGeometry *>(
416  geom->getSubdetectorGeometry(DetId::HGCalHSc, ForwardSubdetector::ForwardEmpty));
417  } else {
418  geometryType_ = 0;
419  eegeom = static_cast<const HGCalGeometry *>(geom->getSubdetectorGeometry(DetId::Forward, HGCEE));
420  fhgeom = static_cast<const HGCalGeometry *>(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF));
421  bhgeom = static_cast<const HcalGeometry *>(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap));
422  }
423  hgtopo_[0] = &(eegeom->topology());
424  hgtopo_[1] = &(fhgeom->topology());
425  if (bhgeomnew)
426  hgtopo_[2] = &(bhgeomnew->topology());
427 
428  for (unsigned i = 0; i < 3; ++i) {
429  if (hgtopo_[i])
430  hgddd_[i] = &(hgtopo_[i]->dddConstants());
431  }
432  }
433 
434  if (bhgeom) {
435  hcddd_ = bhgeom->topology().dddConstants();
436  }
437 }

References HGCalTopology::dddConstants(), HcalTopology::dddConstants(), doHGCAL, EcalMappingRecord_cfi::eegeom, DetId::Forward, ForwardEmpty, relativeConstraints::geom, geometryType_, edm::EventSetup::get(), get, DetId::Hcal, HcalEndcap, hcddd_, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, HGCEE, HGCHEF, hgddd_, hgtopo_, mps_fire::i, and HcalGeometry::topology().

◆ fillSimHits()

template<class T >
void CaloTruthAccumulator::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 
)
private

Fills the supplied vector with pointers to the SimHits, checking for bad modules if required.

Definition at line 673 of file CaloTruthAccumulator.cc.

676  {
677  for (auto const &collectionTag : collectionTags_) {
679  const bool isHcal = (collectionTag.instance().find("HcalHits") != std::string::npos);
680  event.getByLabel(collectionTag, hSimHits);
681 
682  for (auto const &simHit : *hSimHits) {
683  DetId id(0);
684 
685  //Relabel as necessary for HGCAL
686  if (doHGCAL) {
687  const uint32_t simId = simHit.id();
688  if (geometryType_ == 1) {
689  // no test numbering in new geometry
690  id = simId;
691  } else if (isHcal) {
693  if (hid.subdet() == HcalEndcap)
694  id = hid;
695  } else {
696  int subdet, layer, cell, sec, subsec, zp;
697  HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell);
698  const HGCalDDDConstants *ddd = hgddd_[subdet - 3];
699  std::pair<int, int> recoLayerCell = ddd->simToReco(cell, layer, sec, hgtopo_[subdet - 3]->detectorType());
700  cell = recoLayerCell.first;
701  layer = recoLayerCell.second;
702  // skip simhits with bad barcodes or non-existant layers
703  if (layer == -1 || simHit.geantTrackId() == 0)
704  continue;
705  id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell);
706  }
707  } else {
708  id = simHit.id();
709  //Relabel all HCAL hits
710  if (isHcal) {
712  id = hid;
713  }
714  }
715 
716  if (id == DetId(0)) {
717  continue;
718  }
719  if (simHit.geantTrackId() == 0) {
720  continue;
721  }
722 
723  returnValue.emplace_back(id, &simHit);
724  simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy();
725  m_detIdToTotalSimEnergy[id.rawId()] += simHit.energy();
726  }
727  } // end of loop over InputTags
728 }

References collectionTags_, doHGCAL, geometryType_, HcalEndcap, hcddd_, hgddd_, hgtopo_, triggerObjects_cff::id, m_detIdToTotalSimEnergy, HcalHitRelabeller::relabel(), fileinputsource_cfi::sec, rpcPointValidation_cfi::simHit, HGCalDDDConstants::simToReco(), HcalDetId::subdet(), and HGCalTestNumbering::unpackHexagonIndex().

Referenced by accumulateEvent().

◆ finalizeEvent()

void CaloTruthAccumulator::finalizeEvent ( edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements DigiAccumulatorMixMod.

Definition at line 476 of file CaloTruthAccumulator.cc.

476  {
477  edm::LogInfo(messageCategory_) << "Adding " << output_.pSimClusters->size() << " SimParticles and "
478  << output_.pCaloParticles->size() << " CaloParticles to the event.";
479 
480  // We need to normalize the hits and energies into hits and fractions (since
481  // we have looped over all pileup events)
482  // For premixing stage1 we keep the energies, they will be normalized to
483  // fractions in stage2
484 
485  if (premixStage1_) {
486  auto totalEnergies = std::make_unique<std::vector<std::pair<unsigned int, float>>>();
487  totalEnergies->reserve(m_detIdToTotalSimEnergy.size());
488  std::copy(m_detIdToTotalSimEnergy.begin(), m_detIdToTotalSimEnergy.end(), std::back_inserter(*totalEnergies));
489  std::sort(totalEnergies->begin(), totalEnergies->end());
490  event.put(std::move(totalEnergies), "MergedCaloTruth");
491  } else {
492  for (auto &sc : *(output_.pSimClusters)) {
493  auto hitsAndEnergies = sc.hits_and_fractions();
494  sc.clearHitsAndFractions();
495  sc.clearHitsEnergy();
496  for (auto &hAndE : hitsAndEnergies) {
497  const float totalenergy = m_detIdToTotalSimEnergy[hAndE.first];
498  float fraction = 0.;
499  if (totalenergy > 0)
500  fraction = hAndE.second / totalenergy;
501  else
503  << "TotalSimEnergy for hit " << hAndE.first << " is 0! The fraction for this hit cannot be computed.";
504  sc.addRecHitAndFraction(hAndE.first, fraction);
505  sc.addHitEnergy(hAndE.second);
506  }
507  }
508  }
509 
510  // save the SimCluster orphan handle so we can fill the calo particles
511  auto scHandle = event.put(std::move(output_.pSimClusters), "MergedCaloTruth");
512 
513  // now fill the calo particles
514  for (unsigned i = 0; i < output_.pCaloParticles->size(); ++i) {
515  auto &cp = (*output_.pCaloParticles)[i];
516  for (unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j) {
517  edm::Ref<SimClusterCollection> ref(scHandle, j);
518  cp.addSimCluster(ref);
519  }
520  }
521 
522  event.put(std::move(output_.pCaloParticles), "MergedCaloTruth");
523 
524  calo_particles().swap(m_caloParticles);
525 
526  std::unordered_map<Index_t, float>().swap(m_detIdToTotalSimEnergy);
527  std::unordered_multimap<Barcode_t, Index_t>().swap(m_simHitBarcodeToIndex);
528 }

References filterCSVwithJSON::copy, CommonMethods::cp(), HLT_2018_cff::fraction, mps_fire::i, dqmiolumiharvest::j, m_caloParticles, m_detIdToTotalSimEnergy, m_simHitBarcodeToIndex, messageCategory_, eostools::move(), output_, CaloTruthAccumulator::OutputCollections::pCaloParticles, premixStage1_, CaloTruthAccumulator::OutputCollections::pSimClusters, CaloTruthAccumulator::calo_particles::sc_start_, CaloTruthAccumulator::calo_particles::sc_stop_, and CaloTruthAccumulator::calo_particles::swap().

◆ initializeEvent()

void CaloTruthAccumulator::initializeEvent ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Member Data Documentation

◆ collectionTags_

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

Definition at line 172 of file CaloTruthAccumulator.cc.

Referenced by CaloTruthAccumulator(), and fillSimHits().

◆ doHGCAL

bool CaloTruthAccumulator::doHGCAL
private

Definition at line 209 of file CaloTruthAccumulator.cc.

Referenced by beginLuminosityBlock(), and fillSimHits().

◆ genParticleLabel_

edm::InputTag CaloTruthAccumulator::genParticleLabel_
private

Definition at line 173 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent(), and CaloTruthAccumulator().

◆ geometryType_

int CaloTruthAccumulator::geometryType_
private

Definition at line 208 of file CaloTruthAccumulator.cc.

Referenced by beginLuminosityBlock(), and fillSimHits().

◆ hcddd_

const HcalDDDRecConstants* CaloTruthAccumulator::hcddd_ = nullptr
private

Definition at line 204 of file CaloTruthAccumulator.cc.

Referenced by beginLuminosityBlock(), and fillSimHits().

◆ hepMCproductLabel_

edm::InputTag CaloTruthAccumulator::hepMCproductLabel_
private

Needed to add HepMC::GenVertex to SimVertex.

Definition at line 175 of file CaloTruthAccumulator.cc.

Referenced by accumulate(), and CaloTruthAccumulator().

◆ hgddd_

const HGCalDDDConstants* CaloTruthAccumulator::hgddd_[3] = {nullptr, nullptr, nullptr}
private

Definition at line 203 of file CaloTruthAccumulator.cc.

Referenced by beginLuminosityBlock(), and fillSimHits().

◆ hgtopo_

const HGCalTopology* CaloTruthAccumulator::hgtopo_[3] = {nullptr, nullptr, nullptr}
private

Definition at line 202 of file CaloTruthAccumulator.cc.

Referenced by beginLuminosityBlock(), and fillSimHits().

◆ hSimTracks

edm::Handle<std::vector<SimTrack> > CaloTruthAccumulator::hSimTracks
private

Definition at line 169 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent().

◆ hSimVertices

edm::Handle<std::vector<SimVertex> > CaloTruthAccumulator::hSimVertices
private

Definition at line 170 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent().

◆ m_caloParticles

calo_particles CaloTruthAccumulator::m_caloParticles
private

Definition at line 206 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent(), and finalizeEvent().

◆ m_detIdToTotalSimEnergy

std::unordered_map<Index_t, float> CaloTruthAccumulator::m_detIdToTotalSimEnergy
private

Definition at line 151 of file CaloTruthAccumulator.cc.

Referenced by fillSimHits(), finalizeEvent(), and initializeEvent().

◆ m_simHitBarcodeToIndex

std::unordered_multimap<Barcode_t, Index_t> CaloTruthAccumulator::m_simHitBarcodeToIndex
private

Definition at line 152 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent(), and finalizeEvent().

◆ maximumPreviousBunchCrossing_

const unsigned int CaloTruthAccumulator::maximumPreviousBunchCrossing_
private

The maximum bunch crossing BEFORE the signal crossing to create TrackinParticles for. Use positive values. If set to zero no previous bunches are added and only in-time, signal and after bunches (defined by maximumSubsequentBunchCrossing_) are used.

Definition at line 159 of file CaloTruthAccumulator.cc.

Referenced by accumulate().

◆ maximumSubsequentBunchCrossing_

const unsigned int CaloTruthAccumulator::maximumSubsequentBunchCrossing_
private

The maximum bunch crossing AFTER the signal crossing to create TrackinParticles for. E.g. if set to zero only uses the signal and in time pileup (and previous bunches defined by the maximumPreviousBunchCrossing_ parameter).

Definition at line 165 of file CaloTruthAccumulator.cc.

Referenced by accumulate().

◆ maxPseudoRapidity_

const double CaloTruthAccumulator::maxPseudoRapidity_
private

Definition at line 177 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent().

◆ messageCategory_

const std::string CaloTruthAccumulator::messageCategory_
private

Definition at line 149 of file CaloTruthAccumulator.cc.

Referenced by accumulate(), accumulateEvent(), and finalizeEvent().

◆ minEnergy_

const double CaloTruthAccumulator::minEnergy_
private

Definition at line 177 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent().

◆ output_

OutputCollections CaloTruthAccumulator::output_
private

Definition at line 205 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent(), finalizeEvent(), and initializeEvent().

◆ premixStage1_

const bool CaloTruthAccumulator::premixStage1_
private

Definition at line 178 of file CaloTruthAccumulator.cc.

Referenced by CaloTruthAccumulator(), and finalizeEvent().

◆ simTrackLabel_

const edm::InputTag CaloTruthAccumulator::simTrackLabel_
private

Definition at line 167 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent(), and CaloTruthAccumulator().

◆ simVertexLabel_

const edm::InputTag CaloTruthAccumulator::simVertexLabel_
private

Definition at line 168 of file CaloTruthAccumulator.cc.

Referenced by accumulateEvent(), and CaloTruthAccumulator().

CaloTruthAccumulator::m_simHitBarcodeToIndex
std::unordered_multimap< Barcode_t, Index_t > m_simHitBarcodeToIndex
Definition: CaloTruthAccumulator.cc:152
CaloTruthAccumulator::hSimVertices
edm::Handle< std::vector< SimVertex > > hSimVertices
Definition: CaloTruthAccumulator.cc:170
CaloTruthAccumulator::fillSimHits
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.
Definition: CaloTruthAccumulator.cc:673
CoreSimTrack::momentum
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
put
void put(edm::Event &evt, double value, const char *instanceName)
Definition: EventShapeVarsProducer.cc:27
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
SimClusterCollection
std::vector< SimCluster > SimClusterCollection
Definition: SimClusterFwd.h:8
mps_fire.i
i
Definition: mps_fire.py:355
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
ForwardEmpty
Definition: ForwardSubdetector.h:5
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
HcalDDDRecConstants::dddConstants
const HcalDDDSimConstants * dddConstants() const
Definition: HcalDDDRecConstants.h:126
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
CaloTruthAccumulator::OutputCollections::pSimClusters
std::unique_ptr< SimClusterCollection > pSimClusters
Definition: CaloTruthAccumulator.cc:182
CaloTruthAccumulator::calo_particles::sc_stop_
std::vector< uint32_t > sc_stop_
Definition: CaloTruthAccumulator.cc:188
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HGCalTestNumbering::unpackHexagonIndex
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
Definition: HGCalTestNumbering.cc:47
CaloTruthAccumulator::hgtopo_
const HGCalTopology * hgtopo_[3]
Definition: CaloTruthAccumulator.cc:202
DetId::Hcal
Definition: DetId.h:28
edm::LogInfo
Definition: MessageLogger.h:254
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
CaloTruthAccumulator::maximumPreviousBunchCrossing_
const unsigned int maximumPreviousBunchCrossing_
Definition: CaloTruthAccumulator.cc:159
findQualityFiles.v
v
Definition: findQualityFiles.py:179
EcalMappingRecord_cfi.eegeom
eegeom
Definition: EcalMappingRecord_cfi.py:3
edm::Handle< edm::HepMCProduct >
DEBUG
#define DEBUG
Definition: CaloTruthAccumulator.cc:1
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
CaloTruthAccumulator::minEnergy_
const double minEnergy_
Definition: CaloTruthAccumulator.cc:177
CaloTruthAccumulator::simVertexLabel_
const edm::InputTag simVertexLabel_
Definition: CaloTruthAccumulator.cc:168
CaloTruthAccumulator::maxPseudoRapidity_
const double maxPseudoRapidity_
Definition: CaloTruthAccumulator.cc:177
edm::Ref
Definition: AssociativeIterator.h:58
HGCalDDDConstants
Definition: HGCalDDDConstants.h:25
CaloTruthAccumulator::maximumSubsequentBunchCrossing_
const unsigned int maximumSubsequentBunchCrossing_
Definition: CaloTruthAccumulator.cc:165
SimTrack::noGenpart
bool noGenpart() const
Definition: SimTrack.h:35
config
Definition: config.py:1
DetId
Definition: DetId.h:17
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
HGCalDDDConstants::simToReco
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
Definition: HGCalDDDConstants.cc:1006
CaloTruthAccumulator::calo_particles::sc_start_
std::vector< uint32_t > sc_start_
Definition: CaloTruthAccumulator.cc:187
CaloTruthAccumulator::m_detIdToTotalSimEnergy
std::unordered_map< Index_t, float > m_detIdToTotalSimEnergy
Definition: CaloTruthAccumulator.cc:151
rpcPointValidation_cfi.simHit
simHit
Definition: rpcPointValidation_cfi.py:24
runTauDisplay.vis
vis
Definition: runTauDisplay.py:328
CaloTruthAccumulator::OutputCollections::pCaloParticles
std::unique_ptr< CaloParticleCollection > pCaloParticles
Definition: CaloTruthAccumulator.cc:183
edm::ESHandle< CaloGeometry >
CaloTruthAccumulator::output_
OutputCollections output_
Definition: CaloTruthAccumulator.cc:205
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
OrderedSet.t
t
Definition: OrderedSet.py:90
HGCalGeometry
Definition: HGCalGeometry.h:30
CaloParticleCollection
std::vector< CaloParticle > CaloParticleCollection
Definition: CaloParticleFwd.h:8
EdgeProperty::cumulative_simHits
int cumulative_simHits
Definition: CaloTruthAccumulator.cc:108
CaloTruthAccumulator::collectionTags_
std::vector< edm::InputTag > collectionTags_
Definition: CaloTruthAccumulator.cc:172
HGCEE
Definition: ForwardSubdetector.h:8
CaloTruthAccumulator::premixStage1_
const bool premixStage1_
Definition: CaloTruthAccumulator.cc:178
edm::LogWarning
Definition: MessageLogger.h:141
CaloTruthAccumulator::messageCategory_
const std::string messageCategory_
Definition: CaloTruthAccumulator.cc:149
edm::ParameterSet
Definition: ParameterSet.h:36
CaloTruthAccumulator::hgddd_
const HGCalDDDConstants * hgddd_[3]
Definition: CaloTruthAccumulator.cc:203
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalDetId
Definition: HcalDetId.h:12
DecayChain
adjacency_list< listS, vecS, directedS, VertexMotherParticleProperty, EdgeParticleClustersProperty > DecayChain
Definition: CaloTruthAccumulator.cc:122
CaloTruthAccumulator::hepMCproductLabel_
edm::InputTag hepMCproductLabel_
Needed to add HepMC::GenVertex to SimVertex.
Definition: CaloTruthAccumulator.cc:175
edm::ProducesCollector::produces
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Definition: ProducesCollector.h:52
get
#define get
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
HcalHitRelabeller::relabel
DetId relabel(const uint32_t testId) const
Definition: HcalHitRelabeller.cc:49
HGCalDetId
Definition: HGCalDetId.h:8
PA_ZEESkim_cff.decay
decay
Definition: PA_ZEESkim_cff.py:26
EdgeProperty
Definition: CaloTruthAccumulator.cc:104
eostools.move
def move(src, dest)
Definition: eostools.py:511
CaloTruthAccumulator::hSimTracks
edm::Handle< std::vector< SimTrack > > hSimTracks
Definition: CaloTruthAccumulator.cc:169
CaloTruthAccumulator::accumulateEvent
void accumulateEvent(const T &event, const edm::EventSetup &setup, const edm::Handle< edm::HepMCProduct > &hepMCproduct)
Both forms of accumulate() delegate to this templated method.
Definition: CaloTruthAccumulator.cc:531
CaloTruthAccumulator::geometryType_
int geometryType_
Definition: CaloTruthAccumulator.cc:208
HcalEndcap
Definition: HcalAssistant.h:34
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
DetId::HGCalHSc
Definition: DetId.h:34
VertexProperty
Definition: CaloTruthAccumulator.cc:111
CaloTruthAccumulator::doHGCAL
bool doHGCAL
Definition: CaloTruthAccumulator.cc:209
IfLogDebug
#define IfLogDebug(cond, cat)
Definition: MessageLogger.h:698
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
CaloTruthAccumulator::hcddd_
const HcalDDDRecConstants * hcddd_
Definition: CaloTruthAccumulator.cc:204
CaloTruthAccumulator::simTrackLabel_
const edm::InputTag simTrackLabel_
Definition: CaloTruthAccumulator.cc:167
HGCHEF
Definition: ForwardSubdetector.h:9
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CaloTruthAccumulator::m_caloParticles
calo_particles m_caloParticles
Definition: CaloTruthAccumulator.cc:206
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
DetId::Forward
Definition: DetId.h:30
event
Definition: event.py:1
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
CommonMethods.cp
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
Definition: CommonMethods.py:192
HcalGeometry
Definition: HcalGeometry.h:17
HLT_2018_cff.fraction
fraction
Definition: HLT_2018_cff.py:51317
edm::InputTag
Definition: InputTag.h:15
EdgeProperty::simTrack
const SimTrack * simTrack
Definition: CaloTruthAccumulator.cc:106
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
CaloTruthAccumulator::genParticleLabel_
edm::InputTag genParticleLabel_
Definition: CaloTruthAccumulator.cc:173