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::ProducerBase &mixMod, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void accumulate (edm::Event const &event, edm::EventSetup const &setup)=0
 
virtual void accumulate (PileUpEventPrincipal const &event, edm::EventSetup const &setup, edm::StreamID const &)=0
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
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 void finalizeEvent (edm::Event &event, edm::EventSetup const &setup)=0
 
virtual PileupMixingContentgetEventPileupInfo ()
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual void initializeEvent (edm::Event const &event, edm::EventSetup const &setup)=0
 
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_
 
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 89 of file TrackingTruthAccumulator.h.

Constructor & Destructor Documentation

TrackingTruthAccumulator::TrackingTruthAccumulator ( const edm::ParameterSet config,
edm::ProducerBase mixMod,
edm::ConsumesCollector iC 
)
explicit

Definition at line 259 of file TrackingTruthAccumulator.cc.

References chargedOnly_, collectionTags_, edm::ConsumesCollector::consumes(), createInitialVertexCollection_, createMergedCollection_, createUnmergedCollection_, edm::ParameterSet::exists(), genParticleLabel_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::ParameterSet::getParameterSet(), hepMCproductLabel_, messageCategory_, edm::ProductRegistryHelper::produces(), selector_, selectorFlag_, signalOnly_, simTrackLabel_, and simVertexLabel_.

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

Member Function Documentation

void TrackingTruthAccumulator::accumulate ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivate

Referenced by initializeEvent().

void TrackingTruthAccumulator::accumulate ( const PileUpEventPrincipal event,
const edm::EventSetup setup,
edm::StreamID const &   
)
overrideprivate
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 442 of file TrackingTruthAccumulator.cc.

References addAncestors_, allowDifferentProcessTypeForDifferentDetectors_, EncodedEventId::bunchCrossing(), CoreSimTrack::charge(), chargedOnly_, createInitialVertexCollection_, createMergedCollection_, createUnmergedCollection_, EncodedEventId::event(), CoreSimTrack::eventId(), cppFunctionSkipper::exception, fillSimHits(), genParticleLabel_, edm::EventSetup::get(), ignoreTracksOutsideVolume_, mergedOutput_, pInitialVertices_, CoreSimVertex::position(), edm::ESHandle< T >::product(), selector_, selectorFlag_, signalOnly_, muonSimHitMatcherPSet::simTrack, simTrackLabel_, ecalDetailedTimeRecHit_cfi::simVertex, simVertexLabel_, unmergedOutput_, vertexDistanceCut_, SimVertex::vertexId(), volumeRadius_, and volumeZ_.

Referenced by initializeEvent().

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

References a, funct::abs(), TrackingVertex::addDaughterTrack(), TrackingParticle::addDecayVertex(), TrackingParticle::addG4Track(), TrackingVertex::addG4Vertex(), TrackingParticle::addGenParticle(), TrackingVertex::addParentTrack(), allowDifferentProcessTypeForDifferentDetectors_, b, EncodedEventId::bunchCrossing(), collectionTags_, gather_cfg::cout, DEFINE_DIGI_ACCUMULATOR, DetId::det(), end, EncodedEventId::event(), CoreSimVertex::eventId(), CoreSimTrack::eventId(), spr::find(), TrackingParticle::g4Tracks(), genWeightsTable_cfi::genEvent, TrackingParticle::genParticles(), SimTrack::genpartIndex(), edm::getRef(), edm::isFinite(), TrackerTopology::layer(), mag2(), SiStripPI::max, SimTrack::noVertex(), NULL, TrackingParticle::numberOfHits(), TrackingParticle::numberOfTrackerHits(), TrackingParticle::numberOfTrackerLayers(), TrackingParticle::parentVertex(), objects.autophobj::particleType, common_cff::pdgId, TrackingParticle::pdgId(), CoreSimVertex::position(), position, TrackingParticle::setNumberOfHits(), TrackingParticle::setNumberOfTrackerHits(), TrackingParticle::setNumberOfTrackerLayers(), TrackingParticle::setParentVertex(), rpcPointValidation_cfi::simHit, trackerHits::simHits, muonSimHitMatcherPSet::simTrack, ecalDetailedTimeRecHit_cfi::simVertex, jetUpdater_cfi::sort, DetId::subdetId(), PSimHit::timeOfFlight(), findElectronsInSiStrips_cfi::trackCollection, DetId::Tracker, CoreSimTrack::trackId(), CoreSimTrack::type(), particleFlowSuperClusterECAL_cfi::vertexCollection, trackingTruthProducer_cfi::vertexDistanceCut, trackingTruthProducer_cfi::volumeRadius, volumeRadius_, trackingTruthProducer_cfi::volumeZ, and volumeZ_.

Referenced by accumulateEvent().

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

Definition at line 414 of file TrackingTruthAccumulator.cc.

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

414  {
416  edm::LogInfo("TrackingTruthAccumulator")
417  << "Adding " << unmergedOutput_.pTrackingParticles->size() << " TrackingParticles and "
418  << unmergedOutput_.pTrackingVertices->size() << " TrackingVertexs to the event.";
419 
422  }
423 
425  edm::LogInfo("TrackingTruthAccumulator")
426  << "Adding " << mergedOutput_.pTrackingParticles->size() << " merged TrackingParticles and "
427  << mergedOutput_.pTrackingVertices->size() << " merged TrackingVertexs to the event.";
428 
429  event.put(std::move(mergedOutput_.pTrackingParticles), "MergedTrackTruth");
430  event.put(std::move(mergedOutput_.pTrackingVertices), "MergedTrackTruth");
431  }
432 
434  edm::LogInfo("TrackingTruthAccumulator")
435  << "Adding " << pInitialVertices_->size() << " initial TrackingVertexs to the event.";
436 
437  event.put(std::move(pInitialVertices_), "InitialVertices");
438  }
439 }
std::unique_ptr< TrackingParticleCollection > pTrackingParticles
std::unique_ptr< TrackingVertexCollection > pInitialVertices_
std::unique_ptr< TrackingVertexCollection > pTrackingVertices
def move(src, dest)
Definition: eostools.py:511
void TrackingTruthAccumulator::initializeEvent ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivate

Definition at line 357 of file TrackingTruthAccumulator.cc.

References accumulate(), accumulateEvent(), PileUpEventPrincipal::bunchCrossing(), createInitialVertexCollection_, createMergedCollection_, createUnmergedCollection_, event(), hepMCproductLabel_, maximumPreviousBunchCrossing_, maximumSubsequentBunchCrossing_, mergedOutput_, messageCategory_, pInitialVertices_, TrackingTruthAccumulator::OutputCollections::pTrackingParticles, TrackingTruthAccumulator::OutputCollections::pTrackingVertices, TrackingTruthAccumulator::OutputCollections::refTrackingParticles, TrackingTruthAccumulator::OutputCollections::refTrackingVertexes, GeneralSetup::setup(), and unmergedOutput_.

357  {
362  const_cast<edm::Event &>(event).getRefBeforePut<TrackingParticleCollection>();
363  unmergedOutput_.refTrackingVertexes = const_cast<edm::Event &>(event).getRefBeforePut<TrackingVertexCollection>();
364  }
365 
370  const_cast<edm::Event &>(event).getRefBeforePut<TrackingParticleCollection>("MergedTrackTruth");
372  const_cast<edm::Event &>(event).getRefBeforePut<TrackingVertexCollection>("MergedTrackTruth");
373  }
374 
377  }
378 }
std::unique_ptr< TrackingParticleCollection > pTrackingParticles
std::unique_ptr< TrackingVertexCollection > pInitialVertices_
std::unique_ptr< TrackingVertexCollection > pTrackingVertices
std::vector< TrackingParticle > TrackingParticleCollection
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< TrackingVertex > TrackingVertexCollection

Member Data Documentation

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 140 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

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 170 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and fillSimHits().

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 155 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

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

Definition at line 146 of file TrackingTruthAccumulator.h.

Referenced by fillSimHits(), and TrackingTruthAccumulator().

const bool TrackingTruthAccumulator::createInitialVertexCollection_
private

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

Definition at line 137 of file TrackingTruthAccumulator.h.

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

const bool TrackingTruthAccumulator::createMergedCollection_
private
const bool TrackingTruthAccumulator::createUnmergedCollection_
private

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

Definition at line 133 of file TrackingTruthAccumulator.h.

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

edm::InputTag TrackingTruthAccumulator::genParticleLabel_
private

Definition at line 147 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

edm::InputTag TrackingTruthAccumulator::hepMCproductLabel_
private

Needed to add HepMC::GenVertex to SimVertex.

Definition at line 149 of file TrackingTruthAccumulator.h.

Referenced by initializeEvent(), and TrackingTruthAccumulator().

const bool TrackingTruthAccumulator::ignoreTracksOutsideVolume_
private

Definition at line 119 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

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 125 of file TrackingTruthAccumulator.h.

Referenced by initializeEvent().

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 130 of file TrackingTruthAccumulator.h.

Referenced by initializeEvent().

OutputCollections TrackingTruthAccumulator::mergedOutput_
private

Definition at line 184 of file TrackingTruthAccumulator.h.

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

const std::string TrackingTruthAccumulator::messageCategory_
private

The message category used to send messages to MessageLogger

Definition at line 112 of file TrackingTruthAccumulator.h.

Referenced by initializeEvent(), and TrackingTruthAccumulator().

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

Definition at line 185 of file TrackingTruthAccumulator.h.

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

const bool TrackingTruthAccumulator::removeDeadModules_
private

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

Definition at line 143 of file TrackingTruthAccumulator.h.

TrackingParticleSelector TrackingTruthAccumulator::selector_
private

Definition at line 152 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

bool TrackingTruthAccumulator::selectorFlag_
private

Definition at line 151 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

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 158 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

const edm::InputTag TrackingTruthAccumulator::simTrackLabel_
private

Definition at line 144 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

const edm::InputTag TrackingTruthAccumulator::simVertexLabel_
private

Definition at line 145 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and TrackingTruthAccumulator().

OutputCollections TrackingTruthAccumulator::unmergedOutput_
private

Definition at line 183 of file TrackingTruthAccumulator.h.

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

const double TrackingTruthAccumulator::vertexDistanceCut_
private

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

Definition at line 118 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent().

const double TrackingTruthAccumulator::volumeRadius_
private

Definition at line 115 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and fillSimHits().

const double TrackingTruthAccumulator::volumeZ_
private

Definition at line 116 of file TrackingTruthAccumulator.h.

Referenced by accumulateEvent(), and fillSimHits().