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