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>
48 // static private methods
51 //______________________________________________________________________________
52 const TString& AliMpFiles::GetDataDir()
55 static const TString kDataDir = "/data";
59 //______________________________________________________________________________
60 const TString& AliMpFiles::GetDataRunDir()
62 /// directory for run dependent data
63 static const TString kDataRunDir = "/data_run";
67 //______________________________________________________________________________
68 const TString& AliMpFiles::GetStationDir()
71 static const TString kStationDir = "/station";
75 //______________________________________________________________________________
76 const TString& AliMpFiles::GetBendingDir()
78 /// bending plane directory
79 static const TString kBendingDir = "bending_plane/";
83 //______________________________________________________________________________
84 const TString& AliMpFiles::GetNonBendingDir()
86 /// non-bending plane directory
87 static const TString kNonBendingDir = "non-bending_plane/";
88 return kNonBendingDir;
91 //______________________________________________________________________________
92 const TString& AliMpFiles::GetDENames()
94 /// DE names data file name
95 static const TString kDENames = "denames";
99 //______________________________________________________________________________
100 const TString& AliMpFiles::GetSector()
102 /// sector data file name
103 static const TString kSector = "zones";
107 //______________________________________________________________________________
108 const TString& AliMpFiles::GetSectorSpecial()
110 /// sector special data file name
111 static const TString kSectorSpecial = "zones_special";
112 return kSectorSpecial;
115 //______________________________________________________________________________
116 const TString& AliMpFiles::GetSectorSpecial2()
118 /// sector special data file name
119 static const TString kSectorSpecial2 = "zones_special_outer";
120 return kSectorSpecial2;
123 //______________________________________________________________________________
124 const TString& AliMpFiles::GetMotifPrefix()
126 /// motif data file name
127 static const TString kMotifPrefix = "motif";
132 //______________________________________________________________________________
133 const TString& AliMpFiles::GetMotifSpecialPrefix()
135 /// special motif data file name
136 static const TString kMotifSpecialPrefix ="motifSpecial";
137 return kMotifSpecialPrefix;
140 //______________________________________________________________________________
141 const TString& AliMpFiles::GetManuToSerial()
143 /// manu to serial file name suffix
144 static const TString kManuToSerial ="_manu";
145 return kManuToSerial;
148 //______________________________________________________________________________
149 const TString& AliMpFiles::GetPadPosPrefix()
151 /// pad position data file name
152 static const TString kPadPosPrefix = "padPos";
153 return kPadPosPrefix;
156 //______________________________________________________________________________
157 const TString& AliMpFiles::GetDataExt()
160 static const TString kDataExt = ".dat";
164 //______________________________________________________________________________
165 const TString& AliMpFiles::GetBergToGCFileName()
167 /// BergToGC mapping file name
168 static const TString kBergToGCFileName = "bergToGC";
169 return kBergToGCFileName;
172 //______________________________________________________________________________
173 const TString& AliMpFiles::GetTriggerLocalBoards()
175 /// local board name to id mapping
176 static const TString kTriggerLocalBoards = "RegionalCrate";
177 return kTriggerLocalBoards;
180 //______________________________________________________________________________
181 const TString& AliMpFiles::GetTriggerGlobalBoards()
183 /// global board name to id mapping
184 static const TString kTriggerGlobalBoards = "GlobalCrate";
185 return kTriggerGlobalBoards;
188 //______________________________________________________________________________
189 const TString& AliMpFiles::GetBusPatchFileName()
191 /// DetElemIdToBusPatch file name
192 static const TString kBusPatchFileName = "DetElemIdToBusPatch";
193 return kBusPatchFileName;
196 //______________________________________________________________________________
197 const TString& AliMpFiles::GetBusPatchInfoFileName()
199 /// BusPatch length file name
200 static const TString kBusPatchInfoFileName = "BusPatchInfo";
201 return kBusPatchInfoFileName;
204 //______________________________________________________________________________
205 const TString& AliMpFiles::GetBusPatchSpecialFileName()
207 /// BusPatch special file name
208 static const TString kBusPatchSpecialFileName = "BusPatchSpecial";
209 return kBusPatchSpecialFileName;
212 //______________________________________________________________________________
213 const TString& AliMpFiles::GetSerialToBinFileName()
215 /// serial to bin number file name
216 static const TString kSerialToBinFileName = "ManuSerialToBin";
217 return kSerialToBinFileName;
221 // static public methods
224 //______________________________________________________________________________
225 TString AliMpFiles::PlaneDataDir(AliMp::StationType station,
226 AliMq::Station12Type station12Type,
227 AliMp::PlaneType plane)
229 /// Returns path to data files with sector description
230 /// for a specified plane.
233 case AliMp::kStation12:
235 case AliMp::kBendingPlane:
236 return GetTop() + GetDataDir() + StationDataDir(station, station12Type) + GetBendingDir();
238 case AliMp::kNonBendingPlane:
239 return GetTop() + GetDataDir() + StationDataDir(station, station12Type) + GetNonBendingDir();
243 case AliMp::kStation345:
244 case AliMp::kStationTrigger:
245 return GetTop() + GetDataDir() + StationDataDir(station, AliMq::kNotSt12);
248 AliFatalClass("Incomplete switch on AliMp::PlaneType");
254 //______________________________________________________________________________
255 TString AliMpFiles::StationDataDir(AliMp::StationType station,
256 AliMq::Station12Type station12Type)
258 /// Returns the station directory name for the specified station number.
260 TString stationDataDir(GetStationDir());
262 case AliMp::kStation12:
263 switch (station12Type) {
264 case AliMq::kStation1:
265 stationDataDir += "1/";
268 case AliMq::kStation2:
269 stationDataDir += "2/";
272 case AliMq::kNotSt12:
273 AliFatalClass("Incorrect switch on AliMq::Station12Type");
278 case AliMp::kStation345:
279 stationDataDir += "345/";
282 case AliMp::kStationTrigger:
283 stationDataDir += "Trigger/";
287 stationDataDir += "Invalid/";
290 return stationDataDir;
293 //______________________________________________________________________________
294 TString AliMpFiles::BusPatchFilePath()
296 /// Return path to data file with bus patch mapping.
298 return GetTop() + GetDataDir() + "/" + GetBusPatchFileName() + GetDataExt();
301 //______________________________________________________________________________
302 TString AliMpFiles::BusPatchInfoFilePath()
304 /// Return path to data file with bus patch mapping.
306 return GetTop() + GetDataDir() + "/" + GetBusPatchInfoFileName() + GetDataExt();
309 //______________________________________________________________________________
310 TString AliMpFiles::BusPatchSpecialFilePath()
312 /// Return path to data file with special bus patch mapping.
314 return GetTop() + GetDataDir() + "/" + GetBusPatchSpecialFileName() + GetDataExt();
317 //______________________________________________________________________________
318 TString AliMpFiles::SerialToBinFilePath()
320 /// Return path to data file containing manu serial numbers with their bin.
322 return GetTop() + GetDataDir() + "/" + GetSerialToBinFileName() + GetDataExt();
326 //______________________________________________________________________________
327 TString AliMpFiles::DENamesFilePath(AliMp::StationType station,
328 AliMq::Station12Type station12Type)
330 /// Return path to data file with DE names for given station.
332 return GetTop() + GetDataDir() + StationDataDir(station, station12Type)
333 + GetDENames() + GetDataExt();
336 //______________________________________________________________________________
337 TString AliMpFiles::LocalTriggerBoardMapping()
339 /// Return path to data file with local trigger board mapping.
341 return GetTop() + GetDataDir()
342 + StationDataDir(AliMp::kStationTrigger, AliMq::kNotSt12)
343 + GetTriggerLocalBoards() + GetDataExt();;
346 //______________________________________________________________________________
347 TString AliMpFiles::GlobalTriggerBoardMapping()
349 /// Return path to data file with local trigger board mapping.
351 return GetTop() + GetDataDir()
352 + StationDataDir(AliMp::kStationTrigger, AliMq::kNotSt12)
353 + GetTriggerGlobalBoards() + GetDataExt();;
356 //_____________________________________________________________________________
357 TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
358 const char* slatType,
359 AliMp::PlaneType plane)
363 return TString(PlaneDataDir(stationType, AliMq::kNotSt12, plane)
365 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
368 //_____________________________________________________________________________
369 TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
372 /// Get the full path for a given PCB (only relevant to stations 3,
373 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
374 /// we use it to re-use the PlaneDataDir() method untouched.
376 return TString(PlaneDataDir(stationType, AliMq::kNotSt12, AliMp::kNonBendingPlane)
380 //______________________________________________________________________________
381 TString AliMpFiles::SectorFilePath(AliMq::Station12Type station12Type,
382 AliMp::PlaneType plane)
384 /// Return path to data file with sector description.
386 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
387 + GetSector() + GetDataExt());
390 //______________________________________________________________________________
391 TString AliMpFiles::SectorSpecialFilePath(AliMq::Station12Type station12Type,
392 AliMp::PlaneType plane)
394 /// Return path to data file with sector special description (irregular motifs).
396 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
397 + GetSectorSpecial() + GetDataExt());
400 //______________________________________________________________________________
401 TString AliMpFiles::SectorSpecialFilePath2(AliMq::Station12Type station12Type,
402 AliMp::PlaneType plane)
404 /// Returns path to data file with sector special description (irregular motifs).
406 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
407 + GetSectorSpecial2() + GetDataExt());
410 //______________________________________________________________________________
411 TString AliMpFiles::MotifFileName(const TString& motifTypeID)
413 /// Returns name of data file for a given motif type.
415 return TString(GetMotifPrefix() + motifTypeID + GetDataExt());
418 //______________________________________________________________________________
419 TString AliMpFiles::MotifFilePath(AliMp::StationType station,
420 AliMq::Station12Type station12Type,
421 AliMp::PlaneType plane,
422 const TString& motifTypeID)
424 /// Returns path to data file for a given motif type.
426 return TString(PlaneDataDir(station, station12Type, plane)
427 + MotifFileName(motifTypeID));
430 //______________________________________________________________________________
431 TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
433 /// Returns name of data file with pad positions for a given motif type.
435 return TString(GetPadPosPrefix() + motifTypeID + GetDataExt());
438 //______________________________________________________________________________
439 TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
440 AliMq::Station12Type station12Type,
441 AliMp::PlaneType plane,
442 const TString& motifTypeID)
444 /// Returns path to data file with pad positions for a given motif type.
446 return TString(PlaneDataDir(station, station12Type, plane)
447 + PadPosFileName(motifTypeID));
450 //______________________________________________________________________________
451 TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
453 /// Returns name of data file with pad dimensions for a given motif ID.
455 return TString(GetMotifSpecialPrefix() + motifID + GetDataExt());
459 //______________________________________________________________________________
460 TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
461 AliMq::Station12Type station12Type,
462 AliMp::PlaneType plane,
463 const TString& motifID)
465 /// Returns path to data file with pad dimensions for a given motif ID.
467 return TString(PlaneDataDir(station, station12Type, plane)
468 + MotifSpecialFileName(motifID));
471 //______________________________________________________________________________
472 TString AliMpFiles::BergToGCFilePath(AliMp::StationType station,
473 AliMq::Station12Type station12Type)
475 /// Returns the path of the file which describes the correspondance between
476 /// the berg number and the gassiplex channel.
478 return GetTop() + GetDataDir() + StationDataDir(station, station12Type)
479 + GetBergToGCFileName() + GetDataExt();
482 //______________________________________________________________________________
483 TString AliMpFiles::ManuToSerialPath(const TString& deName,
484 AliMp::StationType station,
485 AliMq::Station12Type station12Type)
487 /// Returns the path of the file for the manu id to their serial number
489 return GetTop() + GetDataRunDir() + StationDataDir(station, station12Type)
490 + deName + GetManuToSerial() + GetDataExt();
494 //______________________________________________________________________________
496 AliMpFiles::SetTopPath(const TString& topPath)
498 /// Set top file path
503 //______________________________________________________________________________
504 TString AliMpFiles::GetTop()
506 /// Return top path to mapping data defined either via MINSTALL
507 /// or ALICE_ROOT environment variable. \n
508 /// If both variables are defined, MINSTALL is used.
510 TString top = getenv("MINSTALL");
511 if ( ! top.IsNull() ) return top;
513 TString ntop = getenv("ALICE_ROOT");
514 if ( ntop.IsNull() ) {
515 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
518 ntop += "/MUON/mapping";
526 //______________________________________________________________________________
527 AliMpFiles::~AliMpFiles()