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)) {
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();
29 for (; trackIt != tracksEnd; ++trackIt, ++daughterIt, ++trackTypeIt) {
32 double px = track.
px(), py = track.
py(), pz = track.
pz(),
p = track.
p();
37 energy =
sqrt(
p *
p + mass * mass);
39 energy = daughter.
energy();
61 vector<Candidate *> &daughters,
62 vector<RecoCandidate::TrackType> &trackTypes,
65 for (
unsigned int j = 0;
j < nDau; ++
j) {
68 ostringstream message;
69 message <<
"Can't access in write mode candidate daughters. "
70 <<
"pdgId = " << c.
pdgId() <<
".\n";
73 message <<
"Null daughter also found in read-only mode\n";
75 message <<
"Daughter found in read-only mode with id: " << d1->
pdgId() <<
"\n";
79 fill(tracks, daughters, trackTypes, *d);
85 daughters.push_back(d);
86 trackTypes.push_back(type);
88 cerr <<
">>> warning: candidate of type " << d->
pdgId() <<
" has no track reference." << endl;
double p() const
momentum vector magnitude
virtual double energy() const =0
energy
void fill(CovarianceMatrix &v) const
fill SMatrix
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
const edm::EventSetup & c
virtual void setP4(const LorentzVector &p4)=0
set 4-momentum
virtual double mass() const =0
mass
auto const & tracks
cannot be loose
math::Error< 5 >::type CovarianceMatrix
double px() const
x coordinate of momentum vector
void setVertex(const Point &vertex) override
set vertex
virtual size_type numberOfDaughters() const =0
number of daughters
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
virtual void setVertex(const Point &vertex)=0
set vertex
void setCovariance(const CovarianceMatrix &m)
set covariance matrix
double chi2() const
chi-squares
void fill(std::vector< reco::TransientTrack > &, std::vector< reco::Candidate * > &, std::vector< reco::RecoCandidate::TrackType > &, reco::Candidate &) const
double pz() const
z coordinate of momentum vector
virtual int pdgId() const =0
PDG identifier.
void set(const MagneticField *bField)
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
T get() const
get a component
math::XYZPoint Point
point in the space
std::vector< reco::TransientTrack > const & refittedTracks() const
static constexpr float d1
void setP4(const LorentzVector &p4) final
set 4-momentum
double py() const
y coordinate of momentum vector