23 static const double depth;
24 static const double R_BARREL;
25 static const double R_BARREL2;
26 static const double Z_ENDCAP;
27 static const double R_FORWARD;
28 static const double R_FORWARD2;
29 static const double Z_FORWARD;
30 static const double Z_BIG;
33 const double CaloPoint::depth = 0.1;
34 const double CaloPoint::R_BARREL = (1.-depth)*143.+depth*407.;
35 const double CaloPoint::R_BARREL2 = R_BARREL * R_BARREL;
36 const double CaloPoint::Z_ENDCAP = (1.-depth)*320.+depth*568.;
37 const double CaloPoint::R_FORWARD = Z_ENDCAP /
std::sqrt (std::cosh(3.)*std::cosh(3.) -1.);
38 const double CaloPoint::R_FORWARD2 = R_FORWARD * R_FORWARD;
39 const double CaloPoint::Z_FORWARD = 1100.+depth*165.;
40 const double CaloPoint::Z_BIG = 1.e5;
45 CaloPointZ (
double fZ,
double fEta){
47 static const double ETA_MAX = 5.2;
49 if (fZ > Z_ENDCAP) fZ = Z_ENDCAP-1.;
50 if (fZ < -Z_ENDCAP) fZ = -Z_ENDCAP+1;
52 double tanThetaAbs =
std::sqrt (std::cosh(fEta)*std::cosh(fEta) - 1.);
53 double tanTheta = fEta >= 0 ? tanThetaAbs : -tanThetaAbs;
55 double rEndcap = tanTheta == 0 ? 1.e10 :
56 fEta > 0 ? (Z_ENDCAP - fZ) / tanTheta : (-Z_ENDCAP - fZ) / tanTheta;
57 if (rEndcap > R_BARREL) {
59 mZ = fZ + R_BARREL * tanTheta;
63 if (rEndcap > R_FORWARD) zRef = Z_ENDCAP;
64 else if (std::fabs (fEta) <
ETA_MAX) zRef = Z_FORWARD;
66 mZ = fEta > 0 ? zRef : -zRef;
67 mR = std::fabs ((mZ - fZ) / tanTheta);
70 double etaReference (
double fZ) {
75 double thetaReference (
double fZ) {
80 double z()
const {
return mZ;}
81 double r()
const {
return mR;}
90 template<
typename Po
int>
93 template<
typename Vector,
typename Po
int2>
94 CaloPoint3D(
const Point2 &vertex,
const Vector &
dir)
99 int side = dir.z() < -1
e-9 ? -1 : dir.z() > 1
e-9 ? +1 : 0;
101 double dirR = dir.Rho();
104 double dirUnit[2] = { dir.x() / dirR, dir.y() / dirR };
109 double vtxLong = dirUnit[0] * vertex.x() + dirUnit[1] * vertex.y();
112 double tIP = dirUnit[0] * vertex.y() - dirUnit[1] * vertex.x();
118 double slope = dirR / dir.z();
121 r = vtxLong + slope * (side * Z_ENDCAP - vertex.z());
124 if (r2 < R_FORWARD2) {
126 r = vtxLong + slope * (side * Z_FORWARD - vertex.z());
127 z = side * Z_FORWARD;
128 }
else if (r2 < R_BARREL2) {
139 double slope = dir.z() / dirR;
141 z = vertex.z() + slope * (r - vtxLong);
145 point =
Point(dirUnit[0] * r - dirUnit[1] * tIP,
146 dirUnit[1] * r + dirUnit[0] * tIP,
150 const Point &caloPoint()
const {
return point; }
162 const Point& fVertex,
169 for (
unsigned i = 0;
i < fConstituents.size ();
i++) {
175 const Point& fVertex)
185 double phiRef =
phi();
191 double sumEtaPhi = 0;
192 int i = towers.size();
194 double eta = towers[
i]->eta();
196 double weight = towers[
i]->et();
199 sumEta2 += eta * eta *
weight;
201 sumPhi2 += phi * phi *
weight;
202 sumEtaPhi += eta * phi *
weight;
206 result.
etaMean = sumEta / sumw;
208 result.
etaEtaMoment = (sumEta2 - sumEta * sumEta / sumw) / sumw;
209 result.
phiPhiMoment = (sumPhi2 - sumPhi * sumPhi / sumw) / sumw;
210 result.
etaPhiMoment = (sumEtaPhi - sumEta * sumPhi / sumw) / sumw;
228 int i = towers.size();
230 double value = towers[
i]->eta();
231 double weight = towers[
i]->et();
234 sum2 += value * value *
weight;
236 return sumw > 0 ? (sum2 - sum*sum/sumw ) / sumw : 0;
241 double phiRef =
phi();
246 int i = towers.size();
249 double weight = towers[
i]->et();
252 sum2 += value * value *
weight;
254 return sumw > 0 ? (sum2 - sum*sum/sumw ) / sumw : 0;
259 double phiRef =
phi();
265 int i = towers.size();
267 double valueA = towers[
i]->eta();
268 double valueB =
deltaPhi (towers[i]->
phi(), phiRef);
269 double weight = towers[
i]->et();
273 sumAB += valueA * valueB *
weight;
275 return sumw > 0 ? (sumAB - sumA*sumB/sumw ) / sumw : 0;
282 int i = towers.size ();
284 double r =
deltaR (*
this, *(towers[i]));
285 if (r >= fRmin && r < fRmax) result += towers[
i]->et ();
293 if (fFraction >= 1)
return towers.size();
295 for (
unsigned i = 0;
i < towers.size(); ++
i) totalEt += towers[
i]->
et();
296 double fractionEnergy = totalEt * fFraction;
298 for (; result < towers.size(); ++
result) {
299 fractionEnergy -= towers[
result]->et();
300 if (fractionEnergy <= 0)
return result+1;
309 for (
unsigned i = 0;
i < towers.size(); ++
i) {
311 if (dR > result) result =
dR;
319 CaloPointZ refPoint (0., fDetectorEta);
320 return refPoint.etaReference (fZVertex);
326 CaloPointZ refPoint (fZVertex, fPhysicsEta);
327 return refPoint.etaReference (0.);
331 CaloPoint3D<Point> caloPoint(oldVertex,inParticle.
momentum());
332 Vector physicsDir = caloPoint.caloPoint() - newVertex;
340 CaloPoint3D<Point> caloPoint(vertex,inParticle.
momentum());
342 Vector detectorDir = caloPoint.caloPoint() -
np;
359 std::vector<const Candidate*>
result;
361 for (
int i = 0;
i < nDaughters; ++
i) {
376 for(
unsigned iConst=0; iConst<constituents.size(); ++iConst ) {
378 float pt = constituents[iConst]->p4().Pt();
386 float ptD_value = (sum_pt>0.) ?
sqrt( sum_pt2 / (sum_pt*sum_pt) ) : 0.;
400 float sum_pt2deltaR2 = 0.;
402 for(
unsigned iConst=0; iConst<constituents.size(); ++iConst ) {
406 float pt = thisConstituent.Pt();
408 double dR =
deltaR (*
this, *(constituents[iConst]));
409 float pt2deltaR2 = pt*pt*dR*
dR;
412 sum_pt2deltaR2 += pt2deltaR2;
416 float rmsCand_value = (sum_pt2>0.) ? sum_pt2deltaR2/sum_pt2 : 0.;
418 return rmsCand_value;
425 std::ostringstream
out;
426 out <<
"Jet p/px/py/pz/pt: " <<
p() <<
'/' <<
px () <<
'/' <<
py() <<
'/' <<
pz() <<
'/' <<
pt() << std::endl
427 <<
" eta/phi: " <<
eta () <<
'/' <<
phi () << std::endl
429 out <<
" Constituents:" << std::endl;
433 out <<
" #" <<
index <<
" p/pt/eta/phi: "
434 << constituent->p() <<
'/' << constituent->pt() <<
'/' << constituent->eta() <<
'/' << constituent->phi()
435 <<
" productId/index: " << constituent.
id() <<
'/' << constituent.
key() << std::endl;
438 out <<
" #" <<
index <<
" constituent is not available in the event" << std::endl;
virtual double p() const
magnitude of momentum vector
float etInAnnulus(float fRmin, float fRmax) const
ET in annulus between rmin and rmax around jet direction.
virtual double energy() const =0
energy
math::XYZVector Vector
point in the space
virtual float pt() const
transverse momentum
static float detectorEta(float fZVertex, float fPhysicsEta)
static function to convert physics eta to detector eta
virtual double et() const
transverse energy
CandidatePtr daughterPtr(size_type i) const
reference to daughter at given position
virtual float phi() const
momentum azimuthal angle
static const double slope[3]
int nCarrying(float fFraction) const
return # of constituent carrying fraction of energy
virtual void setP4(const LorentzVector &p4)
set 4-momentum
std::vector< Constituent > Constituents
virtual void scaleEnergy(double fScale)
scale energy of the jet
double deltaR(const T1 &t1, const T2 &t2)
EtaPhiMoments etaPhiStatistics() const
eta-phi statistics, ET weighted
float etaphiMoment() const
eta-phi second moment, ET weighted
float maxDistance() const
maximum distance from jet to constituent
bool isNonnull() const
Checks for non-null.
virtual Vector momentum() const =0
spatial momentum vector
virtual size_t numberOfDaughters() const
number of daughters
record to store eta-phi first and second moments
virtual float eta() const
momentum pseudorapidity
ProductID id() const
Accessor for product ID.
float constituentEtaPhiSpread() const
double deltaPhi(double phi1, double phi2)
float etaetaMoment() const
eta-eta second moment, ET weighted
unsigned int index
index type
float constituentPtDistribution() const
virtual double px() const
x coordinate of momentum vector
virtual std::vector< const reco::Candidate * > getJetConstituentsQuick() const
quick list of constituents
float phiphiMoment() const
phi-phi second moment, ET weighted
virtual double pz() const
z coordinate of momentum vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
static Candidate::LorentzVector detectorP4(const Candidate::Point &vertex, const Candidate &inParticle)
static Candidate::LorentzVector physicsP4(const Candidate::Point &newVertex, const Candidate &inParticle, const Candidate::Point &oldVertex=Candidate::Point(0, 0, 0))
virtual int nConstituents() const
of constituents
Square< F >::type sqr(const F &f)
void addDaughter(const CandidatePtr &)
add a daughter via a reference
Jet()
Default constructor.
math::XYZPoint Point
point in the space
virtual std::string print() const
Print object.
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
static float physicsEta(float fZVertex, float fDetectorEta)
static function to convert detector eta to physics eta
virtual double py() const
y coordinate of momentum vector
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
math::XYZPoint Point
point in the space
virtual Constituents getJetConstituents() const
list of constituents