]>
Commit | Line | Data |
---|---|---|
dee1d5f1 | 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 | ||
5f91c9e8 | 16 | // $Id$ |
f023e45b | 17 | // $MpId: AliMpFiles.cxx,v 1.12 2006/05/23 13:09:54 ivana Exp $ |
dee1d5f1 | 18 | // Category: basic |
3d1463c8 | 19 | |
20 | //----------------------------------------------------------------------------- | |
5f91c9e8 | 21 | // Class AliMpFiles |
22 | // ---------------- | |
23 | // Class for generating file names and paths. | |
24 | // The input files: | |
25 | // zones.dat, zones_special.dat - sector description | |
26 | // motif*.dat - motif description (generated from Exceed) | |
27 | // padPos*.dat - pad positions in motif | |
28 | // | |
dbe945cc | 29 | // Included in AliRoot: 2003/05/02 |
5f91c9e8 | 30 | // Authors: David Guez, Ivana Hrivnacova; IPN Orsay |
3d1463c8 | 31 | //----------------------------------------------------------------------------- |
5f91c9e8 | 32 | |
5f91c9e8 | 33 | #include "AliMpFiles.h" |
2c605e66 | 34 | |
7f54909e | 35 | #include "AliLog.h" |
2c605e66 | 36 | |
37 | #include <TClass.h> | |
38 | #include <Riostream.h> | |
39 | ||
40 | #include <stdlib.h> | |
5f91c9e8 | 41 | |
13985652 | 42 | /// \cond CLASSIMP |
43 | ClassImp(AliMpFiles) | |
44 | /// \endcond | |
7f54909e | 45 | |
13985652 | 46 | // |
f023e45b | 47 | // static |
48 | ||
5f91c9e8 | 49 | // static data members |
50 | ||
be2a6782 | 51 | const TString AliMpFiles::fgkDataDir = "/data"; |
52 | const TString AliMpFiles::fgkStationDir = "/station"; | |
53 | const TString AliMpFiles::fgkBendingDir = "/bending_plane/"; | |
54 | const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/"; | |
0025a53e | 55 | const TString AliMpFiles::fgkDENames = "denames"; |
5f91c9e8 | 56 | const TString AliMpFiles::fgkSector = "zones"; |
57 | const TString AliMpFiles::fgkSectorSpecial = "zones_special"; | |
be2a6782 | 58 | const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer"; |
5f91c9e8 | 59 | const TString AliMpFiles::fgkMotifPrefix = "motif"; |
60 | const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial"; | |
67f410f1 | 61 | const TString AliMpFiles::fgkManuToSerialDir ="manu_serial/"; |
ec5079b1 | 62 | const TString AliMpFiles::fgkManuToSerial ="_manu"; |
5f91c9e8 | 63 | const TString AliMpFiles::fgkPadPosPrefix = "padPos"; |
64 | const TString AliMpFiles::fgkDataExt = ".dat"; | |
7f54909e | 65 | const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC"; |
f023e45b | 66 | const TString AliMpFiles::fgkTriggerLocalBoards = "crate"; |
4df2ac68 | 67 | const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch"; |
0b121e9e | 68 | const TString AliMpFiles::fgkBusPatchLengthFileName = "BusPatchLength"; |
5f91c9e8 | 69 | //______________________________________________________________________________ |
dee1d5f1 | 70 | AliMpFiles::~AliMpFiles() |
71 | { | |
72 | /// Destructor | |
5f91c9e8 | 73 | } |
74 | ||
5f91c9e8 | 75 | // |
76 | // private methods | |
77 | // | |
78 | ||
7f54909e | 79 | //______________________________________________________________________________ |
d9100e8b | 80 | TString AliMpFiles::GetTop() |
7f54909e | 81 | { |
490da820 | 82 | /// Return top path to mapping data defined either via MINSTALL |
83 | /// or ALICE_ROOT environment variable. \n | |
84 | /// If both variables are defined, MINSTALL is used. | |
85 | ||
d9100e8b | 86 | TString top = getenv("MINSTALL"); |
527e050d | 87 | if ( ! top.IsNull() ) return top; |
88 | ||
d9100e8b | 89 | TString ntop = getenv("ALICE_ROOT"); |
527e050d | 90 | if ( ntop.IsNull() ) { |
91 | AliErrorClassStream() << "Cannot find path to mapping data." << endl; | |
92 | return ntop; | |
93 | } | |
94 | ntop += "/MUON/mapping"; | |
95 | return ntop; | |
7f54909e | 96 | } |
97 | ||
5f91c9e8 | 98 | //______________________________________________________________________________ |
cddd101e | 99 | TString AliMpFiles::PlaneDataDir(AliMp::StationType station, |
100 | AliMp::PlaneType plane) | |
5f91c9e8 | 101 | { |
dee1d5f1 | 102 | /// Returns path to data files with sector description |
103 | /// for a specified plane. | |
5f91c9e8 | 104 | |
dee1d5f1 | 105 | switch (station) { |
cddd101e | 106 | case AliMp::kStation1: |
107 | case AliMp::kStation2: | |
dee1d5f1 | 108 | switch (plane) { |
cddd101e | 109 | case AliMp::kBendingPlane: |
d9100e8b | 110 | return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir; |
dee1d5f1 | 111 | ;; |
cddd101e | 112 | case AliMp::kNonBendingPlane: |
d9100e8b | 113 | return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir; |
dee1d5f1 | 114 | ;; |
115 | } | |
116 | break; | |
cddd101e | 117 | case AliMp::kStation345: |
118 | case AliMp::kStationTrigger: | |
d9100e8b | 119 | return GetTop() + fgkDataDir + StationDataDir(station) + "/"; |
7f54909e | 120 | break; |
121 | default: | |
cddd101e | 122 | AliFatalClass("Incomplete switch on AliMp::PlaneType"); |
dee1d5f1 | 123 | break; |
124 | } | |
5f91c9e8 | 125 | return TString(); |
126 | } | |
127 | ||
be2a6782 | 128 | //______________________________________________________________________________ |
cddd101e | 129 | TString AliMpFiles::StationDataDir(AliMp::StationType station) |
be2a6782 | 130 | { |
dee1d5f1 | 131 | /// Returns the station directory name for the specified station number. |
be2a6782 | 132 | |
133 | TString stationDataDir(fgkStationDir); | |
134 | switch (station) { | |
cddd101e | 135 | case AliMp::kStation1: |
0025a53e | 136 | stationDataDir += "1/"; |
dee1d5f1 | 137 | break; |
138 | ;; | |
cddd101e | 139 | case AliMp::kStation2: |
0025a53e | 140 | stationDataDir += "2/"; |
dee1d5f1 | 141 | break; |
142 | ;; | |
cddd101e | 143 | case AliMp::kStation345: |
dee1d5f1 | 144 | stationDataDir += "345/"; |
145 | break; | |
146 | ;; | |
cddd101e | 147 | case AliMp::kStationTrigger: |
7f54909e | 148 | stationDataDir += "Trigger/"; |
149 | break; | |
150 | ;; | |
151 | default: | |
152 | stationDataDir += "Invalid/"; | |
153 | break; | |
be2a6782 | 154 | } |
155 | return stationDataDir; | |
156 | } | |
157 | ||
5f91c9e8 | 158 | // |
159 | // public methods | |
160 | // | |
161 | ||
4df2ac68 | 162 | //______________________________________________________________________________ |
163 | TString AliMpFiles::BusPatchFilePath() | |
164 | { | |
165 | /// Return path to data file with bus patch mapping. | |
166 | ||
d9100e8b | 167 | return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt; |
4df2ac68 | 168 | } |
169 | ||
0b121e9e | 170 | //______________________________________________________________________________ |
171 | TString AliMpFiles::BusPatchLengthFilePath() | |
172 | { | |
173 | /// Return path to data file with bus patch mapping. | |
174 | ||
175 | return GetTop() + fgkDataDir + "/" + fgkBusPatchLengthFileName + fgkDataExt; | |
176 | } | |
177 | ||
0025a53e | 178 | //______________________________________________________________________________ |
cddd101e | 179 | TString AliMpFiles::DENamesFilePath(AliMp::StationType station) |
0025a53e | 180 | { |
181 | /// Return path to data file with DE names for given station. | |
182 | ||
d9100e8b | 183 | return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt; |
0025a53e | 184 | } |
185 | ||
4df2ac68 | 186 | //______________________________________________________________________________ |
187 | TString AliMpFiles::LocalTriggerBoardMapping() | |
188 | { | |
f023e45b | 189 | /// Return path to data file with local trigger board mapping. |
490da820 | 190 | |
cddd101e | 191 | return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger) |
f023e45b | 192 | + fgkTriggerLocalBoards + fgkDataExt;; |
4df2ac68 | 193 | } |
194 | ||
dee1d5f1 | 195 | //_____________________________________________________________________________ |
cddd101e | 196 | TString AliMpFiles::SlatFilePath(AliMp::StationType stationType, |
7f54909e | 197 | const char* slatType, |
cddd101e | 198 | AliMp::PlaneType plane) |
dee1d5f1 | 199 | { |
200 | /// \todo add .. | |
201 | ||
7f54909e | 202 | return TString(PlaneDataDir(stationType,plane) + slatType + "." + |
cddd101e | 203 | ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat"); |
dee1d5f1 | 204 | } |
205 | ||
206 | //_____________________________________________________________________________ | |
cddd101e | 207 | TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType, |
7f54909e | 208 | const char* pcbType) |
dee1d5f1 | 209 | { |
210 | /// Get the full path for a given PCB (only relevant to stations 3, | |
7f54909e | 211 | /// 4, 5 and trigger). The bending parameter below is of no use in this case, but |
dee1d5f1 | 212 | /// we use it to re-use the PlaneDataDir() method untouched. |
213 | ||
cddd101e | 214 | return TString(PlaneDataDir(stationType,AliMp::kNonBendingPlane) + pcbType + |
7f54909e | 215 | ".pcb"); |
dee1d5f1 | 216 | } |
217 | ||
5f91c9e8 | 218 | //______________________________________________________________________________ |
cddd101e | 219 | TString AliMpFiles::SectorFilePath(AliMp::StationType station, |
220 | AliMp::PlaneType plane) | |
5f91c9e8 | 221 | { |
dee1d5f1 | 222 | /// Return path to data file with sector description. |
5f91c9e8 | 223 | |
be2a6782 | 224 | return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt); |
225 | } | |
226 | ||
227 | //______________________________________________________________________________ | |
cddd101e | 228 | TString AliMpFiles::SectorSpecialFilePath(AliMp::StationType station, |
229 | AliMp::PlaneType plane) | |
be2a6782 | 230 | { |
dee1d5f1 | 231 | /// Return path to data file with sector special description (irregular motifs). |
be2a6782 | 232 | |
233 | return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt); | |
5f91c9e8 | 234 | } |
235 | ||
236 | //______________________________________________________________________________ | |
cddd101e | 237 | TString AliMpFiles::SectorSpecialFilePath2(AliMp::StationType station, |
238 | AliMp::PlaneType plane) | |
5f91c9e8 | 239 | { |
dee1d5f1 | 240 | /// Returns path to data file with sector special description (irregular motifs). |
5f91c9e8 | 241 | |
be2a6782 | 242 | return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt); |
5f91c9e8 | 243 | } |
82915841 | 244 | |
245 | //______________________________________________________________________________ | |
246 | TString AliMpFiles::MotifFileName(const TString& motifTypeID) | |
247 | { | |
248 | /// Returns name of data file for a given motif type. | |
249 | ||
250 | return TString(fgkMotifPrefix + motifTypeID + fgkDataExt); | |
251 | } | |
252 | ||
5f91c9e8 | 253 | //______________________________________________________________________________ |
cddd101e | 254 | TString AliMpFiles::MotifFilePath(AliMp::StationType station, |
255 | AliMp::PlaneType plane, | |
7f54909e | 256 | const TString& motifTypeID) |
5f91c9e8 | 257 | { |
dee1d5f1 | 258 | /// Returns path to data file for a given motif type. |
5f91c9e8 | 259 | |
82915841 | 260 | return TString(PlaneDataDir(station, plane) + MotifFileName(motifTypeID)); |
5f91c9e8 | 261 | } |
82915841 | 262 | |
263 | //______________________________________________________________________________ | |
264 | TString AliMpFiles::PadPosFileName(const TString& motifTypeID) | |
265 | { | |
266 | /// Returns name of data file with pad positions for a given motif type. | |
267 | ||
268 | return TString(fgkPadPosPrefix + motifTypeID + fgkDataExt); | |
269 | } | |
270 | ||
5f91c9e8 | 271 | //______________________________________________________________________________ |
cddd101e | 272 | TString AliMpFiles::PadPosFilePath(AliMp::StationType station, |
273 | AliMp::PlaneType plane, | |
7f54909e | 274 | const TString& motifTypeID) |
5f91c9e8 | 275 | { |
dee1d5f1 | 276 | /// Returns path to data file with pad positions for a given motif type. |
5f91c9e8 | 277 | |
82915841 | 278 | return TString(PlaneDataDir(station, plane) + PadPosFileName(motifTypeID)); |
279 | } | |
280 | ||
281 | //______________________________________________________________________________ | |
282 | TString AliMpFiles::MotifSpecialFileName(const TString& motifID) | |
283 | { | |
284 | /// Returns name of data file with pad dimensions for a given motif ID. | |
285 | ||
286 | return TString(fgkMotifSpecialPrefix + motifID + fgkDataExt); | |
287 | ||
5f91c9e8 | 288 | } |
289 | ||
290 | //______________________________________________________________________________ | |
cddd101e | 291 | TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station, |
292 | AliMp::PlaneType plane, | |
7f54909e | 293 | const TString& motifID) |
5f91c9e8 | 294 | { |
dee1d5f1 | 295 | /// Returns path to data file with pad dimensions for a given motif ID. |
5f91c9e8 | 296 | |
82915841 | 297 | return TString(PlaneDataDir(station, plane) + MotifSpecialFileName(motifID)); |
5f91c9e8 | 298 | } |
299 | ||
300 | //______________________________________________________________________________ | |
cddd101e | 301 | TString AliMpFiles::BergToGCFilePath(AliMp::StationType station) |
5f91c9e8 | 302 | { |
dee1d5f1 | 303 | /// Returns the path of the file which describes the correspondance between |
304 | /// the berg number and the gassiplex channel. | |
5f91c9e8 | 305 | |
d9100e8b | 306 | return GetTop() + fgkDataDir + StationDataDir(station) |
be2a6782 | 307 | + fgkBergToGCFileName + fgkDataExt; |
5f91c9e8 | 308 | } |
7f54909e | 309 | |
ec5079b1 | 310 | //______________________________________________________________________________ |
cddd101e | 311 | TString AliMpFiles::ManuToSerialPath(const TString& deName, AliMp::StationType station) |
ec5079b1 | 312 | { |
313 | /// Returns the path of the file for the manu id to their serial number | |
314 | ||
67f410f1 | 315 | return GetTop() + fgkDataDir + StationDataDir(station) |
316 | + fgkManuToSerialDir + deName + fgkManuToSerial + fgkDataExt; | |
ec5079b1 | 317 | } |
318 | ||
319 | ||
7f54909e | 320 | //______________________________________________________________________________ |
321 | void | |
322 | AliMpFiles::SetTopPath(const TString& topPath) | |
323 | { | |
71a2d3aa | 324 | /// Set top file path |
325 | ||
d9100e8b | 326 | GetTop() = topPath; |
7f54909e | 327 | } |
328 |