1 #include "TStopwatch.h"
6 int runFlowOnTheFlyExample(Int_t nEvts=2000, Int_t mult=1000, Float_t v2=0.05, Int_t iseed=7669)
11 // Load the needed libraries for root (in AliRoot already loaded)
12 gSystem->Load("libGeom");
13 gSystem->Load("libVMC");
14 gSystem->Load("libXMLIO");
15 gSystem->Load("libPhysics");
16 gSystem->Load("libPWGflowBase");
18 fMyTRandom3 = new TRandom3(iseed);
19 gRandom->SetSeed(fMyTRandom3->Integer(65539));
21 // Initialize the flow methods for default analysis:
22 AliFlowAnalysisWithMCEventPlane *mcep = new AliFlowAnalysisWithMCEventPlane();
23 //mcep->SetHarmonic(2); // default is v2
26 AliFlowAnalysisWithQCumulants* qc = new AliFlowAnalysisWithQCumulants();
27 // qc->SetHarmonic(2); // default is v2
31 // set cuts for the Reference Particles and Particles Of Interest:
32 AliFlowTrackSimpleCuts *cutsRP = new AliFlowTrackSimpleCuts();
33 // cutsRP->SetPtMax(ptMaxRP);
34 AliFlowTrackSimpleCuts *cutsPOI = new AliFlowTrackSimpleCuts();
35 cutsPOI->SetPtMin(0.2);
36 cutsPOI->SetPtMax(2.0);
38 Printf("starting the main event loop..");
39 // create and analyze events 'on the fly':
40 for(Int_t i=0; i<nEvts; i++)
42 // creating the event with above settings:
43 AliFlowEventSimple* event = new AliFlowEventSimple(mult,AliFlowEventSimple::kGenerate);
45 //event->TagTracks(cutsRP, cutsPOI);
46 event->TagPOI(cutsPOI);
50 // do flow analysis for various methods:
53 cout <<"Event: " << i+1 << "\r"; cout.flush();
55 } // end of for(Int_t i=0;i<nEvts;i++)
58 // calculate the final results
62 // open a new file which will hold the final results of all methods:
63 TString outputFileName = "AnalysisResults.root";
64 TFile *outputFile = new TFile(outputFileName.Data(),"RECREATE");
65 const Int_t nMethods = 2;
66 TString method[nMethods] = {"MCEP","QC"};
67 TDirectoryFile *dirFileFinal[nMethods] = {NULL};
68 TString fileName[nMethods];
69 for(Int_t i=0; i<nMethods; i++)
71 // form a file name for each method:
72 fileName[i]+="output";
73 fileName[i]+=method[i].Data();
74 fileName[i]+="analysis";
75 dirFileFinal[i] = new TDirectoryFile(fileName[i].Data(),fileName[i].Data());
78 // store the final results
79 mcep->WriteHistograms(dirFileFinal[0]);
80 qc->WriteHistograms(dirFileFinal[1]);
85 cout<<endl; cout<<" ---- Fini ---- "<<endl; cout<<endl;
87 timer.Stop(); timer.Print();