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