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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 ECAL SEED
77  TrajectorySeed::const_iterator eh = e_beg->recHits().first;
78  TrajectorySeed::const_iterator eh_end = e_beg->recHits().second;
79 
80  //HITS FOR TK SEED
81  unsigned int hitShared = 0;
82  unsigned int hitSeed = 0;
83  for (; eh != eh_end; ++eh) {
84  if (!eh->isValid())
85  continue;
86  hitSeed++;
87  bool Shared = false;
88  TrajectorySeed::const_iterator th = TSeed[it].recHits().first;
89  TrajectorySeed::const_iterator th_end = TSeed[it].recHits().second;
90  for (; th != th_end; ++th) {
91  if (!th->isValid())
92  continue;
93  //CHECK THE HIT COMPATIBILITY: put back sharesInput
94  // as soon Egamma solves the bug on the seed collection
95  if (eh->sharesInput(&(*th), TrackingRecHit::all))
96  Shared = true;
97  // if(eh->geographicalId() == th->geographicalId() &&
98  // (eh->localPosition() - th->localPosition()).mag() < 0.001) Shared=true;
99  }
100  if (Shared)
101  hitShared++;
102  }
103  if (hitShared == hitSeed) {
104  AlreadyMatched = true;
105  TSeedMatched[it] = true;
106  NewSeed.setCtfTrack(TSeed[it].ctfTrack());
107  }
108  if (hitShared == (hitSeed - 1)) {
109  NewSeed.setCtfTrack(TSeed[it].ctfTrack());
110  }
111  }
112 
113  output->push_back(NewSeed);
114  }
115 
116  //FILL THE COLLECTION WITH UNMATCHED TK-BASED SEED
117  for (unsigned int it = 0; it < TSeed.size(); it++) {
118  if (!TSeedMatched[it])
119  output->push_back(TSeed[it]);
120  }
121 
122  //PUT THE MERGED COLLECTION IN THE EVENT
123  iEvent.put(std::move(output));
124 }

References TrackingRecHit::all, mergedElectronSeeds_cfi::EcalBasedSeeds, ecalSeedToken_, iEvent, edm::EDGetTokenT< T >::isUninitialized(), eostools::move(), convertSQLitetoXML_cfg::output, TrajectorySeed::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:32
TrajectorySeed::const_iterator
recHitContainer::const_iterator const_iterator
Definition: TrajectorySeed.h:20
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
edm::EDGetTokenT::isUninitialized
bool isUninitialized() const
Definition: EDGetToken.h:70
reco::ElectronSeedCollection
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
Definition: ElectronSeedFwd.h:10
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrajectorySeed::recHits
range recHits() const
Definition: TrajectorySeed.h:52
edm::InputTag
Definition: InputTag.h:15
mergedElectronSeeds_cfi.EcalBasedSeeds
EcalBasedSeeds
Definition: mergedElectronSeeds_cfi.py:5