]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/FLOW/macros/AddTaskJetFlow.C
from Redmer Bertens:
[u/mrichter/AliRoot.git] / PWGCF / FLOW / macros / AddTaskJetFlow.C
CommitLineData
e1dc3f11 1///////////////////////////////////////////////////////////////////
2// //
3// AddTaskJetFlow //
4// Author: Redmer A. Bertens, Utrecht University, 2013 //
5// //
6///////////////////////////////////////////////////////////////////
7class AliAnalysisDataContainer;
8class AliFlowTrackCuts;
9
a4a06f0e 10void AddTaskJetFlow( TString name = "name",
11 TString jets = "jets",
12 Float_t ptbump = 0,
13 TArrayI* cent = 0x0,
14 Float_t MinPOIPt = 0.15,
15 Float_t MaxPOIPt = 150,
16 Float_t CCBinsInPt = 100,
17 Bool_t VParticle = kFALSE,
18 Bool_t debug = kFALSE )
e1dc3f11 19{
20 // first check the environment (common to all tasks)
21 if(debug) printf("\n\n >> AddTaskJetFlow <<\n");
22 TString fileName = AliAnalysisManager::GetCommonFileName();
23 fileName += ":JetFlow";
24 if(debug) printf(" - filename: %s \n",fileName.Data());
25 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
26 if (!mgr) {
27 if(debug) cout << " Fatal error: no analysis manager found! " << endl;
28 return 0x0;
29 }
30 if (!mgr->GetInputEventHandler()) {
31 if(debug) cout << " Fatal error: no imput event handler found!" << endl;
32 return 0x0;
33 }
98bd4878 34 // check the centrality setup
35 if(!cent) {
2db2a6d0 36 Int_t c[] = {0, 10, 30, 50, 70, 90};
98bd4878 37 cent = new TArrayI(sizeof(c)/sizeof(c[0]), c);
38 printf(" > Setup default centrality binning with %i bins \n ", cent->GetSize());
e1dc3f11 39 }
98bd4878 40 // create the cut objects
41 AliFlowTrackCuts* CutsRP = new AliFlowTrackCuts("CutsRP");
42 CutsRP = CutsRP->GetStandardVZEROOnlyTrackCuts();
43 AliFlowTrackCuts* CutsNull = new AliFlowTrackCuts("CutsNull");
44 CutsNull->SetParamType(AliFlowTrackCuts::kGlobal);
45 CutsNull->SetEtaRange(+1, -1);
46 CutsNull->SetPtRange(+1, -1);
47 // add the tasks in a loop, one task for each centrality bin
48 for(Int_t i(0); i < cent->GetSize()-1; i++) {
49 TString tempName(Form("%s_%i_%i", name.Data(), cent->At(i), cent->At(i+1)));
50 // create the task
51 AliAnalysisTaskJetFlow* task = new AliAnalysisTaskJetFlow(tempName.Data());
a4a06f0e 52 task->SetCCMaxPt(MaxPOIPt);
53 task->SetCCBinsInPt(CCBinsInPt);
54 task->SetDoVParticleAnalysis(VParticle);
55 task->SetMinMaxPOIPt(MinPOIPt, MaxPOIPt);
56 (debug) ? task->SetDebugMode(1) : task->SetDebugMode(-1);
98bd4878 57 if(!task) {
58 if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl;
59 return 0x0;
60 }
61 else printf(" > added task with name %s and jet collection %s < \n", tempName.Data(), jets.Data());
62 task->SetJetCollectionName(jets.Data());
63 // pass specific objects and settigns to the task
64 task->SetCutsRP(CutsRP);
65 task->SetCutsNull(CutsNull);
66 task->SetMinMaxCentrality(cent->At(i), cent->At(1+i));
67 task->SetPtBump(ptbump);
68 mgr->AddTask(task);
69 mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
70 mgr->ConnectOutput(task,1,mgr->CreateContainer(Form("%s_histograms", tempName.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName.Data()));
71
e1dc3f11 72 // connect flow anaysis task
98bd4878 73 AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("flowEvent_%s", tempName.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
74 mgr->ConnectOutput(task, 2, flowEvent);
75 TaskJetFlow::AddSPmethod(Form("SP_A_%s", tempName.Data()), -0.8, -0, 0, +0.8, "Qa", 2, flowEvent);
76 TaskJetFlow::AddSPmethod(Form("SP_B_%s", tempName.Data()), -0.8, -0, 0, +0.8, "Qb", 2, flowEvent);
77 }
e1dc3f11 78}
79//_____________________________________________________________________________
80namespace TaskJetFlow{ // use unique namespace to avoid problems in TRAIN analysis
81 void AddSPmethod(char *name, double minEtaA, double maxEtaA, double minEtaB, double maxEtaB, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent)
82 {
83 // add sp task and filter tasks
84 AliFlowTrackSimpleCuts* a = new AliFlowTrackSimpleCuts("a");
85 a->SetEtaMin(minEtaA);
86 a->SetEtaMax(maxEtaA);
87 a->SetMassMin(-999);
88 a->SetMassMax(999);
89 AliFlowTrackSimpleCuts* b = new AliFlowTrackSimpleCuts("b");
90 b->SetEtaMin(minEtaB);
91 b->SetEtaMax(maxEtaB);
92 b->SetMassMin(-999);
93 b->SetMassMax(999);
94 TString fileName = AliAnalysisManager::GetCommonFileName();
95 fileName+=":SP";
98bd4878 96 fileName+="name";
e1dc3f11 97 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
98 AliAnalysisDataContainer *filteredFlowEvent = mgr->CreateContainer(Form("Filter_%s", name), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
99 AliAnalysisTaskFilterFE *tskFilter(0x0);
100 if(!strcmp("Qa", Qvector)) tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", name), 0x0, a);
101 if(!strcmp("Qb", Qvector)) tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", name), 0x0, b);
102 if(tskFilter) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
103 else return;
104 mgr->AddTask(tskFilter);
105 printf( " > Added FILTER TASK < \n ");
106 mgr->ConnectInput(tskFilter, 0, flowEvent);
107 mgr->ConnectOutput(tskFilter, 1, filteredFlowEvent);
108 AliAnalysisDataContainer *outSP = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
109 AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", name), kFALSE);
110 tskSP->SetApplyCorrectionForNUA(kTRUE);
111 tskSP->SetHarmonic(harmonic);
112 tskSP->SetTotalQvector(Qvector);
113 tskSP->SetBookOnlyBasicCCH(kFALSE);
114 mgr->AddTask(tskSP);
115 mgr->ConnectInput(tskSP, 0, filteredFlowEvent);
116 mgr->ConnectOutput(tskSP, 1, outSP);
117 }
118}// end of namespace TaskJetFlow