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

References edm::ParameterSet::getParameter().

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

References edm::EventSetup::getData().

71  {
72  setup_ = &iSetup.getData(esGetTokenSetup_);
73  }
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 75 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.

75  {
76  // associate TTStubs with TrackingParticles
77  Handle<TTStubDetSetVec> handleTTStubDetSetVec;
78  iEvent.getByToken<TTStubDetSetVec>(getTokenTTStubDetSetVec_, handleTTStubDetSetVec);
79  Handle<TTClusterAssMap> handleTTClusterAssMap;
80  Handle<TTStubAssMap> handleTTStubAssMap;
81  iEvent.getByToken<TTClusterAssMap>(getTokenTTClusterAssMap_, handleTTClusterAssMap);
82  map<TPPtr, vector<TTStubRef>> mapTPPtrsTTStubRefs;
83  auto isNonnull = [](const TPPtr& tpPtr) { return tpPtr.isNonnull(); };
84  for (TTStubDetSetVec::const_iterator ttModule = handleTTStubDetSetVec->begin();
85  ttModule != handleTTStubDetSetVec->end();
86  ttModule++) {
87  for (TTStubDetSet::const_iterator ttStub = ttModule->begin(); ttStub != ttModule->end(); ttStub++) {
88  const TTStubRef ttStubRef = makeRefTo(handleTTStubDetSetVec, ttStub);
89  set<TPPtr> tpPtrs;
90  for (unsigned int iClus = 0; iClus < 2; iClus++) {
91  const vector<TPPtr>& assocPtrs =
92  handleTTClusterAssMap->findTrackingParticlePtrs(ttStubRef->clusterRef(iClus));
93  copy_if(assocPtrs.begin(), assocPtrs.end(), inserter(tpPtrs, tpPtrs.begin()), isNonnull);
94  }
95  for (const TPPtr& tpPtr : tpPtrs)
96  mapTPPtrsTTStubRefs[tpPtr].push_back(ttStubRef);
97  }
98  }
99  // associate reconstructable TrackingParticles with TTStubs
100  StubAssociation reconstructable(setup_);
101  StubAssociation selection(setup_);
102  for (const auto& p : mapTPPtrsTTStubRefs) {
103  if (!setup_->useForReconstructable(*p.first) || !setup_->reconstructable(p.second))
104  continue;
105  reconstructable.insert(p.first, p.second);
106  if (setup_->useForAlgEff(*p.first))
107  selection.insert(p.first, p.second);
108  }
109  iEvent.emplace(putTokenReconstructable_, std::move(reconstructable));
111  }
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:642
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:634
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 58 of file StubAssociator.cc.

◆ getTokenTTClusterAssMap_

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

Definition at line 52 of file StubAssociator.cc.

◆ getTokenTTStubDetSetVec_

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

Definition at line 50 of file StubAssociator.cc.

◆ putTokenReconstructable_

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

Definition at line 54 of file StubAssociator.cc.

◆ putTokenSelection_

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

Definition at line 56 of file StubAssociator.cc.

◆ setup_

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

Definition at line 48 of file StubAssociator.cc.

Referenced by upgradeWorkflowComponents.UpgradeWorkflow::setup().