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
 
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 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::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: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 43 of file QuickTrackAssociatorByHitsProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 82 of file QuickTrackAssociatorByHitsProducer.cc.

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

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

Definition at line 132 of file QuickTrackAssociatorByHitsProducer.cc.

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

Member Function Documentation

void QuickTrackAssociatorByHitsProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 198 of file QuickTrackAssociatorByHitsProducer.cc.

199 {
200 }
void QuickTrackAssociatorByHitsProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 204 of file QuickTrackAssociatorByHitsProducer.cc.

204  {
205 }
void QuickTrackAssociatorByHitsProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 210 of file QuickTrackAssociatorByHitsProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

210  {
211  //The following says we do not know what parameters are allowed so do no validation
212  // Please change this to state exactly what you do use, even if it is no parameters
214  desc.setUnknown();
215  descriptions.addDefault(desc);
216 }
void addDefault(ParameterSetDescription const &psetDescription)
edm::ParameterSet QuickTrackAssociatorByHitsProducer::makeHitAssociatorParameters ( const edm::ParameterSet iConfig)
private

Definition at line 147 of file QuickTrackAssociatorByHitsProducer.cc.

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

Referenced by QuickTrackAssociatorByHitsProducer().

147  {
148  edm::ParameterSet hitAssociatorParameters;
149  hitAssociatorParameters.addParameter<bool>( "associatePixel", iConfig.getParameter<bool>("associatePixel") );
150  hitAssociatorParameters.addParameter<bool>( "associateStrip", iConfig.getParameter<bool>("associateStrip") );
151  // This is the important one, it stops the hit associator searching through the list of sim hits.
152  // I only want to use the hit associator methods that work on the hit IDs (i.e. the uint32_t trackId
153  // and the EncodedEventId eventId) so I'm not interested in matching that to the PSimHit objects.
154  hitAssociatorParameters.addParameter<bool>("associateRecoTracks",true);
155  // add these new ones to allow redirection of inputs:
156  hitAssociatorParameters.addParameter<edm::InputTag>( "pixelSimLinkSrc", iConfig.getParameter<edm::InputTag>("pixelSimLinkSrc") );
157  hitAssociatorParameters.addParameter<edm::InputTag>( "stripSimLinkSrc", iConfig.getParameter<edm::InputTag>("stripSimLinkSrc") );
158 
159  return hitAssociatorParameters;
160 }
T getParameter(std::string const &) const
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:125
void QuickTrackAssociatorByHitsProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 164 of file QuickTrackAssociatorByHitsProducer.cc.

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

165 {
166  using namespace edm;
167 
168  const ClusterTPAssociation *clusterAssoc = nullptr;
169  std::unique_ptr<TrackerHitAssociator> trackAssoc;
171  edm::Handle<ClusterTPAssociation> clusterAssocHandle;
172  iEvent.getByToken(cluster2TPToken_,clusterAssocHandle);
173  clusterAssoc = clusterAssocHandle.product();
174  }
175  else {
176  // If control got this far then either useClusterTPAssociation_ was false or getting the cluster
177  // to TrackingParticle association from the event failed. Either way I need to create a hit associator.
178  trackAssoc = std::make_unique<TrackerHitAssociator>(iEvent, trackerHitAssociatorConfig_);
179  }
180 
181  auto impl = std::make_unique<QuickTrackAssociatorByHitsImpl>(iEvent.productGetter(),
182  std::move(trackAssoc),
183  clusterAssoc,
191 
192  auto toPut = std::make_unique<reco::TrackToTrackingParticleAssociator>(std::move(impl));
193  iEvent.put(std::move(toPut));
194 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
EDProductGetter const & productGetter() const
Definition: Event.cc:93
int iEvent
Definition: GenABIO.cc:224
QuickTrackAssociatorByHitsImpl::SimToRecoDenomType simToRecoDenominator_
T const * product() const
Definition: Handle.h:74
edm::EDGetTokenT< ClusterTPAssociation > cluster2TPToken_
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

bool QuickTrackAssociatorByHitsProducer::absoluteNumberOfHits_
private

Definition at line 66 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

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

Definition at line 62 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

double QuickTrackAssociatorByHitsProducer::pixelHitWeight_
private

Definition at line 61 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

double QuickTrackAssociatorByHitsProducer::puritySimToReco_
private

Definition at line 60 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

double QuickTrackAssociatorByHitsProducer::qualitySimToReco_
private

Definition at line 59 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

QuickTrackAssociatorByHitsImpl::SimToRecoDenomType QuickTrackAssociatorByHitsProducer::simToRecoDenominator_
private
bool QuickTrackAssociatorByHitsProducer::threeHitTracksAreSpecial_
private

Definition at line 64 of file QuickTrackAssociatorByHitsProducer.cc.

Referenced by produce().

TrackerHitAssociator::Config QuickTrackAssociatorByHitsProducer::trackerHitAssociatorConfig_
private
bool QuickTrackAssociatorByHitsProducer::useClusterTPAssociation_
private