]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpFiles.cxx
Work around for CINT bug in root 5.10/00, with gcc4.0.2
[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.8 2006/03/02 16:37:20 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 <stdlib.h>
32 #include <Riostream.h>
33
34 #include "AliMpFiles.h"
35 #include "AliLog.h"
36 #include "TClass.h"
37
38 //
39 // static
40
41 // static data members
42
43 const TString AliMpFiles::fgkDataDir = "/data";
44 const TString AliMpFiles::fgkStationDir = "/station";
45 const TString AliMpFiles::fgkBendingDir = "/bending_plane/";
46 const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";
47 const TString AliMpFiles::fgkDENames = "denames"; 
48 const TString AliMpFiles::fgkSector  = "zones"; 
49 const TString AliMpFiles::fgkSectorSpecial = "zones_special";
50 const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
51 const TString AliMpFiles::fgkMotifPrefix   = "motif";  
52 const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
53 const TString AliMpFiles::fgkPadPosPrefix  = "padPos"; 
54 const TString AliMpFiles::fgkDataExt = ".dat";      
55 const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC"; 
56 const TString AliMpFiles::fgkTriggerLocalBoards = "MUONLocalTriggerBoard";
57 const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
58
59 ClassImp(AliMpFiles)
60
61 //______________________________________________________________________________
62 AliMpFiles::AliMpFiles()
63   : TObject()
64 {
65 /// Default constructor
66 }
67   
68 //______________________________________________________________________________
69 AliMpFiles::AliMpFiles(const AliMpFiles& right)
70   : TObject(right) 
71 {
72 /// Protected copy constructor 
73
74   AliFatalClass("Attempt to copy AliMpFiles singleton.");
75 }
76
77
78 //______________________________________________________________________________
79 AliMpFiles::~AliMpFiles() 
80 {
81 /// Destructor
82 }
83
84 // operators
85
86 //______________________________________________________________________________
87 AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right)
88 {
89 /// Assignment operator
90
91   // check assignment to self
92   if (this == &right) return *this;
93
94   AliFatalClass("Attempt to assign AliMpFiles singleton.");
95     
96   return *this;  
97 }    
98           
99 //
100 // private methods
101 //
102
103 //______________________________________________________________________________
104 TString AliMpFiles::GetTop()
105 {
106 /// Return top path to mapping data defined either via MINSTALL
107 /// or ALICE_ROOT environment variable.                                      \n
108 /// If both variables are defined, MINSTALL is used.
109
110   TString top = getenv("MINSTALL");    
111   if ( ! top.IsNull() ) return top;
112
113   TString ntop = getenv("ALICE_ROOT");
114   if ( ntop.IsNull() ) {
115     AliErrorClassStream() << "Cannot find path to mapping data." << endl;
116     return ntop;
117   }  
118   ntop += "/MUON/mapping";
119   return ntop;
120 }
121
122 //______________________________________________________________________________
123 TString AliMpFiles::PlaneDataDir(AliMpStationType station, 
124                                  AliMpPlaneType plane)
125 {
126 /// Returns path to data files with sector description
127 /// for a specified plane.
128
129   switch (station) {
130   case kStation1:
131   case kStation2:
132     switch (plane) {
133     case kBendingPlane:
134       return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
135       ;;
136     case kNonBendingPlane:   
137       return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
138       ;;
139     }   
140     break;
141   case kStation345:
142   case kStationTrigger:  
143     return GetTop() + fgkDataDir + StationDataDir(station) + "/";
144     break;
145   default:  
146     AliFatalClass("Incomplete switch on AliMpPlaneType");
147     break;
148   }
149   return TString();
150 }
151
152 //______________________________________________________________________________
153 TString AliMpFiles::StationDataDir(AliMpStationType station)
154 {
155 /// Returns the station directory name for the specified station number.
156
157   TString stationDataDir(fgkStationDir);
158   switch (station) {
159   case kStation1: 
160     stationDataDir += "1/";
161     break;
162     ;;
163   case kStation2: 
164     stationDataDir += "2/";
165     break;
166     ;;
167   case kStation345: 
168     stationDataDir += "345/";
169     break;
170     ;;      
171   case kStationTrigger:
172     stationDataDir += "Trigger/";
173     break;
174     ;;
175   default:
176     stationDataDir += "Invalid/";
177     break;
178   }   
179   return stationDataDir;
180 }
181
182 //
183 // public methods
184 //
185
186 //______________________________________________________________________________
187 TString AliMpFiles::BusPatchFilePath()
188 {
189 /// Return path to data file with bus patch mapping.
190
191   return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
192 }  
193
194 //______________________________________________________________________________
195 TString AliMpFiles::DENamesFilePath(AliMpStationType station)
196 {
197 /// Return path to data file with DE names for given station.
198  
199   return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
200 }
201
202 //______________________________________________________________________________
203 TString AliMpFiles::LocalTriggerBoardMapping()
204 {
205 /// Return path to data file with DE names for given station.
206
207   return TString(PlaneDataDir(kStationTrigger,kNonBendingPlane) 
208                  + fgkTriggerLocalBoards
209                  + fgkDataExt);
210 }
211
212 //_____________________________________________________________________________
213 TString AliMpFiles::SlatFilePath(AliMpStationType stationType,
214                                  const char* slatType,
215                                  AliMpPlaneType plane)
216 {
217 /// \todo add ..
218
219   return TString(PlaneDataDir(stationType,plane) + slatType + "." +
220                  ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
221 }
222
223 //_____________________________________________________________________________
224 TString AliMpFiles::SlatPCBFilePath(AliMpStationType stationType,
225                                     const char* pcbType)
226 {
227 /// Get the full path for a given PCB (only relevant to stations 3,
228 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
229 /// we use it to re-use the PlaneDataDir() method untouched.
230
231   return TString(PlaneDataDir(stationType,kNonBendingPlane) + pcbType +
232                  ".pcb");
233 }
234
235 //______________________________________________________________________________
236 TString AliMpFiles::SectorFilePath(AliMpStationType station, 
237                                    AliMpPlaneType plane)
238 {
239 /// Return path to data file with sector description.
240  
241   return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
242 }
243     
244 //______________________________________________________________________________
245 TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station, 
246                                           AliMpPlaneType plane)
247 {
248 /// Return path to data file with sector special description (irregular motifs).
249
250   return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
251 }
252     
253 //______________________________________________________________________________
254 TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station, 
255                                            AliMpPlaneType plane)
256 {
257 /// Returns path to data file with sector special description (irregular motifs).
258
259   return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
260 }
261     
262 //______________________________________________________________________________
263 TString AliMpFiles::MotifFilePath(AliMpStationType station, 
264                                   AliMpPlaneType plane, 
265                                   const TString& motifTypeID)
266 {
267 /// Returns path to data file for a given motif type.
268
269   return TString(PlaneDataDir(station, plane) 
270                  + fgkMotifPrefix +  motifTypeID + fgkDataExt);
271 }
272     
273 //______________________________________________________________________________
274 TString AliMpFiles::PadPosFilePath(AliMpStationType station, 
275                                    AliMpPlaneType plane, 
276                                    const TString& motifTypeID)
277 {
278 /// Returns path to data file with pad positions for a given motif type.
279
280   return TString(PlaneDataDir(station, plane) 
281                  + fgkPadPosPrefix +  motifTypeID + fgkDataExt);
282 }
283
284 //______________________________________________________________________________ 
285 TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station, 
286                                          AliMpPlaneType plane,
287                                          const TString& motifID)
288 {
289 /// Returns path to data file with pad dimensions for a given motif ID.
290
291   return TString(PlaneDataDir(station, plane) 
292                  + fgkMotifSpecialPrefix + motifID + fgkDataExt);
293
294 }
295
296 //______________________________________________________________________________ 
297 TString AliMpFiles::BergToGCFilePath(AliMpStationType station)
298 {
299 /// Returns the path of the file which describes the correspondance between
300 /// the berg number and the gassiplex channel.
301
302   return GetTop() + fgkDataDir + StationDataDir(station)
303               + fgkBergToGCFileName + fgkDataExt;
304 }
305
306 //______________________________________________________________________________ 
307 void 
308 AliMpFiles::SetTopPath(const TString& topPath)
309
310   GetTop() = topPath; 
311 }
312