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