2 * >> Testing Macro to read FlatESDEvent from output file <<
4 * Primary Authors : Sergey Gorbunov, Jochen Thaeder, Chiara Zampolli
7 * aliroot -b -l -q LoadLibs.C ReadFlatESD.C++
9 **************************************************************************/
11 #if !defined(__CINT__) || defined(__MAKECINT__)
12 #include "AliESDEvent.h"
14 #include "AliESDfriend.h"
18 #include "./AliFlatESDEvent.h"
19 #include "./AliFlatESDTrack.h"
20 #include "./AliFlatTPCCluster.h"
21 #include "./AliFlatExternalTrackParam.h"
22 #include "Riostream.h"
25 void ReadFlatESD(const char* filename="outFlatESD.root") {
27 ifstream is(filename, std::ifstream::binary | std::ifstream::in);
30 int length = is.tellg();
32 char * buffer = new char [length];
34 std::cout << "Reading " << length << " characters... ";
36 is.read (buffer,length);
38 std::cout << "all characters read successfully." << endl;
40 std::cout << "error: only " << is.gcount() << " could be read";
43 // ...buffer contains the entire file...
46 char *endBuff = buffer+length;
48 while( curr < endBuff ){
49 AliFlatESDEvent *flatEsd = reinterpret_cast<AliFlatESDEvent *>(curr);
50 cout<<"Reading event "<<iEvent<<":"<<endl;
51 cout<<"vtx SPD: "<<(Bool_t) flatEsd->GetPrimaryVertexSPD()
52 <<" vtx tracks: "<<(Bool_t) flatEsd->GetPrimaryVertexTracks()
53 <<" ntracks: "<<flatEsd->GetNumberOfTracks()
54 <<" nV0's: "<<flatEsd->GetNumberOfV0s()
56 curr=curr+ flatEsd->GetSize();
63 cout << "File could not be read" << endl;