AliHMPIDRecoParam is updated with RunTypes:
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDTracker.cxx
1 #include "AliHMPIDTracker.h"     //class header
2 #include "AliHMPIDtrack.h"       //class header
3 #include "AliHMPIDCluster.h"     //GetTrackPoint(),PropagateBack() 
4 #include "AliHMPIDParam.h"       //GetTrackPoint(),PropagateBack()
5 #include "AliHMPIDPid.h"         //Recon(),reconHTA()
6 #include "AliHMPIDRecon.h"       //Recon()
7 #include "AliHMPIDRecoParam.h"   //Recon()
8 #include "AliHMPIDReconstructor.h"//Recon()
9 #include "AliHMPIDReconHTA.h"    //ReconHTA()
10 #include <AliESDEvent.h>         //PropagateBack(),Recon()  
11 #include <AliESDtrack.h>         //Intersect() 
12 #include <AliTracker.h> 
13 #include <AliRun.h>              //GetTrackPoint(),PropagateBack()  
14 #include <AliTrackPointArray.h>  //GetTrackPoint()
15 #include <AliAlignObj.h>         //GetTrackPoint()
16 #include <AliCDBManager.h>       //PropageteBack()
17 #include <AliCDBEntry.h>         //PropageteBack()
18 #include "AliHMPIDRecoParam.h"   //Recon()
19 //.
20 // HMPID base class fo tracking
21 //.
22 //.
23 //.
24 ClassImp(AliHMPIDTracker)
25 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26 AliHMPIDTracker::AliHMPIDTracker():
27   AliTracker(),
28   fClu(new TObjArray(AliHMPIDParam::kMaxCh+1))  
29 {
30 // ctor. Create TObjArray of TClonesArray of AliHMPIDCluster  
31 // 
32 //  
33   fClu->SetOwner(kTRUE);
34   for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++) fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
35 }//ctor
36 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    
37 Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
38 {
39 // Interface callback methode invoked from AliReconstruction::WriteAlignmentData() to get position of MIP cluster in MARS associated to a current track.
40 // MIP cluster is reffered by index which is stored in AliESDtrack  ???????
41 // Arguments: idx- cluster index which is stored by HMPID in AliESDtrack
42 //            point- reference to the object where to store the point     
43 //   Returns: status of operation  if FALSE then AliReconstruction::WriteAlignmentData() do not store this point to array of points for current track. 
44   if(idx<0) return kFALSE; //no MIP cluster assigned to this track in PropagateBack()
45   Int_t iCham=idx/1000000; Int_t iClu=idx%1000000;
46   iClu = iClu%1000; //GetHMPIDcluIdx -> 1e+6*ch + 1e+3*clusize + cluIdx;
47   point.SetVolumeID(AliGeomManager::LayerToVolUID(AliGeomManager::kHMPID,iCham));//layer and chamber number
48   TClonesArray *pArr=(TClonesArray*)(*fClu)[iCham];
49   AliHMPIDCluster *pClu=(AliHMPIDCluster*)pArr->UncheckedAt(iClu);//get pointer to cluster
50   Float_t xyz[3];
51   pClu->GetGlobalXYZ(xyz);
52   Float_t cov[6];
53   pClu->GetGlobalCov(cov);
54   point.SetXYZ(xyz,cov);
55   return kTRUE;
56 }//GetTrackPoint()
57 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
58 Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xPc,Float_t &yPc,Float_t &xRa,Float_t &yRa,Float_t &theta,Float_t &phi)
59 {
60 // Static method to find intersection in between given track and HMPID chambers
61 // Arguments: pTrk- ESD track; xPc,yPc- track intersection with PC in LORS [cm]
62 //   Returns: intersected chamber ID or -1
63   AliHMPIDtrack *hmpTrk = new AliHMPIDtrack(*pTrk);                                             //create a hmpid track to be used for propagation and matching 
64   for(Int_t i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){                              //chambers loop
65     Int_t chInt = IntTrkCha(i,hmpTrk,xPc,yPc,xRa,yRa,theta,phi);
66     if(chInt>=0) {delete hmpTrk;hmpTrk=0x0;return chInt;}
67   }                                                                                             //chambers loop
68   delete hmpTrk; hmpTrk=0x0;
69   return -1;                                                                                    //no intersection with HMPID chambers
70 }//IntTrkCha()
71 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
72 Int_t AliHMPIDTracker::IntTrkCha(Int_t ch,AliHMPIDtrack *pTrk,Float_t &xPc,Float_t &yPc,Float_t &xRa,Float_t &yRa,Float_t &theta,Float_t &phi)
73 {
74 // Static method to find intersection in between given track and HMPID chambers
75 // Arguments: pTrk- HMPID track; xPc,yPc- track intersection with PC in LORS [cm]
76 //   Returns: intersected chamber ID or -1
77     AliHMPIDParam *pParam=AliHMPIDParam::Instance();
78     Double_t p1[3],n1[3]; 
79     pParam->Norm(ch,n1); 
80     pParam->Point(ch,p1,AliHMPIDParam::kRad);                                                    //point & norm  for middle of radiator plane
81     Double_t p2[3],n2[3]; 
82     pParam->Norm(ch,n2);
83     pParam->Point(ch,p2,AliHMPIDParam::kPc);                                                     //point & norm  for entrance to PC plane
84     if(pTrk->Intersect(p1,n1)==kFALSE) return -1;                                                //try to intersect track with the middle of radiator
85     if(pTrk->Intersect(p2,n2)==kFALSE) return -1;   
86     pParam->Mars2LorsVec(ch,n1,theta,phi);                                                       //track angles at RAD
87     pParam->Mars2Lors   (ch,p1,xRa,yRa);                                                         //TRKxRAD position
88     pParam->Mars2Lors   (ch,p2,xPc,yPc);                                                         //TRKxPC position
89     if(AliHMPIDParam::IsInside(xPc,yPc,pParam->DistCut())==kTRUE) return ch;                     //return intersected chamber  
90   return -1;                                                                                     //no intersection with HMPID chambers
91 }//IntTrkCha()
92 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
93 Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
94 {
95 // Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control. Done once per event.
96 // Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
97 //   Returns: error code (currently ignored in AliReconstruction::RunTraking())    
98   for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++) pCluTree->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));
99   pCluTree->GetEntry(0);
100   return 0;  
101 }//LoadClusters()
102 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
103 Int_t AliHMPIDTracker::PropagateBack(AliESDEvent *pEsd)
104 {
105 // Interface pure virtual in AliTracker. Invoked from AliReconstruction::RunTracking() after invocation of AliTracker::LoadClusters() once per event
106 // Agruments: pEsd - pointer to ESD
107 //   Returns: error code    
108   AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean"); //contains TObjArray of 42 TF1 + 1 EPhotMean
109   AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre"); //contains TObjArray of 42 (7ch * 6sec) TF1
110   if(!pNmeanEnt) AliError("No Nmean C6F14 ");
111   if(!pQthreEnt) AliError("No Qthre");
112     
113   return Recon(pEsd,fClu,(TObjArray*)pNmeanEnt->GetObject(),(TObjArray*)pQthreEnt->GetObject());  
114 }//PropagateBack()
115 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
116 Int_t AliHMPIDTracker::Recon(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmean, TObjArray *pQthre)
117 {
118 // Static method to reconstruct Theta Ckov for all valid tracks of a given event.
119 // Arguments: pEsd- pointer ESD; pClu- pointer to clusters for all chambers; pNmean - pointer to all function Nmean=f(time)
120 //   Returns: error code, 0 if no errors   
121   
122   AliHMPIDRecon recon;                                                                           //instance of reconstruction class, nothing important in ctor
123   AliHMPIDParam *pParam = AliHMPIDParam::Instance();                                             //Instance of AliHMPIDParam
124   Float_t xPc,yPc,xRa,yRa,theta,phi;
125   Double_t cluLORS[2]={0};
126 //  Double_t cluMARS[3]={0},trkMARS[3]={0};
127 //  Double_t bestcluMARS[3]={0,0,0};
128 //  Double_t radClu,radInitTrk;   
129   Int_t nMipClusTot=0;
130 //  Double_t d3d=0;
131   Double_t qthre = 0;   Double_t nmean=0; Int_t hvsec=0;
132   Int_t nClusCh[AliHMPIDParam::kMaxCh+1];
133  
134   
135   for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){                                        //loop on the ESD tracks in the event
136            
137 //    Double_t bestChi2=99999;chi2=99999;                                                          //init. track matching params
138     Double_t dmin=999999,bz=0,distCut=1,distParams[5]={1};
139
140     Bool_t isOkDcut=kFALSE;
141     Bool_t isOkQcut=kFALSE;
142     Bool_t isMatched=kFALSE;
143     
144     AliHMPIDCluster *bestHmpCluster=0x0;                                                          //the best matching cluster
145     AliESDtrack *pTrk = pEsd->GetTrack(iTrk);                                                     //get reconstructed track   
146     
147     if(!pTrk->IsOn(AliESDtrack::kTPCout)) continue;
148  
149     if(pTrk->IsOn(AliESDtrack::kTPCrefit)) continue;
150  
151     AliHMPIDtrack *hmpTrk = new AliHMPIDtrack(*pTrk);                                             //create a hmpid track to be used for propagation and matching 
152     bz=AliTracker::GetBz();  
153 //initial flags for HMPID ESD infos    
154     pTrk->SetHMPIDtrk(0,0,0,0);                                                                //no intersection found
155     pTrk->SetHMPIDmip(0,0,0,0);                                                                //store mip info in any case 
156     pTrk->SetHMPIDcluIdx(99,99999);                                                            //chamber not found, mip not yet considered
157     pTrk->SetHMPIDsignal(AliHMPIDRecon::kNotPerformed);                                        //ring reconstruction not yet performed
158     
159     Int_t ipCh=IntTrkCha(pTrk,xPc,yPc,xRa,yRa,theta,phi);                                        //find the intersected chamber for this track 
160     if(ipCh<0) continue;                                                                         //no intersection at all, go after next track
161
162     pTrk->SetHMPIDtrk(xPc,yPc,theta,phi);                                                        //store initial infos
163     pTrk->SetHMPIDcluIdx(ipCh,9999);                                                             //set chamber, index of cluster + cluster size
164     
165 // track intersects the chamber ipCh: find the MIP          
166     
167     TClonesArray *pMipCluLst=(TClonesArray *)pClus->At(ipCh);                                   //get the list of clusters
168     nMipClusTot = pMipCluLst->GetEntries();                                                     //total number of clusters in the given chamber
169     nClusCh[ipCh] = nMipClusTot;
170     
171     if(nMipClusTot==0) continue;                                                                         
172     
173     Int_t index=-1;                                                                             //index of the "best" matching cluster
174     
175     for (Int_t iClu=0; iClu<nMipClusTot;iClu++) {                                               //clusters loop
176       
177       AliHMPIDCluster *pClu=(AliHMPIDCluster*)pMipCluLst->UncheckedAt(iClu);                    //get the cluster
178 // evaluate qThre
179       if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) {                                             // just for backward compatibility
180         qthre=((TF1*)pQthre->At(pClu->Ch()))->Eval(pEsd->GetTimeStamp());                          //
181       } else {                                                                                     // in the past just 1 qthre
182         hvsec = pParam->InHVSector(pClu->Y());                                              //  per chamber
183         if(hvsec>=0)
184           qthre=((TF1*)pQthre->At(6*ipCh+hvsec))->Eval(pEsd->GetTimeStamp());                      //
185       }                                                                                            //
186 //
187       if(pClu->Q()<qthre) continue;                                                                      //charge compartible with MIP clusters      
188       isOkQcut = kTRUE;
189 //
190       cluLORS[0]=pClu->X(); cluLORS[1]=pClu->Y();                                            //get the LORS coordinates of the cluster
191       Double_t dist = TMath::Sqrt((xPc-cluLORS[0])*(xPc-cluLORS[0])+(yPc-cluLORS[1])*(yPc-cluLORS[1]));
192       
193       if(dist<dmin) {
194         dmin = dist;
195         index=iClu;
196         bestHmpCluster=pClu;
197       }
198     }
199
200     if(!isOkQcut) {
201       pTrk->SetHMPIDsignal(pParam->kMipQdcCut);
202       continue;                                                                     
203     }
204
205     Double_t radius = (pParam->Lors2Mars(ipCh,pParam->SizeAllX()/2,pParam->SizeAllY()/2)).Mag(); 
206     
207     if(!AliTracker::PropagateTrackTo(hmpTrk,radius,pTrk->GetMass(),1,kFALSE)) continue;
208               
209     if(!hmpTrk->PropagateTo(bestHmpCluster)) continue;
210
211     Int_t cluSiz = bestHmpCluster->Size();
212     pTrk->SetHMPIDmip(bestHmpCluster->X(),bestHmpCluster->Y(),(Int_t)bestHmpCluster->Q(),0);  //store mip info in any case 
213     pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz);                                             //set chamber, index of cluster + cluster size
214
215     if(AliHMPIDReconstructor::GetRecoParam())                                                 //retrieve distance cut
216     {
217       AliHMPIDReconstructor::GetRecoParam()->PrintParameters();
218       if(AliHMPIDReconstructor::GetRecoParam()->IsFixedDistCut()==kTRUE)                      //distance cut is fixed number
219       { 
220         distCut=AliHMPIDReconstructor::GetRecoParam()->GetHmpTrackMatchingDist();
221       }
222       else 
223       {
224         for(Int_t ipar=0;ipar,5;ipar++) distParams[ipar]=AliHMPIDReconstructor::GetRecoParam()->GetHmpTrackMatchingDistParam(ipar);      //prevision: distance cut is function of momentum
225         distCut=distParams[0]+distParams[1]*TMath::Power(distParams[2]*pTrk->GetP(),distParams[3]); //prevision: change functional form to be more precise
226       }
227     }
228     else {distCut=pParam->DistCut();}
229       
230     if(dmin < distCut) {
231       isOkDcut = kTRUE;
232     }
233
234     
235     
236     if(!isOkDcut) {
237       pTrk->SetHMPIDsignal(pParam->kMipDistCut);                                                //closest cluster with enough charge is still too far from intersection
238     }
239     
240     if(isOkQcut*isOkDcut) isMatched = kTRUE;                                                    // MIP-Track matched !!    
241     
242     if(!isMatched) continue;                                                                    // If matched continue...
243
244     Bool_t isOk = hmpTrk->Update(bestHmpCluster,0.1,0);
245     if(!isOk) continue;
246     pTrk->SetOuterHmpParam(hmpTrk,AliESDtrack::kHMPIDout);                 
247
248     FillResiduals(hmpTrk,bestHmpCluster,kFALSE);
249  
250     
251     //evaluate nMean
252     if(pNmean->GetEntries()==21) {                                                              //for backward compatibility
253       nmean=((TF1*)pNmean->At(3*ipCh))->Eval(pEsd->GetTimeStamp());                             //C6F14 Nmean for this chamber
254     } else {
255       Int_t iRad     = pParam->Radiator(yRa);                                                   //evaluate the radiator involved
256       if(iRad < 0) {
257         nmean = -1;
258       } else {
259       Double_t tLow  = ((TF1*)pNmean->At(6*ipCh+2*iRad  ))->Eval(pEsd->GetTimeStamp());         //C6F14 low  temp for this chamber
260       Double_t tHigh = ((TF1*)pNmean->At(6*ipCh+2*iRad+1))->Eval(pEsd->GetTimeStamp());         //C6F14 high temp for this chamber
261       Double_t tExp  = pParam->FindTemp(tLow,tHigh,yRa);                                        //estimated temp for that chamber at that y
262       nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp);                  //mean ref idx @ a given temp
263       }
264       if(nmean < 0){                                                                            //track didn' t pass through the radiator
265          pTrk->SetHMPIDsignal(AliHMPIDRecon::kNoRad);                                           //set the appropriate flag
266          pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz);                                          //set index of cluster
267          continue;
268       }
269     }
270     //
271     recon.SetImpPC(xPc,yPc);                                                                     //store track impact to PC
272     recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(ipCh),index,nmean,xRa,yRa);                   //search for Cerenkov angle of this track
273     
274     
275     AliHMPIDPid pID;
276     Double_t prob[5];
277     pID.FindPid(pTrk,5,prob);
278     pTrk->SetHMPIDpid(prob);
279 //      Printf(" Prob e- %6.2f mu %6.2f pi %6.2f k %6.2f p %6.2f",prob[0]*100,prob[1]*100,prob[2]*100,prob[3]*100,prob[4]*100);
280
281     delete hmpTrk;hmpTrk=0x0;
282   }//iTrk
283
284   return 0; // error code: 0=no error;
285 }//Recon()
286 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
287 Int_t AliHMPIDTracker::ReconHiddenTrk(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmean, TObjArray *pQthre)
288 {
289 // Static method to reconstruct Theta Ckov for all valid tracks of a given event.
290 // 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)
291 //   Returns: error code, 0 if no errors
292   
293   AliHMPIDReconHTA reconHTA;                                                                     //instance of reconstruction class, nothing important in ctor
294   
295   AliHMPIDParam *pParam = AliHMPIDParam::Instance();                                             //Instance of AliHMPIDParam
296   
297   for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){                                        //loop on the ESD tracks in the event
298     
299     AliESDtrack *pTrk = pEsd->GetTrack(iTrk);                                                     //here it is simulated or just empty track
300     Int_t ipCh;
301     ipCh = pTrk->GetHMPIDcluIdx();ipCh/=1000000;
302     if(ipCh<0) continue;
303
304     TClonesArray *pMipCluLst=(TClonesArray *)pClus->At(ipCh);                                   //get the list of clusters
305     Int_t nMipClusTot = pMipCluLst->GetEntries();                                               //total number of clusters in the given chamber
306     
307     Double_t qMip=-1;
308     Int_t chMip=-1;    
309     Double_t xMip = 0;
310     Double_t yMip = 0;
311     Int_t indMip  = 0;
312     Int_t cluMipSiz = 0;
313
314     for (Int_t iClu=0; iClu<nMipClusTot;iClu++) {                                               //clusters loop
315       
316       AliHMPIDCluster *pClu=(AliHMPIDCluster*)pMipCluLst->UncheckedAt(iClu);                    //get the cluster
317       Double_t qClus = pClu->Q();
318       if(qClus>qMip) {
319         qMip  = qClus;
320         chMip = pClu->Ch();
321         xMip = pClu->X();
322         yMip = pClu->Y();
323         indMip = iClu;
324         cluMipSiz = pClu->Size();
325       }
326     }//clus loop
327
328     if(chMip<0) return 1;    
329     
330     Int_t hvsec;
331     Double_t qthre=0;
332 // evaluate qThre
333     if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) {                                              // just for backward compatibility
334       qthre=((TF1*)pQthre->At(chMip))->Eval(pEsd->GetTimeStamp());                                //
335     } else {                                                                                      // in the past just 1 qthre
336       hvsec = pParam->InHVSector(yMip);                                                           //  per chamber
337       if(hvsec>=0) qthre=((TF1*)pQthre->At(6*chMip+hvsec))->Eval(pEsd->GetTimeStamp());           //
338     }
339 //
340     if(qMip<qthre) {
341       pTrk->SetHMPIDmip(xMip,yMip,(Int_t)qMip,0);                                                        //store mip info in any case 
342       pTrk->SetHMPIDcluIdx(chMip,indMip+1000*cluMipSiz);                                                          
343       pTrk->SetHMPIDsignal(pParam->kMipQdcCut);
344       return 1;                                                                                   //charge compatible with MIP clusters      
345     }
346       
347     pTrk->SetHMPIDmip(xMip,yMip,(Int_t)qMip,0);                                                   //store mip info in any case 
348     pTrk->SetHMPIDcluIdx(chMip,indMip+1000*cluMipSiz);                                                          
349
350     Double_t yRa = yMip;                                                                        //just an approx...
351     Double_t nmean;
352     //evaluate nMean
353     if(pNmean->GetEntries()==21) {                                                              //for backward compatibility
354       nmean=((TF1*)pNmean->At(3*chMip))->Eval(pEsd->GetTimeStamp());                            //C6F14 Nmean for this chamber
355     } else {
356       Int_t iRad     = pParam->Radiator(yRa);                                                   //evaluate the radiator involved
357       if(iRad < 0) {
358         nmean = -1;
359       } else {
360       Double_t tLow  = ((TF1*)pNmean->At(6*chMip+2*iRad  ))->Eval(pEsd->GetTimeStamp());        //C6F14 low  temp for this chamber
361       Double_t tHigh = ((TF1*)pNmean->At(6*chMip+2*iRad+1))->Eval(pEsd->GetTimeStamp());        //C6F14 high temp for this chamber
362       Double_t tExp  = pParam->FindTemp(tLow,tHigh,yRa);                                        //estimated temp for that chamber at that y
363       nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp);                  //mean ref idx @ a given temp
364       }
365       if(nmean < 0){                                                                            //track didn' t pass through the radiator
366          pTrk->SetHMPIDsignal(AliHMPIDRecon::kNoRad);                                           //set the appropriate flag
367          return 1;
368       }
369     }
370     //
371     if(!reconHTA.CkovHiddenTrk(pTrk,(TClonesArray *)pClus->At(ipCh),indMip,nmean)) {                 //search for track parameters and Cerenkov angle of this track
372       AliHMPIDPid pID;
373       Double_t prob[5];
374       pID.FindPid(pTrk,5,prob);
375       pTrk->SetHMPIDpid(prob);
376     }
377 //      Printf(" Prob e- %6.2f mu %6.2f pi %6.2f k %6.2f p %6.2f",prob[0]*100,prob[1]*100,prob[2]*100,prob[3]*100,prob[4]*100);
378   }//iTrk
379
380   return 0; // error code: 0=no error;
381
382 }//Recon()
383 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
384 void AliHMPIDTracker::FillClusterArray(TObjArray* array) const {
385   
386  // Publishes all pointers to clusters known to the tracker into the
387   // passed object array.
388   // The ownership is not transfered - the caller is not expected to delete
389   // the clusters
390  
391   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){    
392     TClonesArray *pCluArr=(TClonesArray*)(*fClu)[iCh];
393     for (Int_t iClu=0; iClu<pCluArr->GetEntriesFast();iClu++){
394       AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluArr->UncheckedAt(iClu);    
395       array->AddLast(pClu);
396     }//cluster loop in iCh
397     pCluArr->Delete();
398   }//Ch loop
399     
400   return;
401 }
402 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++