CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoTracker/CkfPattern/interface/GroupedCkfTrajectoryBuilder.h

Go to the documentation of this file.
00001 #ifndef GroupedCkfTrajectoryBuilder_H
00002 #define GroupedCkfTrajectoryBuilder_H
00003 
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 #include "FWCore/Framework/interface/EventSetup.h"
00007 
00008 #include "RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilder.h"
00009 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
00010 
00011 #include "TrackingTools/PatternTools/interface/TempTrajectory.h"
00012 
00013 #include <vector>
00014 
00015 
00016 #include "FWCore/Utilities/interface/Visibility.h"
00017 
00018 
00024 class GroupedCkfTrajectoryBuilder : public BaseCkfTrajectoryBuilder {
00025   
00026  public:
00028   GroupedCkfTrajectoryBuilder(const edm::ParameterSet&              conf,
00029                               const TrajectoryStateUpdator*         updator,
00030                               const Propagator*                     propagatorAlong,
00031                               const Propagator*                     propagatorOpposite,
00032                               const Chi2MeasurementEstimatorBase*   estimator,
00033                               const TransientTrackingRecHitBuilder* RecHitBuilder,
00034                               const MeasurementTracker*             measurementTracker,
00035                               const TrajectoryFilter*               filter,
00036                               const TrajectoryFilter*               inOutFilter);
00037 
00039   virtual ~GroupedCkfTrajectoryBuilder(){}
00040 
00042   //  virtual void setEvent(const edm::Event& event) const;
00043 
00045   TrajectoryContainer trajectories(const TrajectorySeed&) const;
00046 
00048   void trajectories(const TrajectorySeed&, TrajectoryContainer &ret) const;
00049 
00051   TrajectoryContainer trajectories(const TrajectorySeed&, const TrackingRegion&) const;
00052 
00054   void trajectories(const TrajectorySeed&, TrajectoryContainer &ret, const TrackingRegion&) const;
00055 
00057   // also new interface returning the start Trajectory...
00058   TempTrajectory buildTrajectories (const TrajectorySeed&seed,
00059                                     TrajectoryContainer &ret,
00060                                     const TrajectoryFilter*) const;
00061 
00062 
00063 
00070   void  rebuildSeedingRegion(const TrajectorySeed&,
00071                              TrajectoryContainer& result) const ;
00072  
00073   // same as above using the precomputed startingTraj..
00074   void  rebuildTrajectories(TempTrajectory const & startingTraj, const TrajectorySeed&,
00075                              TrajectoryContainer& result) const ;  
00076 
00077 
00078   // Access to lower level components
00079   const TrajectoryStateUpdator&  updator() const    {return *theUpdator;}
00080   const Chi2MeasurementEstimatorBase&    estimator() const  {return *theEstimator;}
00081 
00082   //   PropagationDirection        direction() const  {return theDirection;}
00083 
00085   double        chiSquareCut()          {return theChiSquareCut;}
00086 
00088   int           maxCand()               {return theMaxCand;}
00089 
00090 
00092   float         lostHitPenalty()        {return theLostHitPenalty;}
00093 
00094   //   /** Tells whether an intermediary cleaning stage should take place during TB. */
00095   //   bool             intermediateCleaning()  {return theIntermediateCleaning;}
00096 
00098   double ptCut() {return theptCut;}
00099 
00101   double mass() {return theMass;}
00102 
00103 protected:
00104 
00105   virtual void analyseSeed(const TrajectorySeed& seed) const{}
00106 
00107   virtual void analyseMeasurements( const std::vector<TM>& meas, 
00108                                     const Trajectory& traj) const{}
00109   virtual void analyseResult( const TrajectoryContainer& result) const {}
00110 
00111 private :
00113   GroupedCkfTrajectoryBuilder (const GroupedCkfTrajectoryBuilder&)  dso_internal;
00114 
00116   GroupedCkfTrajectoryBuilder& operator= (const GroupedCkfTrajectoryBuilder&)  dso_internal;
00117 
00118   
00119   inline bool tkxor(bool a, bool b) const  dso_internal {return (a||b) && !(a&&b);}
00120   // to be ported later
00121 
00122   bool advanceOneLayer( TempTrajectory& traj, 
00123                         const TrajectoryFilter* regionalCondition,
00124                         const Propagator* propagator, 
00125                         bool inOut,
00126                         TempTrajectoryContainer& newCand, 
00127                         TempTrajectoryContainer& result) const  dso_internal;
00128 
00129   void groupedLimitedCandidates( TempTrajectory const& startingTraj, 
00130                                  const TrajectoryFilter* regionalCondition,
00131                                  const Propagator* propagator, 
00132                                  bool inOut,
00133                                  TempTrajectoryContainer& result) const  dso_internal;
00134 
00136   void rebuildSeedingRegion (const TrajectorySeed&seed,
00137                              TempTrajectory const& startingTraj,
00138                              TempTrajectoryContainer& result) const  dso_internal;
00139 
00140    //** try to find additional hits in seeding region for a candidate
00141    //* (returns number of trajectories added) *
00142   int rebuildSeedingRegion (const TrajectorySeed&seed,
00143                             const std::vector<const TrackingRecHit*>& seedHits,
00144                             TempTrajectory& candidate,
00145                             TempTrajectoryContainer& result) const  dso_internal;
00146 
00147   // ** Backward fit of trajectory candidate except seed. Fit result is returned. invalid if fit failed
00148   // *  remaining hits are returned  remainingHits.
00149   TempTrajectory backwardFit (TempTrajectory& candidate, unsigned int nSeed,
00150                               const TrajectoryFitter& fitter,
00151                               std::vector<const TrackingRecHit*>& remainingHits) const  dso_internal;
00152 
00154   bool verifyHits (TempTrajectory::DataContainer::const_iterator rbegin,
00155                    size_t maxDepth,
00156                    const std::vector<const TrackingRecHit*>& hits) const  dso_internal;
00157 
00159   void groupedIntermediaryClean(TempTrajectoryContainer& theTrajectories) const  dso_internal;
00160 
00161 
00163   static inline PropagationDirection oppositeDirection (PropagationDirection dir) {
00164     if ( dir==alongMomentum )  return oppositeToMomentum;
00165     if ( dir==oppositeToMomentum )  return alongMomentum;
00166     return dir;
00167   }
00168 
00169 
00170 private:
00171   TrajectoryFilter*              theConfigurableCondition;
00172 
00173   //   typedef deque< const TrajectoryFilter*>   StopCondContainer;
00174   //   StopCondContainer              theStopConditions;
00175 
00176   double theChiSquareCut;       
00178   double theptCut;              
00180   double theMass;               
00182   int theMaxCand;               
00184   float theLostHitPenalty;      
00185   float theFoundHitBonus;       
00187   bool theIntermediateCleaning; 
00190   bool theAlwaysUseInvalid;
00191 
00192   bool theLockHits;             
00193   bool theBestHitOnly;          
00195   bool theRequireSeedHitsInRebuild; 
00197   unsigned int theMinNrOfHitsForRebuild;     
00200   unsigned int theMinNrOf2dHitsForRebuild;   
00202   bool theKeepOriginalIfRebuildFails;   
00207   float maxPt2ForLooperReconstruction;
00208 
00209   float maxDPhiForLooperReconstruction;
00210 
00211   mutable TempTrajectoryContainer work_; // Better here than alloc every time
00212   enum work_MaxSize_Size_ { work_MaxSize_ = 50 };  // if it grows above this number, it is forced to resize to half this amount when cleared
00213 };
00214 
00215 #endif