]>
Commit | Line | Data |
---|---|---|
56236b95 | 1 | /** |
2 | * @file MakeAODTrain.C | |
3 | * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk> | |
4 | * @date Tue Jul 12 10:05:30 2011 | |
5 | * | |
6 | * @brief Run first pass analysis - make AOD tree | |
7 | * | |
8 | * @ingroup pwg2_forward_trains | |
9 | */ | |
1d86b7ca | 10 | //==================================================================== |
11 | /** | |
12 | * Analysis train to make Forward and Central multiplicity | |
13 | * | |
14 | * To run, do | |
15 | * @code | |
16 | * gROOT->LoadMacro("TrainSetup.C"); | |
17 | * // Make train | |
18 | * MakeAODTrain t("My Analysis"); | |
19 | * // Set variaous parameters on the train | |
20 | * t.SetDataDir("/home/of/data"); | |
21 | * t.AddRun(118506) | |
22 | * // Run it | |
23 | * t.Run("LOCAL", "FULL", -1, false, false); | |
24 | * @endcode | |
25 | * | |
1d86b7ca | 26 | * @ingroup pwg2_forward_aod |
56199f2b | 27 | * @ingroup pwg2_forward_trains |
1d86b7ca | 28 | */ |
29 | class MakeAODTrain : public TrainSetup | |
30 | { | |
31 | public: | |
32 | /** | |
33 | * Constructor. Date and time must be specified when running this | |
34 | * in Termiante mode on Grid | |
35 | * | |
36 | * @param name Name of train (free form) | |
37 | * @param sys Collision system (1: pp, 2: PbPb) | |
38 | * @param sNN Center of mass energy [GeV] | |
39 | * @param field L3 magnetic field - one of {-5,0,+5} kG | |
40 | * @param useCent Whether to use centrality | |
41 | * @param dateTime Append date and time to name | |
42 | * @param year Year - if not specified, current year | |
43 | * @param month Month - if not specified, current month | |
44 | * @param day Day - if not specified, current day | |
45 | * @param hour Hour - if not specified, current hour | |
46 | * @param min Minutes - if not specified, current minutes | |
47 | */ | |
48 | MakeAODTrain(const char* name, | |
49 | UShort_t sys = 0, | |
50 | UShort_t sNN = 0, | |
51 | Short_t field = 0, | |
52 | Bool_t useCent = false, | |
53 | Bool_t dateTime = false, | |
54 | UShort_t year = 0, | |
55 | UShort_t month = 0, | |
56 | UShort_t day = 0, | |
57 | UShort_t hour = 0, | |
58 | UShort_t min = 0) | |
59 | : TrainSetup(name, dateTime, | |
60 | year, month, day, hour, min), | |
61 | fSys(sys), | |
62 | fSNN(sNN), | |
63 | fField(field), | |
64 | fUseCent(useCent) | |
65 | {} | |
66 | /** | |
67 | * Run this analysis | |
68 | * | |
69 | * @param mode Mode - see TrainSetup::EMode | |
70 | * @param oper Operation - see TrainSetup::EOperation | |
71 | * @param nEvents Number of events (negative means all) | |
72 | * @param mc If true, assume simulated events | |
73 | * @param usePar If true, use PARs | |
74 | */ | |
75 | void Run(const char* mode, const char* oper, | |
76 | Int_t nEvents=-1, Bool_t mc=false, | |
77 | Bool_t usePar=false) | |
78 | { | |
79 | Info("Run", "Running in mode=%s, oper=%s, events=%d, MC=%d, Par=%d", | |
80 | mode, oper, nEvents, mc, usePar); | |
81 | Exec("ESD", mode, oper, nEvents, mc, usePar); | |
82 | } | |
83 | /** | |
84 | * Run this analysis | |
85 | * | |
86 | * @param mode Mode - see TrainSetup::EMode | |
87 | * @param oper Operation - see TrainSetup::EOperation | |
88 | * @param nEvents Number of events (negative means all) | |
89 | * @param mc If true, assume simulated events | |
90 | * @param usePar If true, use PARs | |
91 | */ | |
92 | void Run(EMode mode, EOper oper, Int_t nEvents=-1, Bool_t mc=false, | |
93 | Bool_t usePar = false) | |
94 | { | |
95 | Info("Run", "Running in mode=%d, oper=%d, events=%d, MC=%d, Par=%d", | |
96 | mode, oper, nEvents, mc, usePar); | |
97 | Exec(kESD, mode, oper, nEvents, mc, usePar); | |
98 | } | |
99 | protected: | |
100 | /** | |
101 | * Create the tasks | |
102 | * | |
103 | * @param mode Processing mode | |
104 | * @param par Whether to use par files | |
105 | * @param mgr Analysis manager | |
106 | */ | |
107 | void CreateTasks(EMode mode, Bool_t par, AliAnalysisManager* mgr) | |
108 | { | |
109 | // --- Output file name ------------------------------------------ | |
110 | AliAnalysisManager::SetCommonFileName("forward.root"); | |
111 | ||
112 | // --- Load libraries/pars --------------------------------------- | |
113 | LoadLibrary("PWG2forward2", mode, par, true); | |
114 | ||
115 | // --- Set load path --------------------------------------------- | |
116 | gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2", | |
117 | gROOT->GetMacroPath())); | |
118 | ||
119 | // --- Check if this is MC --------------------------------------- | |
120 | Bool_t mc = mgr->GetMCtruthEventHandler() != 0; | |
121 | ||
122 | // --- Add the task ---------------------------------------------- | |
123 | gROOT->Macro(Form("AddTaskForwardMult.C(%d,%d,%d,%d)", | |
124 | mc, fSys, fSNN, fField)); | |
125 | AddExtraFile(gSystem->Which(gROOT->GetMacroPath(), "ForwardAODConfig.C")); | |
126 | ||
127 | // --- Add the task ---------------------------------------------- | |
128 | gROOT->Macro(Form("AddTaskCentralMult.C(%d,%d,%d,%d)", | |
129 | mc, fSys, fSNN, fField)); | |
130 | AddExtraFile(gSystem->Which(gROOT->GetMacroPath(), "CentralAODConfig.C")); | |
131 | } | |
132 | //__________________________________________________________________ | |
133 | /** | |
134 | * Create physics selection , and add to manager | |
135 | * | |
136 | * @param mc Whether this is for MC | |
137 | * @param mgr Manager | |
138 | */ | |
139 | void CreatePhysicsSelection(Bool_t mc, | |
140 | AliAnalysisManager* mgr) | |
141 | { | |
142 | TrainSetup::CreatePhysicsSelection(mc, mgr); | |
143 | ||
144 | // --- Get input event handler ----------------------------------- | |
145 | AliInputEventHandler* ih = | |
146 | dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler()); | |
147 | if (!ih) | |
148 | Fatal("CreatePhysicsSelection", "Couldn't get input handler (%p)", ih); | |
149 | ||
150 | // --- Get Physics selection ------------------------------------- | |
151 | AliPhysicsSelection* ps = | |
152 | dynamic_cast<AliPhysicsSelection*>(ih->GetEventSelection()); | |
153 | if (!ps) | |
154 | Fatal("CreatePhysicsSelection", "Couldn't get PhysicsSelection (%p)",ps); | |
155 | ||
156 | // --- Ignore trigger class when selecting events. This means --- | |
157 | // --- that we get offline+(A,C,E) events too -------------------- | |
158 | // ps->SetSkipTriggerClassSelection(true); | |
159 | } | |
160 | //__________________________________________________________________ | |
161 | /** | |
162 | * Create the centrality selection only if requested | |
163 | * | |
164 | * @param mc Monte-Carlo truth flag | |
165 | * @param mgr Manager | |
166 | */ | |
167 | void CreateCentralitySelection(Bool_t mc, AliAnalysisManager* mgr) | |
168 | { | |
169 | if (!fUseCent) return; | |
170 | TrainSetup::CreateCentralitySelection(mc, mgr); | |
171 | } | |
172 | UShort_t fSys; | |
173 | UShort_t fSNN; | |
174 | Short_t fField; | |
175 | Bool_t fUseCent; | |
176 | }; | |
177 | // | |
178 | // EOF | |
179 | // |