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.6 2006/01/11 10:05:08 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::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";
61 TString AliMpFiles::fgTop = AliMpFiles::fgkDefaultTop;
63 //______________________________________________________________________________
64 AliMpFiles::AliMpFiles()
67 /// Default constructor
70 //______________________________________________________________________________
71 AliMpFiles::AliMpFiles(const AliMpFiles& right)
74 /// Protected copy constructor
76 AliFatalClass("Attempt to copy AliMpFiles singleton.");
80 //______________________________________________________________________________
81 AliMpFiles::~AliMpFiles()
88 //______________________________________________________________________________
89 AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right)
91 /// Assignment operator
93 // check assignment to self
94 if (this == &right) return *this;
96 AliFatalClass("Attempt to assign AliMpFiles singleton.");
105 //______________________________________________________________________________
106 const char* AliMpFiles::GetDefaultTop()
108 const char* top = getenv("MINSTALL");
111 const char* ntop = getenv("ALICE_ROOT");
113 TString dirPath(ntop);
114 dirPath += "/MUON/mapping";
115 return dirPath.Data();
120 //______________________________________________________________________________
121 TString AliMpFiles::PlaneDataDir(AliMpStationType station,
122 AliMpPlaneType plane)
124 /// Returns path to data files with sector description
125 /// for a specified plane.
132 return fgTop + fgkDataDir + StationDataDir(station) + fgkBendingDir;
134 case kNonBendingPlane:
135 return fgTop + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
140 case kStationTrigger:
141 return fgTop + fgkDataDir + StationDataDir(station) + "/";
144 AliFatalClass("Incomplete switch on AliMpPlaneType");
150 //______________________________________________________________________________
151 TString AliMpFiles::StationDataDir(AliMpStationType station)
153 /// Returns the station directory name for the specified station number.
155 TString stationDataDir(fgkStationDir);
158 stationDataDir += "1/";
162 stationDataDir += "2/";
166 stationDataDir += "345/";
169 case kStationTrigger:
170 stationDataDir += "Trigger/";
174 stationDataDir += "Invalid/";
177 return stationDataDir;
184 //______________________________________________________________________________
185 TString AliMpFiles::BusPatchFilePath()
187 /// Return path to data file with bus patch mapping.
189 return fgTop + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
192 //______________________________________________________________________________
193 TString AliMpFiles::DENamesFilePath(AliMpStationType station)
195 /// Return path to data file with DE names for given station.
197 return fgTop + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
200 //______________________________________________________________________________
201 TString AliMpFiles::LocalTriggerBoardMapping()
203 return TString(PlaneDataDir(kStationTrigger,kNonBendingPlane)
204 + fgkTriggerLocalBoards
208 //_____________________________________________________________________________
209 TString AliMpFiles::SlatFilePath(AliMpStationType stationType,
210 const char* slatType,
211 AliMpPlaneType plane)
215 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
216 ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
219 //_____________________________________________________________________________
220 TString AliMpFiles::SlatPCBFilePath(AliMpStationType stationType,
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.
227 return TString(PlaneDataDir(stationType,kNonBendingPlane) + pcbType +
231 //______________________________________________________________________________
232 TString AliMpFiles::SectorFilePath(AliMpStationType station,
233 AliMpPlaneType plane)
235 /// Return path to data file with sector description.
237 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
240 //______________________________________________________________________________
241 TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station,
242 AliMpPlaneType plane)
244 /// Return path to data file with sector special description (irregular motifs).
246 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
249 //______________________________________________________________________________
250 TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station,
251 AliMpPlaneType plane)
253 /// Returns path to data file with sector special description (irregular motifs).
255 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
258 //______________________________________________________________________________
259 TString AliMpFiles::MotifFilePath(AliMpStationType station,
260 AliMpPlaneType plane,
261 const TString& motifTypeID)
263 /// Returns path to data file for a given motif type.
265 return TString(PlaneDataDir(station, plane)
266 + fgkMotifPrefix + motifTypeID + fgkDataExt);
269 //______________________________________________________________________________
270 TString AliMpFiles::PadPosFilePath(AliMpStationType station,
271 AliMpPlaneType plane,
272 const TString& motifTypeID)
274 /// Returns path to data file with pad positions for a given motif type.
276 return TString(PlaneDataDir(station, plane)
277 + fgkPadPosPrefix + motifTypeID + fgkDataExt);
280 //______________________________________________________________________________
281 TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station,
282 AliMpPlaneType plane,
283 const TString& motifID)
285 /// Returns path to data file with pad dimensions for a given motif ID.
287 return TString(PlaneDataDir(station, plane)
288 + fgkMotifSpecialPrefix + motifID + fgkDataExt);
292 //______________________________________________________________________________
293 TString AliMpFiles::BergToGCFilePath(AliMpStationType station)
295 /// Returns the path of the file which describes the correspondance between
296 /// the berg number and the gassiplex channel.
298 return fgTop + fgkDataDir + StationDataDir(station)
299 + fgkBergToGCFileName + fgkDataExt;
302 //______________________________________________________________________________
304 AliMpFiles::SetTopPath(const TString& topPath)