CMS 3D CMS Logo

FWPFClusterRPZUtils.cc
Go to the documentation of this file.
2 
3 //______________________________________________________________________________
4 TEveScalableStraightLineSet *FWPFClusterRPZUtils::buildRhoPhiClusterLineSet(const reco::PFCluster &cluster,
5  const FWViewContext *vc,
6  float r) {
7  float energy, et;
8  TEveVector centre = TEveVector(cluster.x(), cluster.y(), cluster.z());
9 
10  energy = cluster.energy();
11  et = FWPFMaths::calculateEt(centre, energy);
12 
13  return buildRhoPhiClusterLineSet(cluster, vc, energy, et, r);
14 }
15 
16 //______________________________________________________________________________
18  const reco::PFCluster &cluster, const FWViewContext *vc, float e, float et, float r) {
19  TEveScalableStraightLineSet *ls = new TEveScalableStraightLineSet("rhophiCluster");
20  TEveVector vec;
21  float size = 1.f; // Stored in scale
22  double phi;
23 
24  vec = TEveVector(cluster.x(), cluster.y(), cluster.z());
25  phi = vec.Phi();
26 
27  FWViewEnergyScale *energyScale = vc->getEnergyScale();
28  ls->SetLineWidth(4);
29 
30  ls->SetScaleCenter(r * cos(phi), r * sin(phi), 0);
31  ls->AddLine(r * cos(phi), r * sin(phi), 0, (r + size) * cos(phi), (r + size) * sin(phi), 0);
32  ls->SetScale(energyScale->getScaleFactor3D() * (energyScale->getPlotEt() ? et : e));
33 
34  return ls;
35 }
36 
37 //______________________________________________________________________________
38 TEveScalableStraightLineSet *FWPFClusterRPZUtils::buildRhoZClusterLineSet(
39  const reco::PFCluster &cluster, const FWViewContext *vc, float caloTransAngle, float r, float z) {
40  float energy, et;
41  TEveVector centre = TEveVector(cluster.x(), cluster.y(), cluster.z());
42 
43  energy = cluster.energy();
44  et = FWPFMaths::calculateEt(centre, energy);
45 
46  return buildRhoZClusterLineSet(cluster, vc, caloTransAngle, energy, et, r, z);
47 }
48 
49 //______________________________________________________________________________
50 TEveScalableStraightLineSet *FWPFClusterRPZUtils::buildRhoZClusterLineSet(
51  const reco::PFCluster &cluster, const FWViewContext *vc, float caloTransAngle, float e, float et, float r, float z) {
52  float size = 1.f; // Stored in scale
53  float offr = 4;
54  float ecalZ = z + offr / tan(caloTransAngle);
55  double theta, phi;
56  double rad(0);
57  TEveVector vec;
58  TEveScalableStraightLineSet *ls = new TEveScalableStraightLineSet("rhoZCluster");
59 
60  vec = TEveVector(cluster.x(), cluster.y(), cluster.z());
61  phi = vec.Phi();
62  theta = vec.Theta();
63 
64  FWViewEnergyScale *caloScale = vc->getEnergyScale();
65  ls->SetLineWidth(4);
66 
67  if (theta < caloTransAngle || TMath::Pi() - theta < caloTransAngle)
68  rad = ecalZ / fabs(cos(theta));
69  else
70  rad = r / sin(theta);
71 
72  ls->SetScaleCenter(0., (phi > 0 ? rad * fabs(sin(theta)) : -rad * fabs(sin(theta))), rad * cos(theta));
73  ls->AddLine(0.,
74  (phi > 0 ? rad * fabs(sin(theta)) : -rad * fabs(sin(theta))),
75  rad * cos(theta),
76  0.,
77  (phi > 0 ? (rad + size) * fabs(sin(theta)) : -(rad + size) * fabs(sin(theta))),
78  (rad + size) * cos(theta));
79  ls->SetScale(caloScale->getScaleFactor3D() * (caloScale->getPlotEt() ? et : e));
80 
81  return ls;
82 }
size
Write out results.
const double Pi
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:172
TEveScalableStraightLineSet * buildRhoPhiClusterLineSet(const reco::PFCluster &, const FWViewContext *, float r)
float float float z
bool getPlotEt() const
FWViewEnergyScale * getEnergyScale() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double energy() const
cluster energy
Definition: PFCluster.h:74
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
TEveScalableStraightLineSet * buildRhoZClusterLineSet(const reco::PFCluster &, const FWViewContext *, float caloTransAngle, float r, float z)
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:178
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:175
float calculateEt(const TEveVector &centre, float e)
Definition: FWPFMaths.cc:115
float getScaleFactor3D() const
def ls(path, rec=False)
Definition: eostools.py:349
Geom::Theta< T > theta() const