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"
37 // static data members
39 AliMpFiles* AliMpFiles::fgInstance = 0;
40 const TString AliMpFiles::fgkDefaultTop = getenv("MINSTALL");
41 const TString AliMpFiles::fgkDataDir = "/data";
42 const TString AliMpFiles::fgkStationDir = "/station";
43 const TString AliMpFiles::fgkBendingDir = "/bending_plane/";
44 const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";
45 const TString AliMpFiles::fgkSector = "zones";
46 const TString AliMpFiles::fgkSectorSpecial = "zones_special";
47 const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
48 const TString AliMpFiles::fgkMotifPrefix = "motif";
49 const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
50 const TString AliMpFiles::fgkPadPosPrefix = "padPos";
51 const TString AliMpFiles::fgkDataExt = ".dat";
52 const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
54 //______________________________________________________________________________
55 AliMpFiles::AliMpFiles()
59 /// Default constructor
63 "AliMpFiles: attempt to create two instances of singleton.");
69 //______________________________________________________________________________
70 AliMpFiles::AliMpFiles(const AliMpFiles& right)
73 /// Protected copy constructor
75 Fatal("AliMpFiles", "Attempt to copy AliMpFiles singleton.");
79 //______________________________________________________________________________
80 AliMpFiles::~AliMpFiles()
89 //______________________________________________________________________________
90 AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right)
92 /// Assignment operator
94 // check assignment to self
95 if (this == &right) return *this;
97 Fatal("operator=", "Attempt to assign AliMpFiles singleton.");
106 //______________________________________________________________________________
107 TString AliMpFiles::PlaneDataDir(AliMpStationType station,
108 AliMpPlaneType plane) const
110 /// Returns path to data files with sector description
111 /// for a specified plane.
118 return fTop + fgkDataDir + StationDataDir(station) + fgkBendingDir;
120 case kNonBendingPlane:
121 return fTop + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
126 return fTop + fgkDataDir + StationDataDir(station) + "/";
130 Fatal("PlaneDataDir", "Incomplete switch on AliMpPlaneType");
134 //______________________________________________________________________________
135 TString AliMpFiles::StationDataDir(AliMpStationType station) const
137 /// Returns the station directory name for the specified station number.
139 TString stationDataDir(fgkStationDir);
150 stationDataDir += "345/";
154 return stationDataDir;
161 //______________________________________________________________________________
162 AliMpFiles* AliMpFiles::Instance()
164 /// Return the singleton instance;
165 /// Creates it if it does not yet exist,
167 if (!fgInstance) fgInstance = new AliMpFiles();
173 //_____________________________________________________________________________
174 TString AliMpFiles::SlatFilePath(const char* slatType,
175 AliMpPlaneType plane) const
179 return TString(PlaneDataDir(kStation345,plane) + slatType + "." +
180 ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
183 //_____________________________________________________________________________
184 TString AliMpFiles::SlatPCBFilePath(const char* pcbType) const
186 /// Get the full path for a given PCB (only relevant to stations 3,
187 /// 4 and 5). The bending parameter below is of no use in this case, but
188 /// we use it to re-use the PlaneDataDir() method untouched.
190 return TString(PlaneDataDir(kStation345,kNonBendingPlane) + pcbType +
194 //_____________________________________________________________________________
196 AliMpFiles::DetElemIdToSlatTypeFilePath() const
198 /// Get the full path of the file containing the mapping detElemId <->
200 /// The bending parameter below is of no use in this case, but
201 /// we use it to re-use the PlaneDataDir() method untouched.
203 return TString(PlaneDataDir(kStation345,kNonBendingPlane) +
204 "DetElemIdToSlatType.dat");
206 //______________________________________________________________________________
207 TString AliMpFiles::SectorFilePath(AliMpStationType station,
208 AliMpPlaneType plane) const
210 /// Return path to data file with sector description.
212 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
215 //______________________________________________________________________________
216 TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station,
217 AliMpPlaneType plane) const
219 /// Return path to data file with sector special description (irregular motifs).
221 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
224 //______________________________________________________________________________
225 TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station,
226 AliMpPlaneType plane) const
228 /// Returns path to data file with sector special description (irregular motifs).
230 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
233 //______________________________________________________________________________
234 TString AliMpFiles::MotifFilePath(AliMpStationType station,
235 AliMpPlaneType plane,
236 const TString& motifTypeID) const
238 /// Returns path to data file for a given motif type.
240 return TString(PlaneDataDir(station, plane)
241 + fgkMotifPrefix + motifTypeID + fgkDataExt);
244 //______________________________________________________________________________
245 TString AliMpFiles::PadPosFilePath(AliMpStationType station,
246 AliMpPlaneType plane,
247 const TString& motifTypeID) const
249 /// Returns path to data file with pad positions for a given motif type.
251 return TString(PlaneDataDir(station, plane)
252 + fgkPadPosPrefix + motifTypeID + fgkDataExt);
255 //______________________________________________________________________________
256 TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station,
257 AliMpPlaneType plane,
258 const TString& motifID) const
260 /// Returns path to data file with pad dimensions for a given motif ID.
262 return TString(PlaneDataDir(station, plane)
263 + fgkMotifSpecialPrefix + motifID + fgkDataExt);
267 //______________________________________________________________________________
268 TString AliMpFiles::BergToGCFilePath(AliMpStationType station) const
270 /// Returns the path of the file which describes the correspondance between
271 /// the berg number and the gassiplex channel.
273 return fTop + fgkDataDir + StationDataDir(station)
274 + fgkBergToGCFileName + fgkDataExt;