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