Line data Source code
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 : /// \class AliTPCRawStreamV3
18 : /// \brief 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 NextChannel method loads the data for the next pad. If there is no pad left
22 : /// it returns kFALSE.
23 :
24 : #include <TSystem.h>
25 :
26 : #include "AliTPCRawStreamV3.h"
27 : #include "AliRawReader.h"
28 : #include "AliLog.h"
29 : #include "AliTPCAltroMapping.h"
30 :
31 : /// \cond CLASSIMP
32 24 : ClassImp(AliTPCRawStreamV3)
33 : /// \endcond
34 :
35 : //_____________________________________________________________________________
36 : AliTPCRawStreamV3::AliTPCRawStreamV3(AliRawReader* rawReader, AliAltroMapping **mapping) :
37 4 : AliAltroRawStreamV3(rawReader),
38 4 : fSector(-1),
39 4 : fPrevSector(-1),
40 4 : fRow(-1),
41 4 : fPrevRow(-1),
42 4 : fPad(-1),
43 4 : fPrevPad(-1),
44 4 : fPatchIndex(-1),
45 4 : fIsMapOwner(kFALSE)
46 20 : {
47 : // create an object to read TPC raw digits
48 :
49 4 : SelectRawData("TPC");
50 :
51 4 : if (mapping == NULL) {
52 0 : TString path = gSystem->Getenv("ALICE_ROOT");
53 0 : path += "/TPC/mapping/Patch";
54 0 : TString path2;
55 0 : for(Int_t i = 0; i < 6; i++) {
56 0 : path2 = path;
57 0 : path2 += i;
58 0 : path2 += ".data";
59 0 : fMapping[i] = new AliTPCAltroMapping(path2.Data());
60 : }
61 0 : fIsMapOwner = kTRUE;
62 0 : }
63 : else {
64 56 : for(Int_t i = 0; i < 6; i++)
65 24 : fMapping[i] = mapping[i];
66 : }
67 :
68 :
69 : //fNoAltroMapping = kFALSE;
70 8 : }
71 : //_____________________________________________________________________________
72 : AliTPCRawStreamV3::~AliTPCRawStreamV3()
73 16 : {
74 : // destructor
75 :
76 4 : if (fIsMapOwner)
77 0 : for(Int_t i = 0; i < 6; i++) delete fMapping[i];
78 8 : }
79 :
80 : //_____________________________________________________________________________
81 : void AliTPCRawStreamV3::Reset()
82 : {
83 : // reset tpc raw stream params
84 0 : AliAltroRawStreamV3::Reset();
85 0 : fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = fPatchIndex = -1;
86 0 : }
87 :
88 : //_____________________________________________________________________________
89 : Bool_t AliTPCRawStreamV3::NextChannel()
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 96266 : fPrevRow = fRow;
110 48133 : fPrevPad = fPad;
111 48133 : fRow = -1;
112 48133 : fPad = -1;
113 48915 : if (!AliAltroRawStreamV3::NextChannel()) return kFALSE;
114 :
115 47351 : Short_t hwAddress = GetHWAddress();
116 47351 : if (hwAddress>-1){
117 47351 : fRow = fMapping[fPatchIndex]->GetPadRow(hwAddress);
118 47351 : fPad = fMapping[fPatchIndex]->GetPad(hwAddress);
119 47351 : }
120 : return kTRUE;
121 48133 : }
122 : //_____________________________________________________________________________
123 : Bool_t AliTPCRawStreamV3::NextDDL()
124 : {
125 : // Take the DDL index,
126 : // calculate the patch number and
127 : // set the sector number
128 : // return AliAltroRawStreamV3::NextDDL();
129 2140 : fPrevSector = fSector;
130 1070 : fSector = -1;
131 1358 : if (!AliAltroRawStreamV3::NextDDL()) return kFALSE;
132 :
133 782 : Int_t ddlNumber = GetDDLNumber();
134 782 : if (ddlNumber < 72) {
135 278 : fSector = ddlNumber / 2;
136 278 : fPatchIndex = ddlNumber % 2;
137 278 : }
138 : else {
139 504 : fSector = (ddlNumber - 72) / 4 + 36;
140 504 : fPatchIndex = (ddlNumber - 72) % 4 + 2;
141 : }
142 : return kTRUE;
143 1070 : }
144 : //_____________________________________________________________________________
145 : void AliTPCRawStreamV3::ApplyAltroMapping()
146 : {
147 0 : Int_t ddlNumber = GetDDLNumber();
148 : Int_t patchIndex;
149 0 : if (ddlNumber < 72) {
150 0 : fSector = ddlNumber / 2;
151 0 : patchIndex = ddlNumber % 2;
152 0 : }
153 : else {
154 0 : fSector = (ddlNumber - 72) / 4 + 36;
155 0 : patchIndex = (ddlNumber - 72) % 4 + 2;
156 : }
157 :
158 0 : Short_t hwAddress = GetHWAddress();
159 0 : fRow = fMapping[patchIndex]->GetPadRow(hwAddress);
160 0 : fPad = fMapping[patchIndex]->GetPad(hwAddress);
161 :
162 :
163 : // if ((fRow < 0) || (fPad < 0))
164 : // AddMappingErrorLog(Form("hw=%d",hwAddress));
165 0 : }
|