CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/TrackingTools/TrackAssociator/interface/CachedTrajectory.h

Go to the documentation of this file.
00001 #ifndef TrackAssociator_CachedTrajectory_h
00002 #define TrackAssociator_CachedTrajectory_h 1
00003 // -*- C++ -*-
00004 //
00005 // Package:    TrackAssociator
00006 // Class:      CachedTrajectory
00007 // 
00008 /*
00009 
00010  Description: CachedTrajectory is a transient class, which stores a set of
00011  * trajectory states that can be used as starting points when there is need
00012  * propagate the same track to a number of different surfaces, which might 
00013  * not be know in advance.
00014 
00015  Implementation:
00016      <Notes on implementation>
00017 */
00018 //
00019 // Original Author:  Dmytro Kovalskyi
00020 //         Created:  Fri Apr 21 10:59:41 PDT 2006
00021 // $Id: CachedTrajectory.h,v 1.14 2010/10/03 17:25:10 elmer Exp $
00022 //
00023 //
00024 
00025 #include "TrackingTools/TrackAssociator/interface/DetIdAssociator.h"
00026 #include "TrackingTools/TrackAssociator/interface/TAMuonChamberMatch.h"
00027 #include "TrackingTools/TrackAssociator/interface/FiducialVolume.h"
00028 #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixStateInfo.h"
00029 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
00030 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00031 #include "DataFormats/DetId/interface/DetId.h"
00032 #include <deque>
00033 
00034 class CachedTrajectory {
00035  public:
00036    CachedTrajectory();
00037    enum TrajectorType { IpToEcal, IpToHcal, IpToHO, FullTrajectory };
00038    enum WideTrajectoryType { Ecal, Hcal, HO };
00039 
00040    void reset_trajectory();
00041    
00043    bool propagateAll(const SteppingHelixStateInfo& initialState);
00044    
00045    void propagateForward(SteppingHelixStateInfo& state, float distance);
00046    void propagate(SteppingHelixStateInfo& state, const Plane& plane);
00047    void propagate(SteppingHelixStateInfo& state, const Cylinder& cylinder);
00048 
00050    TrajectoryStateOnSurface propagate(const Plane* plane);
00051    
00054    std::pair<float,float> trajectoryDelta( TrajectorType );
00055    
00056    void setPropagator(const Propagator* ptr){   propagator_ = ptr; }
00057    void setStateAtIP(const SteppingHelixStateInfo& state){ stateAtIP_ = state; }
00058    
00062    void getTrajectory(std::vector<SteppingHelixStateInfo>&,
00063                       const FiducialVolume&,
00064                       int steps = 4);
00065    
00066    void findEcalTrajectory(const FiducialVolume&);
00067    void findHcalTrajectory(const FiducialVolume&);
00068    void findHOTrajectory(const FiducialVolume&);
00069    void findPreshowerTrajectory(const FiducialVolume&);
00070 
00071    const std::vector<SteppingHelixStateInfo>& getEcalTrajectory();
00072    const std::vector<SteppingHelixStateInfo>& getHcalTrajectory();
00073    const std::vector<SteppingHelixStateInfo>& getHOTrajectory();
00074    const std::vector<SteppingHelixStateInfo>& getPreshowerTrajectory();
00075 
00076    std::vector<GlobalPoint>* getWideTrajectory(const std::vector<SteppingHelixStateInfo>&,
00077                                                      WideTrajectoryType);
00078 
00079    SteppingHelixStateInfo getStateAtEcal();
00080    SteppingHelixStateInfo getStateAtPreshower();
00081    SteppingHelixStateInfo getStateAtHcal();
00082    SteppingHelixStateInfo getStateAtHO();
00083    
00084    //get the innermost state of the whole trajectory 
00085    SteppingHelixStateInfo getInnerState();
00086    //get the outermost state of the whole trajectory 
00087    SteppingHelixStateInfo getOuterState();
00088    
00089    // specify the detector global boundaries to limit the propagator
00090    // units: cm
00091    // HINT: use lower bounds to limit propagateAll() action within
00092    //       smaller region, such as ECAL for example
00093    void setMaxDetectorRadius(float r = 800.){ maxRho_ = r;}
00094    void setMaxDetectorLength(float l = 2200.){ maxZ_ = l/2.;}
00095    void setMaxHORadius(float r = 800.) { HOmaxRho_ = r;}
00096    void setMaxHOLength(float l = 2200.) { HOmaxZ_ = l/2.;}
00097    void setMinDetectorRadius(float r = 0.){ minRho_ = r;}
00098    void setMinDetectorLength(float l = 0.){ minZ_ = l/2.;}
00099 
00100    void setPropagationStep(float s = 20.){ step_ = s;}
00101    float getPropagationStep() const { return step_;}
00102    
00103  protected:
00104    
00105    static int sign (float number){
00106       if (number ==0) return 0;
00107       if (number > 0)
00108         return 1;
00109       else
00110         return -1;
00111    }
00112    
00113    std::pair<float,float> delta( const double& theta1,
00114                                  const double& theta2,
00115                                  const double& phi1,
00116                                  const double& phi2);
00117    
00118    float distance(const Plane* plane, int index) {
00119       if (index<0 || fullTrajectory_.empty() || (unsigned int)index >= fullTrajectory_.size()) return 0;
00120       return plane->localZ(fullTrajectory_[index].position());
00121    }
00122    
00123    std::deque<SteppingHelixStateInfo> fullTrajectory_;
00124    std::vector<SteppingHelixStateInfo> ecalTrajectory_;
00125    std::vector<SteppingHelixStateInfo> hcalTrajectory_;
00126    std::vector<SteppingHelixStateInfo> hoTrajectory_;
00127    std::vector<SteppingHelixStateInfo> preshowerTrajectory_;
00128    std::vector<GlobalPoint> wideEcalTrajectory_; 
00129    std::vector<GlobalPoint> wideHcalTrajectory_;
00130    std::vector<GlobalPoint> wideHOTrajectory_;
00131    SteppingHelixStateInfo stateAtIP_;
00132    
00133    bool fullTrajectoryFilled_;
00134    
00135    const Propagator* propagator_;
00136    
00137    float maxRho_;
00138    float maxZ_;
00139    float HOmaxRho_;
00140    float HOmaxZ_;
00141    float minRho_;
00142    float minZ_;
00143    float step_;
00144 
00145 };
00146 #endif