]>
Commit | Line | Data |
---|---|---|
37c55dc0 | 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 | ||
0d0e6995 | 16 | /* $Id$ */ |
17 | ||
4347b38f | 18 | //____________________________________________________________________ |
42403906 | 19 | // |
7684b53c | 20 | // This is a class that constructs AliFMDMult (reconstructed |
21 | // multiplicity) from of Digits | |
4347b38f | 22 | // |
23 | // This class reads either digits from a TClonesArray or raw data from | |
24 | // a DDL file (or similar), and stores the read ADC counts in an | |
25 | // internal cache (fAdcs). | |
26 | // | |
27 | // From the cached values it then calculates the number of particles | |
28 | // that hit a region of the FMDs, as specified by the user. | |
29 | // | |
30 | // The reconstruction can be done in two ways: Either via counting the | |
31 | // number of empty strips (Poisson method), or by converting the ADC | |
32 | // signal to an energy deposition, and then dividing by the typical | |
33 | // energy loss of a particle. | |
34 | // | |
7684b53c | 35 | // +---------------------+ +---------------------+ |
36 | // | AliFMDReconstructor |<>-----| AliFMDMultAlgorithm | | |
37 | // +---------------------+ +---------------------+ | |
38 | // ^ | |
39 | // | | |
40 | // +-----------+---------+ | |
41 | // | | | |
42 | // +-------------------+ +------------------+ | |
43 | // | AliFMDMultPoisson | | AliFMDMultNaiive | | |
44 | // +-------------------+ +------------------+ | |
45 | // | |
46 | // AliFMDReconstructor acts as a manager class. It contains a list of | |
47 | // AliFMDMultAlgorithm objects. The call graph looks something like | |
48 | // | |
49 | // | |
50 | // +----------------------+ +----------------------+ | |
51 | // | :AliFMDReconstructor | | :AliFMDMultAlgorithm | | |
52 | // +----------------------+ +----------------------+ | |
53 | // | | | |
54 | // Reconstruct +-+ | | |
55 | // ------------>| | PreRun +-+ | |
56 | // | |------------------------------->| | | |
57 | // | | +-+ | |
58 | // | |-----+ (for each event) | | |
59 | // | | | *ProcessEvent | | |
60 | // |+-+ | | | |
61 | // || |<---+ PreEvent +-+ | |
62 | // || |------------------------------>| | | |
63 | // || | +-+ | |
64 | // || |-----+ | | |
65 | // || | | ProcessDigits | | |
66 | // ||+-+ | | | |
67 | // ||| |<---+ | | |
68 | // ||| | *ProcessDigit(digit) +-+ | |
69 | // ||| |----------------------------->| | | |
70 | // ||| | +-+ | |
71 | // ||+-+ | | |
72 | // || | PostEvent +-+ | |
73 | // || |------------------------------>| | | |
74 | // || | +-+ | |
75 | // |+-+ | | |
76 | // | | PostRun +-+ | |
77 | // | |------------------------------->| | | |
78 | // | | +-+ | |
79 | // +-+ | | |
80 | // | | | |
81 | // | |
4347b38f | 82 | // |
37c55dc0 | 83 | // |
84 | //-- Authors: Evgeny Karpechev(INR) and Alla Maevsksia | |
4347b38f | 85 | // Latest changes by Christian Holm Christensen <cholm@nbi.dk> |
86 | // | |
87 | // | |
88 | //____________________________________________________________________ | |
37c55dc0 | 89 | |
56b1929b | 90 | #include <AliLog.h> // ALILOG_H |
91 | #include <AliRun.h> // ALIRUN_H | |
92 | #include <AliRunLoader.h> // ALIRUNLOADER_H | |
93 | #include <AliLoader.h> // ALILOADER_H | |
94 | #include <AliHeader.h> // ALIHEADER_H | |
95 | #include <AliRawReader.h> // ALIRAWREADER_H | |
96 | #include <AliGenEventHeader.h> // ALIGENEVENTHEADER_H | |
1a1fdef7 | 97 | #include "AliFMD.h" // ALIFMD_H |
98 | #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H | |
99 | #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H | |
100 | #include "AliFMDDetector.h" // ALIFMDDETECTOR_H | |
101 | #include "AliFMDRing.h" // ALIFMDRING_H | |
56b1929b | 102 | #include "AliFMDDigit.h" // ALIFMDDIGIT_H |
103 | #include "AliFMDReconstructor.h" // ALIFMDRECONSTRUCTOR_H | |
104 | #include "AliFMDRawStream.h" // ALIFMDRAWSTREAM_H | |
105 | #include "AliFMDRawReader.h" // ALIFMDRAWREADER_H | |
106 | #include "AliFMDMultAlgorithm.h" // ALIFMDMULTALGORITHM_H | |
107 | #include "AliFMDMultPoisson.h" // ALIFMDMULTPOISSON_H | |
108 | #include "AliFMDMultNaiive.h" // ALIFMDMULTNAIIVE_H | |
4347b38f | 109 | |
110 | //____________________________________________________________________ | |
925e6570 | 111 | ClassImp(AliFMDReconstructor) |
1a1fdef7 | 112 | #if 0 |
113 | ; // This is here to keep Emacs for indenting the next line | |
114 | #endif | |
37c55dc0 | 115 | |
4347b38f | 116 | //____________________________________________________________________ |
117 | AliFMDReconstructor::AliFMDReconstructor() | |
118 | : AliReconstructor(), | |
4347b38f | 119 | fPedestal(0), |
e802be3e | 120 | fPedestalWidth(0), |
121 | fPedestalFactor(0) | |
4347b38f | 122 | { |
42403906 | 123 | // Make a new FMD reconstructor object - default CTOR. |
1a1fdef7 | 124 | AliFMDParameters* pars = AliFMDParameters::Instance(); |
125 | fPedestal = pars->GetPedestal(); | |
126 | fPedestalWidth = pars->GetPedestalWidth(); | |
127 | fPedestalFactor = pars->GetPedestalFactor(); | |
128 | ||
56b1929b | 129 | fAlgorithms.Add(new AliFMDMultNaiive); |
130 | fAlgorithms.Add(new AliFMDMultPoisson); | |
c3907f00 | 131 | |
132 | TIter next(&fAlgorithms); | |
133 | AliFMDMultAlgorithm* algorithm = 0; | |
134 | while ((algorithm = static_cast<AliFMDMultAlgorithm*>(next()))) | |
135 | algorithm->PreRun(0); | |
4347b38f | 136 | } |
137 | ||
42403906 | 138 | |
139 | //____________________________________________________________________ | |
140 | AliFMDReconstructor::AliFMDReconstructor(const AliFMDReconstructor& other) | |
141 | : AliReconstructor(), | |
42403906 | 142 | fPedestal(0), |
e802be3e | 143 | fPedestalWidth(0), |
144 | fPedestalFactor(0) | |
42403906 | 145 | { |
56b1929b | 146 | // Copy constructor |
1a1fdef7 | 147 | fPedestal = other.fPedestal; |
148 | fPedestalWidth = other.fPedestalWidth; | |
149 | fPedestalFactor = other.fPedestalFactor; | |
42403906 | 150 | |
56b1929b | 151 | |
152 | fAlgorithms.Delete(); | |
153 | TIter next(&(other.fAlgorithms)); | |
154 | AliFMDMultAlgorithm* algorithm = 0; | |
155 | while ((algorithm = static_cast<AliFMDMultAlgorithm*>(next()))) | |
156 | fAlgorithms.Add(algorithm); | |
157 | fAlgorithms.SetOwner(kFALSE); | |
42403906 | 158 | } |
159 | ||
160 | ||
161 | //____________________________________________________________________ | |
162 | AliFMDReconstructor& | |
163 | AliFMDReconstructor::operator=(const AliFMDReconstructor& other) | |
164 | { | |
56b1929b | 165 | // Assignment operator |
1a1fdef7 | 166 | fPedestal = other.fPedestal; |
167 | fPedestalWidth = other.fPedestalWidth; | |
168 | fPedestalFactor = other.fPedestalFactor; | |
42403906 | 169 | |
56b1929b | 170 | fAlgorithms.Delete(); |
171 | TIter next(&(other.fAlgorithms)); | |
172 | AliFMDMultAlgorithm* algorithm = 0; | |
173 | while ((algorithm = static_cast<AliFMDMultAlgorithm*>(next()))) | |
174 | fAlgorithms.Add(algorithm); | |
175 | fAlgorithms.SetOwner(kFALSE); | |
176 | ||
42403906 | 177 | return *this; |
178 | } | |
56b1929b | 179 | |
180 | //____________________________________________________________________ | |
181 | AliFMDReconstructor::~AliFMDReconstructor() | |
182 | { | |
183 | // Destructor | |
184 | fAlgorithms.Delete(); | |
185 | } | |
4347b38f | 186 | |
187 | //____________________________________________________________________ | |
188 | void | |
1a1fdef7 | 189 | AliFMDReconstructor::Init(AliRunLoader* runLoader) |
190 | { | |
191 | // Initialize the reconstructor | |
192 | AliDebug(1, Form("Init called with runloader 0x%x", runLoader)); | |
193 | fCurrentVertex = 0; | |
194 | if (!runLoader) { | |
195 | Warning("Init", "No run loader"); | |
4347b38f | 196 | return; |
197 | } | |
1a1fdef7 | 198 | AliHeader* header = runLoader->GetHeader(); |
199 | if (!header) { | |
200 | Warning("Init", "No header"); | |
4347b38f | 201 | return; |
202 | } | |
1a1fdef7 | 203 | AliGenEventHeader* eventHeader = header->GenEventHeader(); |
204 | if (!eventHeader) { | |
205 | Warning("Init", "no event header"); | |
206 | return; | |
4347b38f | 207 | } |
1a1fdef7 | 208 | TArrayF vtx; |
209 | eventHeader->PrimaryVertex(vtx); | |
210 | fCurrentVertex = vtx[2]; | |
211 | AliDebug(1, Form("Primary vertex Z coordinate for event # %d/%d is %f", | |
212 | header->GetRun(), header->GetEvent(), fCurrentVertex)); | |
4347b38f | 213 | } |
dc8af42e | 214 | |
4347b38f | 215 | //____________________________________________________________________ |
216 | void | |
1a1fdef7 | 217 | AliFMDReconstructor::ConvertDigits(AliRawReader* reader, |
218 | TTree* digitsTree) const | |
219 | { | |
220 | // Convert Raw digits to AliFMDDigit's in a tree | |
221 | AliFMDRawReader rawRead(reader, digitsTree); | |
222 | // rawRead.SetSampleRate(fFMD->GetSampleRate()); | |
223 | rawRead.Exec(); | |
4347b38f | 224 | } |
225 | ||
4347b38f | 226 | //____________________________________________________________________ |
227 | void | |
1a1fdef7 | 228 | AliFMDReconstructor::Reconstruct(TTree* digitsTree, |
229 | TTree* clusterTree) const | |
4347b38f | 230 | { |
1a1fdef7 | 231 | // Reconstruct event from digits in tree |
4347b38f | 232 | // Get the FMD branch holding the digits. |
69b696b9 | 233 | // FIXME: The vertex may not be known yet, so we may have to move |
234 | // some of this to FillESD. | |
1a1fdef7 | 235 | AliDebug(1, "Reconstructing from digits in a tree"); |
236 | ||
237 | TBranch *digitBranch = digitsTree->GetBranch("FMD"); | |
4347b38f | 238 | if (!digitBranch) { |
1a1fdef7 | 239 | Error("Exec", "No digit branch for the FMD found"); |
240 | return; | |
4347b38f | 241 | } |
0abe7182 | 242 | TClonesArray* digits = new TClonesArray("AliFMDDigit"); |
1a1fdef7 | 243 | digitBranch->SetAddress(&digits); |
4347b38f | 244 | |
e802be3e | 245 | TIter next(&fAlgorithms); |
56b1929b | 246 | AliFMDMultAlgorithm* algorithm = 0; |
247 | while ((algorithm = static_cast<AliFMDMultAlgorithm*>(next()))) | |
1a1fdef7 | 248 | algorithm->PreEvent(clusterTree, fCurrentVertex); |
249 | digitBranch->GetEntry(0); | |
250 | ||
e802be3e | 251 | ProcessDigits(digits); |
252 | ||
253 | next.Reset(); | |
254 | algorithm = 0; | |
56b1929b | 255 | while ((algorithm = static_cast<AliFMDMultAlgorithm*>(next()))) |
e802be3e | 256 | algorithm->PostEvent(); |
1a1fdef7 | 257 | clusterTree->Fill(); |
0abe7182 | 258 | digits->Delete(); |
259 | delete digits; | |
4347b38f | 260 | } |
1a1fdef7 | 261 | |
4347b38f | 262 | //____________________________________________________________________ |
e802be3e | 263 | void |
264 | AliFMDReconstructor::ProcessDigits(TClonesArray* digits) const | |
4347b38f | 265 | { |
69b696b9 | 266 | // For each digit, find the pseudo rapdity, azimuthal angle, and |
267 | // number of corrected ADC counts, and pass it on to the algorithms | |
268 | // used. | |
e802be3e | 269 | Int_t nDigits = digits->GetEntries(); |
1a1fdef7 | 270 | AliDebug(1, Form("Got %d digits", nDigits)); |
e802be3e | 271 | for (Int_t i = 0; i < nDigits; i++) { |
272 | AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i)); | |
1a1fdef7 | 273 | AliFMDGeometry* fmd = AliFMDGeometry::Instance(); |
274 | AliFMDDetector* subDetector = fmd->GetDetector(digit->Detector()); | |
e802be3e | 275 | if (!subDetector) { |
276 | Warning("ProcessDigits", "Unknown detector: FMD%d" , digit->Detector()); | |
277 | continue; | |
278 | } | |
4347b38f | 279 | |
1a1fdef7 | 280 | AliFMDRing* ring = subDetector->GetRing(digit->Ring()); |
281 | Float_t ringZ = subDetector->GetRingZ(digit->Ring()); | |
e802be3e | 282 | if (!ring) { |
283 | Warning("ProcessDigits", "Unknown ring: FMD%d%c", digit->Detector(), | |
284 | digit->Ring()); | |
285 | break; | |
4347b38f | 286 | } |
287 | ||
e802be3e | 288 | Float_t realZ = fCurrentVertex + ringZ; |
56b1929b | 289 | Float_t stripR = ((ring->GetHighR() - ring->GetLowR()) |
290 | / ring->GetNStrips() * (digit->Strip() + .5) | |
291 | + ring->GetLowR()); | |
e802be3e | 292 | Float_t theta = TMath::ATan2(stripR, realZ); |
293 | Float_t phi = (2 * TMath::Pi() / ring->GetNSectors() | |
294 | * (digit->Sector() + .5)); | |
295 | Float_t eta = -TMath::Log(TMath::Tan(theta / 2)); | |
296 | UShort_t counts = SubtractPedestal(digit); | |
4347b38f | 297 | |
e802be3e | 298 | TIter next(&fAlgorithms); |
56b1929b | 299 | AliFMDMultAlgorithm* algorithm = 0; |
300 | while ((algorithm = static_cast<AliFMDMultAlgorithm*>(next()))) | |
e802be3e | 301 | algorithm->ProcessDigit(digit, eta, phi, counts); |
4347b38f | 302 | } |
4347b38f | 303 | } |
4347b38f | 304 | |
1a1fdef7 | 305 | //____________________________________________________________________ |
306 | UShort_t | |
307 | AliFMDReconstructor::SubtractPedestal(AliFMDDigit* digit) const | |
308 | { | |
309 | // Member function to subtract the pedestal from a digit | |
310 | // This implementation does nothing, but a derived class could over | |
311 | // load this to subtract a pedestal that was given in a database or | |
312 | // something like that. | |
313 | ||
314 | Int_t counts = 0; | |
315 | Float_t ped = fPedestal + fPedestalFactor * fPedestalWidth; | |
316 | if (digit->Count3() > 0) counts = digit->Count3(); | |
317 | else if (digit->Count2() > 0) counts = digit->Count2(); | |
318 | else counts = digit->Count1(); | |
319 | counts = TMath::Max(Int_t(counts - ped), 0); | |
320 | return UShort_t(counts); | |
321 | } | |
322 | ||
4347b38f | 323 | //____________________________________________________________________ |
324 | void | |
1a1fdef7 | 325 | AliFMDReconstructor::FillESD(TTree* /* digitsTree */, |
326 | TTree* /* clusterTree */, | |
327 | AliESD* /* esd*/) const | |
121a60bd | 328 | { |
42403906 | 329 | // nothing to be done |
69b696b9 | 330 | // FIXME: The vertex may not be known when Reconstruct is executed, |
331 | // so we may have to move some of that member function here. | |
121a60bd | 332 | |
333 | } | |
334 | ||
42403906 | 335 | //____________________________________________________________________ |
336 | // | |
337 | // EOF | |
338 | // |