]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCDigitReaderDecoder.cxx
documentation and keyword substitution fixed
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderDecoder.cxx
1 // $Id$
2
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project        * 
5 //* ALICE Experiment at CERN, All rights reserved.                         *
6 //*                                                                        *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
8 //*                  Timm Steinbeck <timm@kip.uni-heidelberg.de>           *
9 //*                  Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
10 //*                  for The ALICE HLT Project.                            *
11 //*                                                                        *
12 //* Permission to use, copy, modify and distribute this software and its   *
13 //* documentation strictly for non-commercial purposes is hereby granted   *
14 //* without fee, provided that the above copyright notice appears in all   *
15 //* copies and that both the copyright notice and this permission notice   *
16 //* appear in the supporting documentation. The authors make no claims     *
17 //* about the suitability of this software for any purpose. It is          *
18 //* provided "as is" without express or implied warranty.                  *
19 //**************************************************************************
20
21 /** @file   AliHLTTPCDigitReaderDecoder.cxx
22     @author Kenneth Aamodt, Matthias Richter
23     @date   
24     @brief  DigitReader implementation for the fast ALTRO Decoder
25 */
26
27 #if __GNUC__>= 3
28 using namespace std;
29 #endif
30
31 #include "AliHLTTPCDigitReaderDecoder.h"
32 #include "AliHLTTPCMapping.h"
33 #include "AliAltroDecoder.h"
34 #include "AliAltroData.h"
35 #include "AliAltroBunch.h"
36
37 ClassImp(AliHLTTPCDigitReaderDecoder)
38
39 AliHLTTPCDigitReaderDecoder::AliHLTTPCDigitReaderDecoder()
40   :
41   AliHLTTPCDigitReader(),
42   fAltroDecoder(NULL),
43   fAltroData(),
44   fAltroBunch(NULL),
45   fMapping(NULL),
46   fNextCounter(0),
47   fNextSignalMethodUsed(kFALSE)
48 {
49   // see header file for class documentation
50   // or
51   // refer to README to build package
52   // or
53   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
54 }
55
56 AliHLTTPCDigitReaderDecoder::~AliHLTTPCDigitReaderDecoder()
57 {
58   // see header file for class documentation
59   if(fAltroDecoder){
60     delete fAltroDecoder;
61   }
62   if(fAltroBunch){
63     delete fAltroBunch;
64   }
65   if(fMapping){
66     delete fMapping;
67   }
68 }
69
70 int AliHLTTPCDigitReaderDecoder::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
71 {
72   // see header file for class documentation
73   fMapping = new AliHLTTPCMapping(patch);
74   fAltroDecoder = new AliAltroDecoder();
75   fAltroBunch = new AliAltroBunch();
76   fAltroDecoder->SetMemory((UChar_t*)ptr, size);
77   fAltroDecoder->Decode();
78   return 0;
79 }
80
81 bool AliHLTTPCDigitReaderDecoder::NextChannel()
82 {
83   // see header file for class documentation
84   return fAltroDecoder->NextChannel(&fAltroData);
85 }
86
87 int AliHLTTPCDigitReaderDecoder::NextBunch()
88 {
89   // see header file for class documentation
90   return fAltroData.NextBunch(fAltroBunch);
91 }
92
93 bool AliHLTTPCDigitReaderDecoder::NextSignal()
94 {
95   // see header file for class documentation
96   /*  nextSignalMethodUsed=kTRUE;
97   if(!fAltroBunch){      // this is true when NextChannel and Next bunch has not been called yet
98     if(NextChannel()){   // checks if ther is any pads with data
99       if(!NextBunch()){  // checks if there is any bunch
100         return false;
101       }
102     }
103     else{
104       return false;
105     }
106   }
107   
108   UInt_t bunchSize=fAltroBunchSize;
109   if(nextCounter==bunchSize){
110     nextCounter=0;
111     return false;
112     }*/
113   return true;
114 }
115
116 const UInt_t* AliHLTTPCDigitReaderDecoder::GetSignals()
117 {
118   // see header file for class documentation
119   return fAltroBunch->GetData();
120 }
121
122 int AliHLTTPCDigitReaderDecoder::GetRow()
123 {
124   // see header file for class documentation
125   return fMapping->GetRow(fAltroData.GetHadd());
126 }
127
128 int AliHLTTPCDigitReaderDecoder::GetPad()
129 {
130   // see header file for class documentation
131   return fMapping->GetPad(fAltroData.GetHadd());
132     //    return 0;
133 }
134
135 int AliHLTTPCDigitReaderDecoder::GetSignal()
136 {
137   // see header file for class documentation
138   return 0;
139 }
140
141 int AliHLTTPCDigitReaderDecoder::GetTime()
142 {
143   // see header file for class documentation
144   if(!fNextSignalMethodUsed){// this is true if the bunch approach is used
145     return fAltroBunch->GetStartTimeBin();
146   }
147   else{
148     return fAltroBunch->GetStartTimeBin()+fNextCounter;
149   }
150 }
151
152 int AliHLTTPCDigitReaderDecoder::GetBunchSize()
153 {
154   return fAltroBunch->GetBunchSize();
155 }