AliPhysics  master (3d17d9d)
AddTaskDs.C
Go to the documentation of this file.
1 AliAnalysisTaskSEDs *AddTaskDs(Int_t system = AliAnalysisTaskSEDs::kpp, Bool_t readMC = kFALSE, Int_t AODProtection = 1,
2  Bool_t storeNsparse = kFALSE, TString filename = "", TString postname = "", Bool_t createMLtree = kFALSE,
3  Bool_t applyML = kFALSE, TString confFileML = "", TString cutObjName = "AnalysisCuts",
4  Bool_t storeNsparseDplus = kFALSE, Bool_t doCutVarHistos = kFALSE, Bool_t storeNsparseImpPar = kFALSE)
5 {
6  // AddTask for AliAnalysisTaskSEDs
7  // Origin: R. Bala, bala@to.infn.it
8  // Modified for Ds meson: G.M. Innocenti innocent@to.infn.it
9  // Mantainers: F. Catalano, fabio.catalano@cern.ch
10  // F. Grosa, fabrizio.grosa@cern.ch
11  //==============================================================================
12 
13  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14  if (!mgr)
15  ::Error("AddTaskDs", "No analysis manager to connect to.");
16 
17  TFile* filecuts = TFile::Open(filename.Data());
18  if(!filecuts || (filecuts && !filecuts->IsOpen()))
19  ::Fatal("AddTaskDs", "Cut file not found on Grid: analysis will not start!\n");
20  else
21  printf("Cut file correctly found\n");
22 
23  //Analysis Task
24  AliRDHFCutsDstoKKpi* analysiscuts = new AliRDHFCutsDstoKKpi();
25  analysiscuts = (AliRDHFCutsDstoKKpi*)filecuts->Get(cutObjName.Data());
26  if (!analysiscuts){
27  ::Fatal("AddTaskDs", "Cut object not found in cutfile");
28  return NULL;
29  }
30 
31  AliAnalysisTaskSEDs *dsTask = new AliAnalysisTaskSEDs("DsAnalysis", analysiscuts, createMLtree);
32  dsTask->SetDebugLevel(0);
33  dsTask->SetUseSelectionBit(kTRUE);
34  dsTask->SetSystem(system);
35  dsTask->SetReadMC(readMC);
36  dsTask->SetAODMismatchProtection(AODProtection);
37  dsTask->SetFillNSparse(storeNsparse);
38  if(createMLtree && readMC)
39  dsTask->SetFillOnlySignalInMLtree();
40  dsTask->SetDoMLApplication(applyML);
41  if(applyML)
42  dsTask->SetMLConfigFile(confFileML);
43  dsTask->SetFillNSparseDplus(storeNsparseDplus);
44  dsTask->SetDoCutVarHistos(doCutVarHistos);
45  dsTask->SetFillNSparseImpPar(storeNsparseImpPar);
46  if(system == AliAnalysisTaskSEDs::kPbPb || system == AliAnalysisTaskSEDs::kUpgr)
47  dsTask->SetKeepOnlyBkgFromHIJING(kTRUE);
48 
49  mgr->AddTask(dsTask);
50 
51  // Create containers for input/output
52  TString name = Form("cinputDs%s", postname.Data());
53  AliAnalysisDataContainer *cinputDs = mgr->CreateContainer(name, TChain::Class(), AliAnalysisManager::kInputContainer);
54  TString outputfile = AliAnalysisManager::GetCommonFileName();
55  outputfile += ":PWGHF_D2H_InvMassDs";
56  outputfile += postname.Data();
57 
58  name = Form("coutputDsCuts%s", postname.Data());
59  AliAnalysisDataContainer *coutputDsCuts = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer,
60  outputfile.Data());
61 
62  name = Form("coutputDs%s", postname.Data());
63  AliAnalysisDataContainer *coutputDs = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer,
64  outputfile.Data());
65 
66  name = Form("coutputDsNorm%s", postname.Data());
67  AliAnalysisDataContainer *coutputDsNorm = mgr->CreateContainer(name, AliNormalizationCounter::Class(), AliAnalysisManager::kOutputContainer,
68  outputfile.Data());
69 
70  AliAnalysisDataContainer *coutputDsML = nullptr;
71  if(createMLtree) {
72  name = Form("coutputDsML%s", postname.Data());
73  coutputDsML = mgr->CreateContainer(name, TTree::Class(), AliAnalysisManager::kOutputContainer, outputfile.Data());
74  }
75 
76  mgr->ConnectInput(dsTask, 0, mgr->GetCommonInputContainer());
77  mgr->ConnectOutput(dsTask, 1, coutputDs);
78  mgr->ConnectOutput(dsTask, 2, coutputDsCuts);
79  mgr->ConnectOutput(dsTask, 3, coutputDsNorm);
80  if(createMLtree)
81  mgr->ConnectOutput(dsTask, 4, coutputDsML);
82 
83  return dsTask;
84 }
const char * filename
Definition: TestFCM.C:1
AliAnalysisTaskSEDs * AddTaskDs(Int_t system=AliAnalysisTaskSEDs::kpp, Bool_t readMC=kFALSE, Int_t AODProtection=1, Bool_t storeNsparse=kFALSE, TString filename="", TString postname="", Bool_t createMLtree=kFALSE, Bool_t applyML=kFALSE, TString confFileML="", TString cutObjName="AnalysisCuts", Bool_t storeNsparseDplus=kFALSE, Bool_t doCutVarHistos=kFALSE, Bool_t storeNsparseImpPar=kFALSE)
Definition: AddTaskDs.C:1
int Int_t
Definition: External.C:63
bool Bool_t
Definition: External.C:53