]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/macros/makeAnal.C
Adding needed includes
[u/mrichter/AliRoot.git] / PWG2 / FLOW / macros / makeAnal.C
1 /////////////////////////////////////////////////////////////
2 //
3 // $Id$
4 //
5 // Author: Emanuele Simili
6 //
7 /////////////////////////////////////////////////////////////
8 //
9 // Description:  ROOT macro to perform the AliFlowAnalysis 
10 //
11 /////////////////////////////////////////////////////////////
12
13 #include <vector>
14 #include <iostream>
15 #include <fstream>
16 #include "TVector.h"
17 #include "TVector2.h"
18 #include "TVector3.h"
19 #include "TMath.h"
20 #include "TObjArray"
21 #include "TStopwatch.h"
22
23 using namespace std; //required for resolving the 'cout' symbol
24
25 void makeAnal(TString wch = "ESD")
26 {
27  cout << " . Here the newly compiled flow analysis . " << endl ;
28  cout << " . AliFlowEvent(s) --> root histograms  " << endl ;
29  cout << endl ;
30
31  gSystem->Load("libPhysics.so");
32  gSystem->Load("libPWG2.so");
33  gSystem->Load("libPWG2flow.so");
34
35  //char *loadFrom = gSystem->ExpandPathName("$ALICE_ROOT/PWG2/FLOW/AliFlow_Anal.so") ;
36  //cout << " . *** Loading libs from   ' " << loadFrom << " ' ." << endl ;
37  //gSystem->Load(loadFrom);
38  cout << " .                          ...libs  loaded" << endl ;
39
40  int cc = -1 ;            // centrality class
41  TString ver = "h_" ;     // names ... according to the FlowMaker 
42  int selNumber = 0 ;      // ... 
43
44  TStopwatch timer;
45  timer.Start();
46
47  AliFlowSelection* select = new AliFlowSelection() ;
48
49 // Event Cuts
50  select->SetCentralityCut(-1) ;
51  select->SetRunIdCut(-1) ;
52
53 // R.P. calculation cuts
54  for(int j=0;j<Flow::nHars;j++)
55  {
56   select->SetEtaCut(0., 1.1, j, 1) ;
57   select->SetPtCut(0.1, 10. , j, 1);
58  }
59  select->SetConstrainCut(kTRUE) ;
60  select->SetDcaGlobalCut(0.,0.1);
61  //select->SetNhitsCut(3., 1) ;
62  //select->SetPidCut("pi");
63
64 // Correlation analysis cuts
65  select->SetEtaPart(-1.1,1.1);
66  select->SetPtPart(0.1,10.);
67  select->SetConstrainablePart(kTRUE);
68  select->SetDcaGlobalPart(0.,0.1);
69  //select->SetPPart(0.1,10.);
70  //select->SetEtaAbsPart(0.5,1.1);
71  //select->SetPidPart("pi");
72  //select->SetYPart(..,..);
73  //select->SetPidProbPart(0.5,1.);
74  //select->SetFitPtsPart(3, 480);
75  //select->SetFitOverMaxPtsPart(0.1,3.);
76  //select->SetDedxPtsPart(1.,0.);
77  //select->SetChiSqPart(0.,100.);
78
79 // V0 analysis cuts
80  //select->SetV0DcaCross(0.,0.1) ;
81  select->SetV0Mass(0.4875,0.5078) ;     // Mk0 = 0.49765
82  select->SetV0SideBands(0.08) ;
83  //select->SetV0P(0.,10.) ;
84  select->SetV0Pt(0.1,10.) ;
85  select->SetV0Eta(-2.1,2.1) ;
86  //select->SetV0EtaAbs(0.,0.9) ;
87  //select->SetV0Pid("0") ;
88  //select->SetV0Y(0.,10.) ;
89  //select->SetV0Lenght(0.,100.) ;
90  //select->SetV0LenghtOverSigma(0.,5.) ;
91  //select->SetV0ChiSqPart(0.,100.) ;
92
93  cout << " . Selection for R.P. calculation: " << endl ;
94  select->PrintSelectionList() ;
95  cout << " . Selection for correlation analysis: " << endl ;
96  select->PrintList() ;
97  cout << " . Selection for V0 analysis: " << endl ;
98  select->PrintV0List() ;
99
100  AliFlowAnalysisMaker* flow = new AliFlowAnalysisMaker("FlowAnal",*select) ;
101
102 // Input/Output/Wgt files : auto-naming
103  TString inpt = ver ; inpt += wch ; inpt += "flow" ;
104  TString outp = inpt ; outp += "AnalPlot" ;
105  if(selNumber) { outp += selNumber ; }
106  if(cc>=0) { outp += "_" ; outp += cc ; }
107  TString wgt  = "flowPhiWgt." ; wgt += wch ;
108  inpt += ".root" ; outp += ".root" ; wgt += ".root" ;
109
110 // tmporary setting ---
111  inpt = "flowEvtS.root" ;
112  outp = "flowEvtSanalPlot.root" ;
113 // tmporary setting ---
114
115 //OUTput file
116  flow->SetHistFileName(outp.Data());       // __MC/ESDflowAnalPlot.root
117  cout << " . Writing Histograms on  : " << flow->GetHistFileName()   << "  . " << endl ;
118
119 // auto file name
120  flow->SetOneInputFile(kTRUE) ;
121  flow->SetInputFileName(inpt.Data()) ;    // __MC/ESDflow.root
122  cout << " . Reading FlowEvents from  : " << flow->GetInputFileName()  << "  . " << endl ;
123 //INput: one flowEvent file
124  //flow->SetOneInputFile(kTRUE) ;
125  //flow->SetInputFileName("neo_ESDflow.root") ;
126 //INput: more than one file
127 //  //flow->SetInputFileNames("...") ;
128 //  cout << " . Reading FlowEvents from  : " << "  tot files  " << endl ;
129
130 //WGT file
131  flow->SetPhiWgtFileName(wgt.Data());      // flowPhiWgt.MC/ESD.root
132  cout << "# Weights File (if there)  : " << flow->GetPhiWgtFileName() << "  . " << endl ;
133  cout << endl ;
134
135 // Analysis settings
136  flow->SetFlowForV0() ;         // default kTRUE.
137  // flow->SetEtaSub() ;          // default is Disabled - DO NOT USE (kFALSE) AS AN ARGUMENT !!!
138  //flow->SetV1Ep1Ep2() ;        // default kFALSE.
139  flow->SetShuffle() ;           // default kFALSE. shuffles track array
140  //flow->SetRedoWgt();          // default kFALSE. recalculates phiWgt (even if phiWgt file is already there)
141  flow->SetUsePhiWgt() ;         // default kTRUE if phiWgt file is there, kFALSE if not (& phiWgt file is created)
142  //flow->SetUseBayWgt() ;       // default kFALSE. uses bayesian weights in P.id.
143  //flow->SetUsePtWgt();         // default kFALSE. uses pT as a weight for RP determination
144  //flow->SetUseEtaWgt();                // default kFALSE. uses eta as a weight for RP determination
145  flow->SetUseOnePhiWgt() ; // or // flow->SetUseFirstLastPhiWgt() ; // uses 1 or 3 wgt histograms (default is 1)
146  //
147  flow->SetMakeAll() ;           // default kTRUE. this should speed up the execution time
148  flow->SetMaxLabel(1000) ;      // THERE WAS A CRASH WHEN LOOPING OVER MORE FLOWEVENT FILES !!!
149  flow->SetFillLabels(kFALSE) ;   // ... ~A CHANGE WAS MADE IN THE ANALYSIS TO FIX IT (// *temp*)
150  //
151  flow->SetDebugg(1) ;           // more couts
152  //Flow::mDebug = kTRUE ;       // more couts from singleton
153
154 // init (make histograms, start the analysis)
155  Int_t step = 0 ;
156  step += flow->Init() ;
157  if(step<1) { cout << "#! UNEXPECTED TERMINATION !# " << step << endl ; break ; }
158
159 // make (loop)
160  step += flow->Make() ;
161  if(step<2) { cout << "#! UNEXPECTED TERMINATION !# " << step << endl ; break ; }
162  cout << endl;
163  cout << "Particles normalized abundance:" << endl;  // shows the bayesian vector
164  flow->PrintRunBayesian() ; cout << endl;
165
166 // finish (save hists, close files)
167  step += flow->Finish() ;
168  if(step<3) { cout << "#! UNEXPECTED TERMINATION !# " << step << endl ; break ; }
169
170  timer.Stop();
171  cout << endl ;
172  cout << " . " ; timer.Print();
173  cout << " . here it was (analysis) ... " << endl ;  //juice!
174  cout << endl ;
175 }