move macros to macros/
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskDplus.C
CommitLineData
3734af7b 1AliAnalysisTaskSEDplus *AddTaskDplus(Bool_t storeNtuple=kTRUE,
2fbaf745 2 Bool_t readMC=kTRUE)
d486095a 3{
4 //
4afc48a2 5 // Test macro for the AliAnalysisTaskSE for D+ candidates
d486095a 6
4afc48a2 7 //Invariant mass histogram and
8 // association with MC truth (using MC info in AOD)
9 // R. Bala, bala@to.infn.it
d486095a 10 // Get the pointer to the existing analysis manager via the static access method.
11 //==============================================================================
12 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13 if (!mgr) {
14 ::Error("AddTaskDplus", "No analysis manager to connect to.");
15 return NULL;
16 }
17
4c230f6d 18 //ptbins
19 const Int_t nptbins=4;
20 Float_t* ptbins;
21 ptbins=new Float_t[nptbins+1];
22 ptbins[0]=0.;
23 ptbins[1]=2.;
24 ptbins[2]=3.;
25 ptbins[3]=5.;
26 ptbins[4]=99999.;
27 const Int_t nvars=12;
d486095a 28
4c230f6d 29
30
31
32 Float_t** prodcutsval;
33 prodcutsval=new Float_t*[nvars];
34 for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
35 for(Int_t ipt=0;ipt<nptbins;ipt++){
36 prodcutsval[0][ipt]=0.2;
37 prodcutsval[1][ipt]=0.4;
38 prodcutsval[2][ipt]=0.4;
39 prodcutsval[3][ipt]=0.;
40 prodcutsval[4][ipt]=0.;
3734af7b 41 prodcutsval[5][ipt]=0.01;
42 prodcutsval[6][ipt]=0.06;
4c230f6d 43 prodcutsval[7][ipt]=0.02;
44 prodcutsval[8][ipt]=0.;
45 prodcutsval[9][ipt]=0.85;
46 prodcutsval[10][ipt]=0.;
47 prodcutsval[11][ipt]=10000000.0;
48
49 }
50
51
52
53 Float_t** anacutsval;
54 anacutsval=new Float_t*[nvars];
55 for(Int_t ic=0;ic<nvars;ic++){anacutsval[ic]=new Float_t[nptbins];}
56 //Double_t cutsDplus[12]={0.2,0.4,0.4,0.,0.,0.01,0.06,0.02,0.,0.85,0.,10000000000.};
57 Int_t ic=0;
58 for(Int_t ipt=0;ipt<nptbins;ipt++){
59 anacutsval[ic][ipt]=0.2;
60 }
61 Int_t ic=1;
62 for(Int_t ipt=0;ipt<nptbins;ipt++){
63 anacutsval[ic][ipt]=0.4;
64 }
65 Int_t ic=2;
66 for(Int_t ipt=0;ipt<nptbins;ipt++){
67 anacutsval[ic][ipt]=0.4;
68 }
69 Int_t ic=3;
70 for(Int_t ipt=0;ipt<nptbins;ipt++){
71 anacutsval[ic][ipt]=0.;
72 }
73 Int_t ic=4;
74 for(Int_t ipt=0;ipt<nptbins;ipt++){
75 anacutsval[ic][ipt]=0.;
76 }
77 Int_t ic=5;
78 for(Int_t ipt=0;ipt<nptbins;ipt++){
79 anacutsval[ic][ipt]=0.01;
80 }
81 Int_t ic=11;
82 for(Int_t ipt=0;ipt<nptbins;ipt++){
83 anacutsval[ic][ipt]=10000000000.;
84 }
85 anacutsval[6][0]=0.022100;
86 anacutsval[6][1]=0.034;
87 anacutsval[6][2]=0.020667;
88 anacutsval[6][3]=0.023333;
89
90 anacutsval[7][0]=0.08;
91 anacutsval[7][1]=0.09;
92 anacutsval[7][2]=0.095;
93 anacutsval[7][3]=0.115;
94
95 anacutsval[8][0]=0.5;
96 anacutsval[8][1]=1.0;
97 anacutsval[8][2]=0.5;
98 anacutsval[8][3]=0.5;
99
100 anacutsval[9][0]=0.979;
101 anacutsval[9][1]=0.9975;
102 anacutsval[9][2]=0.995;
103 anacutsval[9][3]=0.9975;
104
105 anacutsval[10][0]=0.0055;
106 anacutsval[10][1]=0.0028;
107 anacutsval[10][2]=0.000883;
108 anacutsval[10][3]=0.000883;
109
110
111
112
113//Production cuts
114
115 AliRDHFCutsDplustoKpipi *prodcuts = new AliRDHFCutsDplustoKpipi();
116 prodcuts->SetPtBins(nptbins+1,ptbins);
117 prodcuts->SetCuts(nvars,nptbins,prodcutsval);
118
119 //Analysis cuts
120 AliRDHFCutsDplustoKpipi *analysiscuts = new AliRDHFCutsDplustoKpipi();
121 analysiscuts->SetPtBins(nptbins+1,ptbins);
122 analysiscuts->SetCuts(nvars,nptbins,anacutsval);
123
124
125 // Aanalysis task
126 AliAnalysisTaskSEDplus *dplusTask = new AliAnalysisTaskSEDplus("DplusAnalysis",analysiscuts,prodcuts,storeNtuple);
2fbaf745 127 dplusTask->SetReadMC(readMC);
4afc48a2 128 dplusTask->SetDoLikeSign(kTRUE);
3b1598da 129 dplusTask->SetDebugLevel(0);
4c230f6d 130
d486095a 131 mgr->AddTask(dplusTask);
132
4c230f6d 133 // Create containers for input/output
134
41ff2555 135 AliAnalysisDataContainer *cinputDplus = mgr->CreateContainer("cinputDplus",TChain::Class(),
d486095a 136 AliAnalysisManager::kInputContainer);
34dc24ce 137 TString outputfile = AliAnalysisManager::GetCommonFileName();
138 outputfile += ":PWG3_D2H_InvMassDplus";
4c230f6d 139
140 AliAnalysisDataContainer *coutputDplusCuts = mgr->CreateContainer("coutputDplusCuts",TList::Class(),
141 AliAnalysisManager::kOutputContainer,
142 outputfile.Data());
143
41ff2555 144 AliAnalysisDataContainer *coutputDplus = mgr->CreateContainer("coutputDplus",TList::Class(),
d486095a 145 AliAnalysisManager::kOutputContainer,
34dc24ce 146 outputfile.Data());
4c230f6d 147
1f4e9722 148 if(storeNtuple){
149 AliAnalysisDataContainer *coutputDplus2 = mgr->CreateContainer("coutputDplus2",TNtuple::Class(),
10bdd1ae 150 AliAnalysisManager::kOutputContainer,
2a5c77c6 151 "InvMassDplus_nt1.root");
4afc48a2 152
1f4e9722 153 coutputDplus2->SetSpecialOutput();
1f4e9722 154 }
d486095a 155 mgr->ConnectInput(dplusTask,0,mgr->GetCommonInputContainer());
156
41ff2555 157 mgr->ConnectOutput(dplusTask,1,coutputDplus);
4c230f6d 158
159 mgr->ConnectOutput(dplusTask,2,coutputDplusCuts);
1f4e9722 160
161 if(storeNtuple){
4c230f6d 162 mgr->ConnectOutput(dplusTask,3,coutputDplus2);
1f4e9722 163 }
d486095a 164 return dplusTask;
165}