]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/trains/MakeQATrain.C
Added first go at a QA task
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / trains / MakeQATrain.C
CommitLineData
96624385 1#include "TrainSetup.C"
2
3//====================================================================
4/**
5 * Analysis train to do energy loss fits
6 *
7 * @ingroup pwg2_forward_trains
8 */
9class MakeQATrain : public TrainSetup
10{
11public:
12 /**
13 * Constructor. Date and time must be specified when running this
14 * in Termiante mode on Grid
15 *
16 * @param name Name of train
17 * @param useCent Whether to use centrality or not
18 * @param dateTime Append date and time to name
19 * @param year Year
20 * @param month Month
21 * @param day Day
22 * @param hour Hour
23 * @param min Minutes
24 */
25 MakeQATrain(const char* name = "Forward QA",
26 Bool_t useCent = false,
27 Bool_t dateTime = false,
28 UShort_t year = 0,
29 UShort_t month = 0,
30 UShort_t day = 0,
31 UShort_t hour = 0,
32 UShort_t min = 0)
33 : TrainSetup(name, dateTime, year, month, day, hour, min),
34 fUseCent(useCent)
35 {}
36 //__________________________________________________________________
37 /**
38 * Run this analysis
39 *
40 * @param mode Mode
41 * @param oper Operation
42 * @param nEvents Number of events (negative means all)
43 * @param mc If true, assume simulated events
44 * @param par IF true, use par files
45 */
46 void Run(const char* mode, const char* oper,
47 Int_t nEvents=-1, Bool_t mc=false, Bool_t par=false)
48 {
49 Exec("ESD", mode, oper, nEvents, mc, par);
50 }
51 //__________________________________________________________________
52 /**
53 * Run this analysis
54 *
55 * @param mode Mode
56 * @param oper Operation
57 * @param nEvents Number of events (negative means all)
58 * @param mc If true, assume simulated events
59 * @param par IF true, use par files
60 */
61 void Run(EMode mode, EOper oper, Int_t nEvents=-1, Bool_t mc=false,
62 Bool_t par=false)
63 {
64 Exec(kESD, mode, oper, nEvents, mc, par);
65 }
66protected:
67 //__________________________________________________________________
68 /**
69 * Create the tasks
70 *
71 * @param mode Processing mode
72 * @param par Whether to use par files
73 * @param mgr Analysis manager
74 */
75 void CreateTasks(EMode mode, Bool_t par, AliAnalysisManager* mgr)
76 {
77 // --- Output file name ------------------------------------------
78 AliAnalysisManager::SetCommonFileName("forward_eloss.root");
79
80 // --- Load libraries/pars ---------------------------------------
81 LoadLibrary("PWG2forward2", mode, par, true);
82
83 // --- Set load path ---------------------------------------------
84 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2",
85 gROOT->GetMacroPath()));
86
87 // --- Check if this is MC ---------------------------------------
88 Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
89
90 // --- Add the task ----------------------------------------------
91 gROOT->Macro(Form("AddTaskForwardQA.C(%d,%d)", mc, fUseCent));
92 }
93 /**
94 * Create entrality selection if enabled
95 *
96 * @param mc Whether this is MC or not
97 * @param mgr Analysis manager
98 */
99 virtual void CreateCentralitySelection(Bool_t mc, AliAnalysisManager* mgr)
100 {
101 if (!fUseCent) return;
102
103 gROOT->Macro("AddTaskCentrality.C");
104 AliCentralitySelectionTask* ctask =
105 dynamic_cast<AliCentralitySelectionTask*>(mgr->GetTask("CentralitySelection"));
106 if (!ctask) return;
107 ctask->SetPass(fESDPass);
108 if (mc) ctask->SetMCInput();
109 }
110 /**
111 * Crete output handler - we don't want one here.
112 *
113 * @return 0
114 */
115 AliVEventHandler* CreateOutputHandler(EType) { return 0; }
116 Bool_t fUseCent; // Whether to use centrality or not
117};
118
119//
120// EOF
121//