correct the getting of EMCAL geometry
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDTracker.cxx
3c6274c1 1#include "AliHMPIDTracker.h" //class header
2#include "AliHMPIDCluster.h" //GetTrackPoint(),PropagateBack()
3#include "AliHMPIDParam.h" //GetTrackPoint(),PropagateBack()
4#include "AliHMPIDRecon.h" //PropagateBack()
d3da6dc4 5#include <AliESD.h> //PropagateBack()
6#include <AliRun.h> //GetTrackPoint(),PropagateBack()
7#include <AliTrackPointArray.h> //GetTrackPoint()
8#include <AliAlignObj.h> //GetTrackPoint()
d3da6dc4 10//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
13// Interface callback methode invoked from AliReconstruction::WriteAlignmentData() to get position of MIP cluster in MARS associated to a current track.
14// MIP cluster is reffered by index which is stored in AliESDtrack ???????
15// Arguments: idx- cluster index which is stored by HMPID in AliESDtrack
16// point- reference to the object where to store the point
17// Returns: status of operation if FALSE then AliReconstruction::WriteAlignmentData() do not store this point to array of points for current track.
18 if(idx<0) return kFALSE; //no MIP cluster assigned to this track in PropagateBack()
19 Int_t iCham=idx/1000000;
20 Int_t iClu=idx%1000000;
21 point.SetVolumeID(AliAlignObj::LayerToVolUID(AliAlignObj::kHMPID,iCham-1));//layer and chamber number
22 AliHMPID *pRich=((AliHMPID*)gAlice->GetDetector("HMPID"));
23 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pRich->CluLst(iCham)->UncheckedAt(iClu);//get pointer to cluster
24 Double_t mars[3];
25 AliHMPIDParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
26 point.SetXYZ(mars[0],mars[1],mars[2]);
27 return kTRUE;
30Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
32// Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control
33// Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
34// Returns: error code (currently ignored in AliReconstruction::RunTraking())
35 AliDebug(1,"Start."); pCluTree->GetEntry(0); AliDebug(1,"Stop."); return 0;
3c6274c1 38Int_t AliHMPIDTracker::Recon(AliESD *pESD,TObjArray *pCluAll)
d3da6dc4 39{
40// Interface callback methode invoked by AliRecontruction::RunTracking() during tracking after TOF. It's done just once per event
41// Arguments: pESD - pointer to Event Summary Data class instance which contains a list of tracks
42// Returns: error code, 0 if no errors
3c6274c1 43 Int_t iNtracks=pESD->GetNumberOfTracks(); AliDebugClass(1,Form("Start with %i tracks",iNtracks));
59280a5a 44
45 AliHMPIDRecon recon; //instance of reconstruction class, nothing important in ctor
46 Float_t xRa,yRa;
d3da6dc4 47 for(Int_t iTrk=0;iTrk<iNtracks;iTrk++){ //ESD tracks loop
48 AliESDtrack *pTrk = pESD->GetTrack(iTrk); //get next reconstructed track
59280a5a 49 Int_t cham=IntTrkCha(pTrk,xRa,yRa); //get chamber intersected by thie track
50 if(cham<0) continue; //no intersection at all, go after next track
51 recon.CkovAngle(pTrk,(TClonesArray *)pCluAll->At(cham)); //search for Cerenkov angle for this track
52 } //ESD tracks loop
3c6274c1 53 AliDebugClass(1,"Stop pattern recognition");
d3da6dc4 54 return 0; // error code: 0=no error;
59280a5a 57Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xRa,Float_t &yRa)
59// Static method to find intersection in between given track and HMPID chambers
60// Arguments: pTrk - ESD track
61// xRa,yRa - track intersection with the middle of radiator, LORS
62// Returns: intersected chamber ID or -1
64 AliHMPIDParam *pParam=AliHMPIDParam::Instance();
65 Float_t xPc=0,yPc=0,th=0,ph=0; //track intersection point and angles, LORS
66 for(Int_t i=0;i<7;i++){ //chambers loop
67 Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Lors2Mars(i,0,0,p1,AliHMPIDParam::kRad); //point & norm for RAD
68 Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Lors2Mars(i,0,0,p2,AliHMPIDParam::kPc); //point & norm for PC
70 if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue; //try to intersect track with the middle of radiator
71 if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue; //try to intersect track with PC
73 pParam->Mars2LorsVec(i,n1,th,ph); //track angles
74 pParam->Mars2Lors (i,p1,xRa,yRa); //TRKxRAD position
75 pParam->Mars2Lors (i,p2,xPc,yPc); //TRKxPC position
77 if(AliHMPIDDigit::IsInside(xPc,yPc)==kFALSE) continue; //not in active area
78 pTrk->SetHMPIDtrk (xPc,yPc,th,ph); //store track intersection info
79 pTrk->SetHMPIDcluIdx (i,0);
80 return i;
81 } //chambers loop
82 return -1; //no intersection with HMPID chambers