CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
tt::StubAssociator Class Reference

Class to associate reconstrucable TrackingParticles with TTStubs and vice versa It may associate multiple TPs with a TTStub and can therefore be used to associate TTTracks with TrackingParticles. This EDProducer creates two StubAssociation EDProducts, one using only TP that are "reconstructable" (produce stubs in a min. number of layers) and one using TP that are also "use for the tracking efficiency measurement". More...

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

Public Member Functions

 StubAssociator (const ParameterSet &)
 
- 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, 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::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

ESGetToken< Setup, SetupRcdesGetTokenSetup_
 
EDGetTokenT< TTClusterAssMapgetTokenTTClusterAssMap_
 
EDGetTokenT< TTStubDetSetVecgetTokenTTStubDetSetVec_
 
EDPutTokenT< StubAssociationputTokenReconstructable_
 
EDPutTokenT< StubAssociationputTokenSelection_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Class to associate reconstrucable TrackingParticles with TTStubs and vice versa It may associate multiple TPs with a TTStub and can therefore be used to associate TTTracks with TrackingParticles. This EDProducer creates two StubAssociation EDProducts, one using only TP that are "reconstructable" (produce stubs in a min. number of layers) and one using TP that are also "use for the tracking efficiency measurement".

Author
Thomas Schuh
Date
2020, Apr

Definition at line 37 of file StubAssociator.cc.

Constructor & Destructor Documentation

◆ StubAssociator()

tt::StubAssociator::StubAssociator ( const ParameterSet iConfig)
explicit

Definition at line 55 of file StubAssociator.cc.

References edm::ParameterSet::getParameter().

55  {
56  // book in- and output ed products
57  getTokenTTStubDetSetVec_ = consumes<TTStubDetSetVec>(iConfig.getParameter<InputTag>("InputTagTTStubDetSetVec"));
58  getTokenTTClusterAssMap_ = consumes<TTClusterAssMap>(iConfig.getParameter<InputTag>("InputTagTTClusterAssMap"));
59  putTokenReconstructable_ = produces<StubAssociation>(iConfig.getParameter<string>("BranchReconstructable"));
60  putTokenSelection_ = produces<StubAssociation>(iConfig.getParameter<string>("BranchSelection"));
61  // book ES product
62  esGetTokenSetup_ = esConsumes<Setup, SetupRcd>();
63  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
EDPutTokenT< StubAssociation > putTokenReconstructable_
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
EDGetTokenT< TTStubDetSetVec > getTokenTTStubDetSetVec_
EDGetTokenT< TTClusterAssMap > getTokenTTClusterAssMap_
EDPutTokenT< StubAssociation > putTokenSelection_

Member Function Documentation

◆ produce()

void tt::StubAssociator::produce ( StreamID  ,
Event iEvent,
const EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 65 of file StubAssociator.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), edm::EventSetup::getData(), iEvent, tt::StubAssociation::insert(), edm::makeRefTo(), eostools::move(), AlCaHLTBitMon_ParallelJobs::p, corrVsCorr::selection, and singleTopDQM_cfi::setup.

65  {
66  auto const& setup = iSetup.getData(esGetTokenSetup_);
67 
68  // associate TTStubs with TrackingParticles
69  Handle<TTStubDetSetVec> handleTTStubDetSetVec = iEvent.getHandle(getTokenTTStubDetSetVec_);
70  auto const& ttClusterAssMap = iEvent.get(getTokenTTClusterAssMap_);
71 
72  map<TPPtr, vector<TTStubRef>> mapTPPtrsTTStubRefs;
73  auto isNonnull = [](const TPPtr& tpPtr) { return tpPtr.isNonnull(); };
74  for (TTStubDetSetVec::const_iterator ttModule = handleTTStubDetSetVec->begin();
75  ttModule != handleTTStubDetSetVec->end();
76  ttModule++) {
77  for (TTStubDetSet::const_iterator ttStub = ttModule->begin(); ttStub != ttModule->end(); ttStub++) {
78  const TTStubRef ttStubRef = makeRefTo(handleTTStubDetSetVec, ttStub);
79  set<TPPtr> tpPtrs;
80  for (unsigned int iClus = 0; iClus < 2; iClus++) {
81  const vector<TPPtr>& assocPtrs = ttClusterAssMap.findTrackingParticlePtrs(ttStubRef->clusterRef(iClus));
82  copy_if(assocPtrs.begin(), assocPtrs.end(), inserter(tpPtrs, tpPtrs.begin()), isNonnull);
83  }
84  for (const TPPtr& tpPtr : tpPtrs)
85  mapTPPtrsTTStubRefs[tpPtr].push_back(ttStubRef);
86  }
87  }
88  // associate reconstructable TrackingParticles with TTStubs
89  StubAssociation reconstructable(&setup);
90  StubAssociation selection(&setup);
91  for (const auto& p : mapTPPtrsTTStubRefs) {
92  if (!setup.useForReconstructable(*p.first) || !setup.reconstructable(p.second))
93  continue;
94  reconstructable.insert(p.first, p.second);
95  if (setup.useForAlgEff(*p.first))
96  selection.insert(p.first, p.second);
97  }
98  iEvent.emplace(putTokenReconstructable_, std::move(reconstructable));
100  }
EDPutTokenT< StubAssociation > putTokenReconstructable_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
selection
main part
Definition: corrVsCorr.py:100
data_type const * const_iterator
Definition: DetSetNew.h:31
const_iterator end(bool update=false) const
int iEvent
Definition: GenABIO.cc:224
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, det_id_type iDetID, typename HandleT::element_type::value_type::const_iterator itIter)
Definition: DetSetVector.h:409
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin(bool update=false) const
EDGetTokenT< TTStubDetSetVec > getTokenTTStubDetSetVec_
EDGetTokenT< TTClusterAssMap > getTokenTTClusterAssMap_
EDPutTokenT< StubAssociation > putTokenSelection_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ esGetTokenSetup_

ESGetToken<Setup, SetupRcd> tt::StubAssociator::esGetTokenSetup_
private

Definition at line 52 of file StubAssociator.cc.

◆ getTokenTTClusterAssMap_

EDGetTokenT<TTClusterAssMap> tt::StubAssociator::getTokenTTClusterAssMap_
private

Definition at line 46 of file StubAssociator.cc.

◆ getTokenTTStubDetSetVec_

EDGetTokenT<TTStubDetSetVec> tt::StubAssociator::getTokenTTStubDetSetVec_
private

Definition at line 44 of file StubAssociator.cc.

◆ putTokenReconstructable_

EDPutTokenT<StubAssociation> tt::StubAssociator::putTokenReconstructable_
private

Definition at line 48 of file StubAssociator.cc.

◆ putTokenSelection_

EDPutTokenT<StubAssociation> tt::StubAssociator::putTokenSelection_
private

Definition at line 50 of file StubAssociator.cc.