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 "AliTPCRawStreamFast.h"
32 #include "AliRawReader.h"
34 #include "AliTPCAltroMapping.h"
36 ClassImp(AliTPCRawStreamFast)
38 //_____________________________________________________________________________
39 AliTPCRawStreamFast::AliTPCRawStreamFast(AliRawReader* rawReader) :
40 AliAltroRawStreamFast(rawReader),
49 // create an object to read TPC raw digits
53 TString path = gSystem->Getenv("ALICE_ROOT");
54 path += "/TPC/mapping/Patch";
56 for(Int_t i = 0; i < 6; i++) {
60 fMapping[i] = new AliTPCAltroMapping(path2.Data());
63 //fNoAltroMapping = kFALSE;
66 //_____________________________________________________________________________
67 AliTPCRawStreamFast::AliTPCRawStreamFast(const AliTPCRawStreamFast& stream) :
68 AliAltroRawStreamFast(stream),
69 fSector(stream.fSector),
70 fPrevSector(stream.fPrevSector),
72 fPrevRow(stream.fPrevRow),
74 fPrevPad(stream.fPrevPad),
77 for(Int_t i = 0; i < 6; i++) fMapping[i] = stream.fMapping[i];
80 //_____________________________________________________________________________
81 AliTPCRawStreamFast& AliTPCRawStreamFast::operator = (const AliTPCRawStreamFast& stream)
83 if(&stream == this) return *this;
85 ((AliAltroRawStreamFast *)this)->operator=(stream);
87 fSector = stream.fSector;
88 fPrevSector = stream.fPrevSector;
90 fPrevRow = stream.fPrevRow;
92 fPrevPad = stream.fPrevPad;
95 for(Int_t i = 0; i < 6; i++) fMapping[i] = stream.fMapping[i];
100 //_____________________________________________________________________________
101 AliTPCRawStreamFast::~AliTPCRawStreamFast()
106 for(Int_t i = 0; i < 6; i++) delete fMapping[i];
109 //_____________________________________________________________________________
110 void AliTPCRawStreamFast::Reset()
112 // reset tpc raw stream params
113 AliAltroRawStreamFast::Reset();
114 fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = -1;
117 //_____________________________________________________________________________
118 Bool_t AliTPCRawStreamFast::NextChannel()
120 // Read next TPC Channel
121 // Apply the TPC altro mapping to get
122 // the sector,pad-row and pad indeces
123 fPrevSector = fSector;
126 if (AliAltroRawStreamFast::NextChannel()) {
127 // if (IsNewHWAddress())
128 if ( GetHWAddress() > -1 )
136 //_____________________________________________________________________________
137 void AliTPCRawStreamFast::ApplyAltroMapping()
139 // Take the DDL index, load
140 // the corresponding altro mapping
141 // object and fill the sector,row and pad indeces
142 Int_t ddlNumber = GetDDLNumber();
144 if (ddlNumber < 72) {
145 fSector = ddlNumber / 2;
146 patchIndex = ddlNumber % 2;
149 fSector = (ddlNumber - 72) / 4 + 36;
150 patchIndex = (ddlNumber - 72) % 4 + 2;
153 Short_t hwAddress = GetHWAddress();
154 fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
155 fPad = fMapping[patchIndex]->GetPad(hwAddress);
157 // if ((fRow < 0) || (fPad < 0))
158 // AddMappingErrorLog(Form("hw=%d",hwAddress));