CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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 
00017 
00023 class GroupedCkfTrajectoryBuilder : public BaseCkfTrajectoryBuilder {
00024   
00025  public:
00027   GroupedCkfTrajectoryBuilder(const edm::ParameterSet&              conf,
00028                               const TrajectoryStateUpdator*         updator,
00029                               const Propagator*                     propagatorAlong,
00030                               const Propagator*                     propagatorOpposite,
00031                               const Chi2MeasurementEstimatorBase*   estimator,
00032                               const TransientTrackingRecHitBuilder* RecHitBuilder,
00033                               const MeasurementTracker*             measurementTracker,
00034                               const TrajectoryFilter*               filter,
00035                               const TrajectoryFilter*               inOutFilter);
00036 
00038   virtual ~GroupedCkfTrajectoryBuilder(){}
00039 
00041   virtual void setEvent(const edm::Event& event) const;
00042 
00044   TrajectoryContainer trajectories(const TrajectorySeed&) const;
00045 
00047   void trajectories(const TrajectorySeed&, TrajectoryContainer &ret) const;
00048 
00050   TrajectoryContainer trajectories(const TrajectorySeed&, const TrackingRegion&) const;
00051 
00053   void trajectories(const TrajectorySeed&, TrajectoryContainer &ret, const TrackingRegion&) const;
00054 
00061   void  rebuildSeedingRegion(const TrajectorySeed&,
00062                              TrajectoryContainer& result) const ;  
00063 
00064   // Access to lower level components
00065   const TrajectoryStateUpdator&  updator() const    {return *theUpdator;}
00066   const Chi2MeasurementEstimatorBase&    estimator() const  {return *theEstimator;}
00067 
00068   //   PropagationDirection        direction() const  {return theDirection;}
00069 
00071   double        chiSquareCut()          {return theChiSquareCut;}
00072 
00074   int           maxCand()               {return theMaxCand;}
00075 
00076 
00078   float         lostHitPenalty()        {return theLostHitPenalty;}
00079 
00080   //   /** Tells whether an intermediary cleaning stage should take place during TB. */
00081   //   bool             intermediateCleaning()  {return theIntermediateCleaning;}
00082 
00084   double ptCut() {return theptCut;}
00085 
00087   double mass() {return theMass;}
00088 
00089 protected:
00090 
00091   virtual void analyseSeed(const TrajectorySeed& seed) const{}
00092 
00093   virtual void analyseMeasurements( const std::vector<TM>& meas, 
00094                                     const Trajectory& traj) const{}
00095   virtual void analyseResult( const TrajectoryContainer& result) const {}
00096 
00097 private :
00099   GroupedCkfTrajectoryBuilder (const GroupedCkfTrajectoryBuilder&);
00100 
00102   GroupedCkfTrajectoryBuilder& operator= (const GroupedCkfTrajectoryBuilder&);
00103 
00105   void buildTrajectories (const TrajectorySeed&,
00106                                   TrajectoryContainer &ret,
00107                                   const TrajectoryFilter*) const;
00108   
00109   inline bool tkxor(bool a, bool b) const {return (a||b) && !(a&&b);}
00110   // to be ported later
00111 
00112   bool advanceOneLayer( TempTrajectory& traj, 
00113                         const TrajectoryFilter* regionalCondition,
00114                         const Propagator* propagator, 
00115                         bool inOut,
00116                         TempTrajectoryContainer& newCand, 
00117                         TempTrajectoryContainer& result) const;
00118 
00119   void groupedLimitedCandidates( TempTrajectory& startingTraj, 
00120                                  const TrajectoryFilter* regionalCondition,
00121                                  const Propagator* propagator, 
00122                                  bool inOut,
00123                                  TempTrajectoryContainer& result) const;
00124 
00126   void rebuildSeedingRegion (TempTrajectory& startingTraj,
00127                              TempTrajectoryContainer& result) const ;
00128 
00129    //** try to find additional hits in seeding region for a candidate
00130    //* (returns number of trajectories added) *
00131   int rebuildSeedingRegion (const std::vector<const TrackingRecHit*>& seedHits,
00132                             TempTrajectory& candidate,
00133                             TempTrajectoryContainer& result) const ;
00134 
00135   // ** Backward fit of trajectory candidate except seed. Fit result and
00136   // *  remaining hits are returned in fittedTracks and remainingHits.
00137   // *  FittedTracks is empty if no fit was done. *
00138   void backwardFit (TempTrajectory& candidate, unsigned int nSeed,
00139                     const TrajectoryFitter& fitter,
00140                     TempTrajectoryContainer& fittedTracks,
00141                     std::vector<const TrackingRecHit*>& remainingHits) const;
00142 
00144   bool verifyHits (TempTrajectory::DataContainer::const_iterator rbegin,
00145                    size_t maxDepth,
00146                    const std::vector<const TrackingRecHit*>& hits) const;
00147 
00149   void groupedIntermediaryClean(TempTrajectoryContainer& theTrajectories) const ;
00150 
00153   void layers (const TempTrajectory::DataContainer& measurements,
00154                std::vector<const DetLayer*> &fillme) const;
00155 
00157   inline PropagationDirection oppositeDirection (PropagationDirection dir) const {
00158     if ( dir==alongMomentum )  return oppositeToMomentum;
00159     else if ( dir==oppositeToMomentum )  return alongMomentum;
00160     return dir;
00161   }
00162 
00163 
00164 private:
00165   TrajectoryFilter*              theConfigurableCondition;
00166 
00167   //   typedef deque< const TrajectoryFilter*>   StopCondContainer;
00168   //   StopCondContainer              theStopConditions;
00169 
00170   double theChiSquareCut;       
00172   double theptCut;              
00174   double theMass;               
00176   int theMaxCand;               
00178   float theLostHitPenalty;      
00179   float theFoundHitBonus;       
00181   bool theIntermediateCleaning; 
00184   bool theAlwaysUseInvalid;
00185 
00186   bool theLockHits;             
00187   bool theBestHitOnly;          
00189   bool theRequireSeedHitsInRebuild; 
00191   unsigned int theMinNrOfHitsForRebuild;     
00194   unsigned int theMinNrOf2dHitsForRebuild;   
00198   mutable TempTrajectoryContainer work_; // Better here than alloc every time
00199   enum work_MaxSize_Size_ { work_MaxSize_ = 50 };  // if it grows above this number, it is forced to resize to half this amount when cleared
00200 };
00201 
00202 #endif