]>
Commit | Line | Data |
---|---|---|
917559ee | 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 | /* $Id: AliTRDqaAT.cxx $ */ | |
17 | ||
18 | // | |
19 | // This class is a part of a package of high level QA monitoring for TRD. | |
20 | // In this class provides a commonly used tools as static functions. | |
21 | // | |
22 | // S. Radomski | |
23 | // radomski@physi.uni-heidelberg.de | |
24 | // March 2008 | |
25 | // | |
26 | ||
27 | #include "AliTRDqaAT.h" | |
28 | ||
29 | #include "TMath.h" | |
30 | #include "TH1D.h" | |
8e2f611a | 31 | #include "AliPID.h" |
32 | #include "AliESDtrack.h" | |
917559ee | 33 | #include "AliExternalTrackParam.h" |
34 | ||
35 | //______________________________________________________________________________ | |
36 | ||
37 | AliTRDqaAT::AliTRDqaAT() { | |
38 | // | |
39 | // Dummy contructor | |
40 | // | |
41 | ||
42 | } | |
43 | ||
44 | //______________________________________________________________________________ | |
45 | Int_t AliTRDqaAT::GetSector(const Double_t alpha) | |
46 | { | |
47 | // Gets the sector number | |
48 | ||
49 | Double_t size = TMath::DegToRad() * 20.; | |
50 | Int_t sector = (Int_t)((alpha + TMath::Pi())/size); | |
51 | return sector; | |
52 | } | |
53 | ||
54 | //______________________________________________________________________________ | |
55 | ||
56 | Int_t AliTRDqaAT::GetStack(const AliExternalTrackParam *paramOut) | |
57 | { | |
58 | // | |
59 | // calculates the stack the track is in | |
60 | // | |
61 | ||
62 | const Double_t l = -0.9; | |
63 | const Double_t w = (2*l)/5; | |
64 | ||
65 | Double_t tan = paramOut->GetZ() / paramOut->GetX(); | |
66 | Double_t pos = (tan - l) / w; | |
67 | return (Int_t) pos; | |
68 | } | |
69 | ||
70 | //______________________________________________________________________________ | |
71 | ||
72 | void AliTRDqaAT::BuildRatio(TH1D *ratio, TH1D *histN, TH1D*histD) { | |
73 | // | |
74 | // Calculate the ratio of two histograms | |
75 | // error are calculated assuming the histos have the same counts | |
76 | // | |
77 | ||
78 | // calclate | |
79 | ||
80 | Int_t nbins = histN->GetXaxis()->GetNbins(); | |
81 | for(Int_t i=1; i<nbins+2; i++) { | |
82 | ||
83 | Double_t valueN = histN->GetBinContent(i); | |
84 | Double_t valueD = histD->GetBinContent(i); | |
85 | ||
86 | if (valueD < 1) { | |
87 | ratio->SetBinContent(i, 0); | |
88 | ratio->SetBinError(i, 0); | |
89 | continue; | |
90 | } | |
91 | ||
92 | Double_t eps = (valueN < valueD-valueN)? valueN : valueD-valueN; | |
93 | ||
94 | ratio->SetBinContent(i, valueN/valueD); | |
95 | ratio->SetBinError(i, TMath::Sqrt(eps)/valueD); | |
96 | } | |
97 | ||
98 | // style | |
99 | ratio->SetMinimum(-0.1); | |
100 | ratio->SetMaximum(1.1); | |
101 | ratio->SetMarkerStyle(20); | |
102 | } | |
103 | //__________________________________________________________________________ | |
8e2f611a | 104 | |
105 | void AliTRDqaAT::FillStatus(TH1D *fStatusHist, UInt_t status) { | |
106 | ||
107 | UInt_t u = 1; | |
108 | //UInt_t status = track->GetStatus(); | |
109 | for(Int_t bit=0; bit<32; bit++) | |
110 | if (u<<bit & status) fStatusHist->Fill(bit); | |
111 | } | |
112 | ||
113 | //__________________________________________________________________________ | |
114 | ||
115 | void AliTRDqaAT::PrintPID(const AliESDtrack *track) { | |
116 | ||
117 | Int_t id = AliPID::kElectron; | |
118 | Double_t pidESD[5], pidITS[5], pidTPC[5], pidTRD[5]; | |
119 | ||
120 | track->GetESDpid(pidESD); | |
121 | track->GetITSpid(pidITS); | |
122 | track->GetTPCpid(pidTPC); | |
123 | track->GetTRDpid(pidTRD); | |
124 | //track->GetTOFpid(pidTOF); | |
125 | ||
126 | Double_t comb = pidITS[id] * pidTPC[id] * pidTRD[id]; | |
127 | ||
128 | Double_t normTot = 0; | |
129 | Double_t norm[5] = {0,0,0,0,0}; | |
130 | for(Int_t i=0; i<5; i++) { | |
131 | norm[i] = pidITS[i] * pidTPC[i] * pidTRD[i]; | |
132 | normTot += norm[i]; | |
133 | } | |
134 | ||
135 | Double_t trdTot = 0; | |
136 | for(Int_t i=0; i<AliPID::kSPECIES; i++) trdTot += pidTRD[i]; | |
137 | ||
138 | ||
139 | // comb /= norm; | |
140 | ||
141 | printf("%.3f | %.3f %.3f | %.3f %.3f %.3f | ", | |
142 | pidESD[id], comb, normTot, pidITS[id], pidTPC[id], pidTRD[id]); | |
143 | ||
144 | for(Int_t i=0; i<5; i++) printf("%.2f:%.2f:%.2f | ", pidITS[i], pidTPC[i], pidTRD[i]); | |
145 | printf("| %.3f |\n", trdTot); | |
146 | } | |
147 | ||
148 | //__________________________________________________________________________ |