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 $
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
31 #include "AliMpFiles.h"
36 #include <Riostream.h>
47 // static data members
49 const TString AliMpFiles::fgkDataDir = "/data";
50 const TString AliMpFiles::fgkStationDir = "/station";
51 const TString AliMpFiles::fgkBendingDir = "/bending_plane/";
52 const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";
53 const TString AliMpFiles::fgkDENames = "denames";
54 const TString AliMpFiles::fgkSector = "zones";
55 const TString AliMpFiles::fgkSectorSpecial = "zones_special";
56 const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
57 const TString AliMpFiles::fgkMotifPrefix = "motif";
58 const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
59 const TString AliMpFiles::fgkManuToSerialDir ="manu_serial/";
60 const TString AliMpFiles::fgkManuToSerial ="_manu";
61 const TString AliMpFiles::fgkPadPosPrefix = "padPos";
62 const TString AliMpFiles::fgkDataExt = ".dat";
63 const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
64 const TString AliMpFiles::fgkTriggerLocalBoards = "crate";
65 const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
66 const TString AliMpFiles::fgkBusPatchLengthFileName = "BusPatchLength";
67 //______________________________________________________________________________
68 AliMpFiles::~AliMpFiles()
77 //______________________________________________________________________________
78 TString AliMpFiles::GetTop()
80 /// Return top path to mapping data defined either via MINSTALL
81 /// or ALICE_ROOT environment variable. \n
82 /// If both variables are defined, MINSTALL is used.
84 TString top = getenv("MINSTALL");
85 if ( ! top.IsNull() ) return top;
87 TString ntop = getenv("ALICE_ROOT");
88 if ( ntop.IsNull() ) {
89 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
92 ntop += "/MUON/mapping";
96 //______________________________________________________________________________
97 TString AliMpFiles::PlaneDataDir(AliMp::StationType station,
98 AliMp::PlaneType plane)
100 /// Returns path to data files with sector description
101 /// for a specified plane.
104 case AliMp::kStation1:
105 case AliMp::kStation2:
107 case AliMp::kBendingPlane:
108 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
110 case AliMp::kNonBendingPlane:
111 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
115 case AliMp::kStation345:
116 case AliMp::kStationTrigger:
117 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
120 AliFatalClass("Incomplete switch on AliMp::PlaneType");
126 //______________________________________________________________________________
127 TString AliMpFiles::StationDataDir(AliMp::StationType station)
129 /// Returns the station directory name for the specified station number.
131 TString stationDataDir(fgkStationDir);
133 case AliMp::kStation1:
134 stationDataDir += "1/";
137 case AliMp::kStation2:
138 stationDataDir += "2/";
141 case AliMp::kStation345:
142 stationDataDir += "345/";
145 case AliMp::kStationTrigger:
146 stationDataDir += "Trigger/";
150 stationDataDir += "Invalid/";
153 return stationDataDir;
160 //______________________________________________________________________________
161 TString AliMpFiles::BusPatchFilePath()
163 /// Return path to data file with bus patch mapping.
165 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
168 //______________________________________________________________________________
169 TString AliMpFiles::BusPatchLengthFilePath()
171 /// Return path to data file with bus patch mapping.
173 return GetTop() + fgkDataDir + "/" + fgkBusPatchLengthFileName + fgkDataExt;
176 //______________________________________________________________________________
177 TString AliMpFiles::DENamesFilePath(AliMp::StationType station)
179 /// Return path to data file with DE names for given station.
181 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
184 //______________________________________________________________________________
185 TString AliMpFiles::LocalTriggerBoardMapping()
187 /// Return path to data file with local trigger board mapping.
189 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
190 + fgkTriggerLocalBoards + fgkDataExt;;
193 //_____________________________________________________________________________
194 TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
195 const char* slatType,
196 AliMp::PlaneType plane)
200 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
201 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
204 //_____________________________________________________________________________
205 TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
208 /// Get the full path for a given PCB (only relevant to stations 3,
209 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
210 /// we use it to re-use the PlaneDataDir() method untouched.
212 return TString(PlaneDataDir(stationType,AliMp::kNonBendingPlane) + pcbType +
216 //______________________________________________________________________________
217 TString AliMpFiles::SectorFilePath(AliMp::StationType station,
218 AliMp::PlaneType plane)
220 /// Return path to data file with sector description.
222 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
225 //______________________________________________________________________________
226 TString AliMpFiles::SectorSpecialFilePath(AliMp::StationType station,
227 AliMp::PlaneType plane)
229 /// Return path to data file with sector special description (irregular motifs).
231 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
234 //______________________________________________________________________________
235 TString AliMpFiles::SectorSpecialFilePath2(AliMp::StationType station,
236 AliMp::PlaneType plane)
238 /// Returns path to data file with sector special description (irregular motifs).
240 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
243 //______________________________________________________________________________
244 TString AliMpFiles::MotifFileName(const TString& motifTypeID)
246 /// Returns name of data file for a given motif type.
248 return TString(fgkMotifPrefix + motifTypeID + fgkDataExt);
251 //______________________________________________________________________________
252 TString AliMpFiles::MotifFilePath(AliMp::StationType station,
253 AliMp::PlaneType plane,
254 const TString& motifTypeID)
256 /// Returns path to data file for a given motif type.
258 return TString(PlaneDataDir(station, plane) + MotifFileName(motifTypeID));
261 //______________________________________________________________________________
262 TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
264 /// Returns name of data file with pad positions for a given motif type.
266 return TString(fgkPadPosPrefix + motifTypeID + fgkDataExt);
269 //______________________________________________________________________________
270 TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
271 AliMp::PlaneType 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) + PadPosFileName(motifTypeID));
279 //______________________________________________________________________________
280 TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
282 /// Returns name of data file with pad dimensions for a given motif ID.
284 return TString(fgkMotifSpecialPrefix + motifID + fgkDataExt);
288 //______________________________________________________________________________
289 TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
290 AliMp::PlaneType plane,
291 const TString& motifID)
293 /// Returns path to data file with pad dimensions for a given motif ID.
295 return TString(PlaneDataDir(station, plane) + MotifSpecialFileName(motifID));
298 //______________________________________________________________________________
299 TString AliMpFiles::BergToGCFilePath(AliMp::StationType station)
301 /// Returns the path of the file which describes the correspondance between
302 /// the berg number and the gassiplex channel.
304 return GetTop() + fgkDataDir + StationDataDir(station)
305 + fgkBergToGCFileName + fgkDataExt;
308 //______________________________________________________________________________
309 TString AliMpFiles::ManuToSerialPath(const TString& deName, AliMp::StationType station)
311 /// Returns the path of the file for the manu id to their serial number
313 return GetTop() + fgkDataDir + StationDataDir(station)
314 + fgkManuToSerialDir + deName + fgkManuToSerial + fgkDataExt;
318 //______________________________________________________________________________
320 AliMpFiles::SetTopPath(const TString& topPath)
322 /// Set top file path