#if !defined(__CINT__) || defined(__MAKECINT__) #include "TMath.h" #include "TTree.h" #include "TString.h" #include "TH3F.h" #include "TH1S.h" #include "TArrayS.h" #include "TFile.h" #include "TStopwatch.h" #include "iostream.h" #include "AliLog.h" #include "AliESDEvent.h" #include "AliESDCaloCluster.h" #include "AliVCluster.h" #include "AliPHOSGeometry.h" #include "AliESDTrack.h" #endif void Printtrack(const char* file="/home/mhu001/zzh026/phy291/0/AliESDs.root") //void Printtrack(const char* file="/scratch/120822/006/root_archive.zip#AliESDs.root") { TH1F *fhNTrack = new TH1F("fhNTrack","no of tracks",200,0.,100.); TH1F *fhP = new TH1F("hP","ptotal distribution of tracks",200,0.,100.); TH1F *fhPt = new TH1F("hPt","pt distribution of tracks",200,0.,100.); TH1F *fhPhi = new TH1F("hPhi","phi distribution",360, 0, 6.28); TH1F *fhEta = new TH1F("hEta","eta distribution",100, -1, 1); TH1F *fhTPCncls = new TH1F("hTPCncls","number of clusters per track",1000, 0, 200); TH1F *hltNTrack = new TH1F("hltNTrack","no of tracks",200,0.,100.); TH1F *hltP = new TH1F("hltP","ptotal distribution of tracks",200,0.,100.); TH1F *hltPt = new TH1F("hltPt","pt distribution of tracks",200,0.,100.); TH1F *hltPhi = new TH1F("hltPhi","phi distribution",360, 0, 6.28); TH1F *hltEta = new TH1F("hltEta","eta distribution",100, -1, 1); TH1F *hltTPCncls = new TH1F("hltTPCncls","number of clusters per track",1000, 0, 200); char * kInDir = "/home/mhu001/zzh026/phy291/zip"; Int_t kFile = 10; char fileE[120]; for (Int_t ievent = 0 ; ievent < kFile ; ievent++) { sprintf(fileE, "%s/%d/root_archive.zip#AliESDs.root", kInDir,ievent) ; TFile * fESD = TFile::Open(fileE) ; //Check if file exists and add it, if not skip it if (fESD) { char* kTreeName = "esdTree"; char* kInputData = "ESD"; // Get run number TTree* esdTree = (TTree*)fESD->Get("esdTree"); AliESDEvent* event = new AliESDEvent(); event->ReadFromTree(esdTree); esdTree->GetEvent(0); } } if(fESD) fESD->Close(); TFile *f = TFile::Open(file); TTree *hltesdTree = (TTree*)f->Get("HLTesdTree"); if(!hltesdTree) { cerr << "HLT Tree not found!" << endl; return; } //esdTree Float_t xyz[3] = {0,0,0}; for(Int_t iEvent=0; iEventGetEntries(); iEvent++){ esdTree->GetEvent(iEvent); Int_t multClu = event->GetNumberOfCaloClusters(); Int_t nTrack = event->GetNumberOfTracks(); cout<<"Event "<Fill(nTrack); Double_t p[3]; for(Int_t itrack=0;itrackGetTrack(itrack); if(esdtrack->GetConstrainedParam()){ const AliExternalTrackParam* track = esdtrack->GetConstrainedParam(); esdtrack->GetConstrainedPxPyPz(p); Int_t ncls=esdtrack->GetTPCNcls(); } TLorentzVector mom(p[0], p[1], p[2], 0); fhP->Fill(TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2])); fhP->Fill(esdtrack->P()); fhPt->Fill(mom->Pt()); Double_t phi=mom.Phi(); if(phi<0) phi+=2*TMath::Pi(); fhPhi->Fill(phi); fhEta->Fill(mom.Eta()); fhTPCncls->Fill(ncls); }//loop of tracks }//loop of events //hltTree AliESDEvent *hltevent = new AliESDEvent; hltevent->ReadFromTree(hltesdTree); for(Int_t iEvent=0; iEventGetEntries(); iEvent++){ hltesdTree->GetEvent(iEvent); Int_t multClu = event->GetNumberOfCaloClusters(); Int_t nTrack = event->GetNumberOfTracks(); cout<<"Event "<Fill(nTrack); Double_t p[3]; for(Int_t itrack=0;itrackGetTrack(itrack); if(esdtrack->GetConstrainedParam()){ const AliExternalTrackParam* track = esdtrack->GetConstrainedParam(); esdtrack->GetConstrainedPxPyPz(p); Int_t ncls=esdtrack->GetTPCNcls(); } TLorentzVector mom(p[0], p[1], p[2], 0); hltP->Fill(TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2])); hltPt->Fill (esdtrack->P()); hltPt->Fill(mom.Pt()); Double_t phi=mom.Phi(); if(phi<0) phi+=2*TMath::Pi(); hltPhi->Fill(phi); hltEta->Fill(mom.Eta()); hltTPCncls->Fill(ncls); }//loop of tracks }//loop of events TFile *hfile = new TFile("track.root","recreate"); { fhNTrack->Write(); fhP->Write(); fhPt->Write(); fhPhi->Write(); fhEta->Write(); fhTPCncls->Write(); hltPt->Write(); hltPhi->Write(); hltEta->Write(); hltTPCncls->Write(); } hfile->Close(); }