1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //Utils for identified fragmentation function (IDFF) analysis
17 //Author: Xianguo Lu (xianguo.lu@cern.ch)
19 #include "AliIDFFUtils.h"
20 #include "AliAODEvent.h"
21 #include "AliAODMCParticle.h"
22 #include "AliESDtrack.h"
24 #include "TClonesArray.h"
26 ClassImp(AliIDFFUtils);
28 AliPIDResponse * AliIDFFUtils::fPid=0x0;
30 Int_t AliIDFFUtils::PDG2Type(const Int_t pdg)
33 //conversion from pdg code to local definition of particle type
36 Int_t itype = kNOTSELECTED;
57 THnSparseD *AliIDFFUtils::GetTHn(const TString name)
63 const Int_t nvar = 10;
64 // 0 1 2 3 4 5 6 7 8 9
65 const TString atitle[nvar]={"TrackEta","JetPt", "TrackTPCsig", "Log10TrackP", "Log10TrackPt", "z", "xi", "pdg", "tof", "hmpid"};
66 const Int_t nbins[nvar] ={ 4, 20, 2400, Nx(), 50, 25, 50, 7, 7, 7};
67 const Double_t xmins[nvar]={ 0, 0, 0, Xmin(), Xmin(), 0, 0, -3.5, -3.5, -3.5};
68 const Double_t xmaxs[nvar]={ 0.9, 100, 200, Xmax(), Xmax(), 1, 6, 3.5, 3.5, 3.5};
70 THnSparseD * hh = new THnSparseD(name,"", nvar, nbins, xmins, xmaxs);
71 for(Int_t ia=0; ia<nvar; ia++){
72 hh->GetAxis(ia)->SetTitle(atitle[ia]);
81 const Double_t etas[]={0, 0.2, 0.4, 0.6, 0.9};
87 Bool_t AliIDFFUtils::HMPIDAcceptance(const AliAODTrack *track)
90 //check HMPID acceptance
94 Double_t tEta = TMath::Abs(track->Eta());
95 Double_t tPhi = track->Phi();
96 if(tPhi < 0.) tPhi += TMath::TwoPi();
97 if(tPhi > TMath::TwoPi()) tPhi -= TMath::TwoPi();
103 if(tPhi < 0.08 || tPhi > 1.12){
110 Bool_t AliIDFFUtils::HMPIDQA(const AliAODTrack *track)
113 //check HMPID PID quality
117 if(track->GetHMPIDsignal() <= 0.){
121 //check track-quality cuts
124 Float_t tX, tY, tTh, tPh;
128 track->GetHMPIDtrk(tX, tY, tTh, tPh);
129 track->GetHMPIDmip(mpX, mpY, mpQ, mpNph);
130 const Double_t dist = TMath::Sqrt((tX-mpX)*(tX-mpX)+(tY-mpY)*(tY-mpY));
132 //taking the pass 2 case for the moment
134 //Printf("Track did not pass the distance cut");
139 //have to check if this also varies with pass
140 //taking the pass 2 case for the moment
142 //Printf("Track did not pass the MipQ cut");
149 Int_t AliIDFFUtils::HMPIDType(const AliAODTrack * track)
152 //return the (locally defined) particle type judged by HMPID
156 if(!HMPIDAcceptance(track))
162 Double_t nsigma[]={-999,-999,-999};
163 nsigma[kPION] = fPid->NumberOfSigmasHMPID( track, AliPID::kPion);
164 nsigma[kKAON] = fPid->NumberOfSigmasHMPID( track, AliPID::kKaon);
165 nsigma[kPROTON] = fPid->NumberOfSigmasHMPID( track, AliPID::kProton);
167 const Double_t inclusion=2;
168 const Double_t exclusion=3;
170 if(TMath::Abs(nsigma[kPION])<inclusion && TMath::Abs(nsigma[kKAON])>exclusion && TMath::Abs(nsigma[kPROTON])>exclusion) return kPION;
171 if(TMath::Abs(nsigma[kPION])>exclusion && TMath::Abs(nsigma[kKAON])<inclusion && TMath::Abs(nsigma[kPROTON])>exclusion) return kKAON;
172 if(TMath::Abs(nsigma[kPION])>exclusion && TMath::Abs(nsigma[kKAON])>exclusion && TMath::Abs(nsigma[kPROTON])<inclusion) return kPROTON;
177 Int_t AliIDFFUtils::TOFType(const AliAODTrack * trackptr, const Int_t tofmode)
180 //return the (locally defined) particle type judged by TOF
183 //check kTOFout, kTIME, mismatch
184 const AliPIDResponse::EDetPidStatus tofstatus = fPid->CheckPIDStatus(AliPIDResponse::kTOF, trackptr);
185 if(tofstatus != AliPIDResponse::kDetPidOk)
188 Double_t nsigma[]={-999,-999,-999};
189 nsigma[kPION] = fPid->NumberOfSigmasTOF( trackptr, AliPID::kPion);
190 nsigma[kKAON] = fPid->NumberOfSigmasTOF( trackptr, AliPID::kKaon);
191 nsigma[kPROTON] = fPid->NumberOfSigmasTOF( trackptr, AliPID::kProton);
193 Double_t inclusion=-999;
194 Double_t exclusion=-999;
208 printf("AliIDFFUtils::TOFType bad tofmode ! %d\n", tofmode); exit(1);
211 if(TMath::Abs(nsigma[kPION])<inclusion && TMath::Abs(nsigma[kKAON])>exclusion && TMath::Abs(nsigma[kPROTON])>exclusion) return kPION;
212 if(TMath::Abs(nsigma[kPION])>exclusion && TMath::Abs(nsigma[kKAON])<inclusion && TMath::Abs(nsigma[kPROTON])>exclusion) return kKAON;
213 if(TMath::Abs(nsigma[kPION])>exclusion && TMath::Abs(nsigma[kKAON])>exclusion && TMath::Abs(nsigma[kPROTON])<inclusion) return kPROTON;
219 void AliIDFFUtils::FillTHn(THnSparseD * hh, Double_t jetpt, const AliAODTrack * track, AliAODEvent *aodevent, const Int_t tofmode) //AliMCEvent * mcevent)
225 Int_t mcpdg = kNOINFO;
227 TClonesArray *tca = dynamic_cast<TClonesArray*>(aodevent->FindListObject(AliAODMCParticle::StdBranchName()));
229 const Int_t mclabel = TMath::Abs(track->GetLabel());
231 AliAODMCParticle* gentrack = dynamic_cast<AliAODMCParticle*> (tca->At(mclabel));
233 //printf("null gentrack in AliIDFFUtils::FillTHn mclabel %d\n", mclabel);
234 mcpdg = PDG2Type(TMath::Abs(gentrack->GetPdgCode()));
238 //===========================================================================================================
240 const Int_t ktof = TOFType(track, tofmode);
241 const Int_t khmpid = HMPIDType(track);
243 //===========================================================================================================
245 const Double_t eps = 1e-6;
246 const Double_t tracketa = TMath::Abs(track->Eta());
247 Double_t tracktpc = track->GetTPCsignal();
249 tracktpc = 200 - eps;
250 const Double_t tracklogmom = TMath::Log10(track->P());
251 const Double_t tracklogpt = TMath::Log10(track->Pt());
256 jetpt = zz = xi = eps;
259 else if(track->Pt()>(1-eps)*jetpt && track->Pt()<(1+eps)*jetpt){ // case z=1 : move entry to last histo bin <1
264 zz = track->Pt()/jetpt;
265 xi = TMath::Log(1/zz);
268 //===========================================================================================================
270 const Double_t vars[]={tracketa, jetpt, tracktpc, tracklogmom, tracklogpt, zz, xi, Double_t(mcpdg), Double_t(ktof), Double_t(khmpid)};
275 //_________________________________________________________________________________
276 Bool_t AliIDFFUtils::TPCCutPIDN(const AliAODTrack * track)
282 //assuming this cut is particle type independent, then it is fine
283 //need further investigation
284 if(track->GetTPCsignalN()<60){
291 //_________________________________________________________________________________
292 Bool_t AliIDFFUtils::TPCCutMIGeo(const AliAODTrack * track, const AliVEvent* evt, TTreeStream * streamer)
298 Short_t sign = track->Charge();
304 track->GetPxPyPz(pxpypz);
306 AliExternalTrackParam * par = new AliExternalTrackParam(xyz, pxpypz, cv, sign);
309 Double_t varGeom = dummy.GetLengthInActiveZone(par,3,236, evt->GetMagneticField(), 0,0);
310 Double_t varNcr = track->GetTPCClusterInfo(3,1);
311 Double_t varNcls = track->GetTPCsignalN();
313 Bool_t cutGeom = varGeom > 1.*(130-5*TMath::Abs(1./track->Pt()));
314 Bool_t cutNcr = varNcr > 0.85*(130-5*TMath::Abs(1./track->Pt()));
315 Bool_t cutNcls = varNcls > 0.7*(130-5*TMath::Abs(1./track->Pt()));
317 Bool_t kout = cutGeom && cutNcr && cutNcls;
320 Double_t dedx = track->GetTPCsignal();
322 (*streamer)<<"tree"<<
325 "varGeom="<<varGeom<<
327 "varNcls="<<varNcls<<
329 "cutGeom="<<cutGeom<<
331 "cutNcls="<<cutNcls<<