CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DigiSimLinkPruner Class Reference

#include <SimTracker/TrackAssociation/plugins/DigiSimLinkPruner.cc>

Inheritance diagram for DigiSimLinkPruner:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DigiSimLinkPruner (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > siphase2OTSimLinksToken_
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > sipixelSimLinksToken_
 
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > sistripSimLinksToken_
 
edm::EDGetTokenT< TrackingParticleCollectiontrackingParticleToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Produce a pruned version of the DigiSimLinks collection based on the association to a collection of TrackingParticles

Implementation: [Notes on implementation]

Definition at line 68 of file DigiSimLinkPruner.cc.

Constructor & Destructor Documentation

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

Definition at line 84 of file DigiSimLinkPruner.cc.

References edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), siphase2OTSimLinksToken_, and sistripSimLinksToken_.

86  consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("trackingParticles"))),
89  produces<edm::DetSetVector<PixelDigiSimLink>>("siPixel");
90 
91  if (iConfig.existsAs<edm::InputTag>("stripSimLinkSrc")) {
93  consumes<edm::DetSetVector<StripDigiSimLink>>(iConfig.getParameter<edm::InputTag>("stripSimLinkSrc"));
94  produces<edm::DetSetVector<StripDigiSimLink>>("siStrip");
95  }
96 
97  if (iConfig.existsAs<edm::InputTag>("phase2OTSimLinkSrc")) {
99  consumes<edm::DetSetVector<PixelDigiSimLink>>(iConfig.getParameter<edm::InputTag>("phase2OTSimLinkSrc"));
100  produces<edm::DetSetVector<PixelDigiSimLink>>("siphase2OT");
101  }
102 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:161
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > siphase2OTSimLinksToken_
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > sistripSimLinksToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > sipixelSimLinksToken_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_

Member Function Documentation

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

Definition at line 150 of file DigiSimLinkPruner.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), and DEFINE_FWK_MODULE.

150  {
152  desc.add<edm::InputTag>("trackingParticles");
153  desc.add<edm::InputTag>("pixelSimLinkSrc", edm::InputTag("simSiPixelDigis"));
154  desc.addOptional<edm::InputTag>("stripSimLinkSrc");
155  desc.addOptional<edm::InputTag>("phase2OTSimLinkSrc");
156 
157  descriptions.add("digiSimLinkPrunerDefault", desc);
158 }
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void DigiSimLinkPruner::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 105 of file DigiSimLinkPruner.cc.

References runTauDisplay::eid, edm::Event::get(), edm::EDGetTokenT< T >::isUninitialized(), eostools::move(), edm::Event::put(), siphase2OTSimLinksToken_, sipixelSimLinksToken_, sistripSimLinksToken_, and trackingParticleToken_.

105  {
106  using namespace edm;
107 
108  auto const& tpColl = iEvent.get(trackingParticleToken_);
109 
110  std::set<std::pair<uint32_t, EncodedEventId>> selectedIds;
111  for (TrackingParticleCollection::size_type itp = 0; itp < tpColl.size(); ++itp) {
112  auto const& trackingParticle = tpColl[itp];
113 
114  // SimTracks inside TrackingParticle
115 
116  EncodedEventId eid(trackingParticle.eventId());
117 
118  for (auto const& trk : trackingParticle.g4Tracks()) {
119  selectedIds.emplace(trk.trackId(), eid);
120  }
121  }
122 
123  auto const& sipixelLinkColl = iEvent.get(sipixelSimLinksToken_);
124 
125  auto sipixelLinkVector = pruneByTpAssoc(sipixelLinkColl, selectedIds);
126 
127  auto sipixelOut = std::make_unique<edm::DetSetVector<PixelDigiSimLink>>(sipixelLinkVector);
128  iEvent.put(std::move(sipixelOut), "siPixel");
129 
131  auto const& sistripLinkColl = iEvent.get(sistripSimLinksToken_);
132 
133  auto sistripLinkVector = pruneByTpAssoc(sistripLinkColl, selectedIds);
134 
135  auto sistripOut = std::make_unique<edm::DetSetVector<StripDigiSimLink>>(sistripLinkVector);
136  iEvent.put(std::move(sistripOut), "siStrip");
137  }
138 
140  auto const& siphase2OTLinkColl = iEvent.get(siphase2OTSimLinksToken_);
141 
142  auto siphase2OTLinkVector = pruneByTpAssoc(siphase2OTLinkColl, selectedIds);
143 
144  auto siphase2OTOut = std::make_unique<edm::DetSetVector<PixelDigiSimLink>>(siphase2OTLinkVector);
145  iEvent.put(std::move(siphase2OTOut), "siphase2OT");
146  }
147 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
uint16_t size_type
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > siphase2OTSimLinksToken_
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:326
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > sistripSimLinksToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > sipixelSimLinksToken_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
HLT enums.
bool isUninitialized() const
Definition: EDGetToken.h:70
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink> > DigiSimLinkPruner::siphase2OTSimLinksToken_
private

Definition at line 81 of file DigiSimLinkPruner.cc.

Referenced by DigiSimLinkPruner(), and produce().

edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink> > DigiSimLinkPruner::sipixelSimLinksToken_
private

Definition at line 79 of file DigiSimLinkPruner.cc.

Referenced by produce().

edm::EDGetTokenT<edm::DetSetVector<StripDigiSimLink> > DigiSimLinkPruner::sistripSimLinksToken_
private

Definition at line 80 of file DigiSimLinkPruner.cc.

Referenced by DigiSimLinkPruner(), and produce().

edm::EDGetTokenT<TrackingParticleCollection> DigiSimLinkPruner::trackingParticleToken_
private

Definition at line 78 of file DigiSimLinkPruner.cc.

Referenced by produce().