]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HMPID/AliHMPIDTracker.cxx
Protection in Physical node
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDTracker.cxx
... / ...
CommitLineData
1#include "AliHMPIDTracker.h" //class header
2#include "AliHMPIDCluster.h" //GetTrackPoint(),PropagateBack()
3#include "AliHMPIDParam.h" //GetTrackPoint(),PropagateBack()
4#include "AliHMPIDRecon.h" //PropagateBack()
5#include <AliESD.h> //PropagateBack()
6#include <AliRun.h> //GetTrackPoint(),PropagateBack()
7#include <AliTrackPointArray.h> //GetTrackPoint()
8#include <AliAlignObj.h> //GetTrackPoint()
9#include <AliCDBManager.h>
10#include <AliCDBEntry.h>
11
12ClassImp(AliHMPIDTracker)
13
14//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
16{
17// Interface callback methode invoked from AliReconstruction::WriteAlignmentData() to get position of MIP cluster in MARS associated to a current track.
18// MIP cluster is reffered by index which is stored in AliESDtrack ???????
19// Arguments: idx- cluster index which is stored by HMPID in AliESDtrack
20// point- reference to the object where to store the point
21// Returns: status of operation if FALSE then AliReconstruction::WriteAlignmentData() do not store this point to array of points for current track.
22 if(idx<0) return kFALSE; //no MIP cluster assigned to this track in PropagateBack()
23 Int_t iCham=idx/1000000;
24 Int_t iClu=idx%1000000;
25 point.SetVolumeID(AliAlignObj::LayerToVolUID(AliAlignObj::kHMPID,iCham-1));//layer and chamber number
26 AliHMPID *pRich=((AliHMPID*)gAlice->GetDetector("HMPID"));
27 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pRich->CluLst(iCham)->UncheckedAt(iClu);//get pointer to cluster
28 Double_t mars[3];
29 AliHMPIDParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
30 point.SetXYZ(mars[0],mars[1],mars[2]);
31 return kTRUE;
32}
33//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
34Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
35{
36// Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control
37// Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
38// Returns: error code (currently ignored in AliReconstruction::RunTraking())
39 AliDebug(1,"Start."); pCluTree->GetEntry(0); AliDebug(1,"Stop."); return 0;
40}
41//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
42Int_t AliHMPIDTracker::PropagateBack(AliESD *pEsd)
43{
44// This method defined as pure virtual in AliTracker. It is invoked from AliReconstruction::RunTracking() after invocation of AliTracker::LoadClusters()
45// Agruments: pEsd - pointer to ESD
46// Returns: error code
47 AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean",pEsd->GetRunNumber()); //contains TObjArray of 21 TF1
48 AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre",pEsd->GetRunNumber()); //contains TObjArray of 7 TF1
49 if(!pNmeanEnt) AliFatal("No Nmean C6F14 ");
50 if(!pQthreEnt) AliFatal("No Qthre");
51
52 AliHMPID *pHmpid=((AliHMPID*)gAlice->GetDetector("HMPID"));
53 return Recon(pEsd,pHmpid->CluLst(),(TObjArray*)pNmeanEnt->GetObject());
54}
55//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56Int_t AliHMPIDTracker::Recon(AliESD *pEsd,TObjArray *pCluAll,TObjArray *pNmean)
57{
58// Interface callback method invoked by AliRecontruction::RunTracking() during tracking after TOF. It's done just once per event
59// Arguments: pEsd - pointer to Event Summary Data class instance which contains a list of tracks
60// Returns: error code, 0 if no errors
61 Int_t iNtracks=pEsd->GetNumberOfTracks(); AliDebugClass(1,Form("Start with %i tracks",iNtracks));
62
63 AliHMPIDRecon recon; //instance of reconstruction class, nothing important in ctor
64 Double_t xPc,yPc;
65 for(Int_t iTrk=0;iTrk<iNtracks;iTrk++){ //ESD tracks loop
66 AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //get next reconstructed track
67 Int_t cham=IntTrkCha(pTrk,xPc,yPc); //get chamber intersected by this track
68 if(cham<0) continue; //no intersection at all, go after next track
69 Double_t nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp()); //C6F14 Nmean for this chamber
70 recon.SetImpPC(xPc,yPc); //store track impact to PC
71 recon.CkovAngle(pTrk,(TClonesArray *)pCluAll->At(cham),nmean); //search for Cerenkov angle of this track
72 } //ESD tracks loop
73 AliDebugClass(1,"Stop pattern recognition");
74 return 0; // error code: 0=no error;
75}//PropagateBack()
76//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
77Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Double_t &xToPc,Double_t &yToPc)
78{
79// Static method to find intersection in between given track and HMPID chambers
80// Arguments: pTrk - ESD track
81// xPc,yPc - track intersection with PC, LORS
82// Returns: intersected chamber ID or -1
83
84 AliHMPIDParam *pParam=AliHMPIDParam::Instance();
85 Float_t xRa=0,yRa=0,xPc=0,yPc=0,theta=0,phi=0; //track intersection point and angles, LORS
86 for(Int_t i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++){ //chambers loop
87 Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Lors2Mars(i,0,0,p1,AliHMPIDParam::kRad); //point & norm for RAD
88 Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Lors2Mars(i,0,0,p2,AliHMPIDParam::kPc); //point & norm for PC
89
90 if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue; //try to intersect track with the middle of radiator
91 if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue; //try to intersect track with PC
92
93 pParam->Mars2LorsVec(i,n1,theta,phi); //track angles at RAD
94 pParam->Mars2Lors (i,p1,xRa,yRa); //TRKxRAD position
95 pParam->Mars2Lors (i,p2,xPc,yPc); //TRKxPC position
96 xToPc=(Double_t)xPc;yToPc=(Double_t)yPc; //conversion float->double only
97 if(AliHMPIDDigit::IsInside(xPc,yPc,pParam->DistCut())==kFALSE) continue; //not in active area
98 pTrk->SetHMPIDtrk (xRa,yRa,theta,phi); //store track intersection info
99 pTrk->SetHMPIDcluIdx (i,0);
100 return i;
101 } //chambers loop
102 return -1; //no intersection with HMPID chambers
103}