CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWPFUtils Class Reference

#include <FWPFUtils.h>

List of all members.

Public Member Functions

bool checkIntersect (const TEveVector &vec, float r)
TEveVector cross (const TEveVector &v1, const TEveVector &v2)
float dot (const TEveVector &v1, const TEveVector &v2)
 FWPFUtils ()
float getCaloR1 ()
float getCaloR2 ()
float getCaloR3 ()
float getCaloZ1 ()
float getCaloZ2 ()
FWMagFieldgetField ()
TEveTrack * getTrack (const reco::Track &iData)
void initPropagator ()
float linearInterpolation (const TEveVector &p1, const TEveVector &p2, float r)
TEveVector lineCircleIntersect (const TEveVector &v1, const TEveVector &v2, float r)
TEveVector lineLineIntersect (const TEveVector &v1, const TEveVector &v2, const TEveVector &v3, const TEveVector &v4)
float sgn (float val)
virtual ~FWPFUtils ()

Private Member Functions

 FWPFUtils (const FWPFUtils &)
const FWPFUtilsoperator= (const FWPFUtils &)

Private Attributes

float m_caloR1
float m_caloR2
float m_caloR3
float m_caloZ1
float m_caloZ2
FWMagFieldm_magField
TEveTrackPropagator * m_trackerTrackPropagator
TEveTrackPropagator * m_trackPropagator

Detailed Description

Definition at line 26 of file FWPFUtils.h.


Constructor & Destructor Documentation

FWPFUtils::FWPFUtils ( )

Definition at line 4 of file FWPFUtils.cc.

References m_caloR1, m_caloR2, m_caloR3, m_caloZ1, and m_caloZ2.

                     : m_trackerTrackPropagator(0), m_trackPropagator(0), m_magField(0)
{
   // ECAL
   m_caloR1 = 129;      // Centres of front faces of the crystals in supermodules (1.29m) - Barrel
   m_caloZ1 = 303.353;  // Longitudinal distance between the interaction point and last tracker layer - Endcap

   // HCAL
   m_caloR2 = 177.7;    // Longitudinal profile in the barrel (inner radius) - Barrel
   m_caloR3 = 287.65;   // Longitudinal profile in the barrel (outer radius) - Barrel
   m_caloZ2 = 400.458;  // Longitudinal distance between the interaction point and the endcap envelope - Endcap
}
virtual FWPFUtils::~FWPFUtils ( ) [inline, virtual]

Definition at line 31 of file FWPFUtils.h.

{}
FWPFUtils::FWPFUtils ( const FWPFUtils ) [private]

Member Function Documentation

bool FWPFUtils::checkIntersect ( const TEveVector &  vec,
float  r 
)

Definition at line 129 of file FWPFUtils.cc.

References h, and mathSSE::sqrt().

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{
   float h = sqrt( ( p.fX * p.fX ) + ( p.fY * p.fY ) );
   
   if( h >= r )
      return true;

   return false;
}
TEveVector FWPFUtils::cross ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 88 of file FWPFUtils.cc.

Referenced by lineLineIntersect().

{
   TEveVector vec;

   vec.fX = ( v1.fY * v2.fZ ) - ( v1.fZ * v2.fY );
   vec.fY = ( v1.fZ * v2.fX ) - ( v1.fX * v2.fZ );
   vec.fZ = ( v1.fX * v2.fY ) - ( v1.fY * v2.fX );

   return vec;
}
float FWPFUtils::dot ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 113 of file FWPFUtils.cc.

References query::result.

Referenced by lineLineIntersect().

{
   float result = ( v1.fX * v2.fX ) + ( v1.fY * v2.fY ) + ( v1.fZ * v1.fZ );

   return result;
}
float FWPFUtils::getCaloR1 ( ) [inline]
float FWPFUtils::getCaloR2 ( ) [inline]
float FWPFUtils::getCaloR3 ( ) [inline]

Definition at line 48 of file FWPFUtils.h.

References m_caloR3.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{ return m_caloR3;   }
float FWPFUtils::getCaloZ1 ( ) [inline]

Definition at line 49 of file FWPFUtils.h.

References m_caloZ1.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{ return m_caloZ1;   }
float FWPFUtils::getCaloZ2 ( ) [inline]

Definition at line 50 of file FWPFUtils.h.

References m_caloZ2.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{ return m_caloZ2;   }
FWMagField* FWPFUtils::getField ( ) [inline]

Definition at line 51 of file FWPFUtils.h.

References m_magField.

Referenced by FWPFTrackUtils::setupLegoTrack(), and FWPFTrackUtils::setupRPZTrack().

{ return m_magField; }
TEveTrack * FWPFUtils::getTrack ( const reco::Track iData)

Definition at line 18 of file FWPFUtils.cc.

References reco::TrackBase::charge(), reco::Track::extra(), m_trackerTrackPropagator, m_trackPropagator, LargeD0_PixelPairStep_cff::propagator, reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), matplotRender::t, and reco::TrackBase::vertex().

Referenced by FWPFTrackUtils::setupLegoTrack(), and FWPFTrackUtils::setupRPZTrack().

{
   TEveTrackPropagator *propagator = ( !iData.extra().isAvailable() ) ? m_trackerTrackPropagator : m_trackPropagator;

   TEveRecTrack t;
   t.fBeta = 1;
   t.fP = TEveVector( iData.px(), iData.py(), iData.pz() );
   t.fV = TEveVector( iData.vertex().x(), iData.vertex().y(), iData.vertex().z() );
   t.fSign = iData.charge();
   TEveTrack *trk = new TEveTrack( &t, propagator );
   trk->MakeTrack();

   return trk;
}
void FWPFUtils::initPropagator ( )

Definition at line 141 of file FWPFUtils.cc.

References m_caloR3, m_caloZ2, m_magField, m_trackerTrackPropagator, and m_trackPropagator.

Referenced by FWPFTrackUtils::FWPFTrackUtils().

{
   m_magField = new FWMagField();

   // Common propagator, helix stepper
   m_trackPropagator = new TEveTrackPropagator();
   m_trackPropagator->SetMagFieldObj( m_magField, false );
   m_trackPropagator->SetMaxR( m_caloR3 );
   m_trackPropagator->SetMaxZ( m_caloZ2 );
   m_trackPropagator->SetDelta( 0.01 );
   m_trackPropagator->SetProjTrackBreaking( TEveTrackPropagator::kPTB_UseLastPointPos );
   m_trackPropagator->SetRnrPTBMarkers( kTRUE );
   m_trackPropagator->IncDenyDestroy();

   // Tracker propagator
   m_trackerTrackPropagator = new TEveTrackPropagator();
   m_trackerTrackPropagator->SetStepper( TEveTrackPropagator::kRungeKutta );
   m_trackerTrackPropagator->SetMagFieldObj( m_magField, false );
   m_trackerTrackPropagator->SetDelta( 0.01 );
   m_trackerTrackPropagator->SetMaxR( m_caloR3 );
   m_trackerTrackPropagator->SetMaxZ( m_caloZ2 );
   m_trackerTrackPropagator->SetProjTrackBreaking( TEveTrackPropagator::kPTB_UseLastPointPos );
   m_trackerTrackPropagator->SetRnrPTBMarkers( kTRUE );
   m_trackerTrackPropagator->IncDenyDestroy();
}
float FWPFUtils::linearInterpolation ( const TEveVector &  p1,
const TEveVector &  p2,
float  r 
)

Definition at line 101 of file FWPFUtils.cc.

References ExpressReco_HICollisions_FallBack::y, and z.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{
   float y;

   y = ( ( z - fabs( p1.fZ ) ) * p2.fY ) + ( ( fabs( p2.fZ ) - z ) * p1.fY );
   y /= ( fabs( p2.fZ) - fabs( p1.fZ ) );

   return y;
}
TEveVector FWPFUtils::lineCircleIntersect ( const TEveVector &  v1,
const TEveVector &  v2,
float  r 
)

Definition at line 35 of file FWPFUtils.cc.

References funct::D, query::result, sgn(), mathSSE::sqrt(), ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{
   // Definitions
   float x, y;
   float dx = v1.fX - v2.fX;
   float dy = v1.fY - v2.fY;
   float dr = sqrt( ( dx * dx ) + ( dy * dy ) );
   float D = ( ( v2.fX * v1.fY ) - ( v1.fX * v2.fY ) );

   float rtDescrim = sqrt( ( ( r * r ) * ( dr * dr ) ) - ( D * D ) );

   if( dy < 0 )   // Going down
   {
      x = ( D * dy ) - ( ( sgn(dy) * dx ) * rtDescrim );
      x /= ( dr * dr );

      y = ( -D * dx ) - ( fabs( dy ) * rtDescrim );
      y /= ( dr * dr );
   }
   else
   {

      x = ( D * dy ) + ( ( sgn(dy) * dx ) * rtDescrim );
      x /= ( dr * dr );

      y = ( -D * dx ) + ( fabs( dy ) * rtDescrim );
      y /= ( dr * dr );
   }

   TEveVector result = TEveVector( x, y, 0.001 );
   return result;
}
TEveVector FWPFUtils::lineLineIntersect ( const TEveVector &  v1,
const TEveVector &  v2,
const TEveVector &  v3,
const TEveVector &  v4 
)

Definition at line 70 of file FWPFUtils.cc.

References a, b, trackerHits::c, cross(), dot(), p1, p3, query::result, and asciidump::s.

Referenced by FWPFTrackUtils::getCollisionMarkers(), and FWPFTrackUtils::setupLegoTrack().

{
   TEveVector a = p2 - p1;
   TEveVector b = p4 - p3;
   TEveVector c = p3 - p1;
   TEveVector result;
   float s, val;

   s = dot( cross( c, b ), cross( a, b ) );  
   val = dot( cross( a, b ), cross( a, b ) );
   s /= val;
   
   result = p1 + ( a * s );
   return result; 
}
const FWPFUtils& FWPFUtils::operator= ( const FWPFUtils ) [private]
float FWPFUtils::sgn ( float  val)

Definition at line 122 of file FWPFUtils.cc.

Referenced by lineCircleIntersect().

{
   return ( val < 0 ) ? -1 : 1;
}

Member Data Documentation

float FWPFUtils::m_caloR1 [private]

Definition at line 62 of file FWPFUtils.h.

Referenced by FWPFUtils(), and getCaloR1().

float FWPFUtils::m_caloR2 [private]

Definition at line 63 of file FWPFUtils.h.

Referenced by FWPFUtils(), and getCaloR2().

float FWPFUtils::m_caloR3 [private]

Definition at line 64 of file FWPFUtils.h.

Referenced by FWPFUtils(), getCaloR3(), and initPropagator().

float FWPFUtils::m_caloZ1 [private]

Definition at line 65 of file FWPFUtils.h.

Referenced by FWPFUtils(), and getCaloZ1().

float FWPFUtils::m_caloZ2 [private]

Definition at line 66 of file FWPFUtils.h.

Referenced by FWPFUtils(), getCaloZ2(), and initPropagator().

Definition at line 60 of file FWPFUtils.h.

Referenced by getField(), and initPropagator().

TEveTrackPropagator* FWPFUtils::m_trackerTrackPropagator [private]

Definition at line 58 of file FWPFUtils.h.

Referenced by getTrack(), and initPropagator().

TEveTrackPropagator* FWPFUtils::m_trackPropagator [private]

Definition at line 59 of file FWPFUtils.h.

Referenced by getTrack(), and initPropagator().