#97492 Request to: patch AliSimulation; port to Release; make tag on release; for...
[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()
79439569 19#include "TTreeStream.h" // debug streamer
20//
423554a3 21// HMPID base class fo tracking
22//.
23//.
24//.
d3da6dc4 25ClassImp(AliHMPIDTracker)
94b1fbfa 26//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
c61a7285 27AliHMPIDTracker::AliHMPIDTracker():
28 AliTracker(),
79439569 29 fClu(new TObjArray(AliHMPIDParam::kMaxCh+1)),
30 fDebugStreamer(0)
94b1fbfa 31{
59d9d4b3 32// ctor. Create TObjArray of TClonesArray of AliHMPIDCluster
33//
34//
c61a7285 35 fClu->SetOwner(kTRUE);
ae5a42aa 36 for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++) fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
79439569 37 fDebugStreamer = new TTreeSRedirector("HMPIDdebug.root");
38
59d9d4b3 39}//ctor
79439569 40
41
42AliHMPIDTracker::~AliHMPIDTracker(){
43 //
44 // destructor
45 //
46 delete fClu;
47 if (fDebugStreamer) delete fDebugStreamer;
48}
49
d3da6dc4 50//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
52{
53// Interface callback methode invoked from AliReconstruction::WriteAlignmentData() to get position of MIP cluster in MARS associated to a current track.
54// MIP cluster is reffered by index which is stored in AliESDtrack ???????
55// Arguments: idx- cluster index which is stored by HMPID in AliESDtrack
56// point- reference to the object where to store the point
57// Returns: status of operation if FALSE then AliReconstruction::WriteAlignmentData() do not store this point to array of points for current track.
58 if(idx<0) return kFALSE; //no MIP cluster assigned to this track in PropagateBack()
59d9d4b3 59 Int_t iCham=idx/1000000; Int_t iClu=idx%1000000;
2247c219 60 iClu = iClu%1000; //GetHMPIDcluIdx -> 1e+6*ch + 1e+3*clusize + cluIdx;
61 point.SetVolumeID(AliGeomManager::LayerToVolUID(AliGeomManager::kHMPID,iCham));//layer and chamber number
94b1fbfa 62 TClonesArray *pArr=(TClonesArray*)(*fClu)[iCham];
63 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pArr->UncheckedAt(iClu);//get pointer to cluster
2247c219 64 Float_t xyz[3];
65 pClu->GetGlobalXYZ(xyz);
66 Float_t cov[6];
67 pClu->GetGlobalCov(cov);
68 point.SetXYZ(xyz,cov);
d3da6dc4 69 return kTRUE;
59d9d4b3 70}//GetTrackPoint()
71//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39cd22e6 72Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xPc,Float_t &yPc,Float_t &xRa,Float_t &yRa,Float_t &theta,Float_t &phi)
59d9d4b3 73{
74// Static method to find intersection in between given track and HMPID chambers
75// Arguments: pTrk- ESD track; xPc,yPc- track intersection with PC in LORS [cm]
76// Returns: intersected chamber ID or -1
b4866751 77 AliHMPIDtrack *hmpTrk = new AliHMPIDtrack(*pTrk); //create a hmpid track to be used for propagation and matching
ae5a42aa 78 for(Int_t i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){ //chambers loop
b4866751 79 Int_t chInt = IntTrkCha(i,hmpTrk,xPc,yPc,xRa,yRa,theta,phi);
80 if(chInt>=0) {delete hmpTrk;hmpTrk=0x0;return chInt;}
59d9d4b3 81 } //chambers loop
b4866751 82 delete hmpTrk; hmpTrk=0x0;
39cd22e6 83 return -1; //no intersection with HMPID chambers
59d9d4b3 84}//IntTrkCha()
d3da6dc4 85//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
496c71b0 86Int_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)
87{
88// Static method to find intersection in between given track and HMPID chambers
89// Arguments: pTrk- HMPID track; xPc,yPc- track intersection with PC in LORS [cm]
90// Returns: intersected chamber ID or -1
91 AliHMPIDParam *pParam=AliHMPIDParam::Instance();
92 Double_t p1[3],n1[3];
93 pParam->Norm(ch,n1);
94 pParam->Point(ch,p1,AliHMPIDParam::kRad); //point & norm for middle of radiator plane
95 Double_t p2[3],n2[3];
b4866751 96 pParam->Norm(ch,n2);
496c71b0 97 pParam->Point(ch,p2,AliHMPIDParam::kPc); //point & norm for entrance to PC plane
97a4d538 98 if(pTrk->Intersect(p1,n1)==kFALSE) return -1; //try to intersect track with the middle of radiator
99 if(pTrk->Intersect(p2,n2)==kFALSE) return -1;
496c71b0 100 pParam->Mars2LorsVec(ch,n1,theta,phi); //track angles at RAD
101 pParam->Mars2Lors (ch,p1,xRa,yRa); //TRKxRAD position
102 pParam->Mars2Lors (ch,p2,xPc,yPc); //TRKxPC position
103 if(AliHMPIDParam::IsInside(xPc,yPc,pParam->DistCut())==kTRUE) return ch; //return intersected chamber
104 return -1; //no intersection with HMPID chambers
105}//IntTrkCha()
106//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
d3da6dc4 107Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
108{
59d9d4b3 109// Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control. Done once per event.
d3da6dc4 110// Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
111// Returns: error code (currently ignored in AliReconstruction::RunTraking())
ae5a42aa 112 for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++) pCluTree->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));
94b1fbfa 113 pCluTree->GetEntry(0);
94b1fbfa 114 return 0;
59d9d4b3 115}//LoadClusters()
d3da6dc4 116//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
af885e0f 117Int_t AliHMPIDTracker::PropagateBack(AliESDEvent *pEsd)
abb5f786 118{
59d9d4b3 119// Interface pure virtual in AliTracker. Invoked from AliReconstruction::RunTracking() after invocation of AliTracker::LoadClusters() once per event
abb5f786 120// Agruments: pEsd - pointer to ESD
121// Returns: error code
f455af6e 122 AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean"); //contains TObjArray of 42 TF1 + 1 EPhotMean
49881df7 123 AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre"); //contains TObjArray of 42 (7ch * 6sec) TF1
0a7c7084 124 if(!pNmeanEnt) AliError("No Nmean C6F14 ");
125 if(!pQthreEnt) AliError("No Qthre");
94b1fbfa 126
afe12692 127 return Recon(pEsd,fClu,(TObjArray*)pNmeanEnt->GetObject(),(TObjArray*)pQthreEnt->GetObject());
611e810d 128}//PropagateBack()
abb5f786 129//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
afe12692 130Int_t AliHMPIDTracker::Recon(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmean, TObjArray *pQthre)
d3da6dc4 131{
aed5907d 132// Static method to reconstruct the Cherenkov angle for all valid tracks of a given event.
59d9d4b3 133// Arguments: pEsd- pointer ESD; pClu- pointer to clusters for all chambers; pNmean - pointer to all function Nmean=f(time)
aed5907d 134// Returns: error code, 0 if no errors
135//
136// Algortihm: Loop over tracks
137//
138// 1. Find the closest MIP cluster using fast tracks extrapolation method
139// 2. Propagate track to the MIP cluster using the STEER method
140// 3. Update the track information with MIP cluster (Improved angular and position resolution - to be used for Cherenkov angle calculation)
141// 4. Propagate back the constrained track to the radiator radius ( not exact yet)
142// 5. Propagation in the last 10 cm with the fast method
143// 6. Set ESDtrack information
144// 7. Calculate the Cherenkov angle
145
146 const Double_t kMaxSnp=0.9; //maximal snp for prolongation
147 const Double_t kdRadiator=10; // distance between radiator and the plane
496c71b0 148 AliHMPIDRecon recon; //instance of reconstruction class, nothing important in ctor
b8541917 149 AliHMPIDParam *pParam = AliHMPIDParam::Instance(); //Instance of AliHMPIDParam
39cd22e6 150 Float_t xPc,yPc,xRa,yRa,theta,phi;
aed5907d 151
43e51ec6 152 Double_t cluLORS[2]={0};
496c71b0 153 Int_t nMipClusTot=0;
aed5907d 154
84770d7b 155 Double_t qthre = 0; Double_t nmean=0; Int_t hvsec=0;
496c71b0 156 Int_t nClusCh[AliHMPIDParam::kMaxCh+1];
3e630437 157
15f675cb 158 Bool_t tsRight = kTRUE;
159
3e630437 160 UInt_t tsmin = (UInt_t)((TF1*)pQthre->At(0))->GetXmin(); //
161 UInt_t tsmax = (UInt_t)((TF1*)pQthre->At(0))->GetXmax(); //
162 UInt_t ts = pEsd->GetTimeStamp();
496c71b0 163
3e630437 164 if(ts<tsmin || ts>tsmax) {
165 AliWarning(Form(" in HMPID time stamp out of range!!! Please check!!! ts = %i",ts));
15f675cb 166 tsRight = kFALSE;
3e630437 167 }
168
496c71b0 169 for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){ //loop on the ESD tracks in the event
c38d443f 170
aed5907d 171 // Double_t bestChi2=99999;chi2=99999; //init. track matching params
b8541917 172 Double_t dmin=999999,bz=0,distCut=1,distParams[5]={1};
43e51ec6 173
174 Bool_t isOkDcut=kFALSE;
175 Bool_t isOkQcut=kFALSE;
176 Bool_t isMatched=kFALSE;
177
496c71b0 178 AliHMPIDCluster *bestHmpCluster=0x0; //the best matching cluster
c38d443f 179 AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //get reconstructed track
180
181 if(!pTrk->IsOn(AliESDtrack::kTPCout)) continue;
182
183 if(pTrk->IsOn(AliESDtrack::kTPCrefit)) continue;
79439569 184 AliESDfriendTrack *ftrack= (AliESDfriendTrack *)pTrk->GetFriendTrack();
185 if (!ftrack) continue;
186 if (!ftrack->GetTPCOut()) continue;
496c71b0 187 AliHMPIDtrack *hmpTrk = new AliHMPIDtrack(*pTrk); //create a hmpid track to be used for propagation and matching
aed5907d 188 AliHMPIDtrack *hmpTrkConstrained = 0; //create a hmpid track to be used for propagation and matching
79439569 189 hmpTrk->Set(ftrack->GetTPCOut()->GetX(), ftrack->GetTPCOut()->GetAlpha(),ftrack->GetTPCOut()->GetParameter(), ftrack->GetTPCOut()->GetCovariance());
190 //
aed5907d 191 bz=AliTracker::GetBz();
192
193 //initial flags for HMPID ESD infos
43e51ec6 194 pTrk->SetHMPIDtrk(0,0,0,0); //no intersection found
195 pTrk->SetHMPIDmip(0,0,0,0); //store mip info in any case
196 pTrk->SetHMPIDcluIdx(99,99999); //chamber not found, mip not yet considered
197 pTrk->SetHMPIDsignal(AliHMPIDRecon::kNotPerformed); //ring reconstruction not yet performed
496c71b0 198
af291e40 199 Int_t ipCh=IntTrkCha(pTrk,xPc,yPc,xRa,yRa,theta,phi); //find the intersected chamber for this track
4ccd1903 200 if(ipCh<0) {delete hmpTrk;hmpTrk=0x0;continue;} //no intersection at all, go after next track
43e51ec6 201
97a4d538 202 pTrk->SetHMPIDtrk(xPc,yPc,theta,phi); //store initial infos
43e51ec6 203 pTrk->SetHMPIDcluIdx(ipCh,9999); //set chamber, index of cluster + cluster size
496c71b0 204
aed5907d 205 // track intersects the chamber ipCh: find the MIP
496c71b0 206
207 TClonesArray *pMipCluLst=(TClonesArray *)pClus->At(ipCh); //get the list of clusters
208 nMipClusTot = pMipCluLst->GetEntries(); //total number of clusters in the given chamber
209 nClusCh[ipCh] = nMipClusTot;
210
4ccd1903 211 if(nMipClusTot==0) {delete hmpTrk;hmpTrk=0x0;continue;}
43e51ec6 212
aed5907d 213 Int_t index=-1; //index of the "best" matching cluster
214 //
215 // 1. Find the closest MIP cluster using fast tracks extrapolation method
216 //
217 for (Int_t iClu=0; iClu<nMipClusTot;iClu++) { //clusters loop
496c71b0 218
aed5907d 219 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pMipCluLst->UncheckedAt(iClu); //get the cluster
220 // evaluate qThre
15f675cb 221 if(tsRight){
aed5907d 222 if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) {
223 qthre=((TF1*)pQthre->At(pClu->Ch()))->Eval(ts); //
224 } else { // in the past just 1 qthre
225 hvsec = pParam->InHVSector(pClu->Y()); // per chamber
226 if(hvsec>=0) qthre=((TF1*)pQthre->At(6*ipCh+hvsec))->Eval(ts); //
15f675cb 227 }
228 } else qthre = pParam->QCut();
aed5907d 229
230 //
496c71b0 231 if(pClu->Q()<qthre) continue; //charge compartible with MIP clusters
232 isOkQcut = kTRUE;
aed5907d 233 //
234 cluLORS[0]=pClu->X(); cluLORS[1]=pClu->Y(); //get the LORS coordinates of the cluster
43e51ec6 235 Double_t dist = TMath::Sqrt((xPc-cluLORS[0])*(xPc-cluLORS[0])+(yPc-cluLORS[1])*(yPc-cluLORS[1]));
236
237 if(dist<dmin) {
238 dmin = dist;
239 index=iClu;
240 bestHmpCluster=pClu;
241 }
4ccd1903 242 } // clusters loop
b8541917 243
aed5907d 244 // moved down
245 /*if(!isOkQcut) {
496c71b0 246 pTrk->SetHMPIDsignal(pParam->kMipQdcCut);
4ccd1903 247 delete hmpTrk;hmpTrk=0x0; continue;
aed5907d 248 }*/
249
250 //
251 // 2. Propagate track to the MIP cluster using the STEER method
79439569 252 //
95d2d29e 253
254 if(!bestHmpCluster) {delete hmpTrk;hmpTrk=0x0; delete hmpTrkConstrained;hmpTrkConstrained=0x0; continue;}
255
79439569 256 TVector3 vG = pParam->Lors2Mars(ipCh,bestHmpCluster->X(),bestHmpCluster->Y());
257 Double_t gx = vG[0];
258 Double_t gy = vG[1];
259 Double_t gz = vG[2];
260 Double_t alpha=TMath::ATan2(gy,gx);
261 Double_t radiusH=TMath::Sqrt(gy*gy+gx*gx);
aed5907d 262 if (!(hmpTrk->Rotate(alpha,kTRUE))) continue;
263 if(!AliTrackerBase::PropagateTrackToBxByBz(hmpTrk,radiusH,pTrk->GetMass(),1,kFALSE,kMaxSnp,-1)) {delete hmpTrk;hmpTrk=0x0; delete hmpTrkConstrained;hmpTrkConstrained=0x0; continue;}
79439569 264 //
aed5907d 265 // 3. Update the track with MIP cluster (Improved angular and position resolution - to be used for Cherenkov angle calculation)
266 //
267 AliExternalTrackParam trackC(*hmpTrk);
268 Double_t posC[2]={0,gz};
269 Double_t covC[3]={0.1*0.1, 0, 0.1*0.1};
270 trackC.Update(posC,covC);
271 //
272 // 4. Propagate back the constrained track to the radiator radius ( not exact yet)
273 //
274 hmpTrkConstrained = new AliHMPIDtrack(*pTrk);
275 hmpTrkConstrained->Set(trackC.GetX(), trackC.GetAlpha(),trackC.GetParameter(), trackC.GetCovariance());
276 if(!AliTrackerBase::PropagateTrackToBxByBz(hmpTrkConstrained,radiusH-kdRadiator,pTrk->GetMass(),1,kFALSE,kMaxSnp,1)) {delete hmpTrk;hmpTrk=0x0; delete hmpTrkConstrained;hmpTrkConstrained=0x0;continue;}
277 //
278 // 5. Propagation in the last 10 cm with the fast method
279 //
280 Float_t xPc0=0, yPc0=0;
281
7243a52d 282 IntTrkCha(ipCh, hmpTrk, xPc0,yPc0,xRa,yRa,theta,phi);
283 IntTrkCha(ipCh, hmpTrkConstrained, xPc,yPc,xRa,yRa,theta,phi);
aed5907d 284 //
285 // 6. Set ESDtrack information
286 //
287 Int_t cluSiz = bestHmpCluster->Size();
288 pTrk->SetHMPIDmip(bestHmpCluster->X(),bestHmpCluster->Y(),(Int_t)bestHmpCluster->Q(),0); //store mip info in any case
289 pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz); //set chamber, index of cluster + cluster size
290 pTrk->SetHMPIDtrk(xPc0,yPc0,theta,phi);
79439569 291 //
79439569 292 //
293 // Dump debug info if specified
294 //
aed5907d 295 if (AliHMPIDReconstructor::StreamLevel()>0) {
79439569 296 AliExternalTrackParam * trackTPC=new AliExternalTrackParam(*(ftrack->GetTPCOut()));
297 AliExternalTrackParam * trackCurrent=new AliExternalTrackParam(*pTrk);
bf3b953e 298 if(!trackTPC->Rotate(alpha)) continue;
299 if(!trackCurrent->Rotate(alpha)) continue;
79439569 300 Bool_t statusTPC= AliTracker::PropagateTrackToBxByBz(trackTPC,radiusH,pTrk->GetMass(),1,kFALSE,kMaxSnp,-1);
f23adc8f 301 Bool_t statusCurrent=AliTracker::PropagateTrackToBxByBz(trackCurrent,radiusH,pTrk->GetMass(),1,kFALSE,kMaxSnp,-1);
302 AliExternalTrackParam * trackTPCNB=new AliExternalTrackParam(*(ftrack->GetTPCOut()));
bf3b953e 303 if(!trackTPCNB->Rotate(alpha)) continue;
f23adc8f 304 Bool_t statusTPCNB=kTRUE;
305 Double_t bfield[3]={0,0,0};
306 for (Double_t radius=trackTPCNB->GetX(); radius<radiusH; radius+=1){
307 Double_t xyz[3];
308 trackTPCNB->GetXYZ(xyz);
309 GetBxByBz(xyz,bfield);
310 statusTPCNB&=trackTPCNB->PropagateToBxByBz(radius,bfield);
311 }
312 statusTPCNB&=trackTPCNB->PropagateToBxByBz(radiusH,bfield);
313 //
aed5907d 314 Double_t tanAlpha=TMath::Tan(TMath::ASin(trackTPC->GetSnp()));
79439569 315 Double_t deltaC= trackTPC->GetC(AliTrackerBase::GetBz())-ftrack->GetTPCOut()->GetC(AliTrackerBase::GetBz());
316 //
aed5907d 317 AliExternalTrackParam * trackTPCConstrained= new AliExternalTrackParam(*trackTPC);
318 Double_t pos[2]={0,gz};
319 Double_t cov[3]={0.1*0.1, 0, 0.1*0.1};
320 Double_t chi2C = trackTPCConstrained->GetPredictedChi2(pos,cov);
321 trackTPCConstrained->Update(pos,cov);
79439569 322 (*fDebugStreamer)<<"track"<<
aed5907d 323 "rH="<<radiusH<< // radius of cluster
324 "angle="<<tanAlpha<< // tan of the local inlination angle
325 "dC="<<deltaC<< // delta of the curvature
f23adc8f 326 "trackTPC.="<<trackTPC<< // TPC outer param extrapolated to the HMPID
327 "trackTPCNB.="<<trackTPCNB<< // TPC track prpagated with material budget correction
aed5907d 328 "chi2C="<<chi2C<<
f23adc8f 329 "trackTPCC.="<<trackTPCConstrained<< // TPC outer param extrapolated to the HMPID constrained
aed5907d 330 "trackCurrent.="<<trackCurrent<< // current track extrapolated to the HMPID
331 "sTPC="<<statusTPC<< // status for the current TPC track
332 "sCurrent="<<statusCurrent<< // status for the current global track
333 "cl.="<<bestHmpCluster<< // HMPID cluster
79439569 334 //
aed5907d 335 "t.="<<pTrk<< // curent esd track
336 "ft.="<<ftrack<< // friend track
337 "hmpTrk.="<<hmpTrk<< // hmpid tracks as used in the following code
f23adc8f 338 "hmpTrkC.="<<hmpTrkConstrained<< // constrained hmpid tracks as used in the following code
aed5907d 339 "gx="<<gx<< // global cluster position X
340 "gy="<<gy<< // Y
341 "gz="<<gz<< // Z
79439569 342 "\n";
aed5907d 343 }
344 //
345 //
346 //
347 if(!isOkQcut) {
348 pTrk->SetHMPIDsignal(pParam->kMipQdcCut);
349 delete hmpTrk;hmpTrk=0x0;
350 delete hmpTrkConstrained;hmpTrkConstrained=0x0;
351 continue;
352 }
79439569 353
b8541917 354 if(AliHMPIDReconstructor::GetRecoParam()) //retrieve distance cut
355 {
b8541917 356 if(AliHMPIDReconstructor::GetRecoParam()->IsFixedDistCut()==kTRUE) //distance cut is fixed number
357 {
358 distCut=AliHMPIDReconstructor::GetRecoParam()->GetHmpTrackMatchingDist();
359 }
360 else
361 {
13fb7604 362 for(Int_t ipar=0;ipar<5;ipar++) distParams[ipar]=AliHMPIDReconstructor::GetRecoParam()->GetHmpTrackMatchingDistParam(ipar); //prevision: distance cut is function of momentum
b8541917 363 distCut=distParams[0]+distParams[1]*TMath::Power(distParams[2]*pTrk->GetP(),distParams[3]); //prevision: change functional form to be more precise
364 }
365 }
366 else {distCut=pParam->DistCut();}
aed5907d 367
368 //dmin recalculated
369
370 dmin = TMath::Sqrt((xPc0-bestHmpCluster->X())*(xPc0-bestHmpCluster->X())+(yPc0-bestHmpCluster->Y())*(yPc0-bestHmpCluster->Y()));
371
b8541917 372 if(dmin < distCut) {
496c71b0 373 isOkDcut = kTRUE;
4ccd1903 374 }
aed5907d 375 //isOkDcut = kTRUE; // switch OFF cut
b8541917 376
496c71b0 377 if(!isOkDcut) {
496c71b0 378 pTrk->SetHMPIDsignal(pParam->kMipDistCut); //closest cluster with enough charge is still too far from intersection
379 }
380
381 if(isOkQcut*isOkDcut) isMatched = kTRUE; // MIP-Track matched !!
382
aed5907d 383 if(!isMatched) {delete hmpTrk;hmpTrk=0x0;delete hmpTrkConstrained;hmpTrkConstrained=0x0;continue;} // If matched continue...
43e51ec6 384
aed5907d 385 Bool_t isOk = kTRUE;
95d2d29e 386 if(!isOk) {delete hmpTrk;hmpTrk=0x0; delete hmpTrkConstrained;hmpTrkConstrained=0x0; continue;}
aed5907d 387 pTrk->SetOuterHmpParam(hmpTrkConstrained,AliESDtrack::kHMPIDout);
c38d443f 388
389 FillResiduals(hmpTrk,bestHmpCluster,kFALSE);
b8541917 390
aed5907d 391 Int_t iRad = pParam->Radiator(yRa); //evaluate the radiator involved
496c71b0 392
496c71b0 393 //evaluate nMean
15f675cb 394 if(tsRight){
395 if(pNmean->GetEntries()==21) { //for backward compatibility
396 nmean=((TF1*)pNmean->At(3*ipCh))->Eval(ts); //C6F14 Nmean for this chamber
397 } else {
15f675cb 398 if(iRad < 0) {
0a7c7084 399 nmean = -1;
15f675cb 400 } else {
401 Double_t tLow = ((TF1*)pNmean->At(6*ipCh+2*iRad ))->Eval(ts); //C6F14 low temp for this chamber
402 Double_t tHigh = ((TF1*)pNmean->At(6*ipCh+2*iRad+1))->Eval(ts); //C6F14 high temp for this chamber
403 Double_t tExp = pParam->FindTemp(tLow,tHigh,yRa); //estimated temp for that chamber at that y
404 nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp); //mean ref idx @ a given temp
405 }
406 if(nmean < 0){ //track didn' t pass through the radiator
496c71b0 407 pTrk->SetHMPIDsignal(AliHMPIDRecon::kNoRad); //set the appropriate flag
408 pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz); //set index of cluster
4ccd1903 409 delete hmpTrk;hmpTrk=0x0;
aed5907d 410 delete hmpTrkConstrained;hmpTrkConstrained=0x0;
496c71b0 411 continue;
15f675cb 412 }
aed5907d 413 }
414 } else nmean = pParam->MeanIdxRad();
415 //
416 // 7. Calculate the Cherenkov angle
496c71b0 417 //
aed5907d 418 recon.SetImpPC(xPc0,yPc0); //store track impact to PC
97a4d538 419 recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(ipCh),index,nmean,xRa,yRa); //search for Cerenkov angle of this track
aed5907d 420
421 Double_t thetaCkov = pTrk->GetHMPIDsignal();
422
423 if (AliHMPIDReconstructor::StreamLevel()>0) {
424 AliExternalTrackParam * trackTPC=new AliExternalTrackParam(*(ftrack->GetTPCOut()));
425 AliExternalTrackParam * trackCurrent=new AliExternalTrackParam(*pTrk);
bf3b953e 426 if(!trackTPC->Rotate(alpha)) continue;
427 if(!trackCurrent->Rotate(alpha)) continue;
aed5907d 428 Bool_t statusTPC= AliTracker::PropagateTrackToBxByBz(trackTPC,radiusH,pTrk->GetMass(),1,kFALSE,kMaxSnp,-1);
429 Bool_t statusCurrent=AliTracker::PropagateTrackToBxByBz(trackCurrent,radiusH,pTrk->GetMass(),1,kFALSE,kMaxSnp,-1);
430 Double_t tanAlpha=TMath::Tan(TMath::ASin(trackTPC->GetSnp()));
431 Double_t deltaC= trackTPC->GetC(AliTrackerBase::GetBz())-ftrack->GetTPCOut()->GetC(AliTrackerBase::GetBz());
432 //
f23adc8f 433 AliExternalTrackParam * trackTPCNB=new AliExternalTrackParam(*(ftrack->GetTPCOut()));
bf3b953e 434 if(!trackTPCNB->Rotate(alpha)) continue;
f23adc8f 435 Bool_t statusTPCNB=kTRUE;
436 Double_t bfield[3]={0,0,0};
437 for (Double_t radius=trackTPCNB->GetX(); radius<radiusH; radius+=1){
438 Double_t xyz[3];
439 trackTPCNB->GetXYZ(xyz);
440 GetBxByBz(xyz,bfield);
441 statusTPCNB&=trackTPCNB->PropagateToBxByBz(radius,bfield);
442 }
443 statusTPCNB&=trackTPCNB->PropagateToBxByBz(radiusH,bfield);
444
aed5907d 445 AliExternalTrackParam * trackTPCConstrained= new AliExternalTrackParam(*trackTPC);
446 Double_t pos[2]={0,gz};
447 Double_t cov[3]={0.1*0.1, 0, 0.1*0.1};
448 Double_t chi2C = trackTPCConstrained->GetPredictedChi2(pos,cov);
449 trackTPCConstrained->Update(pos,cov);
450 (*fDebugStreamer)<<"track2"<<
451 "rH="<<radiusH<< // radius of cluster
452 "angle="<<tanAlpha<< // tan of the local inlination angle
453 "dC="<<deltaC<< // delta of the curvature
f23adc8f 454 "trackTPC.="<<trackTPC<< // TPC outer param extrapolated to the HMPID
455 "trackTPCNB.="<<trackTPCNB<< // TPC outer param extrapolated to the HMPID
aed5907d 456 "chi2C="<<chi2C<<
f23adc8f 457 "trackTPCC.="<<trackTPCConstrained<< // TPC outer param extrapolated to the HMPID constrained
aed5907d 458 "trackCurrent.="<<trackCurrent<< // current track extrapolated to the HMPID
459 "sTPC="<<statusTPC<< // status for the current TPC track
460 "sCurrent="<<statusCurrent<< // status for the current global track
461 "cl.="<<bestHmpCluster<< // HMPID cluster
462 //
463 "t.="<<pTrk<< // curent esd track
464 "ft.="<<ftrack<< // friend track
465 "hmpTrk.="<<hmpTrk<< // hmpid tracks as used in the following code
f23adc8f 466 "hmpTrkC.="<<hmpTrkConstrained<< // constrained hmpid tracks as used in the following code
aed5907d 467 "gx="<<gx<< // global cluster position X
468 "gy="<<gy<< // Y
469 "gz="<<gz<< // Z
470 "thetaCkov="<<thetaCkov<< // Cherenkov angle
471 "\n";
472 }
473
474 if(pTrk->GetHMPIDsignal()<0) {
475 delete hmpTrk;hmpTrk=0x0;
476 delete hmpTrkConstrained; hmpTrkConstrained=0x0;
477 continue;}
235a21c2 478
e56b695f 479 AliHMPIDPid pID;
480 Double_t prob[5];
b7a2d22d 481 pID.FindPid(pTrk,nmean,5,prob);
e56b695f 482 pTrk->SetHMPIDpid(prob);
aed5907d 483 delete hmpTrk; hmpTrk=0x0;
484 delete hmpTrkConstrained; hmpTrkConstrained=0x0;
496c71b0 485 }//iTrk
486
d3da6dc4 487 return 0; // error code: 0=no error;
611e810d 488}//Recon()
489//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
b7a2d22d 490Int_t AliHMPIDTracker::ReconFromKin(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmean, TObjArray *pQthre)
491{
492// Static method to reconstruct Theta Ckov for all valid tracks of a given event.
493// Arguments: pEsd- pointer ESD; pClu- pointer to clusters for all chambers; pNmean - pointer to all function Nmean=f(time)
494// Returns: error code, 0 if no errors
495
496 AliHMPIDRecon recon; //instance of reconstruction class, nothing important in ctor
497 AliHMPIDParam *pParam = AliHMPIDParam::Instance(); //Instance of AliHMPIDParam
498 Float_t xPc,yPc,xRa,yRa,theta,phi;
499 Double_t cluLORS[2]={0};
500 Int_t nMipClusTot=0;
501 Double_t qthre = 0; Double_t nmean=0; Int_t hvsec=0;
502 Int_t nClusCh[AliHMPIDParam::kMaxCh+1];
503
504 Bool_t tsRight = kTRUE;
505
506 UInt_t tsmin = (UInt_t)((TF1*)pQthre->At(0))->GetXmin(); //
507 UInt_t tsmax = (UInt_t)((TF1*)pQthre->At(0))->GetXmax(); //
508 UInt_t ts = pEsd->GetTimeStamp();
509
510 if(ts<tsmin || ts>tsmax) {
511 AliWarning(Form(" in HMPID time stamp out of range!!! Please check!!! ts = %i",ts));
512 tsRight = kFALSE;
513 }
514
515 for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){ //loop on the ESD tracks in the event
516
517 Double_t dmin=999999,bz=0,distCut=1,distParams[5]={1};
518
519 Bool_t isOkDcut=kFALSE;
520 Bool_t isOkQcut=kFALSE;
521 Bool_t isMatched=kFALSE;
522
523 AliHMPIDCluster *bestHmpCluster=0x0; //the best matching cluster
524 AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //get reconstructed track
525
526 AliHMPIDtrack *hmpTrk = new AliHMPIDtrack(*pTrk); //create a hmpid track to be used for propagation and matching
527 bz=AliTracker::GetBz();
528//initial flags for HMPID ESD infos
529 pTrk->SetHMPIDtrk(0,0,0,0); //no intersection found
530 pTrk->SetHMPIDmip(0,0,0,0); //store mip info in any case
531 pTrk->SetHMPIDcluIdx(99,99999); //chamber not found, mip not yet considered
532 pTrk->SetHMPIDsignal(AliHMPIDRecon::kNotPerformed); //ring reconstruction not yet performed
533
534 Int_t ipCh=IntTrkCha(pTrk,xPc,yPc,xRa,yRa,theta,phi); //find the intersected chamber for this track
535 if(ipCh<0) {delete hmpTrk;hmpTrk=0x0;continue;} //no intersection at all, go after next track
536
537 pTrk->SetHMPIDtrk(xPc,yPc,theta,phi); //store initial infos
538 pTrk->SetHMPIDcluIdx(ipCh,9999); //set chamber, index of cluster + cluster size
539
540// track intersects the chamber ipCh: find the MIP
541
542 TClonesArray *pMipCluLst=(TClonesArray *)pClus->At(ipCh); //get the list of clusters
543 nMipClusTot = pMipCluLst->GetEntries(); //total number of clusters in the given chamber
544 nClusCh[ipCh] = nMipClusTot;
545
546 if(nMipClusTot==0) {delete hmpTrk;hmpTrk=0x0;continue;}
547
548 Int_t index=-1; //index of the "best" matching cluster
549
550 for (Int_t iClu=0; iClu<nMipClusTot;iClu++) { //clusters loop
551
552 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pMipCluLst->UncheckedAt(iClu); //get the cluster
553// evaluate qThre
554 if(tsRight){
555 if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) {
556 qthre=((TF1*)pQthre->At(pClu->Ch()))->Eval(ts); //
557 } else { // in the past just 1 qthre
558 hvsec = pParam->InHVSector(pClu->Y()); // per chamber
559 if(hvsec>=0) qthre=((TF1*)pQthre->At(6*ipCh+hvsec))->Eval(ts); //
560 }
561 } else qthre = pParam->QCut();
562
563//
564 if(pClu->Q()<qthre) continue; //charge compartible with MIP clusters
565 isOkQcut = kTRUE;
566//
567 cluLORS[0]=pClu->X(); cluLORS[1]=pClu->Y(); //get the LORS coordinates of the cluster
568 Double_t dist = TMath::Sqrt((xPc-cluLORS[0])*(xPc-cluLORS[0])+(yPc-cluLORS[1])*(yPc-cluLORS[1]));
569
570 if(dist<dmin) {
571 dmin = dist;
572 index=iClu;
573 bestHmpCluster=pClu;
574 }
575 } // clusters loop
576
577 if(!isOkQcut) {
578 pTrk->SetHMPIDsignal(pParam->kMipQdcCut);
579 delete hmpTrk;hmpTrk=0x0; continue;
580 }
581
582 Double_t radius = (pParam->Lors2Mars(ipCh,pParam->SizeAllX()/2,pParam->SizeAllY()/2)).Mag();
583
584 if(!AliTracker::PropagateTrackToBxByBz(hmpTrk,radius,pTrk->GetMass(),1,kFALSE)) {delete hmpTrk;hmpTrk=0x0;continue;}
585
586 if(!hmpTrk->PropagateTo(bestHmpCluster)) {delete hmpTrk;hmpTrk=0x0;continue;}
587
588 Int_t cluSiz = bestHmpCluster->Size();
589 pTrk->SetHMPIDmip(bestHmpCluster->X(),bestHmpCluster->Y(),(Int_t)bestHmpCluster->Q(),0); //store mip info in any case
590 pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz); //set chamber, index of cluster + cluster size
591
592 if(AliHMPIDReconstructor::GetRecoParam()) //retrieve distance cut
593 {
594 if(AliHMPIDReconstructor::GetRecoParam()->IsFixedDistCut()==kTRUE) //distance cut is fixed number
595 {
596 distCut=AliHMPIDReconstructor::GetRecoParam()->GetHmpTrackMatchingDist();
597 }
598 else
599 {
600 for(Int_t ipar=0;ipar<5;ipar++) distParams[ipar]=AliHMPIDReconstructor::GetRecoParam()->GetHmpTrackMatchingDistParam(ipar); //prevision: distance cut is function of momentum
601 distCut=distParams[0]+distParams[1]*TMath::Power(distParams[2]*pTrk->GetP(),distParams[3]); //prevision: change functional form to be more precise
602 }
603 }
604 else {distCut=pParam->DistCut();}
605
606 if(dmin < distCut) {
607 isOkDcut = kTRUE;
608 }
609
610 if(!isOkDcut) {
611 pTrk->SetHMPIDsignal(pParam->kMipDistCut); //closest cluster with enough charge is still too far from intersection
612 }
613
614 if(isOkQcut*isOkDcut) isMatched = kTRUE; // MIP-Track matched !!
615
616 if(!isMatched) {delete hmpTrk;hmpTrk=0x0;continue;} // If matched continue...
617
618 Bool_t isOk = hmpTrk->Update(bestHmpCluster,0.1,0);
619 if(!isOk) {delete hmpTrk;hmpTrk=0x0;continue;}
620 pTrk->SetOuterHmpParam(hmpTrk,AliESDtrack::kHMPIDout);
621
622 FillResiduals(hmpTrk,bestHmpCluster,kFALSE);
623
624 Int_t iRad = pParam->Radiator(yRa); //evaluate the radiator involved
625
626 //evaluate nMean
627 if(tsRight){
628 if(pNmean->GetEntries()==21) { //for backward compatibility
629 nmean=((TF1*)pNmean->At(3*ipCh))->Eval(ts); //C6F14 Nmean for this chamber
630 } else {
631 if(iRad < 0) {
632 nmean = -1;
633 } else {
634 Double_t tLow = ((TF1*)pNmean->At(6*ipCh+2*iRad ))->Eval(ts); //C6F14 low temp for this chamber
635 Double_t tHigh = ((TF1*)pNmean->At(6*ipCh+2*iRad+1))->Eval(ts); //C6F14 high temp for this chamber
636 Double_t tExp = pParam->FindTemp(tLow,tHigh,yRa); //estimated temp for that chamber at that y
637 nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp); //mean ref idx @ a given temp
638 }
639 if(nmean < 0){ //track didn' t pass through the radiator
640 pTrk->SetHMPIDsignal(AliHMPIDRecon::kNoRad); //set the appropriate flag
641 pTrk->SetHMPIDcluIdx(ipCh,index+1000*cluSiz); //set index of cluster
642 delete hmpTrk;hmpTrk=0x0;
643 continue;
644 }
645 }
646 } else nmean = pParam->MeanIdxRad();
647
648 //
649 recon.SetImpPC(xPc,yPc); //store track impact to PC
650 recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(ipCh),index,nmean,xRa,yRa); //search for Cerenkov angle of this track
651
652 if(pTrk->GetHMPIDsignal()<0) {delete hmpTrk;hmpTrk=0x0;continue;}
653
654 AliHMPIDPid pID;
655 Double_t prob[5];
656 pID.FindPid(pTrk,nmean,5,prob);
657 // Printf("Tracker RefIndex = %f, chmaber = %i, prob1 = %f, prob2 = %f, prob3 = %f, prob4 = %f, prob5 = %f", nmean,ipCh,prob[0],prob[1],prob[2],prob[3],prob[4]);
658 pTrk->SetHMPIDpid(prob);
659 delete hmpTrk;hmpTrk=0x0;
660 }//iTrk
661
662 return 0; // error code: 0=no error;
663}//ReconFromKin()
664//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9785d5fb 665Int_t AliHMPIDTracker::ReconHiddenTrk(AliESDEvent *pEsd,TObjArray *pClus,TObjArray *pNmean, TObjArray *pQthre)
611e810d 666{
667// Static method to reconstruct Theta Ckov for all valid tracks of a given event.
afe12692 668// 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 669// Returns: error code, 0 if no errors
9785d5fb 670
671 AliHMPIDReconHTA reconHTA; //instance of reconstruction class, nothing important in ctor
672
673 AliHMPIDParam *pParam = AliHMPIDParam::Instance(); //Instance of AliHMPIDParam
15f675cb 674
675 Bool_t tsRight = kTRUE;
676
3e630437 677 UInt_t tsmin = (UInt_t)((TF1*)pQthre->At(0))->GetXmin(); //
678 UInt_t tsmax = (UInt_t)((TF1*)pQthre->At(0))->GetXmax(); //
679 UInt_t ts = pEsd->GetTimeStamp();
680
681 if(ts<tsmin || ts>tsmax) {
682 AliWarning(Form(" in HMPID time stamp out of range!!! Please check!!! ts = %i",ts));
15f675cb 683 tsRight = kFALSE;
3e630437 684 }
685
9785d5fb 686 for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){ //loop on the ESD tracks in the event
687
688 AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //here it is simulated or just empty track
689 Int_t ipCh;
690 ipCh = pTrk->GetHMPIDcluIdx();ipCh/=1000000;
691 if(ipCh<0) continue;
692
693 TClonesArray *pMipCluLst=(TClonesArray *)pClus->At(ipCh); //get the list of clusters
694 Int_t nMipClusTot = pMipCluLst->GetEntries(); //total number of clusters in the given chamber
695
696 Double_t qMip=-1;
697 Int_t chMip=-1;
ee2f3539 698 Double_t xMip = 0;
699 Double_t yMip = 0;
700 Int_t indMip = 0;
701 Int_t cluMipSiz = 0;
9785d5fb 702
703 for (Int_t iClu=0; iClu<nMipClusTot;iClu++) { //clusters loop
704
705 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pMipCluLst->UncheckedAt(iClu); //get the cluster
706 Double_t qClus = pClu->Q();
707 if(qClus>qMip) {
708 qMip = qClus;
709 chMip = pClu->Ch();
710 xMip = pClu->X();
711 yMip = pClu->Y();
712 indMip = iClu;
713 cluMipSiz = pClu->Size();
714 }
715 }//clus loop
716
717 if(chMip<0) return 1;
718
719 Int_t hvsec;
ee2f3539 720 Double_t qthre=0;
15f675cb 721
9785d5fb 722// evaluate qThre
15f675cb 723 if(tsRight){
9785d5fb 724 if(pQthre->GetEntriesFast()==pParam->kMaxCh+1) { // just for backward compatibility
3e630437 725 qthre=((TF1*)pQthre->At(chMip))->Eval(ts); //
9785d5fb 726 } else { // in the past just 1 qthre
727 hvsec = pParam->InHVSector(yMip); // per chamber
3e630437 728 if(hvsec>=0) qthre=((TF1*)pQthre->At(6*chMip+hvsec))->Eval(ts); //
15f675cb 729 }
730 } else qthre = pParam->QCut();
9785d5fb 731//
732 if(qMip<qthre) {
3e630437 733 pTrk->SetHMPIDmip(xMip,yMip,(Int_t)qMip,0); //store mip info in any case
9785d5fb 734 pTrk->SetHMPIDcluIdx(chMip,indMip+1000*cluMipSiz);
735 pTrk->SetHMPIDsignal(pParam->kMipQdcCut);
736 return 1; //charge compatible with MIP clusters
737 }
738
739 pTrk->SetHMPIDmip(xMip,yMip,(Int_t)qMip,0); //store mip info in any case
740 pTrk->SetHMPIDcluIdx(chMip,indMip+1000*cluMipSiz);
741
742 Double_t yRa = yMip; //just an approx...
743 Double_t nmean;
ddb21a01 744
745 Int_t iRad = pParam->Radiator(yRa); //evaluate the radiator involved
746
9785d5fb 747 //evaluate nMean
15f675cb 748 if(tsRight){
9785d5fb 749 if(pNmean->GetEntries()==21) { //for backward compatibility
3e630437 750 nmean=((TF1*)pNmean->At(3*chMip))->Eval(ts); //C6F14 Nmean for this chamber
9785d5fb 751 } else {
9785d5fb 752 if(iRad < 0) {
753 nmean = -1;
754 } else {
3e630437 755 Double_t tLow = ((TF1*)pNmean->At(6*chMip+2*iRad ))->Eval(ts); //C6F14 low temp for this chamber
756 Double_t tHigh = ((TF1*)pNmean->At(6*chMip+2*iRad+1))->Eval(ts); //C6F14 high temp for this chamber
9785d5fb 757 Double_t tExp = pParam->FindTemp(tLow,tHigh,yRa); //estimated temp for that chamber at that y
758 nmean = pParam->NIdxRad(AliHMPIDParam::Instance()->GetEPhotMean(),tExp); //mean ref idx @ a given temp
759 }
760 if(nmean < 0){ //track didn' t pass through the radiator
761 pTrk->SetHMPIDsignal(AliHMPIDRecon::kNoRad); //set the appropriate flag
762 return 1;
15f675cb 763 }
764 }
765 } else nmean = pParam->MeanIdxRad();
9785d5fb 766 //
ee2f3539 767 if(!reconHTA.CkovHiddenTrk(pTrk,(TClonesArray *)pClus->At(ipCh),indMip,nmean)) { //search for track parameters and Cerenkov angle of this track
768 AliHMPIDPid pID;
769 Double_t prob[5];
b7a2d22d 770 pID.FindPid(pTrk,nmean,5,prob);
ee2f3539 771 pTrk->SetHMPIDpid(prob);
772 }
e56b695f 773// 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 774 }//iTrk
775
776 return 0; // error code: 0=no error;
777
611e810d 778}//Recon()
d3da6dc4 779//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
c1af14f7 780void AliHMPIDTracker::FillClusterArray(TObjArray* array) const {
781
782 // Publishes all pointers to clusters known to the tracker into the
783 // passed object array.
784 // The ownership is not transfered - the caller is not expected to delete
785 // the clusters
786
787 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
788 TClonesArray *pCluArr=(TClonesArray*)(*fClu)[iCh];
789 for (Int_t iClu=0; iClu<pCluArr->GetEntriesFast();iClu++){
790 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluArr->UncheckedAt(iClu);
791 array->AddLast(pClu);
792 }//cluster loop in iCh
793 pCluArr->Delete();
794 }//Ch loop
795
796 return;
797}
798//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++