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.4 2005/08/26 15:43:36 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
33 #include "AliMpFiles.h"
42 // static data members
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::fgkSector = "zones";
50 const TString AliMpFiles::fgkSectorSpecial = "zones_special";
51 const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
52 const TString AliMpFiles::fgkMotifPrefix = "motif";
53 const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
54 const TString AliMpFiles::fgkPadPosPrefix = "padPos";
55 const TString AliMpFiles::fgkDataExt = ".dat";
56 const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
57 const TString AliMpFiles::fgkTriggerLocalBoards = "MUONLocalTriggerBoard";
58 const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
60 TString AliMpFiles::fgTop = AliMpFiles::fgkDefaultTop;
62 //______________________________________________________________________________
63 AliMpFiles::AliMpFiles()
66 /// Default constructor
69 //______________________________________________________________________________
70 AliMpFiles::AliMpFiles(const AliMpFiles& right)
73 /// Protected copy constructor
75 AliFatalClass("Attempt to copy AliMpFiles singleton.");
79 //______________________________________________________________________________
80 AliMpFiles::~AliMpFiles()
87 //______________________________________________________________________________
88 AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right)
90 /// Assignment operator
92 // check assignment to self
93 if (this == &right) return *this;
95 AliFatalClass("Attempt to assign AliMpFiles singleton.");
104 //______________________________________________________________________________
105 const char* AliMpFiles::GetDefaultTop()
107 const char* top = getenv("MINSTALL");
110 const char* ntop = getenv("ALICE_ROOT");
112 TString dirPath(ntop);
113 dirPath += "/MUON/mapping";
114 return dirPath.Data();
119 //______________________________________________________________________________
120 TString AliMpFiles::PlaneDataDir(AliMpStationType station,
121 AliMpPlaneType plane)
123 /// Returns path to data files with sector description
124 /// for a specified plane.
131 return fgTop + fgkDataDir + StationDataDir(station) + fgkBendingDir;
133 case kNonBendingPlane:
134 return fgTop + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
139 case kStationTrigger:
140 return fgTop + fgkDataDir + StationDataDir(station) + "/";
143 AliFatalClass("Incomplete switch on AliMpPlaneType");
149 //______________________________________________________________________________
150 TString AliMpFiles::StationDataDir(AliMpStationType station)
152 /// Returns the station directory name for the specified station number.
154 TString stationDataDir(fgkStationDir);
165 stationDataDir += "345/";
168 case kStationTrigger:
169 stationDataDir += "Trigger/";
173 stationDataDir += "Invalid/";
176 return stationDataDir;
183 //______________________________________________________________________________
184 TString AliMpFiles::BusPatchFilePath()
186 /// Return path to data file with bus patch mapping.
188 return fgTop + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
191 //______________________________________________________________________________
192 TString AliMpFiles::LocalTriggerBoardMapping()
194 return TString(PlaneDataDir(kStationTrigger,kNonBendingPlane)
195 + fgkTriggerLocalBoards
199 //_____________________________________________________________________________
200 TString AliMpFiles::SlatFilePath(AliMpStationType stationType,
201 const char* slatType,
202 AliMpPlaneType plane)
206 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
207 ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
210 //_____________________________________________________________________________
211 TString AliMpFiles::SlatPCBFilePath(AliMpStationType stationType,
214 /// Get the full path for a given PCB (only relevant to stations 3,
215 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
216 /// we use it to re-use the PlaneDataDir() method untouched.
218 return TString(PlaneDataDir(stationType,kNonBendingPlane) + pcbType +
222 //______________________________________________________________________________
223 TString AliMpFiles::SectorFilePath(AliMpStationType station,
224 AliMpPlaneType plane)
226 /// Return path to data file with sector description.
228 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
231 //______________________________________________________________________________
232 TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station,
233 AliMpPlaneType plane)
235 /// Return path to data file with sector special description (irregular motifs).
237 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
240 //______________________________________________________________________________
241 TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station,
242 AliMpPlaneType plane)
244 /// Returns path to data file with sector special description (irregular motifs).
246 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
249 //______________________________________________________________________________
250 TString AliMpFiles::MotifFilePath(AliMpStationType station,
251 AliMpPlaneType plane,
252 const TString& motifTypeID)
254 /// Returns path to data file for a given motif type.
256 return TString(PlaneDataDir(station, plane)
257 + fgkMotifPrefix + motifTypeID + fgkDataExt);
260 //______________________________________________________________________________
261 TString AliMpFiles::PadPosFilePath(AliMpStationType station,
262 AliMpPlaneType plane,
263 const TString& motifTypeID)
265 /// Returns path to data file with pad positions for a given motif type.
267 return TString(PlaneDataDir(station, plane)
268 + fgkPadPosPrefix + motifTypeID + fgkDataExt);
271 //______________________________________________________________________________
272 TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station,
273 AliMpPlaneType plane,
274 const TString& motifID)
276 /// Returns path to data file with pad dimensions for a given motif ID.
278 return TString(PlaneDataDir(station, plane)
279 + fgkMotifSpecialPrefix + motifID + fgkDataExt);
283 //______________________________________________________________________________
284 TString AliMpFiles::BergToGCFilePath(AliMpStationType station)
286 /// Returns the path of the file which describes the correspondance between
287 /// the berg number and the gassiplex channel.
289 return fgTop + fgkDataDir + StationDataDir(station)
290 + fgkBergToGCFileName + fgkDataExt;
293 //______________________________________________________________________________
295 AliMpFiles::SetTopPath(const TString& topPath)