]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/UPGRADE/AliITSUTrackerGlo.h
MC labeling added
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUTrackerGlo.h
index 512ad9f2d322022f56aa0c481fe71846f5079463..7112f3bdb6fc0c6066b78e14bb0ef8b19be7dc0f 100644 (file)
 #include "AliTracker.h"
 #include "AliESDEvent.h"
 #include "AliITSUSeed.h"
+#include "AliITSUTrackCond.h"
+#include "AliITSUTrackHyp.h"
 
 class AliITSUReconstructor;
 class AliITSURecoDet;
 class AliITSUClusterPix;
-
+class AliESDtrack;
+class AliITSURecoLayer;
 class TTree;
 
 
@@ -22,6 +25,7 @@ class TTree;
 class AliITSUTrackerGlo : public AliTracker {
 
   public:
+  enum {kClus2Tracks,kPropBack,kRefitInw};   // tracking phases
   enum { // info from track extrapolation to layer for cluster check
     kTrXIn ,kTrYIn ,kTrZIn ,kTrPhiIn , // entrance (outer) point on the layer from above 
     kTrXOut,kTrYOut,kTrZOut,kTrPhiOut, // exit (inner) point on the layer
@@ -33,7 +37,8 @@ class AliITSUTrackerGlo : public AliTracker {
        ,kRWCheckFailed =2  // failed to rotate the seed to frame of the layer impact point
   };
   enum {kStopSearchOnSensor,kClusterNotMatching,kClusterMatching}; // flags for track-to-cluster checks
-
+  //
+  enum {kDummyLabel=-3141593};
   AliITSUTrackerGlo(AliITSUReconstructor* rec);
   virtual ~AliITSUTrackerGlo();
 
@@ -43,41 +48,71 @@ class AliITSUTrackerGlo : public AliTracker {
   virtual Int_t          LoadClusters(TTree * treeRP=0);
   virtual void           UnloadClusters();
   virtual AliCluster*    GetCluster(Int_t index) const;
-
-
+  //------------------------------------
+  AliITSURecoDet*        GetITSInterface()       const {return fITS;}
+  //
   //------------------------------------
   Bool_t                 NeedToProlong(AliESDtrack* estTr);
   void                   Init(AliITSUReconstructor* rec);
-  void                   FindTrack(AliESDtrack* esdTr);
-  Bool_t                 InitSeed(AliESDtrack *esdTr);
-  Int_t                  GetNSeeds(Int_t lr)              const {return fSeedsLr[lr].GetEntriesFast();} //RS TOCHECK
-  AliITSUSeed*           GetSeed(Int_t lr, Int_t sID)     const {return (AliITSUSeed*)fSeedsLr[lr].UncheckedAt(sID);} //RS TOCHECK
+  void                   FindTrack(AliESDtrack* esdTr, Int_t esdID);
+  Bool_t                 InitHypothesis(AliESDtrack *esdTr, Int_t esdID);
   Bool_t                 TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo);
-  Bool_t                 NeedToKill(AliITSUSeed* seed, Int_t flag) {return kFALSE;} // todo
-  void                   KillSeed(Int_t ilr, Int_t id) {} // todo
+  Bool_t                 TransportToLayer(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo);
+  Bool_t                 GoToExitFromLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
+  Bool_t                 GoToExitFromLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
+  Bool_t                 GoToEntranceToLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
+  Bool_t                 GoToEntranceToLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kFALSE);
+  Bool_t                 PropagateSeed(AliITSUSeed *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
+  Bool_t                 PropagateSeed(AliExternalTrackParam *seed, Double_t xToGo, Double_t mass, Double_t maxStep=1.0, Bool_t matCorr=kTRUE);
+  Bool_t                 RefitTrack(AliITSUTrackHyp* trc, Double_t r);
+  //
+  void                   KillSeed(AliITSUSeed* seed, Bool_t branch=kFALSE);
+  Bool_t                 NeedToKill(AliITSUSeed* seed, Int_t flag);
   Bool_t                 GetRoadWidth(AliITSUSeed* seed, int ilrA);
   Int_t                  CheckCluster(AliITSUSeed* seed, Int_t lr, Int_t clID);
   void                   AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr);
   //
   AliITSUSeed*           NewSeedFromPool(const AliITSUSeed* src=0);
-  void                   DeleteLastSeedFromPool()               {fSeedsPool.RemoveLast();}
-  void                   ResetSeedTree();  // RS TOCHECK
+  void                   ResetSeedsPool();
+  void                   MarkSeedFree(AliITSUSeed* seed );
+
+  AliITSUTrackHyp*       GetTrackHyp(Int_t id)               const  {return (AliITSUTrackHyp*)fHypStore.UncheckedAt(id);}
+  void                   SetTrackHyp(AliITSUTrackHyp* hyp,Int_t id) {fHypStore.AddAtAndExpand(hyp,id);}
+  void                   DeleteLastSeedFromPool()                   {fSeedsPool.RemoveLast();}
+  void                   SaveCurrentTrackHypotheses();
+  void                   FinalizeHypotheses();
+  void                   UpdateESDTrack(AliITSUTrackHyp* hyp);
+  void                   CookMCLabel(AliITSUTrackHyp* hyp);
+ //
+ protected:
+  TObject*&              NextFreeSeed();
   //
  private:
-  
+  //
   AliITSUTrackerGlo(const AliITSUTrackerGlo&);
   AliITSUTrackerGlo &operator=(const AliITSUTrackerGlo &tr);
   //
  protected:
   AliITSUReconstructor*           fReconstructor;  // ITS global reconstructor 
   AliITSURecoDet*                 fITS;            // interface to ITS
+  AliESDtrack*                    fCurrESDtrack;   // current esd track in processing
   Double_t                        fCurrMass;       // current track mass
   Double_t                        fTrImpData[kNTrImpData];  // data on track impact on the layer
   //
   // the seeds management to be optimized
-  TObjArray*                      fSeedsLr;        // seeds at each layer
-  TClonesArray                    fSeedsPool;      // pool for seeds
-
+  TObjArray                       fHypStore;       // storage for tracks hypotheses
+  AliITSUTrackHyp*                fCurrHyp;        // hypotheses container for current track
+  TClonesArray                    fSeedsPool;      //! pool for seeds
+  TArrayI                         fFreeSeedsID;    //! array of ID's of freed seeds
+  Int_t                           fNFreeSeeds;     //! number of seeds freed in the pool
+  Int_t                           fLastSeedID;     //! id of the pool seed on which is returned by the NextFreeSeed method
+  //
+  AliITSUTrackCond                fTrCond;         // tmp, to be moved to recoparam
+  Int_t                           fTrackPhase;     // tracking phase
+  Int_t*                          fClInfo;         //! auxiliary track cluster info
+  //
+  static const Double_t           fgkToler;        // tracking tolerance
+  //
   ClassDef(AliITSUTrackerGlo,1)   //ITS upgrade tracker
     
 };
@@ -86,10 +121,37 @@ class AliITSUTrackerGlo : public AliTracker {
 inline void AliITSUTrackerGlo::AddProlongationHypothesis(AliITSUSeed* seed, Int_t lr)
 {
   // add new seed prolongation hypothesis 
-  fSeedsLr[lr].AddLast(seed);
-  seed->Print("par");
+  fCurrHyp->AddSeed(seed,lr);
+  printf("*** Adding: "); seed->Print();
+}
+
+//________________________________________
+inline TObject *&AliITSUTrackerGlo::NextFreeSeed()
+{
+  // return next free slot where the seed can be created
+  fLastSeedID = fNFreeSeeds ? fFreeSeedsID.GetArray()[--fNFreeSeeds] : fSeedsPool.GetEntriesFast();
+  //  AliInfo(Form("%d",fLastSeedID));
+  return fSeedsPool[ fLastSeedID ];
+  //
+}
+
+//_________________________________________________________________________
+inline AliITSUSeed* AliITSUTrackerGlo::NewSeedFromPool(const AliITSUSeed* src)
+{
+  // create new seed, optionally copying from the source
+  AliITSUSeed* sd =  src ? new( NextFreeSeed() ) AliITSUSeed(*src) : new( NextFreeSeed() ) AliITSUSeed();
+  sd->SetPoolID(fLastSeedID);
+  return sd;
 }
 
+//_________________________________________________________________________
+inline void AliITSUTrackerGlo::KillSeed(AliITSUSeed* seed, Bool_t branch)
+{
+  // flag seed as killed, if requested, kill recursively its parents whose sole child is the seed being killed
+  seed->Kill();
+  seed = (AliITSUSeed*)seed->GetParent();
+  if (seed && !seed->DecChildren() && branch) KillSeed(seed,branch);
+}
 
 #endif