CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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.22 2012/11/08 21:28:47 dmytro 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 #include "FWCore/Utilities/interface/Visibility.h"
00034 
00035 std::vector<SteppingHelixStateInfo> 
00036 propagateThoughFromIP(const SteppingHelixStateInfo& state,const Propagator* prop,
00037                       const FiducialVolume& volume,int nsteps,
00038                       float step, float minR, float minZ, float maxR, float maxZ);
00039 
00040 class CachedTrajectory {
00041  public:
00042 
00043   const std::vector<SteppingHelixStateInfo>& getEcalTrajectory() const;
00044   const std::vector<SteppingHelixStateInfo>& getHcalTrajectory() const;
00045   const std::vector<SteppingHelixStateInfo>& getHOTrajectory() const;
00046   const std::vector<SteppingHelixStateInfo>& getPreshowerTrajectory() const;
00047 
00048 private:
00049   friend class TrackDetectorAssociator;
00050   friend std::vector<SteppingHelixStateInfo> 
00051   propagateThoughFromIP(const SteppingHelixStateInfo& state,const Propagator* ptr,
00052                         const FiducialVolume& volume,int nsteps,
00053                         float step, float minR, float minZ, float maxR, float maxZ);
00054 
00055   CachedTrajectory();
00056   enum TrajectorType { IpToEcal, IpToHcal, IpToHO, FullTrajectory };
00057   enum WideTrajectoryType { Ecal, Hcal, HO };
00058   
00059   void reset_trajectory() dso_internal;
00060   
00062   bool propagateAll(const SteppingHelixStateInfo& initialState) dso_internal;
00063   
00064   void propagateForward(SteppingHelixStateInfo& state, float distance) dso_internal;
00065   void propagate(SteppingHelixStateInfo& state, const Plane& plane) dso_internal;
00066   void propagate(SteppingHelixStateInfo& state, const Cylinder& cylinder) dso_internal;
00067   
00069   TrajectoryStateOnSurface propagate(const Plane* plane) dso_internal;
00070   
00073   std::pair<float,float> trajectoryDelta( TrajectorType ) dso_internal;
00074   
00075   void setPropagator(const Propagator* ptr) dso_internal { propagator_ = ptr; }
00076   void setStateAtIP(const SteppingHelixStateInfo& state) dso_internal { stateAtIP_ = state; }
00077   
00081    void getTrajectory(std::vector<SteppingHelixStateInfo>&,
00082                       const FiducialVolume&,
00083                       int steps = 4) dso_internal;
00084   
00085   void findEcalTrajectory(const FiducialVolume&) dso_internal;
00086   void findHcalTrajectory(const FiducialVolume&) dso_internal;
00087   void findHOTrajectory(const FiducialVolume&) dso_internal;
00088   void findPreshowerTrajectory(const FiducialVolume&) dso_internal;
00089   
00090   std::vector<GlobalPoint>* getWideTrajectory(const std::vector<SteppingHelixStateInfo>&,
00091                                               WideTrajectoryType) dso_internal;
00092   
00093   SteppingHelixStateInfo getStateAtEcal() dso_internal;
00094   SteppingHelixStateInfo getStateAtPreshower() dso_internal;
00095   SteppingHelixStateInfo getStateAtHcal() dso_internal;
00096   SteppingHelixStateInfo getStateAtHO() dso_internal;
00097   
00098   //get the innermost state of the whole trajectory 
00099   SteppingHelixStateInfo getInnerState() dso_internal;
00100   //get the outermost state of the whole trajectory 
00101   SteppingHelixStateInfo getOuterState() dso_internal;
00102   
00103   // specify the detector global boundaries to limit the propagator
00104    // units: cm
00105    // HINT: use lower bounds to limit propagateAll() action within
00106    //       smaller region, such as ECAL for example
00107   void setMaxDetectorRadius(float r = 800.) dso_internal { maxRho_ = r;}
00108   void setMaxDetectorLength(float l = 2200.) dso_internal { maxZ_ = l/2.;}
00109   void setMaxHORadius(float r = 800.) dso_internal { HOmaxRho_ = r;}
00110   void setMaxHOLength(float l = 2200.) dso_internal { HOmaxZ_ = l/2.;}
00111   void setMinDetectorRadius(float r = 0.)  dso_internal { minRho_ = r;}
00112   void setMinDetectorLength(float l = 0.)  dso_internal { minZ_ = l/2.;}
00113   
00114   void setPropagationStep(float s = 20.){ step_ = s;}
00115   float getPropagationStep() const  dso_internal { return step_;}
00116   
00117 protected:
00118   
00119   static int sign (float number) dso_internal {
00120     if (number ==0) return 0;
00121     if (number > 0)
00122       return 1;
00123     else
00124       return -1;
00125   }
00126   
00127   std::pair<float,float> delta( const double& theta1,
00128                                 const double& theta2,
00129                                 const double& phi1,
00130                                 const double& phi2) dso_internal;
00131   
00132   float distance(const Plane* plane, int index) dso_internal {
00133     if (index<0 || fullTrajectory_.empty() || (unsigned int)index >= fullTrajectory_.size()) return 0;
00134     return plane->localZ(fullTrajectory_[index].position());
00135   }
00136   
00137   std::deque<SteppingHelixStateInfo> fullTrajectory_;
00138   std::vector<SteppingHelixStateInfo> ecalTrajectory_;
00139   std::vector<SteppingHelixStateInfo> hcalTrajectory_;
00140   std::vector<SteppingHelixStateInfo> hoTrajectory_;
00141   std::vector<SteppingHelixStateInfo> preshowerTrajectory_;
00142   std::vector<GlobalPoint> wideEcalTrajectory_; 
00143   std::vector<GlobalPoint> wideHcalTrajectory_;
00144   std::vector<GlobalPoint> wideHOTrajectory_;
00145   SteppingHelixStateInfo stateAtIP_;
00146   
00147   bool fullTrajectoryFilled_;
00148   
00149   const Propagator* propagator_;
00150   
00151   float maxRho_;
00152   float maxZ_;
00153   float HOmaxRho_;
00154   float HOmaxZ_;
00155   float minRho_;
00156   float minZ_;
00157   float step_;
00158   
00159 };
00160 #endif