2 #include "$(ALICE_ROOT)/TPC/alles.h"
4 #include "AliReaderKineTree.h"
5 #include "AliAODParticleCut.h"
7 #include "AliAODPairCut.h"
9 #include "TObjString.h"
15 void WriteAOD(Option_t* datatype, Int_t first = -1,Int_t last = -1,
16 Option_t* processopt="TracksAndParticles",
17 char *outfile = "AOD.root")
19 //datatype defines type of data to be read
20 // Kine - analyzes Kine Tree: simulated particles
24 // default: TracksAndParticles - process both recontructed tracks and sim. particles corresponding to them
25 // Tracks - process only recontructed tracks
26 // Particles - process only simulated particles
28 //Reads data from diroctories from first to last(including)
29 // For examples if first=3 and last=5 it reads from
33 //if first or last is negative (or both), it reads from current directory
35 //these names I use when analysis is done directly from CASTOR files via RFIO
37 const char* basedir=".";
39 const char* field = "";
40 cout<<"WriteAOD.C: datatype is "<<datatype<<" dir is basedir"<<endl;
41 // Dynamically link some shared libs
43 cout<<"WriteAOD.C: Loading ANALYSIS .....\n";
44 gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
45 cout<<"WriteAOD.C: ..... Loaded\n";
47 Bool_t multcheck = kTRUE;
48 /***********************************************************/
51 Int_t kine = strcmp(datatype,"Kine");
52 Int_t ESD = strcmp(datatype,"ESD");
53 Int_t intern = strcmp(datatype,"AOD");
57 reader = new AliReaderKineTree();
58 processopt="Particles"; //this reader by definition reads only simulated particles
63 AliReaderESD* esdreader = new AliReaderESD();
64 esdreader->ReadSimulatedData(kTRUE);
71 reader = new AliHBTReaderAOD("AOD.root");
76 cerr<<"Option "<<datatype<<" not recognized. Exiting"<<endl;
81 if ( (first >= 0) && (last>=0) && ( (last-first)>=0 ) )
82 {//read from many dirs dirs
83 cout<<"WriteAOD.C: ..... Setting dirs first="<<first<<" last="<<last<<"\n";
85 dirs = new TObjArray(last-first+1);
87 for (Int_t i = first; i<=last; i++)
89 sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
90 TObjString *odir= new TObjString(buff);
95 reader->SetDirs(dirs);
97 AliAODParticleCut* readerpartcut= new AliAODParticleCut();
98 readerpartcut->SetPtRange(0.4,1.2);
99 readerpartcut->SetPID(kPiPlus);
100 AliAODPIDCut* pidcut = new AliAODPIDCut(kPiPlus,0.5);
101 readerpartcut->AddBasePartCut(pidcut);
103 reader->AddParticleCut(readerpartcut);//read this particle type with this cut
105 cout<<"WriteAOD.C: P R O C S E S S I N G .....\n\n";
106 AliReaderAOD::WriteAOD(reader,outfile,"AliAODParticle",multcheck);
107 cout<<"\n\nWriteAOD.C: F I N I S H E D\n";
109 if (dirs) delete dirs;