]>
Commit | Line | Data |
---|---|---|
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 | ||
35 | ClassImp(AliTPCRawStreamFast) | |
36 | ||
37 | //_____________________________________________________________________________ | |
08205ed7 | 38 | AliTPCRawStreamFast::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), | |
4958b652 | 46 | fIsMapOwner(kFALSE) |
a0918fa7 | 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 | } | |
4958b652 | 62 | fIsMapOwner = kTRUE; |
08205ed7 | 63 | } |
64 | else { | |
65 | for(Int_t i = 0; i < 6; i++) | |
66 | fMapping[i] = mapping[i]; | |
a0918fa7 | 67 | } |
68 | ||
a0918fa7 | 69 | |
08205ed7 | 70 | //fNoAltroMapping = kFALSE; |
a0918fa7 | 71 | } |
a0918fa7 | 72 | //_____________________________________________________________________________ |
73 | AliTPCRawStreamFast::~AliTPCRawStreamFast() | |
74 | { | |
75 | // destructor | |
76 | ||
77 | if (fIsMapOwner) | |
78 | for(Int_t i = 0; i < 6; i++) delete fMapping[i]; | |
79 | } | |
80 | ||
81 | //_____________________________________________________________________________ | |
82 | void AliTPCRawStreamFast::Reset() | |
83 | { | |
84 | // reset tpc raw stream params | |
85 | AliAltroRawStreamFast::Reset(); | |
86 | fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = -1; | |
87 | } | |
88 | ||
89 | //_____________________________________________________________________________ | |
90 | Bool_t AliTPCRawStreamFast::NextChannel() | |
91 | { | |
92 | // Read next TPC Channel | |
93 | // Apply the TPC altro mapping to get | |
94 | // the sector,pad-row and pad indeces | |
95 | fPrevSector = fSector; | |
96 | fPrevRow = fRow; | |
97 | fPrevPad = fPad; | |
98 | if (AliAltroRawStreamFast::NextChannel()) { | |
99 | // if (IsNewHWAddress()) | |
100 | if ( GetHWAddress() > -1 ) | |
101 | ApplyAltroMapping(); | |
102 | return kTRUE; | |
103 | } | |
104 | else | |
105 | return kFALSE; | |
106 | } | |
107 | ||
108 | //_____________________________________________________________________________ | |
109 | void AliTPCRawStreamFast::ApplyAltroMapping() | |
110 | { | |
111 | // Take the DDL index, load | |
112 | // the corresponding altro mapping | |
113 | // object and fill the sector,row and pad indeces | |
114 | Int_t ddlNumber = GetDDLNumber(); | |
115 | Int_t patchIndex; | |
116 | if (ddlNumber < 72) { | |
117 | fSector = ddlNumber / 2; | |
118 | patchIndex = ddlNumber % 2; | |
119 | } | |
120 | else { | |
121 | fSector = (ddlNumber - 72) / 4 + 36; | |
122 | patchIndex = (ddlNumber - 72) % 4 + 2; | |
123 | } | |
124 | ||
125 | Short_t hwAddress = GetHWAddress(); | |
126 | fRow = fMapping[patchIndex]->GetPadRow(hwAddress); | |
127 | fPad = fMapping[patchIndex]->GetPad(hwAddress); | |
128 | ||
129 | // if ((fRow < 0) || (fPad < 0)) | |
130 | // AddMappingErrorLog(Form("hw=%d",hwAddress)); | |
131 | } |