AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCRawStreamV3.cxx
Go to the documentation of this file.
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 
23 
24 #include <TSystem.h>
25 
26 #include "AliTPCRawStreamV3.h"
27 #include "AliRawReader.h"
28 #include "AliLog.h"
29 #include "AliTPCAltroMapping.h"
30 
34 
35 //_____________________________________________________________________________
36 AliTPCRawStreamV3::AliTPCRawStreamV3(AliRawReader* rawReader, AliAltroMapping **mapping) :
37  AliAltroRawStreamV3(rawReader),
38  fSector(-1),
39  fPrevSector(-1),
40  fRow(-1),
41  fPrevRow(-1),
42  fPad(-1),
43  fPrevPad(-1),
44  fPatchIndex(-1),
45  fIsMapOwner(kFALSE)
46 {
47  // create an object to read TPC raw digits
48 
49  SelectRawData("TPC");
50 
51  if (mapping == NULL) {
52  TString path = gSystem->Getenv("ALICE_ROOT");
53  path += "/TPC/mapping/Patch";
54  TString path2;
55  for(Int_t i = 0; i < 6; i++) {
56  path2 = path;
57  path2 += i;
58  path2 += ".data";
59  fMapping[i] = new AliTPCAltroMapping(path2.Data());
60  }
61  fIsMapOwner = kTRUE;
62  }
63  else {
64  for(Int_t i = 0; i < 6; i++)
65  fMapping[i] = mapping[i];
66  }
67 
68 
69  //fNoAltroMapping = kFALSE;
70 }
71 //_____________________________________________________________________________
73 {
74 // destructor
75 
76  if (fIsMapOwner)
77  for(Int_t i = 0; i < 6; i++) delete fMapping[i];
78 }
79 
80 //_____________________________________________________________________________
82 {
83  // reset tpc raw stream params
84  AliAltroRawStreamV3::Reset();
86 }
87 
88 //_____________________________________________________________________________
90 {
91  // Read next TPC Channel
92  // Apply the TPC altro mapping to get
93  // the pad-row and pad indeces
94 
95 /*
96  fPrevSector = fSector;
97  fPrevRow = fRow;
98  fPrevPad = fPad;
99  if (AliAltroRawStreamV3::NextChannel()) {
100  // if (IsNewHWAddress())
101  if ( GetHWAddress() > -1 )
102  ApplyAltroMapping();
103  return kTRUE;
104  }
105  else
106  return kFALSE;
107  */
108 
109  fPrevRow = fRow;
110  fPrevPad = fPad;
111  fRow = -1;
112  fPad = -1;
113  if (!AliAltroRawStreamV3::NextChannel()) return kFALSE;
114 
115  Short_t hwAddress = GetHWAddress();
116  if (hwAddress>-1){
117  fRow = fMapping[fPatchIndex]->GetPadRow(hwAddress);
118  fPad = fMapping[fPatchIndex]->GetPad(hwAddress);
119  }
120  return kTRUE;
121 }
122 //_____________________________________________________________________________
124 {
125  // Take the DDL index,
126  // calculate the patch number and
127  // set the sector number
128 // return AliAltroRawStreamV3::NextDDL();
130  fSector = -1;
131  if (!AliAltroRawStreamV3::NextDDL()) return kFALSE;
132 
133  Int_t ddlNumber = GetDDLNumber();
134  if (ddlNumber < 72) {
135  fSector = ddlNumber / 2;
136  fPatchIndex = ddlNumber % 2;
137  }
138  else {
139  fSector = (ddlNumber - 72) / 4 + 36;
140  fPatchIndex = (ddlNumber - 72) % 4 + 2;
141  }
142  return kTRUE;
143 }
144 //_____________________________________________________________________________
146 {
147  Int_t ddlNumber = GetDDLNumber();
148  Int_t patchIndex;
149  if (ddlNumber < 72) {
150  fSector = ddlNumber / 2;
151  patchIndex = ddlNumber % 2;
152  }
153  else {
154  fSector = (ddlNumber - 72) / 4 + 36;
155  patchIndex = (ddlNumber - 72) % 4 + 2;
156  }
157 
158  Short_t hwAddress = GetHWAddress();
159  fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
160  fPad = fMapping[patchIndex]->GetPad(hwAddress);
161 
162 
163 // if ((fRow < 0) || (fPad < 0))
164 // AddMappingErrorLog(Form("hw=%d",hwAddress));
165 }
Int_t fPad
index of current pad
virtual Bool_t NextChannel()
Int_t fPrevSector
index of previous sector
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Int_t fRow
index of current row
This class provides access to TPC digits in raw data.
Int_t fPrevPad
index of previous pad
virtual Bool_t NextDDL()
AliAltroMapping * fMapping[6]
Pointers to ALTRO mapping.
Int_t fPatchIndex
current patch
Int_t fSector
index of current sector
virtual void ApplyAltroMapping()
virtual void Reset()
Int_t fPrevRow
index of previous row
Bool_t fIsMapOwner
does object own its mappings?