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