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