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