Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:31

0001 #include "Fireworks/ParticleFlow/interface/FWPFClusterRPZUtils.h"
0002 
0003 //______________________________________________________________________________
0004 TEveScalableStraightLineSet *FWPFClusterRPZUtils::buildRhoPhiClusterLineSet(const reco::PFCluster &cluster,
0005                                                                             const FWViewContext *vc,
0006                                                                             float r) {
0007   float energy, et;
0008   TEveVector centre = TEveVector(cluster.x(), cluster.y(), cluster.z());
0009 
0010   energy = cluster.energy();
0011   et = FWPFMaths::calculateEt(centre, energy);
0012 
0013   return buildRhoPhiClusterLineSet(cluster, vc, energy, et, r);
0014 }
0015 
0016 //______________________________________________________________________________
0017 TEveScalableStraightLineSet *FWPFClusterRPZUtils::buildRhoPhiClusterLineSet(
0018     const reco::PFCluster &cluster, const FWViewContext *vc, float e, float et, float r) {
0019   TEveScalableStraightLineSet *ls = new TEveScalableStraightLineSet("rhophiCluster");
0020   TEveVector vec;
0021   float size = 1.f;  // Stored in scale
0022   double phi;
0023 
0024   vec = TEveVector(cluster.x(), cluster.y(), cluster.z());
0025   phi = vec.Phi();
0026 
0027   FWViewEnergyScale *energyScale = vc->getEnergyScale();
0028   ls->SetLineWidth(4);
0029 
0030   ls->SetScaleCenter(r * cos(phi), r * sin(phi), 0);
0031   ls->AddLine(r * cos(phi), r * sin(phi), 0, (r + size) * cos(phi), (r + size) * sin(phi), 0);
0032   ls->SetScale(energyScale->getScaleFactor3D() * (energyScale->getPlotEt() ? et : e));
0033 
0034   return ls;
0035 }
0036 
0037 //______________________________________________________________________________
0038 TEveScalableStraightLineSet *FWPFClusterRPZUtils::buildRhoZClusterLineSet(
0039     const reco::PFCluster &cluster, const FWViewContext *vc, float caloTransAngle, float r, float z) {
0040   float energy, et;
0041   TEveVector centre = TEveVector(cluster.x(), cluster.y(), cluster.z());
0042 
0043   energy = cluster.energy();
0044   et = FWPFMaths::calculateEt(centre, energy);
0045 
0046   return buildRhoZClusterLineSet(cluster, vc, caloTransAngle, energy, et, r, z);
0047 }
0048 
0049 //______________________________________________________________________________
0050 TEveScalableStraightLineSet *FWPFClusterRPZUtils::buildRhoZClusterLineSet(
0051     const reco::PFCluster &cluster, const FWViewContext *vc, float caloTransAngle, float e, float et, float r, float z) {
0052   float size = 1.f;  // Stored in scale
0053   float offr = 4;
0054   float ecalZ = z + offr / tan(caloTransAngle);
0055   double theta, phi;
0056   double rad(0);
0057   TEveVector vec;
0058   TEveScalableStraightLineSet *ls = new TEveScalableStraightLineSet("rhoZCluster");
0059 
0060   vec = TEveVector(cluster.x(), cluster.y(), cluster.z());
0061   phi = vec.Phi();
0062   theta = vec.Theta();
0063 
0064   FWViewEnergyScale *caloScale = vc->getEnergyScale();
0065   ls->SetLineWidth(4);
0066 
0067   if (theta < caloTransAngle || TMath::Pi() - theta < caloTransAngle)
0068     rad = ecalZ / fabs(cos(theta));
0069   else
0070     rad = r / sin(theta);
0071 
0072   ls->SetScaleCenter(0., (phi > 0 ? rad * fabs(sin(theta)) : -rad * fabs(sin(theta))), rad * cos(theta));
0073   ls->AddLine(0.,
0074               (phi > 0 ? rad * fabs(sin(theta)) : -rad * fabs(sin(theta))),
0075               rad * cos(theta),
0076               0.,
0077               (phi > 0 ? (rad + size) * fabs(sin(theta)) : -(rad + size) * fabs(sin(theta))),
0078               (rad + size) * cos(theta));
0079   ls->SetScale(caloScale->getScaleFactor3D() * (caloScale->getPlotEt() ? et : e));
0080 
0081   return ls;
0082 }