CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ElectronSeedMerger Class Reference

#include <ElectronSeedMerger.h>

Inheritance diagram for ElectronSeedMerger:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronSeedMerger (const edm::ParameterSet &)
 
 ~ElectronSeedMerger ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ParameterSet conf_
 
edm::EDGetTokenT< reco::ElectronSeedCollectionecalSeedToken_
 SEED COLLECTIONS. More...
 
edm::EDGetTokenT< reco::ElectronSeedCollectiontkSeedToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 14 of file ElectronSeedMerger.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file ElectronSeedMerger.cc.

References ecalSeedToken_, edm::ParameterSet::getParameter(), and tkSeedToken_.

21  :
22  conf_(iConfig)
23 {
24  LogInfo("ElectronSeedMerger")<<"Electron SeedMerger started ";
25 
26 
27  ecalSeedToken_ = consumes<ElectronSeedCollection>(iConfig.getParameter<InputTag>("EcalBasedSeeds"));
28  tkSeedToken_ = consumes<ElectronSeedCollection>(iConfig.getParameter<InputTag>("TkBasedSeeds"));
29 
30  produces<ElectronSeedCollection>();
31 
32 }
T getParameter(std::string const &) const
edm::ParameterSet conf_
edm::EDGetTokenT< reco::ElectronSeedCollection > ecalSeedToken_
SEED COLLECTIONS.
edm::EDGetTokenT< reco::ElectronSeedCollection > tkSeedToken_
ElectronSeedMerger::~ElectronSeedMerger ( )

Definition at line 35 of file ElectronSeedMerger.cc.

36 {
37 
38  // do anything here that needs to be done at desctruction time
39  // (e.g. close files, deallocate resources etc.)
40 
41 }

Member Function Documentation

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

Definition at line 50 of file ElectronSeedMerger.cc.

References TrackingRecHit::all, mergedElectronSeeds_cfi::EcalBasedSeeds, ecalSeedToken_, edm::Event::getByToken(), eostools::move(), convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::Event::put(), TrajectorySeed::recHits(), reco::ElectronSeed::setCtfTrack(), mergedElectronSeeds_cfi::TkBasedSeeds, and tkSeedToken_.

51 {
52  //CREATE OUTPUT COLLECTION
53  auto output = std::make_unique<ElectronSeedCollection>();
54 
55  //HANDLE THE INPUT SEED COLLECTIONS
57  iEvent.getByToken(ecalSeedToken_,EcalBasedSeeds);
58  ElectronSeedCollection ESeed = *(EcalBasedSeeds.product());
59 
61  iEvent.getByToken(tkSeedToken_,TkBasedSeeds);
62  ElectronSeedCollection TSeed = *(TkBasedSeeds.product());
63 
64 
65  //VECTOR FOR MATCHED SEEDS
66  vector<bool> TSeedMatched;
67  for (unsigned int it=0;it<TSeed.size();it++){
68  TSeedMatched.push_back(false);
69  }
70 
71 
72  //LOOP OVER THE ECAL SEED COLLECTION
73  ElectronSeedCollection::const_iterator e_beg= ESeed.begin();
74  ElectronSeedCollection::const_iterator e_end= ESeed.end();
75  for (;e_beg!=e_end;++e_beg){
76 
77  ElectronSeed NewSeed=*(e_beg);
78  bool AlreadyMatched =false;
79 
80  //LOOP OVER THE TK SEED COLLECTION
81  for (unsigned int it=0;it<TSeed.size();it++){
82  if (AlreadyMatched) continue;
83 
84  //HITS FOR ECAL SEED
85  TrajectorySeed::const_iterator eh = e_beg->recHits().first;
86  TrajectorySeed::const_iterator eh_end = e_beg->recHits().second;
87 
88  //HITS FOR TK SEED
89  unsigned int hitShared=0;
90  unsigned int hitSeed=0;
91  for (;eh!=eh_end;++eh){
92 
93  if (!eh->isValid()) continue;
94  hitSeed++;
95  bool Shared=false;
96  TrajectorySeed::const_iterator th = TSeed[it].recHits().first;
97  TrajectorySeed::const_iterator th_end = TSeed[it].recHits().second;
98  for (;th!=th_end;++th){
99  if (!th->isValid()) continue;
100  //CHECK THE HIT COMPATIBILITY: put back sharesInput
101  // as soon Egamma solves the bug on the seed collection
102  if (eh->sharesInput(&(*th),TrackingRecHit::all)) Shared = true;
103  // if(eh->geographicalId() == th->geographicalId() &&
104 // (eh->localPosition() - th->localPosition()).mag() < 0.001) Shared=true;
105  }
106  if (Shared) hitShared++;
107  }
108  if (hitShared==hitSeed){
109  AlreadyMatched=true;
110  TSeedMatched[it]=true;
111  NewSeed.setCtfTrack(TSeed[it].ctfTrack());
112  }
113  if ( hitShared == (hitSeed-1)){
114  NewSeed.setCtfTrack(TSeed[it].ctfTrack());
115  }
116  }
117 
118  output->push_back(NewSeed);
119  }
120 
121  //FILL THE COLLECTION WITH UNMATCHED TK-BASED SEED
122  for (unsigned int it=0;it<TSeed.size();it++){
123  if (!TSeedMatched[it]) output->push_back(TSeed[it]);
124  }
125 
126  //PUT THE MERGED COLLECTION IN THE EVENT
127  iEvent.put(std::move(output));
128 
129 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void setCtfTrack(const CtfTrackRef &)
Set additional info.
Definition: ElectronSeed.cc:35
recHitContainer::const_iterator const_iterator
edm::EDGetTokenT< reco::ElectronSeedCollection > ecalSeedToken_
SEED COLLECTIONS.
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
T const * product() const
Definition: Handle.h:81
range recHits() const
edm::EDGetTokenT< reco::ElectronSeedCollection > tkSeedToken_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::ParameterSet ElectronSeedMerger::conf_
private

Definition at line 23 of file ElectronSeedMerger.h.

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

SEED COLLECTIONS.

Definition at line 26 of file ElectronSeedMerger.h.

Referenced by ElectronSeedMerger(), and produce().

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

Definition at line 27 of file ElectronSeedMerger.h.

Referenced by ElectronSeedMerger(), and produce().