]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AddTaskForwardFlow.C
Merge branch 'workdir'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskForwardFlow.C
1 /**
2  * @file   AddTaskForwardFlow.C
3  * @author Alexander Hansen alexander.hansen@cern.ch 
4  * 
5  * @brief  
6  * 
7  * 
8  * @ingroup pwglf_forward_scripts_tasks
9  */
10 /** 
11  * @defgroup pwglf_forward_flow Flow 
12  *
13  * Code to deal with flow 
14  *
15  * @ingroup pwglf_forward_topical
16  */
17 /** 
18  * Add Flow task to train 
19  * 
20  * @param type          Which moments to do 
21  * @param useEtaGap     Whehter to use @f$\eta@f$ gaps
22  * @param etaGap        Size of @f$\eta@f$ gap
23  * @param useCent       Whether to use centrality 
24  * @param mc            Monte-carlo input
25  * @param satVtx        Use satellite interactions 
26  * @param outlierCutFMD Cut to remove events with outliers 
27  * @param outlierCutSPD Cut to remove events with outliers 
28  * @param addFlow       Afterburn what (MC only)
29  * @param addFType      Afterburner parameterization
30  * @param addFOrder     Afterburder order 
31  *
32  * @ingroup pwglf_forward_flow
33  */
34 void AddTaskForwardFlow(TString  type          = "234", 
35                         Bool_t   useEtaGap     = kFALSE,
36                         Bool_t   mc            = kFALSE,
37                         Double_t outlierCutFMD = 4.0, 
38                         Double_t outlierCutSPD = 0,
39                         Double_t etaGap        = 2.0,
40                         Bool_t   useCent       = kFALSE,
41                         Bool_t   satVtx        = kFALSE,
42                         TString  addFlow       = "",
43                         Int_t    addFType      = 0,
44                         Int_t    addFOrder     = 0)
45 {
46   // --- Get analysis manager ----------------------------------------
47   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
48   if (!mgr) 
49     Fatal("","No analysis manager to connect to.");
50
51   // --- Check that we have an AOD input handler ---------------------
52   UShort_t aodInput = 0;
53   if (!(aodInput = AliForwardUtil::CheckForAOD())) 
54     Fatal("","Cannot proceed without and AOD handler");
55   if (aodInput == 2 && 
56       (!AliForwardUtil::CheckForTask("AliForwardMultiplicityBase") ||
57        !AliForwardUtil::CheckForTask("AliCentralMultiplicityTask")))
58     Fatal("","The relevant tasks weren't added to the train");
59
60   // --- For the selected flow tasks the input and output is set -----
61   const char* name = (useEtaGap ? "ForwardQCumulantsEtaGap", "ForwardQCumulants");
62   AliForwardFlowTaskQC* task = 0;
63   // --- Set up adding flow to MC input ----------------------------
64   if (mc) {
65     AliForwardMCFlowTaskQC* mcTask = new AliForwardMCFlowTaskQC(name);
66     mcTask->SetUseImpactParameter(!useCent);
67     if (addFlow.Data()[0] != '\0') {
68       mcTask->AddFlow(addFlow);
69       mcTask->AddFlowType(addFType);
70       mcTask->AddFlowOrder(addFOrder);
71     }
72     task = mcTask;
73   }
74   // --- Or use normal task ----------------------------------------
75   else 
76     task = new AliForwardFlowTaskQC(name);
77   
78   mgr->AddTask(task); 
79
80   // --- Set flow flags --------------------------------------------
81   UShort_t flags = AliForwardFlowTaskQC::kSymEta;
82   if (useEtaGap)           flags |= AliForwardFlowTaskQC::kEtaGap;
83   if (satVtx)              flags |= AliForwardFlowTaskQC::kSatVtx;
84   if (useEtaGap || satVtx) flags ^= AliForwardFlowTaskQC::kSymEta;
85   task->SetFlowFlags(flags);
86   
87   // --- Set eta gap value -----------------------------------------
88   task->SetEtaGapValue(etaGap);
89
90   // --- Check which harmonics to calculate --------------------------
91   const char* harm = type.Data();
92   Int_t i = 0;
93   std::cout << "Type string: " << type.Data();
94   std::cout << "\t harm string: " << harm << std::endl;
95   while (i < type.Length()) {
96     char c = harm[i];
97     std::cout << "Adding moment: " << c << std::endl;
98     Short_t n = atoi(&c);
99     std::cout << "Adding moment: " << n << std::endl;
100     task->AddFlowMoment(n);
101     i++;
102   }
103
104   // --- Set non-default axis for vertices ---------------------------
105   TAxis* a = 0;
106   if (satVtx) {
107     a = new TAxis(6, 93.75, 318.75);
108   }
109   else 
110     a = new TAxis(20, -10, 10);
111   task->SetVertexAxis(a);
112
113   // --- Set sigma cuts for outliers ---------------------------------
114   task->SetDetectorCuts(outlierCutFMD, outlierCutSPD);
115
116   // --- Create containers for output --------------------------------
117   const char* sumName = (useEtaGap ? "FlowQCSumsEtaGap" : "FlowQCSums");
118   const char* resName = (useEtaGap ? "FlowQCResultsEtaGap" : "FlowQCResults");
119   AliAnalysisDataContainer* sums = 
120     mgr->CreateContainer(sumName, TList::Class(), 
121                          AliAnalysisManager::kOutputContainer, 
122                          AliAnalysisManager::GetCommonFileName());
123   AliAnalysisDataContainer* output = 
124     mgr->CreateContainer(resName, TList::Class(), 
125                          AliAnalysisManager::kParamContainer, 
126                          AliAnalysisManager::GetCommonFileName());
127   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
128   mgr->ConnectOutput(task, 1, sums);
129   mgr->ConnectOutput(task, 2, output);
130 }
131 /*
132  * EOF
133  */