]>
Commit | Line | Data |
---|---|---|
8e2f611a | 1 | |
917559ee | 2 | /************************************************************************** |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
17 | /* $Id: AliTRDqaEnergyDeposit.cxx $ */ | |
18 | ||
19 | // | |
20 | // This class is a part of a package of high level QA monitoring for TRD. | |
21 | // In this class the dEdX is analyzed as a function of the particle type, | |
22 | // momentum and chamber. | |
23 | // | |
24 | // S. Radomski | |
25 | // radomski@physi.uni-heidelberg.de | |
26 | // March 2008 | |
27 | // | |
28 | ||
29 | #include "AliTRDqaEnergyDeposit.h" | |
30 | ||
31 | #include "TMath.h" | |
32 | #include "TH1D.h" | |
33 | #include "TH2D.h" | |
34 | #include "TFile.h" | |
35 | #include "TTree.h" | |
36 | #include "TChain.h" | |
37 | ||
38 | #include "AliESDEvent.h" | |
39 | #include "AliESDtrack.h" | |
40 | #include "AliKalmanTrack.h" | |
41 | ||
42 | //______________________________________________________________________________ | |
43 | ||
44 | AliTRDqaEnergyDeposit::AliTRDqaEnergyDeposit() | |
45 | : AliAnalysisTask("",""), | |
46 | fChain(0), | |
47 | fESD(0), | |
48 | fOutputContainer(0) | |
49 | { | |
50 | // Dummy default constructor | |
51 | } | |
52 | //______________________________________________________________________________ | |
53 | ||
54 | AliTRDqaEnergyDeposit:: AliTRDqaEnergyDeposit(AliTRDqaEnergyDeposit& /*trd*/) | |
55 | : AliAnalysisTask("",""), | |
56 | fChain(0), | |
57 | fESD(0), | |
58 | fOutputContainer(0) | |
59 | { | |
60 | // Dummy copy constructor | |
61 | ||
62 | //return *this; | |
63 | } | |
64 | ||
65 | //______________________________________________________________________________ | |
66 | AliTRDqaEnergyDeposit::AliTRDqaEnergyDeposit(const char *name) | |
67 | : AliAnalysisTask(name,""), | |
68 | fChain(0), | |
69 | fESD(0), | |
70 | fOutputContainer(0) | |
71 | { | |
72 | // Constructor. | |
73 | // Input slot #0 works with an Ntuple | |
74 | DefineInput(0, TChain::Class()); | |
75 | // Output slot #0 writes into a TH1 container | |
76 | DefineOutput(0, TObjArray::Class()) ; | |
77 | } | |
78 | ||
79 | //______________________________________________________________________________ | |
80 | void AliTRDqaEnergyDeposit::ConnectInputData(const Option_t *) | |
81 | { | |
82 | // Initialisation of branch container and histograms | |
83 | ||
84 | //AliInfo(Form("*** Initialization of %s", GetName())) ; | |
85 | ||
86 | fChain = (TChain*)GetInputData(0); | |
87 | fESD = new AliESDEvent(); | |
88 | fESD->ReadFromTree(fChain); | |
89 | } | |
90 | ||
91 | //________________________________________________________________________ | |
92 | void AliTRDqaEnergyDeposit::CreateOutputObjects() | |
93 | { | |
94 | // build histograms | |
95 | ||
96 | // prepare the scale from 0.5 to 10 GeV | |
97 | const Int_t knbinsx = 50; | |
98 | Double_t scalex[knbinsx+1]; | |
99 | Double_t dd = (TMath::Log(10) - TMath::Log(0.5)) / knbinsx; | |
100 | for(Int_t ix=0; ix<knbinsx+1; ix++) { | |
101 | scalex[ix] = 0.5 * TMath::Exp(dd * ix); | |
102 | } | |
103 | ||
104 | const Int_t knbinsy = 50; | |
105 | Double_t scaley[knbinsy+1]; | |
106 | for(Int_t iy=0; iy<knbinsy+1; iy++) { | |
107 | scaley[iy] = iy * (3e3/100.); | |
108 | } | |
109 | ||
110 | const char *title = ";p_{T};dEdX (a. u.)"; | |
111 | const char *charge[2] = {"Pos", "Neg"}; | |
112 | ||
113 | // build histograms | |
114 | fOutputContainer = new TObjArray(50); | |
115 | Int_t c=0; | |
116 | ||
117 | for(Int_t i=0; i<2; i++) { | |
118 | ||
119 | fSignalPtSum[i] = new TH2D(Form("ptSig%s", charge[i]), title, knbinsx, scalex, knbinsy, scaley); | |
120 | fOutputContainer->AddAt(fSignalPtSum[i], c++); | |
121 | ||
122 | for(Int_t j=0; j<AliPID::kSPECIES; j++) { | |
123 | Int_t idx = AliPID::kSPECIES*i+j; | |
8e2f611a | 124 | |
125 | // | |
917559ee | 126 | fSignalPtType[idx] = |
127 | new TH2D(Form("ptSig%s%d", charge[i], j), title, knbinsx, scalex, knbinsy, scaley); | |
128 | fOutputContainer->AddAt(fSignalPtType[idx], c++); | |
8e2f611a | 129 | |
130 | // | |
131 | fSignalPtPure[idx] = | |
132 | new TH2D(Form("ptSigPure%s%d", charge[i], j), title, knbinsx, scalex, knbinsy, scaley); | |
133 | fOutputContainer->AddAt(fSignalPtPure[idx], c++); | |
917559ee | 134 | |
135 | fProb[idx] = new TH1D(Form("prob%s%d", charge[i], j), ";LQ", 100, 0, 1); | |
136 | fOutputContainer->AddAt(fProb[idx], c++); | |
137 | } | |
138 | } | |
139 | ||
140 | printf("n hist = %d\n", c); | |
141 | } | |
142 | //______________________________________________________________________________ | |
143 | void AliTRDqaEnergyDeposit::Exec(Option_t *) | |
144 | { | |
145 | // Process one event | |
146 | ||
147 | // Long64_t entry = fChain->GetReadEntry() ; | |
148 | ||
149 | // Processing of one event | |
150 | ||
151 | if (!fESD) { | |
152 | //AliError("fESD is not connected to the input!") ; | |
153 | return ; | |
154 | } | |
155 | ||
156 | Int_t nTracks = fESD->GetNumberOfTracks(); | |
157 | //fNTracks->Fill(nTracks); | |
158 | ||
159 | // track loop | |
160 | for(Int_t i=0; i<nTracks; i++) { | |
161 | ||
162 | // | |
163 | // track selection | |
164 | // | |
165 | // param in and Out | |
166 | // TRDrefit and TRDPid bit | |
167 | // | |
168 | ||
169 | AliESDtrack *track = fESD->GetTrack(i); | |
170 | const AliExternalTrackParam *paramOut = track->GetOuterParam(); | |
171 | const AliExternalTrackParam *paramIn = track->GetInnerParam(); | |
172 | ||
173 | // long track .. | |
174 | if (!paramIn) continue; | |
175 | if (!paramOut) continue; | |
176 | ||
177 | UInt_t status = track->GetStatus(); | |
178 | if (!(status & AliESDtrack::kTRDrefit)) continue; | |
179 | if (!(status & AliESDtrack::kTRDpid)) continue; | |
ed15ef4f | 180 | if (track->GetTRDntrackletsPID() < 6) continue; |
917559ee | 181 | |
182 | // standard selection | |
183 | ||
184 | Int_t idx = (track->GetSign() > 0) ? 0 : 1; | |
185 | Double_t pt = paramOut->Pt(); | |
186 | ||
187 | Double_t signal = 0; | |
7bce990c | 188 | for(Int_t k=0; k<6; ++k) |
189 | signal += track->GetTRDslice(k, -1); | |
917559ee | 190 | signal /= 6; |
191 | ||
192 | fSignalPtSum[idx]->Fill(pt, signal); | |
193 | ||
7bce990c | 194 | for(Int_t k=0; k<AliPID::kSPECIES; ++k) { |
917559ee | 195 | |
7bce990c | 196 | Double_t lq = track->GetTRDpid(k); |
197 | fProb[AliPID::kSPECIES*idx+k]->Fill(lq); | |
198 | if (lq > 0.8) fSignalPtType[AliPID::kSPECIES*idx+k]->Fill(pt, signal); | |
917559ee | 199 | } |
200 | } | |
201 | ||
202 | PostData(0, fOutputContainer); | |
8e2f611a | 203 | } |
204 | ||
205 | //______________________________________________________________________________ | |
206 | void AliTRDqaEnergyDeposit::FillElectrons() { | |
207 | ||
208 | ||
209 | ||
917559ee | 210 | } |
211 | ||
212 | //______________________________________________________________________________ | |
213 | void AliTRDqaEnergyDeposit::Terminate(Option_t *) | |
214 | { | |
215 | // retrieve histograms | |
216 | fOutputContainer = (TObjArray*)GetOutputData(0); | |
217 | ||
218 | // post processing | |
219 | ||
220 | ||
221 | // save the results | |
222 | TFile *file = new TFile("outEnergyDeposit.root", "RECREATE"); | |
223 | fOutputContainer->Write(); | |
224 | ||
225 | file->Flush(); | |
226 | file->Close(); | |
227 | delete file; | |
228 | ||
229 | //for(Int_t i=0; i<fOutputContainer->GetEntries(); i++) { | |
230 | // TObject *obj = fOu | |
231 | // } | |
232 | } | |
233 | ||
234 | //______________________________________________________________________________ |