]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AddTaskForwardFlowQC.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskForwardFlowQC.C
1 /**
2  * @file   AddTaskForwardFlowQC.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 maxMom        Max moment to do 
21  * @param useEtaGap     Whehter to use @f$\eta@f$ gaps
22  * @param mc            Monte-carlo input
23  * @param outlierCutFMD Cut to remove events with outliers 
24  * @param outlierCutSPD Cut to remove events with outliers 
25  * @param etaGap        Size of @f$\eta@f$ gap
26  * @param useCent       Whether to use centrality or impact parameter for MC 
27  * @param useMCVtx      Whether to use vertex info from MC header
28  * @param satVtx        Use satellite interactions 
29  * @param addFlow       Afterburn what (MC only)
30  * @param addFType      Afterburner parameterization
31  * @param addFOrder     Afterburder order 
32  *
33  * @ingroup pwglf_forward_flow
34  */
35 void AddTaskForwardFlowQC(Int_t    maxMom        = 5,
36                           TString  fwdDet        = "FMD",
37                           Bool_t   useEtaGap     = kFALSE,
38                           Bool_t   use3cor       = kFALSE,
39                           Bool_t   mc            = kFALSE,
40                           Double_t outlierCutFMD = 4.0, 
41                           Double_t outlierCutSPD = 4.0,
42                           Double_t etaGap        = 2.0,
43                           Bool_t   useTPCForRef  = kFALSE,
44                           Bool_t   useCent       = kFALSE,
45                           Bool_t   useMCVtx      = kFALSE,
46                           Bool_t   satVtx        = kFALSE,
47                           TString  addFlow       = "",
48                           Int_t    addFType      = 0,
49                           Int_t    addFOrder     = 0)
50 {
51   // --- Get analysis manager ----------------------------------------
52   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
53   if (!mgr) 
54     Fatal("","No analysis manager to connect to.");
55
56   // --- Check that we have an AOD input handler ---------------------
57   UShort_t aodInput = 0;
58   if (!(aodInput = AliForwardUtil::CheckForAOD())) 
59     Fatal("","Cannot proceed without and AOD handler");
60   if (aodInput == 2 && 
61       (!AliForwardUtil::CheckForTask("AliForwardMultiplicityBase") ||
62        !AliForwardUtil::CheckForTask("AliCentralMultiplicityTask")))
63     Fatal("","The relevant tasks weren't added to the train");
64
65   // --- For the selected flow tasks the input and output is set -----
66   fwdDet.ToUpper();
67   
68   // --- Set flow flags --------------------------------------------
69   if (useEtaGap && use3cor) 
70     Fatal("", "You're doing it wrong! Cannot do both eta-gap and 3-sub");
71   UShort_t flags = AliForwardFlowTaskQC::kStdQC|AliForwardFlowTaskQC::kSymEta;
72   if (useEtaGap)              flags = AliForwardFlowTaskQC::kEtaGap;
73   if (use3cor)                flags = AliForwardFlowTaskQC::k3Cor;
74   if (satVtx)                 flags |= AliForwardFlowTaskQC::kSatVtx;
75   if (fwdDet.Contains("FMD")) flags |= AliForwardFlowTaskQC::kNUAcorr;
76   if      (fwdDet.Contains("FMD"))   flags |= AliForwardFlowTaskQC::kFMD;
77   else if (fwdDet.Contains("VZERO")) flags |= AliForwardFlowTaskQC::kVZERO;
78   if (useTPCForRef) flags |= AliForwardFlowTaskQC::kTPC;
79
80   const char* name = Form("ForwardFlowQC%s%s", fwdDet.Data(), AliForwardFlowTaskQC::GetQCType(flags, false));
81   AliForwardFlowTaskQC* task = 0;
82   // --- Set up adding flow to MC input ----------------------------
83   if (mc) {
84     AliForwardMCFlowTaskQC* mcTask = new AliForwardMCFlowTaskQC(name);
85     mcTask->SetUseImpactParameter(!useCent);
86     mcTask->SetUseMCHeaderVertex(useMCVtx);
87     if (addFlow.Data()[0] != '\0') {
88       mcTask->AddFlow(addFlow);
89       mcTask->AddFlowType(addFType);
90       mcTask->AddFlowOrder(addFOrder);
91     }
92     task = mcTask;
93   }
94   // --- Or use normal task ----------------------------------------
95   else 
96     task = new AliForwardFlowTaskQC(name);
97   
98   mgr->AddTask(task);
99 //  mgr->SetSkipTerminate(true);
100 //  task->SelectCollisionCandidates(AliVEvent::kCentral);
101   task->SetFlowFlags(flags);
102   
103   // --- Set eta gap value -----------------------------------------
104   task->SetEtaGapValue(etaGap);
105
106   // --- Check which harmonics to calculate --------------------------
107   task->SetMaxFlowMoment(maxMom);
108   
109   // --- Set non-default axis for vertices ---------------------------
110   TAxis* a = 0;
111   if (satVtx) {
112     a = new TAxis(6, 93.75, 318.75);
113   }
114   else 
115     a = new TAxis(20, -10, 10);
116 //    a = new TAxis(10, -5, 5);
117   task->SetVertexAxis(a);
118
119   // --- Set non-default axis for centrality -------------------------
120   Double_t cent[] = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100 };
121   //Double_t cent[] = {0, 2.5, 15, 25, 50, 100 };
122   //Double_t cent[] = {0, 100};
123   Int_t nBins = sizeof(cent)/sizeof(Double_t) -1;
124   TAxis* centAxis = new TAxis(nBins, cent);
125   task->SetCentralityAxis(centAxis);
126
127   // --- Set sigma cuts for outliers ---------------------------------
128   task->SetDetectorCuts(outlierCutFMD, outlierCutSPD);
129
130   // --- Create containers for output --------------------------------
131   const char* sumName = Form("FlowQCSums%s%s", fwdDet.Data(), AliForwardFlowTaskQC::GetQCType(flags, false));
132   const char* resName = Form("FlowQCResults%s%s", fwdDet.Data(), AliForwardFlowTaskQC::GetQCType(flags, false));
133   AliAnalysisDataContainer* sums = 
134     mgr->CreateContainer(sumName, TList::Class(), 
135                          AliAnalysisManager::kOutputContainer, 
136                          AliAnalysisManager::GetCommonFileName());
137   AliAnalysisDataContainer* output = 
138     mgr->CreateContainer(resName, TList::Class(), 
139                          AliAnalysisManager::kParamContainer, 
140                          AliAnalysisManager::GetCommonFileName());
141   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
142   mgr->ConnectOutput(task, 1, sums);
143   mgr->ConnectOutput(task, 2, output);
144 }
145 /*
146  * EOF
147  */