1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // $MpId: AliMpFiles.cxx,v 1.8 2006/03/02 16:37:20 ivana Exp $
22 // Class for generating file names and paths.
24 // zones.dat, zones_special.dat - sector description
25 // motif*.dat - motif description (generated from Exceed)
26 // padPos*.dat - pad positions in motif
28 // Included in AliRoot: 2003/05/02
29 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
32 #include <Riostream.h>
34 #include "AliMpFiles.h"
41 // static data members
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";
61 //______________________________________________________________________________
62 AliMpFiles::AliMpFiles()
65 /// Default constructor
68 //______________________________________________________________________________
69 AliMpFiles::AliMpFiles(const AliMpFiles& right)
72 /// Protected copy constructor
74 AliFatalClass("Attempt to copy AliMpFiles singleton.");
78 //______________________________________________________________________________
79 AliMpFiles::~AliMpFiles()
86 //______________________________________________________________________________
87 AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right)
89 /// Assignment operator
91 // check assignment to self
92 if (this == &right) return *this;
94 AliFatalClass("Attempt to assign AliMpFiles singleton.");
103 //______________________________________________________________________________
104 TString AliMpFiles::GetTop()
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.
110 TString top = getenv("MINSTALL");
111 if ( ! top.IsNull() ) return top;
113 TString ntop = getenv("ALICE_ROOT");
114 if ( ntop.IsNull() ) {
115 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
118 ntop += "/MUON/mapping";
122 //______________________________________________________________________________
123 TString AliMpFiles::PlaneDataDir(AliMpStationType station,
124 AliMpPlaneType plane)
126 /// Returns path to data files with sector description
127 /// for a specified plane.
134 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
136 case kNonBendingPlane:
137 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
142 case kStationTrigger:
143 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
146 AliFatalClass("Incomplete switch on AliMpPlaneType");
152 //______________________________________________________________________________
153 TString AliMpFiles::StationDataDir(AliMpStationType station)
155 /// Returns the station directory name for the specified station number.
157 TString stationDataDir(fgkStationDir);
160 stationDataDir += "1/";
164 stationDataDir += "2/";
168 stationDataDir += "345/";
171 case kStationTrigger:
172 stationDataDir += "Trigger/";
176 stationDataDir += "Invalid/";
179 return stationDataDir;
186 //______________________________________________________________________________
187 TString AliMpFiles::BusPatchFilePath()
189 /// Return path to data file with bus patch mapping.
191 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
194 //______________________________________________________________________________
195 TString AliMpFiles::DENamesFilePath(AliMpStationType station)
197 /// Return path to data file with DE names for given station.
199 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
202 //______________________________________________________________________________
203 TString AliMpFiles::LocalTriggerBoardMapping()
205 /// Return path to data file with DE names for given station.
207 return TString(PlaneDataDir(kStationTrigger,kNonBendingPlane)
208 + fgkTriggerLocalBoards
212 //_____________________________________________________________________________
213 TString AliMpFiles::SlatFilePath(AliMpStationType stationType,
214 const char* slatType,
215 AliMpPlaneType plane)
219 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
220 ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
223 //_____________________________________________________________________________
224 TString AliMpFiles::SlatPCBFilePath(AliMpStationType stationType,
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.
231 return TString(PlaneDataDir(stationType,kNonBendingPlane) + pcbType +
235 //______________________________________________________________________________
236 TString AliMpFiles::SectorFilePath(AliMpStationType station,
237 AliMpPlaneType plane)
239 /// Return path to data file with sector description.
241 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
244 //______________________________________________________________________________
245 TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station,
246 AliMpPlaneType plane)
248 /// Return path to data file with sector special description (irregular motifs).
250 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
253 //______________________________________________________________________________
254 TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station,
255 AliMpPlaneType plane)
257 /// Returns path to data file with sector special description (irregular motifs).
259 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
262 //______________________________________________________________________________
263 TString AliMpFiles::MotifFilePath(AliMpStationType station,
264 AliMpPlaneType plane,
265 const TString& motifTypeID)
267 /// Returns path to data file for a given motif type.
269 return TString(PlaneDataDir(station, plane)
270 + fgkMotifPrefix + motifTypeID + fgkDataExt);
273 //______________________________________________________________________________
274 TString AliMpFiles::PadPosFilePath(AliMpStationType station,
275 AliMpPlaneType plane,
276 const TString& motifTypeID)
278 /// Returns path to data file with pad positions for a given motif type.
280 return TString(PlaneDataDir(station, plane)
281 + fgkPadPosPrefix + motifTypeID + fgkDataExt);
284 //______________________________________________________________________________
285 TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station,
286 AliMpPlaneType plane,
287 const TString& motifID)
289 /// Returns path to data file with pad dimensions for a given motif ID.
291 return TString(PlaneDataDir(station, plane)
292 + fgkMotifSpecialPrefix + motifID + fgkDataExt);
296 //______________________________________________________________________________
297 TString AliMpFiles::BergToGCFilePath(AliMpStationType station)
299 /// Returns the path of the file which describes the correspondance between
300 /// the berg number and the gassiplex channel.
302 return GetTop() + fgkDataDir + StationDataDir(station)
303 + fgkBergToGCFileName + fgkDataExt;
306 //______________________________________________________________________________
308 AliMpFiles::SetTopPath(const TString& topPath)