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