#include #include #include #include void AliESD_parser( std::string outName = "particles.txt", // name of the output text file std::string inpName = "AliESDs.root", // name of the input ALIESD file std::string treeName = "esdTree", // name of the tracks tree std::string pVertexBranchName = "PrimaryVertex.AliVertex.fPosition[3]", // name of the AliVertex position branch std::string tracksBranchName = "Tracks.fP[5]" // name of the tracks branch ) { ///-------> input TChain trackTree(treeName.c_str()); trackTree.AddFile(inpName.c_str()); TBranchElement *pVertexBranch = (TBranchElement*)trackTree.GetBranch(pVertexBranchName.c_str()); std::cout << "trackTree.GetEntries(): " << trackTree.GetEntries() << std::endl; std::cout << "pVertexBranch->GetEntries(): " << pVertexBranch->GetEntries() << std::endl; for (int n = 0; n < pVertexBranch->GetEntries(); n++) { pVertexBranch->GetEntry(n); double vertex[3]; for(int i =0 ; i < 3 ; i++) { vertex[i] = pVertexBranch->GetValue(i, sizeof(double)); } std::cout << "Vertex for Entry " << n << " " << vertex[0] << " " << vertex[1] << " " << vertex[2] << std::endl; } }