]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCRawStreamOld.cxx
Changes in order to comply with the corresponding changes in the raw reader classes
[u/mrichter/AliRoot.git] / TPC / AliTPCRawStreamOld.cxx
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 ///
18 /// This class provides access to TPC digits in raw data.
19 ///
20 /// It loops over all TPC digits in the raw data given by the AliRawReader.
21 /// The Next method goes to the next digit. If there are no digits left
22 /// it returns kFALSE.
23 /// Several getters provide information about the current digit.
24 ///
25 ///////////////////////////////////////////////////////////////////////////////
26
27 #include <TSystem.h>
28
29 #include "AliTPCRawStreamOld.h"
30 #include "AliRawReader.h"
31 #include "AliLog.h"
32 #include "AliTPCAltroMapping.h"
33
34 ClassImp(AliTPCRawStreamOld)
35
36 //_____________________________________________________________________________
37 AliTPCRawStreamOld::AliTPCRawStreamOld(AliRawReader* rawReader) :
38   AliAltroRawStreamOld(rawReader),
39   fSector(-1),
40   fPrevSector(-1),
41   fRow(-1),
42   fPrevRow(-1),
43   fPad(-1),
44   fPrevPad(-1)
45 {
46   // create an object to read TPC raw digits
47
48   //  Do not select on the equipment Id, since the Id
49   //  is wrong (it starts from 228 or so...)
50   //  SelectRawData(0);
51
52   TString path = gSystem->Getenv("ALICE_ROOT");
53   path += "/TPC/mapping/Patch";
54   TString path2;
55   for(Int_t i = 0; i < 6; i++) {
56     path2 = path;
57     path2 += i;
58     path2 += ".data";
59     fMapping[i] = new AliTPCAltroMapping(path2.Data());
60   }
61
62   fNoAltroMapping = kFALSE;
63 }
64
65 //_____________________________________________________________________________
66 AliTPCRawStreamOld::AliTPCRawStreamOld(const AliTPCRawStreamOld& stream) :
67   AliAltroRawStreamOld(stream),
68   fSector(-1),
69   fPrevSector(-1),
70   fRow(-1),
71   fPrevRow(-1),
72   fPad(-1),
73   fPrevPad(-1)
74 {
75   Fatal("AliTPCRawStreamOld", "copy constructor not implemented");
76 }
77
78 //_____________________________________________________________________________
79 AliTPCRawStreamOld& AliTPCRawStreamOld::operator = (const AliTPCRawStreamOld& 
80                                               /* stream */)
81 {
82   Fatal("operator =", "assignment operator not implemented");
83   return *this;
84 }
85
86 //_____________________________________________________________________________
87 AliTPCRawStreamOld::~AliTPCRawStreamOld()
88 {
89 // destructor
90
91   for(Int_t i = 0; i < 6; i++) delete fMapping[i];
92 }
93
94 //_____________________________________________________________________________
95 void AliTPCRawStreamOld::Reset()
96 {
97   // reset tpc raw stream params
98   AliAltroRawStreamOld::Reset();
99   fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = -1;
100 }
101
102 //_____________________________________________________________________________
103 Bool_t AliTPCRawStreamOld::Next()
104 {
105   // Read next TPC signal
106   // Apply the TPC altro mapping to get
107   // the sector,pad-row and pad indeces
108   fPrevSector = fSector;
109   fPrevRow = fRow;
110   fPrevPad = fPad;
111   if (AliAltroRawStreamOld::Next()) {
112     if (IsNewHWAddress())
113       ApplyAltroMapping();
114     return kTRUE;
115   }
116   else
117     return kFALSE;
118 }
119
120 //_____________________________________________________________________________
121 void AliTPCRawStreamOld::ApplyAltroMapping()
122 {
123   // Take the DDL index, load
124   // the corresponding altro mapping
125   // object and fill the sector,row and pad indeces
126   Int_t ddlNumber = GetDDLNumber();
127   switch (ddlNumber) {
128     case 152:
129       ddlNumber = 74;
130       break;
131     case 153:
132       ddlNumber = 75;
133       break;
134     case 253:
135       ddlNumber = 0;
136       break;
137     case 0:
138       ddlNumber = 73;
139       break;
140     case 1:
141       ddlNumber = 1;
142       break;
143     case 5:
144       ddlNumber = 72;
145       break;
146     default:
147       break;
148   }
149   Int_t patchIndex;
150   if (ddlNumber < 72) {
151     fSector = ddlNumber / 2;
152     patchIndex = ddlNumber % 2;
153   }
154   else {
155     fSector = (ddlNumber - 72) / 4 + 36;
156     patchIndex = (ddlNumber - 72) % 4 + 2;
157   }
158
159   Short_t hwAddress = GetHWAddress();
160   fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
161   fPad = fMapping[patchIndex]->GetPad(hwAddress);
162
163 }