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