Merge TRD-develop
[u/mrichter/AliRoot.git] / TRD / AliTRDdigitizer.cxx
CommitLineData
f7336fa3 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$
da581aea 18Revision 1.3 2000/04/28 14:49:27 cblume
19Only one declaration of iDict in MakeDigits()
20
21Revision 1.1.4.1 2000/05/08 14:42:04 cblume
22Introduced AliTRDdigitsManager
28329a48 23
1befd3b2 24Revision 1.1 2000/02/28 19:00:13 cblume
25Add new TRD classes
26
f7336fa3 27*/
28
29///////////////////////////////////////////////////////////////////////////////
30// //
31// Creates and handles digits from TRD hits //
32// //
33// The following effects are included: //
34// - Diffusion //
35// - ExB effects //
36// - Gas gain including fluctuations //
37// - Pad-response (simple Gaussian approximation) //
38// - Electronics noise //
39// - Electronics gain //
40// - Digitization //
41// - ADC threshold //
42// The corresponding parameter can be adjusted via the various //
43// Set-functions. If these parameters are not explicitly set, default //
44// values are used (see Init-function). //
45// To produce digits from a root-file with TRD-hits use the //
46// slowDigitsCreate.C macro. //
47// //
48///////////////////////////////////////////////////////////////////////////////
49
50#include <TMath.h>
51#include <TVector.h>
52#include <TRandom.h>
53
54#include "AliTRD.h"
55#include "AliTRDdigitizer.h"
da581aea 56#include "AliTRDdataArrayI.h"
57#include "AliTRDdataArrayF.h"
58#include "AliTRDdigitsManager.h"
f7336fa3 59
60ClassImp(AliTRDdigitizer)
61
62//_____________________________________________________________________________
63AliTRDdigitizer::AliTRDdigitizer():TNamed()
64{
65 //
66 // AliTRDdigitizer default constructor
67 //
68
da581aea 69 fInputFile = NULL;
70 fDigits = NULL;
71 fTRD = NULL;
72 fGeo = NULL;
73 fPRF = NULL;
74
75 fEvent = 0;
76 fGasGain = 0.0;
77 fNoise = 0.0;
78 fChipGain = 0.0;
79 fADCoutRange = 0.0;
80 fADCinRange = 0.0;
81 fADCthreshold = 0;
82 fDiffusionOn = 0;
83 fDiffusionT = 0.0;
84 fDiffusionL = 0.0;
85 fElAttachOn = 0;
86 fElAttachProp = 0.0;
87 fExBOn = 0;
88 fLorentzAngle = 0.0;
f7336fa3 89
90}
91
92//_____________________________________________________________________________
93AliTRDdigitizer::AliTRDdigitizer(const Text_t *name, const Text_t *title)
94 :TNamed(name,title)
95{
96 //
97 // AliTRDdigitizer default constructor
98 //
99
da581aea 100 fInputFile = NULL;
101 fDigits = NULL;
102 fTRD = NULL;
103 fGeo = NULL;
f7336fa3 104
da581aea 105 fEvent = 0;
f7336fa3 106
107 Init();
108
109}
110
111//_____________________________________________________________________________
112AliTRDdigitizer::~AliTRDdigitizer()
113{
114
115 if (fInputFile) {
116 fInputFile->Close();
117 delete fInputFile;
118 }
119
da581aea 120 if (fDigits) {
121 delete fDigits;
f7336fa3 122 }
123
da581aea 124 if (fPRF) delete fPRF;
f7336fa3 125
126}
127
128//_____________________________________________________________________________
129Int_t AliTRDdigitizer::Diffusion(Float_t driftlength, Float_t *xyz)
130{
131 //
132 // Applies the diffusion smearing to the position of a single electron
133 //
134
135 Float_t driftSqrt = TMath::Sqrt(driftlength);
136 Float_t sigmaT = driftSqrt * fDiffusionT;
137 Float_t sigmaL = driftSqrt * fDiffusionL;
138 xyz[0] = gRandom->Gaus(xyz[0], sigmaL * fLorentzFactor);
139 xyz[1] = gRandom->Gaus(xyz[1], sigmaT * fLorentzFactor);
140 xyz[2] = gRandom->Gaus(xyz[2], sigmaT);
141 return 1;
142
143}
144
145//_____________________________________________________________________________
146Int_t AliTRDdigitizer::ExB(Float_t driftlength, Float_t *xyz)
147{
148 //
149 // Applies E x B effects to the position of a single electron
150 //
151
152 xyz[0] = xyz[0];
153 xyz[1] = xyz[1] + fLorentzAngle * driftlength;
154 xyz[2] = xyz[2];
155
156 return 1;
157
158}
159
160//_____________________________________________________________________________
161void AliTRDdigitizer::Init()
162{
163 //
164 // Initializes the digitization procedure with standard values
165 //
166
167 // The default parameter for the digitization
168 fGasGain = 2.0E3;
169 fNoise = 3000.;
170 fChipGain = 10.;
171 fADCoutRange = 255.;
172 fADCinRange = 2000.;
173 fADCthreshold = 1;
174
175 // Transverse and longitudinal diffusion coefficients (Xe/Isobutane)
176 fDiffusionOn = 1;
177 fDiffusionT = 0.060;
178 fDiffusionL = 0.017;
179
180 // Propability for electron attachment
181 fElAttachOn = 0;
182 fElAttachProp = 0.0;
183
184 // E x B effects
185 fExBOn = 0;
186 // omega * tau. (tau ~ 12 * 10^-12, B = 0.2T)
187 fLorentzAngle = 17.6 * 12.0 * 0.2 * 0.01;
188
da581aea 189 // The pad response function
190 fPRF = new TF1("PRF","[0]*([1]+exp(-x*x/(2.0*[2])))",-2,2);
191 fPRF->SetParameter(0, 0.8872);
192 fPRF->SetParameter(1,-0.00573);
193 fPRF->SetParameter(2, 0.454 * 0.454);
194
f7336fa3 195}
196
197//_____________________________________________________________________________
198Bool_t AliTRDdigitizer::Open(const Char_t *name, Int_t nEvent)
199{
200 //
201 // Opens a ROOT-file with TRD-hits and reads in the hit-tree
202 //
203
204 // Connect the AliRoot file containing Geometry, Kine, and Hits
205 fInputFile = (TFile*) gROOT->GetListOfFiles()->FindObject(name);
206 if (!fInputFile) {
207 printf("AliTRDdigitizer::Open -- ");
208 printf("Open the ALIROOT-file %s.\n",name);
209 fInputFile = new TFile(name,"UPDATE");
210 }
211 else {
212 printf("AliTRDdigitizer::Open -- ");
213 printf("%s is already open.\n",name);
214 }
215
da581aea 216 gAlice = (AliRun*) fInputFile->Get("gAlice");
217 if (gAlice) {
218 printf("AliTRDdigitizer::Open -- ");
219 printf("AliRun object found on file.\n");
220 }
221 else {
222 printf("AliTRDdigitizer::Open -- ");
223 printf("Could not find AliRun object.\n");
224 return kFALSE;
225 }
f7336fa3 226
227 fEvent = nEvent;
228
229 // Import the Trees for the event nEvent in the file
230 Int_t nparticles = gAlice->GetEvent(fEvent);
231 if (nparticles <= 0) {
232 printf("AliTRDdigitizer::Open -- ");
233 printf("No entries in the trees for event %d.\n",fEvent);
234 return kFALSE;
235 }
236
237 return kTRUE;
238
239}
240
241//_____________________________________________________________________________
242Float_t AliTRDdigitizer::PadResponse(Float_t x)
243{
244 //
245 // The pad response for the chevron pads.
246 // We use a simple Gaussian approximation which should be good
247 // enough for our purpose.
248 //
249
250 // The parameters for the response function
251 const Float_t aa = 0.8872;
252 const Float_t bb = -0.00573;
253 const Float_t cc = 0.454;
254 const Float_t cc2 = cc*cc;
255
da581aea 256 // Get the pointer to the detector class and check for version 1
257 fTRD = (AliTRD*) gAlice->GetDetector("TRD");
258 if (fTRD->IsVersion() != 1) {
259 printf("AliTRDdigitizer::Open -- ");
260 printf("TRD must be version 1 (slow simulator).\n");
261 exit(1);
262 }
263
264 // Get the geometry
265 fGeo = fTRD->GetGeometry();
266 printf("AliTRDdigitizer::Open -- ");
267 printf("Geometry version %d\n",fGeo->IsVersion());
f7336fa3 268
da581aea 269 return kTRUE;
f7336fa3 270
271}
272
273//_____________________________________________________________________________
274Bool_t AliTRDdigitizer::MakeDigits()
275{
276 //
277 // Loops through the TRD-hits and creates the digits.
278 //
279
f7336fa3 280 ///////////////////////////////////////////////////////////////
281 // Parameter
282 ///////////////////////////////////////////////////////////////
283
284 // Converts number of electrons to fC
285 const Float_t el2fC = 1.602E-19 * 1.0E15;
286
287 ///////////////////////////////////////////////////////////////
288
289 Int_t iRow, iCol, iTime;
290 Int_t nBytes = 0;
28329a48 291 Int_t iDict;
f7336fa3 292
293 Int_t totalSizeDigits = 0;
294 Int_t totalSizeDict0 = 0;
295 Int_t totalSizeDict1 = 0;
296 Int_t totalSizeDict2 = 0;
297
da581aea 298 AliTRDdataArrayI *Digits;
299 AliTRDdataArrayI *Dictionary[kNDict];
300
301 if (!fGeo) {
302 printf("AliTRDdigitizer::MakeDigits -- ");
303 printf("No geometry defined\n");
304 return kFALSE;
305 }
306
307 // Create a digits manager
308 fDigits = new AliTRDdigitsManager();
309
310 // Create detector arrays to keep the signal and track numbers
311 AliTRDdataArrayF *Signal = new AliTRDdataArrayF();
312 AliTRDdataArrayI *Tracks[kNDict];
313 for (iDict = 0; iDict < kNDict; iDict++) {
314 Tracks[iDict] = new AliTRDdataArrayI();
315 }
f7336fa3 316
317 // Get the pointer to the hit tree
da581aea 318 TTree *HitTree = gAlice->TreeH();
319
320 // Get the number of entries in the hit tree
321 // (Number of primary particles creating a hit somewhere)
322 Int_t nTrack = (Int_t) HitTree->GetEntries();
323
324 printf("AliTRDdigitizer::MakeDigits -- ");
325 printf("Start creating digits.\n");
f7336fa3 326
327 // The Lorentz factor
328 if (fExBOn) {
329 fLorentzFactor = 1.0 / (1.0 + fLorentzAngle*fLorentzAngle);
330 }
331 else {
332 fLorentzFactor = 1.0;
333 }
334
f7336fa3 335 Int_t chamBeg = 0;
336 Int_t chamEnd = kNcham;
da581aea 337 if (fTRD->GetSensChamber() >= 0) {
338 chamBeg = fTRD->GetSensChamber();
339 chamEnd = chamBeg + 1;
f7336fa3 340 }
341 Int_t planBeg = 0;
342 Int_t planEnd = kNplan;
da581aea 343 if (fTRD->GetSensPlane() >= 0) {
344 planBeg = fTRD->GetSensPlane();
f7336fa3 345 planEnd = planBeg + 1;
346 }
347 Int_t sectBeg = 0;
348 Int_t sectEnd = kNsect;
da581aea 349 if (fTRD->GetSensSector() >= 0) {
350 sectBeg = fTRD->GetSensSector();
f7336fa3 351 sectEnd = sectBeg + 1;
352 }
353
da581aea 354 Int_t count_hits = 0;
355
f7336fa3 356 // Loop through all the chambers
357 for (Int_t iCham = chamBeg; iCham < chamEnd; iCham++) {
358 for (Int_t iPlan = planBeg; iPlan < planEnd; iPlan++) {
359 for (Int_t iSect = sectBeg; iSect < sectEnd; iSect++) {
360
361 Int_t nDigits = 0;
362
f7336fa3 363 printf("AliTRDdigitizer::MakeDigits -- ");
364 printf("Digitizing chamber %d, plane %d, sector %d.\n"
365 ,iCham,iPlan,iSect);
366
da581aea 367 Int_t iDet = fGeo->GetDetector(iPlan,iCham,iSect);
368 Int_t nRowMax = fGeo->GetRowMax(iPlan,iCham,iSect);
369 Int_t nColMax = fGeo->GetColMax(iPlan);
370 Int_t nTimeMax = fGeo->GetTimeMax();
371 Float_t row0 = fGeo->GetRow0(iPlan,iCham,iSect);
372 Float_t col0 = fGeo->GetCol0(iPlan);
373 Float_t time0 = fGeo->GetTime0(iPlan);
374 Float_t rowPadSize = fGeo->GetRowPadSize();
375 Float_t colPadSize = fGeo->GetColPadSize();
376 Float_t timeBinSize = fGeo->GetTimeBinSize();
377
378 // Adjust the size of the detector arrays
379 Signal->Allocate(nRowMax,nColMax,nTimeMax);
380 for (iDict = 0; iDict < kNDict; iDict++) {
381 Tracks[iDict]->Allocate(nRowMax,nColMax,nTimeMax);
382 }
f7336fa3 383
384 // Loop through all entries in the tree
385 for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
386
387 gAlice->ResetHits();
388 nBytes += HitTree->GetEvent(iTrack);
389
390 // Get the number of hits in the TRD created by this particle
da581aea 391 Int_t nHit = fTRD->Hits()->GetEntriesFast();
f7336fa3 392
393 // Loop through the TRD hits
394 for (Int_t iHit = 0; iHit < nHit; iHit++) {
395
da581aea 396 count_hits++;
f7336fa3 397
da581aea 398 AliTRDhit *Hit = (AliTRDhit *) fTRD->Hits()->UncheckedAt(iHit);
f7336fa3 399 Float_t pos[3];
400 pos[0] = Hit->fX;
401 pos[1] = Hit->fY;
402 pos[2] = Hit->fZ;
403 Float_t q = Hit->fQ;
404 Int_t track = Hit->fTrack;
405 Int_t detector = Hit->fDetector;
da581aea 406 Int_t plane = fGeo->GetPlane(detector);
407 Int_t sector = fGeo->GetSector(detector);
408 Int_t chamber = fGeo->GetChamber(detector);
f7336fa3 409
410 if ((sector != iSect) ||
411 (plane != iPlan) ||
412 (chamber != iCham))
413 continue;
414
415 // Rotate the sectors on top of each other
416 Float_t rot[3];
da581aea 417 fGeo->Rotate(detector,pos,rot);
f7336fa3 418
419 // The hit position in pad coordinates (center pad)
420 // The pad row (z-direction)
421 Int_t rowH = (Int_t) ((rot[2] - row0) / rowPadSize);
422 // The pad column (rphi-direction)
423 Int_t colH = (Int_t) ((rot[1] - col0) / colPadSize);
424 // The time bucket
425 Int_t timeH = (Int_t) ((rot[0] - time0) / timeBinSize);
426
427 // Array to sum up the signal in a box surrounding the
428 // hit postition
429 const Int_t timeBox = 7;
430 const Int_t colBox = 9;
431 const Int_t rowBox = 7;
432 Float_t signalSum[rowBox][colBox][timeBox];
433 for (iRow = 0; iRow < rowBox; iRow++ ) {
434 for (iCol = 0; iCol < colBox; iCol++ ) {
435 for (iTime = 0; iTime < timeBox; iTime++) {
436 signalSum[iRow][iCol][iTime] = 0;
437 }
438 }
439 }
440
441 // Loop over all electrons of this hit
442 Int_t nEl = (Int_t) q;
443 for (Int_t iEl = 0; iEl < nEl; iEl++) {
444
445 // The driftlength
446 Float_t driftlength = rot[0] - time0;
447 if ((driftlength < 0) ||
448 (driftlength > kDrThick)) break;
449 Float_t driftlengthL = driftlength;
450 if (fExBOn) driftlengthL /= TMath::Sqrt(fLorentzFactor);
451 Float_t xyz[3];
452 xyz[0] = rot[0];
453 xyz[1] = rot[1];
454 xyz[2] = rot[2];
455
456 // Electron attachment
457 if (fElAttachOn) {
458 if (gRandom->Rndm() < (driftlengthL * fElAttachProp / 100.)) continue;
459 }
460
461 // Apply the diffusion smearing
462 if (fDiffusionOn) {
463 if (!(Diffusion(driftlengthL,xyz))) continue;
464 }
465
466 // Apply E x B effects
467 if (fExBOn) {
468 if (!(ExB(driftlength,xyz))) continue;
469 }
470
471 // The electron position and the distance to the hit position
472 // in pad units
473 // The pad row (z-direction)
474 Int_t rowE = (Int_t) ((xyz[2] - row0) / rowPadSize);
475 Int_t rowD = rowH - rowE;
476 // The pad column (rphi-direction)
477 Int_t colE = (Int_t) ((xyz[1] - col0) / colPadSize);
478 Int_t colD = colH - colE;
479 // The time bucket
480 Int_t timeE = (Int_t) ((xyz[0] - time0) / timeBinSize);
481 Int_t timeD = timeH - timeE;
482
483 // Apply the gas gain including fluctuations
484 Int_t signal = (Int_t) (-fGasGain * TMath::Log(gRandom->Rndm()));
485
486 // The distance of the electron to the center of the pad
487 // in units of pad width
488 Float_t dist = (xyz[1] - col0 - (colE + 0.5) * colPadSize)
489 / colPadSize;
490
491 // Sum up the signal in the different pixels
492 // and apply the pad response
493 Int_t rowIdx = rowD + (Int_t) ( rowBox / 2);
494 Int_t colIdx = colD + (Int_t) ( colBox / 2);
495 Int_t timeIdx = timeD + (Int_t) (timeBox / 2);
496
497 if (( rowIdx < 0) || ( rowIdx > rowBox)) {
498 printf("AliTRDdigitizer::MakeDigits -- ");
499 printf("Boundary error. rowIdx = %d (%d)\n", rowIdx, rowBox);
500 continue;
501 }
502 if (( colIdx < 0) || ( colIdx > colBox)) {
503 printf("AliTRDdigitizer::MakeDigits -- ");
504 printf("Boundary error. colIdx = %d (%d)\n", colIdx, colBox);
505 continue;
506 }
507 if ((timeIdx < 0) || (timeIdx > timeBox)) {
508 printf("AliTRDdigitizer::MakeDigits -- ");
509 printf("Boundary error. timeIdx = %d (%d)\n",timeIdx,timeBox);
510 continue;
511 }
da581aea 512 signalSum[rowIdx][colIdx-1][timeIdx] += fPRF->Eval(dist-1.0,0,0) * signal;
513 signalSum[rowIdx][colIdx ][timeIdx] += fPRF->Eval(dist ,0,0) * signal;
514 signalSum[rowIdx][colIdx+1][timeIdx] += fPRF->Eval(dist+1.0,0,0) * signal;
f7336fa3 515
516 }
517
518 // Add the padcluster to the detector matrix
519 for (iRow = 0; iRow < rowBox; iRow++ ) {
520 for (iCol = 0; iCol < colBox; iCol++ ) {
521 for (iTime = 0; iTime < timeBox; iTime++) {
522
523 Int_t rowB = rowH + iRow - (Int_t) ( rowBox / 2);
524 Int_t colB = colH + iCol - (Int_t) ( colBox / 2);
525 Int_t timeB = timeH + iTime - (Int_t) (timeBox / 2);
f7336fa3 526 Float_t signalB = signalSum[iRow][iCol][iTime];
da581aea 527 if (( rowB < 0) || ( rowB >= nRowMax)) continue;
528 if (( colB < 0) || ( colB >= nColMax)) continue;
529 if ((timeB < 0) || (timeB >= nTimeMax)) continue;
f7336fa3 530 if (signalB > 0.0) {
da581aea 531
532 // Add the signal sum
533 signalB += Signal->GetData(rowB,colB,timeB);
534 Signal->SetData(rowB,colB,timeB,signalB);
535 // Store the track index in the dictionary
536 // Note: We store index+1 in order to allow the array to be compressed
537 for (iDict = 0; iDict < kNDict; iDict++) {
538 Int_t oldTrack = Tracks[iDict]->GetData(rowB,colB,timeB);
539 if (oldTrack == track+1) break;
540 if (oldTrack == -1) break;
541 if (oldTrack == 0) {
542 Tracks[iDict]->SetData(rowB,colB,timeB,track+1);
543 break;
544 }
545 }
546 if (iDict == kNDict) {
f7336fa3 547 printf("AliTRDdigitizer::MakeDigits -- ");
da581aea 548 printf("More than three tracks for one digit!\n");
549 }
550 }
f7336fa3 551
552 }
553 }
554 }
555
556 }
557
558 }
559
560 // Add a container for the digits of this detector
da581aea 561 Digits = fDigits->GetDigits(iDet);
f7336fa3 562 // Allocate memory space for the digits buffer
563 Digits->Allocate(nRowMax,nColMax,nTimeMax);
564
da581aea 565 // Do the same for the dictionary arrays
28329a48 566 for (iDict = 0; iDict < kNDict; iDict++) {
da581aea 567 Dictionary[iDict] = fDigits->GetDictionary(iDet,iDict);
f7336fa3 568 Dictionary[iDict]->Allocate(nRowMax,nColMax,nTimeMax);
569 }
570
da581aea 571 // Create the digits for this chamber
f7336fa3 572 for (iRow = 0; iRow < nRowMax; iRow++ ) {
573 for (iCol = 0; iCol < nColMax; iCol++ ) {
574 for (iTime = 0; iTime < nTimeMax; iTime++) {
575
da581aea 576 Float_t signalAmp = Signal->GetData(iRow,iCol,iTime);
f7336fa3 577
578 // Add the noise
1befd3b2 579 signalAmp = TMath::Max((Float_t) gRandom->Gaus(signalAmp,fNoise)
580 ,(Float_t) 0.0);
f7336fa3 581 // Convert to fC
582 signalAmp *= el2fC;
583 // Convert to mV
584 signalAmp *= fChipGain;
585 // Convert to ADC counts
586 Int_t adc = (Int_t) (signalAmp * (fADCoutRange / fADCinRange));
587
da581aea 588 if (adc > fADCthreshold) {
f7336fa3 589
da581aea 590 nDigits++;
591
592 // Store the amplitude of the digit
593 Digits->SetData(iRow,iCol,iTime,adc);
594
595 // Store the track index in the dictionary
596 // Note: We store index+1 in order to allow the array to be compressed
597 for (iDict = 0; iDict < kNDict; iDict++) {
598 Dictionary[iDict]->SetData(iRow,iCol,iTime
599 ,Tracks[iDict]->GetData(iRow,iCol,iTime));
600 }
f7336fa3 601
da581aea 602 }
f7336fa3 603
604 }
605 }
606 }
607
608 // Compress the arrays
da581aea 609 Digits->Compress(1,0);
28329a48 610 for (iDict = 0; iDict < kNDict; iDict++) {
f7336fa3 611 Dictionary[iDict]->Compress(1,0);
612 }
613
614 totalSizeDigits += Digits->GetSize();
615 totalSizeDict0 += Dictionary[0]->GetSize();
616 totalSizeDict1 += Dictionary[1]->GetSize();
617 totalSizeDict2 += Dictionary[2]->GetSize();
618
619 printf("AliTRDdigitizer::MakeDigits -- ");
620 printf("Number of digits found: %d.\n",nDigits);
da581aea 621
622 // Reset the arrays
623 Signal->Reset();
624 for (iDict = 0; iDict < kNDict; iDict++) {
625 Tracks[iDict]->Reset();
626 }
f7336fa3 627
628 }
629 }
630 }
631
632 printf("AliTRDdigitizer::MakeDigits -- ");
da581aea 633 printf("Total number of analyzed hits = %d\n",count_hits);
634
635 printf("AliTRDdigitizer::MakeDigits -- ");
f7336fa3 636 printf("Total digits data size = %d, %d, %d, %d\n",totalSizeDigits
637 ,totalSizeDict0
638 ,totalSizeDict1
639 ,totalSizeDict2);
640
641 return kTRUE;
642
643}
644
645//_____________________________________________________________________________
f7336fa3 646Bool_t AliTRDdigitizer::WriteDigits()
647{
648 //
649 // Writes out the TRD-digits and the dictionaries
650 //
651
652 // Create the branches
653 if (!(gAlice->TreeD()->GetBranch("TRDdigits"))) {
da581aea 654 if (!fDigits->MakeBranch()) return kFALSE;
f7336fa3 655 }
656
da581aea 657 // Store the digits and the dictionary in the tree
658 fDigits->WriteDigits();
f7336fa3 659
660 // Write the new tree into the input file (use overwrite option)
661 Char_t treeName[7];
662 sprintf(treeName,"TreeD%d",fEvent);
663 printf("AliTRDdigitizer::WriteDigits -- ");
664 printf("Write the digits tree %s for event %d.\n"
665 ,treeName,fEvent);
666 gAlice->TreeD()->Write(treeName,2);
667
668 return kTRUE;
669
670}