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 ///////////////////////////////////////////////////////////////////////////////
20 /// This class provides access to TPC digits in raw data.
22 /// It loops over all TPC digits in the raw data given by the AliRawReader.
23 /// The Next method goes to the next digit. If there are no digits left
24 /// it returns kFALSE.
25 /// Several getters provide information about the current digit.
27 ///////////////////////////////////////////////////////////////////////////////
31 #include "AliTPCRawStream.h"
32 #include "AliRawReader.h"
34 #include "AliTPCAltroMapping.h"
36 ClassImp(AliTPCRawStream)
38 //_____________________________________________________________________________
39 AliTPCRawStream::AliTPCRawStream(AliRawReader* rawReader, AliAltroMapping **mapping) :
40 AliAltroRawStream(rawReader),
49 // create an object to read TPC raw digits
53 if (mapping == NULL) {
54 TString path = gSystem->Getenv("ALICE_ROOT");
55 path += "/TPC/mapping/Patch";
57 for(Int_t i = 0; i < 6; i++) {
61 fMapping[i] = new AliTPCAltroMapping(path2.Data());
66 for(Int_t i = 0; i < 6; i++)
67 fMapping[i] = mapping[i];
72 //_____________________________________________________________________________
73 AliTPCRawStream::AliTPCRawStream(const AliTPCRawStream& stream) :
74 AliAltroRawStream(stream),
75 fSector(stream.fSector),
76 fPrevSector(stream.fPrevSector),
78 fPrevRow(stream.fPrevRow),
80 fPrevPad(stream.fPrevPad),
83 for(Int_t i = 0; i < 6; i++) fMapping[i] = stream.fMapping[i];
86 //_____________________________________________________________________________
87 AliTPCRawStream& AliTPCRawStream::operator = (const AliTPCRawStream& stream)
89 if(&stream == this) return *this;
91 ((AliAltroRawStream *)this)->operator=(stream);
93 fSector = stream.fSector;
94 fPrevSector = stream.fPrevSector;
96 fPrevRow = stream.fPrevRow;
98 fPrevPad = stream.fPrevPad;
101 for(Int_t i = 0; i < 6; i++) fMapping[i] = stream.fMapping[i];
106 //_____________________________________________________________________________
107 AliTPCRawStream::~AliTPCRawStream()
112 for(Int_t i = 0; i < 6; i++) delete fMapping[i];
115 //_____________________________________________________________________________
116 void AliTPCRawStream::Reset()
118 // reset tpc raw stream params
119 AliAltroRawStream::Reset();
120 fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = -1;
123 //_____________________________________________________________________________
124 Bool_t AliTPCRawStream::Next()
126 // Read next TPC signal
127 // Apply the TPC altro mapping to get
128 // the sector,pad-row and pad indeces
129 fPrevSector = fSector;
132 if (AliAltroRawStream::Next()) {
133 if (IsNewHWAddress())
141 //_____________________________________________________________________________
142 void AliTPCRawStream::ApplyAltroMapping()
144 // Take the DDL index, load
145 // the corresponding altro mapping
146 // object and fill the sector,row and pad indeces
147 Int_t ddlNumber = GetDDLNumber();
149 if (ddlNumber < 72) {
150 fSector = ddlNumber / 2;
151 patchIndex = ddlNumber % 2;
154 fSector = (ddlNumber - 72) / 4 + 36;
155 patchIndex = (ddlNumber - 72) % 4 + 2;
158 Short_t hwAddress = GetHWAddress();
159 fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
160 fPad = fMapping[patchIndex]->GetPad(hwAddress);
162 if ((fRow < 0) || (fPad < 0))
163 AddMappingErrorLog(Form("hw=%d",hwAddress));