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 **************************************************************************/
16 /* $Id: AliTPCRawStreamV3.cxx 22777 2007-12-05 17:37:33Z marian $ */
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 NextChannel method loads the data for the next pad. If there is no pad left
24 /// it returns kFALSE.
26 ///////////////////////////////////////////////////////////////////////////////
30 #include "AliTPCRawStreamV3.h"
31 #include "AliRawReader.h"
33 #include "AliTPCAltroMapping.h"
35 ClassImp(AliTPCRawStreamV3)
37 //_____________________________________________________________________________
38 AliTPCRawStreamV3::AliTPCRawStreamV3(AliRawReader* rawReader, AliAltroMapping **mapping) :
39 AliAltroRawStreamV3(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];
71 //fNoAltroMapping = kFALSE;
73 //_____________________________________________________________________________
74 AliTPCRawStreamV3::~AliTPCRawStreamV3()
79 for(Int_t i = 0; i < 6; i++) delete fMapping[i];
82 //_____________________________________________________________________________
83 void AliTPCRawStreamV3::Reset()
85 // reset tpc raw stream params
86 AliAltroRawStreamV3::Reset();
87 fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = fPatchIndex = -1;
90 //_____________________________________________________________________________
91 Bool_t AliTPCRawStreamV3::NextChannel()
93 // Read next TPC Channel
94 // Apply the TPC altro mapping to get
95 // the pad-row and pad indeces
98 fPrevSector = fSector;
101 if (AliAltroRawStreamV3::NextChannel()) {
102 // if (IsNewHWAddress())
103 if ( GetHWAddress() > -1 )
115 if (!AliAltroRawStreamV3::NextChannel()) return kFALSE;
117 Short_t hwAddress = GetHWAddress();
119 fRow = fMapping[fPatchIndex]->GetPadRow(hwAddress);
120 fPad = fMapping[fPatchIndex]->GetPad(hwAddress);
124 //_____________________________________________________________________________
125 Bool_t AliTPCRawStreamV3::NextDDL()
127 // Take the DDL index,
128 // calculate the patch number and
129 // set the sector number
130 // return AliAltroRawStreamV3::NextDDL();
131 fPrevSector = fSector;
133 if (!AliAltroRawStreamV3::NextDDL()) return kFALSE;
135 Int_t ddlNumber = GetDDLNumber();
136 if (ddlNumber < 72) {
137 fSector = ddlNumber / 2;
138 fPatchIndex = ddlNumber % 2;
141 fSector = (ddlNumber - 72) / 4 + 36;
142 fPatchIndex = (ddlNumber - 72) % 4 + 2;
146 //_____________________________________________________________________________
147 void AliTPCRawStreamV3::ApplyAltroMapping()
149 Int_t ddlNumber = GetDDLNumber();
151 if (ddlNumber < 72) {
152 fSector = ddlNumber / 2;
153 patchIndex = ddlNumber % 2;
156 fSector = (ddlNumber - 72) / 4 + 36;
157 patchIndex = (ddlNumber - 72) % 4 + 2;
160 Short_t hwAddress = GetHWAddress();
161 fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
162 fPad = fMapping[patchIndex]->GetPad(hwAddress);
165 // if ((fRow < 0) || (fPad < 0))
166 // AddMappingErrorLog(Form("hw=%d",hwAddress));