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::stream::EDProducer<>

Public Member Functions

 StubAssociator (const ParameterSet &)
 
 ~StubAssociator () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void beginRun (const Run &, const EventSetup &) override
 
void endJob ()
 
void produce (Event &, const EventSetup &) override
 

Private Attributes

ESGetToken< Setup, SetupRcdesGetTokenSetup_
 
EDGetTokenT< TTClusterAssMapgetTokenTTClusterAssMap_
 
EDGetTokenT< TTStubDetSetVecgetTokenTTStubDetSetVec_
 
EDPutTokenT< StubAssociationputTokenReconstructable_
 
EDPutTokenT< StubAssociationputTokenSelection_
 
const Setupsetup_ = nullptr
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

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 60 of file StubAssociator.cc.

References edm::ParameterSet::getParameter().

60  {
61  // book in- and output ed products
62  getTokenTTStubDetSetVec_ = consumes<TTStubDetSetVec>(iConfig.getParameter<InputTag>("InputTagTTStubDetSetVec"));
63  getTokenTTClusterAssMap_ = consumes<TTClusterAssMap>(iConfig.getParameter<InputTag>("InputTagTTClusterAssMap"));
64  putTokenReconstructable_ = produces<StubAssociation>(iConfig.getParameter<string>("BranchReconstructable"));
65  putTokenSelection_ = produces<StubAssociation>(iConfig.getParameter<string>("BranchSelection"));
66  // book ES product
67  esGetTokenSetup_ = esConsumes<Setup, SetupRcd, Transition::BeginRun>();
68  }
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_

◆ ~StubAssociator()

tt::StubAssociator::~StubAssociator ( )
inlineoverride

Definition at line 40 of file StubAssociator.cc.

40 {}

Member Function Documentation

◆ beginRun()

void tt::StubAssociator::beginRun ( const Run iRun,
const EventSetup iSetup 
)
overrideprivate

Definition at line 70 of file StubAssociator.cc.

References edm::EventSetup::getData().

70  {
71  setup_ = &iSetup.getData(esGetTokenSetup_);
72  }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
const Setup * setup_

◆ endJob()

void tt::StubAssociator::endJob ( void  )
inlineprivate

Definition at line 45 of file StubAssociator.cc.

45 {}

◆ produce()

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

Definition at line 74 of file StubAssociator.cc.

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

74  {
75  // associate TTStubs with TrackingParticles
76  Handle<TTStubDetSetVec> handleTTStubDetSetVec;
77  iEvent.getByToken<TTStubDetSetVec>(getTokenTTStubDetSetVec_, handleTTStubDetSetVec);
78  Handle<TTClusterAssMap> handleTTClusterAssMap;
79  Handle<TTStubAssMap> handleTTStubAssMap;
80  iEvent.getByToken<TTClusterAssMap>(getTokenTTClusterAssMap_, handleTTClusterAssMap);
81  map<TPPtr, vector<TTStubRef>> mapTPPtrsTTStubRefs;
82  auto isNonnull = [](const TPPtr& tpPtr) { return tpPtr.isNonnull(); };
83  for (TTStubDetSetVec::const_iterator ttModule = handleTTStubDetSetVec->begin();
84  ttModule != handleTTStubDetSetVec->end();
85  ttModule++) {
86  for (TTStubDetSet::const_iterator ttStub = ttModule->begin(); ttStub != ttModule->end(); ttStub++) {
87  const TTStubRef ttStubRef = makeRefTo(handleTTStubDetSetVec, ttStub);
88  set<TPPtr> tpPtrs;
89  for (unsigned int iClus = 0; iClus < 2; iClus++) {
90  const vector<TPPtr>& assocPtrs =
91  handleTTClusterAssMap->findTrackingParticlePtrs(ttStubRef->clusterRef(iClus));
92  copy_if(assocPtrs.begin(), assocPtrs.end(), inserter(tpPtrs, tpPtrs.begin()), isNonnull);
93  }
94  for (const TPPtr& tpPtr : tpPtrs)
95  mapTPPtrsTTStubRefs[tpPtr].push_back(ttStubRef);
96  }
97  }
98  // associate reconstructable TrackingParticles with TTStubs
99  StubAssociation reconstructable(setup_);
100  StubAssociation selection(setup_);
101  for (const auto& p : mapTPPtrsTTStubRefs) {
102  if (!setup_->useForReconstructable(*p.first) || !setup_->reconstructable(p.second))
103  continue;
104  reconstructable.insert(p.first, p.second);
105  if (setup_->useForAlgEff(*p.first))
106  selection.insert(p.first, p.second);
107  }
108  iEvent.emplace(putTokenReconstructable_, std::move(reconstructable));
110  }
EDPutTokenT< StubAssociation > putTokenReconstructable_
selection
main part
Definition: corrVsCorr.py:100
data_type const * const_iterator
Definition: DetSetNew.h:31
bool useForAlgEff(const TrackingParticle &tp) const
Definition: Setup.cc:646
const_iterator end(bool update=false) const
Stores association of Truth Particles (TP) to L1 Track-Trigger Clusters.
int iEvent
Definition: GenABIO.cc:224
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
bool reconstructable(const std::vector< TTStubRef > &ttStubRefs) const
Definition: Setup.cc:638
bool useForReconstructable(const TrackingParticle &tp) const
Definition: Setup.h:96
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin(bool update=false) const
EDGetTokenT< TTStubDetSetVec > getTokenTTStubDetSetVec_
EDGetTokenT< TTClusterAssMap > getTokenTTClusterAssMap_
EDPutTokenT< StubAssociation > putTokenSelection_
const Setup * setup_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ esGetTokenSetup_

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

Definition at line 57 of file StubAssociator.cc.

◆ getTokenTTClusterAssMap_

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

Definition at line 51 of file StubAssociator.cc.

◆ getTokenTTStubDetSetVec_

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

Definition at line 49 of file StubAssociator.cc.

◆ putTokenReconstructable_

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

Definition at line 53 of file StubAssociator.cc.

◆ putTokenSelection_

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

Definition at line 55 of file StubAssociator.cc.

◆ setup_

const Setup* tt::StubAssociator::setup_ = nullptr
private

Definition at line 47 of file StubAssociator.cc.

Referenced by upgradeWorkflowComponents.UpgradeWorkflow::setup().