removed alias tpc_TP_359.Temperature (not used)
[u/mrichter/AliRoot.git] / TPC / AliTPCRawStreamFast.cxx
CommitLineData
a0918fa7 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/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19///
20/// This class provides access to TPC digits in raw data.
21///
22/// It loops over all TPC digits in the raw data given by the AliRawReader.
08205ed7 23/// The NextChannel method loads the data for the next pad. If there is no pad left
a0918fa7 24/// it returns kFALSE.
a0918fa7 25///
26///////////////////////////////////////////////////////////////////////////////
27
28#include <TSystem.h>
29
30#include "AliTPCRawStreamFast.h"
31#include "AliRawReader.h"
32#include "AliLog.h"
33#include "AliTPCAltroMapping.h"
34
35ClassImp(AliTPCRawStreamFast)
36
37//_____________________________________________________________________________
08205ed7 38AliTPCRawStreamFast::AliTPCRawStreamFast(AliRawReader* rawReader, AliAltroMapping **mapping) :
a0918fa7 39 AliAltroRawStreamFast(rawReader),
40 fSector(-1),
41 fPrevSector(-1),
42 fRow(-1),
43 fPrevRow(-1),
44 fPad(-1),
45 fPrevPad(-1),
46 fIsMapOwner(kTRUE)
47{
48 // create an object to read TPC raw digits
49
50 SelectRawData("TPC");
51
08205ed7 52 if (mapping == NULL) {
53 TString path = gSystem->Getenv("ALICE_ROOT");
54 path += "/TPC/mapping/Patch";
55 TString path2;
56 for(Int_t i = 0; i < 6; i++) {
57 path2 = path;
58 path2 += i;
59 path2 += ".data";
60 fMapping[i] = new AliTPCAltroMapping(path2.Data());
61 }
62 }
63 else {
64 for(Int_t i = 0; i < 6; i++)
65 fMapping[i] = mapping[i];
a0918fa7 66 }
67
a0918fa7 68
08205ed7 69 //fNoAltroMapping = kFALSE;
a0918fa7 70}
a0918fa7 71//_____________________________________________________________________________
72AliTPCRawStreamFast::~AliTPCRawStreamFast()
73{
74// destructor
75
76 if (fIsMapOwner)
77 for(Int_t i = 0; i < 6; i++) delete fMapping[i];
78}
79
80//_____________________________________________________________________________
81void AliTPCRawStreamFast::Reset()
82{
83 // reset tpc raw stream params
84 AliAltroRawStreamFast::Reset();
85 fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = -1;
86}
87
88//_____________________________________________________________________________
89Bool_t AliTPCRawStreamFast::NextChannel()
90{
91 // Read next TPC Channel
92 // Apply the TPC altro mapping to get
93 // the sector,pad-row and pad indeces
94 fPrevSector = fSector;
95 fPrevRow = fRow;
96 fPrevPad = fPad;
97 if (AliAltroRawStreamFast::NextChannel()) {
98 // if (IsNewHWAddress())
99 if ( GetHWAddress() > -1 )
100 ApplyAltroMapping();
101 return kTRUE;
102 }
103 else
104 return kFALSE;
105}
106
107//_____________________________________________________________________________
108void AliTPCRawStreamFast::ApplyAltroMapping()
109{
110 // Take the DDL index, load
111 // the corresponding altro mapping
112 // object and fill the sector,row and pad indeces
113 Int_t ddlNumber = GetDDLNumber();
114 Int_t patchIndex;
115 if (ddlNumber < 72) {
116 fSector = ddlNumber / 2;
117 patchIndex = ddlNumber % 2;
118 }
119 else {
120 fSector = (ddlNumber - 72) / 4 + 36;
121 patchIndex = (ddlNumber - 72) % 4 + 2;
122 }
123
124 Short_t hwAddress = GetHWAddress();
125 fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
126 fPad = fMapping[patchIndex]->GetPad(hwAddress);
127
128// if ((fRow < 0) || (fPad < 0))
129// AddMappingErrorLog(Form("hw=%d",hwAddress));
130}