Compilation warning removed
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDTracker.cxx
CommitLineData
3c6274c1 1#include "AliHMPIDTracker.h" //class header
2#include "AliHMPIDCluster.h" //GetTrackPoint(),PropagateBack()
3#include "AliHMPIDParam.h" //GetTrackPoint(),PropagateBack()
59d9d4b3 4#include "AliHMPIDRecon.h" //Recon()
57fcdc2b 5#include "AliHMPIDReconHTA.h" //ReconHTA()
6#include <AliESDEvent.h> //PropagateBack(),Recon()
7#include <AliESDtrack.h> //Intersect()
d3da6dc4 8#include <AliRun.h> //GetTrackPoint(),PropagateBack()
9#include <AliTrackPointArray.h> //GetTrackPoint()
10#include <AliAlignObj.h> //GetTrackPoint()
59d9d4b3 11#include <AliCDBManager.h> //PropageteBack()
12#include <AliCDBEntry.h> //PropageteBack()
423554a3 13//.
14// HMPID base class fo tracking
15//.
16//.
17//.
d3da6dc4 18ClassImp(AliHMPIDTracker)
94b1fbfa 19//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
20AliHMPIDTracker::AliHMPIDTracker():AliTracker()
21{
59d9d4b3 22// ctor. Create TObjArray of TClonesArray of AliHMPIDCluster
23//
24//
ae5a42aa 25 fClu=new TObjArray(AliHMPIDParam::kMaxCh+1); fClu->SetOwner(kTRUE);
26 for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++) fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
59d9d4b3 27}//ctor
d3da6dc4 28//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
30{
31// Interface callback methode invoked from AliReconstruction::WriteAlignmentData() to get position of MIP cluster in MARS associated to a current track.
32// MIP cluster is reffered by index which is stored in AliESDtrack ???????
33// Arguments: idx- cluster index which is stored by HMPID in AliESDtrack
34// point- reference to the object where to store the point
35// Returns: status of operation if FALSE then AliReconstruction::WriteAlignmentData() do not store this point to array of points for current track.
36 if(idx<0) return kFALSE; //no MIP cluster assigned to this track in PropagateBack()
59d9d4b3 37 Int_t iCham=idx/1000000; Int_t iClu=idx%1000000;
ae079791 38 point.SetVolumeID(AliGeomManager::LayerToVolUID(AliGeomManager::kHMPID,iCham-1));//layer and chamber number
94b1fbfa 39 TClonesArray *pArr=(TClonesArray*)(*fClu)[iCham];
40 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pArr->UncheckedAt(iClu);//get pointer to cluster
d3da6dc4 41 Double_t mars[3];
42 AliHMPIDParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
43 point.SetXYZ(mars[0],mars[1],mars[2]);
44 return kTRUE;
59d9d4b3 45}//GetTrackPoint()
46//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
47Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xPc,Float_t &yPc)
48{
49// Static method to find intersection in between given track and HMPID chambers
50// Arguments: pTrk- ESD track; xPc,yPc- track intersection with PC in LORS [cm]
51// Returns: intersected chamber ID or -1
52 AliHMPIDParam *pParam=AliHMPIDParam::Instance();
53 Float_t xRa=0,yRa=0,theta=0,phi=0; //track intersection at PC and angles at RAD, LORS
ae5a42aa 54 for(Int_t i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){ //chambers loop
59d9d4b3 55 Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Point(i,p1,AliHMPIDParam::kRad); //point & norm for middle of radiator plane
56 Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Point(i,p2,AliHMPIDParam::kPc); //point & norm for entrance to PC plane
57 if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue; //try to intersect track with the middle of radiator
58 if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue; //try to intersect track with PC
59 pParam->Mars2LorsVec(i,n1,theta,phi); //track angles at RAD
60 pParam->Mars2Lors (i,p1,xRa,yRa); //TRKxRAD position
61 pParam->Mars2Lors (i,p2,xPc,yPc); //TRKxPC position
ae5a42aa 62 if(AliHMPIDParam::IsInside(xPc,yPc,pParam->DistCut())==kFALSE) continue; //not in active area
59d9d4b3 63 pTrk->SetHMPIDtrk (xRa,yRa,theta,phi); //store track intersection info
64 pTrk->SetHMPIDcluIdx (i,0);
65 return i;
66 } //chambers loop
67 return -1; //no intersection with HMPID chambers
68}//IntTrkCha()
d3da6dc4 69//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
70Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
71{
59d9d4b3 72// Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control. Done once per event.
d3da6dc4 73// Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
74// Returns: error code (currently ignored in AliReconstruction::RunTraking())
ae5a42aa 75 for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++) pCluTree->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));
94b1fbfa 76 pCluTree->GetEntry(0);
94b1fbfa 77 return 0;
59d9d4b3 78}//LoadClusters()
d3da6dc4 79//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
af885e0f 80Int_t AliHMPIDTracker::PropagateBack(AliESDEvent *pEsd)
abb5f786 81{
59d9d4b3 82// Interface pure virtual in AliTracker. Invoked from AliReconstruction::RunTracking() after invocation of AliTracker::LoadClusters() once per event
abb5f786 83// Agruments: pEsd - pointer to ESD
84// Returns: error code
f6998a13 85 AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean"); //contains TObjArray of 21 TF1
86 AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre"); //contains TObjArray of 7 TF1
abb5f786 87 if(!pNmeanEnt) AliFatal("No Nmean C6F14 ");
88 if(!pQthreEnt) AliFatal("No Qthre");
94b1fbfa 89
afe12692 90 return Recon(pEsd,fClu,(TObjArray*)pNmeanEnt->GetObject(),(TObjArray*)pQthreEnt->GetObject());
611e810d 91}//PropagateBack()
abb5f786 92//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
afe12692 93Int_t AliHMPIDTracker::Recon(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmean, TObjArray *pQthre)
d3da6dc4 94{
59d9d4b3 95// Static method to reconstruct Theta Ckov for all valid tracks of a given event.
96// Arguments: pEsd- pointer ESD; pClu- pointer to clusters for all chambers; pNmean - pointer to all function Nmean=f(time)
d3da6dc4 97// Returns: error code, 0 if no errors
abb5f786 98 AliHMPIDRecon recon; //instance of reconstruction class, nothing important in ctor
59d9d4b3 99 Float_t xPc,yPc;
100 for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){ //ESD tracks loop
101 AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //get reconstructed track
a591e55f 102 Int_t cham=IntTrkCha(pTrk,xPc,yPc); //get chamber intersected by this track
59280a5a 103 if(cham<0) continue; //no intersection at all, go after next track
a591e55f 104 Double_t nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp()); //C6F14 Nmean for this chamber
afe12692 105 Double_t qthre=((TF1*)pQthre->At(cham)) ->Eval(pEsd->GetTimeStamp()); //Qthre for this chamber
a591e55f 106 recon.SetImpPC(xPc,yPc); //store track impact to PC
afe12692 107 recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(cham),nmean,qthre); //search for Cerenkov angle of this track
8d6043fc 108// Printf("AliHMPIDTracker::Recon: nmean %f, qthre %f",nmean,qthre);
59280a5a 109 } //ESD tracks loop
d3da6dc4 110 return 0; // error code: 0=no error;
611e810d 111}//Recon()
112//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
afe12692 113Int_t AliHMPIDTracker::ReconHiddenTrk(Int_t iCh,AliESDtrack *pTrk,TClonesArray *pCluLst,TObjArray *pNmean,TObjArray *pQthre)
611e810d 114{
115// Static method to reconstruct Theta Ckov for all valid tracks of a given event.
afe12692 116// Arguments: pEsd- pointer ESD; pClu- pointer to clusters for all chambers; pNmean - pointer to all function Nmean=f(time), pQthre - pointer to all function Qthre=f(time)
611e810d 117// Returns: error code, 0 if no errors
57fcdc2b 118 AliHMPIDReconHTA reconHTA; //instance of reconstruction class, nothing important in ctor
611e810d 119 Double_t nmean=((TF1*)pNmean->At(3*iCh))->Eval(0); //C6F14 Nmean for this chamber
afe12692 120 Double_t qthre=((TF1*)pQthre->At(iCh)) ->Eval(0); //C6F14 Nmean for this chamber
611e810d 121 if(pCluLst->GetEntriesFast()<4) return 1; //min 4 clusters (3 + 1 mip) to find a ring!
57fcdc2b 122 if(reconHTA.CkovHiddenTrk(pTrk,pCluLst,nmean,qthre)) return 0; //search for track parameters and Cerenkov angle of this track
5b2b2013 123 else return 1; // error code: 0=no error,1=fit not performed;
611e810d 124}//Recon()
d3da6dc4 125//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++