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];
70 fNoAltroMapping = kFALSE;
73 //_____________________________________________________________________________
74 AliTPCRawStream::AliTPCRawStream(const AliTPCRawStream& stream) :
75 AliAltroRawStream(stream),
76 fSector(stream.fSector),
77 fPrevSector(stream.fPrevSector),
79 fPrevRow(stream.fPrevRow),
81 fPrevPad(stream.fPrevPad),
84 for(Int_t i = 0; i < 6; i++) fMapping[i] = stream.fMapping[i];
87 //_____________________________________________________________________________
88 AliTPCRawStream& AliTPCRawStream::operator = (const AliTPCRawStream& stream)
90 if(&stream == this) return *this;
92 ((AliAltroRawStream *)this)->operator=(stream);
94 fSector = stream.fSector;
95 fPrevSector = stream.fPrevSector;
97 fPrevRow = stream.fPrevRow;
99 fPrevPad = stream.fPrevPad;
100 fIsMapOwner = kFALSE;
102 for(Int_t i = 0; i < 6; i++) fMapping[i] = stream.fMapping[i];
107 //_____________________________________________________________________________
108 AliTPCRawStream::~AliTPCRawStream()
113 for(Int_t i = 0; i < 6; i++) delete fMapping[i];
116 //_____________________________________________________________________________
117 void AliTPCRawStream::Reset()
119 // reset tpc raw stream params
120 AliAltroRawStream::Reset();
121 fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = -1;
124 //_____________________________________________________________________________
125 Bool_t AliTPCRawStream::Next()
127 // Read next TPC signal
128 // Apply the TPC altro mapping to get
129 // the sector,pad-row and pad indeces
130 fPrevSector = fSector;
133 if (AliAltroRawStream::Next()) {
134 if (IsNewHWAddress())
142 //_____________________________________________________________________________
143 void AliTPCRawStream::ApplyAltroMapping()
145 // Take the DDL index, load
146 // the corresponding altro mapping
147 // object and fill the sector,row and pad indeces
148 Int_t ddlNumber = GetDDLNumber();
150 if (ddlNumber < 72) {
151 fSector = ddlNumber / 2;
152 patchIndex = ddlNumber % 2;
155 fSector = (ddlNumber - 72) / 4 + 36;
156 patchIndex = (ddlNumber - 72) % 4 + 2;
159 Short_t hwAddress = GetHWAddress();
160 fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
161 fPad = fMapping[patchIndex]->GetPad(hwAddress);
163 if ((fRow < 0) || (fPad < 0))
164 AddMappingErrorLog(Form("hw=%d",hwAddress));