Mip-track matching improved. Now Last point of HMPID stored and track re-fitted.
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Sep 2008 18:21:29 +0000 (18:21 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Sep 2008 18:21:29 +0000 (18:21 +0000)
HMPID/AliHMPIDRecon.cxx
HMPID/AliHMPIDRecon.h
HMPID/AliHMPIDTracker.cxx
HMPID/AliHMPIDTracker.h
HMPID/AliHMPIDtrack.cxx
HMPID/AliHMPIDtrack.h

index 76de088..ce974bd 100644 (file)
@@ -79,7 +79,7 @@ void AliHMPIDRecon::DeleteVars()const
   delete fPhotWei;
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean,Double_t qthre)
+void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t index,Double_t nmean)
 {
 // Pattern recognition method based on Hough transform
 // Arguments:   pTrk     - track for which Ckov angle is to be found
@@ -89,7 +89,6 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t n
 
   const Int_t nMinPhotAcc = 3;                      // Minimum number of photons required to perform the pattern recognition
   
-  
   Int_t nClusTot = pCluLst->GetEntries();
   if(nClusTot>fParam->MultCut()) fIsWEIGHT = kTRUE; // offset to take into account bkg in reconstruction
   else                           fIsWEIGHT = kFALSE;
@@ -102,48 +101,37 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t n
 
   fParam->SetRefIdx(nmean);
 
-  Float_t dMin=999,mipX=-1,mipY=-1;Int_t chId=-1,mipId=-1,mipQ=-1;
-  Int_t sizeClu = -1;
+  Float_t mipX=-1,mipY=-1;
+  Int_t chId=-1,mipQ=-1,sizeClu = -1;
+  
   fPhotCnt=0;
+  
   for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
-    AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu);                       //get pointer to current cluster    
+    AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu);                     //get pointer to current cluster    
+    if(iClu == index) {                                                                     // this is the MIP! not a photon candidate: just store mip info
+      mipX = pClu->X();
+      mipY = pClu->Y();
+      mipQ=(Int_t)pClu->Q();
+      sizeClu=pClu->Size();
+      continue;                                                             
+    }
     chId=pClu->Ch();
-    if(pClu->Q()>qthre){                                                                      //charge compartible with MIP clusters      
-      Float_t dX=fPc.X()-pClu->X(),dY=fPc.Y()-pClu->Y(),d =TMath::Sqrt(dX*dX+dY*dY);          //distance between current cluster and intersection point
-      if( d < dMin) {mipId=iClu; dMin=d;mipX=pClu->X();
-                     mipY=pClu->Y();mipQ=(Int_t)pClu->Q();sizeClu=pClu->Size();}              //current cluster is closer, overwrite data for min cluster
-    }else{                                                                                    //charge compatible with photon cluster
-      Double_t thetaCer,phiCer;
-      if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){                                  //find ckov angle for this  photon candidate
-        fPhotCkov[fPhotCnt]=thetaCer;                                                         //actual theta Cerenkov (in TRS)
-        fPhotPhi [fPhotCnt]=phiCer;                                                           //actual phi   Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
-       //PH        Printf("photon n. %i reconstructed theta = %f",fPhotCnt,fPhotCkov[fPhotCnt]);
-        fPhotCnt++;                                                                           //increment counter of photon candidates
-      }
+    Double_t thetaCer,phiCer;
+    if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){                                  //find ckov angle for this  photon candidate
+      fPhotCkov[fPhotCnt]=thetaCer;                                                         //actual theta Cerenkov (in TRS)
+      fPhotPhi [fPhotCnt]=phiCer;                                                           //actual phi   Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
+      fPhotCnt++;                                                                           //increment counter of photon candidates
     }
   }//clusters loop
 
   pTrk->SetHMPIDmip(mipX,mipY,mipQ,fPhotCnt);                                                //store mip info in any case 
   
-  if(nmean < 0){                                                                             //track didn' t pass through the radiator
-    pTrk->SetHMPIDsignal(kNoRad);                                                            //set the appropriate flag
-    pTrk->SetHMPIDcluIdx(chId,mipId+1000*sizeClu);                                           //set index of cluster
-    return;
-  }
-   
   if(fPhotCnt<=nMinPhotAcc) {                                                                 //no reconstruction with <=3 photon candidates
     pTrk->SetHMPIDsignal(kNoPhotAccept);                                                      //set the appropriate flag
-    pTrk->SetHMPIDcluIdx(chId,mipId+1000*sizeClu);                                            //set index of cluster
+    pTrk->SetHMPIDcluIdx(chId,index+1000*sizeClu);                                            //set index of cluster
     return;
   }
   
-  if(mipId==-1) {
-    pTrk->SetHMPIDcluIdx(chId,9999);                                                          //set index of cluster
-    pTrk->SetHMPIDsignal(kMipQdcCut);
-    return;
-  }                                                                                           //no clusters with QDC more the threshold at all
-    pTrk->SetHMPIDcluIdx(chId,mipId+1000*sizeClu);                                            //set chamber, index of cluster + cluster size
-    if(dMin>fParam->DistCut()) {pTrk->SetHMPIDsignal(kMipDistCut); return;}                   //closest cluster with enough charge is still too far from intersection
   
   fMipPos.Set(mipX,mipY);
   
index cc2884c..705a10a 100644 (file)
@@ -27,8 +27,8 @@ public :
     virtual ~AliHMPIDRecon() {;} //dtor
 
   void     InitVars     (Int_t n);                                                                 //init space for variables
-  void     DeleteVars   ()const;                                                                        //delete variables
-  void     CkovAngle    (AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean, Double_t qthre);  //reconstructed Theta Cerenkov
+  void     DeleteVars   ()const;                                                                   //delete variables
+  void     CkovAngle    (AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t index,Double_t nmean );     //reconstructed Theta Cerenkov
   Bool_t   FindPhotCkov (Double_t cluX,Double_t cluY,Double_t &thetaCer,Double_t &phiCer    );     //find ckov angle for single photon candidate
   Double_t FindRingCkov (Int_t iNclus                                                       );     //best ckov for ring formed by found photon candidates
   void     FindRingGeom (Double_t ckovAng,Int_t level=1                                     );     //estimated area of ring in cm^2 and portion accepted by geometry
index 080fc77..9bfe6e3 100644 (file)
@@ -1,4 +1,5 @@
 #include "AliHMPIDTracker.h"     //class header
+#include "AliHMPIDtrack.h"     //class header
 #include "AliHMPIDCluster.h"     //GetTrackPoint(),PropagateBack() 
 #include "AliHMPIDParam.h"       //GetTrackPoint(),PropagateBack()
 #include "AliHMPIDRecon.h"       //Recon()
@@ -65,6 +66,27 @@ Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xPc,Float_t &yPc,Flo
   return -1;                                                                                    //no intersection with HMPID chambers
 }//IntTrkCha()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Int_t AliHMPIDTracker::IntTrkCha(Int_t ch,AliHMPIDtrack *pTrk,Float_t &xPc,Float_t &yPc,Float_t &xRa,Float_t &yRa,Float_t &theta,Float_t &phi)
+{
+// Static method to find intersection in between given track and HMPID chambers
+// Arguments: pTrk- HMPID track; xPc,yPc- track intersection with PC in LORS [cm]
+//   Returns: intersected chamber ID or -1
+    AliHMPIDParam *pParam=AliHMPIDParam::Instance();
+    Double_t p1[3],n1[3]; 
+    pParam->Norm(ch,n1); 
+    pParam->Point(ch,p1,AliHMPIDParam::kRad);                                                    //point & norm  for middle of radiator plane
+    Double_t p2[3],n2[3]; 
+    pParam->Norm(ch,n2); 
+    pParam->Point(ch,p2,AliHMPIDParam::kPc);                                                     //point & norm  for entrance to PC plane
+    if(pTrk->Intersect(pTrk,p1,n1)==kFALSE) return -1;                                           //try to intersect track with the middle of radiator
+    if(pTrk->Intersect(pTrk,p2,n2)==kFALSE) return -1;   
+    pParam->Mars2LorsVec(ch,n1,theta,phi);                                                       //track angles at RAD
+    pParam->Mars2Lors   (ch,p1,xRa,yRa);                                                         //TRKxRAD position
+    pParam->Mars2Lors   (ch,p2,xPc,yPc);                                                         //TRKxPC position
+    if(AliHMPIDParam::IsInside(xPc,yPc,pParam->DistCut())==kTRUE) return ch;                     //return intersected chamber  
+  return -1;                                                                                     //no intersection with HMPID chambers
+}//IntTrkCha()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
 {
 // Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control. Done once per event.
@@ -82,8 +104,8 @@ Int_t AliHMPIDTracker::PropagateBack(AliESDEvent *pEsd)
 //   Returns: error code    
   AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean"); //contains TObjArray of 42 TF1 + 1 EPhotMean
   AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre"); //contains TObjArray of 42 (7ch * 6sec) TF1
-  if(!pNmeanEnt) AliError("No Nmean C6F14 ");
-  if(!pQthreEnt) AliError("No Qthre");
+  if(!pNmeanEnt) AliFatal("No Nmean C6F14 ");
+  if(!pQthreEnt) AliFatal("No Qthre");
     
   return Recon(pEsd,fClu,(TObjArray*)pNmeanEnt->GetObject(),(TObjArray*)pQthreEnt->GetObject());  
 }//PropagateBack()
@@ -93,45 +115,143 @@ Int_t AliHMPIDTracker::Recon(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmea
 // Static method to reconstruct Theta Ckov for all valid tracks of a given event.
 // Arguments: pEsd- pointer ESD; pClu- pointer to clusters for all chambers; pNmean - pointer to all function Nmean=f(time)
 //   Returns: error code, 0 if no errors   
-  AliHMPIDRecon recon;                                                                       //instance of reconstruction class, nothing important in ctor
+  
+  AliHMPIDRecon recon;                                                                           //instance of reconstruction class, nothing important in ctor
   Float_t xPc,yPc,xRa,yRa,theta,phi;
-  for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){                                       //ESD tracks loop
-    AliESDtrack *pTrk = pEsd->GetTrack(iTrk);                                                    //get reconstructed track    
-    Int_t cham=IntTrkCha(pTrk,xPc,yPc,xRa,yRa,theta,phi);                                        //get chamber intersected by this track 
-    if(cham<0) {                                                                                 //no intersection at all, go after next track
+  Double_t cluLORS[2]={0},cluMARS[3]={0},trkMARS[3]={0};
+//  Double_t bestcluMARS[3]={0,0,0};
+  Double_t radClu,radInitTrk;   
+  Int_t nMipClusTot=0;
+  Double_t d3d=0,dmin=999999,bz=0;
+  Bool_t isMatched=kFALSE;
+  Int_t bestCluCh=-1;
+  Int_t cluSiz=0;
+  Double_t qthre = 0;   Double_t nmean=0; Int_t cham=0; Int_t hvsec=0;
+  Int_t index=0;                                                                                //index of the "best" matching cluster
+  Double_t bestChi2=-1;                                                                         //Chi2 of the "best" matching cluster
+  Double_t chi2=0;   
+  Int_t nClusCh[AliHMPIDParam::kMaxCh+1];
+  Bool_t isOkQcut=kFALSE;
+  Bool_t isOkDcut=kFALSE;
+  
+  AliHMPIDParam *pParam = AliHMPIDParam::Instance();                                             //Instance of AliHMPIDParam
+  
+  for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){                                        //loop on the ESD tracks in the event
+    isMatched=kFALSE;bestCluCh=-1;dmin=999999;bestChi2=99999;chi2=99999;cluSiz=0;                 //init. track matching params
+    isOkQcut = kFALSE;
+    AliHMPIDCluster *bestHmpCluster=0x0;                                                          //the best matching cluster
+    AliESDtrack *pTrk = pEsd->GetTrack(iTrk);                                                     //get reconstructed track    
+    AliHMPIDtrack *hmpTrk = new AliHMPIDtrack(*pTrk);                                             //create a hmpid track to be used for propagation and matching 
+    bz=AliTracker::GetBz();  
+    
+    Int_t ipCh=IntTrkCha(pTrk,xPc,yPc,xRa,yRa,theta,phi);
+    if(ipCh<0) {                                                                                 //no intersection at all, go after next track
       pTrk->SetHMPIDtrk(0,0,0,0);                                                                //no intersection found
       pTrk->SetHMPIDcluIdx   (99,99999);                                                         //chamber not found, mip not yet considered
       pTrk->SetHMPIDsignal(AliHMPIDRecon::kNotPerformed);                                        //ring reconstruction not yet performed
       continue;                                                                         
     }
+    
+// track intersects the chamber ipCh: find the MIP          
+    
+    TClonesArray *pMipCluLst=(TClonesArray *)pClus->At(ipCh);                                   //get the list of clusters
+    nMipClusTot = pMipCluLst->GetEntries();                                                     //total number of clusters in the given chamber
+    nClusCh[ipCh] = nMipClusTot;
+    
+    for (Int_t iClu=0; iClu<nMipClusTot;iClu++) {                                               //clusters loop
+      
+      AliHMPIDCluster *pClu=(AliHMPIDCluster*)pMipCluLst->UncheckedAt(iClu);                    //get the cluster
+// evaluate qThre
+      if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) {                                             // just for backward compatibility
+        qthre=((TF1*)pQthre->At(pClu->Ch()))->Eval(pEsd->GetTimeStamp());                          //
+      } else {                                                                                     // in the past just 1 qthre
+        hvsec = pParam->InHVSector(pClu->Y());                                              //  per chamber
+        if(hvsec>=0)
+         qthre=((TF1*)pQthre->At(6*cham+hvsec))->Eval(pEsd->GetTimeStamp());                      //
+      }                                                                                            //
+//
+      if(pClu->Q()<qthre) continue;                                                                      //charge compartible with MIP clusters      
+      isOkQcut = kTRUE;
+
+      cluLORS[0]=pClu->X(); cluLORS[1]=pClu->Y();                                            //get the LORS coordinates of the cluster
+      pParam->Lors2Mars(ipCh,cluLORS[0],cluLORS[1],cluMARS);              //convert cluster coors. from LORS to MARS
+      radClu=TMath::Sqrt(cluMARS[0]*cluMARS[0]+cluMARS[1]*cluMARS[1]);                       //radial distance of candidate cluster in MARS                                          
+      Double_t trkx0[3]; 
+      hmpTrk->GetXYZ(trkx0);                                                                 //get track position in MARS
+      radInitTrk=TMath::Sqrt(trkx0[0]*trkx0[0]+trkx0[1]*trkx0[1]);
+      hmpTrk->PropagateToR(radClu,10);
+      hmpTrk->GetXYZ(trkx0);                                                                   //get track position in MARS
+      hmpTrk->GetXYZAt(radClu,bz,trkMARS);                                                     //get the track coordinates at the rad distance after prop. 
+      d3d=TMath::Sqrt((cluMARS[0]-trkMARS[0])*(cluMARS[0]-trkMARS[0])+(cluMARS[1]-trkMARS[1])*(cluMARS[1]-trkMARS[1])+(cluMARS[2]-trkMARS[2])*(cluMARS[2]-trkMARS[2]));
+      chi2=hmpTrk->GetPredictedChi2(pClu);
+      if(dmin > d3d ) {                                                                         //to be saved for the moment...
+        cluSiz = pClu->Size();
+        dmin=d3d;
+        bestCluCh=ipCh;
+        bestHmpCluster=pClu;
+        index=iClu;
+        bestChi2=chi2;
+        cluLORS[0]=pClu->X(); cluLORS[1]=pClu->Y();
+//        pParam->Lors2Mars(ipCh,cluLORS[0],cluLORS[1],bestcluMARS); 
+      }//global dmin cut 
+    }//clus loop
+
+    if(!isOkQcut) {
+      pTrk->SetHMPIDcluIdx(ipCh,9999);                                                          
+      pTrk->SetHMPIDsignal(pParam->kMipQdcCut);
+      continue;                                                                     
+    }
+    
+    if(dmin < pParam->DistCut()) {
+      isOkDcut = kTRUE;
+    }
+
+    if(!isOkDcut) {
+      pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz);                                             //set chamber, index of cluster + cluster size
+      pTrk->SetHMPIDsignal(pParam->kMipDistCut);                                                //closest cluster with enough charge is still too far from intersection
+    }
+    
+    if(isOkQcut*isOkDcut) isMatched = kTRUE;                                                    // MIP-Track matched !!    
+    
+    if(!isMatched) continue;                                                                    // If matched continue...
+    
+    Int_t indexAll = 0;
+    for(Int_t iC=0;iC<bestCluCh;iC++) indexAll+=nClusCh[iC]; indexAll+=index;                    //to be verified...
+
+    Bool_t isOk = hmpTrk->Update(bestHmpCluster,bestChi2,indexAll);
+    if(!isOk) continue;
+    pTrk->SetOuterParam((AliExternalTrackParam*)&hmpTrk,AliESDtrack::kHMPIDout);                 
+
+//    cham=IntTrkCha(bestCluCh,hmpTrk,xPc,yPc,xRa,yRa,theta,phi);
+    cham=IntTrkCha(pTrk,xPc,yPc,xRa,yRa,theta,phi);
+    if(cham<0) {                                                                                  //no intersection at all, go after next track
+      pTrk->SetHMPIDtrk(0,0,0,0);                                                                //no intersection found
+      pTrk->SetHMPIDcluIdx   (99,99999);                                                         //chamber not found, mip not yet considered
+      pTrk->SetHMPIDsignal(AliHMPIDRecon::kNotPerformed);                                        //ring reconstruction not yet performed
+      continue;                                                                         
+    }
+
     pTrk->SetHMPIDtrk(xRa,yRa,theta,phi);                                                        //store initial infos
-    Double_t nmean;
-    if(pNmean->GetEntries()==21) {                                                               //for backward compatibility
-       nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp());                             //C6F14 Nmean for this chamber
-     } else {
-       Int_t iRad     = AliHMPIDParam::Radiator(yRa);                                            //evaluate the radiator involved
-       if(iRad < 0) {
-        nmean = -1;
-       } else {
-        //AliDebug(1,"\n track didn' t pass through the radiator \n");                           //check track passage through the radiators
-       Double_t tLow  = ((TF1*)pNmean->At(6*cham+2*iRad  ))->Eval(pEsd->GetTimeStamp());         //C6F14 low  temp for this chamber
-       Double_t tHigh = ((TF1*)pNmean->At(6*cham+2*iRad+1))->Eval(pEsd->GetTimeStamp());         //C6F14 high temp for this chamber
-       Double_t tExp  = AliHMPIDParam::FindTemp(tLow,tHigh,yRa);                                 //estimated temp for that chamber at that y
-       nmean = AliHMPIDParam::NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp);           //mean ref idx @ a given temp
-       }
-     }
-    Double_t qthre = 0; 
-    if(pQthre->GetEntriesFast()==AliHMPIDParam::kMaxCh+1)                                        // just for backward compatibility
-      qthre=((TF1*)pQthre->At(cham))->Eval(pEsd->GetTimeStamp());                                //
-    else {                                                                                       // in the past just 1 qthre
-      Int_t hvsec = AliHMPIDParam::InHVSector(yPc);                                              //  per chamber
-      if (hvsec>=0)
-       qthre=((TF1*)pQthre->At(6*cham+hvsec))->Eval(pEsd->GetTimeStamp());                      //
-    }                                                                                            //
+    //evaluate nMean
+    if(pNmean->GetEntries()==21) {                                                              //for backward compatibility
+      nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp());                             //C6F14 Nmean for this chamber
+    } else {
+      Int_t iRad     = pParam->Radiator(yRa);                                                   //evaluate the radiator involved
+      Double_t tLow  = ((TF1*)pNmean->At(6*cham+2*iRad  ))->Eval(pEsd->GetTimeStamp());         //C6F14 low  temp for this chamber
+      Double_t tHigh = ((TF1*)pNmean->At(6*cham+2*iRad+1))->Eval(pEsd->GetTimeStamp());         //C6F14 high temp for this chamber
+      Double_t tExp  = pParam->FindTemp(tLow,tHigh,yRa);                                        //estimated temp for that chamber at that y
+      nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp);                  //mean ref idx @ a given temp
+      if(nmean < 0){                                                                            //track didn' t pass through the radiator
+         pTrk->SetHMPIDsignal(AliHMPIDRecon::kNoRad);                                           //set the appropriate flag
+         pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz);                                          //set index of cluster
+         continue;
+      }
+    }
+    //
     recon.SetImpPC(xPc,yPc);                                                                     //store track impact to PC
-    recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(cham),nmean,qthre);                           //search for Cerenkov angle of this track
-//    Printf("AliHMPIDTracker::Recon: nmean %f, qthre %f",nmean,qthre);
-  }                                                                                              //ESD tracks loop
+    recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(cham),index,nmean);                           //search for Cerenkov angle of this track
+  }//iTrk
+
   return 0; // error code: 0=no error;
 }//Recon()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index 5aed52a..b95f4a8 100644 (file)
@@ -5,12 +5,14 @@
 #include "AliHMPID.h"   //Recon()
 #include <AliRun.h>     //Recon()
 #include <TF1.h>        //field
+#include <TObjArray.h>        //field
 //.
 // HMPID base class fo tracking
 //.
 
 class AliESDEvent;      //Recon()     
 class AliESDtrack; //IntTrkCha()
+class AliHMPIDtrack;
 class AliHMPIDTracker : public AliTracker
 {
 public:
@@ -27,11 +29,14 @@ public:
          void        FillClusterArray(TObjArray* array) const;                              //             from AliTracker 
 //private part  
   static Int_t       IntTrkCha     (AliESDtrack *pTrk,Float_t &xPc,Float_t &yPc,Float_t &xRa,Float_t &yRa,Float_t &theta,Float_t &phi);//find track-PC intersection, retuns chamber ID
+  static Int_t       IntTrkCha     (Int_t ch,AliHMPIDtrack *pTrk,Float_t &xPc,Float_t &yPc,Float_t &xRa,Float_t &yRa,Float_t &theta,Float_t &phi);//find track-PC intersection, retuns chamber ID
+
   static Int_t       Recon         (AliESDEvent *pEsd,TObjArray *pCluAll,TObjArray *pNmean=0,TObjArray *pQthre=0);//do actual job, returns status code  
   static Int_t       ReconHiddenTrk(Int_t iCh,Int_t iHVsec,AliESDtrack *pTrk,TClonesArray *pClus,TObjArray *pNmean, TObjArray *pQthre);//do actual job with Hidden Track Algorithm    
   
+  
 protected:
-  TObjArray            *fClu;                     //! each chamber holds it's one list of clusters 
+ TObjArray            *fClu;                     //! each chamber holds it's one list of clusters 
 //
 private:
   AliHMPIDTracker(const AliHMPIDTracker& r);              //dummy copy constructor
index 22ccd55..cb2aefa 100644 (file)
@@ -119,7 +119,7 @@ Int_t AliHMPIDtrack::GetProlongation(Double_t xk, Double_t &y, Double_t &z)
 }
  
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t   AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
+Bool_t   AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
 {
   //
   // Propagate track to the radial position
@@ -168,10 +168,8 @@ Int_t   AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
   if (param[1] <= 0) {
     param[1] = 100000000;
   }
-  PropagateTo(r,param[1],param[0]*param[4]);
-
-  return 0;
-
+  return PropagateTo(r,param[1],param[0]*param[4]);
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Double_t AliHMPIDtrack::GetPredictedChi2(const AliCluster3D *c) const {
@@ -224,7 +222,6 @@ Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz)
   // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
   //+++++++++++++++++++++++++++++++++++++++++    
   Double_t x0[3]; GetXYZ(x0); //get track position in MARS
-  //Printf("xxx Intersect OLD: bz: %lf xxx",bz);
   
   //estimates initial helix length up to plane
   Double_t s=(pnt[0]-x0[0])*norm[0] + (pnt[1]-x0[1])*norm[1] + (pnt[2]-x0[2])*norm[2];
@@ -251,43 +248,25 @@ Bool_t AliHMPIDtrack::Intersect(AliHMPIDtrack *pTrk,Double_t pnt[3], Double_t no
   // Arguments: planePoint,planeNorm - the plane defined by any plane's point 
   // and vector, normal to the plane
   // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
-  
-  //Printf(":::::: 111 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
-  
-  Double_t bz=-1.0*GetBz();  
   Double_t x0[3]; pTrk->GetXYZ(x0); //get track position in MARS
-  //Printf(":::::: 222 :::::: x0: %lf x1: %lf x2: %lf",x0[0],x0[1],x0[2]);
-
-  Double_t rad;
-  //estimates initial helix length up to plane
-  Double_t s=(pnt[0]-x0[0])*norm[0] + (pnt[1]-x0[1])*norm[1] + (pnt[2]-x0[2])*norm[2];
   Double_t dist=99999,distPrev=dist;
-  Double_t x[3],p[3]; 
-  while(TMath::Abs(dist)>0.00001){
+  Double_t x[3],p[3],
+  pntrad= TMath::Sqrt(pnt[0]*pnt[0]+pnt[1]*pnt[1]);
+  while(TMath::Abs(dist)> 0.000001){//0.00001){
     //calculates helix at the distance s from x0 ALONG the helix
-    Propagate(s,x,p,bz);
-    
+    pTrk->PropagateTo(pntrad);pTrk->GetXYZ(x);pTrk->GetPxPyPz(p); 
     //distance between current helix position and plane
     dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2];
-    if(TMath::Abs(dist) >= TMath::Abs(distPrev)) {return kFALSE;}
+    pntrad=pntrad-dist*0.7;
+    //Printf("--- 111 --- dist %lf",dist);
+    if(TMath::Abs(2.0*dist) >= TMath::Abs(distPrev)) {return kFALSE;}
     distPrev=dist;
-    s-=dist;
   }
-   // Printf(":::::: 333 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
   //on exit pnt is intersection point,norm is track vector at that point, 
-  //all in MARS
-  rad=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]); 
-  PropagateTo(rad);       //propagate with the average dens. rad. lenght
-  GetXYZAt(rad,bz,x); 
-  GetPxPyPz(p);                                                       //propagate to the radial distance of the PC or the Radiator    
+  //Printf("--- 222 --- dist %lf",dist);
+  Printf("");
   for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];}
- // Printf(":::::: 444 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
- /*
-   pEsdTrk->SetHMPIDpx(p[0]);
-  pEsdTrk->SetHMPIDpy(p[1]);
-  pEsdTrk->SetHMPIDpz(p[2]);
-  */
-  
   return kTRUE;
 }//Intersect()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -324,3 +303,24 @@ void AliHMPIDtrack::Propagate(Double_t len, Double_t x[3],Double_t p[3], Double_
   }
 }//Propagate()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliHMPIDtrack::Update(const AliHMPIDCluster *pClu, Double_t chisq, Int_t index)
+{
+  //
+  // Arguments: AliCluster3D, chi sq, and clu index
+  // Returns: kTRUE if the track parameters are successfully updated
+  Double_t p[2]={pClu->GetY(), pClu->GetZ()};
+  Double_t cov[3]={pClu->GetSigmaY2(), 0., pClu->GetSigmaZ2()};
+  if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
+
+  /*
+  AliTracker::FillResiduals(this,p,cov,pClu->GetVolumeId());
+
+  Int_t n=GetNumberOfClusters();
+  fIndex[n]=index;
+  SetNumberOfClusters(n+1);
+  SetChi2(GetChi2()+chisq);
+*/
+  return kTRUE;
+
+}//Update()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index e689fa8..df9fd90 100644 (file)
@@ -30,13 +30,13 @@ public:
    Bool_t   PropagateTo(const AliCluster3D *c);
    Bool_t   PropagateTo(Double_t xr, Double_t x0 = 8.72, Double_t rho = 5.86e-3);                 //Use material definition as for TOF???
    void     Propagate(Double_t len,Double_t x[3],Double_t p[3],Double_t bz) const;                //HMPID method moved from AliExternalTrackParam
-   Int_t    PropagateToR(Double_t r,Double_t step);
+   Bool_t   PropagateToR(Double_t r,Double_t step);
    Bool_t   Rotate(Double_t alpha, Bool_t absolute);
    Int_t    GetProlongation(Double_t xk, Double_t &y, Double_t &z);
    Bool_t   Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz) const;                      //HMPID method moved from AliExternalTrackParam
    Bool_t   Intersect(AliHMPIDtrack *pTrk,Double_t pnt[3], Double_t norm[3]) ;                      //just for test 
    Double_t GetBz() const;     
-
+   Bool_t   Update(const AliHMPIDCluster *pClu, Double_t chi2, Int_t index);
               
 protected:
    Bool_t   Update(const AliCluster */*c*/, Double_t /*chi2*/, Int_t /*idx*/) {return 0;}