]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDTracker.cxx
This commit was generated by cvs2svn to compensate for changes in r15986,
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDTracker.cxx
CommitLineData
d3da6dc4 1#include "AliHMPIDTracker.h" //class header
2#include "AliHMPID.h" //GetTrackPoint(),PropagateBack()
3#include "AliHMPIDCluster.h" //GetTrackPoint(),PropagateBack()
4#include "AliHMPIDParam.h" //GetTrackPoint(),PropagateBack()
5#include "AliHMPIDRecon.h" //PropagateBack()
6#include <AliESD.h> //PropagateBack()
7#include <AliRun.h> //GetTrackPoint(),PropagateBack()
8#include <AliTrackPointArray.h> //GetTrackPoint()
9#include <AliAlignObj.h> //GetTrackPoint()
10ClassImp(AliHMPIDTracker)
11//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12AliHMPIDTracker::AliHMPIDTracker():AliTracker()
13{
14// AliHMPIDTracker is created from AliReconstraction::Run() which invokes AliReconstraction::CreateTrackers()
15// which in turn invokes AliHMPIDReconstructor::CreateTracker().
16// Note that this is done just once per session before AliReconstruction::Run() goes to events loop.
17}
18//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
19Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
20{
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 HMPID 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::kHMPID,iCham-1));//layer and chamber number
30 AliHMPID *pRich=((AliHMPID*)gAlice->GetDetector("HMPID"));
31 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pRich->CluLst(iCham)->UncheckedAt(iClu);//get pointer to cluster
32 Double_t mars[3];
33 AliHMPIDParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
34 point.SetXYZ(mars[0],mars[1],mars[2]);
35 return kTRUE;
36}
37//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
39{
40// Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control
41// Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::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 AliHMPIDTracker::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
51 Int_t iNtracks=pESD->GetNumberOfTracks(); AliDebug(1,Form("Start with %i tracks",iNtracks));
52 AliHMPID *pRich=((AliHMPID*)gAlice->GetDetector("HMPID"));
53 AliHMPIDRecon recon; //instance of reconstruction class, nothing important in ctor
54
55 AliHMPIDParam *pParam=AliHMPIDParam::Instance();
56
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,AliHMPIDParam::kRad); //point & norm for RAD
64 Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Lors2Mars(i,0,0,p2,AliHMPIDParam::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
72
73 if(AliHMPIDDigit::IsInside(xPc,yPc)==kFALSE) continue; //not in active area
74 iCh=i;
75 break;
76 }//chambers loop
77
78 if(iCh==-1) continue; //no intersection at all, go after next track
79
80 TClonesArray *pCluLst=pRich->CluLst(iCh); //get clusters list for intersected chamber
81
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 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->At(iClu); //get pointer to current cluster
86 if(pClu->Q()<100) continue; //QDC is incompartible with mip, go after another one
87
88 Float_t dX=xPc-pClu->X(); //distance between current cluster and intersection point
89 Float_t dY=yPc-pClu->Y();
90 Float_t d =TMath::Sqrt(dX*dX+dY*dY);
91
92 if( d < dMin) {iMip=iClu; dMin=d;} //current cluster is closer, overwrite data for min cluster
93 }//clusters loop for intersected chamber
94
95 pTrk->SetHMPIDtrk (xPc,yPc,th,ph); //store track info
96 if(iMip==-1) {pTrk->SetHMPIDsignal (kMipQdcCut); continue;} //no clusters with QDC more the threshold at all
97
98 AliHMPIDCluster *pMipClu=(AliHMPIDCluster*)pCluLst->At(iMip); //take mip cluster
99
100 pTrk->SetHMPIDmip (pMipClu->X(),pMipClu->Y(),pMipClu->Q()); //store mip info
101 if(dMin>1) {pTrk->SetHMPIDsignal (kMipDistCut); continue;} //closest cluster with enough charge is still too far
102 pTrk->SetHMPIDcluIdx (iCh,iMip); //set mip cluster index
103 recon.SetTrack(th,ph,xRa,yRa); Int_t iNphot=0; //initialize track parameters
104 pTrk->SetHMPIDsignal (recon.CkovAngle(pCluLst,iNphot)); //search for Cerenkov angle for this track
105 pTrk->SetHMPIDchi2 (recon.CkovSigma2()); //error squared
106 pTrk->SetHMPIDmip (pMipClu->X(),pMipClu->Y(),pMipClu->Q(),iMip); //info on mip cluster + n. phot.
d3da6dc4 107 }//ESD tracks loop
108 AliDebug(1,"Stop pattern recognition");
109 return 0; // error code: 0=no error;
110}//PropagateBack()
111//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++