CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ElectronSeedMerger Class Reference
Inheritance diagram for ElectronSeedMerger:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronSeedMerger (const edm::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 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 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 (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

const edm::EDGetTokenT< reco::ElectronSeedCollectionecalSeedToken_
 
edm::EDGetTokenT< reco::ElectronSeedCollectiontkSeedToken_
 

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

Definition at line 18 of file ElectronSeedMerger.cc.

Constructor & Destructor Documentation

◆ ElectronSeedMerger()

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

Definition at line 33 of file ElectronSeedMerger.cc.

References edm::ParameterSet::getParameter().

34  : ecalSeedToken_{consumes<ElectronSeedCollection>(iConfig.getParameter<InputTag>("EcalBasedSeeds"))} {
35  edm::InputTag tkSeedLabel_ = iConfig.getParameter<InputTag>("TkBasedSeeds");
36  if (!tkSeedLabel_.label().empty())
37  tkSeedToken_ = consumes<ElectronSeedCollection>(tkSeedLabel_);
38 
39  produces<ElectronSeedCollection>();
40 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< reco::ElectronSeedCollection > tkSeedToken_
const edm::EDGetTokenT< reco::ElectronSeedCollection > ecalSeedToken_

Member Function Documentation

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 43 of file ElectronSeedMerger.cc.

References TrackingRecHit::all, ecalSeedToken_, iEvent, edm::EDGetTokenT< T >::isUninitialized(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, eostools::move(), TrackingRecHit::some, and tkSeedToken_.

43  {
44  //HANDLE THE INPUT SEED COLLECTIONS
45  auto const& eSeeds = iEvent.get(ecalSeedToken_);
46 
47  ElectronSeedCollection tSeedsEmpty;
48  auto const& tSeeds = tkSeedToken_.isUninitialized() ? tSeedsEmpty : iEvent.get(tkSeedToken_);
49 
50  //CREATE OUTPUT COLLECTION
51  auto output = std::make_unique<ElectronSeedCollection>();
52  output->reserve(eSeeds.size() + tSeeds.size());
53 
54  //VECTOR FOR MATCHED SEEDS
55  vector<bool> tSeedsMatched(tSeeds.size(), false);
56 
57  //LOOP OVER THE ECAL SEED COLLECTION
58  for (auto newSeed : eSeeds) { // make a copy
59 
60  //LOOP OVER THE TK SEED COLLECTION
61  int it = -1;
62  for (auto const& tSeed : tSeeds) {
63  it++;
64 
65  //HITS FOR TK SEED
66  unsigned int hitShared = 0;
67  unsigned int hitSeed = 0;
68  for (auto const& eh : newSeed.recHits()) {
69  if (!eh.isValid())
70  continue;
71  hitSeed++;
72 
73  for (auto const& th : tSeed.recHits()) {
74  if (!th.isValid())
75  continue;
76  //CHECK THE HIT COMPATIBILITY
77  if (eh.sharesInput(&th, TrackingRecHit::all)) {
78  hitShared++;
79  break;
80  }
81  }
82  }
83  if (hitShared == hitSeed) {
84  tSeedsMatched[it] = true;
85  newSeed.setCtfTrack(tSeed.ctfTrack());
86  break;
87  }
88  if (hitShared == (hitSeed - 1)) {
89  newSeed.setCtfTrack(tSeed.ctfTrack());
90  } else if ((hitShared > 0 || tSeed.nHits() == 0) && !newSeed.isTrackerDriven()) {
91  //try to find hits in the full track
92  unsigned int hitSharedOnTrack = 0;
93  for (auto const& eh : newSeed.recHits()) {
94  if (!eh.isValid())
95  continue;
96  for (auto const* th : tSeed.ctfTrack()->recHits()) {
97  if (!th->isValid())
98  continue;
99  // hits on tracks are not matched : use ::some
100  if (eh.sharesInput(th, TrackingRecHit::some)) {
101  hitSharedOnTrack++;
102  break;
103  }
104  }
105  }
106  if (hitSharedOnTrack == hitSeed) {
107  tSeedsMatched[it] = true;
108  newSeed.setCtfTrack(tSeed.ctfTrack());
109  break;
110  }
111  if (hitSharedOnTrack == (hitSeed - 1)) {
112  newSeed.setCtfTrack(tSeed.ctfTrack());
113  }
114  }
115  }
116 
117  output->push_back(newSeed);
118  }
119 
120  //FILL THE COLLECTION WITH UNMATCHED TK-BASED SEED
121  for (unsigned int it = 0; it < tSeeds.size(); it++) {
122  if (!tSeedsMatched[it])
123  output->push_back(tSeeds[it]);
124  }
125 
126  //PUT THE MERGED COLLECTION IN THE EVENT
127  iEvent.put(std::move(output));
128 }
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:104
int iEvent
Definition: GenABIO.cc:224
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
edm::EDGetTokenT< reco::ElectronSeedCollection > tkSeedToken_
Definition: output.py:1
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< reco::ElectronSeedCollection > ecalSeedToken_

Member Data Documentation

◆ ecalSeedToken_

const edm::EDGetTokenT<reco::ElectronSeedCollection> ElectronSeedMerger::ecalSeedToken_
private

Definition at line 25 of file ElectronSeedMerger.cc.

Referenced by produce().

◆ tkSeedToken_

edm::EDGetTokenT<reco::ElectronSeedCollection> ElectronSeedMerger::tkSeedToken_
private

Definition at line 26 of file ElectronSeedMerger.cc.

Referenced by produce().