CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PackedGenParticle.cc
Go to the documentation of this file.
4 
5 
6 
7 void pat::PackedGenParticle::pack(bool unpackAfterwards) {
9  packedY_ = int16_t(p4_.Rapidity()/6.0f*std::numeric_limits<int16_t>::max());
10  packedPhi_ = int16_t(p4_.Phi()/3.2f*std::numeric_limits<int16_t>::max());
12  if (unpackAfterwards) unpack(); // force the values to match with the packed ones
13 }
14 
15 
17  float y = int16_t(packedY_)*6.0f/std::numeric_limits<int16_t>::max();
18  float pt=MiniFloatConverter::float16to32(packedPt_);
19  float m=MiniFloatConverter::float16to32(packedM_);
20  float pz = std::tanh(y)*std::sqrt((m*m+pt*pt)/(1.-std::tanh(y)*std::tanh(y)));
21  float eta = std::asinh(pz/pt);
22  p4_ = PolarLorentzVector(pt,eta,int16_t(packedPhi_)*3.2f/std::numeric_limits<int16_t>::max(),m);
23  p4c_ = p4_;
24  unpacked_ = true;
25 }
26 
28 
29 
30 float pat::PackedGenParticle::dxy(const Point &p) const {
31  unpack();
32  return -(vertex_.X()-p.X()) * std::sin(float(p4_.Phi())) + (vertex_.Y()-p.Y()) * std::cos(float(p4_.Phi()));
33 }
34 float pat::PackedGenParticle::dz(const Point &p) const {
35  unpack();
36  return (vertex_.Z()-p.X()) - ((vertex_.X()-p.X()) * std::cos(float(p4_.Phi())) + (vertex_.Y()-p.Y()) * std::sin(float(p4_.Phi()))) * p4_.Pz()/p4_.Pt();
37 }
38 
39 
41 
43  throw cms::Exception("Invalid Reference")
44  << "this Candidate has no master clone reference."
45  << "Can't call masterClone() method.\n";
46 }
47 
49  return false;
50 }
51 
53  return false;
54 }
55 
56 
58  throw cms::Exception("Invalid Reference")
59  << "this Candidate has no master clone ptr."
60  << "Can't call masterClonePtr() method.\n";
61 }
62 
64  return 0;
65 }
66 
68  if(mother_.isNonnull()) return 1;
69  return 0;
70 }
71 
73  return p4() == o.p4() && vertex() == o.vertex() && charge() == o.charge();
74 // return p4() == o.p4() && charge() == o.charge();
75 }
76 
78  return 0;
79 }
80 
82  return mother_.get();
83 }
84 
87  << "This Candidate type does not implement daughter(std::string). "
88  << "Please use CompositeCandidate or NamedCompositeCandidate.\n";
89 }
90 
93  << "This Candidate type does not implement daughter(std::string). "
94  << "Please use CompositeCandidate or NamedCompositeCandidate.\n";
95 }
96 
97 
98 
100  return 0;
101 }
102 
104  return 0;
105 }
106 
108  return 0;
109 }
110 
112  return 0;
113 }
114 
117  << "reco::ConcreteCandidate does not implement vertex covariant matrix.\n";
118 }
119 
122  << "reco::ConcreteCandidate does not implement vertex covariant matrix.\n";
123 }
124 
125 bool pat::PackedGenParticle::isElectron() const { return false; }
126 
127 bool pat::PackedGenParticle::isMuon() const { return false; }
128 
129 bool pat::PackedGenParticle::isGlobalMuon() const { return false; }
130 
131 bool pat::PackedGenParticle::isStandAloneMuon() const { return false; }
132 
133 bool pat::PackedGenParticle::isTrackerMuon() const { return false; }
134 
135 bool pat::PackedGenParticle::isCaloMuon() const { return false; }
136 
137 bool pat::PackedGenParticle::isPhoton() const { return false; }
138 
139 bool pat::PackedGenParticle::isConvertedPhoton() const { return false; }
140 
141 bool pat::PackedGenParticle::isJet() const { return false; }
142 
143 bool pat::PackedGenParticle::longLived() const {return false;}
144 
145 bool pat::PackedGenParticle::massConstraint() const {return false;}
146 
147 
148 
149 
int i
Definition: DBlmapReader.cc:9
virtual void fillVertexCovariance(CovarianceMatrix &v) const
fill SMatrix
CovarianceMatrix vertexCovariance() const
return SMatrix
virtual size_t numberOfMothers() const
number of mothers
size_t size_type
Definition: Candidate.h:30
virtual double vertexNdof() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual bool isTrackerMuon() const
virtual bool isJet() const
virtual ~PackedGenParticle()
destructor
virtual const reco::Candidate * daughter(size_type) const
return daughter at a given position (throws an exception)
T eta() const
virtual bool isElectron() const
get a component
virtual bool isPhoton() const
static float float16to32(uint16_t h)
Definition: libminifloat.h:10
PolarLorentzVector p4_
the four vector
void pack(bool unpackAfterwards=true)
virtual double vertexNormalizedChi2() const
chi-squared divided by n.d.o.f.
virtual bool isMuon() const
virtual bool longLived() const
is long lived?
T sqrt(T t)
Definition: SSEVec.h:48
double p4[4]
Definition: TauolaWrapper.h:92
static uint16_t float32to16(float x)
Definition: libminifloat.h:15
virtual const reco::CandidateBaseRef & masterClone() const
virtual double vertexChi2() const
chi-squares
virtual size_t numberOfDaughters() const
number of daughters
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual bool isStandAloneMuon() const
int j
Definition: DBlmapReader.cc:9
virtual const reco::CandidatePtr & masterClonePtr() const
double f[11][100]
virtual const Point & vertex() const =0
vertex position
virtual int charge() const =0
electric charge
virtual bool hasMasterClonePtr() const
virtual bool overlap(const reco::Candidate &) const
check overlap with another Candidate
virtual bool hasMasterClone() const
virtual bool isCaloMuon() const
virtual bool isGlobalMuon() const
virtual const reco::Candidate * mother(size_type) const
return mother at a given position (throws an exception)
virtual bool isConvertedPhoton() const
T get() const
get a component
Definition: Candidate.h:217
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
virtual bool massConstraint() const
do mass constraint?
virtual float dz() const
dz with respect to the PV ref
virtual float dxy() const
dxy with respect to the PV ref
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39