]>
Commit | Line | Data |
---|---|---|
5f91c9e8 | 1 | // $Id$ |
2 | // Category: sector | |
3 | // | |
4 | // Class AliMpFiles | |
5 | // ---------------- | |
6 | // Class for generating file names and paths. | |
7 | // The input files: | |
8 | // zones.dat, zones_special.dat - sector description | |
9 | // motif*.dat - motif description (generated from Exceed) | |
10 | // padPos*.dat - pad positions in motif | |
11 | // | |
12 | // Authors: David Guez, Ivana Hrivnacova; IPN Orsay | |
13 | ||
14 | #include <stdlib.h> | |
15 | ||
16 | #include "AliMpFiles.h" | |
17 | ||
18 | ClassImp(AliMpFiles) | |
19 | ||
20 | // static data members | |
21 | ||
22 | AliMpFiles* AliMpFiles::fgInstance = 0; | |
23 | const TString AliMpFiles::fgkDefaultTop = getenv("MINSTALL"); | |
be2a6782 | 24 | const TString AliMpFiles::fgkDataDir = "/data"; |
25 | const TString AliMpFiles::fgkStationDir = "/station"; | |
26 | const TString AliMpFiles::fgkBendingDir = "/bending_plane/"; | |
27 | const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/"; | |
5f91c9e8 | 28 | const TString AliMpFiles::fgkSector = "zones"; |
29 | const TString AliMpFiles::fgkSectorSpecial = "zones_special"; | |
be2a6782 | 30 | const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer"; |
5f91c9e8 | 31 | const TString AliMpFiles::fgkMotifPrefix = "motif"; |
32 | const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial"; | |
33 | const TString AliMpFiles::fgkPadPosPrefix = "padPos"; | |
34 | const TString AliMpFiles::fgkDataExt = ".dat"; | |
35 | const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC"; | |
36 | ||
37 | //______________________________________________________________________________ | |
38 | AliMpFiles::AliMpFiles() | |
be2a6782 | 39 | : TObject(), |
40 | fTop(fgkDefaultTop) | |
5f91c9e8 | 41 | { |
42 | // | |
43 | if (fgInstance) { | |
44 | Fatal("AliMpFiles", | |
45 | "AliMpFiles: attempt to create two instances of singleton."); | |
46 | } | |
47 | ||
48 | fgInstance = this; | |
49 | } | |
50 | ||
51 | //______________________________________________________________________________ | |
be2a6782 | 52 | AliMpFiles::AliMpFiles(const AliMpFiles& right) |
53 | : TObject(right) | |
54 | { | |
5f91c9e8 | 55 | // |
56 | Fatal("AliMpFiles", "Attempt to copy AliMpFiles singleton."); | |
57 | } | |
58 | ||
59 | ||
60 | //______________________________________________________________________________ | |
61 | AliMpFiles::~AliMpFiles() { | |
62 | // | |
63 | ||
64 | fgInstance = 0; | |
65 | } | |
66 | ||
67 | // operators | |
68 | ||
69 | //______________________________________________________________________________ | |
70 | AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right) | |
71 | { | |
72 | // check assignement to self | |
73 | if (this == &right) return *this; | |
74 | ||
75 | Fatal("operator=", "Attempt to assign AliMpFiles singleton."); | |
76 | ||
77 | return *this; | |
78 | } | |
79 | ||
80 | // | |
81 | // private methods | |
82 | // | |
83 | ||
84 | //______________________________________________________________________________ | |
be2a6782 | 85 | TString AliMpFiles::PlaneDataDir(AliMpStationType station, |
86 | AliMpPlaneType plane) const | |
5f91c9e8 | 87 | { |
88 | // Returns path to data files with sector description | |
89 | // for a specified plane. | |
90 | // --- | |
91 | ||
92 | switch (plane) { | |
93 | case kBendingPlane: | |
be2a6782 | 94 | return fTop + fgkDataDir + StationDataDir(station) + fgkBendingDir; |
5f91c9e8 | 95 | ;; |
96 | case kNonBendingPlane: | |
be2a6782 | 97 | return fTop + fgkDataDir + StationDataDir(station) + fgkNonBendingDir; |
5f91c9e8 | 98 | ;; |
99 | } | |
100 | ||
101 | Fatal("PlaneDataDir", "Incomplete switch on AliMpPlaneType"); | |
102 | return TString(); | |
103 | } | |
104 | ||
be2a6782 | 105 | //______________________________________________________________________________ |
106 | TString AliMpFiles::StationDataDir(AliMpStationType station) const | |
107 | { | |
108 | // Returns the station directory name for the specified station number. | |
109 | // --- | |
110 | ||
111 | TString stationDataDir(fgkStationDir); | |
112 | switch (station) { | |
113 | case kStation1: | |
114 | stationDataDir += 1; | |
115 | break; | |
116 | ;; | |
117 | case kStation2: | |
118 | stationDataDir += 2; | |
119 | break; | |
120 | ;; | |
121 | } | |
122 | return stationDataDir; | |
123 | } | |
124 | ||
5f91c9e8 | 125 | // |
126 | // public methods | |
127 | // | |
128 | ||
129 | //______________________________________________________________________________ | |
130 | AliMpFiles* AliMpFiles::Instance() | |
131 | { | |
132 | // Return the singleton instance; | |
133 | // Creates it if it does not yet exist, | |
134 | // | |
135 | // --- | |
136 | ||
137 | if (!fgInstance) fgInstance = new AliMpFiles(); | |
138 | ||
139 | return fgInstance; | |
140 | } | |
141 | ||
142 | //______________________________________________________________________________ | |
be2a6782 | 143 | TString AliMpFiles::SectorFilePath(AliMpStationType station, |
144 | AliMpPlaneType plane) const | |
5f91c9e8 | 145 | { |
146 | // Returns path to data file with sector description. | |
147 | // --- | |
148 | ||
be2a6782 | 149 | return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt); |
150 | } | |
151 | ||
152 | //______________________________________________________________________________ | |
153 | TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station, | |
154 | AliMpPlaneType plane) const | |
155 | { | |
156 | // Returns path to data file with sector special description (irregular motifs). | |
157 | // --- | |
158 | ||
159 | return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt); | |
5f91c9e8 | 160 | } |
161 | ||
162 | //______________________________________________________________________________ | |
be2a6782 | 163 | TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station, |
164 | AliMpPlaneType plane) const | |
5f91c9e8 | 165 | { |
166 | // Returns path to data file with sector special description (irregular motifs). | |
167 | // --- | |
168 | ||
be2a6782 | 169 | return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt); |
5f91c9e8 | 170 | } |
171 | ||
172 | //______________________________________________________________________________ | |
be2a6782 | 173 | TString AliMpFiles::MotifFilePath(AliMpStationType station, |
174 | AliMpPlaneType plane, | |
5f91c9e8 | 175 | const TString& motifTypeID) const |
176 | { | |
177 | // Returns path to data file for a given motif type. | |
178 | // --- | |
179 | ||
be2a6782 | 180 | return TString(PlaneDataDir(station, plane) |
181 | + fgkMotifPrefix + motifTypeID + fgkDataExt); | |
5f91c9e8 | 182 | } |
183 | ||
184 | //______________________________________________________________________________ | |
be2a6782 | 185 | TString AliMpFiles::PadPosFilePath(AliMpStationType station, |
186 | AliMpPlaneType plane, | |
5f91c9e8 | 187 | const TString& motifTypeID) const |
188 | { | |
189 | // Returns path to data file with pad positions for a given motif type. | |
190 | // --- | |
191 | ||
be2a6782 | 192 | return TString(PlaneDataDir(station, plane) |
193 | + fgkPadPosPrefix + motifTypeID + fgkDataExt); | |
5f91c9e8 | 194 | } |
195 | ||
196 | //______________________________________________________________________________ | |
be2a6782 | 197 | TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station, |
198 | AliMpPlaneType plane, | |
5f91c9e8 | 199 | const TString& motifID) const |
200 | { | |
201 | // Returns path to data file with pad dimensions for a given motif ID. | |
202 | // --- | |
203 | ||
be2a6782 | 204 | return TString(PlaneDataDir(station, plane) |
205 | + fgkMotifSpecialPrefix + motifID + fgkDataExt); | |
5f91c9e8 | 206 | |
207 | } | |
208 | ||
209 | //______________________________________________________________________________ | |
be2a6782 | 210 | TString AliMpFiles::BergToGCFilePath(AliMpStationType station) const |
5f91c9e8 | 211 | { |
212 | // Returns the path of the file which describes the correspondance between | |
213 | // the berg number and the gassiplex channel. | |
214 | // --- | |
215 | ||
be2a6782 | 216 | return fTop + fgkDataDir + StationDataDir(station) |
217 | + fgkBergToGCFileName + fgkDataExt; | |
5f91c9e8 | 218 | } |