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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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
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<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 17 of file ElectronSeedMerger.cc.

Constructor & Destructor Documentation

◆ ElectronSeedMerger()

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

Definition at line 32 of file ElectronSeedMerger.cc.

33  : ecalSeedToken_{consumes<ElectronSeedCollection>(iConfig.getParameter<InputTag>("EcalBasedSeeds"))} {
34  edm::InputTag tkSeedLabel_ = iConfig.getParameter<InputTag>("TkBasedSeeds");
35  if (!tkSeedLabel_.label().empty())
36  tkSeedToken_ = consumes<ElectronSeedCollection>(tkSeedLabel_);
37 
38  produces<ElectronSeedCollection>();
39 }

References edm::ParameterSet::getParameter().

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

42  {
43  //CREATE OUTPUT COLLECTION
44  auto output = std::make_unique<ElectronSeedCollection>();
45 
46  //HANDLE THE INPUT SEED COLLECTIONS
49  ElectronSeedCollection ESeed = *(EcalBasedSeeds.product());
50 
54  iEvent.getByToken(tkSeedToken_, TkBasedSeeds);
55  TSeed = *(TkBasedSeeds.product());
56  }
57 
58  //VECTOR FOR MATCHED SEEDS
59  vector<bool> TSeedMatched;
60  for (unsigned int it = 0; it < TSeed.size(); it++) {
61  TSeedMatched.push_back(false);
62  }
63 
64  //LOOP OVER THE ECAL SEED COLLECTION
65  ElectronSeedCollection::const_iterator e_beg = ESeed.begin();
66  ElectronSeedCollection::const_iterator e_end = ESeed.end();
67  for (; e_beg != e_end; ++e_beg) {
68  ElectronSeed NewSeed = *(e_beg);
69  bool AlreadyMatched = false;
70 
71  //LOOP OVER THE TK SEED COLLECTION
72  for (unsigned int it = 0; it < TSeed.size(); it++) {
73  if (AlreadyMatched)
74  continue;
75 
76  //HITS FOR TK SEED
77  unsigned int hitShared = 0;
78  unsigned int hitSeed = 0;
79  for (auto const& eh : e_beg->recHits()) {
80  if (!eh.isValid())
81  continue;
82  hitSeed++;
83  bool Shared = false;
84  for (auto const& th : TSeed[it].recHits()) {
85  if (!th.isValid())
86  continue;
87  //CHECK THE HIT COMPATIBILITY: put back sharesInput
88  // as soon Egamma solves the bug on the seed collection
89  if (eh.sharesInput(&th, TrackingRecHit::all))
90  Shared = true;
91  // if(eh->geographicalId() == th->geographicalId() &&
92  // (eh->localPosition() - th->localPosition()).mag() < 0.001) Shared=true;
93  }
94  if (Shared)
95  hitShared++;
96  }
97  if (hitShared == hitSeed) {
98  AlreadyMatched = true;
99  TSeedMatched[it] = true;
100  NewSeed.setCtfTrack(TSeed[it].ctfTrack());
101  }
102  if (hitShared == (hitSeed - 1)) {
103  NewSeed.setCtfTrack(TSeed[it].ctfTrack());
104  }
105  }
106 
107  output->push_back(NewSeed);
108  }
109 
110  //FILL THE COLLECTION WITH UNMATCHED TK-BASED SEED
111  for (unsigned int it = 0; it < TSeed.size(); it++) {
112  if (!TSeedMatched[it])
113  output->push_back(TSeed[it]);
114  }
115 
116  //PUT THE MERGED COLLECTION IN THE EVENT
117  iEvent.put(std::move(output));
118 }

References TrackingRecHit::all, mergedElectronSeeds_cfi::EcalBasedSeeds, ecalSeedToken_, iEvent, edm::EDGetTokenT< T >::isUninitialized(), eostools::move(), convertSQLitetoXML_cfg::output, FastTrackerRecHitMaskProducer_cfi::recHits, reco::ElectronSeed::setCtfTrack(), mergedElectronSeeds_cfi::TkBasedSeeds, and tkSeedToken_.

Member Data Documentation

◆ ecalSeedToken_

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

Definition at line 24 of file ElectronSeedMerger.cc.

Referenced by produce().

◆ tkSeedToken_

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

Definition at line 25 of file ElectronSeedMerger.cc.

Referenced by produce().

convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::EDGetTokenT::isUninitialized
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
edm::Handle
Definition: AssociativeIterator.h:50
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
reco::ElectronSeed
Definition: ElectronSeed.h:51
ElectronSeedMerger::tkSeedToken_
edm::EDGetTokenT< reco::ElectronSeedCollection > tkSeedToken_
Definition: ElectronSeedMerger.cc:25
reco::ElectronSeedCollection
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
Definition: ElectronSeedFwd.h:10
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
TrackingRecHit::all
Definition: TrackingRecHit.h:59
mergedElectronSeeds_cfi.TkBasedSeeds
TkBasedSeeds
Definition: mergedElectronSeeds_cfi.py:6
reco::ElectronSeed::setCtfTrack
void setCtfTrack(const CtfTrackRef &)
Set additional info.
Definition: ElectronSeed.cc:39
iEvent
int iEvent
Definition: GenABIO.cc:224
ElectronSeedMerger::ecalSeedToken_
const edm::EDGetTokenT< reco::ElectronSeedCollection > ecalSeedToken_
Definition: ElectronSeedMerger.cc:24
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::InputTag
Definition: InputTag.h:15
mergedElectronSeeds_cfi.EcalBasedSeeds
EcalBasedSeeds
Definition: mergedElectronSeeds_cfi.py:5