]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/macros/AddTaskHFEnpePbPb.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / AddTaskHFEnpePbPb.C
1 AliAnalysisTask *AddTaskHFEnpePbPb(Bool_t MCthere, 
2                                    Bool_t isAOD,
3                                    Bool_t kNPERef = kTRUE,
4                                    Bool_t kNPEkAny = kFALSE,
5                                    Bool_t kNPERefMCf =  kTRUE,
6                                    Bool_t kNPERefTPConly =  kTRUE)
7 {
8   // Default settings (TOF-TPC PbPb)
9   const int     kDefTPCcl       = 130;
10   const int     kDefTPCclPID    =  80;
11   const int kDefTPCclshared = 1.1;
12   const int     kDefITScl       =   4;
13   const int kDefITSchi2percluster = -1; // cleanup removes badly matching tracks - effects high pt  (cut value = 36)
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   const Bool_t   etacorrection   = kFALSE;
20   const Bool_t   multicorrection = kTRUE;
21
22   Double_t dEdxhm[12] = {3.11,3.11,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};  
23   Double_t tpcl1[12]  = {-0.14,-0.14,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3};  
24
25   // Default setting for the associated electron for the NonPhotonic Analysis
26   const double  kassETAm = -0.8;
27   const double  kassETAp = 0.8;
28   const int     kassITS         =   2;
29   const int     kassTPCcl       = 60;
30   const int     kassTPCPIDcl    =  60;
31   const double  kassDCAr        =   1.0;
32   const double  kassDCAz        =   2.0;
33   const double  kassTPCSminus   =  -3.0;
34   const double  kassTPCSplus    =   3.0;
35
36   //get the current analysis manager
37   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
38   if (!mgr) {
39     Error("AddTask_hfe_HFE", "No analysis manager found.");
40     return 0;
41   }
42
43   //mgr->AddClassDebug("AliAnalysisTaskHFE",12);
44  
45
46   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
47
48   //@@ 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
49
50   Double_t dEdxaclm[12], dEdxachm[12];
51   for(int icent = 0; icent < 12; icent++){
52     dEdxaclm[icent] = kassTPCSminus;
53     dEdxachm[icent] = kassTPCSplus;
54   }
55
56   if(kNPERef){
57     // **************************************************************
58     // 
59     // Reference task
60     //
61     // **************************************************************
62     RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,
63                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE,kFALSE);
64   }
65
66   if(kNPEkAny){
67     // **************************************************************
68     // 
69     // task for kAny instead of kBoth
70     //
71     // **************************************************************
72     RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kAny, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,
73                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE,kFALSE);
74   }
75   if(kNPERefMCf){
76     // **************************************************************
77     // 
78     // Reference task + MC fake rejected
79     //
80     // **************************************************************
81     RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, kDefTOFs, AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,
82                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE, kTRUE);
83   }
84
85   if(kNPERefTPConly){
86     // **************************************************************
87     // 
88     // Reference task
89     //
90     // **************************************************************
91     RegisterTaskNPEPbPb( MCthere, isAOD, kDefTPCcl, kDefTPCclPID, kDefITScl, kDefDCAr, kDefDCAz, tpcl1, dEdxhm, 0., AliHFEextraCuts::kBoth, kDefITSchi2percluster, kDefTPCclshared, etacorrection, multicorrection, kDefEtaIncMin, kDefEtaIncMax,
92                          kassETAm, kassETAp, kassITS, kassTPCcl, kassTPCPIDcl, kassDCAr, kassDCAz, dEdxaclm, dEdxachm, kTRUE, kFALSE, kFALSE);
93   }
94
95   return NULL;
96 }
97
98 //===============================================================================
99 AliAnalysisTask *RegisterTaskNPEPbPb(Bool_t useMC, Bool_t isAOD, 
100                Int_t tpcCls=120, Int_t tpcClsPID=80, 
101                Int_t itsCls=4, Double_t dcaxy=1.0, Double_t dcaz=2.0, 
102                Double_t *tpcdEdxcutlow=NULL, Double_t *tpcdEdxcuthigh=NULL, 
103                Double_t tofs=3., Int_t itshitpixel =AliHFEextraCuts::kBoth,
104                Double_t itschi2percluster = -1, Double_t tpcsharedcluster = 1.1,
105                Bool_t etacorr=kFALSE, Bool_t multicorr = kFALSE,
106                Double_t etaIncMin = -0.8, Double_t etaIncMax = 0.8,
107                Double_t assETAm=-0.8, Double_t assETAp=0.8, Int_t assITS=2, Int_t assTPCcl=100,
108                Int_t assTPCPIDcl=80, Double_t assDCAr=1.0, Double_t assDCAz=2.0,
109                Double_t *assTPCSminus = NULL, Double_t *assTPCSplus=NULL,
110                                      Bool_t useCat1Tracks = kTRUE, Bool_t useCat2Tracks = kTRUE, Bool_t rejectMCFake = kFALSE)
111 {
112
113   //
114   // Cuts on the inclusive leg
115   //
116   Int_t idcaxy = (Int_t)(dcaxy*10.);
117   Int_t idcaz = (Int_t)(dcaz*10.);
118   Int_t tpclow = 0;
119   if(tpcdEdxcutlow) tpclow = (Int_t) (tpcdEdxcutlow[0]*1000.);
120   Int_t itofs = (Int_t)(tofs*10.);
121   Int_t ipixelany = itshitpixel;
122   Int_t imult = multicorr ? 1 : 0;
123
124   //
125   // Cuts on the associated leg
126   //
127   Int_t iassDCAr = (Int_t)(assDCAr*10);
128   Int_t iassDCAz = (Int_t)(assDCAz*10);
129   Int_t iassTPCSplus  = assTPCSplus ? (Int_t)(assTPCSplus[0]*1000) : 0;
130   Int_t icat1 = useCat1Tracks ? 1 : 0;
131   Int_t icat2 = useCat2Tracks ? 1 : 0;
132   Int_t irejectMCFake = rejectMCFake ? 1 : 0;
133
134   TString appendix(TString::Format("SPD%d_incTPCc%dTPCp%dITS%dDCAr%dz%dTPCs%dTOFs%dm%d_photTPCc%dTPCp%dITS%dDCAr%dDCAz%dTPCs%dMCf%d",ipixelany,tpcCls,tpcClsPID,itsCls,idcaxy,idcaz,tpclow,itofs,imult,assTPCcl,assTPCPIDcl,assITS,iassDCAr,iassDCAz,iassTPCSplus,irejectMCFake));
135
136   printf("Add macro appendix %s\n", appendix.Data());
137
138   if(!gROOT->GetListOfGlobalFunctions()->FindObject("ConfigHFEnpePbPb"))gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/ConfigHFEnpePbPb.C");
139
140   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
141   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
142   AliAnalysisTaskHFE *task = ConfigHFEnpePbPb(useMC, isAOD, appendix, tpcCls, tpcClsPID, itsCls, dcaxy, dcaz, tpcdEdxcutlow, tpcdEdxcuthigh, tofs, 0, itshitpixel, itschi2percluster, tpcsharedcluster, etacorr, multicorr, etaIncMin, etaIncMax,
143                                               assETAm, assETAp, assITS, assTPCcl, assTPCPIDcl, assDCAr, assDCAz, assTPCSminus, assTPCSplus, useCat1Tracks, useCat2Tracks,rejectMCFake);
144   if(isAOD)
145     task->SetAODAnalysis();
146   else
147     task->SetESDAnalysis();
148
149   if (useMC)    task->SetHasMCData(kTRUE);
150   else          task->SetHasMCData(kFALSE);
151
152   task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
153
154   TString containerName = mgr->GetCommonFileName();
155   containerName += ":HFE";
156   containerName += appendix.Data();
157   printf("container name: %s\n", containerName.Data());
158
159   //create data containers
160   task->ConnectOutput(1, mgr->CreateContainer(Form("HFE_Results_%s", appendix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()));
161   task->ConnectOutput(2, mgr->CreateContainer(Form("HFE_QA_%s", appendix.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, containerName.Data()));
162   mgr->ConnectInput(task,  0, cinput );
163
164   mgr->AddTask(task);
165
166   return NULL;
167 }