test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TemplatedVertexMerger< VTX > Class Template Reference
Inheritance diagram for TemplatedVertexMerger< VTX >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< VTX > Product
 
- 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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

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

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

Private Attributes

double maxFraction
 
double minSignificance
 
edm::EDGetTokenT< Producttoken_secondaryVertex
 

Additional Inherited Members

- 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

template<class VTX>
class TemplatedVertexMerger< VTX >

Definition at line 22 of file VertexMerger.cc.

Member Typedef Documentation

template<class VTX >
typedef std::vector<VTX> TemplatedVertexMerger< VTX >::Product

Definition at line 24 of file VertexMerger.cc.

Constructor & Destructor Documentation

template<class VTX >
TemplatedVertexMerger< VTX >::TemplatedVertexMerger ( const edm::ParameterSet params)

Definition at line 38 of file VertexMerger.cc.

References edm::ParameterSet::getParameter(), and TemplatedVertexMerger< VTX >::token_secondaryVertex.

38  :
39  maxFraction(params.getParameter<double>("maxFraction")),
40  minSignificance(params.getParameter<double>("minSignificance"))
41 {
42  token_secondaryVertex = consumes<Product>(params.getParameter<edm::InputTag>("secondaryVertices"));
43  produces<Product>();
44 }
T getParameter(std::string const &) const
edm::EDGetTokenT< Product > token_secondaryVertex
Definition: VertexMerger.cc:32

Member Function Documentation

template<class VTX >
void TemplatedVertexMerger< VTX >::produce ( edm::Event event,
const edm::EventSetup es 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 47 of file VertexMerger.cc.

References vertexTools::computeSharedTracks(), RecoVertex::convertError(), RecoVertex::convertPos(), HLT_25ns10e33_v2_cff::maxFraction, HLT_25ns10e33_v2_cff::minSignificance, eostools::move(), dt_dqm_sourceclient_common_cff::reco, indexGen::s2, and HLT_25ns10e33_v2_cff::secondaryVertices.

48 {
49  using namespace reco;
50 
52  event.getByToken(token_secondaryVertex, secondaryVertices);
53 
54  VertexDistance3D dist;
55  auto recoVertices = std::make_unique<Product>();
56  for(typename Product::const_iterator sv = secondaryVertices->begin();
57  sv != secondaryVertices->end(); ++sv) {
58  recoVertices->push_back(*sv);
59  }
60  for(typename Product::iterator sv = recoVertices->begin();
61  sv != recoVertices->end(); ++sv) {
62 
63  bool shared=false;
64  VertexState s1(RecoVertex::convertPos(sv->position()),RecoVertex::convertError(sv->error()));
65  for(typename Product::iterator sv2 = recoVertices->begin();
66  sv2 != recoVertices->end(); ++sv2) {
67  VertexState s2(RecoVertex::convertPos(sv2->position()),RecoVertex::convertError(sv2->error()));
68  double fr=vertexTools::computeSharedTracks(*sv2, *sv);
69  // std::cout << sv2-recoVertices->begin() << " vs " << sv-recoVertices->begin() << " : " << fr << " " << computeSharedTracks(*sv, *sv2) << " sig " << dist.distance(*sv,*sv2).significance() << std::endl;
70  // std::cout << (fr > maxFraction) << " && " << (dist.distance(*sv,*sv2).significance() < 2) << " && " << (sv-sv2!=0) << " && " << (fr >= computeSharedTracks(*sv2, *sv)) << std::endl;
71  if (fr > maxFraction && dist.distance(s1,s2).significance() < minSignificance && sv-sv2!=0
72  && fr >= vertexTools::computeSharedTracks(*sv, *sv2) )
73  {
74  shared=true;
75  // std::cout << "shared " << sv-recoVertices->begin() << " and " << sv2-recoVertices->begin() << " fractions: " << fr << " , " << computeSharedTracks(*sv2, *sv) << " sig: " << dist.distance(*sv,*sv2).significance() << std::endl;
76 
77  }
78 
79 
80  }
81  if(shared) { sv=recoVertices->erase(sv)-1; }
82  // std::cout << "it = " << sv-recoVertices->begin() << " new size is: " << recoVertices->size() << std::endl;
83  }
84 
85  event.put(std::move(recoVertices));
86 
87 
88 
89 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
edm::EDGetTokenT< Product > token_secondaryVertex
Definition: VertexMerger.cc:32
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
double computeSharedTracks(const reco::Vertex &pv, const std::vector< reco::TrackRef > &svTracks, double minTrackWeight=0.5, float unused=0)
Definition: SharedTracks.cc:4
tuple s2
Definition: indexGen.py:106
def move
Definition: eostools.py:510
template<class VTX >
bool TemplatedVertexMerger< VTX >::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

template<class VTX >
double TemplatedVertexMerger< VTX >::maxFraction
private

Definition at line 33 of file VertexMerger.cc.

template<class VTX >
double TemplatedVertexMerger< VTX >::minSignificance
private

Definition at line 34 of file VertexMerger.cc.

template<class VTX >
edm::EDGetTokenT<Product> TemplatedVertexMerger< VTX >::token_secondaryVertex
private

Definition at line 32 of file VertexMerger.cc.

Referenced by TemplatedVertexMerger< VTX >::TemplatedVertexMerger().