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