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 //______________________________________________________________________________
72 AliMpFiles::~AliMpFiles()
81 //______________________________________________________________________________
82 TString AliMpFiles::GetTop()
84 /// Return top path to mapping data defined either via MINSTALL
85 /// or ALICE_ROOT environment variable. \n
86 /// If both variables are defined, MINSTALL is used.
88 TString top = getenv("MINSTALL");
89 if ( ! top.IsNull() ) return top;
91 TString ntop = getenv("ALICE_ROOT");
92 if ( ntop.IsNull() ) {
93 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
96 ntop += "/MUON/mapping";
100 //______________________________________________________________________________
101 TString AliMpFiles::PlaneDataDir(AliMp::StationType station,
102 AliMp::PlaneType plane)
104 /// Returns path to data files with sector description
105 /// for a specified plane.
108 case AliMp::kStation1:
109 case AliMp::kStation2:
111 case AliMp::kBendingPlane:
112 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
114 case AliMp::kNonBendingPlane:
115 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
119 case AliMp::kStation345:
120 case AliMp::kStationTrigger:
121 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
124 AliFatalClass("Incomplete switch on AliMp::PlaneType");
130 //______________________________________________________________________________
131 TString AliMpFiles::StationDataDir(AliMp::StationType station)
133 /// Returns the station directory name for the specified station number.
135 TString stationDataDir(fgkStationDir);
137 case AliMp::kStation1:
138 stationDataDir += "1/";
141 case AliMp::kStation2:
142 stationDataDir += "2/";
145 case AliMp::kStation345:
146 stationDataDir += "345/";
149 case AliMp::kStationTrigger:
150 stationDataDir += "Trigger/";
154 stationDataDir += "Invalid/";
157 return stationDataDir;
164 //______________________________________________________________________________
165 TString AliMpFiles::BusPatchFilePath()
167 /// Return path to data file with bus patch mapping.
169 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
172 //______________________________________________________________________________
173 TString AliMpFiles::BusPatchLengthFilePath()
175 /// Return path to data file with bus patch mapping.
177 return GetTop() + fgkDataDir + "/" + fgkBusPatchLengthFileName + fgkDataExt;
180 //______________________________________________________________________________
181 TString AliMpFiles::BusPatchSpecialFilePath()
183 /// Return path to data file with special bus patch mapping.
185 return GetTop() + fgkDataDir + "/" + fgkBusPatchSpecialFileName + fgkDataExt;
188 //______________________________________________________________________________
189 TString AliMpFiles::DENamesFilePath(AliMp::StationType station)
191 /// Return path to data file with DE names for given station.
193 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
196 //______________________________________________________________________________
197 TString AliMpFiles::LocalTriggerBoardMapping()
199 /// Return path to data file with local trigger board mapping.
201 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
202 + fgkTriggerLocalBoards + fgkDataExt;;
205 //______________________________________________________________________________
206 TString AliMpFiles::GlobalTriggerBoardMapping()
208 /// Return path to data file with local trigger board mapping.
210 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
211 + fgkTriggerGlobalBoards + fgkDataExt;;
214 //_____________________________________________________________________________
215 TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
216 const char* slatType,
217 AliMp::PlaneType plane)
221 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
222 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
225 //_____________________________________________________________________________
226 TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
229 /// Get the full path for a given PCB (only relevant to stations 3,
230 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
231 /// we use it to re-use the PlaneDataDir() method untouched.
233 return TString(PlaneDataDir(stationType,AliMp::kNonBendingPlane) + pcbType +
237 //______________________________________________________________________________
238 TString AliMpFiles::SectorFilePath(AliMp::StationType station,
239 AliMp::PlaneType plane)
241 /// Return path to data file with sector description.
243 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
246 //______________________________________________________________________________
247 TString AliMpFiles::SectorSpecialFilePath(AliMp::StationType station,
248 AliMp::PlaneType plane)
250 /// Return path to data file with sector special description (irregular motifs).
252 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
255 //______________________________________________________________________________
256 TString AliMpFiles::SectorSpecialFilePath2(AliMp::StationType station,
257 AliMp::PlaneType plane)
259 /// Returns path to data file with sector special description (irregular motifs).
261 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
264 //______________________________________________________________________________
265 TString AliMpFiles::MotifFileName(const TString& motifTypeID)
267 /// Returns name of data file for a given motif type.
269 return TString(fgkMotifPrefix + motifTypeID + fgkDataExt);
272 //______________________________________________________________________________
273 TString AliMpFiles::MotifFilePath(AliMp::StationType station,
274 AliMp::PlaneType plane,
275 const TString& motifTypeID)
277 /// Returns path to data file for a given motif type.
279 return TString(PlaneDataDir(station, plane) + MotifFileName(motifTypeID));
282 //______________________________________________________________________________
283 TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
285 /// Returns name of data file with pad positions for a given motif type.
287 return TString(fgkPadPosPrefix + motifTypeID + fgkDataExt);
290 //______________________________________________________________________________
291 TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
292 AliMp::PlaneType plane,
293 const TString& motifTypeID)
295 /// Returns path to data file with pad positions for a given motif type.
297 return TString(PlaneDataDir(station, plane) + PadPosFileName(motifTypeID));
300 //______________________________________________________________________________
301 TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
303 /// Returns name of data file with pad dimensions for a given motif ID.
305 return TString(fgkMotifSpecialPrefix + motifID + fgkDataExt);
309 //______________________________________________________________________________
310 TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
311 AliMp::PlaneType plane,
312 const TString& motifID)
314 /// Returns path to data file with pad dimensions for a given motif ID.
316 return TString(PlaneDataDir(station, plane) + MotifSpecialFileName(motifID));
319 //______________________________________________________________________________
320 TString AliMpFiles::BergToGCFilePath(AliMp::StationType station)
322 /// Returns the path of the file which describes the correspondance between
323 /// the berg number and the gassiplex channel.
325 return GetTop() + fgkDataDir + StationDataDir(station)
326 + fgkBergToGCFileName + fgkDataExt;
329 //______________________________________________________________________________
330 TString AliMpFiles::ManuToSerialPath(const TString& deName, AliMp::StationType station)
332 /// Returns the path of the file for the manu id to their serial number
334 return GetTop() + fgkDataDir + StationDataDir(station)
335 + fgkManuToSerialDir + deName + fgkManuToSerial + fgkDataExt;
339 //______________________________________________________________________________
341 AliMpFiles::SetTopPath(const TString& topPath)
343 /// Set top file path