]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/scripts/multdist/MakeMultiplicityDistributions.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / scripts / multdist / MakeMultiplicityDistributions.C
1 /**
2  * @file 
3  * 
4  * @ingroup pwg2_forward_scripts
5  */
6
7 /** 
8  * Run first pass of the analysis - that is read in ESD and produce AOD
9  * 
10  * @param esddir    ESD input directory. Any file matching the pattern 
11  *                  *AliESDs*.root are added to the chain 
12  * @param nEvents   Number of events to process.  If 0 or less, then 
13  *                  all events are analysed
14  * @param proof     Run in proof mode 
15  * @param mc        Run over MC data
16  *
17  * If PROOF mode is selected, then Terminate will be run on the master node 
18  * in any case. 
19  * 
20  *
21  * @ingroup pwg2_forward_scripts
22  */
23 void MakeMultiplicityDistributions(const char* aoddir=".", 
24                                    Int_t       nEvents=-1, 
25                                    const char* trig="INEL",
26                                    Double_t    vzMin=-10,
27                                    Double_t    vzMax=10,
28                                    Int_t    lowCent= 0,
29                                    Int_t    highCent= 0,
30                                    char*       output="forward_multiplicity.root",         
31                                    Int_t       nBins= 500,
32                                    Int_t       proof=0)
33 {
34   // --- Libraries to load -------------------------------------------
35   gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
36
37   // --- Check for proof mode, and possibly upload pars --------------
38   if (proof> 0) { 
39     gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadPars.C");
40     LoadPars(proof);
41   }
42   
43   // --- Our data chain ----------------------------------------------
44   std::cout << "making chain of files" << std::endl;
45   gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/MakeChain.C");
46   TChain* chain = MakeChain("AOD", aoddir,true);
47   // If 0 or less events is select, choose all 
48   if (nEvents <= 0) nEvents = chain->GetEntries();
49
50   // --- Creating the manager and handlers ---------------------------
51   AliAnalysisManager *mgr  = new AliAnalysisManager("Forward Train", 
52                                                     "Forward Multiplicity");
53
54   if(lowCent>=highCent)
55     AliAnalysisManager::SetCommonFileName(output);
56   else{
57     Char_t* name = Form("%s_cent_%d_%d.root",output,lowCent, highCent);
58     AliAnalysisManager::SetCommonFileName(name);
59   }
60   // --- ESD input handler -------------------------------------------
61   AliAODInputHandler *aodInputHandler = new AliAODInputHandler();
62   mgr->SetInputEventHandler(aodInputHandler);      
63        
64   // --- Add tasks ---------------------------------------------------
65   // Forward 
66   gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/AddTaskMultiplicity.C");
67   AddTaskMultiplicity(trig, vzMin, vzMax, lowCent, highCent, nBins);
68   
69   
70   // --- Run the analysis --------------------------------------------
71   TStopwatch t;
72   if (!mgr->InitAnalysis()) {
73     Error("MakeMult", "Failed to initialize analysis train!");
74     return;
75   }
76   // Skip terminate if we're so requested and not in Proof or full mode
77   mgr->SetSkipTerminate(false);
78   // Some informative output 
79   mgr->PrintStatus();
80   // mgr->SetDebugLevel(3);
81   if (mgr->GetDebugLevel() < 1 && !proof) 
82     mgr->SetUseProgressBar(kTRUE,100);
83
84   // Run the train 
85   t.Start();
86   Printf("=== RUNNING ANALYSIS ==================================");
87   mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents);
88   t.Stop();
89   t.Print();
90 }
91 //
92 // EOF
93 //