CMS 3D CMS Logo

Typedefs | Enumerations | Functions | Variables
noPuUtils Namespace Reference

Typedefs

typedef std::vector< std::pair< reco::PFCandidateRef, int > > CandQualityPairVector
 
typedef edm::AssociationMap< edm::OneToManyWithQuality< reco::PFCandidateCollection, reco::VertexCollection, int > > reversedPFCandToVertexAssMap
 
typedef std::vector< std::pair< reco::VertexRef, int > > VertexQualityPairVector
 

Enumerations

enum  { kNeutral = 0, kChNoAssoc, kChPUAssoc, kChHSAssoc }
 

Functions

int isVertexAssociated (const reco::PFCandidatePtr &, const PFCandToVertexAssMap &, const reco::VertexCollection &, double)
 
int isVertexAssociated_fast (const reco::PFCandidateRef &, const noPuUtils::reversedPFCandToVertexAssMap &, const reco::VertexCollection &, double, int &, int)
 
void promoteAssocToHSAssoc (int quality, double z, const reco::VertexCollection &vertices, double dZ, int &vtxAssociationType, bool checkdR2)
 
noPuUtils::reversedPFCandToVertexAssMap reversePFCandToVertexAssociation (const PFCandToVertexAssMap &)
 

Variables

const double dR2Min = 0.01 * 0.01
 

Typedef Documentation

◆ CandQualityPairVector

typedef std::vector<std::pair<reco::PFCandidateRef, int> > noPuUtils::CandQualityPairVector

Definition at line 24 of file NoPileUpMEtAuxFunctions.h.

◆ reversedPFCandToVertexAssMap

Definition at line 28 of file NoPileUpMEtAuxFunctions.h.

◆ VertexQualityPairVector

typedef std::vector<std::pair<reco::VertexRef, int> > noPuUtils::VertexQualityPairVector

Definition at line 25 of file NoPileUpMEtAuxFunctions.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kNeutral 
kChNoAssoc 
kChPUAssoc 
kChHSAssoc 

Definition at line 22 of file NoPileUpMEtAuxFunctions.h.

Function Documentation

◆ isVertexAssociated()

int noPuUtils::isVertexAssociated ( const reco::PFCandidatePtr pfCandidate,
const PFCandToVertexAssMap pfCandToVertexAssociations,
const reco::VertexCollection vertices,
double  dZ 
)

Definition at line 11 of file NoPileUpMEtAuxFunctions.cc.

14  {
15  int vtxAssociationType = noPuUtils::kNeutral;
16 
17  if (pfCandidate->charge() != 0) {
18  vtxAssociationType = noPuUtils::kChNoAssoc;
19  for (PFCandToVertexAssMap::const_iterator pfCandToVertexAssociation = pfCandToVertexAssociations.begin();
20  pfCandToVertexAssociation != pfCandToVertexAssociations.end();
21  ++pfCandToVertexAssociation) {
22  const noPuUtils::CandQualityPairVector& pfCandidates_vertex = pfCandToVertexAssociation->val;
23 
24  for (noPuUtils::CandQualityPairVector::const_iterator pfCandidate_vertex = pfCandidates_vertex.begin();
25  pfCandidate_vertex != pfCandidates_vertex.end();
26  ++pfCandidate_vertex) {
27  const reco::PFCandidatePtr pfcVtx = edm::refToPtr(pfCandidate_vertex->first); //<reco::PFCandidatePtr>
28  //std::cout<<pfCandidate<<" "<<test<<std::endl;
29 
30  if (pfCandidate != pfcVtx)
31  continue; //std::cout<<" pouet "<<pfCandidate<<" "<<test<<std::endl;
32 
33  //if(deltaR2(pfCandidate->p4(), pfCandidate_vertex->first->p4()) > dR2Min ) continue;
34  double z = pfCandToVertexAssociation->key->position().z();
35  int quality = pfCandidate_vertex->second;
36  promoteAssocToHSAssoc(quality, z, vertices, dZ, vtxAssociationType, false);
37  }
38  }
39  }
40 
41  return vtxAssociationType;
42  }

References edm::AssociationMap< Tag >::begin(), edm::AssociationMap< Tag >::end(), kChNoAssoc, kNeutral, promoteAssocToHSAssoc(), quality, edm::refToPtr(), and pwdgSkimBPark_cfi::vertices.

◆ isVertexAssociated_fast()

int noPuUtils::isVertexAssociated_fast ( const reco::PFCandidateRef pfCandidate,
const noPuUtils::reversedPFCandToVertexAssMap pfCandToVertexAssociations,
const reco::VertexCollection vertices,
double  dZ,
int &  numWarnings,
int  maxWarnings 
)

Definition at line 64 of file NoPileUpMEtAuxFunctions.cc.

69  {
70  int vtxAssociationType = noPuUtils::kNeutral;
71 
72  if (pfCandidate->charge() != 0) {
73  vtxAssociationType = noPuUtils::kChNoAssoc;
74 
75  const noPuUtils::VertexQualityPairVector* pfCandAssocVtxs = nullptr;
77  pfCandToVertexAssociations.find(pfCandidate);
78  if (itPfcToVtxAss != pfCandToVertexAssociations.end()) {
79  pfCandAssocVtxs = &itPfcToVtxAss->val;
80  } else {
81  for (noPuUtils::reversedPFCandToVertexAssMap::const_iterator pfcToVtxAssoc = pfCandToVertexAssociations.begin();
82  pfcToVtxAssoc != pfCandToVertexAssociations.end();
83  ++pfcToVtxAssoc) {
84  if (deltaR2(pfCandidate->p4(), pfcToVtxAssoc->key->p4()) < dR2Min) {
85  pfCandAssocVtxs = &pfcToVtxAssoc->val;
86  break;
87  }
88  }
89  }
90  if (pfCandAssocVtxs != nullptr) {
91  for (noPuUtils::VertexQualityPairVector::const_iterator pfcAssVtx = pfCandAssocVtxs->begin();
92  pfcAssVtx != pfCandAssocVtxs->end();
93  ++pfcAssVtx) {
94  double z = pfcAssVtx->first->position().z();
95  int quality = pfcAssVtx->second;
96  promoteAssocToHSAssoc(quality, z, vertices, dZ, vtxAssociationType, false);
97  }
98  }
99  }
100 
101  return vtxAssociationType;
102  }

References edm::AssociationMap< Tag >::begin(), HLTMuonOfflineAnalyzer_cfi::deltaR2, dR2Min, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), kChNoAssoc, edm::Ref< C, T, F >::key(), kNeutral, promoteAssocToHSAssoc(), quality, edm::helpers::KeyVal< K, V >::val, and pwdgSkimBPark_cfi::vertices.

Referenced by NoPileUpPFMEtDataProducer::produce().

◆ promoteAssocToHSAssoc()

void noPuUtils::promoteAssocToHSAssoc ( int  quality,
double  z,
const reco::VertexCollection vertices,
double  dZ,
int &  vtxAssociationType,
bool  checkdR2 
)

Definition at line 104 of file NoPileUpMEtAuxFunctions.cc.

109  {
111  for (reco::VertexCollection::const_iterator vertex = vertices.begin(); vertex != vertices.end(); ++vertex) {
112  if (std::abs(z - vertex->position().z()) < dZ) {
113  if (vtxAssociationType < noPuUtils::kChHSAssoc)
114  vtxAssociationType = noPuUtils::kChHSAssoc;
115  }
116  }
117  }
118  }

References funct::abs(), kChHSAssoc, quality, bphysicsOniaDQM_cfi::vertex, and pwdgSkimBPark_cfi::vertices.

Referenced by isVertexAssociated(), and isVertexAssociated_fast().

◆ reversePFCandToVertexAssociation()

noPuUtils::reversedPFCandToVertexAssMap noPuUtils::reversePFCandToVertexAssociation ( const PFCandToVertexAssMap pfCandToVertexAssociations)

Definition at line 44 of file NoPileUpMEtAuxFunctions.cc.

45  {
46  noPuUtils::reversedPFCandToVertexAssMap revPfCandToVtxAssoc;
47 
48  for (PFCandToVertexAssMap::const_iterator pfCandToVertexAssociation = pfCandToVertexAssociations.begin();
49  pfCandToVertexAssociation != pfCandToVertexAssociations.end();
50  ++pfCandToVertexAssociation) {
51  const reco::VertexRef& vertex = pfCandToVertexAssociation->key;
52 
53  const noPuUtils::CandQualityPairVector& pfCandidates_vertex = pfCandToVertexAssociation->val;
54  for (noPuUtils::CandQualityPairVector::const_iterator pfCandidate_vertex = pfCandidates_vertex.begin();
55  pfCandidate_vertex != pfCandidates_vertex.end();
56  ++pfCandidate_vertex) {
57  revPfCandToVtxAssoc.insert(pfCandidate_vertex->first, std::make_pair(vertex, pfCandidate_vertex->second));
58  }
59  }
60 
61  return revPfCandToVtxAssoc;
62  }

References edm::AssociationMap< Tag >::begin(), edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::insert(), and bphysicsOniaDQM_cfi::vertex.

Referenced by NoPileUpPFMEtDataProducer::produce().

Variable Documentation

◆ dR2Min

const double noPuUtils::dR2Min = 0.01 * 0.01

Definition at line 9 of file NoPileUpMEtAuxFunctions.cc.

Referenced by isVertexAssociated_fast().

noPuUtils::kChPUAssoc
Definition: NoPileUpMEtAuxFunctions.h:22
noPuUtils::VertexQualityPairVector
std::vector< std::pair< reco::VertexRef, int > > VertexQualityPairVector
Definition: NoPileUpMEtAuxFunctions.h:25
edm::AssociationMap::find
const_iterator find(const key_type &k) const
find element with specified reference key
Definition: AssociationMap.h:173
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
noPuUtils::promoteAssocToHSAssoc
void promoteAssocToHSAssoc(int quality, double z, const reco::VertexCollection &vertices, double dZ, int &vtxAssociationType, bool checkdR2)
Definition: NoPileUpMEtAuxFunctions.cc:104
noPuUtils::dR2Min
const double dR2Min
Definition: NoPileUpMEtAuxFunctions.cc:9
noPuUtils::kNeutral
Definition: NoPileUpMEtAuxFunctions.h:22
edm::Ref< VertexCollection >
noPuUtils::kChHSAssoc
Definition: NoPileUpMEtAuxFunctions.h:22
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
edm::refToPtr
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
edm::helpers::KeyVal::val
V val
Definition: AssociationMapHelpers.h:33
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
edm::AssociationMap
Definition: AssociationMap.h:48
edm::Ptr< PFCandidate >
edm::AssociationMap::insert
void insert(const key_type &k, const data_type &v)
insert an association
Definition: AssociationMap.h:166
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
noPuUtils::CandQualityPairVector
std::vector< std::pair< reco::PFCandidateRef, int > > CandQualityPairVector
Definition: NoPileUpMEtAuxFunctions.h:24
edm::AssociationMap::begin
const_iterator begin() const
first iterator over the map (read only)
Definition: AssociationMap.h:169
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::AssociationMap::const_iterator
const iterator
Definition: AssociationMap.h:76
noPuUtils::kChNoAssoc
Definition: NoPileUpMEtAuxFunctions.h:22
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7