]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/MakeAOD.C
Added central dN/deta task based on tracks
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / MakeAOD.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 MakeAOD(const char* esddir, 
24              Int_t       nEvents=-1, 
25              Int_t       proof=0,
26              Bool_t      mc=false)
27 {
28   // --- Libraries to load -------------------------------------------
29   gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
30
31   // --- Check for proof mode, and possibly upload pars --------------
32   if (proof> 0) { 
33     gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
34     LoadPars(proof);
35   }
36   
37   // --- Our data chain ----------------------------------------------
38   gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeESDChain.C");
39   TChain* chain = MakeESDChain(esddir,true);
40   // If 0 or less events is select, choose all 
41   if (nEvents <= 0) nEvents = chain->GetEntries();
42
43   // --- Creating the manager and handlers ---------------------------
44   AliAnalysisManager *mgr  = new AliAnalysisManager("Analysis Train", 
45                                                     "FMD analysis train");
46
47   // --- ESD input handler -------------------------------------------
48   AliESDInputHandler *esdHandler = new AliESDInputHandler();
49   esdHandler->SetInactiveBranches(// "AliESDRun " 
50                                   // "AliESDHeader "
51                                   // "AliESDZDC "
52                                   // "AliESDFMD "
53                                   // "AliESDVZERO " 
54                                   "AliESDTZERO " 
55                                   "TPCVertex " 
56                                   // "SPDVertex "
57                                   // "PrimaryVertex "
58                                   // "AliMultiplicity "
59                                   "PHOSTrigger "
60                                   "EMCALTrigger "
61                                   "SPDPileupVertices " 
62                                   "TrkPileupVertices " 
63                                   // "Tracks "
64                                   "MuonTracks " 
65                                   "PmdTracks "
66                                   "TrdTracks "
67                                   "V0s " 
68                                   "Cascades " 
69                                   "Kinks " 
70                                   "CaloClusters "
71                                   "EMCALLCells "
72                                   "PHOSCells "
73                                   "AliRawDataErrorLogs "
74                                   "ALIESDCACORDE " 
75                                   "HLTGlobalTrigger");
76   mgr->SetInputEventHandler(esdHandler);      
77        
78   // --- Monte Carlo handler -----------------------------------------
79   if (mc) {
80     AliMCEventHandler* mcHandler = new AliMCEventHandler();
81     mgr->SetMCtruthEventHandler(mcHandler);
82     mcHandler->SetReadTR(true);    
83   }
84
85   // --- AOD output handler ------------------------------------------
86   AliAODHandler* aodHandler   = new AliAODHandler();
87   mgr->SetOutputEventHandler(aodHandler);
88   aodHandler->SetOutputFileName("AliAODs.root");
89
90   // --- Add tasks ---------------------------------------------------
91   // Physics selection 
92   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
93   AddTaskPhysicsSelection(mc, kTRUE, kTRUE);
94
95 #if 1
96   // Centrality 
97   gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/Compile.C");
98   // gDebug = 10;
99   Compile("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskCopyHeader.C","+");
100   // gDebug = 10;
101   Compile("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/AliESDCentrality.C","+g");
102   // gDebug = 0;
103   AddTaskCopyHeader();
104
105
106   // Central multiplicity
107   Compile("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskCentralMult.C","+");
108   AddTaskCentralMult();
109 #endif
110
111   // FMD 
112   gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskFMD.C");
113   AddTaskFMD(mc);
114
115   
116   // --- Run the analysis --------------------------------------------
117   TStopwatch t;
118   if (!mgr->InitAnalysis()) {
119     Error("MakeAOD", "Failed to initialize analysis train!");
120     return;
121   }
122   // Skip terminate if we're so requested and not in Proof or full mode
123   mgr->SetSkipTerminate(false);
124   // Some informative output 
125   mgr->PrintStatus();
126   // mgr->SetDebugLevel(3);
127   if (mgr->GetDebugLevel() < 1 && !proof) 
128     mgr->SetUseProgressBar(kTRUE);
129
130   // Run the train 
131   t.Start();
132   Printf("=== RUNNING ANALYSIS ==================================");
133   mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents);
134   t.Stop();
135   t.Print();
136 }
137 //
138 // EOF
139 //