]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPIDTracker.cxx
- Dipole rotated wr to ALICE coordinate system
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDTracker.cxx
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
12 ClassImp(AliHMPIDTracker)
13
14 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    
15 Bool_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 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
34 Int_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 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
42 Int_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 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56 Int_t AliHMPIDTracker::Recon(AliESD *pEsd,TObjArray *pCluAll,TObjArray *pNmean)
57 {
58 // Interface callback methode 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   
64   AliHMPIDRecon recon;                                                                       //instance of reconstruction class, nothing important in ctor
65   Float_t xRa,yRa;
66   for(Int_t iTrk=0;iTrk<iNtracks;iTrk++){                                                        //ESD tracks loop
67     AliESDtrack *pTrk = pEsd->GetTrack(iTrk);                                                    //get next reconstructed track    
68     Int_t cham=IntTrkCha(pTrk,xRa,yRa);                                                          //get chamber intersected by thie track 
69     if(cham<0) continue;                                                                         //no intersection at all, go after next track
70     Double_t nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp());                       //C6F14 Nmean for this chamber   
71     recon.CkovAngle(pTrk,(TClonesArray *)pCluAll->At(cham),nmean);                               //search for Cerenkov angle for this track
72   }                                                                                              //ESD tracks loop
73   AliDebugClass(1,"Stop pattern recognition");
74   return 0; // error code: 0=no error;
75 }//PropagateBack()
76 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
77 Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xRa,Float_t &yRa)
78 {
79 // Static method to find intersection in between given track and HMPID chambers
80 // Arguments: pTrk    - ESD track 
81 //            xRa,yRa - track intersection with the middle of radiator, LORS
82 //   Returns: intersected chamber ID or -1
83   
84   AliHMPIDParam *pParam=AliHMPIDParam::Instance();
85   Float_t xPc=0,yPc=0,th=0,ph=0;                                                                //track intersection point and angles, LORS  
86   for(Int_t i=0;i<7;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,th,ph);                                                           //track angles
94     pParam->Mars2Lors   (i,p1,xRa,yRa);                                                         //TRKxRAD position
95     pParam->Mars2Lors   (i,p2,xPc,yPc);                                                         //TRKxPC position
96       
97     if(AliHMPIDDigit::IsInside(xPc,yPc)==kFALSE) continue;                                      //not in active area  
98     pTrk->SetHMPIDtrk      (xPc,yPc,th,ph);                                                     //store track intersection info
99     pTrk->SetHMPIDcluIdx   (i,0);
100     return i;
101   }                                                                                             //chambers loop
102   return -1; //no intersection with HMPID chambers
103 }