Corrections for gcc 4.0
[u/mrichter/AliRoot.git] / HBTAN / hbtcorrections.C
CommitLineData
83b33650 1void hbtcorrections(Int_t first = -1,Int_t last = -1)
2{
3
4 const char* basedir=".";
5 const char* serie="";
6 const char* field = "";
7
8 AliHBTReader* reader = new AliHBTReaderInternal("ESD.old.root");
9 TObjArray* dirs=0;
10 if ( (first >= 0) && (last>=0) && ( (last-first)>=0 ) )
11 {//read from many dirs dirs
12 char buff[50];
13 dirs = new TObjArray(last-first+1);
14 for (Int_t i = first; i<=last; i++)
15 {
16 sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
17 TObjString *odir= new TObjString(buff);
18 dirs->Add(odir);
19 }
20 }
21 reader->SetDirs(dirs);
22
23 AliHBTParticleCut* readerpartcut= new AliHBTParticleCut();
24 readerpartcut->SetPtRange(0.0,1.0);
25 readerpartcut->SetPID(kPiPlus);
26 reader->AddParticleCut(readerpartcut);//read this particle type with this cut
27
28 AliHBTAnalysis* analysis = new AliHBTAnalysis();
29 analysis->SetReader(reader);
30 analysis->SetDisplayInfo(100000);
31 AliHBTPairCut *paircut = new AliHBTPairCut();
32 paircut->SetQInvRange(0.0,0.15);
33 analysis->SetGlobalPairCut(paircut);
34
35
36
37 AliHBTCorrectQInvCorrelFctn* correctqinvCF = new AliHBTCorrectQInvCorrelFctn();
38
39 analysis->AddTrackFunction(correctqinvCF);
40
41 TFile* outf = TFile::Open("hbtcorrected.root","recreate");
42 if (outf == 0x0)
43 {
44 cout<<"\n\nERROR: can not open file"<<endl;
45 return;
46 }
47 Int_t iter = 0;
48 TString dirname;
49 TString ietration("Iteration");
50 correctqinvCF->SetInitialValues(0.8,12.0);
51 correctqinvCF->SetRadiusConvergenceTreshold(0.005);
52 correctqinvCF->SetLambdaConvergenceTreshold(0.01);
53 while (1)
54 {
55 iter++;
56 dirname = ietration+iter;
57 TDirectory* dir = outf->mkdir(dirname,"results after "+dirname);
58 outf->Write();
59 if (dir) dir->cd();
60 else
61 {
62 cout<<"\n\nERROR: can not make an directory in file named"<<dirname<<endl;
63 return;
64 }
65
66 analysis->Process("Tracks");
67
68/*****************************************/
69 dir->cd();
70 correctqinvCF->WriteAll();
71/*****************************************/
72 if (correctqinvCF->IsConverged()) break;
73 else
74 {
75 correctqinvCF->SetInitialValues(correctqinvCF->GetFittedLambda(),correctqinvCF->GetFittedRadius());
76 }
77 }
78 outf->cd();
79 analysis->Write();
80 delete outf;
81}