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::fgkDataRunDir = "/data_run";
53 const TString AliMpFiles::fgkStationDir = "/station";
54 const TString AliMpFiles::fgkBendingDir = "bending_plane/";
55 const TString AliMpFiles::fgkNonBendingDir = "non-bending_plane/";
56 const TString AliMpFiles::fgkDENames = "denames";
57 const TString AliMpFiles::fgkSector = "zones";
58 const TString AliMpFiles::fgkSectorSpecial = "zones_special";
59 const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
60 const TString AliMpFiles::fgkMotifPrefix = "motif";
61 const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
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 AliMq::Station12Type station12Type,
86 AliMp::PlaneType plane)
88 /// Returns path to data files with sector description
89 /// for a specified plane.
92 case AliMp::kStation12:
94 case AliMp::kBendingPlane:
95 return GetTop() + fgkDataDir + StationDataDir(station, station12Type) + fgkBendingDir;
97 case AliMp::kNonBendingPlane:
98 return GetTop() + fgkDataDir + StationDataDir(station, station12Type) + fgkNonBendingDir;
102 case AliMp::kStation345:
103 case AliMp::kStationTrigger:
104 return GetTop() + fgkDataDir + StationDataDir(station, AliMq::kNotSt12);
107 AliFatalClass("Incomplete switch on AliMp::PlaneType");
113 //______________________________________________________________________________
114 TString AliMpFiles::StationDataDir(AliMp::StationType station,
115 AliMq::Station12Type station12Type)
117 /// Returns the station directory name for the specified station number.
119 TString stationDataDir(fgkStationDir);
121 case AliMp::kStation12:
122 switch (station12Type) {
123 case AliMq::kStation1:
124 stationDataDir += "1/";
127 case AliMq::kStation2:
128 stationDataDir += "2/";
131 case AliMq::kNotSt12:
132 AliFatalClass("Incorrect switch on AliMq::Station12Type");
137 case AliMp::kStation345:
138 stationDataDir += "345/";
141 case AliMp::kStationTrigger:
142 stationDataDir += "Trigger/";
146 stationDataDir += "Invalid/";
149 return stationDataDir;
152 //______________________________________________________________________________
153 TString AliMpFiles::BusPatchFilePath()
155 /// Return path to data file with bus patch mapping.
157 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
160 //______________________________________________________________________________
161 TString AliMpFiles::BusPatchInfoFilePath()
163 /// Return path to data file with bus patch mapping.
165 return GetTop() + fgkDataDir + "/" + fgkBusPatchInfoFileName + fgkDataExt;
168 //______________________________________________________________________________
169 TString AliMpFiles::BusPatchSpecialFilePath()
171 /// Return path to data file with special bus patch mapping.
173 return GetTop() + fgkDataDir + "/" + fgkBusPatchSpecialFileName + fgkDataExt;
176 //______________________________________________________________________________
177 TString AliMpFiles::SerialToBinFilePath()
179 /// Return path to data file containing manu serial numbers with their bin.
181 return GetTop() + fgkDataDir + "/" + fgkSerialToBinFileName + fgkDataExt;
185 //______________________________________________________________________________
186 TString AliMpFiles::DENamesFilePath(AliMp::StationType station,
187 AliMq::Station12Type station12Type)
189 /// Return path to data file with DE names for given station.
191 return GetTop() + fgkDataDir + StationDataDir(station, station12Type)
192 + fgkDENames + fgkDataExt;
195 //______________________________________________________________________________
196 TString AliMpFiles::LocalTriggerBoardMapping()
198 /// Return path to data file with local trigger board mapping.
200 return GetTop() + fgkDataDir
201 + StationDataDir(AliMp::kStationTrigger, AliMq::kNotSt12)
202 + fgkTriggerLocalBoards + fgkDataExt;;
205 //______________________________________________________________________________
206 TString AliMpFiles::GlobalTriggerBoardMapping()
208 /// Return path to data file with local trigger board mapping.
210 return GetTop() + fgkDataDir
211 + StationDataDir(AliMp::kStationTrigger, AliMq::kNotSt12)
212 + fgkTriggerGlobalBoards + fgkDataExt;;
215 //_____________________________________________________________________________
216 TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
217 const char* slatType,
218 AliMp::PlaneType plane)
222 return TString(PlaneDataDir(stationType, AliMq::kNotSt12, plane)
224 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
227 //_____________________________________________________________________________
228 TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
231 /// Get the full path for a given PCB (only relevant to stations 3,
232 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
233 /// we use it to re-use the PlaneDataDir() method untouched.
235 return TString(PlaneDataDir(stationType, AliMq::kNotSt12, AliMp::kNonBendingPlane)
239 //______________________________________________________________________________
240 TString AliMpFiles::SectorFilePath(AliMq::Station12Type station12Type,
241 AliMp::PlaneType plane)
243 /// Return path to data file with sector description.
245 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
246 + fgkSector + fgkDataExt);
249 //______________________________________________________________________________
250 TString AliMpFiles::SectorSpecialFilePath(AliMq::Station12Type station12Type,
251 AliMp::PlaneType plane)
253 /// Return path to data file with sector special description (irregular motifs).
255 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
256 + fgkSectorSpecial + fgkDataExt);
259 //______________________________________________________________________________
260 TString AliMpFiles::SectorSpecialFilePath2(AliMq::Station12Type station12Type,
261 AliMp::PlaneType plane)
263 /// Returns path to data file with sector special description (irregular motifs).
265 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
266 + fgkSectorSpecial2 + fgkDataExt);
269 //______________________________________________________________________________
270 TString AliMpFiles::MotifFileName(const TString& motifTypeID)
272 /// Returns name of data file for a given motif type.
274 return TString(fgkMotifPrefix + motifTypeID + fgkDataExt);
277 //______________________________________________________________________________
278 TString AliMpFiles::MotifFilePath(AliMp::StationType station,
279 AliMq::Station12Type station12Type,
280 AliMp::PlaneType plane,
281 const TString& motifTypeID)
283 /// Returns path to data file for a given motif type.
285 return TString(PlaneDataDir(station, station12Type, plane)
286 + MotifFileName(motifTypeID));
289 //______________________________________________________________________________
290 TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
292 /// Returns name of data file with pad positions for a given motif type.
294 return TString(fgkPadPosPrefix + motifTypeID + fgkDataExt);
297 //______________________________________________________________________________
298 TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
299 AliMq::Station12Type station12Type,
300 AliMp::PlaneType plane,
301 const TString& motifTypeID)
303 /// Returns path to data file with pad positions for a given motif type.
305 return TString(PlaneDataDir(station, station12Type, plane)
306 + PadPosFileName(motifTypeID));
309 //______________________________________________________________________________
310 TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
312 /// Returns name of data file with pad dimensions for a given motif ID.
314 return TString(fgkMotifSpecialPrefix + motifID + fgkDataExt);
318 //______________________________________________________________________________
319 TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
320 AliMq::Station12Type station12Type,
321 AliMp::PlaneType plane,
322 const TString& motifID)
324 /// Returns path to data file with pad dimensions for a given motif ID.
326 return TString(PlaneDataDir(station, station12Type, plane)
327 + MotifSpecialFileName(motifID));
330 //______________________________________________________________________________
331 TString AliMpFiles::BergToGCFilePath(AliMp::StationType station,
332 AliMq::Station12Type station12Type)
334 /// Returns the path of the file which describes the correspondance between
335 /// the berg number and the gassiplex channel.
337 return GetTop() + fgkDataDir + StationDataDir(station, station12Type)
338 + fgkBergToGCFileName + fgkDataExt;
341 //______________________________________________________________________________
342 TString AliMpFiles::ManuToSerialPath(const TString& deName,
343 AliMp::StationType station,
344 AliMq::Station12Type station12Type)
346 /// Returns the path of the file for the manu id to their serial number
348 return GetTop() + fgkDataRunDir + StationDataDir(station, station12Type)
349 + deName + fgkManuToSerial + fgkDataExt;
353 //______________________________________________________________________________
355 AliMpFiles::SetTopPath(const TString& topPath)
357 /// Set top file path
362 //______________________________________________________________________________
363 TString AliMpFiles::GetTop()
365 /// Return top path to mapping data defined either via MINSTALL
366 /// or ALICE_ROOT environment variable. \n
367 /// If both variables are defined, MINSTALL is used.
369 TString top = getenv("MINSTALL");
370 if ( ! top.IsNull() ) return top;
372 TString ntop = getenv("ALICE_ROOT");
373 if ( ntop.IsNull() ) {
374 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
377 ntop += "/MUON/mapping";