]>
Commit | Line | Data |
---|---|---|
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 | ||
34 | ClassImp(AliTPCRawStreamOld) | |
35 | ||
36 | //_____________________________________________________________________________ | |
37 | AliTPCRawStreamOld::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 | ||
48 | // Do not select on the equipment Id, since the Id | |
49 | // is wrong (it starts from 228 or so...) | |
50 | // SelectRawData(0); | |
51 | // Skip the Common Data Header, since it is only 7 | |
52 | // 32-bit words | |
53 | rawReader->RequireHeader(kFALSE); | |
54 | ||
55 | TString path = gSystem->Getenv("ALICE_ROOT"); | |
56 | path += "/TPC/mapping/Patch"; | |
57 | TString path2; | |
58 | for(Int_t i = 0; i < 6; i++) { | |
59 | path2 = path; | |
60 | path2 += i; | |
61 | path2 += ".data"; | |
62 | fMapping[i] = new AliTPCAltroMapping(path2.Data()); | |
63 | } | |
64 | ||
65 | fNoAltroMapping = kFALSE; | |
66 | } | |
67 | ||
68 | //_____________________________________________________________________________ | |
69 | AliTPCRawStreamOld::AliTPCRawStreamOld(const AliTPCRawStreamOld& stream) : | |
70 | AliAltroRawStreamOld(stream), | |
71 | fSector(-1), | |
72 | fPrevSector(-1), | |
73 | fRow(-1), | |
74 | fPrevRow(-1), | |
75 | fPad(-1), | |
76 | fPrevPad(-1) | |
77 | { | |
78 | Fatal("AliTPCRawStreamOld", "copy constructor not implemented"); | |
79 | } | |
80 | ||
81 | //_____________________________________________________________________________ | |
82 | AliTPCRawStreamOld& AliTPCRawStreamOld::operator = (const AliTPCRawStreamOld& | |
83 | /* stream */) | |
84 | { | |
85 | Fatal("operator =", "assignment operator not implemented"); | |
86 | return *this; | |
87 | } | |
88 | ||
89 | //_____________________________________________________________________________ | |
90 | AliTPCRawStreamOld::~AliTPCRawStreamOld() | |
91 | { | |
92 | // destructor | |
93 | ||
94 | for(Int_t i = 0; i < 6; i++) delete fMapping[i]; | |
95 | } | |
96 | ||
97 | //_____________________________________________________________________________ | |
98 | void AliTPCRawStreamOld::Reset() | |
99 | { | |
100 | // reset tpc raw stream params | |
101 | AliAltroRawStreamOld::Reset(); | |
102 | fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = -1; | |
103 | } | |
104 | ||
105 | //_____________________________________________________________________________ | |
106 | Bool_t AliTPCRawStreamOld::Next() | |
107 | { | |
108 | // Read next TPC signal | |
109 | // Apply the TPC altro mapping to get | |
110 | // the sector,pad-row and pad indeces | |
111 | fPrevSector = fSector; | |
112 | fPrevRow = fRow; | |
113 | fPrevPad = fPad; | |
114 | if (AliAltroRawStreamOld::Next()) { | |
115 | if (IsNewHWAddress()) | |
116 | ApplyAltroMapping(); | |
117 | return kTRUE; | |
118 | } | |
119 | else | |
120 | return kFALSE; | |
121 | } | |
122 | ||
123 | //_____________________________________________________________________________ | |
124 | void AliTPCRawStreamOld::ApplyAltroMapping() | |
125 | { | |
126 | // Take the DDL index, load | |
127 | // the corresponding altro mapping | |
128 | // object and fill the sector,row and pad indeces | |
129 | Int_t ddlNumber = GetDDLNumber()-228; | |
130 | Int_t patchIndex; | |
131 | if (ddlNumber < 72) { | |
132 | fSector = ddlNumber / 2; | |
133 | patchIndex = ddlNumber % 2; | |
134 | } | |
135 | else { | |
136 | fSector = (ddlNumber - 72) / 4 + 36; | |
137 | patchIndex = (ddlNumber - 72) % 4 + 2; | |
138 | } | |
139 | ||
140 | Short_t hwAddress = GetHWAddress(); | |
141 | fRow = fMapping[patchIndex]->GetPadRow(hwAddress); | |
142 | fPad = fMapping[patchIndex]->GetPad(hwAddress); | |
143 | ||
144 | } |