CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
CandCommonVertexFitterBase Class Referenceabstract

#include <CandCommonVertexFitter.h>

Inheritance diagram for CandCommonVertexFitterBase:
CandCommonVertexFitter< Fitter >

Public Types

typedef reco::Vertex::CovarianceMatrix CovarianceMatrix
 

Public Member Functions

 CandCommonVertexFitterBase (const edm::ParameterSet &)
 
void set (const MagneticField *bField)
 
void set (reco::VertexCompositeCandidate &) const
 
virtual ~CandCommonVertexFitterBase ()
 

Protected Member Functions

void fill (std::vector< reco::TransientTrack > &, std::vector< reco::Candidate * > &, std::vector< reco::RecoCandidate::TrackType > &, reco::Candidate &) const
 
virtual bool fit (TransientVertex &, const std::vector< reco::TransientTrack > &) const =0
 

Protected Attributes

const MagneticFieldbField_
 
double chi2_
 chi-sqared More...
 
CovarianceMatrix cov_
 covariance matrix (3x3) More...
 
double ndof_
 number of degrees of freedom More...
 

Detailed Description

Definition at line 19 of file CandCommonVertexFitter.h.

Member Typedef Documentation

◆ CovarianceMatrix

Definition at line 21 of file CandCommonVertexFitter.h.

Constructor & Destructor Documentation

◆ CandCommonVertexFitterBase()

CandCommonVertexFitterBase::CandCommonVertexFitterBase ( const edm::ParameterSet )
inline

Definition at line 22 of file CandCommonVertexFitter.h.

22 : bField_(nullptr) {}

◆ ~CandCommonVertexFitterBase()

virtual CandCommonVertexFitterBase::~CandCommonVertexFitterBase ( )
inlinevirtual

Definition at line 23 of file CandCommonVertexFitter.h.

23 {}

Member Function Documentation

◆ fill()

void CandCommonVertexFitterBase::fill ( std::vector< reco::TransientTrack > &  tracks,
std::vector< reco::Candidate * > &  daughters,
std::vector< reco::RecoCandidate::TrackType > &  trackTypes,
reco::Candidate c 
) const
protected

Definition at line 60 of file CandCommonVertexFitter.cc.

63  {
64  size_t nDau = c.numberOfDaughters();
65  for (unsigned int j = 0; j < nDau; ++j) {
66  Candidate *d = c.daughter(j);
67  if (d == nullptr) {
68  ostringstream message;
69  message << "Can't access in write mode candidate daughters. "
70  << "pdgId = " << c.pdgId() << ".\n";
71  const Candidate *d1 = c.daughter(j);
72  if (d1 == nullptr)
73  message << "Null daughter also found in read-only mode\n";
74  else
75  message << "Daughter found in read-only mode with id: " << d1->pdgId() << "\n";
76  throw edm::Exception(edm::errors::InvalidReference) << message.str();
77  }
78  if (d->numberOfDaughters() > 0)
79  fill(tracks, daughters, trackTypes, *d);
80  else {
81  const Track *trk = d->get<const Track *>();
83  if (trk != nullptr) {
84  tracks.push_back(TransientTrack(*trk, bField_));
85  daughters.push_back(d);
86  trackTypes.push_back(type);
87  } else {
88  cerr << ">>> warning: candidate of type " << d->pdgId() << " has no track reference." << endl;
89  }
90  }
91  }
92 }

References c, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, ztail::d, d1, BPhysicsValidation_cfi::daughters, Exception, ntuplemaker::fill, edm::errors::InvalidReference, dqmiolumiharvest::j, and tracks.

◆ fit()

virtual bool CandCommonVertexFitterBase::fit ( TransientVertex ,
const std::vector< reco::TransientTrack > &   
) const
protectedpure virtual

◆ set() [1/2]

void CandCommonVertexFitterBase::set ( const MagneticField bField)
inline

◆ set() [2/2]

void CandCommonVertexFitterBase::set ( reco::VertexCompositeCandidate c) const

Definition at line 9 of file CandCommonVertexFitter.cc.

9  {
10  if (bField_ == nullptr)
12  << "B-Field was not set up CandCommonVertexFitter.\n"
13  << "the following method must be called before fitting a candidate:\n"
14  << " CandCommonVertexFitter:.set( const MagneticField * )" << endl;
15  vector<TransientTrack> tracks;
16  vector<Candidate *> daughters;
17  vector<RecoCandidate::TrackType> trackTypes;
18  fill(tracks, daughters, trackTypes, c);
19  assert(tracks.size() == daughters.size());
21  if (fit(vertex, tracks)) {
22  tracks = vertex.refittedTracks();
23  Candidate::Point vtx(vertex.position());
24  c.setVertex(vtx);
25  vector<TransientTrack>::const_iterator trackIt = tracks.begin(), tracksEnd = tracks.end();
26  vector<Candidate *>::const_iterator daughterIt = daughters.begin();
27  vector<RecoCandidate::TrackType>::const_iterator trackTypeIt = trackTypes.begin();
28  Candidate::LorentzVector mp4(0, 0, 0, 0);
29  for (; trackIt != tracksEnd; ++trackIt, ++daughterIt, ++trackTypeIt) {
30  const Track &track = trackIt->track();
31  Candidate &daughter = **daughterIt;
32  double px = track.px(), py = track.py(), pz = track.pz(), p = track.p();
33  double energy;
34  daughter.setVertex(vtx);
35  if (*trackTypeIt == RecoCandidate::recoTrackType) {
36  double mass = daughter.mass();
37  energy = sqrt(p * p + mass * mass);
38  } else {
39  energy = daughter.energy();
40  double scale = energy / p;
41  px *= scale;
42  py *= scale;
43  pz *= scale;
44  }
46  daughter.setP4(dp4);
47  mp4 += dp4;
48  }
49  c.setP4(mp4);
50  Vertex v = vertex;
51  c.setChi2AndNdof(chi2_ = v.chi2(), ndof_ = v.ndof());
52  v.fill(cov_);
53  c.setCovariance(cov_);
54  } else {
55  c.setChi2AndNdof(chi2_ = -1, ndof_ = 0);
56  c.setCovariance(cov_ = CovarianceMatrix(ROOT::Math::SMatrixIdentity()));
57  }
58 }

References cms::cuda::assert(), c, BPhysicsValidation_cfi::daughters, HCALHighEnergyHPDFilter_cfi::energy, reco::Candidate::energy(), Exception, ntuplemaker::fill, L1TowerCalibrationProducer_cfi::fit, edm::errors::InvalidReference, EgHLTOffHistBins_cfi::mass, reco::Candidate::mass(), AlCaHLTBitMon_ParallelJobs::p, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, reco::RecoCandidate::recoTrackType, L1EGammaCrystalsEmulatorProducer_cfi::scale, reco::Candidate::setP4(), reco::Candidate::setVertex(), mathSSE::sqrt(), HLT_FULL_cff::track, tracks, findQualityFiles::v, bphysicsOniaDQM_cfi::vertex, and extraflags_cff::vtx.

Member Data Documentation

◆ bField_

const MagneticField* CandCommonVertexFitterBase::bField_
protected

Definition at line 28 of file CandCommonVertexFitter.h.

Referenced by set().

◆ chi2_

double CandCommonVertexFitterBase::chi2_
mutableprotected

chi-sqared

Definition at line 35 of file CandCommonVertexFitter.h.

◆ cov_

CovarianceMatrix CandCommonVertexFitterBase::cov_
mutableprotected

covariance matrix (3x3)

Definition at line 39 of file CandCommonVertexFitter.h.

◆ ndof_

double CandCommonVertexFitterBase::ndof_
mutableprotected

number of degrees of freedom

Definition at line 37 of file CandCommonVertexFitter.h.

reco::Candidate::energy
virtual double energy() const =0
energy
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
reco::Candidate::setP4
virtual void setP4(const LorentzVector &p4)=0
set 4-momentum
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
edm::errors::InvalidReference
Definition: EDMException.h:39
reco::Candidate::mass
virtual double mass() const =0
mass
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CandCommonVertexFitterBase::ndof_
double ndof_
number of degrees of freedom
Definition: CandCommonVertexFitter.h:37
cms::cuda::assert
assert(be >=bs)
findQualityFiles.v
v
Definition: findQualityFiles.py:179
reco::RecoCandidate::TrackType
TrackType
track type
Definition: RecoCandidate.h:56
CandCommonVertexFitterBase::fill
void fill(std::vector< reco::TransientTrack > &, std::vector< reco::Candidate * > &, std::vector< reco::RecoCandidate::TrackType > &, reco::Candidate &) const
Definition: CandCommonVertexFitter.cc:60
BPhysicsValidation_cfi.daughters
daughters
Definition: BPhysicsValidation_cfi.py:11
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::Track
Definition: Track.h:27
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
CandCommonVertexFitterBase::cov_
CovarianceMatrix cov_
covariance matrix (3x3)
Definition: CandCommonVertexFitter.h:39
reco::Candidate::setVertex
virtual void setVertex(const Point &vertex)=0
set vertex
TransientVertex
Definition: TransientVertex.h:18
CandCommonVertexFitterBase::fit
virtual bool fit(TransientVertex &, const std::vector< reco::TransientTrack > &) const =0
reco::Candidate
Definition: Candidate.h:27
CandCommonVertexFitterBase::CovarianceMatrix
reco::Vertex::CovarianceMatrix CovarianceMatrix
Definition: CandCommonVertexFitter.h:21
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
reco::TransientTrack
Definition: TransientTrack.h:19
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:284
Exception
Definition: hltDiff.cc:245
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
CandCommonVertexFitterBase::bField_
const MagneticField * bField_
Definition: CandCommonVertexFitter.h:28
ztail.d
d
Definition: ztail.py:151
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
CandCommonVertexFitterBase::chi2_
double chi2_
chi-sqared
Definition: CandCommonVertexFitter.h:35
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
reco::Candidate::Point
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
d1
static constexpr float d1
Definition: L1EGammaCrystalsEmulatorProducer.cc:85
reco::Vertex
Definition: Vertex.h:35