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