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";
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::DENamesFilePath(AliMp::StationType station)
171 /// Return path to data file with DE names for given station.
173 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
176 //______________________________________________________________________________
177 TString AliMpFiles::LocalTriggerBoardMapping()
179 /// Return path to data file with local trigger board mapping.
181 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
182 + fgkTriggerLocalBoards + fgkDataExt;;
185 //_____________________________________________________________________________
186 TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
187 const char* slatType,
188 AliMp::PlaneType plane)
192 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
193 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
196 //_____________________________________________________________________________
197 TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
200 /// Get the full path for a given PCB (only relevant to stations 3,
201 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
202 /// we use it to re-use the PlaneDataDir() method untouched.
204 return TString(PlaneDataDir(stationType,AliMp::kNonBendingPlane) + pcbType +
208 //______________________________________________________________________________
209 TString AliMpFiles::SectorFilePath(AliMp::StationType station,
210 AliMp::PlaneType plane)
212 /// Return path to data file with sector description.
214 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
217 //______________________________________________________________________________
218 TString AliMpFiles::SectorSpecialFilePath(AliMp::StationType station,
219 AliMp::PlaneType plane)
221 /// Return path to data file with sector special description (irregular motifs).
223 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
226 //______________________________________________________________________________
227 TString AliMpFiles::SectorSpecialFilePath2(AliMp::StationType station,
228 AliMp::PlaneType plane)
230 /// Returns path to data file with sector special description (irregular motifs).
232 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
235 //______________________________________________________________________________
236 TString AliMpFiles::MotifFileName(const TString& motifTypeID)
238 /// Returns name of data file for a given motif type.
240 return TString(fgkMotifPrefix + motifTypeID + fgkDataExt);
243 //______________________________________________________________________________
244 TString AliMpFiles::MotifFilePath(AliMp::StationType station,
245 AliMp::PlaneType plane,
246 const TString& motifTypeID)
248 /// Returns path to data file for a given motif type.
250 return TString(PlaneDataDir(station, plane) + MotifFileName(motifTypeID));
253 //______________________________________________________________________________
254 TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
256 /// Returns name of data file with pad positions for a given motif type.
258 return TString(fgkPadPosPrefix + motifTypeID + fgkDataExt);
261 //______________________________________________________________________________
262 TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
263 AliMp::PlaneType plane,
264 const TString& motifTypeID)
266 /// Returns path to data file with pad positions for a given motif type.
268 return TString(PlaneDataDir(station, plane) + PadPosFileName(motifTypeID));
271 //______________________________________________________________________________
272 TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
274 /// Returns name of data file with pad dimensions for a given motif ID.
276 return TString(fgkMotifSpecialPrefix + motifID + fgkDataExt);
280 //______________________________________________________________________________
281 TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
282 AliMp::PlaneType 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) + MotifSpecialFileName(motifID));
290 //______________________________________________________________________________
291 TString AliMpFiles::BergToGCFilePath(AliMp::StationType station)
293 /// Returns the path of the file which describes the correspondance between
294 /// the berg number and the gassiplex channel.
296 return GetTop() + fgkDataDir + StationDataDir(station)
297 + fgkBergToGCFileName + fgkDataExt;
300 //______________________________________________________________________________
301 TString AliMpFiles::ManuToSerialPath(const TString& deName, AliMp::StationType station)
303 /// Returns the path of the file for the manu id to their serial number
305 return GetTop() + fgkDataDir + StationDataDir(station)
306 + fgkManuToSerialDir + deName + fgkManuToSerial + fgkDataExt;
310 //______________________________________________________________________________
312 AliMpFiles::SetTopPath(const TString& topPath)