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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &es) override
 
 VertexMerger (const edm::ParameterSet &params)
 
- 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
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

double maxFraction
 
double minSignificance
 
edm::EDGetTokenT
< reco::VertexCollection
token_secondaryVertex
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 17 of file VertexMerger.cc.

Constructor & Destructor Documentation

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

Definition at line 31 of file VertexMerger.cc.

References edm::ParameterSet::getParameter(), and token_secondaryVertex.

31  :
32  maxFraction(params.getParameter<double>("maxFraction")),
33  minSignificance(params.getParameter<double>("minSignificance"))
34 {
35  token_secondaryVertex = consumes<reco::VertexCollection>(params.getParameter<edm::InputTag>("secondaryVertices"));
36  produces<reco::VertexCollection>();
37 }
T getParameter(std::string const &) const
double maxFraction
Definition: VertexMerger.cc:27
double minSignificance
Definition: VertexMerger.cc:28
edm::EDGetTokenT< reco::VertexCollection > token_secondaryVertex
Definition: VertexMerger.cc:26

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 61 of file VertexMerger.cc.

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

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

Member Data Documentation

double VertexMerger::maxFraction
private

Definition at line 27 of file VertexMerger.cc.

Referenced by produce().

double VertexMerger::minSignificance
private

Definition at line 28 of file VertexMerger.cc.

Referenced by produce().

edm::EDGetTokenT<reco::VertexCollection> VertexMerger::token_secondaryVertex
private

Definition at line 26 of file VertexMerger.cc.

Referenced by produce(), and VertexMerger().