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::fgkBusPatchInfoFileName = "BusPatchInfo";
70 const TString AliMpFiles::fgkBusPatchSpecialFileName = "BusPatchSpecial";
71 const TString AliMpFiles::fgkSerialToBinFileName = "ManuSerialToBin";
73 //______________________________________________________________________________
74 AliMpFiles::~AliMpFiles()
83 //______________________________________________________________________________
84 TString AliMpFiles::PlaneDataDir(AliMp::StationType station,
85 AliMp::PlaneType plane)
87 /// Returns path to data files with sector description
88 /// for a specified plane.
91 case AliMp::kStation1:
92 case AliMp::kStation2:
94 case AliMp::kBendingPlane:
95 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
97 case AliMp::kNonBendingPlane:
98 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
102 case AliMp::kStation345:
103 case AliMp::kStationTrigger:
104 return GetTop() + fgkDataDir + StationDataDir(station);
107 AliFatalClass("Incomplete switch on AliMp::PlaneType");
113 //______________________________________________________________________________
114 TString AliMpFiles::StationDataDir(AliMp::StationType station)
116 /// Returns the station directory name for the specified station number.
118 TString stationDataDir(fgkStationDir);
120 case AliMp::kStation1:
121 stationDataDir += "1/";
124 case AliMp::kStation2:
125 stationDataDir += "2/";
128 case AliMp::kStation345:
129 stationDataDir += "345/";
132 case AliMp::kStationTrigger:
133 stationDataDir += "Trigger/";
137 stationDataDir += "Invalid/";
140 return stationDataDir;
147 //______________________________________________________________________________
148 TString AliMpFiles::BusPatchFilePath()
150 /// Return path to data file with bus patch mapping.
152 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
155 //______________________________________________________________________________
156 TString AliMpFiles::BusPatchInfoFilePath()
158 /// Return path to data file with bus patch mapping.
160 return GetTop() + fgkDataDir + "/" + fgkBusPatchInfoFileName + fgkDataExt;
163 //______________________________________________________________________________
164 TString AliMpFiles::BusPatchSpecialFilePath()
166 /// Return path to data file with special bus patch mapping.
168 return GetTop() + fgkDataDir + "/" + fgkBusPatchSpecialFileName + fgkDataExt;
171 //______________________________________________________________________________
172 TString AliMpFiles::SerialToBinFilePath()
174 /// Return path to data file containing manu serial numbers with their bin.
176 return GetTop() + fgkDataDir + "/" + fgkSerialToBinFileName + fgkDataExt;
180 //______________________________________________________________________________
181 TString AliMpFiles::DENamesFilePath(AliMp::StationType station)
183 /// Return path to data file with DE names for given station.
185 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
188 //______________________________________________________________________________
189 TString AliMpFiles::LocalTriggerBoardMapping()
191 /// Return path to data file with local trigger board mapping.
193 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
194 + fgkTriggerLocalBoards + fgkDataExt;;
197 //______________________________________________________________________________
198 TString AliMpFiles::GlobalTriggerBoardMapping()
200 /// Return path to data file with local trigger board mapping.
202 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
203 + fgkTriggerGlobalBoards + fgkDataExt;;
206 //_____________________________________________________________________________
207 TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
208 const char* slatType,
209 AliMp::PlaneType plane)
213 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
214 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
217 //_____________________________________________________________________________
218 TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
221 /// Get the full path for a given PCB (only relevant to stations 3,
222 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
223 /// we use it to re-use the PlaneDataDir() method untouched.
225 return TString(PlaneDataDir(stationType,AliMp::kNonBendingPlane) + pcbType +
229 //______________________________________________________________________________
230 TString AliMpFiles::SectorFilePath(AliMp::StationType station,
231 AliMp::PlaneType plane)
233 /// Return path to data file with sector description.
235 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
238 //______________________________________________________________________________
239 TString AliMpFiles::SectorSpecialFilePath(AliMp::StationType station,
240 AliMp::PlaneType plane)
242 /// Return path to data file with sector special description (irregular motifs).
244 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
247 //______________________________________________________________________________
248 TString AliMpFiles::SectorSpecialFilePath2(AliMp::StationType station,
249 AliMp::PlaneType plane)
251 /// Returns path to data file with sector special description (irregular motifs).
253 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
256 //______________________________________________________________________________
257 TString AliMpFiles::MotifFileName(const TString& motifTypeID)
259 /// Returns name of data file for a given motif type.
261 return TString(fgkMotifPrefix + motifTypeID + fgkDataExt);
264 //______________________________________________________________________________
265 TString AliMpFiles::MotifFilePath(AliMp::StationType station,
266 AliMp::PlaneType plane,
267 const TString& motifTypeID)
269 /// Returns path to data file for a given motif type.
271 return TString(PlaneDataDir(station, plane) + MotifFileName(motifTypeID));
274 //______________________________________________________________________________
275 TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
277 /// Returns name of data file with pad positions for a given motif type.
279 return TString(fgkPadPosPrefix + motifTypeID + fgkDataExt);
282 //______________________________________________________________________________
283 TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
284 AliMp::PlaneType plane,
285 const TString& motifTypeID)
287 /// Returns path to data file with pad positions for a given motif type.
289 return TString(PlaneDataDir(station, plane) + PadPosFileName(motifTypeID));
292 //______________________________________________________________________________
293 TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
295 /// Returns name of data file with pad dimensions for a given motif ID.
297 return TString(fgkMotifSpecialPrefix + motifID + fgkDataExt);
301 //______________________________________________________________________________
302 TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
303 AliMp::PlaneType plane,
304 const TString& motifID)
306 /// Returns path to data file with pad dimensions for a given motif ID.
308 return TString(PlaneDataDir(station, plane) + MotifSpecialFileName(motifID));
311 //______________________________________________________________________________
312 TString AliMpFiles::BergToGCFilePath(AliMp::StationType station)
314 /// Returns the path of the file which describes the correspondance between
315 /// the berg number and the gassiplex channel.
317 return GetTop() + fgkDataDir + StationDataDir(station)
318 + fgkBergToGCFileName + fgkDataExt;
321 //______________________________________________________________________________
322 TString AliMpFiles::ManuToSerialPath(const TString& deName, AliMp::StationType station)
324 /// Returns the path of the file for the manu id to their serial number
326 return GetTop() + fgkDataDir + StationDataDir(station)
327 + fgkManuToSerialDir + deName + fgkManuToSerial + fgkDataExt;
331 //______________________________________________________________________________
333 AliMpFiles::SetTopPath(const TString& topPath)
335 /// Set top file path
340 //______________________________________________________________________________
341 TString AliMpFiles::GetTop()
343 /// Return top path to mapping data defined either via MINSTALL
344 /// or ALICE_ROOT environment variable. \n
345 /// If both variables are defined, MINSTALL is used.
347 TString top = getenv("MINSTALL");
348 if ( ! top.IsNull() ) return top;
350 TString ntop = getenv("ALICE_ROOT");
351 if ( ntop.IsNull() ) {
352 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
355 ntop += "/MUON/mapping";