]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/macros/AddTaskHFEnpepPb.C
update train config
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / AddTaskHFEnpepPb.C
1 AliAnalysisTask *AddTaskHFEnpepPb(Bool_t MCthere,
2                                   Bool_t isAOD, 
3                                   Bool_t kNPERef = kTRUE,
4                                   Bool_t kNPERefTPConly = kTRUE,
5                                   Bool_t kNPEkAny = kFALSE,
6                                   Bool_t kNPEsystematics = kFALSE,
7                                   Bool_t kNPEpidsys = kFALSE
8 ){
9
10   // Default settings (TOF-TPC pPb)
11   const int     kDefTPCcl       = 110;
12   const int     kDefTPCclPID    =  80;
13   const int     kDefITScl       =   4;
14   const double  kDefDCAr        =   1.;
15   const double  kDefDCAz        =   2.;
16   const double  kDefTOFs        =   3.;
17   const double  kDefEtaIncMin = -0.8;
18   const double  kDefEtaIncMax = 0.8;
19
20   // TPC PID Cuts Inclusive leg:
21   // NEW SPLINES + CORRECTIONS: mean 0, width 1
22   // mean is actually 0.06 (abs(eta)<0.6)
23   Double_t dEdxhm[12] = {3.06,3.06,3.06,3.06,3.06,3.06,3.06,3.06,3.06,3.06,3.06,3.06};  // Above 3 sigma we neglect 0.13%
24
25   Double_t tpcl0[12]  = {-0.94,-0.94,-0.94,-0.94,-0.94,-0.94,-0.94,-0.94,-0.94,-0.94,-0.94,-0.94};  // 84%
26   Double_t tpcl1[12]  = {-0.44,-0.44,-0.44,-0.44,-0.44,-0.44,-0.44,-0.44,-0.44,-0.44,-0.44,-0.44};  // 69%
27   Double_t tpcl2[12]  = {0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06};  // 50%
28
29   Double_t tpcl3[12]  = {-0.69,-0.69,-0.69,-0.69,-0.69,-0.69,-0.69,-0.69,-0.69,-0.69,-0.69,-0.69};  // 77.2%
30   Double_t tpcl4[12]  = {-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19,-0.19};  // 59.7%
31   Double_t tpcl5[12]  = {0.186,0.186,0.186,0.186,0.186,0.186,0.186,0.186,0.186,0.186,0.186,0.186};  // 45%
32   Double_t tpcl6[12]  = {0.31,0.31,0.31,0.31,0.31,0.31,0.31,0.31,0.31,0.31,0.31,0.31};  // 40%
33   Double_t tpcl7[12]  = {0.56,0.56,0.56,0.56,0.56,0.56,0.56,0.56,0.56,0.56,0.56,0.56};  // 30.7%
34
35   // Default setting for the associated electron for the NonPhotonic Analysis
36   const double  kassETAm = -0.8;
37   const double  kassETAp = 0.8;
38   const int     kassITS         =   2;
39   const int     kassTPCcl       = 60;
40   const int     kassTPCPIDcl    =  60;
41   const double  kassDCAr        =   1.0;
42   const double  kassDCAz        =   2.0;
43   const double  kassTPCSminus   =  -3.0;
44   const double  kassTPCSplus    =   3.0;
45
46   enum{
47           kHFEV0A = 1,
48           kHFEV0M = 2,
49           kHFECL1 = 3,
50           kHFEZNA = 4
51   };
52
53   //get the current analysis manager
54   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
55   if (!mgr) {
56     Error("AddTask_hfe_HFE", "No analysis manager found.");
57     return 0;
58   }
59
60   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
61
62   //@@ 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
63
64   Double_t dEdxaclm[12], dEdxachm[12],dEdxaclm1[12], dEdxachm1[12],dEdxaclm2[12], dEdxachm2[12];
65   for(int icent = 0; icent < 12; icent++){
66     dEdxaclm[icent] = kassTPCSminus;
67     dEdxachm[icent] = kassTPCSplus;
68     dEdxaclm1[icent] = -2;
69     dEdxachm1[icent] = 2;
70     dEdxaclm2[icent] = -4;
71     dEdxachm2[icent] = 4;
72   }
73
74   if(kNPERef){
75     // **************************************************************
76     // 
77     // Reference task
78     //
79     // **************************************************************
80     RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, 
81                         AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax, kassETAm, kassETAp, kassITS, kassTPCcl, 
82                         kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
83     /*RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, 
84      *                    AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax, kassETAm, kassETAp, kassITS, kassTPCcl, 
85      *                    kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE);
86      */
87   }
88
89   if(kNPERefTPConly){
90     // **************************************************************
91     // 
92     // Reference task for TPC-only on the inclusive leg
93     //
94     // **************************************************************
95     RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, 0, 
96                         AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax, kassETAm, kassETAp, kassITS, kassTPCcl, 
97                         kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
98     /*RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, 
99      *                    AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax, kassETAm, kassETAp, kassITS, kassTPCcl, 
100      *                    kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE);
101      */
102   }
103
104   if(kNPEkAny){
105     // **************************************************************
106     // 
107     // task for kAny instead of kBoth
108     //
109     // **************************************************************
110     RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, 
111                         AliHFEextraCuts::kAny, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax, kassETAm, kassETAp, kassITS, kassTPCcl, 
112                         kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
113     /*RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, 
114      *                    AliHFEextraCuts::kAny, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax, kassETAm, kassETAp, kassITS, kassTPCcl, 
115      *                    kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE);
116      */
117   }
118
119   if(kNPEsystematics){
120     // **************************************************************
121     // 
122     // Cut systematics on the associated track
123     //
124     // **************************************************************
125       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
126                          0.0, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
127       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
128                          kassETAm, 0.0, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
129       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
130                          kassETAm, kassETAp, 3, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
131       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
132                          kassETAm, kassETAp, kassITS, 80, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
133       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
134                          kassETAm, kassETAp, kassITS, 100, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
135       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
136                          kassETAm, kassETAp, kassITS, 40, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
137       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
138                          kassETAm, kassETAp, kassITS, kassTPCcl, 40, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
139       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
140                          kassETAm, kassETAp, kassITS, kassTPCcl, 80, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
141       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
142                          kassETAm, kassETAp, kassITS, kassTPCcl, 100, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
143       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
144                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, 0.5, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
145       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
146                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, 2, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kTRUE);
147       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
148                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, 1, dEdxaclm, dEdxachm, kTRUE, kTRUE);
149       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
150                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, 4, dEdxaclm, dEdxachm, kTRUE, kTRUE);
151       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
152                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm1, dEdxachm1, kTRUE, kTRUE);
153       RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax,
154                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm2, dEdxachm2, kTRUE, kTRUE);
155
156   }
157
158   // PID systematics
159   if(kNPEpidsys){
160     const int kPIDvars = 4;
161     const double pidvars[kPIDvars] = {2, 2.5, 3.5, 4};
162     double dEdxtestlow[12], dEdxtesthigh[12];
163     for(int itest = 0; itest < kPIDvars; itest++){
164       for(int icent = 0; icent < 12; icent++){
165         dEdxtestlow[icent] = -1. * pidvars[itest];
166         dEdxtesthigh[icent] = pidvars[itest];
167       }
168 //      RegisterTaskNPEpPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpc1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kHFEV0A, kDefEtaIncMin, kDefEtaIncMax, kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxtestlow, dEdxtesthigh);
169     } 
170   }
171
172   return NULL;
173 }
174
175 //===============================================================================
176 AliAnalysisTask *RegisterTaskNPEpPb(Bool_t useMC, Bool_t isAOD, 
177                Int_t tpcCls=120, Int_t tpcClsPID=80, 
178                Int_t itsCls=4, Double_t dcaxy=1.0, Double_t dcaz=2.0, 
179                Double_t *tpcdEdxcutlow=NULL, Double_t *tpcdEdxcuthigh=NULL, 
180                Double_t tofs=3., Int_t itshitpixel =AliHFEextraCuts::kBoth, Int_t icent=1,
181                Double_t etaIncMin = -0.8, Double_t etaIncMax = 0.8,
182                Double_t assETAm=-0.8, Double_t assETAp=0.8, Int_t assITS=2, Int_t assTPCcl=100,
183                Int_t assTPCPIDcl=80, Double_t assDCAr=1.0, Double_t assDCAz=2.0,
184                Double_t *assTPCSminus = NULL, Double_t *assTPCSplus=NULL,
185                Bool_t useCat1Tracks = kTRUE, Bool_t useCat2Tracks = kTRUE)
186 {
187   //
188   // Cuts on the inclusive leg
189   //
190   Int_t idcaxy = (Int_t)(dcaxy*10.);
191   Int_t idcaz = (Int_t)(dcaz*10.);
192   Int_t tpclow = 0;
193   if(tpcdEdxcutlow) tpclow = (Int_t) (tpcdEdxcutlow[0]*1000.);
194   Int_t itofs = (Int_t)(tofs*10.);
195   Int_t ipixelany = itshitpixel;
196
197   //
198   // Cuts on the associated leg
199   //
200   Int_t iassDCAr = (Int_t)(assDCAr*10);
201   Int_t iassDCAz = (Int_t)(assDCAz*10);
202   Int_t iassTPCSminus = assTPCSplus ? (Int_t)(assTPCSplus[0]*1000.) : 0;
203
204   printf("Argument passed to function to determine the centrality estimator %i\n", icent);
205   if (icent == 2) TString cesti("V0M");
206   else if (icent == 3) TString cesti("CL1");
207   else if (icent == 4) TString cesti("ZNA");
208   else TString cesti("V0A");
209   printf("Centrality estimator %s\n", cesti.Data());
210
211   TString appendix(TString::Format("SPD%d_incTPCc%dTPCp%dITS%dDCAr%dz%dTPCs%dTOFs%d_photTPCc%dTPCp%dITS%dDCAr%dDCAz%dTPCs%dce%s",ipixelany,tpcCls,tpcClsPID,itsCls,idcaxy,idcaz,tpclow,itofs,assTPCcl,assTPCPIDcl,assITS,iassDCAr,iassDCAz,iassTPCSminus,cesti.Data()));
212   printf("Add macro appendix %s\n", appendix.Data());
213
214  if(!gROOT->GetListOfGlobalFunctions()->FindObject("ConfigHFEnpepPb")) gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/macros/configs/pPb/ConfigHFEnpepPb.C");
215
216   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
217   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
218   AliAnalysisTaskHFE *task = ConfigHFEnpepPb(useMC, isAOD, appendix, tpcCls, tpcClsPID, itsCls, dcaxy, dcaz, tpcdEdxcutlow, tpcdEdxcuthigh, tofs, 0, itshitpixel, icent, etaIncMin, etaIncMax,
219                                              assETAm, assETAp, assITS, assTPCcl, assTPCPIDcl, assDCAr, assDCAz, assTPCSminus, assTPCSplus, useCat1Tracks, useCat2Tracks);
220   if(isAOD)
221     task->SetAODAnalysis();
222   else
223     task->SetESDAnalysis();
224
225   if (useMC)    task->SetHasMCData(kTRUE);
226   else          task->SetHasMCData(kFALSE);
227
228   task->SelectCollisionCandidates(AliVEvent::kINT7);
229
230   TString containerName = mgr->GetCommonFileName();
231   containerName += ":HFEtask";
232   containerName += appendix.Data();
233   printf("container name: %s\n", containerName.Data());
234
235   //create data containers
236   task->ConnectOutput(1, mgr->CreateContainer(Form("HFE_Results_%s", appendix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data() ));
237   task->ConnectOutput(2, mgr->CreateContainer(Form("HFE_QA_%s", appendix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()));
238   mgr->ConnectInput(task,  0, cinput );
239
240   mgr->AddTask(task);
241
242   return NULL;
243 }