CMS 3D CMS Logo

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<>

Public Types

typedef std::vector< VTX > Product
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

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

Private Attributes

double maxFraction
 
double minSignificance
 
edm::EDGetTokenT< Producttoken_secondaryVertex
 

Detailed Description

template<class VTX>
class TemplatedVertexMerger< VTX >

Definition at line 22 of file VertexMerger.cc.

Member Typedef Documentation

◆ Product

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

Definition at line 24 of file VertexMerger.cc.

Constructor & Destructor Documentation

◆ TemplatedVertexMerger()

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

Definition at line 38 of file VertexMerger.cc.

References submitPVValidationJobs::params, and TemplatedVertexMerger< VTX >::token_secondaryVertex.

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

Member Function Documentation

◆ produce()

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

Definition at line 46 of file VertexMerger.cc.

References vertexTools::computeSharedTracks(), RecoVertex::convertError(), RecoVertex::convertPos(), VertexDistance3D::distance(), HLT_2024v13_cff::maxFraction, HLT_2024v13_cff::minSignificance, eostools::move(), HLT_2024v13_cff::secondaryVertices, Measurement1D::significance(), and pfDeepBoostedJetPreprocessParams_cfi::sv.

46  {
47  using namespace reco;
48 
50  event.getByToken(token_secondaryVertex, secondaryVertices);
51 
52  VertexDistance3D dist;
53  auto recoVertices = std::make_unique<Product>();
54  for (typename Product::const_iterator sv = secondaryVertices->begin(); sv != secondaryVertices->end(); ++sv) {
55  recoVertices->push_back(*sv);
56  }
57  for (typename Product::iterator sv = recoVertices->begin(); sv != recoVertices->end(); ++sv) {
58  bool shared = false;
60  for (typename Product::iterator sv2 = recoVertices->begin(); sv2 != recoVertices->end(); ++sv2) {
61  VertexState s2(RecoVertex::convertPos(sv2->position()), RecoVertex::convertError(sv2->error()));
62  double fr = vertexTools::computeSharedTracks(*sv2, *sv);
63  // std::cout << sv2-recoVertices->begin() << " vs " << sv-recoVertices->begin() << " : " << fr << " " << computeSharedTracks(*sv, *sv2) << " sig " << dist.distance(*sv,*sv2).significance() << std::endl;
64  // std::cout << (fr > maxFraction) << " && " << (dist.distance(*sv,*sv2).significance() < 2) << " && " << (sv-sv2!=0) << " && " << (fr >= computeSharedTracks(*sv2, *sv)) << std::endl;
65  if (fr > maxFraction && dist.distance(s1, s2).significance() < minSignificance && sv - sv2 != 0 &&
66  fr >= vertexTools::computeSharedTracks(*sv, *sv2)) {
67  shared = true;
68  // std::cout << "shared " << sv-recoVertices->begin() << " and " << sv2-recoVertices->begin() << " fractions: " << fr << " , " << computeSharedTracks(*sv2, *sv) << " sig: " << dist.distance(*sv,*sv2).significance() << std::endl;
69  }
70  }
71  if (shared) {
72  sv = recoVertices->erase(sv) - 1;
73  }
74  // std::cout << "it = " << sv-recoVertices->begin() << " new size is: " << recoVertices->size() << std::endl;
75  }
76 
77  event.put(std::move(recoVertices));
78 }
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
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
double significance() const
Definition: Measurement1D.h:29
fixed size matrix
def move(src, dest)
Definition: eostools.py:511

◆ trackFilter()

template<class VTX >
bool TemplatedVertexMerger< VTX >::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

◆ maxFraction

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

Definition at line 33 of file VertexMerger.cc.

◆ minSignificance

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

Definition at line 34 of file VertexMerger.cc.

◆ token_secondaryVertex

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

Definition at line 32 of file VertexMerger.cc.

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