CMS 3D CMS Logo

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