AliPhysics  e59a9ba (e59a9ba)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 storeNsparse=kFALSE,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  dsTask->SetFillNSparse(storeNsparse);
55  mgr->AddTask(dsTask);
56 
57  // Create containers for input/output
58  TString name="cinputDs";
59  name+=postname;
60  AliAnalysisDataContainer *cinputDs = mgr->CreateContainer(name,TChain::Class(),
61  AliAnalysisManager::kInputContainer);
62  TString outputfile = AliAnalysisManager::GetCommonFileName();
63  outputfile += ":PWG3_D2H_InvMassDs";
64  outputfile+=postname;
65 
66  name="coutputDsCuts"; name+=postname;
67  AliAnalysisDataContainer *coutputDsCuts = mgr->CreateContainer(name,TList::Class(),
68  AliAnalysisManager::kOutputContainer,
69  outputfile.Data());
70 
71  name="coutputDs"; name+=postname;
72  AliAnalysisDataContainer *coutputDs = mgr->CreateContainer(name,TList::Class(),
73  AliAnalysisManager::kOutputContainer,
74  outputfile.Data());
75  name="coutputDsNorm"; name+=postname;
76  AliAnalysisDataContainer *coutputDsNorm = mgr->CreateContainer(name,AliNormalizationCounter::Class(),
77  AliAnalysisManager::kOutputContainer,
78  outputfile.Data());
79 
80  name="coutputDs2"; name+=postname;
81  if(storeNtuple){
82  AliAnalysisDataContainer *coutputDs2 = mgr->CreateContainer(name,TNtuple::Class(),
83  AliAnalysisManager::kOutputContainer,
84  outputfile.Data());
85  coutputDs2->SetSpecialOutput();
86  }
87 
88  mgr->ConnectInput(dsTask,0,mgr->GetCommonInputContainer());
89 
90  mgr->ConnectOutput(dsTask,1,coutputDs);
91 
92  mgr->ConnectOutput(dsTask,2,coutputDsCuts);
93 
94  mgr->ConnectOutput(dsTask,3,coutputDsNorm);
95 
96  if(storeNtuple){
97  mgr->ConnectOutput(dsTask,4,coutputDs2);
98  }
99 
100  return dsTask;
101 }
AliAnalysisTaskSEDs * AddTaskDs(Int_t system=0, Int_t storeNtuple=0, Bool_t storeNsparse=kFALSE, Bool_t readMC=kFALSE, TString filename="", TString postname="")
Definition: AddTaskDs.C:1
void SetUseSelectionBit(Bool_t opt=kFALSE)
virtual void SetStandardCutsPP2010()
void SetReadMC(Bool_t readMC=kTRUE)
void SetFillNSparse(Bool_t fill=kTRUE)