fix getters for row and column number
[u/mrichter/AliRoot.git] / ANALYSIS / WriteAOD.C
CommitLineData
dd2b6810 1#if 0
2 #include "$(ALICE_ROOT)/TPC/alles.h"
3 #include "AliReader.h"
4 #include "AliReaderKineTree.h"
5 #include "AliAODParticleCut.h"
6 #include "AliAOD.h"
7 #include "AliAODPairCut.h"
8 #include "TSystem.h"
9 #include "TObjString.h"
10 #include "TString.h"
11 #include "AliPDG.h"
12#endif
13
14
efdb0cc9 15void WriteAOD(Option_t* datatype, Int_t first = -1,Int_t last = -1,
16 Option_t* processopt="TracksAndParticles",
dd2b6810 17 char *outfile = "AOD.root")
18 {
19//datatype defines type of data to be read
20// Kine - analyzes Kine Tree: simulated particles
21// ESD
22// AOD
23
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
27
28//Reads data from diroctories from first to last(including)
29// For examples if first=3 and last=5 it reads from
30// ./3/
31// ./4/
32// ./5/
33//if first or last is negative (or both), it reads from current directory
34//
35//these names I use when analysis is done directly from CASTOR files via RFIO
36
37 const char* basedir=".";
38 const char* serie="";
39 const char* field = "";
40 cout<<"WriteAOD.C: datatype is "<<datatype<<" dir is basedir"<<endl;
41 // Dynamically link some shared libs
42
43 cout<<"WriteAOD.C: Loading ANALYSIS .....\n";
44 gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
45 cout<<"WriteAOD.C: ..... Loaded\n";
46
47 Bool_t multcheck = kTRUE;
48 /***********************************************************/
49
50 AliReader* reader;
51 Int_t kine = strcmp(datatype,"Kine");
52 Int_t ESD = strcmp(datatype,"ESD");
53 Int_t intern = strcmp(datatype,"AOD");
54
55 if(!kine)
56 {
57 reader = new AliReaderKineTree();
58 processopt="Particles"; //this reader by definition reads only simulated particles
59 multcheck = kFALSE;
60 }
61 else if(!ESD)
62 {
63 AliReaderESD* esdreader = new AliReaderESD();
64 esdreader->ReadSimulatedData(kTRUE);
65 reader = esdreader;
66 multcheck = kTRUE;
67 }
68
69 else if(!intern)
70 {
71 reader = new AliHBTReaderAOD("AOD.root");
72 multcheck = kTRUE;
73 }
74 else
75 {
76 cerr<<"Option "<<datatype<<" not recognized. Exiting"<<endl;
77 return;
78 }
79
80 TObjArray* dirs=0;
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";
84 char buff[50];
85 dirs = new TObjArray(last-first+1);
86 dirs->SetOwner();
87 for (Int_t i = first; i<=last; i++)
88 {
89 sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
90 TObjString *odir= new TObjString(buff);
91 dirs->Add(odir);
92 }
93 }
94
95 reader->SetDirs(dirs);
96
97 AliAODParticleCut* readerpartcut= new AliAODParticleCut();
beb1c41d 98 readerpartcut->SetPtRange(0.4,1.2);
99 readerpartcut->SetPID(kPiPlus);
100 AliAODPIDCut* pidcut = new AliAODPIDCut(kPiPlus,0.5);
dd2b6810 101 readerpartcut->AddBasePartCut(pidcut);
102
103 reader->AddParticleCut(readerpartcut);//read this particle type with this cut
104
105 cout<<"WriteAOD.C: P R O C S E S S I N G .....\n\n";
beb1c41d 106 AliReaderAOD::WriteAOD(reader,outfile,"AliAODParticle",multcheck);
dd2b6810 107 cout<<"\n\nWriteAOD.C: F I N I S H E D\n";
108
109 if (dirs) delete dirs;
110 delete reader;
111 }
112