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