]>
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$ |
dee1d5f1 | 17 | // $MpId: AliMpFiles.cxx,v 1.4 2005/08/26 15:43:36 ivana Exp $ |
18 | // Category: basic | |
5f91c9e8 | 19 | // |
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 | ||
31 | #include <stdlib.h> | |
32 | ||
33 | #include "AliMpFiles.h" | |
34 | ||
35 | ClassImp(AliMpFiles) | |
36 | ||
37 | // static data members | |
38 | ||
39 | AliMpFiles* AliMpFiles::fgInstance = 0; | |
40 | const TString AliMpFiles::fgkDefaultTop = getenv("MINSTALL"); | |
be2a6782 | 41 | const TString AliMpFiles::fgkDataDir = "/data"; |
42 | const TString AliMpFiles::fgkStationDir = "/station"; | |
43 | const TString AliMpFiles::fgkBendingDir = "/bending_plane/"; | |
44 | const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/"; | |
5f91c9e8 | 45 | const TString AliMpFiles::fgkSector = "zones"; |
46 | const TString AliMpFiles::fgkSectorSpecial = "zones_special"; | |
be2a6782 | 47 | const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer"; |
5f91c9e8 | 48 | const TString AliMpFiles::fgkMotifPrefix = "motif"; |
49 | const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial"; | |
50 | const TString AliMpFiles::fgkPadPosPrefix = "padPos"; | |
51 | const TString AliMpFiles::fgkDataExt = ".dat"; | |
52 | const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC"; | |
53 | ||
54 | //______________________________________________________________________________ | |
55 | AliMpFiles::AliMpFiles() | |
be2a6782 | 56 | : TObject(), |
57 | fTop(fgkDefaultTop) | |
5f91c9e8 | 58 | { |
dee1d5f1 | 59 | /// Default constructor |
60 | ||
5f91c9e8 | 61 | if (fgInstance) { |
62 | Fatal("AliMpFiles", | |
63 | "AliMpFiles: attempt to create two instances of singleton."); | |
64 | } | |
65 | ||
66 | fgInstance = this; | |
67 | } | |
68 | ||
69 | //______________________________________________________________________________ | |
be2a6782 | 70 | AliMpFiles::AliMpFiles(const AliMpFiles& right) |
71 | : TObject(right) | |
72 | { | |
dee1d5f1 | 73 | /// Protected copy constructor |
74 | ||
5f91c9e8 | 75 | Fatal("AliMpFiles", "Attempt to copy AliMpFiles singleton."); |
76 | } | |
77 | ||
78 | ||
79 | //______________________________________________________________________________ | |
dee1d5f1 | 80 | AliMpFiles::~AliMpFiles() |
81 | { | |
82 | /// Destructor | |
5f91c9e8 | 83 | |
84 | fgInstance = 0; | |
85 | } | |
86 | ||
87 | // operators | |
88 | ||
89 | //______________________________________________________________________________ | |
90 | AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right) | |
91 | { | |
dee1d5f1 | 92 | /// Assignment operator |
93 | ||
94 | // check assignment to self | |
5f91c9e8 | 95 | if (this == &right) return *this; |
96 | ||
97 | Fatal("operator=", "Attempt to assign AliMpFiles singleton."); | |
98 | ||
99 | return *this; | |
100 | } | |
101 | ||
102 | // | |
103 | // private methods | |
104 | // | |
105 | ||
106 | //______________________________________________________________________________ | |
be2a6782 | 107 | TString AliMpFiles::PlaneDataDir(AliMpStationType station, |
108 | AliMpPlaneType plane) const | |
5f91c9e8 | 109 | { |
dee1d5f1 | 110 | /// Returns path to data files with sector description |
111 | /// for a specified plane. | |
5f91c9e8 | 112 | |
dee1d5f1 | 113 | switch (station) { |
114 | case kStation1: | |
115 | case kStation2: | |
116 | switch (plane) { | |
5f91c9e8 | 117 | case kBendingPlane: |
dee1d5f1 | 118 | return fTop + fgkDataDir + StationDataDir(station) + fgkBendingDir; |
119 | ;; | |
5f91c9e8 | 120 | case kNonBendingPlane: |
dee1d5f1 | 121 | return fTop + fgkDataDir + StationDataDir(station) + fgkNonBendingDir; |
122 | ;; | |
123 | } | |
124 | break; | |
125 | case kStation345: | |
126 | return fTop + fgkDataDir + StationDataDir(station) + "/"; | |
127 | break; | |
128 | } | |
129 | ||
5f91c9e8 | 130 | Fatal("PlaneDataDir", "Incomplete switch on AliMpPlaneType"); |
131 | return TString(); | |
132 | } | |
133 | ||
be2a6782 | 134 | //______________________________________________________________________________ |
135 | TString AliMpFiles::StationDataDir(AliMpStationType station) const | |
136 | { | |
dee1d5f1 | 137 | /// Returns the station directory name for the specified station number. |
be2a6782 | 138 | |
139 | TString stationDataDir(fgkStationDir); | |
140 | switch (station) { | |
dee1d5f1 | 141 | case kStation1: |
142 | stationDataDir += 1; | |
143 | break; | |
144 | ;; | |
145 | case kStation2: | |
146 | stationDataDir += 2; | |
147 | break; | |
148 | ;; | |
149 | case kStation345: | |
150 | stationDataDir += "345/"; | |
151 | break; | |
152 | ;; | |
be2a6782 | 153 | } |
154 | return stationDataDir; | |
155 | } | |
156 | ||
5f91c9e8 | 157 | // |
158 | // public methods | |
159 | // | |
160 | ||
161 | //______________________________________________________________________________ | |
162 | AliMpFiles* AliMpFiles::Instance() | |
163 | { | |
dee1d5f1 | 164 | /// Return the singleton instance; |
165 | /// Creates it if it does not yet exist, | |
5f91c9e8 | 166 | |
167 | if (!fgInstance) fgInstance = new AliMpFiles(); | |
168 | ||
169 | return fgInstance; | |
170 | } | |
171 | ||
dee1d5f1 | 172 | |
173 | //_____________________________________________________________________________ | |
174 | TString AliMpFiles::SlatFilePath(const char* slatType, | |
175 | AliMpPlaneType plane) const | |
176 | { | |
177 | /// \todo add .. | |
178 | ||
179 | return TString(PlaneDataDir(kStation345,plane) + slatType + "." + | |
180 | ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat"); | |
181 | } | |
182 | ||
183 | //_____________________________________________________________________________ | |
184 | TString AliMpFiles::SlatPCBFilePath(const char* pcbType) const | |
185 | { | |
186 | /// Get the full path for a given PCB (only relevant to stations 3, | |
187 | /// 4 and 5). The bending parameter below is of no use in this case, but | |
188 | /// we use it to re-use the PlaneDataDir() method untouched. | |
189 | ||
190 | return TString(PlaneDataDir(kStation345,kNonBendingPlane) + pcbType + | |
191 | ".pcb"); | |
192 | } | |
193 | ||
194 | //_____________________________________________________________________________ | |
195 | TString | |
196 | AliMpFiles::DetElemIdToSlatTypeFilePath() const | |
197 | { | |
198 | /// Get the full path of the file containing the mapping detElemId <-> | |
199 | /// SlatType. | |
200 | /// The bending parameter below is of no use in this case, but | |
201 | /// we use it to re-use the PlaneDataDir() method untouched. | |
202 | ||
203 | return TString(PlaneDataDir(kStation345,kNonBendingPlane) + | |
204 | "DetElemIdToSlatType.dat"); | |
205 | } | |
5f91c9e8 | 206 | //______________________________________________________________________________ |
be2a6782 | 207 | TString AliMpFiles::SectorFilePath(AliMpStationType station, |
208 | AliMpPlaneType plane) const | |
5f91c9e8 | 209 | { |
dee1d5f1 | 210 | /// Return path to data file with sector description. |
5f91c9e8 | 211 | |
be2a6782 | 212 | return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt); |
213 | } | |
214 | ||
215 | //______________________________________________________________________________ | |
216 | TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station, | |
217 | AliMpPlaneType plane) const | |
218 | { | |
dee1d5f1 | 219 | /// Return path to data file with sector special description (irregular motifs). |
be2a6782 | 220 | |
221 | return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt); | |
5f91c9e8 | 222 | } |
223 | ||
224 | //______________________________________________________________________________ | |
be2a6782 | 225 | TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station, |
226 | AliMpPlaneType plane) const | |
5f91c9e8 | 227 | { |
dee1d5f1 | 228 | /// Returns path to data file with sector special description (irregular motifs). |
5f91c9e8 | 229 | |
be2a6782 | 230 | return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt); |
5f91c9e8 | 231 | } |
232 | ||
233 | //______________________________________________________________________________ | |
be2a6782 | 234 | TString AliMpFiles::MotifFilePath(AliMpStationType station, |
235 | AliMpPlaneType plane, | |
5f91c9e8 | 236 | const TString& motifTypeID) const |
237 | { | |
dee1d5f1 | 238 | /// Returns path to data file for a given motif type. |
5f91c9e8 | 239 | |
be2a6782 | 240 | return TString(PlaneDataDir(station, plane) |
241 | + fgkMotifPrefix + motifTypeID + fgkDataExt); | |
5f91c9e8 | 242 | } |
243 | ||
244 | //______________________________________________________________________________ | |
be2a6782 | 245 | TString AliMpFiles::PadPosFilePath(AliMpStationType station, |
246 | AliMpPlaneType plane, | |
5f91c9e8 | 247 | const TString& motifTypeID) const |
248 | { | |
dee1d5f1 | 249 | /// Returns path to data file with pad positions for a given motif type. |
5f91c9e8 | 250 | |
be2a6782 | 251 | return TString(PlaneDataDir(station, plane) |
252 | + fgkPadPosPrefix + motifTypeID + fgkDataExt); | |
5f91c9e8 | 253 | } |
254 | ||
255 | //______________________________________________________________________________ | |
be2a6782 | 256 | TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station, |
257 | AliMpPlaneType plane, | |
5f91c9e8 | 258 | const TString& motifID) const |
259 | { | |
dee1d5f1 | 260 | /// Returns path to data file with pad dimensions for a given motif ID. |
5f91c9e8 | 261 | |
be2a6782 | 262 | return TString(PlaneDataDir(station, plane) |
263 | + fgkMotifSpecialPrefix + motifID + fgkDataExt); | |
5f91c9e8 | 264 | |
265 | } | |
266 | ||
267 | //______________________________________________________________________________ | |
be2a6782 | 268 | TString AliMpFiles::BergToGCFilePath(AliMpStationType station) const |
5f91c9e8 | 269 | { |
dee1d5f1 | 270 | /// Returns the path of the file which describes the correspondance between |
271 | /// the berg number and the gassiplex channel. | |
5f91c9e8 | 272 | |
be2a6782 | 273 | return fTop + fgkDataDir + StationDataDir(station) |
274 | + fgkBergToGCFileName + fgkDataExt; | |
5f91c9e8 | 275 | } |