CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ElectronSeedMerger Class Reference

#include <ElectronSeedMerger.h>

Inheritance diagram for ElectronSeedMerger:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronSeedMerger (const edm::ParameterSet &)
 
 ~ElectronSeedMerger ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

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

Private Attributes

edm::ParameterSet conf_
 
edm::InputTag ecalBasedSeeds_
 SEED COLLECTIONS. More...
 
edm::InputTag tkBasedSeeds_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 13 of file ElectronSeedMerger.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file ElectronSeedMerger.cc.

References ecalBasedSeeds_, edm::ParameterSet::getParameter(), and tkBasedSeeds_.

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

Definition at line 36 of file ElectronSeedMerger.cc.

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

Member Function Documentation

virtual void ElectronSeedMerger::beginJob ( void  )
inlineprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 19 of file ElectronSeedMerger.h.

19 {} ;
virtual void ElectronSeedMerger::endJob ( void  )
inlineprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 21 of file ElectronSeedMerger.h.

21 {}
void ElectronSeedMerger::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 51 of file ElectronSeedMerger.cc.

References TrackingRecHit::all, ecalBasedSeeds_, edm::Event::getByLabel(), convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::Event::put(), TrajectorySeed::recHits(), reco::ElectronSeed::setCtfTrack(), and tkBasedSeeds_.

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

Member Data Documentation

edm::ParameterSet ElectronSeedMerger::conf_
private

Definition at line 24 of file ElectronSeedMerger.h.

edm::InputTag ElectronSeedMerger::ecalBasedSeeds_
private

SEED COLLECTIONS.

Definition at line 27 of file ElectronSeedMerger.h.

Referenced by ElectronSeedMerger(), and produce().

edm::InputTag ElectronSeedMerger::tkBasedSeeds_
private

Definition at line 28 of file ElectronSeedMerger.h.

Referenced by ElectronSeedMerger(), and produce().