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