11 if (!inkin->IsOpen()) {
12 cerr<<
"Can't open galice.root !\n";
14 gAlice = (AliRun*)inkin->Get(
"gAlice");
15 cout<<
"AliRun object found on file "<<
gAlice<<endl;
16 cout<<
"!!!! field ="<<
gAlice->Field()->SolenoidField()<<endl;
17 AliKalmanTrack::SetFieldMap(
gAlice->Field());
19 cout<<
" Convconst="<<AliKalmanTrack::GetConvConst()<<endl;
21 AliTPCtrack *iotrack=0;
23 if (!tf->IsOpen()) {cerr<<
"Can't open AliTPCtracks.root !\n";
return 3;}
28 TFile fpid(
"AliTPCtracksPid.root",
"recreate");
31 for(
int je=0;je<emax;je++){
32 char tname[100]; sprintf(tname,
"TreeT_TPC_%d",je);
33 TTree *tracktree=(TTree*)tf->Get(tname);
34 if (!tracktree) {cerr<<
"Can't get a tree with TPC tracks !\n";
return 4;}
36 TBranch *tbranch=tracktree->GetBranch(
"tracks");
37 nentr=(Int_t)tracktree->GetEntries();
38 cout<<nentr<<
" "<<
" tracks in track tree "<<tname<<
"."<<endl;
40 char tpname[100]; sprintf(tpname,
"TreeT%d",je);
41 TTree *ptree =
new TTree(tpname,
"Tree with PID");
42 ptree->Branch(
"pids",
"AliTPCtrackPid",&outpid,32000,1);
44 for (i=0; i<nentr; i++) {
45 iotrack=
new AliTPCtrack;
46 tbranch->SetAddress(&iotrack);
47 tracktree->GetEvent(i);
48 Double_t par[5],xx;xx=85.1951;
49 iotrack->PropagateTo(xx);
50 iotrack->GetExternalParameters(xx,par);
52 Float_t phi=TMath::ASin(par[2]) + iotrack->GetAlpha();
53 if (phi<-TMath::Pi()) phi+=2*TMath::Pi();
54 if (phi>=TMath::Pi()) phi-=2*TMath::Pi();
55 Float_t lam=TMath::ATan(par[3]);
56 Float_t pt_1=TMath::Abs(par[4]);
59 Float_t mom=1./(pt_1*TMath::Cos(lam));
60 Float_t dedx=iotrack->GetdEdx();
61 Int_t pcode=pid.
GetPcode(dedx/50.,mom);
70 pidtmp.
fLabel=TMath::Abs(iotrack->GetLabel());
71 cout<<
"tlab,dedx,mom,pcode="<<pidtmp.
fLabel<<
" "<<dedx<<
" "<<mom<<
" "<<pcode<<endl;
75 cout<<
"Event "<<je+1<<
" ok."<<endl;
80 cout<<
"File AliTPCtracksPid.root written"<<endl;
TFile * Open(const char *filename, Long64_t &nevents)
Class to determine the particle ID for TPC tracks.
Int_t fPcode
Particle code.
Int_t GetPcode(TClonesArray *, Float_t) const
Int_t fLabel
Particle Label.
Int_t AliTPCSavePID(Int_t emax=3)
Float_t fWp
Particle momentum.