CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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 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)
 

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 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
 
- 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 41 of file ElectronSeedMerger.cc.

References edm::ParameterSet::getParameter().

42  : ecalSeedToken_{consumes<ElectronSeedCollection>(iConfig.getParameter<InputTag>("EcalBasedSeeds"))} {
43  edm::InputTag tkSeedLabel_ = iConfig.getParameter<InputTag>("TkBasedSeeds");
44  if (!tkSeedLabel_.label().empty())
45  tkSeedToken_ = consumes<ElectronSeedCollection>(tkSeedLabel_);
46 
47  produces<ElectronSeedCollection>();
48 }
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

◆ fillDescriptions()

void ElectronSeedMerger::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 34 of file ElectronSeedMerger.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

34  {
36  desc.add<edm::InputTag>("EcalBasedSeeds", edm::InputTag("ecalDrivenElectronSeeds"));
37  desc.add<edm::InputTag>("TkBasedSeeds", edm::InputTag("trackerDrivenElectronSeeds:SeedsForGsf"));
38  descriptions.addWithDefaultLabel(desc);
39 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 51 of file ElectronSeedMerger.cc.

References TrackingRecHit::all, iEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, eostools::move(), and TrackingRecHit::some.

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

◆ tkSeedToken_

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

Definition at line 27 of file ElectronSeedMerger.cc.