]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
RefitInward implemented
authorshahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jan 2013 18:45:17 +0000 (18:45 +0000)
committershahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jan 2013 18:45:17 +0000 (18:45 +0000)
ITS/UPGRADE/AliITSUSeed.cxx
ITS/UPGRADE/AliITSUSeed.h
ITS/UPGRADE/AliITSUTrackHyp.cxx
ITS/UPGRADE/AliITSUTrackHyp.h
ITS/UPGRADE/AliITSUTrackerGlo.cxx
ITS/UPGRADE/AliITSUTrackerGlo.h

index 1cbe2fd1f8e8f27c1cac9fd8d852dbc9dfef69c3..9ec1ef5932ba86000071a838dd90a814442aef31 100644 (file)
@@ -241,6 +241,20 @@ Bool_t AliITSUSeed::PropagateToX(Double_t xk, Double_t b)
   return kTRUE;
 }
 
+//__________________________________________________________________
+Int_t AliITSUSeed::GetClusterIndex(Int_t ind) const
+{
+  // get ind-th cluster index
+  int ncl = 0;
+  const AliITSUSeed* seed = this;
+  while(seed) {
+    if ( HasCluster() && (ncl++==ind) ) return seed->GetClusterID();
+    seed = (AliITSUSeed*)seed->GetParent();
+  }
+  return -1;
+  //
+}
+
 //______________________________________________________________________________
 Bool_t AliITSUSeed::RotateToAlpha(Double_t alpha) 
 {
@@ -718,3 +732,4 @@ Bool_t AliITSUSeed::Smooth(Double_t vecL[5],Double_t matL[15])
 }
 
  */
+
index ba23538a56ed3c0f80d2a315917457e53b91f8af..90895e537ee2c8c55b422ad70dabbe5d6dff339b 100644 (file)
@@ -36,7 +36,10 @@ class AliITSUSeed: public AliExternalTrackParam
   Int_t           GetLayerID()                     const {return UnpackLayer(fClID);}
   Int_t           GetClusterID()                   const {return UnpackCluster(fClID);}
   Bool_t          HasClusterOnLayer(Int_t lr)      const {return fHitsPattern&(0x1<<lr);}
+  Bool_t          HasCluster()                     const {return IsCluster(fClID);}
   Int_t           GetNLayersHit()                  const {return NumberOfBitsSet(fHitsPattern);}
+  Int_t           GetNClusters()                   const;
+  Int_t           GetClusterIndex(Int_t ind)       const;
   UShort_t        GetHitsPattern()                 const {return fHitsPattern;}
   Float_t         GetChi2Cl()                      const {return fChi2Cl;}
   Float_t         GetChi2Glo()                     const {return fChi2Glo;}
@@ -74,17 +77,17 @@ class AliITSUSeed: public AliExternalTrackParam
   //
  protected:
   //
-  Double_t              fFMatrix[kNFElem];  // matrix of propagation from prev layer (non-trivial elements)
-  Double_t              fKMatrix[kNKElem];  // Gain matrix non-trivial elements (note: standard MBF formula uses I-K*H)
-  Double_t              fRMatrix[kNRElem];  // rotation matrix non-trivial elements
-  Double_t              fCovIYZ[3];         // inverted matrix of propagation + meas errors = [Hi * Pi|i-1 * Hi^T + Ri]^-1
-  Double_t              fResid[2];          // residuals vector
   UShort_t              fHitsPattern;       // bit pattern of hits
   UShort_t              fNChildren;         // number of children (prolongations)
   UInt_t                fClID;              // packed cluster info (see AliITSUAux::PackCluster)
   Float_t               fChi2Glo;           // current chi2 global (sum of track-cluster chi2's on layers with hit)
   Float_t               fChi2Cl;            // track-cluster chi2 (if >0) or penalty for missing cluster (if < 0)
   Float_t               fChi2Penalty;       // total penalty (e.g. for missing clusters)
+  Double_t              fFMatrix[kNFElem];  // matrix of propagation from prev layer (non-trivial elements)
+  Double_t              fKMatrix[kNKElem];  // Gain matrix non-trivial elements (note: standard MBF formula uses I-K*H)
+  Double_t              fRMatrix[kNRElem];  // rotation matrix non-trivial elements
+  Double_t              fCovIYZ[3];         // inverted matrix of propagation + meas errors = [Hi * Pi|i-1 * Hi^T + Ri]^-1
+  Double_t              fResid[2];          // residuals vector
   TObject*              fParent;            // parent track (in higher tree hierarchy)
   
   ClassDef(AliITSUSeed,1)
@@ -145,4 +148,18 @@ inline const AliITSUSeed* AliITSUSeed::GetParent(Int_t lr) const
   return par;
 }
 
+//__________________________________________________________________
+inline Int_t AliITSUSeed::GetNClusters() const
+{
+  // count number of clusters (some layers may have >1 hit)
+  int ncl = 0;
+  const AliITSUSeed* seed = this;
+  while(seed) {
+    if (seed->HasCluster()) ncl++;
+    seed = (AliITSUSeed*)seed->GetParent();
+  }
+  return ncl;
+  //
+}
+
 #endif
index d977f3f32261b70461fb6f835b93a12d7ce084b7..5f974a9d89b027322ad24dfa1737954d37cf711f 100644 (file)
@@ -126,8 +126,12 @@ Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
   // fill cl.id's in the array. The clusters of layer L will be set at slots
   // clID[2L] (and clID[2L+1] if there is an extra cluster).
   for (int i=fNLayers<<1;i--;) clIDarr[i]=-1;
-  AliITSUSeed* seed = GetWinner();
   Int_t lr,ncl=0;
+  AliITSUSeed* seed = GetWinner();
+  if (!seed) {
+    AliFatal("The winner is not set");
+    return ncl;
+  }
   while(seed) {
     int clID = seed->GetLrCluster(lr);
     if (clID>=0) {
@@ -139,3 +143,33 @@ Int_t AliITSUTrackHyp::FetchClusterInfo(Int_t *clIDarr) const
   }
   return ncl;
 }
+
+//__________________________________________________________________
+Int_t AliITSUTrackHyp::GetNumberOfClusters() const
+{
+  // This is a temporary (slow) way of accessing number of clusters
+  // TODO: add dedicated data members filled by winner
+  AliITSUSeed* seed = GetWinner();
+  int ncl = 0;
+  if (!seed) {
+    AliFatal("The winner is not set");
+    return ncl;
+  }
+  return seed->GetNClusters();
+  //
+}
+
+//__________________________________________________________________
+Int_t AliITSUTrackHyp::GetClusterIndex(Int_t ind) const 
+{
+  // This is a temporary (slow) way of accessing cluster index
+  // TODO: add dedicated data members filled by winner
+  AliITSUSeed* seed = GetWinner();
+  int ncl = 0;
+  if (!seed) {
+    AliFatal("The winner is not set");
+    return -1;
+  }
+  return seed->GetClusterIndex(ind);
+  //
+}
index 01eb07504305119df17e920c96d36e8de25c3370..ebc72b4aedb3d21c833bce1f119fc8a50bcb5e49 100644 (file)
@@ -37,9 +37,9 @@ class AliITSUTrackHyp: public AliKalmanTrack
   virtual Double_t   GetPredictedChi2(const AliCluster *c) const;
   virtual Bool_t     PropagateTo(Double_t xr, Double_t x0, Double_t rho);
   virtual Bool_t     Update(const AliCluster* c, Double_t chi2, Int_t index);
-  virtual Int_t      GetClusterIndex(Int_t)  const { return -1;}
-  virtual Int_t      GetNumberOfTracklets()  const { return 0;}
-  virtual Int_t      GetTrackletIndex(Int_t) const { return -1;}
+  virtual Int_t      GetNumberOfClusters()   const;
+  virtual Int_t      GetClusterIndex(Int_t ind)  const;
+  //  virtual Int_t      GetTrackletIndex(Int_t) const { return -1;}
   virtual Double_t   GetPIDsignal()          const { return 0;}
   //
   virtual void       Print(Option_t* option = "") const;
index a9f2aa27bf0197968df26ff796d4e3b52d2b2bbc..719493c12ce79bb983b020cc7ecbf3ece11260d6 100644 (file)
@@ -118,8 +118,8 @@ Int_t AliITSUTrackerGlo::Clusters2Tracks(AliESDEvent *esdEv)
 {
   //
   //
+  SetTrackingPhase(kClus2Tracks);
   ResetSeedsPool();
-  fTrackPhase = kClus2Tracks;
   int nTrESD = esdEv->GetNumberOfTracks();
   AliInfo(Form("Will try to find prolongations for %d tracks",nTrESD));
   AliITSUReconstructor::GetRecoParam()->Print();
@@ -148,9 +148,9 @@ Int_t AliITSUTrackerGlo::PropagateBack(AliESDEvent *esdEv)
   //
   // Do outward fits in ITS
   //
-  fTrackPhase = kPropBack;
+  SetTrackingPhase(kPropBack);
   int nTrESD = esdEv->GetNumberOfTracks();
-  AliInfo(Form("Will fit %d tracks",nTrESD));
+  AliInfo(Form("Will propagate back %d tracks",nTrESD));
   //
   double bz0 = GetBz();
   Double_t xyzTrk[3],xyzVtx[3]={GetX(),GetY(),GetZ()};
@@ -204,6 +204,9 @@ Int_t AliITSUTrackerGlo::PropagateBack(AliESDEvent *esdEv)
     if (RefitTrack(currTr,fITS->GetRMax())) { // propagate to exit from the ITS/TPC screen
       UpdateESDTrack(currTr,AliESDtrack::kITSout);
     }
+    else {
+      AliInfo(Form("Refit Failed for track %d",itr));
+    }
     //
   }
   //
@@ -211,13 +214,34 @@ Int_t AliITSUTrackerGlo::PropagateBack(AliESDEvent *esdEv)
 }
 
 //_________________________________________________________________________
-Int_t AliITSUTrackerGlo::RefitInward(AliESDEvent * /*event*/)
+Int_t AliITSUTrackerGlo::RefitInward(AliESDEvent *esdEv)
 {
   //
-  // To be implemented 
+  // refit the tracks inward, using current cov.matrix
+  //
+  SetTrackingPhase(kRefitInw);
+  Int_t nTrESD = esdEv->GetNumberOfTracks();
+  AliInfo(Form("Will refit inward %d tracks",nTrESD));
+  AliITSUTrackHyp *currTr=0;
+  //
+  for (int itr=0;itr<nTrESD;itr++) {
+    AliESDtrack *esdTr = esdEv->GetTrack(itr);
+    // Start time integral and add distance from current position to vertex 
+    UInt_t trStat = esdTr->GetStatus();
+    if ( !(trStat & AliESDtrack::kITSout) ) continue;
+    if (   trStat & AliESDtrack::kITSrefit ) continue; // already done
+    if (  (trStat & AliESDtrack::kTPCout) && !(trStat & AliESDtrack::kTPCrefit) ) continue;
+    //
+    currTr = GetTrackHyp(itr);
+    currTr->AliExternalTrackParam::operator=(*esdTr);  // fetch current ESDtrack kinematics
+    if (RefitTrack(currTr,fITS->GetRMin())) { // propagate up to inside radius of the beam pipe
+      UpdateESDTrack(currTr,AliESDtrack::kITSrefit);
+    }
+    else {
+      AliInfo(Form("Refit Failed for track %d",itr));
+    }
+  }    
   //
-  
-  Info("RefitInward","To be implemented");
   return 0;
 }
 
@@ -461,12 +485,14 @@ Bool_t AliITSUTrackerGlo::GoToExitFromLayer(AliITSUSeed* seed, AliITSURecoLayer*
   double xToGo = lr->GetR(dir);
   if (check) { // do we need to track till the surface of the current layer ?
     double curR2 = seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY(); // current radius
+    //    AliInfo(Form(" dir:%d Cur: %e Tgt: %e",dir,Sqrt(curR2),xToGo));
     if      (dir>0) { if (curR2-xToGo*xToGo>fgkToler) return kTRUE; } // on the surface or outside of the layer
     else if (dir<0) { if (xToGo*xToGo-curR2>fgkToler) return kTRUE; } // on the surface or outside of the layer
   }
   if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
   // go via layer to its boundary, applying material correction.
   if (!PropagateSeed(seed,xToGo,fCurrMass, lr->GetMaxStep())) return kFALSE;
+  //
   return kTRUE;
   //
 }
@@ -485,6 +511,7 @@ Bool_t AliITSUTrackerGlo::GoToExitFromLayer(AliExternalTrackParam* seed, AliITSU
   if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
   // go via layer to its boundary, applying material correction.
   if (!PropagateSeed(seed,xToGo,fCurrMass, lr->GetMaxStep())) return kFALSE;
+  //
   return kTRUE;
   //
 }
@@ -860,7 +887,7 @@ Bool_t AliITSUTrackerGlo::RefitTrack(AliITSUTrackHyp* trc, Double_t rDest, Bool_
     if (!lr->IsActive() || fClInfo[ilrA2=(ilrA<<1)]<0) continue; 
     //
     if (ilr!=lrStart && !TransportToLayer(&tmpTr,lrStart,ilr)) {
-      printf("Failed to transport %d -> %d\n",lrStart,ilr);
+      AliInfo(Form("Failed to transport %d -> %d\n",lrStart,ilr));
       return kFALSE; // go to the entrance to the layer
     }
     lrStart = ilr;
@@ -879,11 +906,20 @@ Bool_t AliITSUTrackerGlo::RefitTrack(AliITSUTrackHyp* trc, Double_t rDest, Bool_
     for (int icl=0;icl<nclLr;icl++) {
       AliITSUClusterPix* clus =  (AliITSUClusterPix*)lr->GetCluster(iclLr[icl]);
       AliITSURecoSens* sens = lr->GetSensorFromID(clus->GetVolumeId());
-      if (!tmpTr.Rotate(sens->GetPhiTF())) return kFALSE;
-      printf("Refit cl:%d on lr %d Need to go %.4f -> %.4f\n",icl,ilrA,tmpTr.GetX(),sens->GetXTF()+clus->GetX());
-      if (!PropagateSeed(&tmpTr,sens->GetXTF()+clus->GetX(),fCurrMass)) return kFALSE;
-      if (!tmpTr.Update(clus)) return kFALSE;
-      printf("AfterRefit: "); tmpTr.AliExternalTrackParam::Print();
+      if (!tmpTr.Rotate(sens->GetPhiTF())) {
+       AliInfo(Form("Failed on rotate to %f",sens->GetPhiTF()));
+       return kFALSE;
+      }
+      //printf("Refit cl:%d on lr %d Need to go %.4f -> %.4f\n",icl,ilrA,tmpTr.GetX(),sens->GetXTF()+clus->GetX());
+      if (!PropagateSeed(&tmpTr,sens->GetXTF()+clus->GetX(),fCurrMass)) {
+       AliInfo(Form("Failed on propagate to %f",sens->GetXTF()+clus->GetX())); 
+       return kFALSE;
+      }
+      if (!tmpTr.Update(clus)) {
+       AliInfo(Form("Failed on Update"));              
+       return kFALSE;
+      }
+      //printf("AfterRefit: "); tmpTr.AliExternalTrackParam::Print();
       if (stopAtLastCl && ++clCount==ncl) return kTRUE; // it was requested to not propagate after last update
     }
     //
@@ -892,11 +928,17 @@ Bool_t AliITSUTrackerGlo::RefitTrack(AliITSUTrackHyp* trc, Double_t rDest, Bool_
   // Still, try to go as close as possible to rDest.
   //
   if (lrStart!=lrStop) {
-    printf("Going to last layer %d -> %d\n",lrStart,lrStop);
-    if (!TransportToLayer(&tmpTr,lrStart,lrStop)) return kTRUE;    
-    if (!GoToExitFromLayer(&tmpTr,fITS->GetLayer(lrStop),dir)) return kFALSE; // go till the exit from layer
+    //printf("Going to last layer %d -> %d\n",lrStart,lrStop);
+    if (!TransportToLayer(&tmpTr,lrStart,lrStop)) {
+      AliInfo(Form("Failed on TransportToLayer %d->%d",lrStart,lrStop));               
+      return kTRUE;
+    }    
+    if (!GoToExitFromLayer(&tmpTr,fITS->GetLayer(lrStop),dir)) {
+      AliFatal(Form("Failed on GoToExitFromLayer %d",lrStop));         
+      return kTRUE; // go till the exit from layer
+    }
     //
-    printf("On exit from last layer\n");
+    //printf("On exit from last layer\n");
     tmpTr.AliExternalTrackParam::Print();
     // go to the destination radius
     if (!tmpTr.GetXatLabR(rDest,rDest,GetBz(),dir)) return kTRUE;
index a1e7b71c066ff91062b54485d34c1fcd56b923dd..3ee304e99f61b885f7a221770c34fa8c7d469800 100644 (file)
@@ -58,13 +58,15 @@ class AliITSUTrackerGlo : public AliTracker {
   Bool_t                 InitHypothesis(AliESDtrack *esdTr, Int_t esdID);
   Bool_t                 TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo);
   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                 GoToExitFromLayer(AliITSUSeed* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
+  Bool_t                 GoToExitFromLayer(AliExternalTrackParam* seed, AliITSURecoLayer* lr, Int_t dir, Bool_t check=kTRUE);
   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, Bool_t stopAtLastCl=kFALSE);
+  Int_t                  GetTrackingPhase()                 const {return fTrackPhase;}
+
   //
   void                   KillSeed(AliITSUSeed* seed, Bool_t branch=kFALSE);
   Bool_t                 NeedToKill(AliITSUSeed* seed, Int_t flag);
@@ -83,6 +85,7 @@ class AliITSUTrackerGlo : public AliTracker {
   void                   FinalizeHypotheses();
   void                   UpdateESDTrack(AliITSUTrackHyp* hyp,Int_t flag);
   void                   CookMCLabel(AliITSUTrackHyp* hyp);
+  void                   SetTrackingPhase(Int_t p)        {fTrackPhase = p;}
  //
  protected:
   TObject*&              NextFreeSeed();