CMS 3D CMS Logo

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

#include <SimTracker/TrackAssociatorProducers/plugins/QuickTrackAssociatorByHitsProducer.cc>

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

Public Member Functions

 QuickTrackAssociatorByHitsProducer (const edm::ParameterSet &)
 
 ~QuickTrackAssociatorByHitsProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 beginJob () override
 
void endJob () override
 
edm::ParameterSet makeHitAssociatorParameters (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

bool absoluteNumberOfHits_
 
edm::EDGetTokenT< ClusterTPAssociationcluster2TPToken_
 
double cutRecoToSim_
 
double pixelHitWeight_
 
double puritySimToReco_
 
double qualitySimToReco_
 
QuickTrackAssociatorByHitsImpl::SimToRecoDenomType simToRecoDenominator_
 
bool threeHitTracksAreSpecial_
 
TrackerHitAssociator::Config trackerHitAssociatorConfig_
 
bool useClusterTPAssociation_
 

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::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 41 of file QuickTrackAssociatorByHitsProducer.cc.

Constructor & Destructor Documentation

◆ QuickTrackAssociatorByHitsProducer()

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

Definition at line 78 of file QuickTrackAssociatorByHitsProducer.cc.

79  : qualitySimToReco_(iConfig.getParameter<double>("Quality_SimToReco")),
80  puritySimToReco_(iConfig.getParameter<double>("Purity_SimToReco")),
81  pixelHitWeight_(iConfig.getParameter<double>("PixelHitWeight")),
82  cutRecoToSim_(iConfig.getParameter<double>("Cut_RecoToSim")),
83  threeHitTracksAreSpecial_(iConfig.getParameter<bool>("ThreeHitTracksAreSpecial")),
84  useClusterTPAssociation_(iConfig.getParameter<bool>("useClusterTPAssociation")),
85  absoluteNumberOfHits_(iConfig.getParameter<bool>("AbsoluteNumberOfHits")) {
86  //
87  // Check whether the denominator when working out the percentage of shared hits should
88  // be the number of simulated hits or the number of reconstructed hits.
89  //
90  std::string denominatorString = iConfig.getParameter<std::string>("SimToRecoDenominator");
91  if (denominatorString == "sim")
93  else if (denominatorString == "reco")
95  else
96  throw cms::Exception("QuickTrackAssociatorByHitsImpl") << "SimToRecoDenominator not specified as sim or reco";
97 
98  //
99  // Do some checks on whether UseGrouped or UseSplitting have been set. They're not used
100  // unlike the standard TrackAssociatorByHits so show a warning.
101  //
102  bool useGrouped, useSplitting;
103  if (iConfig.exists("UseGrouped"))
104  useGrouped = iConfig.getParameter<bool>("UseGrouped");
105  else
106  useGrouped = true;
107 
108  if (iConfig.exists("UseSplitting"))
109  useSplitting = iConfig.getParameter<bool>("UseSplitting");
110  else
111  useSplitting = true;
112 
113  // This associator works as though both UseGrouped and UseSplitting were set to true, so show a
114  // warning if this isn't the case.
115  if (!(useGrouped && useSplitting)) {
116  LogDebug("QuickTrackAssociatorByHitsImpl")
117  << "UseGrouped and/or UseSplitting has been set to false, but this associator ignores that setting.";
118  }
119 
120  //register your products
121  produces<reco::TrackToTrackingParticleAssociator>();
122 
124  cluster2TPToken_ = consumes<ClusterTPAssociation>(iConfig.getParameter<edm::InputTag>("cluster2TPSrc"));
125  } else {
128  }
129 }

References cluster2TPToken_, helper::Config, edm::EDConsumerBase::consumesCollector(), QuickTrackAssociatorByHitsImpl::denomreco, QuickTrackAssociatorByHitsImpl::denomsim, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), LogDebug, makeHitAssociatorParameters(), simToRecoDenominator_, AlCaHLTBitMon_QueryRunRegistry::string, trackerHitAssociatorConfig_, and useClusterTPAssociation_.

◆ ~QuickTrackAssociatorByHitsProducer()

QuickTrackAssociatorByHitsProducer::~QuickTrackAssociatorByHitsProducer ( )
override

Definition at line 131 of file QuickTrackAssociatorByHitsProducer.cc.

131  {
132  // do anything here that needs to be done at desctruction time
133  // (e.g. close files, deallocate resources etc.)
134 }

Member Function Documentation

◆ beginJob()

void QuickTrackAssociatorByHitsProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 192 of file QuickTrackAssociatorByHitsProducer.cc.

192 {}

◆ endJob()

void QuickTrackAssociatorByHitsProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 195 of file QuickTrackAssociatorByHitsProducer.cc.

195 {}

◆ fillDescriptions()

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

Definition at line 198 of file QuickTrackAssociatorByHitsProducer.cc.

198  {
199  //The following says we do not know what parameters are allowed so do no validation
200  // Please change this to state exactly what you do use, even if it is no parameters
202  desc.setUnknown();
203  descriptions.addDefault(desc);
204 }

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

◆ makeHitAssociatorParameters()

edm::ParameterSet QuickTrackAssociatorByHitsProducer::makeHitAssociatorParameters ( const edm::ParameterSet iConfig)
private

Definition at line 141 of file QuickTrackAssociatorByHitsProducer.cc.

141  {
142  edm::ParameterSet hitAssociatorParameters;
143  hitAssociatorParameters.addParameter<bool>("associatePixel", iConfig.getParameter<bool>("associatePixel"));
144  hitAssociatorParameters.addParameter<bool>("associateStrip", iConfig.getParameter<bool>("associateStrip"));
145  // This is the important one, it stops the hit associator searching through the list of sim hits.
146  // I only want to use the hit associator methods that work on the hit IDs (i.e. the uint32_t trackId
147  // and the EncodedEventId eventId) so I'm not interested in matching that to the PSimHit objects.
148  hitAssociatorParameters.addParameter<bool>("associateRecoTracks", true);
149  // add these new ones to allow redirection of inputs:
150  hitAssociatorParameters.addParameter<edm::InputTag>("pixelSimLinkSrc",
151  iConfig.getParameter<edm::InputTag>("pixelSimLinkSrc"));
152  hitAssociatorParameters.addParameter<edm::InputTag>("stripSimLinkSrc",
153  iConfig.getParameter<edm::InputTag>("stripSimLinkSrc"));
154 
155  return hitAssociatorParameters;
156 }

References edm::ParameterSet::addParameter(), and edm::ParameterSet::getParameter().

Referenced by QuickTrackAssociatorByHitsProducer().

◆ produce()

void QuickTrackAssociatorByHitsProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 159 of file QuickTrackAssociatorByHitsProducer.cc.

161  {
162  using namespace edm;
163 
164  const ClusterTPAssociation* clusterAssoc = nullptr;
165  std::unique_ptr<TrackerHitAssociator> trackAssoc;
167  edm::Handle<ClusterTPAssociation> clusterAssocHandle;
168  iEvent.getByToken(cluster2TPToken_, clusterAssocHandle);
169  clusterAssoc = clusterAssocHandle.product();
170  } else {
171  // If control got this far then either useClusterTPAssociation_ was false or getting the cluster
172  // to TrackingParticle association from the event failed. Either way I need to create a hit associator.
173  trackAssoc = std::make_unique<TrackerHitAssociator>(iEvent, trackerHitAssociatorConfig_);
174  }
175 
176  auto impl = std::make_unique<QuickTrackAssociatorByHitsImpl>(iEvent.productGetter(),
177  std::move(trackAssoc),
178  clusterAssoc,
186 
187  auto toPut = std::make_unique<reco::TrackToTrackingParticleAssociator>(std::move(impl));
188  iEvent.put(std::move(toPut));
189 }

References absoluteNumberOfHits_, cluster2TPToken_, cutRecoToSim_, iEvent, eostools::move(), pixelHitWeight_, edm::Handle< T >::product(), puritySimToReco_, qualitySimToReco_, simToRecoDenominator_, threeHitTracksAreSpecial_, convertXMLtoSQLite_cfg::toPut, trackerHitAssociatorConfig_, and useClusterTPAssociation_.

Member Data Documentation

◆ absoluteNumberOfHits_

bool QuickTrackAssociatorByHitsProducer::absoluteNumberOfHits_
private

Definition at line 64 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

◆ cluster2TPToken_

edm::EDGetTokenT<ClusterTPAssociation> QuickTrackAssociatorByHitsProducer::cluster2TPToken_
private

◆ cutRecoToSim_

double QuickTrackAssociatorByHitsProducer::cutRecoToSim_
private

Definition at line 60 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

◆ pixelHitWeight_

double QuickTrackAssociatorByHitsProducer::pixelHitWeight_
private

Definition at line 59 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

◆ puritySimToReco_

double QuickTrackAssociatorByHitsProducer::puritySimToReco_
private

Definition at line 58 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

◆ qualitySimToReco_

double QuickTrackAssociatorByHitsProducer::qualitySimToReco_
private

Definition at line 57 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

◆ simToRecoDenominator_

QuickTrackAssociatorByHitsImpl::SimToRecoDenomType QuickTrackAssociatorByHitsProducer::simToRecoDenominator_
private

◆ threeHitTracksAreSpecial_

bool QuickTrackAssociatorByHitsProducer::threeHitTracksAreSpecial_
private

Definition at line 62 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

◆ trackerHitAssociatorConfig_

TrackerHitAssociator::Config QuickTrackAssociatorByHitsProducer::trackerHitAssociatorConfig_
private

◆ useClusterTPAssociation_

bool QuickTrackAssociatorByHitsProducer::useClusterTPAssociation_
private
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm
HLT enums.
Definition: AlignableModifier.h:19
QuickTrackAssociatorByHitsProducer::absoluteNumberOfHits_
bool absoluteNumberOfHits_
Definition: QuickTrackAssociatorByHitsProducer.cc:64
QuickTrackAssociatorByHitsProducer::useClusterTPAssociation_
bool useClusterTPAssociation_
Definition: QuickTrackAssociatorByHitsProducer.cc:63
ClusterTPAssociation
Definition: ClusterTPAssociation.h:21
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
QuickTrackAssociatorByHitsProducer::makeHitAssociatorParameters
edm::ParameterSet makeHitAssociatorParameters(const edm::ParameterSet &)
Definition: QuickTrackAssociatorByHitsProducer.cc:141
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:47
edm::Handle
Definition: AssociativeIterator.h:50
QuickTrackAssociatorByHitsProducer::threeHitTracksAreSpecial_
bool threeHitTracksAreSpecial_
Definition: QuickTrackAssociatorByHitsProducer.cc:62
QuickTrackAssociatorByHitsImpl::denomsim
Definition: QuickTrackAssociatorByHitsImpl.h:68
QuickTrackAssociatorByHitsProducer::puritySimToReco_
double puritySimToReco_
Definition: QuickTrackAssociatorByHitsProducer.cc:58
QuickTrackAssociatorByHitsProducer::cutRecoToSim_
double cutRecoToSim_
Definition: QuickTrackAssociatorByHitsProducer.cc:60
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
QuickTrackAssociatorByHitsImpl::denomreco
Definition: QuickTrackAssociatorByHitsImpl.h:68
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
iEvent
int iEvent
Definition: GenABIO.cc:224
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
QuickTrackAssociatorByHitsProducer::trackerHitAssociatorConfig_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
Definition: QuickTrackAssociatorByHitsProducer.cc:55
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
impl
Definition: trackAlgoPriorityOrder.h:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
QuickTrackAssociatorByHitsProducer::simToRecoDenominator_
QuickTrackAssociatorByHitsImpl::SimToRecoDenomType simToRecoDenominator_
Definition: QuickTrackAssociatorByHitsProducer.cc:61
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
convertXMLtoSQLite_cfg.toPut
toPut
Definition: convertXMLtoSQLite_cfg.py:41
QuickTrackAssociatorByHitsProducer::cluster2TPToken_
edm::EDGetTokenT< ClusterTPAssociation > cluster2TPToken_
Definition: QuickTrackAssociatorByHitsProducer.cc:56
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15
QuickTrackAssociatorByHitsProducer::pixelHitWeight_
double pixelHitWeight_
Definition: QuickTrackAssociatorByHitsProducer.cc:59
helper.Config
Config
Definition: helper.py:10
QuickTrackAssociatorByHitsProducer::qualitySimToReco_
double qualitySimToReco_
Definition: QuickTrackAssociatorByHitsProducer.cc:57