]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | /* | |
17 | $Log$ | |
b94fa26c | 18 | Revision 1.19 2001/03/12 17:47:25 hristov |
19 | Changes needed on Sun with CC 5.0 | |
20 | ||
5cf7bbad | 21 | Revision 1.18 2001/01/26 19:57:42 hristov |
22 | Major upgrade of AliRoot code | |
23 | ||
2ab0c725 | 24 | Revision 1.17 2000/10/19 09:58:14 vicinanz |
25 | Updated Hits2Digit procedure | |
26 | ||
c2af3d73 | 27 | Revision 1.16 2000/10/02 21:28:17 fca |
28 | Removal of useless dependecies via forward declarations | |
29 | ||
94de3818 | 30 | Revision 1.15 2000/05/18 14:33:01 vicinanz |
31 | Modified to be full HP compliant | |
32 | ||
f5489efc | 33 | Revision 1.14 2000/05/15 19:32:36 fca |
34 | Add AddHitList !! | |
35 | ||
c8bd506f | 36 | Revision 1.13 2000/05/10 16:52:18 vicinanz |
37 | New TOF version with holes for PHOS/RICH | |
38 | ||
2cef3cb2 | 39 | Revision 1.11.2.1 2000/05/10 09:37:15 vicinanz |
40 | New version with Holes for PHOS/RICH | |
41 | ||
1cedd08a | 42 | Revision 1.11 1999/11/05 22:39:06 fca |
43 | New hits structure | |
44 | ||
826b71ec | 45 | Revision 1.10 1999/11/01 20:41:57 fca |
46 | Added protections against using the wrong version of FRAME | |
47 | ||
ab76897d | 48 | Revision 1.9 1999/10/15 15:35:19 fca |
49 | New version for frame1099 with and without holes | |
50 | ||
937fe4a4 | 51 | Revision 1.9 1999/09/29 09:24:33 fca |
52 | Introduction of the Copyright and cvs Log | |
4c039060 | 53 | |
937fe4a4 | 54 | */ |
fe4da5cc | 55 | /////////////////////////////////////////////////////////////////////////////// |
56 | // // | |
937fe4a4 | 57 | // Time Of Flight FCA // |
fe4da5cc | 58 | // This class contains the basic functions for the Time Of Flight // |
59 | // detector. Functions specific to one particular geometry are // | |
60 | // contained in the derived classes // | |
937fe4a4 | 61 | // |
62 | // VERSIONE WITH 5 SYMMETRIC MODULES ALONG Z AXIS | |
63 | // ============================================== | |
64 | // | |
65 | // VERSION WITH HOLES FOR PHOS AND TRD IN SPACEFRAME WITH HOLES | |
66 | // | |
67 | // Volume sensibile : FPAD | |
68 | // | |
69 | // | |
70 | // | |
71 | // Begin_Html | |
fe4da5cc | 72 | /* |
1439f98e | 73 | <img src="picts/AliTOFClass.gif"> |
fe4da5cc | 74 | */ |
75 | //End_Html | |
937fe4a4 | 76 | // |
77 | // | |
fe4da5cc | 78 | // // |
79 | /////////////////////////////////////////////////////////////////////////////// | |
80 | ||
826b71ec | 81 | #include <iostream.h> |
82 | ||
fe4da5cc | 83 | #include "AliTOF.h" |
2cef3cb2 | 84 | #include "AliTOFD.h" |
826b71ec | 85 | #include "TBRIK.h" |
2cef3cb2 | 86 | #include "TNode.h" |
87 | #include "TObject.h" | |
88 | #include "TRandom.h" | |
94de3818 | 89 | #include "TTree.h" |
2ab0c725 | 90 | #include "TFile.h" |
94de3818 | 91 | |
fe4da5cc | 92 | #include "AliRun.h" |
94de3818 | 93 | #include "AliMC.h" |
94 | #include "AliMagF.h" | |
fe4da5cc | 95 | #include "AliConst.h" |
2cef3cb2 | 96 | |
fe4da5cc | 97 | |
98 | ClassImp(AliTOF) | |
99 | ||
100 | //_____________________________________________________________________________ | |
101 | AliTOF::AliTOF() | |
102 | { | |
103 | // | |
104 | // Default constructor | |
105 | // | |
106 | fIshunt = 0; | |
107 | } | |
108 | ||
109 | //_____________________________________________________________________________ | |
110 | AliTOF::AliTOF(const char *name, const char *title) | |
111 | : AliDetector(name,title) | |
112 | { | |
113 | // | |
114 | // AliTOF standard constructor | |
115 | // | |
2cef3cb2 | 116 | // Here are fixed some important parameters |
117 | // | |
118 | ||
119 | // Initialization of hits and digits array | |
120 | // | |
fe4da5cc | 121 | fHits = new TClonesArray("AliTOFhit", 405); |
c8bd506f | 122 | gAlice->AddHitList(fHits); |
2cef3cb2 | 123 | fIshunt = 0; |
124 | fDigits = new TClonesArray("AliTOFdigit",405); | |
125 | // | |
126 | // Digitization parameters | |
fe4da5cc | 127 | // |
2cef3cb2 | 128 | // (Transfer Functions to be inserted here) |
fe4da5cc | 129 | // |
130 | SetMarkerColor(7); | |
131 | SetMarkerStyle(2); | |
132 | SetMarkerSize(0.4); | |
2cef3cb2 | 133 | |
134 | // General Geometrical Parameters | |
b94fa26c | 135 | fNTof = 18; // number of sectors |
136 | fRmax = 399.0;//cm | |
2cef3cb2 | 137 | fRmin = 370.0;//cm |
b94fa26c | 138 | fZlenC = 177.5;//cm length of module C |
139 | fZlenB = 141.0;//cm length of module B | |
140 | fZlenA = 106.0;//cm length of module A | |
141 | fZtof = 370.5;//cm total semi-length of TOF detector | |
2cef3cb2 | 142 | |
143 | // Strip Parameters | |
144 | fStripLn = 122.0;//cm Strip Length | |
145 | fSpace = 5.5;//cm Space Beetween the strip and the bottom of the plate | |
146 | fDeadBndZ= 1.5;//cm Dead Boundaries of a Strip along Z direction (width) | |
147 | fDeadBndX= 1.0;//cm Dead Boundaries of a Strip along X direction (length) | |
148 | fXpad = 2.5;//cm X size of a pad | |
149 | fZpad = 3.5;//cm Z size of a pad | |
150 | fGapA = 4.; //cm Gap beetween tilted strip in A-type plate | |
151 | fGapB = 6.; //cm Gap beetween tilted strip in B-type plate | |
152 | fOverSpc = 15.3;//cm Space available for sensitive layers in radial direction | |
153 | fNpadX = 48; // Number of pads in a strip along the X direction | |
154 | fNpadZ = 2; // Number of pads in a strip along the Z direction | |
155 | fPadXStr = fNpadX*fNpadZ; //Number of pads per strip | |
b94fa26c | 156 | fNStripA = 15; // number of strips in A type module |
157 | fNStripB = 19; // number of strips in B type module | |
158 | fNStripC = 20; // number of strips in C type module | |
2cef3cb2 | 159 | |
160 | // Physical performances | |
161 | fTimeRes = 100.;//ps | |
162 | fChrgRes = 100.;//pC | |
163 | ||
164 | // DAQ characteristics | |
165 | fPadXSector = 1932; | |
166 | fNRoc = 14; | |
167 | fNFec = 32; | |
168 | fNTdc = 32; | |
169 | fNPadXRoc = (Int_t)fPadXSector/fNRoc; | |
fe4da5cc | 170 | } |
171 | ||
172 | //_____________________________________________________________________________ | |
2cef3cb2 | 173 | void AliTOF::AddHit(Int_t track, Int_t *vol, Float_t *hits) |
fe4da5cc | 174 | { |
175 | // | |
176 | // Add a TOF hit | |
177 | // | |
178 | TClonesArray &lhits = *fHits; | |
2cef3cb2 | 179 | new(lhits[fNhits++]) AliTOFhit(fIshunt, track, vol, hits); |
fe4da5cc | 180 | } |
181 | ||
182 | //_____________________________________________________________________________ | |
2cef3cb2 | 183 | void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits) |
fe4da5cc | 184 | { |
185 | // | |
2cef3cb2 | 186 | // Add a TOF digit |
187 | // | |
188 | TClonesArray &ldigits = *fDigits; | |
189 | new (ldigits[fNdigits++]) AliTOFdigit(tracks, vol, digits); | |
fe4da5cc | 190 | } |
191 | ||
2cef3cb2 | 192 | |
fe4da5cc | 193 | //_____________________________________________________________________________ |
194 | void AliTOF::CreateGeometry() | |
195 | { | |
196 | // | |
3fe3a833 | 197 | // Common geometry code |
fe4da5cc | 198 | // |
199 | //Begin_Html | |
200 | /* | |
1439f98e | 201 | <img src="picts/AliTOFv23.gif"> |
fe4da5cc | 202 | */ |
203 | //End_Html | |
204 | // | |
fe4da5cc | 205 | const Double_t kPi=TMath::Pi(); |
2cef3cb2 | 206 | const Double_t kDegrad=kPi/180.; |
fe4da5cc | 207 | // |
b94fa26c | 208 | Float_t xTof, yTof, wall; |
937fe4a4 | 209 | |
3fe3a833 | 210 | // frame inbetween TOF modules |
b94fa26c | 211 | wall = 4.;//cm |
3fe3a833 | 212 | |
2cef3cb2 | 213 | // Sizes of TOF module with its support etc.. |
b94fa26c | 214 | xTof = 2.*(fRmin*TMath::Tan(10*kDegrad)-wall/2-.5); |
2cef3cb2 | 215 | yTof = fRmax-fRmin; |
3fe3a833 | 216 | |
937fe4a4 | 217 | // TOF module internal definitions |
2cef3cb2 | 218 | TOFpc(xTof, yTof, fZlenC, fZlenB, fZlenA, fZtof); |
fe4da5cc | 219 | } |
220 | ||
221 | //_____________________________________________________________________________ | |
8f72dc0c | 222 | void AliTOF::DrawModule() |
fe4da5cc | 223 | { |
224 | // | |
225 | // Draw a shaded view of the common part of the TOF geometry | |
fe4da5cc | 226 | // |
227 | ||
3fe3a833 | 228 | cout << " Drawing of AliTOF"<< endl; |
fe4da5cc | 229 | // Set everything unseen |
cfce8870 | 230 | gMC->Gsatt("*", "seen", -1); |
fe4da5cc | 231 | // |
232 | // Set ALIC mother transparent | |
cfce8870 | 233 | gMC->Gsatt("ALIC","SEEN",0); |
fe4da5cc | 234 | // |
235 | // Set the volumes visible | |
2cef3cb2 | 236 | gMC->Gsatt("FTOA","SEEN",1); |
237 | gMC->Gsatt("FTOB","SEEN",1); | |
238 | gMC->Gsatt("FTOC","SEEN",1); | |
239 | gMC->Gsatt("FLTA","SEEN",1); | |
240 | gMC->Gsatt("FLTB","SEEN",1); | |
241 | gMC->Gsatt("FLTC","SEEN",1); | |
242 | gMC->Gsatt("FSTR","SEEN",1); | |
cfce8870 | 243 | // |
244 | gMC->Gdopt("hide", "on"); | |
245 | gMC->Gdopt("shad", "on"); | |
246 | gMC->Gsatt("*", "fill", 7); | |
247 | gMC->SetClipBox("."); | |
248 | gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000); | |
249 | gMC->DefaultRange(); | |
250 | gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02); | |
251 | gMC->Gdhead(1111, "Time Of Flight"); | |
252 | gMC->Gdman(18, 4, "MAN"); | |
253 | gMC->Gdopt("hide","off"); | |
fe4da5cc | 254 | } |
255 | ||
256 | //_____________________________________________________________________________ | |
257 | void AliTOF::CreateMaterials() | |
258 | { | |
259 | // | |
260 | // Defines TOF materials for all versions | |
2cef3cb2 | 261 | // Authors : Maxim Martemianov, Boris Zagreev (ITEP) |
262 | // 18/09/98 | |
b94fa26c | 263 | // Revision: F. Pierella 5-3-2001 |
264 | // Bologna University | |
fe4da5cc | 265 | // |
b94fa26c | 266 | Int_t isxfld = gAlice->Field()->Integ(); |
267 | Float_t sxmgmx = gAlice->Field()->Max(); | |
fe4da5cc | 268 | // |
3fe3a833 | 269 | //--- Quartz (SiO2) |
270 | Float_t aq[2] = { 28.0855,15.9994 }; | |
271 | Float_t zq[2] = { 14.,8. }; | |
272 | Float_t wq[2] = { 1.,2. }; | |
273 | Float_t dq = 2.20; | |
274 | Int_t nq = -2; | |
b94fa26c | 275 | // --- Freon C2F4H2 (TOF-TDR pagg.) |
276 | // Geant Manual CONS110-1, pag. 43 (Geant, Detector Description and Simulation Tool) | |
277 | Float_t afre[3] = {12.011,18.998,1.007}; | |
278 | Float_t zfre[3] = { 6., 9., 1.}; | |
279 | Float_t wfre[3] = { 2., 4., 2.}; | |
280 | Float_t densfre = 0.00375; | |
281 | // http://www.fi.infn.it/sezione/prevprot/gas/freon.html | |
282 | Int_t nfre = -3; | |
283 | /* | |
284 | //-- Isobutane quencher C4H10 (5% in the sensitive mixture) | |
285 | Float_t aiso[2] = {12.011,1.007}; | |
286 | Float_t ziso[2] = { 6., 1.}; | |
287 | Float_t wiso[2] = { 4., 10.}; | |
288 | Float_t densiso = .......; // (g/cm3) density | |
289 | Int_t nfre = -2; // < 0 i.e. proportion by number of atoms of each kind | |
290 | //-- SF6 (5% in the sensitive mixture) | |
291 | Float_t asf[3] = {32.066,18.998}; | |
292 | Float_t zsf[3] = { 16., 9.}; | |
293 | Float_t wsf[3] = { 1., 6.}; | |
294 | Float_t denssf = .....; // (g/cm3) density | |
295 | Int_t nfre = -2; // < 0 i.e. proportion by number of atoms of each kind | |
296 | */ | |
3fe3a833 | 297 | // --- CO2 |
2cef3cb2 | 298 | Float_t ac[2] = {12.,16.}; |
299 | Float_t zc[2] = { 6., 8.}; | |
300 | Float_t wc[2] = { 1., 2.}; | |
3fe3a833 | 301 | Float_t dc = .001977; |
302 | Int_t nc = -2; | |
303 | // For mylar (C5H4O2) | |
304 | Float_t amy[3] = { 12., 1., 16. }; | |
305 | Float_t zmy[3] = { 6., 1., 8. }; | |
306 | Float_t wmy[3] = { 5., 4., 2. }; | |
307 | Float_t dmy = 1.39; | |
308 | Int_t nmy = -3; | |
b94fa26c | 309 | // For polyethilene (CH2) - honeycomb - |
3fe3a833 | 310 | Float_t ape[2] = { 12., 1. }; |
311 | Float_t zpe[2] = { 6., 1. }; | |
312 | Float_t wpe[2] = { 1., 2. }; | |
313 | Float_t dpe = 0.935*0.479; //To have 1%X0 for 1cm as for honeycomb | |
314 | Int_t npe = -2; | |
315 | // --- G10 | |
fe4da5cc | 316 | Float_t ag10[4] = { 12.,1.,16.,28. }; |
2cef3cb2 | 317 | Float_t zg10[4] = { 6.,1., 8.,14. }; |
fe4da5cc | 318 | Float_t wmatg10[4] = { .259,.288,.248,.205 }; |
3fe3a833 | 319 | Float_t densg10 = 1.7; |
320 | Int_t nlmatg10 = -4; | |
321 | // --- DME | |
fe4da5cc | 322 | Float_t adme[5] = { 12.,1.,16.,19.,79. }; |
2cef3cb2 | 323 | Float_t zdme[5] = { 6.,1., 8., 9.,35. }; |
fe4da5cc | 324 | Float_t wmatdme[5] = { .4056,.0961,.2562,.1014,.1407 }; |
3fe3a833 | 325 | Float_t densdme = .00205; |
326 | Int_t nlmatdme = 5; | |
327 | // ---- ALUMINA (AL203) | |
2cef3cb2 | 328 | Float_t aal[2] = { 27.,16.}; |
329 | Float_t zal[2] = { 13., 8.}; | |
fe4da5cc | 330 | Float_t wmatal[2] = { 2.,3. }; |
3fe3a833 | 331 | Float_t densal = 2.3; |
332 | Int_t nlmatal = -2; | |
333 | // -- Water | |
334 | Float_t awa[2] = { 1., 16. }; | |
335 | Float_t zwa[2] = { 1., 8. }; | |
336 | Float_t wwa[2] = { 2., 1. }; | |
337 | Float_t dwa = 1.0; | |
338 | Int_t nwa = -2; | |
fe4da5cc | 339 | // |
3fe3a833 | 340 | //AliMaterial(0, "Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16); |
2cef3cb2 | 341 | AliMaterial( 1, "Air$",14.61,7.3,0.001205,30423.24,67500.); |
342 | AliMaterial( 2, "Cu $", 63.54, 29.0, 8.96, 1.43, 14.8); | |
343 | AliMaterial( 3, "C $", 12.01, 6.0, 2.265,18.8, 74.4); | |
344 | AliMixture ( 4, "Polyethilene$", ape, zpe, dpe, npe, wpe); | |
345 | AliMixture ( 5, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10); | |
346 | AliMixture ( 6, "DME ", adme, zdme, densdme, nlmatdme, wmatdme); | |
347 | AliMixture ( 7, "CO2$", ac, zc, dc, nc, wc); | |
348 | AliMixture ( 8, "ALUMINA$", aal, zal, densal, nlmatal, wmatal); | |
349 | AliMaterial( 9, "Al $", 26.98, 13., 2.7, 8.9, 37.2); | |
3fe3a833 | 350 | AliMaterial(10, "C-TRD$", 12.01, 6., 2.265*18.8/69.282*15./100, 18.8, 74.4); // for 15% |
2cef3cb2 | 351 | AliMixture (11, "Mylar$", amy, zmy, dmy, nmy, wmy); |
352 | AliMixture (12, "Freon$", afre, zfre, densfre, nfre, wfre); | |
353 | AliMixture (13, "Quartz$", aq, zq, dq, nq, wq); | |
354 | AliMixture (14, "Water$", awa, zwa, dwa, nwa, wwa); | |
3fe3a833 | 355 | |
356 | Float_t epsil, stmin, deemax, stemax; | |
2cef3cb2 | 357 | |
358 | // Previous data | |
fe4da5cc | 359 | // EPSIL = 0.1 ! Tracking precision, |
360 | // STEMAX = 0.1 ! Maximum displacement for multiple scattering | |
361 | // DEEMAX = 0.1 ! Maximum fractional energy loss, DLS | |
362 | // STMIN = 0.1 | |
2cef3cb2 | 363 | // |
364 | // New data | |
365 | epsil = .001; // Tracking precision, | |
366 | stemax = -1.; // Maximum displacement for multiple scattering | |
367 | deemax = -.3; // Maximum fractional energy loss, DLS | |
fe4da5cc | 368 | stmin = -.8; |
937fe4a4 | 369 | |
b94fa26c | 370 | AliMedium( 1, "Air$" , 1, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); |
371 | AliMedium( 2, "Cu $" , 2, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
372 | AliMedium( 3, "C $" , 3, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
373 | AliMedium( 4, "Pol$" , 4, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
374 | AliMedium( 5, "G10$" , 5, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
375 | AliMedium( 6, "DME$" , 6, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
376 | AliMedium( 7, "CO2$" , 7, 0, isxfld, sxmgmx, 10., -.01, -.1, .01, -.01); | |
377 | AliMedium( 8,"ALUMINA$", 8, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
378 | AliMedium( 9,"Al Frame$",9, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
379 | AliMedium(10, "DME-S$", 6, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
380 | AliMedium(11, "C-TRD$", 10, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
381 | AliMedium(12, "Myl$" , 11, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
382 | AliMedium(13, "Fre$" , 12, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
383 | AliMedium(14, "Fre-S$", 12, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
384 | AliMedium(15, "Glass$", 13, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
385 | AliMedium(16, "Water$", 14, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin); | |
fe4da5cc | 386 | } |
387 | ||
388 | //_____________________________________________________________________________ | |
389 | Int_t AliTOF::DistancetoPrimitive(Int_t , Int_t ) | |
390 | { | |
391 | // | |
392 | // Returns distance from mouse pointer to detector, default version | |
393 | // | |
394 | return 9999; | |
395 | } | |
396 | ||
397 | //_____________________________________________________________________________ | |
398 | void AliTOF::Init() | |
399 | { | |
400 | // | |
401 | // Initialise TOF detector after it has been built | |
402 | // | |
fe4da5cc | 403 | // Set id of TOF sensitive volume |
937fe4a4 | 404 | if (IsVersion() !=0) fIdSens=gMC->VolId("FPAD"); |
fe4da5cc | 405 | // |
fe4da5cc | 406 | } |
407 | ||
2cef3cb2 | 408 | //____________________________________________________________________________ |
2ab0c725 | 409 | void AliTOF::MakeBranch(Option_t* option, char *file) |
2cef3cb2 | 410 | { |
b94fa26c | 411 | // |
412 | // Initializes the Branches of the TOF inside the | |
413 | // trees written for each event. | |
414 | // AliDetector::MakeBranch initializes just the | |
415 | // Branch inside TreeH. Here we add the branch in | |
416 | // TreeD. | |
417 | // | |
2cef3cb2 | 418 | |
2ab0c725 | 419 | AliDetector::MakeBranch(option,file); |
2cef3cb2 | 420 | |
421 | Int_t buffersize = 4000; | |
422 | Char_t branchname[10]; | |
423 | sprintf(branchname,"%s",GetName()); | |
2ab0c725 | 424 | |
5cf7bbad | 425 | const char *D = strstr(option,"D"); |
2cef3cb2 | 426 | |
427 | if (fDigits && gAlice->TreeD() && D){ | |
2ab0c725 | 428 | gAlice->MakeBranchInTree(gAlice->TreeD(), |
429 | branchname, &fDigits,buffersize, file) ; | |
2cef3cb2 | 430 | } |
431 | } | |
432 | ||
433 | //____________________________________________________________________________ | |
434 | void AliTOF::FinishEvent() | |
435 | { | |
436 | // Hits2Digits(); | |
437 | } | |
438 | ||
2ab0c725 | 439 | //___________________________________________ |
440 | void AliTOF::SDigits2Digits() | |
441 | { | |
442 | // | |
443 | // Genneratedigits | |
444 | // | |
445 | int nparticles = gAlice->GetNtrack(); | |
446 | cout << "Particles :" <<nparticles<<endl; | |
447 | if (nparticles > 0 ) { | |
448 | Hits2Digits(0); | |
449 | } | |
450 | } | |
2cef3cb2 | 451 | |
452 | //____________________________________________________________________________ | |
453 | void AliTOF::Hits2Digits(Int_t evNumber) | |
b94fa26c | 454 | { |
2cef3cb2 | 455 | // |
456 | // Starting from the Hits Tree (TreeH), this | |
457 | // function writes the Digits Tree (TreeD) storing | |
458 | // the digits informations. | |
459 | // Has to be called just at the end of an event or | |
460 | // at the end of a whole run. | |
461 | // It could also be called by AliTOF::Finish Event() | |
462 | // but it can be too heavy. | |
463 | // Just for MC events. | |
464 | // | |
465 | // Called by the macro H2D.C | |
466 | // | |
b94fa26c | 467 | |
2cef3cb2 | 468 | AliTOFhit* currentHit; |
b94fa26c | 469 | TTree *tD, *tH; |
2cef3cb2 | 470 | Int_t tracks[3]; |
471 | Int_t vol[5]; | |
472 | Float_t digit[2]; | |
b94fa26c | 473 | TClonesArray* tofhits=this->Hits(); |
2cef3cb2 | 474 | |
2ab0c725 | 475 | Int_t nparticles = gAlice->GetNtrack(); |
2cef3cb2 | 476 | if (nparticles <= 0) return; |
477 | ||
b94fa26c | 478 | tD = gAlice->TreeD(); |
479 | tH = gAlice->TreeH(); | |
480 | Int_t ntracks =(Int_t) tH->GetEntries(); | |
2cef3cb2 | 481 | Int_t nbytes, nhits; |
b94fa26c | 482 | TRandom* rnd = new TRandom(); |
2cef3cb2 | 483 | |
484 | for (Int_t ntk=0; ntk<ntracks; ntk++){ | |
485 | ||
b94fa26c | 486 | nbytes = tH->GetEvent(ntk); |
487 | nhits = tofhits->GetEntriesFast(); | |
2cef3cb2 | 488 | |
489 | for (Int_t hit=0; hit<nhits; hit++){ | |
490 | ||
b94fa26c | 491 | currentHit = (AliTOFhit*)(tofhits->At(hit)); |
2cef3cb2 | 492 | |
493 | vol[0] = currentHit->GetSector(); | |
494 | vol[1] = currentHit->GetPlate(); | |
b94fa26c | 495 | vol[2] = currentHit->GetPadx(); |
496 | vol[3] = currentHit->GetPadz(); | |
2cef3cb2 | 497 | vol[4] = currentHit->GetStrip(); |
498 | ||
b94fa26c | 499 | Float_t idealtime = currentHit->GetTof(); |
500 | Float_t tdctime = rnd->Gaus(idealtime, fTimeRes); | |
501 | digit[0] = tdctime; | |
2cef3cb2 | 502 | |
b94fa26c | 503 | Float_t idealcharge = currentHit->GetEdep(); |
504 | Float_t adccharge = rnd->Gaus(idealcharge, fChrgRes); | |
505 | digit[1] = adccharge; | |
2cef3cb2 | 506 | |
b94fa26c | 507 | Int_t tracknum = currentHit -> GetTrack(); |
508 | tracks[0] = tracknum; | |
2cef3cb2 | 509 | tracks[1] = 0; |
510 | tracks[2] = 0; | |
511 | ||
b94fa26c | 512 | Bool_t overlap = CheckOverlap(vol, digit, tracknum); |
513 | if(!overlap) AddDigit(tracks, vol, digit); | |
2cef3cb2 | 514 | } |
515 | } | |
b94fa26c | 516 | delete rnd; |
517 | rnd = 0; | |
518 | tD->Fill(); | |
519 | tD->Write(); | |
2cef3cb2 | 520 | } |
521 | ||
522 | //___________________________________________________________________________ | |
523 | Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track) | |
b94fa26c | 524 | { |
2cef3cb2 | 525 | // |
526 | // Checks if 2 or more hits belong to the same pad. | |
527 | // In this case the data assigned to the digit object | |
528 | // are the ones of the first hit in order of Time. | |
529 | // | |
530 | // Called only by Hits2Digits. | |
531 | // | |
b94fa26c | 532 | |
533 | Bool_t overlap = 0; | |
2cef3cb2 | 534 | Int_t vol2[5]; |
535 | ||
536 | for (Int_t ndig=0; ndig<fNdigits; ndig++){ | |
537 | AliTOFdigit* currentDigit = (AliTOFdigit*)(fDigits->UncheckedAt(ndig)); | |
538 | currentDigit->GetLocation(vol2); | |
b94fa26c | 539 | Bool_t idem=1; |
2cef3cb2 | 540 | for (Int_t i=0;i<=4;i++){ |
b94fa26c | 541 | if (vol[i]!=vol2[i]) idem=0;} |
542 | if (idem){ | |
543 | Float_t tdc2 = digit[0]; | |
544 | Float_t tdc1 = currentDigit->GetTdc(); | |
545 | if (tdc1>tdc2){ | |
546 | currentDigit->SetTdc(tdc2); | |
2cef3cb2 | 547 | currentDigit->SetAdc(digit[1]); |
548 | } | |
549 | currentDigit->AddTrack(Track); | |
b94fa26c | 550 | overlap = 1; |
2cef3cb2 | 551 | } |
552 | } | |
b94fa26c | 553 | return overlap; |
2cef3cb2 | 554 | } |
555 | ||
556 | ||
557 | //____________________________________________________________________________ | |
558 | void AliTOF::Digits2Raw(Int_t evNumber) | |
b94fa26c | 559 | { |
2cef3cb2 | 560 | // |
561 | // Starting from digits, writes the | |
562 | // Raw Data objects, i.e. a | |
563 | // TClonesArray of 18 AliTOFRawSector objects | |
564 | // | |
565 | ||
b94fa26c | 566 | TTree* tD; |
2cef3cb2 | 567 | |
568 | Int_t nparticles = gAlice->GetEvent(evNumber); | |
569 | if (nparticles <= 0) return; | |
570 | ||
b94fa26c | 571 | tD = gAlice->TreeD(); |
2cef3cb2 | 572 | |
b94fa26c | 573 | TClonesArray* tofdigits = this->Digits(); |
574 | Int_t ndigits = tofdigits->GetEntriesFast(); | |
2cef3cb2 | 575 | |
b94fa26c | 576 | TClonesArray* rawsectors = new TClonesArray("AliTOFRawSector",fNTof+2); |
2cef3cb2 | 577 | |
578 | for (Int_t isect=1;isect<=fNTof;isect++){ | |
b94fa26c | 579 | AliTOFRawSector* currentSector = (AliTOFRawSector*)rawsectors->UncheckedAt(isect); |
580 | TClonesArray* rocData = (TClonesArray*)currentSector->GetRocData(); | |
2cef3cb2 | 581 | |
582 | for (Int_t digit=0; digit<ndigits; digit++){ | |
b94fa26c | 583 | AliTOFdigit* currentDigit = (AliTOFdigit*)tofdigits->UncheckedAt(digit); |
2cef3cb2 | 584 | Int_t sector = currentDigit->GetSector(); |
585 | if (sector==isect){ | |
b94fa26c | 586 | Int_t pad = currentDigit -> GetTotPad(); |
587 | Int_t roc = (Int_t)(pad/fNPadXRoc)-1; | |
588 | if (roc>=fNRoc) printf("Wrong n. of ROC ! Roc = %i",roc); | |
589 | Int_t padRoc = (Int_t) pad%fNPadXRoc; | |
590 | Int_t fec = (Int_t)(padRoc/fNFec)-1; | |
591 | Int_t tdc = (Int_t)(padRoc%fNFec)-1; | |
592 | Float_t time = currentDigit->GetTdc(); | |
593 | Float_t charge = currentDigit->GetAdc(); | |
594 | AliTOFRoc* currentROC = (AliTOFRoc*)rocData->UncheckedAt(roc); | |
595 | Int_t error = 0; | |
596 | currentROC->AddItem(fec, tdc, error, charge, time); | |
2cef3cb2 | 597 | } |
598 | } | |
599 | ||
b94fa26c | 600 | UInt_t totSize=16,rocSize=0; |
601 | UInt_t rocHead[14],rocChek[14]; | |
602 | UInt_t globalCheckSum=0; | |
2cef3cb2 | 603 | |
604 | for (UInt_t iRoc = 1; iRoc<(UInt_t)fNRoc; iRoc++){ | |
b94fa26c | 605 | AliTOFRoc* currentRoc = (AliTOFRoc*)rocData->UncheckedAt(iRoc); |
606 | rocSize = currentRoc->GetItems()*2+1; | |
607 | totSize += rocSize*4; | |
608 | if (rocSize>=TMath::Power(2,16)) rocSize=0; | |
609 | rocHead[iRoc] = iRoc<<28; | |
610 | rocHead[iRoc] += rocSize; | |
611 | rocChek[iRoc] = currentRoc->GetCheckSum(); | |
612 | Int_t headCheck = currentRoc->BitCount(rocHead[iRoc]); | |
613 | globalCheckSum += headCheck; | |
614 | globalCheckSum += rocChek[iRoc]; | |
2cef3cb2 | 615 | } |
616 | ||
b94fa26c | 617 | AliTOFRoc* dummyRoc = new AliTOFRoc(); |
618 | totSize *= 4; | |
619 | if (totSize>=TMath::Power(2,24)) totSize=0; | |
620 | UInt_t header = totSize; | |
621 | UInt_t sectId = ((UInt_t)isect)<<24; | |
622 | header += sectId; | |
623 | globalCheckSum += dummyRoc->BitCount(header); | |
624 | currentSector->SetGlobalCS(globalCheckSum); | |
625 | currentSector->SetHeader(header); | |
2cef3cb2 | 626 | } |
627 | } | |
628 | ||
629 | //____________________________________________________________________________ | |
630 | void AliTOF::Raw2Digits(Int_t evNumber) | |
b94fa26c | 631 | { |
2cef3cb2 | 632 | // |
633 | // Converts Raw Data objects into digits objects. | |
634 | // We schematize the raw data with a | |
635 | // TClonesArray of 18 AliTOFRawSector objects | |
636 | // | |
b94fa26c | 637 | |
638 | TTree *tD; | |
2cef3cb2 | 639 | Int_t vol[5]; |
640 | Int_t tracks[3]; | |
641 | Float_t digit[2]; | |
642 | ||
643 | tracks[0]=0; | |
644 | tracks[1]=0; | |
645 | tracks[2]=0; | |
fe4da5cc | 646 | |
2cef3cb2 | 647 | Int_t nparticles = gAlice->GetEvent(evNumber); |
648 | if (nparticles <= 0) return; | |
649 | ||
b94fa26c | 650 | tD = gAlice->TreeD(); |
2cef3cb2 | 651 | |
b94fa26c | 652 | TClonesArray* rawsectors = new TClonesArray("AliTOFRawSector",fNTof+2); |
2cef3cb2 | 653 | |
654 | for(Int_t nSec=1; nSec<=fNTof; nSec++){ | |
b94fa26c | 655 | AliTOFRawSector* currentSector = (AliTOFRawSector*)rawsectors->UncheckedAt(nSec); |
656 | TClonesArray* rocData = (TClonesArray*)currentSector->GetRocData(); | |
2cef3cb2 | 657 | for(Int_t nRoc=1; nRoc<=14; nRoc++){ |
b94fa26c | 658 | AliTOFRoc* currentRoc = (AliTOFRoc*)rocData->UncheckedAt(nRoc); |
2cef3cb2 | 659 | Int_t currentItems = currentRoc->GetItems(); |
660 | for(Int_t item=1; item<currentItems; item++){ | |
661 | Int_t nPad = currentRoc->GetTotPad(item); | |
662 | vol[0] = nSec; | |
663 | Int_t nStrip = (Int_t)(nPad/fPadXStr)+1; | |
664 | Int_t nPlate = 5; | |
665 | if (nStrip<=fNStripC+2*fNStripB+fNStripA) nPlate = 4; | |
666 | if (nStrip<=fNStripC+fNStripB+fNStripA) nPlate = 3; | |
667 | if (nStrip<=fNStripC+fNStripB) nPlate = 2; | |
668 | if (nStrip<=fNStripC) nPlate=1; | |
669 | vol[1] = nPlate; | |
670 | switch (nPlate){ | |
671 | case 1: break; | |
672 | case 2: nStrip -= (fNStripC); | |
673 | break; | |
674 | case 3: nStrip -= (fNStripC+fNStripB); | |
675 | break; | |
676 | case 4: nStrip -= (fNStripC+fNStripB+fNStripA); | |
677 | break; | |
678 | case 5: nStrip -= (fNStripC+2*fNStripB+fNStripA); | |
679 | break; | |
680 | } | |
681 | vol[2] = nStrip; | |
b94fa26c | 682 | Int_t pad = nPad%fPadXStr; |
683 | if (pad==0) pad=fPadXStr; | |
2cef3cb2 | 684 | Int_t nPadX=0, nPadZ=0; |
b94fa26c | 685 | (pad>fNpadX)? nPadX -= fNpadX : nPadX = pad ; |
2cef3cb2 | 686 | vol[3] = nPadX; |
b94fa26c | 687 | (pad>fNpadX)? nPadZ = 2 : nPadZ = 1 ; |
2cef3cb2 | 688 | vol[4] = nPadZ; |
689 | UInt_t error=0; | |
b94fa26c | 690 | Float_t tdc = currentRoc->GetTime(item,error); |
691 | if (!error) digit[0]=tdc; | |
2cef3cb2 | 692 | digit[1] = currentRoc->GetCharge(item); |
693 | AddDigit(tracks,vol,digit); | |
694 | } | |
695 | } | |
696 | } | |
b94fa26c | 697 | tD->Fill(); |
698 | tD->Write(); | |
2cef3cb2 | 699 | } |
700 | ||
701 | ||
702 | /******************************************************************************/ | |
703 | ||
fe4da5cc | 704 | ClassImp(AliTOFhit) |
b94fa26c | 705 | |
706 | //____________________________________________________________________________ | |
707 | AliTOFhit::AliTOFhit(const AliTOFhit & hit) | |
708 | { | |
709 | // | |
710 | // copy ctor for AliTOFhit object | |
711 | // | |
712 | fTrack = hit.fTrack; | |
713 | fX = hit.fX; | |
714 | fY = hit.fY; | |
715 | fZ = hit.fZ; | |
716 | fSector = hit.fSector; | |
717 | fPlate = hit.fPlate; | |
718 | fStrip = hit.fStrip; | |
719 | fPadx = hit.fPadx; | |
720 | fPadz = hit.fPadz; | |
721 | fPx = hit.fPx; | |
722 | fPy = hit.fPy; | |
723 | fPz = hit.fPz; | |
724 | fPmom = hit.fPmom; | |
725 | fTof = hit.fTof; | |
726 | fDx = hit.fDx; | |
727 | fDy = hit.fDy; | |
728 | fDz = hit.fDz; | |
729 | fIncA = hit.fIncA; | |
730 | fEdep = hit.fEdep; | |
731 | ||
732 | } | |
fe4da5cc | 733 | |
2cef3cb2 | 734 | //______________________________________________________________________________ |
735 | AliTOFhit::AliTOFhit(Int_t shunt, Int_t track, Int_t *vol, | |
736 | Float_t *hits) | |
737 | :AliHit(shunt, track) | |
b94fa26c | 738 | { |
2cef3cb2 | 739 | // |
740 | // Constructor of hit object | |
741 | // | |
fe4da5cc | 742 | // |
2cef3cb2 | 743 | // Hit Volume |
744 | // | |
745 | fSector= vol[0]; | |
746 | fPlate = vol[1]; | |
747 | fStrip = vol[2]; | |
b94fa26c | 748 | fPadx = vol[3]; |
749 | fPadz = vol[4]; | |
fe4da5cc | 750 | // |
b94fa26c | 751 | //Position of the hit |
2cef3cb2 | 752 | fX = hits[0]; |
753 | fY = hits[1]; | |
754 | fZ = hits[2]; | |
fe4da5cc | 755 | // |
b94fa26c | 756 | // Momentum components of the particle in the ALICE frame when hit is produced |
2cef3cb2 | 757 | fPx = hits[3]; |
758 | fPy = hits[4]; | |
759 | fPz = hits[5]; | |
760 | fPmom= hits[6]; | |
fe4da5cc | 761 | // |
b94fa26c | 762 | // Time Of Flight for the particle that produces hit |
2cef3cb2 | 763 | fTof = hits[7]; //TOF[s] |
764 | // | |
765 | // Other Data | |
766 | fDx = hits[8]; //Distance from the edge along x axis | |
767 | fDy = hits[9]; //Y cohordinate of the hit | |
768 | fDz = hits[10]; //Distance from the edge along z axis | |
769 | fIncA= hits[11]; //Incidence angle | |
770 | fEdep= hits[12]; //Energy loss in TOF pad | |
771 | } | |
772 | ||
773 | //****************************************************************************** | |
774 | ||
775 | ClassImp(AliTOFdigit) | |
776 | ||
777 | //______________________________________________________________________________ | |
778 | AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit) | |
779 | :AliDigit(tracks) | |
b94fa26c | 780 | { |
2cef3cb2 | 781 | // |
782 | // Constructor of digit object | |
783 | // | |
b94fa26c | 784 | |
2cef3cb2 | 785 | fSector = vol[0]; |
786 | fPlate = vol[1]; | |
787 | fStrip = vol[2]; | |
b94fa26c | 788 | fPadx = vol[3]; |
789 | fPadz = vol[4]; | |
2cef3cb2 | 790 | fTdc = digit[0]; |
791 | fAdc = digit[1]; | |
792 | } | |
793 | ||
b94fa26c | 794 | //____________________________________________________________________________ |
795 | AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit) | |
796 | { | |
797 | // | |
798 | // copy ctor for AliTOFdigit object | |
799 | // | |
800 | ||
801 | Int_t i ; | |
802 | for ( i = 0; i < 3 ; i++) | |
803 | fTracks[i] = digit.fTracks[i] ; | |
804 | fSector = digit.fSector; | |
805 | fPlate = digit.fPlate; | |
806 | fStrip = digit.fStrip; | |
807 | fPadx = digit.fPadx; | |
808 | fPadz = digit.fPadz; | |
809 | fTdc = digit.fTdc; | |
810 | fAdc = digit.fAdc; | |
811 | ||
812 | } | |
813 | ||
2cef3cb2 | 814 | //______________________________________________________________________________ |
815 | void AliTOFdigit::GetLocation(Int_t *Loc) | |
b94fa26c | 816 | { |
2cef3cb2 | 817 | // |
818 | // Get the cohordinates of the digit | |
819 | // in terms of Sector - Plate - Strip - Pad | |
820 | // | |
b94fa26c | 821 | |
2cef3cb2 | 822 | Loc[0]=fSector; |
823 | Loc[1]=fPlate; | |
824 | Loc[2]=fStrip; | |
b94fa26c | 825 | Loc[3]=fPadx; |
826 | Loc[4]=fPadz; | |
2cef3cb2 | 827 | } |
828 | ||
829 | //______________________________________________________________________________ | |
830 | Int_t AliTOFdigit::GetTotPad() | |
b94fa26c | 831 | { |
2cef3cb2 | 832 | // |
833 | // Get the "total" index of the pad inside a Sector | |
834 | // starting from the digits data. | |
835 | // | |
b94fa26c | 836 | |
837 | AliTOF* tof; | |
2cef3cb2 | 838 | |
839 | if(gAlice){ | |
b94fa26c | 840 | tof =(AliTOF*) gAlice->GetDetector("TOF"); |
2cef3cb2 | 841 | }else{ |
842 | printf("AliTOFdigit::GetTotPad - No AliRun object present, exiting"); | |
843 | return 0; | |
844 | } | |
845 | ||
b94fa26c | 846 | Int_t pad = fPadx+tof->GetNpadX()*(fPadz-1); |
847 | Int_t before=0; | |
2cef3cb2 | 848 | |
849 | switch(fPlate){ | |
b94fa26c | 850 | case 1: before = 0; |
2cef3cb2 | 851 | break; |
b94fa26c | 852 | case 2: before = tof->GetNStripC(); |
2cef3cb2 | 853 | break; |
b94fa26c | 854 | case 3: before = tof->GetNStripB() + tof->GetNStripC(); |
2cef3cb2 | 855 | break; |
b94fa26c | 856 | case 4: before = tof->GetNStripA() + tof->GetNStripB() + tof->GetNStripC(); |
2cef3cb2 | 857 | break; |
b94fa26c | 858 | case 5: before = tof->GetNStripA() + 2*tof->GetNStripB() + tof->GetNStripC(); |
2cef3cb2 | 859 | break; |
860 | } | |
861 | ||
b94fa26c | 862 | Int_t strip = fStrip+before; |
863 | Int_t padTot = tof->GetPadXStr()*(strip-1)+pad; | |
864 | return padTot; | |
2cef3cb2 | 865 | } |
866 | ||
867 | //______________________________________________________________________________ | |
868 | void AliTOFdigit::AddTrack(Int_t track) | |
b94fa26c | 869 | { |
2cef3cb2 | 870 | // |
871 | // Add a track to the digit | |
872 | // | |
b94fa26c | 873 | |
2cef3cb2 | 874 | if (fTracks[1]==0){ |
875 | fTracks[1] = track; | |
876 | }else if (fTracks[2]==0){ | |
877 | fTracks[2] = track; | |
878 | }else{ | |
c2af3d73 | 879 | // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n"); |
2cef3cb2 | 880 | } |
fe4da5cc | 881 | } |
937fe4a4 | 882 |