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 Bool_t multcheck = kTRUE;
39 const char* basedir=".";
41 const char* field = "";
42 cout<<"WriteAOD.C: datatype is "<<datatype<<" dir is basedir"<<endl;
43 // Dynamically link some shared libs
45 cout<<"WriteAOD.C: Loading ANALYSIS .....\n";
46 gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
47 cout<<"WriteAOD.C: ..... Loaded\n";
60 PID[10]=0;//Last must be 0!!!!!!!!!!!!!!!!!!
74 /***********************************************************/
77 Int_t kine = strcmp(datatype,"Kine");
78 Int_t ESD = strcmp(datatype,"ESD");
79 Int_t intern = strcmp(datatype,"AOD");
83 reader = new AliReaderKineTree();
84 processopt="Particles"; //this reader by definition reads only simulated particles
89 AliReaderESD* esdreader = new AliReaderESD();
90 esdreader->ReadSimulatedData(kTRUE);
91 esdreader->SetNumberOfTrackPoints(5,30.);//5 points every 30 cm
92 esdreader->SetITSTrackPoints(kTRUE);
93 esdreader->SetClusterMap(kTRUE);
101 reader = new AliHBTReaderAOD("AOD.root");
106 cerr<<"Option "<<datatype<<" not recognized. Exiting"<<endl;
111 if ( (first >= 0) && (last>=0) && ( (last-first)>=0 ) )
112 {//read from many dirs dirs
113 cout<<"WriteAOD.C: ..... Setting dirs first="<<first<<" last="<<last<<"\n";
115 dirs = new TObjArray(last-first+1);
117 for (Int_t i = first; i<=last; i++)
119 sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
120 TObjString *odir= new TObjString(buff);
125 reader->SetDirs(dirs);
127 AliAODParticleCut* readerpartcut= new AliAODParticleCut();
132 cout<<"WriteAOD.C: Adding PID = "<<PID[l]<<" l = "<<l<<endl;
133 readerpartcut->SetPID(PID[l]);
134 AliAODParticleCut * pcut = (AliAODParticleCut*)readerpartcut->Clone();
135 AliAODPIDCut* pidcut = new AliAODPIDCut(PID[l],PIDprob[l]);
136 pcut->AddBasePartCut(pidcut);
137 reader->AddParticleCut(pcut);//read this particle type with this cut
142 // readerpartcut->SetPtRange(0.0,1.2);
144 cout<<"WriteAOD.C: P R O C S E S S I N G .....\n\n";
145 AliReaderAOD::WriteAOD(reader,outfile,"AliAODParticle",multcheck);
146 cout<<"\n\nWriteAOD.C: F I N I S H E D\n";
148 if (dirs) delete dirs;