CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Fireworks/Tracks/interface/TrackUtils.h

Go to the documentation of this file.
00001 #ifndef Fireworks_Tracks_TrackUtils_h
00002 #define Fireworks_Tracks_TrackUtils_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Tracks
00006 // Class  :     TrackUtils
00007 // $Id: TrackUtils.h,v 1.25 2010/09/07 15:46:48 yana Exp $
00008 //
00009 
00010 // system include files
00011 #include "TEveVSDStructs.h"
00012 
00013 // forward declarations
00014 namespace reco 
00015 {
00016    class Track;
00017 }
00018 class RecSegment;
00019 
00020 class FWEventItem;
00021 class TEveElement;
00022 class TEveTrack;
00023 class TEveTrackPropagator;
00024 class DetId;
00025 class FWGeometry;
00026 class TEveStraightLineSet;
00027 
00028 class SiPixelCluster;
00029 class SiStripCluster;
00030 class TrackingRecHit;
00031 
00032 namespace fireworks {
00033   
00034 struct State {
00035    TEveVector position;
00036    TEveVector momentum;
00037    bool valid;
00038    State() : valid(false) {
00039    }
00040    State(const TEveVector& pos) :
00041       position(pos), valid(false) {
00042    }
00043    State(const TEveVector& pos, const TEveVector& mom) :
00044       position(pos), momentum(mom), valid(true) {
00045    }
00046 };
00047 
00048 class StateOrdering {
00049    TEveVector m_direction;
00050 public:
00051    StateOrdering( const TEveVector& momentum ) {
00052       m_direction = momentum;
00053       m_direction.Normalize();
00054    }
00055    bool operator() ( const State& state1,
00056                      const State& state2 ) const {
00057       double product1 = state1.position.Perp()*(state1.position.fX*m_direction.fX + state1.position.fY*m_direction.fY>0 ? 1 : -1);
00058       double product2 = state2.position.Perp()*(state2.position.fX*m_direction.fX + state2.position.fY*m_direction.fY>0 ? 1 : -1);
00059       return product1 < product2;
00060    }
00061 };
00062 
00063 TEveTrack* prepareTrack( const reco::Track& track,
00064                          TEveTrackPropagator* propagator,
00065                          const std::vector<TEveVector>& extraRefPoints = std::vector<TEveVector>() );
00066  
00067 float pixelLocalX( const double mpx, const int m_nrows );
00068 float pixelLocalY( const double mpy, const int m_ncols );
00069 
00070 void localSiStrip( short strip, float* localTop, float* localBottom, const float* pars, unsigned int id );
00071 
00072 void pushPixelHits( std::vector<TVector3> &pixelPoints, const FWEventItem &iItem, const reco::Track &t );   
00073 void pushNearbyPixelHits( std::vector<TVector3> &pixelPoints, const FWEventItem &iItem, const reco::Track &t );   
00074 void pushPixelCluster( std::vector<TVector3> &pixelPoints, const FWGeometry &geom, DetId id, const SiPixelCluster &c, const float* pars ); 
00075 
00076 void addSiStripClusters( const FWEventItem* iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master );
00077 
00078 // Helpers for data extraction
00079 const SiStripCluster* extractClusterFromTrackingRecHit( const TrackingRecHit* rh );
00080 
00081 // Helper functions to get human readable informationa about given DetId
00082 // (copied from TrackingTools/TrackAssociator)
00083 std::string info( const DetId& );
00084 std::string info( const std::set<DetId>& );
00085 std::string info( const std::vector<DetId>& );
00086 }
00087 
00088 #endif // Fireworks_Tracks_TrackUtils_h