Reporting message
[u/mrichter/AliRoot.git] / HBTAN / hbtanalysis.C
CommitLineData
0a6dde4c 1void hbtanalysis(Int_t first = -1,Int_t last = -1, char *outfile = "hbtanalysis.root")
2 {
3//HBT Anlysis Macro
4//Anlyzes TPC recontructed tracks and simulated particles that corresponds to them
5//Reads data from diroctories from first to last(including)
6// For examples if first=3 and last=5 it reads from
7// ./3/
8// ./4/
9// ./5/
10//if first or last is negative (or both), it reads from current directory
11//
12//these names I use when analysis is done directly from CASTOR files via RFIO
13// const char* basedir="rfio:/castor/cern.ch/user/s/skowron/";
14// const char* serie="standard";
15// const char* field = "0.4";
16 const char* basedir=".";
17 const char* serie="";
18 const char* field = "";
19
20 // Dynamically link some shared libs
21 gROOT->LoadMacro("loadlibs.C");
22 loadlibs();
23
24 gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libHBTAnalysis");
25
26
27 /***********************************************************/
28 //Create analysis and reader
29 AliHBTAnalysis * analysis = new AliHBTAnalysis();
30
31 AliHBTReader* reader;
32 TObjArray* dirs=0;
33 if ( (first < 0) || (last<0) || ( (last-first)<0 ) )
34 {//read from current directory
35 reader = new AliHBTReaderTPC();
36 }
37 else
38 {//read from many dirs dirs
39 char buff[50];
40 dirs = new TObjArray(last-first+1);
41 for (Int_t i = first; i<=last; i++)
42 {
43 sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
44 TObjString *odir= new TObjString(buff);
45 dirs->Add(odir);
46 }
47 reader = new AliHBTReaderTPC(dirs);
48 }
49
50 /***********************************************************/
51
52 //we want have only low pt pi+ so set a cut to reader
53 AliHBTParticleCut* readerpartcut= new AliHBTParticleCut();
54 readerpartcut->SetPtRange(0.0,3.0);
55 readerpartcut->SetPID(kPiPlus);
56 reader->AddParticleCut(readerpartcut);//read this particle type with this cut
57
58 analysis->SetReader(reader);
59 /************************************************************/
60
61 AliHBTPairCut *paircut = new AliHBTPairCut();
62 paircut->SetQInvRange(0.0,0.15);
63 analysis->SetGlobalPairCut(paircut);
64
65 AliHBTQInvCorrelFctn * qinvcfT= new AliHBTQInvCorrelFctn();
66 AliHBTQInvCorrelFctn * qinvcfP= new AliHBTQInvCorrelFctn();
67
68 analysis->AddTrackFunction(qinvcfT);
69 analysis->AddParticleFunction(qinvcfP);
70
71 analysis->Process();
72
73 qinvcfP->Rename("qinvcfP","Particle (simulated) Qinv CF \\pi^{+} \\pi^{+}");
74 qinvcfT->Rename("qinvcfT","Track (recontructed) Qinv CF \\pi^{+} \\pi^{+}");
75
76 TFile histoOutput(outfile,"recreate");
77 analysis->WriteFunctions();
78 histoOutput.Close();
79
80 delete qinvcfP;
81 delete qinvcfT;
82 delete paircut;
83 delete readerpartcut;
84 if (dirs)
85 {
86 dirs->SetOwner();
87 delete dirs;
88 }
89 delete reader;
90 delete analysis;
91
92 }
93