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
VertexMerger Class Reference
Inheritance diagram for VertexMerger:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &es)
 
 VertexMerger (const edm::ParameterSet &params)
 
- 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

bool trackFilter (const reco::TrackRef &track) const
 

Private Attributes

double maxFraction
 
double minSignificance
 
edm::InputTag secondaryVertexCollection
 

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)
 
static void prevalidate (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 17 of file VertexMerger.cc.

Constructor & Destructor Documentation

VertexMerger::VertexMerger ( const edm::ParameterSet params)

Definition at line 32 of file VertexMerger.cc.

32  :
33 // primaryVertexCollection(params.getParameter<edm::InputTag>("primaryVertices")),
34  secondaryVertexCollection(params.getParameter<edm::InputTag>("secondaryVertices")),
35  maxFraction(params.getParameter<double>("maxFraction")),
36  minSignificance(params.getParameter<double>("minSignificance"))
37 {
38  produces<reco::VertexCollection>();
39 }
T getParameter(std::string const &) const
edm::InputTag secondaryVertexCollection
Definition: VertexMerger.cc:27
double maxFraction
Definition: VertexMerger.cc:28
double minSignificance
Definition: VertexMerger.cc:29

Member Function Documentation

void VertexMerger::produce ( edm::Event event,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 63 of file VertexMerger.cc.

References computeSharedTracks(), maxFraction, minSignificance, dt_dqm_sourceclient_common_cff::reco, and secondaryVertexCollection.

64 {
65  using namespace reco;
66 
67  edm::Handle<VertexCollection> secondaryVertices;
68  event.getByLabel(secondaryVertexCollection, secondaryVertices);
69 
70  VertexDistance3D dist;
71  std::auto_ptr<VertexCollection> recoVertices(new VertexCollection);
72  for(std::vector<reco::Vertex>::const_iterator sv = secondaryVertices->begin();
73  sv != secondaryVertices->end(); ++sv) {
74  recoVertices->push_back(*sv);
75  }
76  for(std::vector<reco::Vertex>::iterator sv = recoVertices->begin();
77  sv != recoVertices->end(); ++sv) {
78 
79  bool shared=false;
80  for(std::vector<reco::Vertex>::iterator sv2 = recoVertices->begin();
81  sv2 != recoVertices->end(); ++sv2) {
82  double fr=computeSharedTracks(*sv2, *sv);
83  // std::cout << sv2-recoVertices->begin() << " vs " << sv-recoVertices->begin() << " : " << fr << " " << computeSharedTracks(*sv, *sv2) << " sig " << dist.distance(*sv,*sv2).significance() << std::endl;
84  // std::cout << (fr > maxFraction) << " && " << (dist.distance(*sv,*sv2).significance() < 2) << " && " << (sv-sv2!=0) << " && " << (fr >= computeSharedTracks(*sv2, *sv)) << std::endl;
85  if (fr > maxFraction && dist.distance(*sv,*sv2).significance() < minSignificance && sv-sv2!=0
86  && fr >= computeSharedTracks(*sv, *sv2) )
87  {
88  shared=true;
89  // std::cout << "shared " << sv-recoVertices->begin() << " and " << sv2-recoVertices->begin() << " fractions: " << fr << " , " << computeSharedTracks(*sv2, *sv) << " sig: " << dist.distance(*sv,*sv2).significance() << std::endl;
90 
91  }
92 
93 
94  }
95  if(shared) { sv=recoVertices->erase(sv)-1; }
96  // std::cout << "it = " << sv-recoVertices->begin() << " new size is: " << recoVertices->size() << std::endl;
97  }
98 
99  event.put(recoVertices);
100 
101 
102 
103 }
edm::InputTag secondaryVertexCollection
Definition: VertexMerger.cc:27
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
static double computeSharedTracks(const reco::Vertex &pv, const reco::Vertex &sv)
Definition: VertexMerger.cc:41
double maxFraction
Definition: VertexMerger.cc:28
double minSignificance
Definition: VertexMerger.cc:29
bool VertexMerger::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

double VertexMerger::maxFraction
private

Definition at line 28 of file VertexMerger.cc.

Referenced by produce().

double VertexMerger::minSignificance
private

Definition at line 29 of file VertexMerger.cc.

Referenced by produce().

edm::InputTag VertexMerger::secondaryVertexCollection
private

Definition at line 27 of file VertexMerger.cc.

Referenced by produce().