]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/trains/MakeFMDELossTrain.C
Fixes for CAF
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / trains / MakeFMDELossTrain.C
CommitLineData
e01b1d30 1/**
2 * @file MakeFMDELossTrain.C
3 * @author Christian Holm Christensen <cholm@master.hehi.nbi.dk>
4 * @date Fri Jun 1 13:53:02 2012
5 *
6 * @brief
7 *
8 *
9 * @ingroup pwglf_forward_trains
10 */
11#include "TrainSetup.C"
12
1d86b7ca 13//====================================================================
14/**
15 * Analysis train to do energy loss fits
16 *
bd6f5206 17 * @ingroup pwglf_forward_trains
e01b1d30 18 * @ingroup pwglf_forward_eloss
1d86b7ca 19 */
20class MakeFMDELossTrain : public TrainSetup
21{
22public:
23 /**
24 * Constructor. Date and time must be specified when running this
25 * in Termiante mode on Grid
26 *
27 * @param name Name of train
1d86b7ca 28 */
e01b1d30 29 MakeFMDELossTrain(const char* name = "FMD Energy Loss")
30 : TrainSetup(name),
31 fUseCent(false)
1d86b7ca 32 {
e01b1d30 33 SetType(kESD);
1d86b7ca 34 }
1d86b7ca 35 /**
e01b1d30 36 * Whether to process per centrality bin
1d86b7ca 37 *
e01b1d30 38 * @param use
1d86b7ca 39 */
e01b1d30 40 void SetUseCentrality(Bool_t use) { fUseCent = use; }
1d86b7ca 41protected:
1897b8a3 42 //------------------------------------------------------------------
43 /**
44 * Create the analysis manager
45 *
46 * @param name Name of the analysis
47 *
48 * @return Created analysis manager
49 */
50 virtual AliAnalysisManager* CreateAnalysisManager(const char* name)
51 {
52 AliAnalysisManager* mgr = TrainSetup::CreateAnalysisManager(name);
53 // mgr->SetAutoBranchLoading(false);
54 return mgr;
55 }
1d86b7ca 56 //__________________________________________________________________
57 /**
58 * Create the tasks
59 *
1d86b7ca 60 * @param par Whether to use par files
61 * @param mgr Analysis manager
62 */
e01b1d30 63 void CreateTasks(EMode /*mode*/, Bool_t par, AliAnalysisManager* mgr)
1d86b7ca 64 {
65 // --- Output file name ------------------------------------------
66 AliAnalysisManager::SetCommonFileName("forward_eloss.root");
67
68 // --- Load libraries/pars ---------------------------------------
e01b1d30 69 LoadLibrary("PWGLFforward2", par, true);
1d86b7ca 70
71 // --- Set load path ---------------------------------------------
bd6f5206 72 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
1d86b7ca 73 gROOT->GetMacroPath()));
74
75 // --- Check if this is MC ---------------------------------------
76 Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
77
78 // --- Add the task ----------------------------------------------
79 gROOT->Macro(Form("AddTaskFMDELoss.C(%d,%d)", mc, fUseCent));
80 }
81 /**
82 * Create entrality selection if enabled
83 *
84 * @param mc Whether this is MC or not
85 * @param mgr Analysis manager
86 */
87 virtual void CreateCentralitySelection(Bool_t mc, AliAnalysisManager* mgr)
88 {
89 if (!fUseCent) return;
90
e01b1d30 91 const char* name = "CentralitySelection";
1d86b7ca 92 gROOT->Macro("AddTaskCentrality.C");
93 AliCentralitySelectionTask* ctask =
e01b1d30 94 dynamic_cast<AliCentralitySelectionTask*>(mgr->GetTask(name));
1d86b7ca 95 if (!ctask) return;
e01b1d30 96 // ctask->SetPass(fESDPass);
1d86b7ca 97 if (mc) ctask->SetMCInput();
98 }
99 /**
100 * Crete output handler - we don't want one here.
101 *
102 * @return 0
103 */
104 AliVEventHandler* CreateOutputHandler(EType) { return 0; }
e01b1d30 105 //__________________________________________________________________
106 const char* ClassName() const { return "MakeFMDElossTrain"; }
107 //__________________________________________________________________
108 void MakeOptions(Runner& r)
109 {
110 TrainSetup::MakeOptions(r);
111 r.Add(new Option("cent", "Use centrality"));
112 }
113 //__________________________________________________________________
114 void SetOptions(Runner& r)
115 {
116 TrainSetup::SetOptions(r);
117 Option* cent = r.FindOption("cent");
118 if (cent) fUseCent = cent->AsBool();
119 }
1d86b7ca 120 Bool_t fUseCent; // Whether to use centrality or not
121};
122
123//
124// EOF
125//