]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/macros/AddTaskHFEtpctofPbPb.C
Next lego train
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / AddTaskHFEtpctofPbPb.C
1 AliAnalysisTask *AddTaskHFEtpctofPbPb(Bool_t isaod, Bool_t isMC,Int_t aodfilter=-1, Int_t tpcCls=120,  Int_t tpcClsPID = 80, Double_t tpcClsRatio = 0.6, Double_t tpcClShared = 1.1, Int_t itsCls=4,Double_t itsChi2PerClusters=36.,Int_t itspixelcut=AliHFEextraCuts::kBoth, Double_t dcaxy=1.0, Double_t dcaz=2.0, Bool_t usetof=kFALSE, Double_t tofs=3.,Bool_t etacor=kFALSE,TString listname="",Double_t tpceff=0.5, Float_t prodlow=0., Float_t prodhigh=100.,Bool_t kMCQA = kFALSE){
2
3   // libraries in case
4   gSystem->Load("libANALYSIS.so");
5   gSystem->Load("libANALYSISalice.so");
6
7
8   //set config file name
9   TString configFile("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C");
10   //TString configFile("/d/alice12/bailhache/AliRootInstallations/07_10_2012/AliRoot/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C");
11   TString checkconfig="ConfigHFEpbpb";
12   if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data()))
13     gROOT->LoadMacro(configFile.Data());
14
15   
16   // Name 
17   Int_t itpcClsRatio = (Int_t) (tpcClsRatio*10);
18   Int_t itpcClShared = (Int_t) (tpcClShared*10);
19   Int_t iitsChi2PerClusters = (Int_t) (itsChi2PerClusters*10);
20   Int_t idcaxy = (Int_t) (dcaxy*10);
21   Int_t idcaz = (Int_t) (dcaz*10);
22   Int_t itofs = (Int_t) (tofs*10);
23   Int_t iprodlow = (Int_t) (prodlow*10);
24   Int_t iprodhigh = (Int_t) (prodhigh*10);
25   Int_t itof = 0;
26   Int_t iMCQA = 0;
27   Int_t ietacor = 0;
28   Int_t itpceff = (Int_t) (tpceff*10);
29   if(usetof) itof=kTRUE;
30   if(kMCQA) iMCQA = 1;
31   if(etacor) ietacor = 1;
32   
33   TString appendix(TString::Format("f%dt%dtp%dtr%dts%di%dic%di%ddcaxy%dz%dtof%dts%de%dtpc%dprodlow%dhigh%dmc%d",aodfilter,tpcCls,tpcClsPID,itpcClsRatio,itpcClShared,itsCls,iitsChi2PerClusters,itspixelcut,idcaxy,idcaz,itof,itofs,ietacor,itpceff,iprodlow,iprodhigh,iMCQA));
34   printf("appendix %s\n", appendix.Data());
35   
36
37   // ESD or AOD
38   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
39   if (!mgr->GetInputEventHandler()) {
40     printf("AddTaskEventplane", "This task requires an input event handler");
41     return NULL;
42   }
43   TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
44   Bool_t isaod = kFALSE;
45   if (inputDataType == "AOD") isaod = kTRUE;
46
47   
48   // TPC cut
49   // 0-5,5-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80,80-90,90-100,one more per history
50   // http://www.physi.uni-heidelberg.de/~pachmay/projects/hfe/pid/tpc/
51   // without eta correction 50%
52   Double_t tpcdEdxcutlow[12] = {0.03,0.15,0.24,0.3,0.39,0.48,0.5,0.51,0.5,0.5,0.5,0.5};
53   // with eta correction 50%
54   // Double_t tpcdEdxcutlow[12] = {-0.01,0.076,0.197,0.26,0.298,0.3,0.3,0.3,0.3,0.3,0.3,0.3};
55   Double_t tpcdEdxcuthigh[12] = {3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
56
57
58   // Task
59   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
60   AliAnalysisTaskHFE *task = ConfigHFEpbpb(isaod,isMC,appendix,aodfilter,tpcCls,tpcClsPID,tpcClsRatio,tpcClShared,itsCls,itsChi2PerClusters,itspixelcut,dcaxy,dcaz,usetof,tofs,etacor,listname,tpcdEdxcutlow,tpcdEdxcuthigh,prodlow,prodhigh,kMCQA);  
61
62   mgr->AddTask(task);
63
64
65   // Write Output 
66   TString containerName = mgr->GetCommonFileName();
67   containerName += ":";
68   containerName += appendix.Data();
69
70   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
71   mgr->ConnectOutput(task,1, mgr->CreateContainer(Form("HFE_Results_%s", appendix.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,containerName.Data()));
72   mgr->ConnectOutput(task,2, mgr->CreateContainer(Form("HFE_QA_%s", appendix.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,containerName.Data()));
73   mgr->ConnectInput(task,0, cinput );    
74
75   return NULL;
76   
77 }