Updates from Redmer
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskLocalRho.C
CommitLineData
5ce0dc6d 1/*
2 * AddTask macro for class
3 * Redmer Alexander Bertens, rbertens@cern.ch
4 * Utrecht University, Utrecht, Netherlands
5 *
6 * Note: this macro is pretty much a copy of AddTaskEmcalJetSample.C
7 *
8 */
9
10AliAnalysisTaskLocalRho* AddTaskLocalRho(
11 const char *ntracks = "Tracks", // track selection used for vn estimate
12 const char *nclusters = "",
13 const char *njets = "Jets", // jet selection for finding leading jet
14 const char *nrho = "Rho",
15 Double_t jetradius = 0.3,
16 Double_t jetptcut = 1,
17 Double_t jetareacut = 0.557,
18 UInt_t type = AliAnalysisTaskEmcal::kTPC,
19 Int_t leadhadtype = 0,
20 const char *name = "AliAnalysisTaskLocalRho",
a3e16fac 21 TString fitOpts = "WLQI",
5ce0dc6d 22 UInt_t fitType = AliAnalysisTaskLocalRho::kCombined,
23 TArrayI *centralities = 0x0,
24 UInt_t runMode = AliAnalysisTaskLocalRho::kGrid
25 )
26{
27 // Get the pointer to the existing analysis manager via the static access method.
28 //==============================================================================
29 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
30 if (!mgr)
31 {
32 ::Error("AddTaskEmcalJetSample", "No analysis manager to connect to.");
33 return NULL;
34 }
35
36 // Check the analysis type using the event handlers connected to the analysis manager.
37 //==============================================================================
38 if (!mgr->GetInputEventHandler())
39 {
40 ::Error("AddTaskEmcalJetSample", "This task requires an input event handler");
41 return NULL;
42 }
43
44 //-------------------------------------------------------
45 // Init the task and do settings
46 //-------------------------------------------------------
47
48 AliAnalysisTaskLocalRho* jetTask = new AliAnalysisTaskLocalRho(name, runMode);
49 // inherited setters
50 jetTask->SetAnaType(type);
51 jetTask->SetTracksName(ntracks);
52 jetTask->SetClusName(nclusters);
53 jetTask->SetJetsName(njets);
54 jetTask->SetRhoName(nrho);
55 jetTask->SetJetRadius(jetradius);
56 jetTask->SetJetPtCut(jetptcut);
57 jetTask->SetPercAreaCut(jetareacut);
58 jetTask->SetLeadingHadronType(leadhadtype);
59 // task specific setters
60 jetTask->SetDebugMode(-1);
61 jetTask->SetModulationFitType(fitType);
62 jetTask->SetModulationFitOptions(fitOpts);
63 jetTask->SetModulationFitMinMaxP(.001, 1);
64 jetTask->SetCentralityClasses(centralities);
65
66 //-------------------------------------------------------
67 // Final settings, pass to manager and set the containers
68 //-------------------------------------------------------
69
70 mgr->AddTask(jetTask);
71
72 // Create containers for input/output
73 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
74 TString contname(name);
75 contname += "_histos";
76 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
77 TList::Class(),AliAnalysisManager::kOutputContainer,
78 Form("%s", AliAnalysisManager::GetCommonFileName()));
79 mgr->ConnectInput (jetTask, 0, cinput1 );
80 mgr->ConnectOutput (jetTask, 1, coutput1 );
81
82 switch (runMode) {
83 case AliAnalysisTaskLocalRho::kLocal : {
84 gStyle->SetOptFit(1);
85 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("good_fits_%s", name.Data()),
86 TList::Class(),AliAnalysisManager::kOutputContainer,
87 Form("%s", AliAnalysisManager::GetCommonFileName()));
88 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("bad_fits_%s", name.Data()),
89 TList::Class(),AliAnalysisManager::kOutputContainer,
90 Form("%s", AliAnalysisManager::GetCommonFileName()));
91 mgr->ConnectOutput (jetTask, 2, coutput2);
92 mgr->ConnectOutput (jetTask, 3, coutput3);
93 } break;
94 default: break;
95 }
96 return jetTask;
97}