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