]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGUD/DIFFRACTIVE/xsAndTwoProng/AliCDMesonBase.cxx
Fix for Coverity defect 21454
[u/mrichter/AliRoot.git] / PWGUD / DIFFRACTIVE / xsAndTwoProng / AliCDMesonBase.cxx
CommitLineData
369562e9 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15//
16// AliDDMesonBase
17// for
18// AliAnalysisTaskDDMeson
19//
20// Author:
21// Xianguo Lu <lu@physi.uni-heidelberg.de>
22// continued by
23// Felix Reidt <Felix.Reidt@cern.ch>
24
25#include "TH2.h"
26#include "TH2D.h"
27#include "TH1I.h"
28#include "TAxis.h"
29#include "THnSparse.h"
30#include "TString.h"
31#include "TList.h"
32
33#include "AliCDMesonBase.h"
34
35
3d85748d 36//------------------------------------------------------------------------------
37//== INVARIANT MASS DISTRIBUTIONS (ThnMother) ================================
38//-- event characteristics
39// number of charged primary particles - combined => can be w/ soft tracks
40const Int_t AliCDMesonBase::fgkNNcombined = 2; // number of bins
41const Double_t AliCDMesonBase::fgkMinNcombined = 2; // lower border
42const Double_t AliCDMesonBase::fgkMaxNcombined = 4; // upper border (#bins + lower border)
43
44// unlike sign or like sign charged?
45const Int_t AliCDMesonBase::fgkNCombCh = 2; // kBinPPMM = number of bins
46const Double_t AliCDMesonBase::fgkMinCombCh = 1.; // kBinPM = lower border
47const Double_t AliCDMesonBase::fgkMaxCombCh = 3.; // kBinPPMM + kBinPM = upper border
48
49// two track PID, take care the enum changed from time to time
50const Int_t AliCDMesonBase::fgkNCombPID = 13; // kBinPIDUnknown = number of bins
51const Double_t AliCDMesonBase::fgkMinCombPID = 1.; // kBinPionE = lower border
52const Double_t AliCDMesonBase::fgkMaxCombPID = 14.;// ... = upper border
53
54// gap configuration, used for different detectors
55const Int_t AliCDMesonBase::fgkNGapConfig = 4; // kBinNG = number of bins
56const Double_t AliCDMesonBase::fgkMinGapConfig = 1.; // kBinDG = lower border
57const Double_t AliCDMesonBase::fgkMaxGapConfig = 5.; // kBinNG + kBinDG = upper border
58
59//-- mother kinematics
60// invariant mass of the two-track system
61const Int_t AliCDMesonBase::fgkNMass = 1024; // number of bins
62const Double_t AliCDMesonBase::fgkMinMass = 0.; // lower border
63const Double_t AliCDMesonBase::fgkMaxMass = 5.12; // upper border
64
65// transverse momentum of the two-track system
66const Int_t AliCDMesonBase::fgkNMotherPt = 128;//10; // number of bins
67const Double_t AliCDMesonBase::fgkMinMotherPt = 0.; // lower border
68const Double_t AliCDMesonBase::fgkMaxMotherPt = .64; //6.4 //2; // upper border
69
70// cosine theta* (opening angle of the two daugther tracks in the
71// centre-of-mass system of the two-track/mother system)
72// **no meaning full variable**
73const Int_t AliCDMesonBase::fgkNCTS = 2; // number of bins
74const Double_t AliCDMesonBase::fgkMinCTS = -1.; // lower border
75const Double_t AliCDMesonBase::fgkMaxCTS = -0.9; // upper border
76
77// opening angle in the lab frame
78const Int_t AliCDMesonBase::fgkNOA = 20; // number of bins
79const Double_t AliCDMesonBase::fgkMinOA = -1.; // lower border
80const Double_t AliCDMesonBase::fgkMaxOA = 1.; // upper border
81
82//-- daughter kinematics
83// transverse momentum of one of the two daughter particles
84// (randomly selected)
85const Int_t AliCDMesonBase::fgkNDaughterPt = 128; // number of bins
86const Double_t AliCDMesonBase::fgkMinDaughterPt = 0.; // lower border
87const Double_t AliCDMesonBase::fgkMaxDaughterPt = 6.4; // upper border
88
89// pseudo rapidity of one of the two daughter particles
90// (randomly selected)
91//const Int_t AliCDMesonBase::fgkNDaughterEta = 64; // number of bins
92//const Double_t AliCDMesonBase::fgkMinDaughterEta = -1.28; // lower border
93//const Double_t AliCDMesonBase::fgkMaxDaughterEta = 1.28; // upper border
94
95//-- Event quality information
96// boolean values to reduce output size
97
98// are there tracks in addition to the ones selected using AliCDMesonTracks
99// (ITSTPC, ITSsa, ITSpureSA) (0 = no, 1 = yes)
100const Int_t AliCDMesonBase::fgkNTrackResiduals = 2; // number of bins
101const Double_t AliCDMesonBase::fgkMinTrackResiduals = 0.; // lower border
102const Double_t AliCDMesonBase::fgkMaxTrackResiduals = 2.; // upper border
103
104// vertex with in +/-4cm (0 = no, 1 = yes)
105const Int_t AliCDMesonBase::fgkNVertexZinRng = 2; // number of bins
106const Double_t AliCDMesonBase::fgkMinVertexZinRng = 0.; // lower border
107const Double_t AliCDMesonBase::fgkMaxVertexZinRng = 2.; // upper border
108
109// are the vertices from SPD and tracks within 0.5cm? (0 = no, 1 = yes)
110const Int_t AliCDMesonBase::fgkNVertexCoincidence = 2; // number of bins
111const Double_t AliCDMesonBase::fgkMinVertexCoincidence = 0.; // lower border
112const Double_t AliCDMesonBase::fgkMaxVertexCoincidence = 2.; // upper border
113
114// are there SPD tracklets which are not assigned to tracks? (0 = no, 1 = yes)
115const Int_t AliCDMesonBase::fgkNTrackletResiduals = 2; // number of bins
116const Double_t AliCDMesonBase::fgkMinTrackletResiduals = 0.; // lower border
117const Double_t AliCDMesonBase::fgkMaxTrackletResiduals = 2.; // upper border
118
119//-- MC event information
120const Int_t AliCDMesonBase::fgkNProcessType = 4; // kBinDD = number of bins
121const Double_t AliCDMesonBase::fgkMinProcessType = 0.; // kBinND = lower border
122const Double_t AliCDMesonBase::fgkMaxProcessType = 4.; // kBinDD = upper border
123
124
125//== EMPTY EVENT STUDY (ThnEmptyEvents) ======================================
126// event type
127const Int_t AliCDMesonBase::fgkNEventType = 5; // kBinEventE = number of bins (5)
128const Double_t AliCDMesonBase::fgkMinEventType = 1.; // kBinEventI = lower border (1)
129const Double_t AliCDMesonBase::fgkMaxEventType = 6.; // kBinEventE+kBinEventI = u. b.
130
131// multiplicities (reused for different detectors and ways of counting)
132const Int_t AliCDMesonBase::fgkNMult = 32; // number of bins
133const Double_t AliCDMesonBase::fgkMinMult = 0.; // lower border
134const Double_t AliCDMesonBase::fgkMaxMult = 31.; // upper border
135
136// multplicities - extended range
137// (reused for different detectors and ways of counting)
138const Int_t AliCDMesonBase::fgkNMultW = 64; // number of bins
139const Double_t AliCDMesonBase::fgkMinMultW = 0; // lower border
140const Double_t AliCDMesonBase::fgkMaxMultW = 63; // upper border
141
142//== MULTIPLICITY STUDY (TnnMultiplicity) ====================================
143// number of ITSTPC tracks in event
144const Int_t AliCDMesonBase::fgkNNch = 51; // number of bins
145const Double_t AliCDMesonBase::fgkMinNch = 0.; // lower border
146const Double_t AliCDMesonBase::fgkMaxNch = 51.; // upper border
147
148// number of ITS standalone tracks in event
149const Int_t AliCDMesonBase::fgkNNsoft = 11; // number of bins
150const Double_t AliCDMesonBase::fgkMinNsoft = 0.; // lower border
151const Double_t AliCDMesonBase::fgkMaxNsoft = 11.; // upper border
152
153// combined multiplicity
154const Int_t AliCDMesonBase::fgkNNcomb = 61; // number of bins
155const Double_t AliCDMesonBase::fgkMinNcomb = 0.; // lower border
156const Double_t AliCDMesonBase::fgkMaxNcomb = 61.; // upper border
157
158// gap configuration is reused from THnMother
159
160// number of residual tracks
161const Int_t AliCDMesonBase::fgkNNresidualTracks = 11; // number of bins
162const Double_t AliCDMesonBase::fgkMinNresidualTracks = 0.; // lower border
163const Double_t AliCDMesonBase::fgkMaxNresidualTracks = 11.; // upper border
164
165// number of residual tracklets
166const Int_t AliCDMesonBase::fgkNNresidualTracklets = 21; // number of bins
167const Double_t AliCDMesonBase::fgkMinNresidualTracklets = 0.; // lower border
168const Double_t AliCDMesonBase::fgkMaxNresidualTracklets = 21.; // upper border
169
170// vertex z-position
171const Int_t AliCDMesonBase::fgkNVertexZ = 20; // number of bins
172const Double_t AliCDMesonBase::fgkMinVertexZ = -10.; // lower border
173const Double_t AliCDMesonBase::fgkMaxVertexZ = 10.; // upper border
174
175// SPD and track vertex distance
176const Int_t AliCDMesonBase::fgkNVerticesDistance = 10; // number of bins
177const Double_t AliCDMesonBase::fgkMinVerticesDistance = 0.; // lower border
178const Double_t AliCDMesonBase::fgkMaxVerticesDistance = 5.; // upper border
179
180
369562e9 181//------------------------------------------------------------------------------
35e4697c 182Int_t AliCDMesonBase::GetGapBin(TString tag, Int_t gapcg,
369562e9 183 Bool_t checkCentralActivity /* = kTRUE */)
184{
185 //
186 // retrieve gap topology for a given string
187 //
188
189 tag.ToUpper();
190
191 Bool_t ka = kFALSE, kc = kFALSE;
192
193 if(tag.Contains("V0")){
194 ka = ka || (gapcg & kBitV0A);
195 kc = kc || (gapcg & kBitV0C);
196 }
197 if(tag.Contains("FMD")){
198 ka = ka || (gapcg & kBitFMDA);
199 kc = kc || (gapcg & kBitFMDC);
200 }
201 if(tag.Contains("SPD")){
202 ka = ka || (gapcg & kBitSPDA);
203 kc = kc || (gapcg & kBitSPDC);
204 }
205 if(tag.Contains("TPC")){
206 ka = ka || (gapcg & kBitTPCA);
207 kc = kc || (gapcg & kBitTPCC);
208 }
209 if(tag.Contains("ZDC")){
210 ka = ka || (gapcg & kBitZDCA);
211 kc = kc || (gapcg & kBitZDCC);
212 }
213
214 if(ka && kc)
215 return kBinNG;
216 else{
217 if(!ka && !kc)
218 if (((gapcg & kBitCentAct) && checkCentralActivity) ||
219 !checkCentralActivity) {
220 return kBinDG; // central activity seen (or not required)
221 }
222 else {
223 return kBinNG; // no central activity
224 }
225 else if(!kc)
226 return kBinGC;
227 else
228 return kBinGA;
229 }
230}
231
232
233//------------------------------------------------------------------------------
35e4697c 234void AliCDMesonBase::CheckRange(Double_t &var, Double_t min,
235 Double_t max)
369562e9 236{
237 //
238 // check whether the value is with in the range specified with min and max
239 //
240
241 const Double_t eps = 1e-3;
242 if( var >= max ) var = max - eps;
243 if( var <= min ) var = min + eps;
244}
245
246
247//------------------------------------------------------------------------------
248Int_t AliCDMesonBase::GetAxis(TString thntit, TString name)
249{
250 //
251 // get the number of an axis, derived from the ThnSparse title (list of axes)
252 //
253
254 thntit.ToUpper();
255 thntit.ReplaceAll(" ","");
256 const Int_t nmax = 20;
257 TString tits[nmax];
258 Int_t counter = 0;
259 while(thntit.Contains(",")){
260 const Int_t pos = thntit.First(",");
261 tits[counter] = thntit(0, pos);
262 thntit = thntit(pos+1, thntit.Length()-pos);
263 counter++;
264 if(counter>=nmax-1){
649e06c4 265 printf("AliCDMesonBase AliCDMesonBase::GetAxis too small nmax! %d %d\n",
369562e9 266 counter, nmax);
267 return -1; //exit(1); // TODO
268 }
269 }
270 tits[counter++] = thntit;
649e06c4 271
369562e9 272 //----------------
273
274 name.ToUpper();
275
276 for(Int_t ii=0; ii<counter; ii++){
277 if( tits[ii] == name )
278 return ii;
279 }
649e06c4 280 printf("AliCDMesonBase AliCDMesonBase::GetAxis !%s! %s not found!\n",
281 name.Data(), thntit.Data());
369562e9 282 for(Int_t ii=0; ii<counter; ii++){
283 printf("*************** AliCDMesonBase::GetAxis *****************\n");
649e06c4 284 printf("AliCDMesonBase AliCDMesonBase::GetAxis %d !%s!\n", ii,
285 tits[ii].Data());
369562e9 286 printf("\n");
287 }
288 return -1; //exit(1); // TODO
289}
290
291
292//------------------------------------------------------------------------------
293TString AliCDMesonBase::GetTitleMother()
294{
295 //
296 // get the title of ThnMother (= list of axes)
297 //
298
299 TString title = "Ncombined, CombCh, CombPID, V0, FMD, SPD, TPC,";
300 title += " Mass, Pt, CTS, OA, DaughterPt, TrackResiduals, VertexZinRng,";
301 title += " ProcessType, VertexCoincidence, TrackletResiduals";
302 return title;
303}
304
305
306//------------------------------------------------------------------------------
307THnSparseD * AliCDMesonBase::GetThnMother(TString name /* = "CDMeson_Mother" */)
308{
309 // creates the THnSparse called Mother (used for the generation of invariant
310 // mass distributions)
311 //
312
313 const Int_t nbin[] = {
314 fgkNNcombined, fgkNCombCh, fgkNCombPID, fgkNGapConfig, fgkNGapConfig,
315 fgkNGapConfig, fgkNGapConfig, fgkNMass, fgkNMotherPt, fgkNCTS, fgkNOA,
316 fgkNDaughterPt, fgkNTrackResiduals, fgkNVertexZinRng, fgkNProcessType,
317 fgkNVertexCoincidence, fgkNTrackletResiduals
318 };
319 const Double_t binmin[] = {
320 fgkMinNcombined, fgkMinCombCh, fgkMinCombPID, fgkMinGapConfig,
321 fgkMinGapConfig, fgkMinGapConfig, fgkMinGapConfig, fgkMinMass,
322 fgkMinMotherPt, fgkMinCTS, fgkMinOA, fgkMinDaughterPt,
323 fgkMinTrackResiduals, fgkMinVertexZinRng, fgkMinProcessType,
324 fgkMinVertexCoincidence, fgkMinTrackletResiduals
325 };
326 const Double_t binmax[] = {
327 fgkMaxNcombined, fgkMaxCombCh, fgkMaxCombPID, fgkMaxGapConfig,
328 fgkMaxGapConfig, fgkMaxGapConfig, fgkMaxGapConfig, fgkMaxMass,
329 fgkMaxMotherPt, fgkMaxCTS, fgkMaxOA, fgkMaxDaughterPt,
330 fgkMaxTrackResiduals, fgkMaxVertexZinRng, fgkMaxProcessType,
331 fgkMaxVertexCoincidence, fgkMaxTrackletResiduals
332 };
333
334 const Int_t npar = sizeof(nbin)/sizeof(Int_t);
335
336 return new THnSparseD(name.Data(), GetTitleMother(), npar, nbin, binmin,
337 binmax);
338}
339
340
341//------------------------------------------------------------------------------
35e4697c 342void AliCDMesonBase::FillThnMother(THnSparseD *thn, Double_t vNch,
343 Double_t vCombCh,
344 Double_t vCombPID, Double_t vV0,
345 Double_t vFMD, Double_t vSPD,
346 Double_t vTPC, Double_t vMass,
347 Double_t vPt, Double_t vOA,
348 Double_t vCTS,
349 Double_t vDaughterPt,
350 Double_t vTrackResiduals,
351 Double_t vVertexZ,
352 Double_t vProcessType,
353 Double_t vVertexCoincidence,
354 Double_t vTrkltResiduals)
369562e9 355{
356 //
357 // fill ThnMother
358 //
359
360 Double_t var[]={
361 vNch, vCombCh, vCombPID, vV0, vFMD, vSPD, vTPC, vMass, vPt, vOA, vCTS,
362 vDaughterPt, vTrackResiduals, vVertexZ, vProcessType, vVertexCoincidence,
363 vTrkltResiduals
364 };
365 const Int_t nv = sizeof(var)/sizeof(Double_t);
366 if(nv!=thn->GetNdimensions()){
367 printf("AliCDMesonBase::FillThnMother nv error!! %d %d\n", nv,
368 thn->GetNdimensions());
369 return; //exit(1);
370 }
371
372 CheckRange(var[7], fgkMinMass, fgkMaxMass);
373 CheckRange(var[8], fgkMinMotherPt, fgkMaxMotherPt);
374 CheckRange(var[11], fgkMinDaughterPt, fgkMaxDaughterPt);
375
376 thn->Fill(var);
377}
378
379
380//------------------------------------------------------------------------------
35e4697c 381Int_t AliCDMesonBase::GetAxisMother(TString name)
369562e9 382{
383 //
384 // return axis number corresponding to the name
385 //
386
387 return GetAxis(GetTitleMother(), name);
388}
389
390
391//------------------------------------------------------------------------------
392TString AliCDMesonBase::GetTitleEmptyEvents()
393{
394 //
395 // title / list of axes of the empty event study THnSparse
396 //
397
398 TString title = "EventType, FMD-A, FMD-C, SPD-I-A, SPD-I-C, SPD-O-A, SPD-O-C";
399 title += ", SPDtrkltA, SPDtrkltC";
400 title += ", fmdSum1I, fmdSum2I, fmdSum2O, fmdSum3I, fmdSum3O";
401 //title += ", TPC_all, TPC_diffVertex";
402 return title;
403}
404
405
406//------------------------------------------------------------------------------
407THnSparseD* AliCDMesonBase::GetThnEmptyEvents()
408{
409 // creates the THnSparse called Empty Events
410 // EventType, FMD-A, FMD-C, SPD-I-A, SPD-I-C, SPD-O-A, SPD-O-C, FMD1I..FMD3O
411 // TPC_all, TPC_diffVertex (not used so far)
412
413 const Int_t nbin[] = {
414 fgkNEventType, fgkNMultW, fgkNMultW, fgkNMult, fgkNMult, fgkNMult, fgkNMult,
415 fgkNMult, fgkNMult, fgkNMult, fgkNMult, fgkNMult, fgkNMult, fgkNMult
416 //, fgkNMult, fgkNMult
417 };
418 const Double_t binmin[] = {
419 fgkMinEventType, fgkMinMultW, fgkMinMultW, fgkMinMult, fgkMinMult,
420 fgkMinMult, fgkMinMult, fgkMinMult, fgkMinMult, fgkMinMult, fgkMinMult,
421 fgkMinMult, fgkMinMult, fgkMinMult //, fgkMinMult, fgkMinMult
422 };
423 const Double_t binmax[] = {
424 fgkMaxEventType, fgkMaxMultW, fgkMaxMultW, fgkMaxMult, fgkMaxMult,
425 fgkMaxMult, fgkMaxMult, fgkMaxMult, fgkMaxMult, fgkMaxMult, fgkMaxMult,
426 fgkMaxMult, fgkMaxMult, fgkMaxMult //, fgkMaxMult, fgkMaxMult
427 };
428
429 const Int_t npar = sizeof(nbin)/sizeof(Int_t);
430
431 return new THnSparseD("CDMeson_EmptyEvents", GetTitleEmptyEvents(), npar,
432 nbin, binmin, binmax);
433}
434
435
436//------------------------------------------------------------------------------
35e4697c 437void AliCDMesonBase::FillThnEmptyEvents(THnSparseD * thn, Int_t eventType,
438 Int_t multFMDA,
439 Int_t multFMDC,
440 Int_t multSPDIA,
441 Int_t multSPDIC,
442 Int_t multSPDOA,
443 Int_t multSPDOC,
444 Int_t multSPDtrkltA,
445 Int_t multSPDtrkltC,
446 Int_t fmdSum1I,
447 Int_t fmdSum2I,
448 Int_t fmdSum2O,
449 Int_t fmdSum3I,
450 Int_t fmdSum3O/*,
451 Int_t multTPC,
452 Int_t multTPCdiffVertex */)
369562e9 453{
454 //
455 // Fill ThnEmptyEvents
456 //
457
458 Double_t var[]={
459 eventType, multFMDA, multFMDC, multSPDIA, multSPDIC, multSPDOA,
460 multSPDOC, multSPDtrkltA, multSPDtrkltC, fmdSum1I, fmdSum2I, fmdSum2O,
461 fmdSum3I, fmdSum3O//, multTPC, multTPCdiffVertex
462 };
463 const Int_t nv = sizeof(var)/sizeof(Double_t);
464 if(nv!=thn->GetNdimensions()){
465 printf("AliCDMesonBase::FillThnEmptyEvents nv error!! %d %d\n", nv,
466 thn->GetNdimensions());
467 return; //exit(1); // TODO
468 }
469
470 thn->Fill(var);
471}
472
473
474//------------------------------------------------------------------------------
35e4697c 475Int_t AliCDMesonBase::GetAxisEmptyEvents(TString name)
369562e9 476{
477 //
478 // return axis number corresponding to the name
479 //
480
481 return GetAxis(GetTitleEmptyEvents(), name);
482}
483
484
485//------------------------------------------------------------------------------
486TString AliCDMesonBase::GetTitleMultiplicity()
487{
488 //
489 // get title of the multiplicity study ThnSparse
490 //
491
492 TString title = "Nch, Nsoft, Ncombined, V0, FMD, SPD, TPC, NresidualTracks";
493 title += ", NresidualTracklets, VertexZ, VerticesDistance, ProcessType";
494 return title;
495}
496
497
498//------------------------------------------------------------------------------
499THnSparseD* AliCDMesonBase::GetThnMultiplicity()
500{
501 //
502 // creates the THnSparse called Multiplicity
503 //
504
505 const Int_t nbin[] = {
506 fgkNNch, fgkNNsoft, fgkNNcomb,fgkNGapConfig, fgkNGapConfig,
507 fgkNGapConfig, fgkNGapConfig, fgkNNresidualTracks, fgkNNresidualTracklets,
508 fgkNVertexZ, fgkNVerticesDistance, fgkNProcessType
509 };
510 const Double_t binmin[] = {
511 fgkMinNch, fgkMinNsoft, fgkMinNcomb, fgkMinGapConfig, fgkMinGapConfig,
512 fgkMinGapConfig, fgkMinGapConfig, fgkMinNresidualTracks,
513 fgkMinNresidualTracklets, fgkMinVertexZ, fgkMinVerticesDistance,
514 fgkMinProcessType
515 };
516 const Double_t binmax[] = {
517 fgkMaxNch, fgkMaxNsoft, fgkMaxNcomb, fgkMaxGapConfig, fgkMaxGapConfig,
518 fgkMaxGapConfig, fgkMaxGapConfig, fgkMaxNresidualTracks,
519 fgkMaxNresidualTracklets, fgkMaxVertexZ, fgkMaxVerticesDistance,
520 fgkMaxProcessType
521 };
522
523 const Int_t npar = sizeof(nbin)/sizeof(Int_t);
524
525 return new THnSparseD("CDMeson_Multiplicity", GetTitleMultiplicity(), npar,
526 nbin, binmin, binmax);
527}
528
529
530//------------------------------------------------------------------------------
35e4697c 531void AliCDMesonBase::FillThnMultiplicity(THnSparseD *thn, Double_t vNch,
532 Double_t vNsoft,
533 Double_t vNcombined,
534 Double_t vV0,
535 Double_t vFMD,
536 Double_t vSPD,
537 Double_t vTPC,
538 Double_t vNresidualTracks,
539 Double_t vNresidualTracklets,
540 Double_t vVertexZ,
541 Double_t vVerticesDistance,
542 Double_t vProcessType)
369562e9 543{
544 // fill ThnMultiplicity
545 // input list copied from GetTitle
546 // var[] copied from GetTitle
547
548 Double_t var[]={
549 vNch, vNsoft, vNcombined, vV0, vFMD, vSPD, vTPC, vNresidualTracks,
550 vNresidualTracklets, vVertexZ, vVerticesDistance, vProcessType
551 };
552 const Int_t nv = sizeof(var)/sizeof(Double_t);
553 if(nv!=thn->GetNdimensions()){
554 printf("AliCDMesonBase::FillThnMultiplicity nv error!! %d %d\n", nv,
555 thn->GetNdimensions());
556 return; //exit(1);
557 }
558
559 thn->Fill(var);
560}
561
562
563//------------------------------------------------------------------------------
35e4697c 564Int_t AliCDMesonBase::GetAxisMultiplicity(TString name)
369562e9 565{
566 //
567 // return axis number corresponding to the name
568 //
569
570 return GetAxis(GetTitleMultiplicity(), name);
571}
572
573
574//------------------------------------------------------------------------------
575TH1F* AliCDMesonBase::GetHistStatsFlow()
576{
577 //
578 // setup the stats flow histogram
579 //
580
581 TH1F *hist = new TH1F("c00_statsFlow", "", AliCDMesonBase::kBinLastValue,
582 0, AliCDMesonBase::kBinLastValue);
583 TAxis* axis = hist->GetXaxis();
584 axis->SetBinLabel(AliCDMesonBase::kBinTotalInput+1, "total Input");
585 axis->SetBinLabel(AliCDMesonBase::kBinGoodInput+1, "good ESDs");
586 axis->SetBinLabel(AliCDMesonBase::kBinV0OR+1, "V0-OR");
587 axis->SetBinLabel(AliCDMesonBase::kBinV0AND+1, "V0-AND");
588 axis->SetBinLabel(AliCDMesonBase::kBinEventsAfterCuts+1, "after cuts");
589 axis->SetBinLabel(AliCDMesonBase::kBinEventsWithOutPileUp+1, "w/o pile up");
590 axis->SetBinLabel(AliCDMesonBase::kBinv0Gap+1, "with V0 DG gap");
591 axis->SetBinLabel(AliCDMesonBase::kBinv0fmdGap+1, "with V0-FMD DG gap");
592 axis->SetBinLabel(AliCDMesonBase::kBinv0fmdspdGap+1,
593 "with V0-FMD-SPD DG gap");
594 axis->SetBinLabel(AliCDMesonBase::kBinv0fmdspdtpcGap+1,
595 "with V0-FMD-SPD-TPC DG gap");
596 axis->SetBinLabel(AliCDMesonBase::kBinv0fmdspdtpczdcGap+1,
597 "with V0-FMD-SPD-TPC-ZDC DG gap");
598 axis->SetBinLabel(AliCDMesonBase::kBinfmdGap+1, "with FMD DG gap");
599 axis->SetBinLabel(AliCDMesonBase::kBinspdGap+1, "with SPD DG gap");
600 axis->SetBinLabel(AliCDMesonBase::kBintpcGap+1, "with TPC DG gap");
601 axis->SetBinLabel(AliCDMesonBase::kBintpcspdGap+1, "width TPC-SPD DG gap");
602 axis->SetBinLabel(AliCDMesonBase::kBintpcspdfmdGap+1,
603 "width TPC-SPD-FMD DG gap");
604 axis->SetBinLabel(AliCDMesonBase::kBintpcspdfmdv0Gap+1,
605 "width TPC-SPD-FMD-V0 DG gap");
606 axis->SetBinLabel(AliCDMesonBase::kBinspdfmdGap+1, "with SPD FMD gap");
607 axis->SetBinLabel(AliCDMesonBase::kBinspdfmdv0Gap+1, "with SPD FMD V0 gap");
608 axis->SetBinLabel(AliCDMesonBase::kBinTwoTrackEvents+1, "with two tracks");
609 axis->SetBinLabel(AliCDMesonBase::kBinThreeTrackEvents+1,
610 "with three tracks");
611 axis->SetBinLabel(AliCDMesonBase::kBinPionEvents+1, "with two pions");
612 axis->SetBinLabel(AliCDMesonBase::kBinKaonEvents+1, "with two kaons");
613 axis->SetBinLabel(AliCDMesonBase::kBinProtonEvents+1, "with two proton");
614 axis->SetBinLabel(AliCDMesonBase::kBinElectronEvents+1, "with two electron");
615 axis->SetBinLabel(AliCDMesonBase::kBinUnknownPIDEvents+1, "with unknown PID");
616 axis->SetBinLabel(AliCDMesonBase::kBinResidualTracks+1,
617 "without residual tracks");
618 axis->SetBinLabel(AliCDMesonBase::kBinResidualTracklets+1,
619 "without residual tracklets");
620 axis->SetBinLabel(AliCDMesonBase::kBinCDonlyEvents+1, "CD only events");
621 return hist;
622}
623
624
625//------------------------------------------------------------------------------
626TH2F* AliCDMesonBase::GetHistPIDStudies(TString name)
627{
628 //
629 // setup the PID studies histogram
630 //
631
632 TH2F *hist = new TH2F(name.Data(), ";particle 1;particle 2",
633 AliCDMesonBase::kBinPIDUnknown,
634 AliCDMesonBase::kBinPionE,
635 AliCDMesonBase::kBinPIDUnknown+1,
636 AliCDMesonBase::kBinPIDUnknown,
637 AliCDMesonBase::kBinPionE,
638 AliCDMesonBase::kBinPIDUnknown+1);
639 TAxis* x = hist->GetXaxis();
640 TAxis* y = hist->GetYaxis();
641 x->SetBinLabel(AliCDMesonBase::kBinPionE, "#pi (ex)");
642 x->SetBinLabel(AliCDMesonBase::kBinPion, "#pi");
643 x->SetBinLabel(AliCDMesonBase::kBinSinglePion, "-");
644 x->SetBinLabel(AliCDMesonBase::kBinKaonE, "K (ex)");
645 x->SetBinLabel(AliCDMesonBase::kBinKaon, "K");
646 x->SetBinLabel(AliCDMesonBase::kBinSingleKaon, ",");
647 x->SetBinLabel(AliCDMesonBase::kBinProtonE, "p (ex)");
648 x->SetBinLabel(AliCDMesonBase::kBinProton, "p");
649 x->SetBinLabel(AliCDMesonBase::kBinSingleProton, "_");
650 x->SetBinLabel(AliCDMesonBase::kBinElectronE, "e (ex)");
651 x->SetBinLabel(AliCDMesonBase::kBinElectron, "e");
652 x->SetBinLabel(AliCDMesonBase::kBinSingleElectron, ".");
653 x->SetBinLabel(AliCDMesonBase::kBinPIDUnknown, "X");
654 y->SetBinLabel(AliCDMesonBase::kBinPionE, "#pi (ex)");
655 y->SetBinLabel(AliCDMesonBase::kBinPion, "#pi");
656 y->SetBinLabel(AliCDMesonBase::kBinSinglePion, "-");
657 y->SetBinLabel(AliCDMesonBase::kBinKaonE, "K (ex)");
658 y->SetBinLabel(AliCDMesonBase::kBinKaon, "K");
659 y->SetBinLabel(AliCDMesonBase::kBinSingleKaon, ",");
660 y->SetBinLabel(AliCDMesonBase::kBinProtonE, "p (ex)");
661 y->SetBinLabel(AliCDMesonBase::kBinProton, "p");
662 y->SetBinLabel(AliCDMesonBase::kBinSingleProton, "_");
663 y->SetBinLabel(AliCDMesonBase::kBinElectronE, "e (ex)");
664 y->SetBinLabel(AliCDMesonBase::kBinElectron, "e");
665 y->SetBinLabel(AliCDMesonBase::kBinSingleElectron, ".");
666 y->SetBinLabel(AliCDMesonBase::kBinPIDUnknown, "X");
667 return hist;
668}
669
670
671//------------------------------------------------------------------------------
672TObjArray* AliCDMesonBase::GetHistVZEROStudies(TList* l)
673{
674 //
675 // Create Histograms for the VZERO trigger studies
676 //
677
678 TObjArray* arr = new TObjArray(130);
679
680 TObject* o = 0x0;
681 for (Int_t iPMT = 0; iPMT < 64; ++iPMT) {
682 o = (TObject*)new TH2F(Form("h00_%02d_ADC_TriggerThr", iPMT),
683 ";ADC Counts;Trigger Threshold (ADC Counts)",
684 400, 0., 4000., 48, 2., 50.);
685 arr->Add(o);
686 l->Add(o);
687 }
688 for (Int_t iPMT = 0; iPMT < 64; ++iPMT) {
689 o = (TObject*)new TH2F(Form("h01_%02d_ADC_Multiplicity", iPMT),
690 ";ADC Counts;Multiplicity",
691 400, 0., 4000., 250, 0., 250.);
692 arr->Add(o);
693 l->Add(o);
694 }
695 /*
696 // not of use for pp data in 2010
697 o = (TObject*)new TH2F("h02_TriggerChargeA_Trigger",
698 ";Trigger Charge A;Trigger Decision A",
699 250, 0., 5000., 2, 0., 2.);
700 arr->Add(o);
701 l->Add(o);
702 o = (TObject*)new TH2F("h03__TriggerChargeC_Trigger",
703 ";Trigger Charge C;Trigger Decision C",
704 250, 0., 5000., 2, 0., 2.);
705 arr->Add(o);
706 l->Add(o);
707 */
708
709 return arr;
710}
711
712
713//------------------------------------------------------------------------------
714void AliCDMesonBase::GetGapTriggers(THnSparseI* gaprun, Int_t gapCondition,
35e4697c 715 Int_t run, Double_t& triggers,
369562e9 716 Double_t& total)
717{
718 // determine the number of certain triggers with a gap in the detectors
719 // specified by gapCondition in run and the total number of events
720 // surviving all cuts (including pile-up rejection)
721
722 triggers = 0;
723 total = 0;
724 Int_t nTuple[] = { gaprun->GetAxis(0)->FindBin(run), 0 };
725 for (Int_t i = 0; i< kBitGapMax; ++i) {
726 nTuple[1] = i;
727 Double_t temp = gaprun->GetBinContent(nTuple);
728 if (!(i & gapCondition)) {
729 triggers += temp;
730 }
731 total += temp;
732 }
733}
734
735
736//------------------------------------------------------------------------------
737void AliCDMesonBase::GetNoGapTriggers(THnSparseI* gaprun, Int_t gapCondition,
35e4697c 738 Int_t run, Double_t& triggers,
369562e9 739 Double_t& total)
740{
741 // determine the number of certain triggers with a NO gap in the detectors
742 // specified by the gapCondition in run and the total number of events
743 // surviving all cuts (including pile-up rejection)
744
745 triggers = 0;
746 total = 0;
747 Int_t nTuple[] = { gaprun->GetAxis(0)->FindBin(run), 0 };
748 for (Int_t i = 0; i< kBitGapMax; ++i) {
749 nTuple[1] = i;
750 Double_t temp = gaprun->GetBinContent(nTuple);
751 if (i & gapCondition) {
752 triggers += temp;
753 }
754 total += temp;
755 }
756}