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