AliPhysics  ff07904 (ff07904)
AddTaskHFTreeCreator.C
Go to the documentation of this file.
2  Int_t system=1/*0=pp,1=PbPb*/,
3  TString finDirname="HFTreeCreator",
4  TString cutsfile="",
5  /*Float_t minC=0., Float_t maxC=100.,*/
6  Int_t AODProtection = 1,
7  Bool_t writeOnlySignalTree=kFALSE,
8  Int_t fillTreeD0=1,
9  Int_t fillTreeDs=1,
10  Int_t fillTreeDplus=1,
14 {
15  //
16  //
17 
18 
19  // Get the pointer to the existing analysis manager via the static access method.
20  //==============================================================================
21  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
22  if (!mgr) {
23  ::Error("AddTaskD0Distr", "No analysis manager to connect to.");
24  return NULL;
25  }
26 
27  //getting the cuts
28  TFile* filecuts;
29  if( cutsfile.EqualTo("") ) {
30  ::Fatal("AddTaskHFTreeCreator", "Input file not provided");
31  } else {
32  filecuts=TFile::Open(cutsfile.Data());
33  if(!filecuts || (filecuts && !filecuts->IsOpen())){
34  ::Fatal("AddTaskHFTreeCreator", "Input file not found : check your cut object");
35  }
36  }
37 
38  AliRDHFCutsD0toKpi* looseCutsD0toKpi =(AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiFilteringCuts");
39  if(!looseCutsD0toKpi) ::Fatal("AddTaskHFTreeCreator", "looseCutsD0toKpi : check your cut file");
40  AliRDHFCutsDstoKKpi* looseCutsDstoKKpi =(AliRDHFCutsDstoKKpi*)filecuts->Get("DstoKKpiFilteringCuts");
41  if(!looseCutsDstoKKpi) ::Fatal("AddTaskHFTreeCreator", "looseCutsDstoKKpi : check your cut file");
42  AliRDHFCutsDplustoKpipi* looseCutsDplustoKpipi =(AliRDHFCutsDplustoKpipi*)filecuts->Get("DplustoKpipiFilteringCuts");
43  if(!looseCutsDplustoKpipi) ::Fatal("AddTaskHFTreeCreator", "looseCutsDplustoKpipi : check your cut file");
44  AliRDHFCutsD0toKpi* analysisCutsD0toKpi =(AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiAnalysisCuts");
45  if(!analysisCutsD0toKpi) ::Fatal("AddTaskHFTreeCreator", "analysisCutsD0toKpi : check your cut file");
46  AliRDHFCutsDstoKKpi* analysisCutsDstoKKpi =(AliRDHFCutsDstoKKpi*)filecuts->Get("DstoKKpiAnalysisCuts");
47  if(!analysisCutsDstoKKpi) ::Fatal("AddTaskHFTreeCreator", "analysisCutsDstoKKpi : check your cut file");
48  AliRDHFCutsDplustoKpipi* analysisCutsDplustoKpipi=(AliRDHFCutsDplustoKpipi*)filecuts->Get("DplustoKpipiAnalysisCuts");
49  if(!analysisCutsDplustoKpipi) ::Fatal("AddTaskHFTreeCreator", "analysisCutsDplustoKpipi : check your cut file");
50 
51  TList *cutsList=new TList();
52  cutsList->SetOwner(kTRUE);
53  cutsList->SetName("cut_objects");
54  cutsList->Add(looseCutsD0toKpi);
55  cutsList->Add(looseCutsDstoKKpi);
56  cutsList->Add(looseCutsDplustoKpipi);
57  cutsList->Add(analysisCutsD0toKpi);
58  cutsList->Add(analysisCutsDstoKKpi);
59  cutsList->Add(analysisCutsDplustoKpipi);
60 
61  AliAnalysisTaskSEHFTreeCreator *task = new AliAnalysisTaskSEHFTreeCreator("TreeCreatorTask",cutsList);
62 
63  task->SetReadMC(readMC);
64  task->SetSystem(system);
65  task->SetAODMismatchProtection(AODProtection);
66  task->SetWriteOnlySignalTree(writeOnlySignalTree);
67  task->SetFillD0Tree(fillTreeD0);
68  task->SetFillDsTree(fillTreeDs);
69  task->SetFillDplusTree(fillTreeDplus);
70  task->SetPIDoptD0Tree(pidOptD0);
71  task->SetPIDoptDsTree(pidOptDs);
72  task->SetPIDoptDplusTree(pidOptDplus);
73  //task->SetDebugLevel(4);
74 
75  mgr->AddTask(task);
76 
77  // Create containers for input/output
78 
79  TString inname = "cinput";
80  TString histoname = "coutputEntries";
81  TString cutsname = "coutputCuts";
82  TString normname = "coutputNorm";
83  TString treename = "coutputTree";
84 
85  inname += finDirname.Data();
86  histoname += finDirname.Data();
87  cutsname += finDirname.Data();
88  normname += finDirname.Data();
89  treename += finDirname.Data();
90 
91 
92 
93  AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(),AliAnalysisManager::kInputContainer);
94  TString outputfile = AliAnalysisManager::GetCommonFileName();
95  outputfile += ":PWGHF_TreeCreator";
96 
97  AliAnalysisDataContainer *coutputEntries = mgr->CreateContainer(histoname,TH1F::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
98  AliAnalysisDataContainer *coutputCuts = mgr->CreateContainer(cutsname,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
99  AliAnalysisDataContainer *coutputNorm = mgr->CreateContainer(normname,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
100  AliAnalysisDataContainer *coutputTree = mgr->CreateContainer(treename,TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
101 
102 
103  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
104  mgr->ConnectOutput(task,1,coutputEntries);
105  mgr->ConnectOutput(task,2,coutputCuts);
106  mgr->ConnectOutput(task,3,coutputNorm);
107  mgr->ConnectOutput(task,4,coutputTree);
108 
109  return task;
110 
111 
112 
113 }
114 
AliAnalysisTaskSEHFTreeCreator * AddTaskHFTreeCreator(Bool_t readMC=kTRUE, Int_t system=1, TString finDirname="HFTreeCreator", TString cutsfile="", Int_t AODProtection=1, Bool_t writeOnlySignalTree=kFALSE, Int_t fillTreeD0=1, Int_t fillTreeDs=1, Int_t fillTreeDplus=1, Int_t pidOptD0=AliHFCutOptTreeHandler::kNoPID, Int_t pidOptDs=AliHFCutOptTreeHandler::kNsigmaPIDchar, Int_t pidOptDplus=AliHFCutOptTreeHandler::kNsigmaPIDchar)
Class for cuts on AOD reconstructed D+->Kpipi.
int Int_t
Definition: External.C:63
bool Bool_t
Definition: External.C:53