2 #include "$(ALICE_ROOT)/TPC/alles.h"
4 #include "AliReaderKineTree.h"
5 #include "AliReaderESDTree.h"
6 #include "AliAODParticleCut.h"
8 #include "AliAODPairCut.h"
10 #include "TObjString.h"
16 void WriteAOD(Option_t* datatype, Int_t first = -1,Int_t last = -1,
17 Option_t* processopt="TracksAndParticles",
18 char *outfile = "AOD.root")
20 //datatype defines type of data to be read
21 // Kine - analyzes Kine Tree: simulated particles
25 // default: TracksAndParticles - process both recontructed tracks and sim. particles corresponding to them
26 // Tracks - process only recontructed tracks
27 // Particles - process only simulated particles
29 //Reads data from diroctories from first to last(including)
30 // For examples if first=3 and last=5 it reads from
34 //if first or last is negative (or both), it reads from current directory
36 //these names I use when analysis is done directly from CASTOR files via RFIO
38 Bool_t multcheck = kTRUE;
40 const char* basedir=".";
42 const char* field = "";
43 cout<<"WriteAOD.C: datatype is "<<datatype<<" dir is basedir"<<endl;
44 // Dynamically link some shared libs
46 cout<<"WriteAOD.C: Loading ANALYSIS .....\n";
47 gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
48 cout<<"WriteAOD.C: ..... Loaded\n";
62 PID[10]=0;//Last must be 0!!!!!!!!!!!!!!!!!!
76 /***********************************************************/
79 Int_t kine = strcmp(datatype,"Kine");
80 Int_t ESD = strcmp(datatype,"ESD");
81 Int_t ESDMuon = strcmp(datatype,"ESDMuon");
82 Int_t intern = strcmp(datatype,"AOD");
86 reader = new AliReaderKineTree();
87 processopt="Particles"; //this reader by definition reads only simulated particles
92 AliReaderESD* esdreader = new AliReaderESD();
93 esdreader->ReadSimulatedData(kTRUE);
94 esdreader->SetNumberOfTrackPoints(5,30.);//5 points every 30 cm
95 esdreader->SetITSTrackPoints(kTRUE);
96 esdreader->SetClusterMap(kTRUE);
104 AliReaderAOD* aodreader = new AliReaderAOD("AOD.root");
105 if (strstr(processopt,"Particles"))
106 aodreader->ReadSimulatedData(kTRUE);
108 aodreader->ReadSimulatedData(kFALSE);
117 // set reader for ESD
118 AliReaderESDTree* muonreader = new AliReaderESDTree("AliESDs.root");
119 // active muon ESD reader
120 muonreader->SetReadMuon(kTRUE);
121 // disable central barrel (default = kTRUE)
122 muonreader->SetReadCentralBarrel(kFALSE);
123 // disable simulated data (not implemented yet)
124 muonreader->ReadSimulatedData(kFALSE);
131 cerr<<"Option "<<datatype<<" not recognized. Exiting"<<endl;
136 if ( (first >= 0) && (last>=0) && ( (last-first)>=0 ) )
137 {//read from many dirs dirs
138 cout<<"WriteAOD.C: ..... Setting dirs first="<<first<<" last="<<last<<"\n";
140 dirs = new TObjArray(last-first+1);
142 for (Int_t i = first; i<=last; i++)
144 sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
145 TObjString *odir= new TObjString(buff);
150 reader->SetDirs(dirs);
152 AliAODParticleCut* readerpartcut= new AliAODParticleCut();
157 cout<<"WriteAOD.C: Adding PID = "<<PID[l]<<" l = "<<l<<endl;
158 readerpartcut->SetPID(PID[l]);
159 AliAODParticleCut * pcut = (AliAODParticleCut*)readerpartcut->Clone();
160 AliAODPIDCut* pidcut = new AliAODPIDCut(PID[l],PIDprob[l]);
161 pcut->AddBasePartCut(pidcut);
162 reader->AddParticleCut(pcut);//read this particle type with this cut
167 // readerpartcut->SetPtRange(0.0,1.2);
169 cout<<"WriteAOD.C: P R O C S E S S I N G .....\n\n";
170 AliReaderAOD::WriteAOD(reader,outfile,"AliAODParticle",multcheck);
171 cout<<"\n\nWriteAOD.C: F I N I S H E D\n";
173 if (dirs) delete dirs;