AliAOD and AODParticle (T.Kuhr) - Readers, AODStdParticle and Cuts (P.Skowronski...
[u/mrichter/AliRoot.git] / ANALYSIS / analysis.C
CommitLineData
a5556ea5 1void analysis(Int_t first = -1, Int_t last = -1, const char* directory=".")
2{
3
4 gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
5
6 AliAODParticle::SetDebug(0);
7 AliRunAnalysis* analysis = new AliRunAnalysis();
8
9 ::Info("analysis.C","Setting dirs");
10 TObjArray* dirs=0;
11 if ( ((first >= 0) && (last >= 0) ) && ( (last-first)>=0 ) )
12 {//read from many dirs dirs
13 char buff[50];
14 dirs = new TObjArray(last-first+1);
15 for (Int_t i = first; i<=last; i++)
16 {
17// sprintf(buff,"%s/%s/%s/%05.5d",basedir,field,serie,i);
18 printf("%s/%d\n",directory,i);
19 sprintf(buff,"%s/%d",directory,i);
20 TObjString *odir= new TObjString(buff);
21 dirs->Add(odir);
22 }
23 }
24
25 AliReaderESD* reader = new AliReaderESD(dirs);
26 reader->ReadSimulatedData(kTRUE);
27 reader->SetReadMostProbableOnly(kTRUE);
28
29/*
30 //example PID cuts
31 AliAODParticleCut* partcut = new AliAODParticleCut();
32 partcut->SetPID(kPiPlus);//here we define the incarnation
33 AliAODPIDCut* pidcut = new AliAODPIDCut(kPiPlus,0.5);//accept all particles types that have PID prob > 50%
34 partcut->AddBasePartCut(pidcut);//
35 reader->AddParticleCut(partcut);//This guy makes a copy of a cut for himself so we can modify it here
36
37 partcut->SetPID(kPiMinus);//here we define that particle has incarnation PiMinus
38 pidcut->SetPID(kPiMinus);//here we define to check if PID probability of being kPiMinus is greater thann 0.5 (number defined few lines above)
39 reader->AddParticleCut(partcut);
40
41 pidcut->SetPID(kKPlus);
42 pidcut->SetPID(kKPlus);
43 reader->AddParticleCut(partcut);
44
45 pidcut->SetPID(kKMinus);
46 pidcut->SetPID(kKMinus);
47 reader->AddParticleCut(partcut);
48*/
49
50 AliFlowAnalysis* flow = new AliFlowAnalysis();
51 analysis->SetReader(reader);
52
53 analysis->Add(flow);
54 analysis->Run();
55 delete analysis;
56}