]>
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"); | |
24 | const TString AliMpFiles::fgkDataDir = "/data";; | |
25 | const TString AliMpFiles::fgkBendingDir = "/bending_plane/";; | |
26 | const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";; | |
27 | const TString AliMpFiles::fgkSector = "zones"; | |
28 | const TString AliMpFiles::fgkSectorSpecial = "zones_special"; | |
29 | const TString AliMpFiles::fgkMotifPrefix = "motif"; | |
30 | const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial"; | |
31 | const TString AliMpFiles::fgkPadPosPrefix = "padPos"; | |
32 | const TString AliMpFiles::fgkDataExt = ".dat"; | |
33 | const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC"; | |
34 | ||
35 | //______________________________________________________________________________ | |
36 | AliMpFiles::AliMpFiles() | |
37 | : fTop(fgkDefaultTop) | |
38 | { | |
39 | // | |
40 | if (fgInstance) { | |
41 | Fatal("AliMpFiles", | |
42 | "AliMpFiles: attempt to create two instances of singleton."); | |
43 | } | |
44 | ||
45 | fgInstance = this; | |
46 | } | |
47 | ||
48 | //______________________________________________________________________________ | |
49 | AliMpFiles::AliMpFiles(const AliMpFiles& right) { | |
50 | // | |
51 | Fatal("AliMpFiles", "Attempt to copy AliMpFiles singleton."); | |
52 | } | |
53 | ||
54 | ||
55 | //______________________________________________________________________________ | |
56 | AliMpFiles::~AliMpFiles() { | |
57 | // | |
58 | ||
59 | fgInstance = 0; | |
60 | } | |
61 | ||
62 | // operators | |
63 | ||
64 | //______________________________________________________________________________ | |
65 | AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right) | |
66 | { | |
67 | // check assignement to self | |
68 | if (this == &right) return *this; | |
69 | ||
70 | Fatal("operator=", "Attempt to assign AliMpFiles singleton."); | |
71 | ||
72 | return *this; | |
73 | } | |
74 | ||
75 | // | |
76 | // private methods | |
77 | // | |
78 | ||
79 | //______________________________________________________________________________ | |
80 | TString AliMpFiles::PlaneDataDir(AliMpPlaneType plane) const | |
81 | { | |
82 | // Returns path to data files with sector description | |
83 | // for a specified plane. | |
84 | // --- | |
85 | ||
86 | switch (plane) { | |
87 | case kBendingPlane: | |
88 | return fTop + fgkDataDir + fgkBendingDir; | |
89 | ;; | |
90 | case kNonBendingPlane: | |
91 | return fTop + fgkDataDir + fgkNonBendingDir; | |
92 | ;; | |
93 | } | |
94 | ||
95 | Fatal("PlaneDataDir", "Incomplete switch on AliMpPlaneType"); | |
96 | return TString(); | |
97 | } | |
98 | ||
99 | // | |
100 | // public methods | |
101 | // | |
102 | ||
103 | //______________________________________________________________________________ | |
104 | AliMpFiles* AliMpFiles::Instance() | |
105 | { | |
106 | // Return the singleton instance; | |
107 | // Creates it if it does not yet exist, | |
108 | // | |
109 | // --- | |
110 | ||
111 | if (!fgInstance) fgInstance = new AliMpFiles(); | |
112 | ||
113 | return fgInstance; | |
114 | } | |
115 | ||
116 | //______________________________________________________________________________ | |
117 | TString AliMpFiles::SectorFilePath(AliMpPlaneType plane) const | |
118 | { | |
119 | // Returns path to data file with sector description. | |
120 | // --- | |
121 | ||
122 | return TString(PlaneDataDir(plane) + fgkSector + fgkDataExt); | |
123 | } | |
124 | ||
125 | //______________________________________________________________________________ | |
126 | TString AliMpFiles::SectorSpecialFilePath(AliMpPlaneType plane) const | |
127 | { | |
128 | // Returns path to data file with sector special description (irregular motifs). | |
129 | // --- | |
130 | ||
131 | return TString(PlaneDataDir(plane) + fgkSectorSpecial + fgkDataExt); | |
132 | } | |
133 | ||
134 | //______________________________________________________________________________ | |
135 | TString AliMpFiles::MotifFilePath(AliMpPlaneType plane, | |
136 | const TString& motifTypeID) const | |
137 | { | |
138 | // Returns path to data file for a given motif type. | |
139 | // --- | |
140 | ||
141 | return TString(PlaneDataDir(plane) + fgkMotifPrefix + motifTypeID + fgkDataExt); | |
142 | } | |
143 | ||
144 | //______________________________________________________________________________ | |
145 | TString AliMpFiles::PadPosFilePath(AliMpPlaneType plane, | |
146 | const TString& motifTypeID) const | |
147 | { | |
148 | // Returns path to data file with pad positions for a given motif type. | |
149 | // --- | |
150 | ||
151 | return TString(PlaneDataDir(plane) + fgkPadPosPrefix + motifTypeID + fgkDataExt); | |
152 | } | |
153 | ||
154 | //______________________________________________________________________________ | |
155 | TString AliMpFiles::MotifSpecialFilePath(AliMpPlaneType plane, | |
156 | const TString& motifID) const | |
157 | { | |
158 | // Returns path to data file with pad dimensions for a given motif ID. | |
159 | // --- | |
160 | ||
161 | return TString(PlaneDataDir(plane) + fgkMotifSpecialPrefix + motifID + fgkDataExt); | |
162 | ||
163 | } | |
164 | ||
165 | //______________________________________________________________________________ | |
166 | TString AliMpFiles::BergToGCFilePath() const | |
167 | { | |
168 | // Returns the path of the file which describes the correspondance between | |
169 | // the berg number and the gassiplex channel. | |
170 | // --- | |
171 | ||
172 | return fTop+fgkDataDir+fgkBergToGCFileName+fgkDataExt; | |
173 | } |