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