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