]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/WriteAOD.C
Bug corrections
[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
d9122a01 37 Bool_t multcheck = kTRUE;
38
dd2b6810 39 const char* basedir=".";
40 const char* serie="";
41 const char* field = "";
42 cout<<"WriteAOD.C: datatype is "<<datatype<<" dir is basedir"<<endl;
43 // Dynamically link some shared libs
44
45 cout<<"WriteAOD.C: Loading ANALYSIS .....\n";
46 gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
47 cout<<"WriteAOD.C: ..... Loaded\n";
48
d9122a01 49 Int_t PID[11];
50 PID[0]=kProton;
51 PID[1]=kProtonBar;
52 PID[2]=kKPlus;
53 PID[3]=kKMinus;
54 PID[4]=kPiPlus;
55 PID[5]=kPiMinus;
56 PID[6]=kElectron;
57 PID[7]=kPositron;
58 PID[8]=kMuonMinus;
59 PID[9]=kMuonPlus;
60 PID[10]=0;//Last must be 0!!!!!!!!!!!!!!!!!!
61
62 Float_t PIDprob[11];
63 PIDprob[0] = 0.5;
64 PIDprob[1] = 0.5;
65 PIDprob[2] = 0.5;
66 PIDprob[3] = 0.5;
67 PIDprob[4] = 0.5;
68 PIDprob[5] = 0.5;
69 PIDprob[6] = 0.5;
70 PIDprob[7] = 0.5;
71 PIDprob[8] = 0.5;
72 PIDprob[9] = 0.5;
73 PIDprob[10] = 0.5;
dd2b6810 74 /***********************************************************/
75
76 AliReader* reader;
77 Int_t kine = strcmp(datatype,"Kine");
78 Int_t ESD = strcmp(datatype,"ESD");
79 Int_t intern = strcmp(datatype,"AOD");
80
81 if(!kine)
82 {
83 reader = new AliReaderKineTree();
84 processopt="Particles"; //this reader by definition reads only simulated particles
85 multcheck = kFALSE;
86 }
87 else if(!ESD)
88 {
89 AliReaderESD* esdreader = new AliReaderESD();
90 esdreader->ReadSimulatedData(kTRUE);
d9122a01 91 esdreader->SetNumberOfTrackPoints(5,30.);//5 points every 30 cm
92 esdreader->SetITSTrackPoints(kTRUE);
93 esdreader->SetClusterMap(kTRUE);
94
dd2b6810 95 reader = esdreader;
96 multcheck = kTRUE;
97 }
98
99 else if(!intern)
100 {
101 reader = new AliHBTReaderAOD("AOD.root");
102 multcheck = kTRUE;
103 }
104 else
105 {
106 cerr<<"Option "<<datatype<<" not recognized. Exiting"<<endl;
107 return;
108 }
109
110 TObjArray* dirs=0;
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";
114 char buff[50];
115 dirs = new TObjArray(last-first+1);
116 dirs->SetOwner();
117 for (Int_t i = first; i<=last; i++)
118 {
119 sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
120 TObjString *odir= new TObjString(buff);
121 dirs->Add(odir);
122 }
123 }
124
125 reader->SetDirs(dirs);
d9122a01 126
127 AliAODParticleCut* readerpartcut= new AliAODParticleCut();
128
129 Int_t l = 0;
130 while (PID[l] != 0)
131 {
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
138 delete pcut;
139 l++;
140 }
141
142// readerpartcut->SetPtRange(0.0,1.2);
dd2b6810 143
144 cout<<"WriteAOD.C: P R O C S E S S I N G .....\n\n";
beb1c41d 145 AliReaderAOD::WriteAOD(reader,outfile,"AliAODParticle",multcheck);
dd2b6810 146 cout<<"\n\nWriteAOD.C: F I N I S H E D\n";
147
148 if (dirs) delete dirs;
149 delete reader;
150 }
151