Old Altro and TPC raw stream modified in a way that they work with the TPC cosmic...
[u/mrichter/AliRoot.git] / TPC / AliTPCRawStreamOld.cxx
CommitLineData
5bbd01a6 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
34ClassImp(AliTPCRawStreamOld)
35
36//_____________________________________________________________________________
37AliTPCRawStreamOld::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 // Skip the Common Data Header, since it is only 7
52 // 32-bit words
53 rawReader->RequireHeader(kFALSE);
54
55 TString path = gSystem->Getenv("ALICE_ROOT");
56 path += "/TPC/mapping/Patch";
57 TString path2;
58 for(Int_t i = 0; i < 6; i++) {
59 path2 = path;
60 path2 += i;
61 path2 += ".data";
62 fMapping[i] = new AliTPCAltroMapping(path2.Data());
63 }
64
65 fNoAltroMapping = kFALSE;
66}
67
68//_____________________________________________________________________________
69AliTPCRawStreamOld::AliTPCRawStreamOld(const AliTPCRawStreamOld& stream) :
70 AliAltroRawStreamOld(stream),
71 fSector(-1),
72 fPrevSector(-1),
73 fRow(-1),
74 fPrevRow(-1),
75 fPad(-1),
76 fPrevPad(-1)
77{
78 Fatal("AliTPCRawStreamOld", "copy constructor not implemented");
79}
80
81//_____________________________________________________________________________
82AliTPCRawStreamOld& AliTPCRawStreamOld::operator = (const AliTPCRawStreamOld&
83 /* stream */)
84{
85 Fatal("operator =", "assignment operator not implemented");
86 return *this;
87}
88
89//_____________________________________________________________________________
90AliTPCRawStreamOld::~AliTPCRawStreamOld()
91{
92// destructor
93
94 for(Int_t i = 0; i < 6; i++) delete fMapping[i];
95}
96
97//_____________________________________________________________________________
98void AliTPCRawStreamOld::Reset()
99{
100 // reset tpc raw stream params
101 AliAltroRawStreamOld::Reset();
102 fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = -1;
103}
104
105//_____________________________________________________________________________
106Bool_t AliTPCRawStreamOld::Next()
107{
108 // Read next TPC signal
109 // Apply the TPC altro mapping to get
110 // the sector,pad-row and pad indeces
111 fPrevSector = fSector;
112 fPrevRow = fRow;
113 fPrevPad = fPad;
114 if (AliAltroRawStreamOld::Next()) {
115 if (IsNewHWAddress())
116 ApplyAltroMapping();
117 return kTRUE;
118 }
119 else
120 return kFALSE;
121}
122
123//_____________________________________________________________________________
124void AliTPCRawStreamOld::ApplyAltroMapping()
125{
126 // Take the DDL index, load
127 // the corresponding altro mapping
128 // object and fill the sector,row and pad indeces
93dca16d 129 Int_t ddlNumber = GetDDLNumber();
130 switch (ddlNumber) {
131 case 152:
132 ddlNumber = 74;
133 break;
134 case 153:
135 ddlNumber = 75;
136 break;
137 case 253:
138 ddlNumber = 0;
139 break;
140 case 0:
141 ddlNumber = 73;
142 break;
143 case 1:
144 ddlNumber = 1;
145 break;
146 case 5:
147 ddlNumber = 72;
148 break;
149 default:
150 break;
151 }
5bbd01a6 152 Int_t patchIndex;
153 if (ddlNumber < 72) {
154 fSector = ddlNumber / 2;
155 patchIndex = ddlNumber % 2;
156 }
157 else {
158 fSector = (ddlNumber - 72) / 4 + 36;
159 patchIndex = (ddlNumber - 72) % 4 + 2;
160 }
161
162 Short_t hwAddress = GetHWAddress();
163 fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
164 fPad = fMapping[patchIndex]->GetPad(hwAddress);
165
166}