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.12 2006/05/23 13:09:54 ivana Exp $
20 //-----------------------------------------------------------------------------
23 // Class for generating file names and paths.
25 // zones.dat, zones_special.dat - sector description
26 // motif*.dat - motif description (generated from Exceed)
27 // padPos*.dat - pad positions in motif
29 // Included in AliRoot: 2003/05/02
30 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
31 //-----------------------------------------------------------------------------
33 #include "AliMpFiles.h"
38 #include <Riostream.h>
49 // static data members
51 const TString AliMpFiles::fgkDataDir = "/data";
52 const TString AliMpFiles::fgkStationDir = "/station";
53 const TString AliMpFiles::fgkBendingDir = "/bending_plane/";
54 const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";
55 const TString AliMpFiles::fgkDENames = "denames";
56 const TString AliMpFiles::fgkSector = "zones";
57 const TString AliMpFiles::fgkSectorSpecial = "zones_special";
58 const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
59 const TString AliMpFiles::fgkMotifPrefix = "motif";
60 const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
61 const TString AliMpFiles::fgkManuToSerialDir ="manu_serial/";
62 const TString AliMpFiles::fgkManuToSerial ="_manu";
63 const TString AliMpFiles::fgkPadPosPrefix = "padPos";
64 const TString AliMpFiles::fgkDataExt = ".dat";
65 const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
66 const TString AliMpFiles::fgkTriggerLocalBoards = "RegionalCrate";
67 const TString AliMpFiles::fgkTriggerGlobalBoards = "GlobalCrate";
68 const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
69 const TString AliMpFiles::fgkBusPatchLengthFileName = "BusPatchLength";
70 const TString AliMpFiles::fgkBusPatchSpecialFileName = "BusPatchSpecial";
71 const TString AliMpFiles::fgkSerialToBinFileName = "ManuSerialToBin";
73 //______________________________________________________________________________
74 AliMpFiles::~AliMpFiles()
83 //______________________________________________________________________________
84 TString AliMpFiles::GetTop()
86 /// Return top path to mapping data defined either via MINSTALL
87 /// or ALICE_ROOT environment variable. \n
88 /// If both variables are defined, MINSTALL is used.
90 TString top = getenv("MINSTALL");
91 if ( ! top.IsNull() ) return top;
93 TString ntop = getenv("ALICE_ROOT");
94 if ( ntop.IsNull() ) {
95 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
98 ntop += "/MUON/mapping";
102 //______________________________________________________________________________
103 TString AliMpFiles::PlaneDataDir(AliMp::StationType station,
104 AliMp::PlaneType plane)
106 /// Returns path to data files with sector description
107 /// for a specified plane.
110 case AliMp::kStation1:
111 case AliMp::kStation2:
113 case AliMp::kBendingPlane:
114 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
116 case AliMp::kNonBendingPlane:
117 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
121 case AliMp::kStation345:
122 case AliMp::kStationTrigger:
123 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
126 AliFatalClass("Incomplete switch on AliMp::PlaneType");
132 //______________________________________________________________________________
133 TString AliMpFiles::StationDataDir(AliMp::StationType station)
135 /// Returns the station directory name for the specified station number.
137 TString stationDataDir(fgkStationDir);
139 case AliMp::kStation1:
140 stationDataDir += "1/";
143 case AliMp::kStation2:
144 stationDataDir += "2/";
147 case AliMp::kStation345:
148 stationDataDir += "345/";
151 case AliMp::kStationTrigger:
152 stationDataDir += "Trigger/";
156 stationDataDir += "Invalid/";
159 return stationDataDir;
166 //______________________________________________________________________________
167 TString AliMpFiles::BusPatchFilePath()
169 /// Return path to data file with bus patch mapping.
171 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
174 //______________________________________________________________________________
175 TString AliMpFiles::BusPatchLengthFilePath()
177 /// Return path to data file with bus patch mapping.
179 return GetTop() + fgkDataDir + "/" + fgkBusPatchLengthFileName + fgkDataExt;
182 //______________________________________________________________________________
183 TString AliMpFiles::BusPatchSpecialFilePath()
185 /// Return path to data file with special bus patch mapping.
187 return GetTop() + fgkDataDir + "/" + fgkBusPatchSpecialFileName + fgkDataExt;
190 //______________________________________________________________________________
191 TString AliMpFiles::SerialToBinFilePath()
193 /// Return path to data file containing manu serial numbers with their bin.
195 return GetTop() + fgkDataDir + "/" + fgkSerialToBinFileName + fgkDataExt;
199 //______________________________________________________________________________
200 TString AliMpFiles::DENamesFilePath(AliMp::StationType station)
202 /// Return path to data file with DE names for given station.
204 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
207 //______________________________________________________________________________
208 TString AliMpFiles::LocalTriggerBoardMapping()
210 /// Return path to data file with local trigger board mapping.
212 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
213 + fgkTriggerLocalBoards + fgkDataExt;;
216 //______________________________________________________________________________
217 TString AliMpFiles::GlobalTriggerBoardMapping()
219 /// Return path to data file with local trigger board mapping.
221 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
222 + fgkTriggerGlobalBoards + fgkDataExt;;
225 //_____________________________________________________________________________
226 TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
227 const char* slatType,
228 AliMp::PlaneType plane)
232 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
233 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
236 //_____________________________________________________________________________
237 TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
240 /// Get the full path for a given PCB (only relevant to stations 3,
241 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
242 /// we use it to re-use the PlaneDataDir() method untouched.
244 return TString(PlaneDataDir(stationType,AliMp::kNonBendingPlane) + pcbType +
248 //______________________________________________________________________________
249 TString AliMpFiles::SectorFilePath(AliMp::StationType station,
250 AliMp::PlaneType plane)
252 /// Return path to data file with sector description.
254 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
257 //______________________________________________________________________________
258 TString AliMpFiles::SectorSpecialFilePath(AliMp::StationType station,
259 AliMp::PlaneType plane)
261 /// Return path to data file with sector special description (irregular motifs).
263 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
266 //______________________________________________________________________________
267 TString AliMpFiles::SectorSpecialFilePath2(AliMp::StationType station,
268 AliMp::PlaneType plane)
270 /// Returns path to data file with sector special description (irregular motifs).
272 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
275 //______________________________________________________________________________
276 TString AliMpFiles::MotifFileName(const TString& motifTypeID)
278 /// Returns name of data file for a given motif type.
280 return TString(fgkMotifPrefix + motifTypeID + fgkDataExt);
283 //______________________________________________________________________________
284 TString AliMpFiles::MotifFilePath(AliMp::StationType station,
285 AliMp::PlaneType plane,
286 const TString& motifTypeID)
288 /// Returns path to data file for a given motif type.
290 return TString(PlaneDataDir(station, plane) + MotifFileName(motifTypeID));
293 //______________________________________________________________________________
294 TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
296 /// Returns name of data file with pad positions for a given motif type.
298 return TString(fgkPadPosPrefix + motifTypeID + fgkDataExt);
301 //______________________________________________________________________________
302 TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
303 AliMp::PlaneType plane,
304 const TString& motifTypeID)
306 /// Returns path to data file with pad positions for a given motif type.
308 return TString(PlaneDataDir(station, plane) + PadPosFileName(motifTypeID));
311 //______________________________________________________________________________
312 TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
314 /// Returns name of data file with pad dimensions for a given motif ID.
316 return TString(fgkMotifSpecialPrefix + motifID + fgkDataExt);
320 //______________________________________________________________________________
321 TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
322 AliMp::PlaneType plane,
323 const TString& motifID)
325 /// Returns path to data file with pad dimensions for a given motif ID.
327 return TString(PlaneDataDir(station, plane) + MotifSpecialFileName(motifID));
330 //______________________________________________________________________________
331 TString AliMpFiles::BergToGCFilePath(AliMp::StationType station)
333 /// Returns the path of the file which describes the correspondance between
334 /// the berg number and the gassiplex channel.
336 return GetTop() + fgkDataDir + StationDataDir(station)
337 + fgkBergToGCFileName + fgkDataExt;
340 //______________________________________________________________________________
341 TString AliMpFiles::ManuToSerialPath(const TString& deName, AliMp::StationType station)
343 /// Returns the path of the file for the manu id to their serial number
345 return GetTop() + fgkDataDir + StationDataDir(station)
346 + fgkManuToSerialDir + deName + fgkManuToSerial + fgkDataExt;
350 //______________________________________________________________________________
352 AliMpFiles::SetTopPath(const TString& topPath)
354 /// Set top file path