CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/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 
00062   void  rebuildSeedingRegion(const TrajectorySeed&,
00063                              TrajectoryContainer& result) const ;  
00064 
00065   // Access to lower level components
00066   const TrajectoryStateUpdator&  updator() const    {return *theUpdator;}
00067   const Chi2MeasurementEstimatorBase&    estimator() const  {return *theEstimator;}
00068 
00069   //   PropagationDirection        direction() const  {return theDirection;}
00070 
00072   double        chiSquareCut()          {return theChiSquareCut;}
00073 
00075   int           maxCand()               {return theMaxCand;}
00076 
00077 
00079   float         lostHitPenalty()        {return theLostHitPenalty;}
00080 
00081   //   /** Tells whether an intermediary cleaning stage should take place during TB. */
00082   //   bool             intermediateCleaning()  {return theIntermediateCleaning;}
00083 
00085   double ptCut() {return theptCut;}
00086 
00088   double mass() {return theMass;}
00089 
00090 protected:
00091 
00092   virtual void analyseSeed(const TrajectorySeed& seed) const{}
00093 
00094   virtual void analyseMeasurements( const std::vector<TM>& meas, 
00095                                     const Trajectory& traj) const{}
00096   virtual void analyseResult( const TrajectoryContainer& result) const {}
00097 
00098 private :
00100   GroupedCkfTrajectoryBuilder (const GroupedCkfTrajectoryBuilder&)  dso_internal;
00101 
00103   GroupedCkfTrajectoryBuilder& operator= (const GroupedCkfTrajectoryBuilder&)  dso_internal;
00104 
00106   void buildTrajectories (const TrajectorySeed&,
00107                                   TrajectoryContainer &ret,
00108                                   const TrajectoryFilter*) const  dso_internal;
00109   
00110   inline bool tkxor(bool a, bool b) const  dso_internal {return (a||b) && !(a&&b);}
00111   // to be ported later
00112 
00113   bool advanceOneLayer( TempTrajectory& traj, 
00114                         const TrajectoryFilter* regionalCondition,
00115                         const Propagator* propagator, 
00116                         bool inOut,
00117                         TempTrajectoryContainer& newCand, 
00118                         TempTrajectoryContainer& result) const  dso_internal;
00119 
00120   void groupedLimitedCandidates( TempTrajectory& startingTraj, 
00121                                  const TrajectoryFilter* regionalCondition,
00122                                  const Propagator* propagator, 
00123                                  bool inOut,
00124                                  TempTrajectoryContainer& result) const  dso_internal;
00125 
00127   void rebuildSeedingRegion (TempTrajectory& startingTraj,
00128                              TempTrajectoryContainer& result) const  dso_internal;
00129 
00130    //** try to find additional hits in seeding region for a candidate
00131    //* (returns number of trajectories added) *
00132   int rebuildSeedingRegion (const std::vector<const TrackingRecHit*>& seedHits,
00133                             TempTrajectory& candidate,
00134                             TempTrajectoryContainer& result) const  dso_internal;
00135 
00136   // ** Backward fit of trajectory candidate except seed. Fit result and
00137   // *  remaining hits are returned in fittedTracks and remainingHits.
00138   // *  FittedTracks is empty if no fit was done. *
00139   void backwardFit (TempTrajectory& candidate, unsigned int nSeed,
00140                     const TrajectoryFitter& fitter,
00141                     TempTrajectoryContainer& fittedTracks,
00142                     std::vector<const TrackingRecHit*>& remainingHits) const  dso_internal;
00143 
00145   bool verifyHits (TempTrajectory::DataContainer::const_iterator rbegin,
00146                    size_t maxDepth,
00147                    const std::vector<const TrackingRecHit*>& hits) const  dso_internal;
00148 
00150   void groupedIntermediaryClean(TempTrajectoryContainer& theTrajectories) const  dso_internal;
00151 
00154   void layers (const TempTrajectory::DataContainer& measurements,
00155                std::vector<const DetLayer*> &fillme) const  dso_internal;
00156 
00158   inline PropagationDirection oppositeDirection (PropagationDirection dir) const  dso_internal{
00159     if ( dir==alongMomentum )  return oppositeToMomentum;
00160     else if ( dir==oppositeToMomentum )  return alongMomentum;
00161     return dir;
00162   }
00163 
00164 
00165 private:
00166   TrajectoryFilter*              theConfigurableCondition;
00167 
00168   //   typedef deque< const TrajectoryFilter*>   StopCondContainer;
00169   //   StopCondContainer              theStopConditions;
00170 
00171   double theChiSquareCut;       
00173   double theptCut;              
00175   double theMass;               
00177   int theMaxCand;               
00179   float theLostHitPenalty;      
00180   float theFoundHitBonus;       
00182   bool theIntermediateCleaning; 
00185   bool theAlwaysUseInvalid;
00186 
00187   bool theLockHits;             
00188   bool theBestHitOnly;          
00190   bool theRequireSeedHitsInRebuild; 
00192   unsigned int theMinNrOfHitsForRebuild;     
00195   unsigned int theMinNrOf2dHitsForRebuild;   
00200   float maxPtForLooperReconstruction;
00201 
00202   float maxDPhiForLooperReconstruction;
00203 
00204   mutable TempTrajectoryContainer work_; // Better here than alloc every time
00205   enum work_MaxSize_Size_ { work_MaxSize_ = 50 };  // if it grows above this number, it is forced to resize to half this amount when cleared
00206 };
00207 
00208 #endif