1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.1.2.1 2000/05/08 14:44:01 cblume
19 Add new class AliTRDdigitsManager
23 ///////////////////////////////////////////////////////////////////////////////
25 // Manages the digits and the track dictionary in the form of //
26 // AliTRDdataArray objects. //
28 ///////////////////////////////////////////////////////////////////////////////
32 #include "AliTRDdigitsManager.h"
33 #include "AliTRDconst.h"
35 ClassImp(AliTRDdigitsManager)
37 //_____________________________________________________________________________
38 AliTRDdigitsManager::AliTRDdigitsManager():TObject()
41 // Default constructor
46 fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",kNdet);
48 for (Int_t iDict = 0; iDict < kNDict; iDict++) {
49 fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI",kNdet);
54 //_____________________________________________________________________________
55 AliTRDdigitsManager::~AliTRDdigitsManager()
63 for (Int_t iDict = 0; iDict < kNDict; iDict++) {
64 fDictionary[iDict]->Delete();
65 delete fDictionary[iDict];
70 //_____________________________________________________________________________
71 void AliTRDdigitsManager::SetRaw()
76 fDigits->SetBit(kRawDigit);
80 //_____________________________________________________________________________
81 Bool_t AliTRDdigitsManager::MakeBranch()
84 // Creates the branches for the digits and the dictionary in the digits tree
87 Int_t buffersize = 64000;
89 Bool_t status = kTRUE;
91 if (gAlice->TreeD()) {
93 // Make the branch for the digits
95 const AliTRDdataArrayI *Digits =
96 (AliTRDdataArrayI *) fDigits->At(0);
98 gAlice->TreeD()->Branch("TRDdigits",Digits->IsA()->GetName()
99 ,&Digits,buffersize,1);
100 printf("AliTRDdigitsManager::MakeBranch -- ");
101 printf("Making branch TRDdigits\n");
111 // Make the branches for the dictionaries
112 for (Int_t iDict = 0; iDict < kNDict; iDict++) {
114 Char_t branchname[15];
115 sprintf(branchname,"TRDdictionary%d",iDict);
116 if (fDictionary[iDict]) {
117 const AliTRDdataArrayI *Dictionary =
118 (AliTRDdataArrayI *) fDictionary[iDict]->At(0);
120 gAlice->TreeD()->Branch(branchname,Dictionary->IsA()->GetName()
121 ,&Dictionary,buffersize,1);
122 printf("AliTRDdigitsManager::MakeBranch -- ");
123 printf("Making branch %s\n",branchname);
143 //_____________________________________________________________________________
144 Bool_t AliTRDdigitsManager::ReadDigits()
147 Bool_t status = kTRUE;
149 status = fDigits->LoadArray("TRDdigits");
151 for (Int_t iDict = 0; iDict < kNDict; iDict++) {
152 Char_t branchname[15];
153 sprintf(branchname,"TRDdictionary%d",iDict);
154 status = fDictionary[iDict]->LoadArray(branchname);
157 if (fDigits->TestBit(kRawDigit)) {
168 //_____________________________________________________________________________
169 Bool_t AliTRDdigitsManager::WriteDigits()
172 // Writes out the TRD-digits and the dictionaries
175 // Create the branches
176 if (!(gAlice->TreeD()->GetBranch("TRDdigits"))) {
177 if (!MakeBranch()) return kFALSE;
180 // Store the contents of the segment array in the tree
181 if (!fDigits->StoreArray("TRDdigits")) {
182 printf("AliTRDdigitsManager::WriteDigits -- ");
183 printf("Error while storing digits in branch TRDdigits\n");
186 for (Int_t iDict = 0; iDict < kNDict; iDict++) {
187 Char_t branchname[15];
188 sprintf(branchname,"TRDdictionary%d",iDict);
189 if (!fDictionary[iDict]->StoreArray(branchname)) {
190 printf("AliTRDdigitsManager::WriteDigits -- ");
191 printf("Error while storing dictionary in branch %s\n",branchname);