AliPhysics  c7b8e89 (c7b8e89)
AddTaskDmesonPIDSysProp.C
Go to the documentation of this file.
3  TString cutfilename = "",
4  TString cutobjname = "AnalysisCuts",
5  TString PIDsystfilename = "",
6  TString postname = "")
7 {
8 
9  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10  if (!mgr) {
11  ::Error("AddTask", "No analysis manager to connect to.");
12  }
13 
14  // Check the analysis type using the event handlers connected to the analysis manager.
15  //==============================================================================
16  if (!mgr->GetInputEventHandler()) {
17  ::Error("AddTaskImpParDistrib", "This task requires an input event handler");
18  return NULL;
19  }
20 
21 
22  Bool_t stdcuts=kFALSE;
23  TFile* filecuts = NULL;
24  if( cutfilename.EqualTo("") ) {
25  stdcuts=kTRUE;
26  }
27  else {
28  filecuts=TFile::Open(cutfilename.Data());
29  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
30  ::Fatal("AddTaskSingleTrackPIDSysPropagation", "Cut object not found: analysis will not start!\n");
31  }
32  else printf("Cut object correctly found\n");
33  }
34 
35  //Analysis Task
36  AliRDHFCuts* analysiscuts = (AliRDHFCuts*)filecuts->Get(cutobjname.Data());
37  if(analysiscuts) Printf("Cut file found!");
38 
39  AliAnalysisTaskSEDmesonPIDSysProp *Task = new AliAnalysisTaskSEDmesonPIDSysProp(ch, analysiscuts, PIDsystfilename);
40  Task->SetDebugLevel(1);
41  Task->SetPIDStrategy(pid);
42  mgr->AddTask(Task);
43 
44  // Create containers for input/output
45  TString mesonname = "";
46  if(ch == AliAnalysisTaskSEDmesonPIDSysProp::kD0toKpi) mesonname = "D0";
47  else if(ch == AliAnalysisTaskSEDmesonPIDSysProp::kDplustoKpipi) mesonname = "Dplus";
48  else if(ch == AliAnalysisTaskSEDmesonPIDSysProp::kDstartoKpipi) mesonname = "Dstar";
49  else if(ch == AliAnalysisTaskSEDmesonPIDSysProp::kDstoKKpi) mesonname = "Ds";
50  TString PIDname = "";
51  if(pid == AliAnalysisTaskSEDmesonPIDSysProp::kStrongPID) PIDname = "strongPID";
52  else if(pid == AliAnalysisTaskSEDmesonPIDSysProp::kConservativePID) PIDname = "conservativePID";
53  else if(pid == AliAnalysisTaskSEDmesonPIDSysProp::knSigmaPID) PIDname = "nSigmaPID";
54 
55  TString outputFileName = AliAnalysisManager::GetCommonFileName();
56  outputFileName += Form(":PWGHF_D2H_PIDeffsyst_%s_%s_%s",mesonname.Data(),PIDname.Data(),postname.Data());
57 
58  AliAnalysisDataContainer *coutput =0x0;
59  coutput = mgr->CreateContainer(Form("systUnc_%s_%s_%s",mesonname.Data(),PIDname.Data(),postname.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName );
60 
61  mgr->ConnectInput(Task,0,mgr->GetCommonInputContainer());
62  mgr->ConnectOutput(Task,1,coutput);
63 
64  return Task;
65 }
AliAnalysisTaskSEDmesonPIDSysProp * AddTaskDmesonPIDSysProp(int ch=AliAnalysisTaskSEDmesonPIDSysProp::kDstoKKpi, int pid=AliAnalysisTaskSEDmesonPIDSysProp::kStrongPID, TString cutfilename="", TString cutobjname="AnalysisCuts", TString PIDsystfilename="", TString postname="")
bool Bool_t
Definition: External.C:53