CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
TrackingTruthAccumulator Class Reference

Replacement for TrackingTruthProducer in the new pileup mixing setup. More...

#include <TrackingTruthAccumulator.h>

Inheritance diagram for TrackingTruthAccumulator:
DigiAccumulatorMixMod

Classes

struct  OutputCollections
 

Public Member Functions

 TrackingTruthAccumulator (const edm::ParameterSet &config, edm::ProducesCollector, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
 DigiAccumulatorMixMod (DigiAccumulatorMixMod const &)=delete
 
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)
 
DigiAccumulatorMixMod const & operator= (DigiAccumulatorMixMod const &)=delete
 
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...
 
template<class T >
void fillSimHits (std::vector< const PSimHit *> &returnValue, 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

const bool addAncestors_
 
bool allowDifferentProcessTypeForDifferentDetectors_
 When counting hits, allows hits in different detectors to have a different process type. More...
 
bool chargedOnly_
 
std::vector< edm::InputTagcollectionTags_
 
const bool createInitialVertexCollection_
 
const bool createMergedCollection_
 
const bool createUnmergedCollection_
 
edm::InputTag genParticleLabel_
 
edm::InputTag hepMCproductLabel_
 Needed to add HepMC::GenVertex to SimVertex. More...
 
const bool ignoreTracksOutsideVolume_
 
const unsigned int maximumPreviousBunchCrossing_
 
const unsigned int maximumSubsequentBunchCrossing_
 
OutputCollections mergedOutput_
 
const std::string messageCategory_
 
std::unique_ptr< TrackingVertexCollectionpInitialVertices_
 
const bool removeDeadModules_
 As of 11/Feb/2013 this option hasn't been implemented yet. More...
 
TrackingParticleSelector selector_
 
bool selectorFlag_
 
bool signalOnly_
 
const edm::InputTag simTrackLabel_
 
const edm::InputTag simVertexLabel_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
OutputCollections unmergedOutput_
 
const double vertexDistanceCut_
 maximum distance for HepMC::GenVertex to be added to SimVertex More...
 
const double volumeRadius_
 
const double volumeZ_
 

Detailed Description

Replacement for TrackingTruthProducer in the new pileup mixing setup.

The configuration parameters are:

Parameter name Type Description
volumeRadius double The volume radius in cm used if ignoreTracksOutsideVolume is true.
volumeZ double The volume z in cm used if ignoreTracksOutsideVolume is true.
ignoreTracksOutsideVolume bool If true, sim tracks that have a production vertex outside the volume specified by volumeRadius and volumeZ won't be turned into TrackingParticles. Doesn't make much difference to be honest, over a huge range of volume sizes so there must be a cut earlier in the simulation.
maximumPreviousBunchCrossing unsigned int Bunch crossings before this number (inclusive; use positive integer) won't be included. Setting to zero means only in-time.
maximumSubsequentBunchCrossing unsigned int Bunch crossings after this won't create any TrackingParticles.
createUnmergedCollection bool Whether to create the TrackingParticle collection without bremsstrahlung merged.
createMergedBremsstrahlung bool Whether to create the TrackingParticle collection with bremsstrahlung merged. At least one of createUnmergedCollection or createMergedBremsstrahlung should be true otherwise nothing will be produced.
createInitialVertexCollection bool Whether to create a collection of just the initial vertices. You can usually get this information from one of the other collections (merged or unmerged bremsstrahlung), but for this collection no selection is applied. Hence you will always have all of the initial vertices regardless of how tightly you select TrackingParticles with the "select" parameter. Note that the collection will have no links to the products of these vertices. If you want to know what came off these vertices you will have to look in one of the other collections. The name of the collection will be "InitialVertices".
alwaysAddAncestors bool If a sim track passes selection and is turned into a TrackingParticle, all of it's parents will also be created even if they fail the selection. This was the default behaviour for the old TrackingParticleProducer.
removeDeadModules bool Hasn't been implemented yet (as of 22/May/2013).
simTrackCollection edm::InputTag The input SimTrack collection
simVertexCollection edm::InputTag The input SimVerted collection
simHitCollections edm::ParameterSet A ParameterSet of vectors of InputTags that are the input PSimHits
genParticleCollection edm::InputTag The input reco::GenParticle collection. Note that there's a difference between reco::GenParticle and HepMC::GenParticle; the old TrackingTruthProducer used to use HepMC::GenParticle.
allowDifferentSimHitProcesses bool Should be false for FullSim and true for FastSim. There's more documentation in the code if you're really interested.
select edm::ParameterSet A ParameterSet used to configure a TrackingParticleSelector. If the TrackingParticle doesn't pass this selector then it's not added to the output.

Author
Mark Grimes (mark..nosp@m.grim.nosp@m.es@br.nosp@m.isto.nosp@m.l.ac..nosp@m.uk)
Date
11/Oct/2012

Definition at line 85 of file TrackingTruthAccumulator.h.

Constructor & Destructor Documentation

◆ TrackingTruthAccumulator()

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

Definition at line 257 of file TrackingTruthAccumulator.cc.

References chargedOnly_, collectionTags_, edm::ConsumesCollector::consumes(), createInitialVertexCollection_, createMergedCollection_, createUnmergedCollection_, genParticleLabel_, edm::ParameterSet::getParameter(), hepMCproductLabel_, messageCategory_, edm::ProducesCollector::produces(), selector_, selectorFlag_, signalOnly_, simTrackLabel_, simVertexLabel_, and triggerMatcherToHLTDebug_cfi::tags.

260  : messageCategory_("TrackingTruthAccumulator"),
261  volumeRadius_(config.getParameter<double>("volumeRadius")),
262  volumeZ_(config.getParameter<double>("volumeZ")),
263  vertexDistanceCut_(config.getParameter<double>("vertexDistanceCut")),
264  ignoreTracksOutsideVolume_(config.getParameter<bool>("ignoreTracksOutsideVolume")),
265  maximumPreviousBunchCrossing_(config.getParameter<unsigned int>("maximumPreviousBunchCrossing")),
266  maximumSubsequentBunchCrossing_(config.getParameter<unsigned int>("maximumSubsequentBunchCrossing")),
267  createUnmergedCollection_(config.getParameter<bool>("createUnmergedCollection")),
268  createMergedCollection_(config.getParameter<bool>("createMergedBremsstrahlung")),
269  createInitialVertexCollection_(config.getParameter<bool>("createInitialVertexCollection")),
270  addAncestors_(config.getParameter<bool>("alwaysAddAncestors")),
271  removeDeadModules_(config.getParameter<bool>("removeDeadModules")),
272  simTrackLabel_(config.getParameter<edm::InputTag>("simTrackCollection")),
273  simVertexLabel_(config.getParameter<edm::InputTag>("simVertexCollection")),
274  collectionTags_(),
275  genParticleLabel_(config.getParameter<edm::InputTag>("genParticleCollection")),
276  hepMCproductLabel_(config.getParameter<edm::InputTag>("HepMCProductLabel")),
277  tTopoToken_(iC.esConsumes()),
278  allowDifferentProcessTypeForDifferentDetectors_(config.getParameter<bool>("allowDifferentSimHitProcesses")) {
279  //
280  // Make sure at least one of the merged and unmerged collections have been set
281  // to be created.
282  //
284  edm::LogError(messageCategory_) << "Both \"createUnmergedCollection\" and "
285  "\"createMergedBremsstrahlung\" have been"
286  << "set to false, which means no collections will be created";
287 
288  // Initialize selection for building TrackingParticles
289  //
290  if (config.exists("select")) {
291  edm::ParameterSet param = config.getParameter<edm::ParameterSet>("select");
292  selector_ = TrackingParticleSelector(param.getParameter<double>("ptMinTP"),
293  param.getParameter<double>("ptMaxTP"),
294  param.getParameter<double>("minRapidityTP"),
295  param.getParameter<double>("maxRapidityTP"),
296  param.getParameter<double>("tipTP"),
297  param.getParameter<double>("lipTP"),
298  param.getParameter<int>("minHitTP"),
299  param.getParameter<bool>("signalOnlyTP"),
300  param.getParameter<bool>("intimeOnlyTP"),
301  param.getParameter<bool>("chargedOnlyTP"),
302  param.getParameter<bool>("stableOnlyTP"),
303  param.getParameter<std::vector<int>>("pdgIdTP"));
304  selectorFlag_ = true;
305 
306  // Also set these two variables, which are used to drop out early if the
307  // SimTrack doesn't conform. The selector_ requires a full TrackingParticle
308  // object, but these two variables can veto things early.
309  chargedOnly_ = param.getParameter<bool>("chargedOnlyTP");
310  signalOnly_ = param.getParameter<bool>("signalOnlyTP");
311  } else {
312  selectorFlag_ = false;
313  chargedOnly_ = false;
314  signalOnly_ = false;
315  }
316 
317  //
318  // Need to state what collections are going to be added to the event. This
319  // depends on which of the merged and unmerged collections have been
320  // configured to be created.
321  //
323  producesCollector.produces<TrackingVertexCollection>();
324  producesCollector.produces<TrackingParticleCollection>();
325  }
326 
328  producesCollector.produces<TrackingParticleCollection>("MergedTrackTruth");
329  producesCollector.produces<TrackingVertexCollection>("MergedTrackTruth");
330  }
331 
333  producesCollector.produces<TrackingVertexCollection>("InitialVertices");
334  }
335 
336  iC.consumes<std::vector<SimTrack>>(simTrackLabel_);
337  iC.consumes<std::vector<SimVertex>>(simVertexLabel_);
338  iC.consumes<std::vector<reco::GenParticle>>(genParticleLabel_);
339  iC.consumes<std::vector<int>>(genParticleLabel_);
340  iC.consumes<std::vector<int>>(hepMCproductLabel_);
341 
342  // Fill the collection tags
343  const edm::ParameterSet &simHitCollectionConfig = config.getParameterSet("simHitCollections");
344  std::vector<std::string> parameterNames = simHitCollectionConfig.getParameterNames();
345 
346  for (const auto &parameterName : parameterNames) {
347  std::vector<edm::InputTag> tags = simHitCollectionConfig.getParameter<std::vector<edm::InputTag>>(parameterName);
348  collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end());
349  }
350 
351  for (const auto &collectionTag : collectionTags_) {
352  iC.consumes<std::vector<PSimHit>>(collectionTag);
353  }
354 }
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const bool removeDeadModules_
As of 11/Feb/2013 this option hasn&#39;t been implemented yet.
const double vertexDistanceCut_
maximum distance for HepMC::GenVertex to be added to SimVertex
Definition: config.py:1
Log< level::Error, false > LogError
const unsigned int maximumSubsequentBunchCrossing_
bool allowDifferentProcessTypeForDifferentDetectors_
When counting hits, allows hits in different detectors to have a different process type...
std::vector< TrackingVertex > TrackingVertexCollection
const unsigned int maximumPreviousBunchCrossing_
TrackingParticleSelector selector_
std::vector< TrackingParticle > TrackingParticleCollection
SingleObjectSelector< TrackingParticleCollection, ::TrackingParticleSelector > TrackingParticleSelector
edm::InputTag hepMCproductLabel_
Needed to add HepMC::GenVertex to SimVertex.
std::vector< edm::InputTag > collectionTags_

Member Function Documentation

◆ accumulate() [1/2]

void TrackingTruthAccumulator::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 386 of file TrackingTruthAccumulator.cc.

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

386  {
387  // Call the templated version that does the same for both signal and pileup
388  // events
389 
391  event.getByLabel(hepMCproductLabel_, hepmc);
392 
393  accumulateEvent(event, setup, hepmc);
394 }
void accumulateEvent(const T &event, const edm::EventSetup &setup, const edm::Handle< edm::HepMCProduct > &hepMCproduct)
Both forms of accumulate() delegate to this templated method.
edm::InputTag hepMCproductLabel_
Needed to add HepMC::GenVertex to SimVertex.
Definition: event.py:1

◆ accumulate() [2/2]

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

Implements DigiAccumulatorMixMod.

Definition at line 396 of file TrackingTruthAccumulator.cc.

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

398  {
399  // If this bunch crossing is outside the user configured limit, don't do
400  // anything.
401  if (event.bunchCrossing() >= -static_cast<int>(maximumPreviousBunchCrossing_) &&
402  event.bunchCrossing() <= static_cast<int>(maximumSubsequentBunchCrossing_)) {
403  // edm::LogInfo(messageCategory_) << "Analysing pileup event for bunch
404  // crossing " << event.bunchCrossing();
405 
406  // simply create empty handle as we do not have a HepMCProduct in PU anyway
408  accumulateEvent(event, setup, hepmc);
409  } else
410  edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing();
411 }
const unsigned int maximumSubsequentBunchCrossing_
void accumulateEvent(const T &event, const edm::EventSetup &setup, const edm::Handle< edm::HepMCProduct > &hepMCproduct)
Both forms of accumulate() delegate to this templated method.
Log< level::Info, false > LogInfo
const unsigned int maximumPreviousBunchCrossing_
Definition: event.py:1

◆ accumulateEvent()

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

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

Definition at line 441 of file TrackingTruthAccumulator.cc.

References addAncestors_, allowDifferentProcessTypeForDifferentDetectors_, chargedOnly_, createInitialVertexCollection_, createMergedCollection_, createUnmergedCollection_, cppFunctionSkipper::exception, fillSimHits(), genParticleLabel_, ignoreTracksOutsideVolume_, mergedOutput_, pInitialVertices_, selector_, selectorFlag_, singleTopDQM_cfi::setup, signalOnly_, cscDigiValidation_cfi::simTrack, simTrackLabel_, ecalDetailedTimeRecHit_cfi::simVertex, simVertexLabel_, tTopoToken_, unmergedOutput_, bphysicsOniaDQM_cfi::vertex, vertexDistanceCut_, volumeRadius_, and volumeZ_.

Referenced by accumulate().

443  {
444  //
445  // Get the collections
446  //
450  edm::Handle<std::vector<int>> hGenParticleIndices;
451 
452  event.getByLabel(simTrackLabel_, hSimTracks);
453  event.getByLabel(simVertexLabel_, hSimVertices);
454 
455  try {
456  event.getByLabel(genParticleLabel_, hGenParticles);
457  event.getByLabel(genParticleLabel_, hGenParticleIndices);
458  } catch (cms::Exception &exception) {
459  //
460  // The Monte Carlo is not always available, e.g. for pileup events. The
461  // information is only used if it's available, but for some reason the
462  // PileUpEventPrincipal wrapper throws an exception here rather than waiting
463  // to see if the handle is used (as is the case for edm::Event). So I just
464  // want to catch this exception and use the normal handle checking later on.
465  //
466  }
467 
468  // Retrieve tracker topology from geometry
469  const TrackerTopology *const tTopo = &setup.getData(tTopoToken_);
470 
471  // Run through the collections and work out the decay chain of each
472  // track/vertex. The information in SimTrack and SimVertex only allows
473  // traversing upwards, but this will allow traversal in both directions. This
474  // is required for things like grouping electrons that bremsstrahlung as one
475  // TrackingParticle if "mergedBremsstrahlung" is set in the config file.
476  DecayChain decayChain(*hSimTracks, *hSimVertices);
477 
478  // I only want to create these collections if they're actually required
479  std::unique_ptr<::OutputCollectionWrapper> pUnmergedCollectionWrapper;
480  std::unique_ptr<::OutputCollectionWrapper> pMergedCollectionWrapper;
482  pUnmergedCollectionWrapper = std::make_unique<::OutputCollectionWrapper>(decayChain, unmergedOutput_);
484  pMergedCollectionWrapper = std::make_unique<::OutputCollectionWrapper>(decayChain, mergedOutput_);
485 
486  std::vector<const PSimHit *> simHitPointers;
487  fillSimHits(simHitPointers, event, setup);
488  TrackingParticleFactory objectFactory(decayChain,
489  hGenParticles,
490  hepMCproduct,
491  hGenParticleIndices,
492  simHitPointers,
494  volumeZ_,
497 
498 #if defined(DO_DEBUG_TESTING)
499  // While I'm testing, perform some checks.
500  // TODO - drop this call once I'm happy it works in all situations.
501  decayChain.integrityCheck();
502 #endif
503 
504  TrackingParticleSelector *pSelector = nullptr;
505  if (selectorFlag_)
506  pSelector = &selector_;
507 
508  // Run over all of the SimTracks, but because I'm interested in the decay
509  // hierarchy do it through the DecayChainTrack objects. These are looped over
510  // in sequence here but they have the hierarchy information for the functions
511  // called to traverse the decay chain.
512 
513  for (size_t index = 0; index < decayChain.decayTracksSize; ++index) {
514  ::DecayChainTrack *pDecayTrack = &decayChain.decayTracks[index];
515  const SimTrack &simTrack = hSimTracks->at(pDecayTrack->simTrackIndex);
516 
517  // Perform some quick checks to see if we can drop out early. Note that
518  // these are a subset of the cuts in the selector_ so the created
519  // TrackingParticle could still fail. The selector_ requires the full
520  // TrackingParticle to be made however, which can be computationally
521  // expensive.
522  if (chargedOnly_ && simTrack.charge() == 0)
523  continue;
524  if (signalOnly_ && (simTrack.eventId().bunchCrossing() != 0 || simTrack.eventId().event() != 0))
525  continue;
526 
527  // Also perform a check to see if the production vertex is inside the
528  // tracker volume (if required).
530  const SimVertex &simVertex = hSimVertices->at(pDecayTrack->pParentVertex->simVertexIndex);
531  if (!objectFactory.vectorIsInsideVolume(simVertex.position()))
532  continue;
533  }
534 
535  // This function creates the TrackinParticle and adds it to the collection
536  // if it passes the selection criteria specified in the configuration. If
537  // the config specifies adding ancestors, the function is called recursively
538  // to do that.
539  ::addTrack(pDecayTrack,
540  pSelector,
541  pUnmergedCollectionWrapper.get(),
542  pMergedCollectionWrapper.get(),
543  objectFactory,
545  tTopo);
546  }
547 
548  // If configured to create a collection of initial vertices, add them from
549  // this bunch crossing. No selection is applied on this collection, but it
550  // also has no links to the TrackingParticle decay products. There are a lot
551  // of "initial vertices", I'm not entirely sure what they all are (nuclear
552  // interactions in the detector maybe?), but the one for the main event is the
553  // one with vertexId==0.
555  // Pretty sure the one with vertexId==0 is always the first one, but doesn't
556  // hurt to check
557  for (const auto &pRootVertex : decayChain.rootVertices) {
558  const SimVertex &vertex = hSimVertices->at(decayChain.rootVertices[0]->simVertexIndex);
559  if (vertex.vertexId() != 0)
560  continue;
561 
562  pInitialVertices_->push_back(objectFactory.createTrackingVertex(pRootVertex));
563  break;
564  }
565  }
566 }
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::unique_ptr< TrackingVertexCollection > pInitialVertices_
const double vertexDistanceCut_
maximum distance for HepMC::GenVertex to be added to SimVertex
adjacency_list< listS, vecS, directedS, VertexMotherParticleProperty, EdgeParticleClustersProperty > DecayChain
Definition: DecayGraph.h:77
bool allowDifferentProcessTypeForDifferentDetectors_
When counting hits, allows hits in different detectors to have a different process type...
TrackingParticleSelector selector_
void fillSimHits(std::vector< const PSimHit *> &returnValue, const T &event, const edm::EventSetup &setup)
Fills the supplied vector with pointers to the SimHits, checking for bad modules if required...
Definition: event.py:1

◆ fillSimHits()

template<class T >
void TrackingTruthAccumulator::fillSimHits ( std::vector< const PSimHit *> &  returnValue,
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 569 of file TrackingTruthAccumulator.cc.

References a, b, collectionTags_, edm::isFinite(), SiStripPI::max, rpcPointValidation_cfi::simHit, and jetUpdater_cfi::sort.

Referenced by accumulateEvent().

571  {
572  // loop over the collections
573  for (const auto &collectionTag : collectionTags_) {
575  event.getByLabel(collectionTag, hSimHits);
576 
577  // TODO - implement removing the dead modules
578  for (const auto &simHit : *hSimHits) {
579  returnValue.push_back(&simHit);
580  }
581 
582  } // end of loop over InputTags
583 
584  // sort the SimHits according to their time of flight,
585  // necessary for looping over them "in order" in
586  // TrackingParticleFactory::createTrackingParticle()
587  std::sort(returnValue.begin(), returnValue.end(), [](const PSimHit *a, const PSimHit *b) {
588  const auto atof =
589  edm::isFinite(a->timeOfFlight()) ? a->timeOfFlight() : std::numeric_limits<decltype(a->timeOfFlight())>::max();
590  const auto btof =
591  edm::isFinite(b->timeOfFlight()) ? b->timeOfFlight() : std::numeric_limits<decltype(b->timeOfFlight())>::max();
592  return atof < btof;
593  });
594 }
constexpr bool isFinite(T x)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
std::vector< edm::InputTag > collectionTags_

◆ finalizeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 413 of file TrackingTruthAccumulator.cc.

References createInitialVertexCollection_, createMergedCollection_, createUnmergedCollection_, mergedOutput_, eostools::move(), pInitialVertices_, TrackingTruthAccumulator::OutputCollections::pTrackingParticles, TrackingTruthAccumulator::OutputCollections::pTrackingVertices, and unmergedOutput_.

413  {
415  edm::LogInfo("TrackingTruthAccumulator")
416  << "Adding " << unmergedOutput_.pTrackingParticles->size() << " TrackingParticles and "
417  << unmergedOutput_.pTrackingVertices->size() << " TrackingVertexs to the event.";
418 
421  }
422 
424  edm::LogInfo("TrackingTruthAccumulator")
425  << "Adding " << mergedOutput_.pTrackingParticles->size() << " merged TrackingParticles and "
426  << mergedOutput_.pTrackingVertices->size() << " merged TrackingVertexs to the event.";
427 
428  event.put(std::move(mergedOutput_.pTrackingParticles), "MergedTrackTruth");
429  event.put(std::move(mergedOutput_.pTrackingVertices), "MergedTrackTruth");
430  }
431 
433  edm::LogInfo("TrackingTruthAccumulator")
434  << "Adding " << pInitialVertices_->size() << " initial TrackingVertexs to the event.";
435 
436  event.put(std::move(pInitialVertices_), "InitialVertices");
437  }
438 }
std::unique_ptr< TrackingParticleCollection > pTrackingParticles
std::unique_ptr< TrackingVertexCollection > pInitialVertices_
std::unique_ptr< TrackingVertexCollection > pTrackingVertices
Log< level::Info, false > LogInfo
def move(src, dest)
Definition: eostools.py:511

◆ initializeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 356 of file TrackingTruthAccumulator.cc.

References createInitialVertexCollection_, createMergedCollection_, createUnmergedCollection_, edmPickEvents::event, mergedOutput_, pInitialVertices_, TrackingTruthAccumulator::OutputCollections::pTrackingParticles, TrackingTruthAccumulator::OutputCollections::pTrackingVertices, TrackingTruthAccumulator::OutputCollections::refTrackingParticles, TrackingTruthAccumulator::OutputCollections::refTrackingVertexes, and unmergedOutput_.

356  {
358  unmergedOutput_.pTrackingParticles = std::make_unique<TrackingParticleCollection>();
359  unmergedOutput_.pTrackingVertices = std::make_unique<TrackingVertexCollection>();
361  const_cast<edm::Event &>(event).getRefBeforePut<TrackingParticleCollection>();
362  unmergedOutput_.refTrackingVertexes = const_cast<edm::Event &>(event).getRefBeforePut<TrackingVertexCollection>();
363  }
364 
366  mergedOutput_.pTrackingParticles = std::make_unique<TrackingParticleCollection>();
367  mergedOutput_.pTrackingVertices = std::make_unique<TrackingVertexCollection>();
369  const_cast<edm::Event &>(event).getRefBeforePut<TrackingParticleCollection>("MergedTrackTruth");
371  const_cast<edm::Event &>(event).getRefBeforePut<TrackingVertexCollection>("MergedTrackTruth");
372  }
373 
375  pInitialVertices_ = std::make_unique<TrackingVertexCollection>();
376  }
377 }
std::unique_ptr< TrackingParticleCollection > pTrackingParticles
std::unique_ptr< TrackingVertexCollection > pInitialVertices_
std::unique_ptr< TrackingVertexCollection > pTrackingVertices

Member Data Documentation

◆ addAncestors_

const bool TrackingTruthAccumulator::addAncestors_
private

Whether or not to add the full parentage of any TrackingParticle that is inserted in the collection.

Definition at line 136 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

◆ allowDifferentProcessTypeForDifferentDetectors_

bool TrackingTruthAccumulator::allowDifferentProcessTypeForDifferentDetectors_
private

When counting hits, allows hits in different detectors to have a different process type.

Fast sim PSimHits seem to have a peculiarity where the process type (as reported by PSimHit::processType()) is different for the tracker than the muons. When counting how many hits there are, the code usually only counts the number of hits that have the same process type as the first hit. Setting this to true will also count hits that have the same process type as the first hit in the second detector.

Definition at line 167 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

◆ chargedOnly_

bool TrackingTruthAccumulator::chargedOnly_
private

Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first.

Definition at line 152 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

◆ collectionTags_

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

Definition at line 142 of file TrackingTruthAccumulator.h.

Referenced by fillSimHits(), and TrackingTruthAccumulator().

◆ createInitialVertexCollection_

const bool TrackingTruthAccumulator::createInitialVertexCollection_
private

Whether or not to create a separate collection for just the initial interaction vertices

Definition at line 133 of file TrackingTruthAccumulator.h.

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

◆ createMergedCollection_

const bool TrackingTruthAccumulator::createMergedCollection_
private

◆ createUnmergedCollection_

const bool TrackingTruthAccumulator::createUnmergedCollection_
private

If bremsstrahlung merging, whether to also add the unmerged collection to the event or not.

Definition at line 129 of file TrackingTruthAccumulator.h.

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

◆ genParticleLabel_

edm::InputTag TrackingTruthAccumulator::genParticleLabel_
private

Definition at line 143 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

◆ hepMCproductLabel_

edm::InputTag TrackingTruthAccumulator::hepMCproductLabel_
private

Needed to add HepMC::GenVertex to SimVertex.

Definition at line 145 of file TrackingTruthAccumulator.h.

Referenced by accumulate(), and TrackingTruthAccumulator().

◆ ignoreTracksOutsideVolume_

const bool TrackingTruthAccumulator::ignoreTracksOutsideVolume_
private

Definition at line 115 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

◆ maximumPreviousBunchCrossing_

const unsigned int TrackingTruthAccumulator::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 121 of file TrackingTruthAccumulator.h.

Referenced by accumulate().

◆ maximumSubsequentBunchCrossing_

const unsigned int TrackingTruthAccumulator::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 126 of file TrackingTruthAccumulator.h.

Referenced by accumulate().

◆ mergedOutput_

OutputCollections TrackingTruthAccumulator::mergedOutput_
private

Definition at line 181 of file TrackingTruthAccumulator.h.

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

◆ messageCategory_

const std::string TrackingTruthAccumulator::messageCategory_
private

The message category used to send messages to MessageLogger

Definition at line 108 of file TrackingTruthAccumulator.h.

Referenced by accumulate(), and TrackingTruthAccumulator().

◆ pInitialVertices_

std::unique_ptr<TrackingVertexCollection> TrackingTruthAccumulator::pInitialVertices_
private

Definition at line 182 of file TrackingTruthAccumulator.h.

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

◆ removeDeadModules_

const bool TrackingTruthAccumulator::removeDeadModules_
private

As of 11/Feb/2013 this option hasn't been implemented yet.

Definition at line 139 of file TrackingTruthAccumulator.h.

◆ selector_

TrackingParticleSelector TrackingTruthAccumulator::selector_
private

Definition at line 149 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

◆ selectorFlag_

bool TrackingTruthAccumulator::selectorFlag_
private

Definition at line 148 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

◆ signalOnly_

bool TrackingTruthAccumulator::signalOnly_
private

Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first.

Definition at line 155 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

◆ simTrackLabel_

const edm::InputTag TrackingTruthAccumulator::simTrackLabel_
private

Definition at line 140 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

◆ simVertexLabel_

const edm::InputTag TrackingTruthAccumulator::simVertexLabel_
private

Definition at line 141 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

◆ tTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TrackingTruthAccumulator::tTopoToken_
private

Definition at line 146 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

◆ unmergedOutput_

OutputCollections TrackingTruthAccumulator::unmergedOutput_
private

Definition at line 180 of file TrackingTruthAccumulator.h.

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

◆ vertexDistanceCut_

const double TrackingTruthAccumulator::vertexDistanceCut_
private

maximum distance for HepMC::GenVertex to be added to SimVertex

Definition at line 114 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

◆ volumeRadius_

const double TrackingTruthAccumulator::volumeRadius_
private

Definition at line 111 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

◆ volumeZ_

const double TrackingTruthAccumulator::volumeZ_
private

Definition at line 112 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().