AliPhysics  vAN-20150827 (3e81cbb)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskDs.C
Go to the documentation of this file.
1 AliAnalysisTaskSEDs *AddTaskDs(Int_t system=0/*0=pp,1=PbPb*/,
2  Int_t storeNtuple=0,Bool_t readMC=kFALSE,
3  TString filename="", TString postname="")
4 {
5  //
6  // Test macro for the AliAnalysisTaskSE for Ds candidates
7 
8  //Invariant mass histogram and
9  // association with MC truth (using MC info in AOD)
10  // Origin: R. Bala, bala@to.infn.it
11  // Modified for Ds meson: G.M. Innocenti innocent@to.infn.it
12  // Get the pointer to the existing analysis manager via the static access method.
13  //==============================================================================
14 
15  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
16  if (!mgr) {
17  ::Error("AddTaskDs", "No analysis manager to connect to.");
18  }
19 
20  Bool_t stdcuts=kFALSE;
21  TFile* filecuts;
22  if( filename.EqualTo("") ) {
23  stdcuts=kTRUE;
24  } else {
25  filecuts=TFile::Open(filename.Data());
26  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
27  AliFatal("Cut object not found: analysis will not start!\n");
28  }
29  else printf("Cut object correctly found\n");
30  }
31 
32  //Analysis Task
33 
34  AliRDHFCutsDstoKKpi* analysiscuts=new AliRDHFCutsDstoKKpi();
35 
36  if(stdcuts) {
37  if(system==0) {
38  printf("Cut object not found: standard pp cut object used\n");
39  analysiscuts->SetStandardCutsPP2010();
40  }
41  else AliFatal("Standard cut object not available for PbPb: analysis will not start!\n");
42  }
43  else analysiscuts = (AliRDHFCutsDstoKKpi*)filecuts->Get("AnalysisCuts");
44 
45  AliAnalysisTaskSEDs *dsTask = new AliAnalysisTaskSEDs("DsAnalysis",analysiscuts,storeNtuple);
46 
47  dsTask->SetReadMC(readMC);
48  //dsTask->SetDoLikeSign(kTRUE);
49  // dsTask->SetUseTPCpid(kTRUE);
50  //dsTask->SetUseTOFpid(kTRUE);
51  dsTask->SetDebugLevel(0);
52  dsTask->SetUseSelectionBit(kTRUE);
53  //dsTask->SetMassLimits(0.2);
54  mgr->AddTask(dsTask);
55 
56  // Create containers for input/output
57  TString name="cinputDs";
58  name+=postname;
59  AliAnalysisDataContainer *cinputDs = mgr->CreateContainer(name,TChain::Class(),
60  AliAnalysisManager::kInputContainer);
61  TString outputfile = AliAnalysisManager::GetCommonFileName();
62  outputfile += ":PWG3_D2H_InvMassDs";
63  outputfile+=postname;
64 
65  name="coutputDsCuts"; name+=postname;
66  AliAnalysisDataContainer *coutputDsCuts = mgr->CreateContainer(name,TList::Class(),
67  AliAnalysisManager::kOutputContainer,
68  outputfile.Data());
69 
70  name="coutputDs"; name+=postname;
71  AliAnalysisDataContainer *coutputDs = mgr->CreateContainer(name,TList::Class(),
72  AliAnalysisManager::kOutputContainer,
73  outputfile.Data());
74  name="coutputDsNorm"; name+=postname;
75  AliAnalysisDataContainer *coutputDsNorm = mgr->CreateContainer(name,AliNormalizationCounter::Class(),
76  AliAnalysisManager::kOutputContainer,
77  outputfile.Data());
78 
79  name="coutputDs2"; name+=postname;
80  if(storeNtuple){
81  AliAnalysisDataContainer *coutputDs2 = mgr->CreateContainer(name,TNtuple::Class(),
82  AliAnalysisManager::kOutputContainer,
83  outputfile.Data());
84  coutputDs2->SetSpecialOutput();
85  }
86 
87  mgr->ConnectInput(dsTask,0,mgr->GetCommonInputContainer());
88 
89  mgr->ConnectOutput(dsTask,1,coutputDs);
90 
91  mgr->ConnectOutput(dsTask,2,coutputDsCuts);
92 
93  mgr->ConnectOutput(dsTask,3,coutputDsNorm);
94 
95  if(storeNtuple){
96  mgr->ConnectOutput(dsTask,4,coutputDs2);
97  }
98 
99  return dsTask;
100 }
void SetUseSelectionBit(Bool_t opt=kFALSE)
AliAnalysisTaskSEDs * AddTaskDs(Int_t system=0, Int_t storeNtuple=0, Bool_t readMC=kFALSE, TString filename="", TString postname="")
Definition: AddTaskDs.C:1
virtual void SetStandardCutsPP2010()
void SetReadMC(Bool_t readMC=kTRUE)