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