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