]>
Commit | Line | Data |
---|---|---|
32bb35a1 | 1 | //DEFINITION OF A FEW CONSTANTS |
2 | const Double_t ymin = -2.0 ; | |
3 | const Double_t ymax = 2.0 ; | |
4 | const Double_t ptmin_0_4 = 0.0 ; | |
5 | const Double_t ptmax_0_4 = 4.0 ; | |
6 | const Double_t ptmin_4_8 = 4.0 ; | |
7 | const Double_t ptmax_4_8 = 8.0 ; | |
8 | const Double_t ptmin_8_10 = 8.0 ; | |
9 | const Double_t ptmax_8_10 = 10.0 ; | |
10 | const Double_t cosmin = -1.; | |
11 | const Double_t cosmax = 1.; | |
12 | const Double_t cTmin = 0; // micron | |
13 | const Double_t cTmax = 500; // micron | |
14 | const Int_t mintrackrefsTPC = 2 ; | |
15 | const Int_t mintrackrefsITS = 3 ; | |
16 | const Int_t charge = 1 ; | |
17 | const Int_t PDG = 421; | |
18 | const Int_t minclustersTPC = 50 ; | |
19 | //---------------------------------------------------- | |
20 | ||
21 | AliCFHeavyFlavourTaskMultiVar *AddTaskCFMultiVar() | |
22 | { | |
23 | ||
24 | //CONTAINER DEFINITION | |
25 | Info("AliCFHeavyFlavourTaskMultiVar","SETUP CONTAINER"); | |
26 | //the sensitive variables (6 in this example), their indices | |
27 | UInt_t ipt = 0; | |
28 | UInt_t iy = 1; | |
29 | UInt_t icosThetaStar = 2; | |
30 | UInt_t ipTpi = 3; | |
31 | UInt_t ipTk = 4; | |
32 | UInt_t icT = 5; | |
33 | //Setting up the container grid... | |
34 | UInt_t nstep = 2 ; //number of selection steps MC | |
35 | const Int_t nvar = 6 ; //number of variables on the grid:pt, y, cosThetaStar, pTpi, pTk, cT | |
36 | const Int_t nbin0_0_4 = 8 ; //bins in pt from 0 to 4 GeV | |
37 | const Int_t nbin0_4_8 = 4 ; //bins in pt from 4 to 8 GeV | |
38 | const Int_t nbin0_8_10 = 1 ; //bins in pt from 8 to 10 GeV | |
39 | const Int_t nbin1 = 8 ; //bins in y | |
40 | const Int_t nbin2 = 8 ; //bins in cosThetaStar | |
41 | const Int_t nbin3_0_4 = 8 ; //bins in ptPi from 0 to 4 GeV | |
42 | const Int_t nbin3_4_8 = 4 ; //bins in ptPi from 4 to 8 GeV | |
43 | const Int_t nbin3_8_10 = 1 ; //bins in ptPi from 8 to 10 GeV | |
44 | const Int_t nbin4_0_4 = 8 ; //bins in ptKa from 0 to 4 GeV | |
45 | const Int_t nbin4_4_8 = 4 ; //bins in ptKa from 4 to 8 GeV | |
46 | const Int_t nbin4_8_10 = 1 ; //bins in ptKa from 8 to 10 GeV | |
47 | const Int_t nbin5 = 24 ; //bins in cT | |
48 | ||
49 | //arrays for the number of bins in each dimension | |
50 | Int_t iBin[nvar]; | |
51 | iBin[0]=nbin0_0_4+nbin0_4_8+nbin0_8_10; | |
52 | iBin[1]=nbin1; | |
53 | iBin[2]=nbin2; | |
54 | iBin[3]=nbin3_0_4+nbin3_4_8+nbin3_8_10; | |
55 | iBin[4]=nbin4_0_4+nbin4_4_8+nbin4_8_10; | |
56 | iBin[5]=nbin5; | |
57 | ||
58 | //arrays for lower bounds : | |
59 | Double_t *binLim0=new Double_t[iBin[0]+1]; | |
60 | Double_t *binLim1=new Double_t[iBin[1]+1]; | |
61 | Double_t *binLim2=new Double_t[iBin[2]+1]; | |
62 | Double_t *binLim3=new Double_t[iBin[3]+1]; | |
63 | Double_t *binLim4=new Double_t[iBin[4]+1]; | |
64 | Double_t *binLim5=new Double_t[iBin[5]+1]; | |
65 | ||
66 | // checking limits | |
67 | if (ptmax_0_4 != ptmin_4_8) { | |
68 | Error("AliCFHeavyFlavourTaskMultiVar","max lim 1st range != min lim 2nd range, please check!"); | |
69 | } | |
70 | if (ptmax_4_8 != ptmin_8_10) { | |
71 | Error("AliCFHeavyFlavourTaskMultiVar","max lim 2nd range != min lim 3rd range, please check!"); | |
72 | } | |
73 | ||
74 | // values for bin lower bounds | |
75 | // pt | |
76 | for(Int_t i=0; i<=nbin0_0_4; i++) binLim0[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbin0_0_4*(Double_t)i ; | |
77 | if (binLim0[nbin0_0_4] != ptmin_4_8) { | |
78 | Error("AliCFHeavyFlavourTaskMultiVar","Calculated bin lim for pt - 1st range - differs from expected!\n"); | |
79 | } | |
80 | for(Int_t i=0; i<=nbin0_4_8; i++) binLim0[i+nbin0_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbin0_4_8*(Double_t)i ; | |
81 | if (binLim0[nbin0_0_4+nbin0_4_8] != ptmin_8_10) { | |
82 | Error("AliCFHeavyFlavourTaskMultiVar","Calculated bin lim for pt - 2nd range - differs from expected!\n"); | |
83 | } | |
84 | for(Int_t i=0; i<=nbin0_8_10; i++) binLim0[i+nbin0_0_4+nbin0_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbin0_8_10*(Double_t)i ; | |
85 | ||
86 | // y | |
87 | for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ymin + (ymax-ymin) /nbin1*(Double_t)i ; | |
88 | ||
89 | // cosThetaStar | |
90 | for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)cosmin + (cosmax-cosmin) /nbin2*(Double_t)i ; | |
91 | ||
92 | // ptPi | |
93 | for(Int_t i=0; i<=nbin3_0_4; i++) binLim3[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbin3_0_4*(Double_t)i ; | |
94 | if (binLim3[nbin3_0_4] != ptmin_4_8) { | |
95 | Error("AliCFHeavyFlavourTaskMultiVar","Calculated bin lim for ptPi - 1st range - differs from expected!"); | |
96 | } | |
97 | for(Int_t i=0; i<=nbin3_4_8; i++) binLim3[i+nbin3_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbin3_4_8*(Double_t)i ; | |
98 | if (binLim3[nbin3_0_4+nbin3_4_8] != ptmin_8_10) { | |
99 | Error("AliCFHeavyFlavourTaskMultiVar","Calculated bin lim for ptPi - 2nd range - differs from expected!\n"); | |
100 | } | |
101 | for(Int_t i=0; i<=nbin3_8_10; i++) binLim3[i+nbin3_0_4+nbin3_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbin3_8_10*(Double_t)i ; | |
102 | ||
103 | // ptKa | |
104 | for(Int_t i=0; i<=nbin4_0_4; i++) binLim4[i]=(Double_t)ptmin_0_4 + (ptmax_0_4-ptmin_0_4)/nbin4_0_4*(Double_t)i ; | |
105 | if (binLim4[nbin4_0_4] != ptmin_4_8) { | |
106 | Error("AliCFHeavyFlavourTaskMultiVar","Calculated bin lim for ptKa - 1st range - differs from expected!"); | |
107 | } | |
108 | for(Int_t i=0; i<=nbin4_4_8; i++) binLim4[i+nbin4_0_4]=(Double_t)ptmin_4_8 + (ptmax_4_8-ptmin_4_8)/nbin4_4_8*(Double_t)i ; | |
109 | if (binLim4[nbin4_0_4+nbin4_4_8] != ptmin_8_10) { | |
110 | Error("AliCFHeavyFlavourTaskMultiVar","Calculated bin lim for ptKa - 2nd range - differs from expected!\n"); | |
111 | } | |
112 | for(Int_t i=0; i<=nbin4_8_10; i++) binLim4[i+nbin4_0_4+nbin4_4_8]=(Double_t)ptmin_8_10 + (ptmax_8_10-ptmin_8_10)/nbin4_8_10*(Double_t)i ; | |
113 | ||
114 | // cT | |
115 | for(Int_t i=0; i<=nbin5; i++) binLim5[i]=(Double_t)cTmin + (cTmax-cTmin) /nbin5*(Double_t)i ; | |
116 | ||
117 | Info("AliCFHeavyFlavourTaskMultiVar","Printing lower limits for bins in pt"); | |
118 | for (Int_t i =0; i<= iBin[0]; i++){ | |
119 | Info("AliCFHeavyFlavourTaskMultiVar",Form("i-th bin, lower limit = %f", binLim0[i])); | |
120 | } | |
121 | Info("Printing lower limits for bins in ptPi"); | |
122 | for (Int_t i =0; i<= iBin[3]; i++){ | |
123 | Info("AliCFHeavyFlavourTaskMultiVar",Form("i-th bin, lower limit = %f", binLim3[i])); | |
124 | } | |
125 | Info("Printing lower limits for bins in ptKa"); | |
126 | for (Int_t i =0; i<= iBin[4]; i++){ | |
127 | Info("AliCFHeavyFlavourTaskMultiVar",Form("i-th bin, lower limit = %f", binLim4[i])); | |
128 | } | |
129 | ||
130 | //one "container" for MC | |
131 | AliCFContainer* container = new AliCFContainer("container","container for tracks",nstep,nvar,iBin); | |
132 | //setting the bin limits | |
133 | container -> SetBinLimits(ipt,binLim0); | |
134 | container -> SetBinLimits(iy,binLim1); | |
135 | container -> SetBinLimits(icosThetaStar,binLim2); | |
136 | container -> SetBinLimits(ipTpi,binLim3); | |
137 | container -> SetBinLimits(ipTk,binLim4); | |
138 | container -> SetBinLimits(icT,binLim5); | |
139 | ||
140 | //CREATE THE CUTS ----------------------------------------------- | |
141 | ||
142 | // Gen-Level kinematic cuts | |
143 | AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts"); | |
144 | // mcKineCuts->SetPtRange(ptmin,ptmax); | |
145 | // mcKineCuts->SetRapidityRange(ymin,ymax); | |
146 | // mcKineCuts->SetChargeMC(charge); | |
147 | ||
148 | //Particle-Level cuts: | |
149 | AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts"); | |
150 | //mcGenCuts->SetRequireIsPrimary(); | |
151 | mcGenCuts->SetRequirePdgCode(PDG, kTRUE); // kTRUE set in order to include D0_bar | |
152 | mcGenCuts->SetAODMC(1); //special flag for reading MC in AOD tree (important) | |
153 | ||
154 | // Rec-Level kinematic cuts | |
155 | AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts"); | |
156 | // recKineCuts->SetPtRange(ptmin,ptmax); | |
157 | // recKineCuts->SetRapidityRange(ymin,ymax); | |
158 | // recKineCuts->SetChargeRec(charge); | |
159 | ||
160 | AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts"); | |
161 | //recQualityCuts->SetStatus(AliESDtrack::kITSrefit); | |
162 | ||
163 | AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts"); | |
164 | //recIsPrimaryCuts->SetAODType(AliAODTrack::kPrimary); | |
165 | ||
166 | printf("CREATE MC KINE CUTS\n"); | |
167 | TObjArray* mcList = new TObjArray(0) ; | |
168 | mcList->AddLast(mcKineCuts); | |
169 | mcList->AddLast(mcGenCuts); | |
170 | ||
171 | printf("CREATE RECONSTRUCTION CUTS\n"); | |
172 | TObjArray* recList = new TObjArray(0) ; | |
173 | recList->AddLast(recKineCuts); | |
174 | recList->AddLast(recQualityCuts); | |
175 | recList->AddLast(recIsPrimaryCuts); | |
176 | ||
177 | //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK | |
178 | printf("CREATE INTERFACE AND CUTS\n"); | |
179 | AliCFManager* man = new AliCFManager() ; | |
180 | man->SetParticleContainer (container); | |
181 | man->SetParticleCutsList(0 , mcList); // MC | |
182 | man->SetParticleCutsList(1 , recList); // AOD | |
183 | ||
184 | // Get the pointer to the existing analysis manager via the static access method. | |
185 | //============================================================================== | |
186 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
187 | if (!mgr) { | |
188 | ::Error("AddTaskCompareHF", "No analysis manager to connect to."); | |
189 | return NULL; | |
190 | } | |
191 | ||
192 | //CREATE THE TASK | |
193 | printf("CREATE TASK\n"); | |
194 | // create the task | |
195 | AliCFHeavyFlavourTaskMultiVar *task = new AliCFHeavyFlavourTaskMultiVar("AliCFHeavyFlavourTaskMultiVar"); | |
196 | task->SetFillFromGenerated(kFALSE); | |
197 | task->SetCFManager(man); //here is set the CF manager | |
198 | ||
199 | ||
200 | // Create and connect containers for input/output | |
201 | ||
202 | // ------ input data ------ | |
203 | AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer(); | |
204 | ||
205 | // ----- output data ----- | |
206 | ||
207 | //slot 0 : default output tree (by default handled by AliAnalysisTaskSE) | |
208 | AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("ctree0", TTree::Class(),AliAnalysisManager::kOutputContainer,"output.root"); | |
209 | ||
210 | //now comes user's output objects : | |
211 | ||
212 | // output TH1I for event counting | |
213 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0", TH1I::Class(),AliAnalysisManager::kOutputContainer,"output.root"); | |
214 | // output Correction Framework Container (for acceptance & efficiency calculations) | |
215 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("ccontainer0", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,"output.root"); | |
216 | ||
217 | //cinput0->SetData(chainAOD); | |
218 | ||
219 | mgr->AddTask(task); | |
220 | ||
221 | mgr->ConnectInput(task,0,mgr->GetCommonInputContainer()); | |
222 | mgr->ConnectOutput(task,0,coutput0); | |
223 | mgr->ConnectOutput(task,1,coutput1); | |
224 | mgr->ConnectOutput(task,2,coutput2); | |
225 | ||
226 | /* | |
227 | mgr->ConnectOutput(task,0,mgr->GetCommonOutputContainer()); | |
228 | mgr->ConnectOutput(task,1,mgr->GetCommonOutputContainer()); | |
229 | mgr->ConnectOutput(task,2,mgr->GetCommonOutputContainer()); | |
230 | */ | |
231 | ||
232 | return task; | |
233 | } |