]>
Commit | Line | Data |
---|---|---|
65792ca0 | 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 PHOS digits in raw data. | |
21 | /// | |
22 | /// It loops over all PHOS digits in the raw data given by the AliRawReader. | |
23 | /// The Next method goes to the next digit. If there are no digits left | |
24 | /// it returns kFALSE. | |
25 | /// Several getters provide information about the current digit. | |
b7f3cbac | 26 | /// usage: |
27 | /// root > AliRawReaderFile rawReader ; | |
28 | /// root > AliPHOSRawStream input(&rawReader) ; | |
29 | /// root > while (input.Next()) ..... | |
65792ca0 | 30 | /////////////////////////////////////////////////////////////////////////////// |
31 | ||
be88e894 | 32 | #include <TString.h> |
33 | #include <TSystem.h> | |
34 | ||
65792ca0 | 35 | #include "AliPHOSRawStream.h" |
36 | #include "AliRawReader.h" | |
be88e894 | 37 | #include "AliPHOSAltroMapping.h" |
65792ca0 | 38 | |
c2b19535 | 39 | ClassImp(AliPHOSRawStream) |
65792ca0 | 40 | |
f88e2313 | 41 | |
65792ca0 | 42 | //_____________________________________________________________________________ |
f88e2313 | 43 | AliPHOSRawStream::AliPHOSRawStream(AliRawReader* rawReader) : |
7b916e14 | 44 | AliAltroRawStream(rawReader), |
45 | fModule(-1), | |
46 | fPrevModule(-1), | |
47 | fRow(-1), | |
48 | fPrevRow(-1), | |
49 | fColumn(-1), | |
be88e894 | 50 | fPrevColumn(-1), |
51 | fGain(0) | |
65792ca0 | 52 | { |
f88e2313 | 53 | // create an object to read PHOS raw digits |
65792ca0 | 54 | |
362c9d61 | 55 | SelectRawData("PHOS"); |
7b916e14 | 56 | |
be88e894 | 57 | TString path = gSystem->Getenv("ALICE_ROOT"); |
58 | path += "/PHOS/mapping/RCU"; | |
59 | TString path2; | |
60 | for(Int_t i = 0; i < 4; i++) { | |
61 | path2 = path; | |
62 | path2 += i; | |
63 | path2 += ".data"; | |
64 | fMapping[i] = new AliPHOSAltroMapping(path2.Data()); | |
65 | } | |
66 | ||
67 | SetNoAltroMapping(kFALSE); | |
7b916e14 | 68 | } |
69 | ||
70 | //_____________________________________________________________________________ | |
71 | AliPHOSRawStream::AliPHOSRawStream(const AliPHOSRawStream& stream) : | |
72 | AliAltroRawStream(stream), | |
73 | fModule(-1), | |
74 | fPrevModule(-1), | |
75 | fRow(-1), | |
76 | fPrevRow(-1), | |
77 | fColumn(-1), | |
be88e894 | 78 | fPrevColumn(-1), |
79 | fGain(0) | |
7b916e14 | 80 | { |
81 | Fatal("AliPHOSRawStream", "copy constructor not implemented"); | |
82 | } | |
83 | ||
84 | //_____________________________________________________________________________ | |
85 | AliPHOSRawStream& AliPHOSRawStream::operator = (const AliPHOSRawStream& | |
86 | /* stream */) | |
87 | { | |
88 | Fatal("operator =", "assignment operator not implemented"); | |
89 | return *this; | |
90 | } | |
91 | ||
92 | //_____________________________________________________________________________ | |
93 | AliPHOSRawStream::~AliPHOSRawStream() | |
94 | { | |
95 | // destructor | |
be88e894 | 96 | |
97 | for(Int_t i = 0; i < 4; i++) delete fMapping[i]; | |
7b916e14 | 98 | } |
99 | ||
100 | //_____________________________________________________________________________ | |
101 | void AliPHOSRawStream::Reset() | |
102 | { | |
103 | // reset phos raw stream params | |
104 | AliAltroRawStream::Reset(); | |
105 | fModule = fPrevModule = fRow = fPrevRow = fColumn = fPrevColumn = -1; | |
be88e894 | 106 | fGain = 0; |
7b916e14 | 107 | } |
108 | ||
109 | //_____________________________________________________________________________ | |
110 | Bool_t AliPHOSRawStream::Next() | |
111 | { | |
112 | // Read next PHOS signal | |
113 | // Apply the PHOS altro mapping to get | |
114 | // the module,row and column indeces | |
115 | fPrevModule = fModule; | |
116 | fPrevRow = fRow; | |
117 | fPrevColumn = fColumn; | |
118 | if (AliAltroRawStream::Next()) { | |
be88e894 | 119 | if (IsNewHWAddress()) |
120 | ApplyAltroMapping(); | |
7b916e14 | 121 | return kTRUE; |
122 | } | |
123 | else | |
124 | return kFALSE; | |
125 | } | |
126 | ||
127 | //_____________________________________________________________________________ | |
128 | void AliPHOSRawStream::ApplyAltroMapping() | |
129 | { | |
130 | // Take the DDL index, load | |
131 | // the corresponding altro mapping | |
132 | // object and fill the sector,row and pad indeces | |
be88e894 | 133 | Int_t ddlNumber = GetDDLNumber(); |
134 | fModule = ddlNumber / 4; | |
135 | ||
136 | Int_t rcuIndex = ddlNumber % 4; | |
137 | ||
138 | Short_t hwAddress = GetHWAddress(); | |
139 | fRow = fMapping[rcuIndex]->GetPadRow(hwAddress); | |
140 | fColumn = fMapping[rcuIndex]->GetPad(hwAddress); | |
141 | fGain = fMapping[rcuIndex]->GetSector(hwAddress); | |
142 | ||
65792ca0 | 143 | } |