]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHTracker.cxx
adding entries parameter to execute function
[u/mrichter/AliRoot.git] / RICH / AliRICHTracker.cxx
CommitLineData
db910db9 1#include "AliRICHTracker.h" //class header
a446c3c3 2#include "AliRICH.h" //GetTrackPoint(),PropagateBack()
3#include "AliRICHCluster.h" //GetTrackPoint(),PropagateBack()
4#include "AliRICHParam.h" //GetTrackPoint(),PropagateBack()
5#include "AliRICHRecon.h" //PropagateBack()
6#include <AliESD.h> //PropagateBack()
7#include <AliRun.h> //GetTrackPoint(),PropagateBack()
db910db9 8#include <AliTrackPointArray.h> //GetTrackPoint()
9#include <AliAlignObj.h> //GetTrackPoint()
998b831f 10ClassImp(AliRICHTracker)
db910db9 11//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12AliRICHTracker::AliRICHTracker():AliTracker()
998b831f 13{
db910db9 14// AliRICHTracker is created from AliReconstraction::Run() which invokes AliReconstraction::CreateTrackers()
15// which in turn invokes AliRICHReconstructor::CreateTracker().
16// Note that this is done just once per session before AliReconstruction::Run() goes to events loop.
db910db9 17}
18//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
19Bool_t AliRICHTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
30c60010 20{
db910db9 21// Interface callback methode invoked from AliReconstruction::WriteAlignmentData() to get position of MIP cluster in MARS associated to a current track.
22// MIP cluster is reffered by index which is stored in AliESDtrack ???????
23// Arguments: idx- cluster index which is stored by RICH in AliESDtrack
24// point- reference to the object where to store the point
25// Returns: status of operation if FALSE then AliReconstruction::WriteAlignmentData() do not store this point to array of points for current track.
26 if(idx<0) return kFALSE; //no MIP cluster assigned to this track in PropagateBack()
27 Int_t iCham=idx/1000000;
28 Int_t iClu=idx%1000000;
29 point.SetVolumeID(AliAlignObj::LayerToVolUID(AliAlignObj::kRICH,iCham-1));//layer and chamber number
30 AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH"));
e30ca504 31 AliRICHCluster *pClu=(AliRICHCluster*)pRich->CluLst(iCham)->UncheckedAt(iClu);//get pointer to cluster
a446c3c3 32 Double_t mars[3];
33 AliRICHParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
34 point.SetXYZ(mars[0],mars[1],mars[2]);
db910db9 35 return kTRUE;
36}
37//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38Int_t AliRICHTracker::LoadClusters(TTree *pCluTree)
39{
e30ca504 40// Interface callback methode invoked from AliReconstruction::RunTracking() to load RICH clusters before PropagateBack() gets control
db910db9 41// Arguments: pCluTree- pointer to clusters tree got by AliRICHLoader::LoadRecPoints("read") then AliRICHLoader::TreeR()
42// Returns: error code (currently ignored in AliReconstruction::RunTraking())
43 AliDebug(1,"Start."); pCluTree->GetEntry(0); AliDebug(1,"Stop."); return 0;
44}
45//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46Int_t AliRICHTracker::PropagateBack(AliESD *pESD)
47{
48// Interface callback methode invoked by AliRecontruction::RunTracking() during tracking after TOF. It's done just once per event
49// Arguments: pESD - pointer to Event Summary Data class instance which contains a list of tracks
50// Returns: error code, 0 if no errors
9a221675 51 Int_t iNtracks=pESD->GetNumberOfTracks(); AliDebug(1,Form("Start with %i tracks",iNtracks));
db910db9 52 AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH"));
e30ca504 53 AliRICHRecon recon; //instance of reconstruction class, nothing important in ctor
db910db9 54
e30ca504 55 AliRICHParam *pParam=AliRICHParam::Instance();
01c81d9d 56
e30ca504 57 for(Int_t iTrk=0;iTrk<iNtracks;iTrk++){ //ESD tracks loop
58 AliESDtrack *pTrk = pESD->GetTrack(iTrk); //get next reconstructed track
59
60 Float_t xRa=0,yRa=0,xPc=0,yPc=0,th=0,ph=0; //track intersection point and angles, LORS
61 Int_t iCh=-1; //intersected chamber
62 for(Int_t i=0;i<7;i++){ //chambers loop
63 Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Lors2Mars(i,0,0,p1,AliRICHParam::kRad); //point & norm for RAD
64 Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Lors2Mars(i,0,0,p2,AliRICHParam::kPc); //point & norm for PC
65
66 if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue; //try to intersect track with the middle of radiator
67 if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue; //try to intersect track with PC
68
69 pParam->Mars2LorsVec(i,n1,th,ph); //track angles
70 pParam->Mars2Lors (i,p1,xRa,yRa); //TRKxRAD position
71 pParam->Mars2Lors (i,p2,xPc,yPc); //TRKxPC position
30c60010 72
e30ca504 73 if(AliRICHDigit::IsInside(xPc,yPc)==kFALSE) continue; //not in active area
74 iCh=i;
75 break;
76 }//chambers loop
30c60010 77
e30ca504 78 if(iCh==-1) continue; //no intersection at all, go after next track
db910db9 79
e30ca504 80 TClonesArray *pCluLst=pRich->CluLst(iCh); //get clusters list for intersected chamber
2a92c3fe 81
e30ca504 82 Double_t dMin=999; //distance between track-PC intersection point and current cluster
83 Int_t iMip=-1; //index of cluster nearest to intersection point
84 for(Int_t iClu=0;iClu<pCluLst->GetEntries();iClu++){ //clusters loop for intersected chamber
85 AliRICHCluster *pClu=(AliRICHCluster*)pCluLst->At(iClu); //get pointer to current cluster
86 if(pClu->Q()<100) continue; //QDC is incompartible with mip, go after another one
9a221675 87
a446c3c3 88 Float_t dX=xPc-pClu->X(); //distance between current cluster and intersection point
e30ca504 89 Float_t dY=yPc-pClu->Y();
90 Float_t d =TMath::Sqrt(dX*dX+dY*dY);
9a221675 91
e30ca504 92 if( d < dMin) {iMip=iClu; dMin=d;} //current cluster is closer, overwrite data for min cluster
93 }//clusters loop for intersected chamber
84093f6f 94
a446c3c3 95 pTrk->SetRICHtrk (xPc,yPc,th,ph); //store track info
96 if(iMip==-1) {pTrk->SetRICHsignal (kMipQdcCut); continue;} //no clusters with QDC more the threshold at all
84093f6f 97
a446c3c3 98 AliRICHCluster *pMipClu=(AliRICHCluster*)pCluLst->At(iMip); //take mip cluster
2a92c3fe 99
a446c3c3 100 pTrk->SetRICHmip (pMipClu->X(),pMipClu->Y(),pMipClu->Q()); //store mip info
101 if(dMin>1) {pTrk->SetRICHsignal (kMipDistCut); continue;} //closest cluster with enough charge is still too far
102 pTrk->SetRICHcluIdx (iCh,iMip); //set mip cluster index
103 recon.SetTrack(th,ph,xRa,yRa); Int_t iNphot=0; //initialize track parameters
104 pTrk->SetRICHsignal (recon.CkovAngle(pCluLst,iNphot)); //search for Cerenkov angle for this track
105 pTrk->SetRICHchi2 (recon.CkovSigma2()); //error squared
106 pTrk->SetRICHmip (pMipClu->X(),pMipClu->Y(),pMipClu->Q(),iMip); //info on mip cluster + n. phot.
e30ca504 107 Printf("Ch=%i MIP-TRK=%5.2f cm Th=%f+-%f", iCh, dMin,pTrk->GetRICHsignal(),pTrk->GetRICHchi2());
108 }//ESD tracks loop
109 AliDebug(1,"Stop pattern recognition");
110 return 0; // error code: 0=no error;
111}//PropagateBack()
db910db9 112//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++