CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/Fireworks/ParticleFlow/src/FWPFClusterRPZUtils.cc

Go to the documentation of this file.
00001 #include "Fireworks/ParticleFlow/interface/FWPFClusterRPZUtils.h"
00002 
00003 //______________________________________________________________________________
00004 TEveScalableStraightLineSet *
00005 FWPFClusterRPZUtils::buildRhoPhiClusterLineSet( const reco::PFCluster &cluster, const FWViewContext *vc, float r )
00006 {
00007    float energy, et;
00008    TEveVector centre = TEveVector( cluster.x(), cluster.y(), cluster.z() );
00009 
00010    energy = cluster.energy();
00011    et = FWPFMaths::calculateEt( centre, energy );
00012 
00013    return buildRhoPhiClusterLineSet( cluster, vc, energy, et, r );
00014 }
00015 
00016 //______________________________________________________________________________
00017 TEveScalableStraightLineSet *
00018 FWPFClusterRPZUtils::buildRhoPhiClusterLineSet( const reco::PFCluster &cluster, const FWViewContext *vc, 
00019                                                 float e, float et, float r )
00020 {
00021    TEveScalableStraightLineSet *ls = new TEveScalableStraightLineSet( "rhophiCluster" );
00022    TEveVector vec;
00023    float size = 1.f; // Stored in scale
00024    double phi;
00025 
00026    vec = TEveVector( cluster.x(), cluster.y(), cluster.z() );
00027    phi = vec.Phi();
00028 
00029    FWViewEnergyScale *energyScale = vc->getEnergyScale();
00030    ls->SetLineWidth( 4 );
00031 
00032    ls->SetScaleCenter( r * cos( phi ), r * sin( phi ), 0 );
00033    ls->AddLine( r * cos( phi ), r * sin( phi ), 0, ( r + size ) * cos( phi ), ( r + size ) * sin( phi ), 0 );
00034    ls->SetScale( energyScale->getScaleFactor3D() * ( energyScale->getPlotEt() ? et : e ) );
00035 
00036    return ls;
00037 }
00038 
00039 //______________________________________________________________________________
00040 TEveScalableStraightLineSet *
00041 FWPFClusterRPZUtils::buildRhoZClusterLineSet( const reco::PFCluster &cluster, const FWViewContext *vc,
00042                                               float caloTransAngle, float r, float z )
00043 {
00044    float energy, et;
00045    TEveVector centre = TEveVector( cluster.x(), cluster.y(), cluster.z() );
00046 
00047    energy = cluster.energy();
00048    et = FWPFMaths::calculateEt( centre, energy );
00049 
00050    return buildRhoZClusterLineSet( cluster, vc, caloTransAngle, energy, et, r, z );
00051 }
00052 
00053 //______________________________________________________________________________
00054 TEveScalableStraightLineSet *
00055 FWPFClusterRPZUtils::buildRhoZClusterLineSet( const reco::PFCluster &cluster, const FWViewContext *vc,
00056                                               float caloTransAngle, float e, float et, float r, float z )
00057 {
00058       float size = 1.f;       // Stored in scale
00059       float offr = 4;
00060       float ecalZ = z + offr / tan( caloTransAngle );
00061       double theta, phi;
00062       double rad(0);
00063       TEveVector vec;
00064       TEveScalableStraightLineSet *ls = new TEveScalableStraightLineSet( "rhoZCluster" );
00065 
00066       vec = TEveVector( cluster.x(), cluster.y(), cluster.z() ); 
00067       phi = vec.Phi();
00068       theta =  vec.Theta();
00069 
00070       FWViewEnergyScale *caloScale = vc->getEnergyScale();
00071       ls->SetLineWidth( 4 );
00072 
00073       if ( theta < caloTransAngle || TMath::Pi() - theta < caloTransAngle )
00074          rad = ecalZ / fabs( cos( theta ) );
00075       else
00076          rad = r / sin( theta );
00077 
00078       ls->SetScaleCenter( 0., ( phi > 0 ? rad * fabs( sin( theta ) ) : -rad * fabs( sin( theta ) ) ), rad * cos( theta ) );
00079       ls->AddLine( 0., ( phi > 0 ? rad * fabs( sin( theta ) ) : -rad * fabs( sin( theta ) ) ), rad * cos( theta ),
00080                    0., ( phi > 0 ? ( rad + size ) * fabs( sin ( theta ) ) : -( rad + size ) * fabs( sin( theta) ) ), 
00081                    ( rad + size ) * cos( theta ) );
00082       ls->SetScale( caloScale->getScaleFactor3D() * ( caloScale->getPlotEt() ? et : e ) );
00083 
00084       return ls;
00085 }
00086