]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONmapping/AliMpFiles.cxx
Fixes for object target dependencies
[u/mrichter/AliRoot.git] / MUON / MUONmapping / AliMpFiles.cxx
CommitLineData
dee1d5f1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
5f91c9e8 16// $Id$
f023e45b 17// $MpId: AliMpFiles.cxx,v 1.12 2006/05/23 13:09:54 ivana Exp $
dee1d5f1 18// Category: basic
3d1463c8 19
20//-----------------------------------------------------------------------------
5f91c9e8 21// Class AliMpFiles
22// ----------------
23// Class for generating file names and paths.
24// The input files:
25// zones.dat, zones_special.dat - sector description
26// motif*.dat - motif description (generated from Exceed)
27// padPos*.dat - pad positions in motif
28//
dbe945cc 29// Included in AliRoot: 2003/05/02
5f91c9e8 30// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
3d1463c8 31//-----------------------------------------------------------------------------
5f91c9e8 32
5f91c9e8 33#include "AliMpFiles.h"
2c605e66 34
7f54909e 35#include "AliLog.h"
2c605e66 36
37#include <TClass.h>
38#include <Riostream.h>
39
40#include <stdlib.h>
5f91c9e8 41
b80faac0 42using std::endl;
13985652 43/// \cond CLASSIMP
44ClassImp(AliMpFiles)
45/// \endcond
7f54909e 46
13985652 47//
31edb2d7 48// static private methods
49//
8b68068b 50
5f91c9e8 51//______________________________________________________________________________
31edb2d7 52const TString& AliMpFiles::GetDataDir()
dee1d5f1 53{
31edb2d7 54 /// data directory
55 static const TString kDataDir = "/data";
56 return kDataDir;
57}
58
59//______________________________________________________________________________
60const TString& AliMpFiles::GetDataRunDir()
61{
62 /// directory for run dependent data
63 static const TString kDataRunDir = "/data_run";
64 return kDataRunDir;
65}
66
67//______________________________________________________________________________
68const TString& AliMpFiles::GetStationDir()
69{
70 /// station directory
71 static const TString kStationDir = "/station";
72 return kStationDir;
73}
74
75//______________________________________________________________________________
76const TString& AliMpFiles::GetBendingDir()
77{
78 /// bending plane directory
79 static const TString kBendingDir = "bending_plane/";
80 return kBendingDir;
81}
82
83//______________________________________________________________________________
84const TString& AliMpFiles::GetNonBendingDir()
85{
86 /// non-bending plane directory
87 static const TString kNonBendingDir = "non-bending_plane/";
88 return kNonBendingDir;
89}
90
91//______________________________________________________________________________
92const TString& AliMpFiles::GetDENames()
93{
94 /// DE names data file name
95 static const TString kDENames = "denames";
96 return kDENames;
97}
98
99//______________________________________________________________________________
100const TString& AliMpFiles::GetSector()
101{
102 /// sector data file name
103 static const TString kSector = "zones";
104 return kSector;
105}
106
107//______________________________________________________________________________
108const TString& AliMpFiles::GetSectorSpecial()
109{
110 /// sector special data file name
111 static const TString kSectorSpecial = "zones_special";
112 return kSectorSpecial;
113}
114
115//______________________________________________________________________________
116const TString& AliMpFiles::GetSectorSpecial2()
117{
118 /// sector special data file name
119 static const TString kSectorSpecial2 = "zones_special_outer";
120 return kSectorSpecial2;
121}
122
123//______________________________________________________________________________
124const TString& AliMpFiles::GetMotifPrefix()
125{
126 /// motif data file name
127 static const TString kMotifPrefix = "motif";
128 return kMotifPrefix;
129}
130
131
132//______________________________________________________________________________
133const TString& AliMpFiles::GetMotifSpecialPrefix()
134{
135 /// special motif data file name
136 static const TString kMotifSpecialPrefix ="motifSpecial";
137 return kMotifSpecialPrefix;
138}
139
140//______________________________________________________________________________
141const TString& AliMpFiles::GetManuToSerial()
142{
143 /// manu to serial file name suffix
144 static const TString kManuToSerial ="_manu";
145 return kManuToSerial;
146}
147
148//______________________________________________________________________________
149const TString& AliMpFiles::GetPadPosPrefix()
150{
151 /// pad position data file name
152 static const TString kPadPosPrefix = "padPos";
153 return kPadPosPrefix;
154}
155
156//______________________________________________________________________________
157const TString& AliMpFiles::GetDataExt()
158{
159 /// file extension
160 static const TString kDataExt = ".dat";
161 return kDataExt;
5f91c9e8 162}
31edb2d7 163
164//______________________________________________________________________________
165const TString& AliMpFiles::GetBergToGCFileName()
166{
167 /// BergToGC mapping file name
168 static const TString kBergToGCFileName = "bergToGC";
169 return kBergToGCFileName;
170}
5f91c9e8 171
31edb2d7 172//______________________________________________________________________________
173const TString& AliMpFiles::GetTriggerLocalBoards()
174{
175 /// local board name to id mapping
176 static const TString kTriggerLocalBoards = "RegionalCrate";
177 return kTriggerLocalBoards;
178}
179
180//______________________________________________________________________________
181const TString& AliMpFiles::GetTriggerGlobalBoards()
182{
183 /// global board name to id mapping
184 static const TString kTriggerGlobalBoards = "GlobalCrate";
185 return kTriggerGlobalBoards;
186}
187
188//______________________________________________________________________________
189const TString& AliMpFiles::GetBusPatchFileName()
190{
191 /// DetElemIdToBusPatch file name
192 static const TString kBusPatchFileName = "DetElemIdToBusPatch";
193 return kBusPatchFileName;
194}
195
196//______________________________________________________________________________
197const TString& AliMpFiles::GetBusPatchInfoFileName()
198{
199 /// BusPatch length file name
200 static const TString kBusPatchInfoFileName = "BusPatchInfo";
201 return kBusPatchInfoFileName;
202}
203
204//______________________________________________________________________________
205const TString& AliMpFiles::GetBusPatchSpecialFileName()
206{
207 /// BusPatch special file name
208 static const TString kBusPatchSpecialFileName = "BusPatchSpecial";
209 return kBusPatchSpecialFileName;
210}
211
212//______________________________________________________________________________
213const TString& AliMpFiles::GetSerialToBinFileName()
214{
215 /// serial to bin number file name
216 static const TString kSerialToBinFileName = "ManuSerialToBin";
217 return kSerialToBinFileName;
218}
219
5f91c9e8 220//
31edb2d7 221// static public methods
5f91c9e8 222//
223
224//______________________________________________________________________________
cddd101e 225TString AliMpFiles::PlaneDataDir(AliMp::StationType station,
4e51cfd2 226 AliMq::Station12Type station12Type,
cddd101e 227 AliMp::PlaneType plane)
5f91c9e8 228{
dee1d5f1 229/// Returns path to data files with sector description
230/// for a specified plane.
5f91c9e8 231
dee1d5f1 232 switch (station) {
4e51cfd2 233 case AliMp::kStation12:
dee1d5f1 234 switch (plane) {
cddd101e 235 case AliMp::kBendingPlane:
31edb2d7 236 return GetTop() + GetDataDir() + StationDataDir(station, station12Type) + GetBendingDir();
dee1d5f1 237 ;;
cddd101e 238 case AliMp::kNonBendingPlane:
31edb2d7 239 return GetTop() + GetDataDir() + StationDataDir(station, station12Type) + GetNonBendingDir();
dee1d5f1 240 ;;
241 }
242 break;
cddd101e 243 case AliMp::kStation345:
244 case AliMp::kStationTrigger:
31edb2d7 245 return GetTop() + GetDataDir() + StationDataDir(station, AliMq::kNotSt12);
7f54909e 246 break;
247 default:
cddd101e 248 AliFatalClass("Incomplete switch on AliMp::PlaneType");
dee1d5f1 249 break;
250 }
5f91c9e8 251 return TString();
252}
253
be2a6782 254//______________________________________________________________________________
4e51cfd2 255TString AliMpFiles::StationDataDir(AliMp::StationType station,
256 AliMq::Station12Type station12Type)
be2a6782 257{
dee1d5f1 258/// Returns the station directory name for the specified station number.
be2a6782 259
31edb2d7 260 TString stationDataDir(GetStationDir());
be2a6782 261 switch (station) {
4e51cfd2 262 case AliMp::kStation12:
263 switch (station12Type) {
264 case AliMq::kStation1:
265 stationDataDir += "1/";
266 break;
267 ;;
268 case AliMq::kStation2:
269 stationDataDir += "2/";
270 break;
271 ;;
272 case AliMq::kNotSt12:
273 AliFatalClass("Incorrect switch on AliMq::Station12Type");
274 break;
275 }
dee1d5f1 276 break;
277 ;;
cddd101e 278 case AliMp::kStation345:
dee1d5f1 279 stationDataDir += "345/";
280 break;
281 ;;
cddd101e 282 case AliMp::kStationTrigger:
7f54909e 283 stationDataDir += "Trigger/";
284 break;
285 ;;
286 default:
287 stationDataDir += "Invalid/";
288 break;
be2a6782 289 }
290 return stationDataDir;
291}
292
4df2ac68 293//______________________________________________________________________________
294TString AliMpFiles::BusPatchFilePath()
295{
296/// Return path to data file with bus patch mapping.
297
31edb2d7 298 return GetTop() + GetDataDir() + "/" + GetBusPatchFileName() + GetDataExt();
4df2ac68 299}
300
0b121e9e 301//______________________________________________________________________________
59754717 302TString AliMpFiles::BusPatchInfoFilePath()
0b121e9e 303{
304/// Return path to data file with bus patch mapping.
305
31edb2d7 306 return GetTop() + GetDataDir() + "/" + GetBusPatchInfoFileName() + GetDataExt();
0b121e9e 307}
308
ae649dcb 309//______________________________________________________________________________
310TString AliMpFiles::BusPatchSpecialFilePath()
311{
312/// Return path to data file with special bus patch mapping.
313
31edb2d7 314 return GetTop() + GetDataDir() + "/" + GetBusPatchSpecialFileName() + GetDataExt();
ae649dcb 315}
316
8b68068b 317//______________________________________________________________________________
318TString AliMpFiles::SerialToBinFilePath()
319{
320/// Return path to data file containing manu serial numbers with their bin.
321
31edb2d7 322 return GetTop() + GetDataDir() + "/" + GetSerialToBinFileName() + GetDataExt();
8b68068b 323}
324
325
0025a53e 326//______________________________________________________________________________
4e51cfd2 327TString AliMpFiles::DENamesFilePath(AliMp::StationType station,
328 AliMq::Station12Type station12Type)
0025a53e 329{
330/// Return path to data file with DE names for given station.
331
31edb2d7 332 return GetTop() + GetDataDir() + StationDataDir(station, station12Type)
333 + GetDENames() + GetDataExt();
0025a53e 334}
335
4df2ac68 336//______________________________________________________________________________
337TString AliMpFiles::LocalTriggerBoardMapping()
338{
f023e45b 339/// Return path to data file with local trigger board mapping.
490da820 340
31edb2d7 341 return GetTop() + GetDataDir()
4e51cfd2 342 + StationDataDir(AliMp::kStationTrigger, AliMq::kNotSt12)
31edb2d7 343 + GetTriggerLocalBoards() + GetDataExt();;
4df2ac68 344}
345
40c8e44b 346//______________________________________________________________________________
347TString AliMpFiles::GlobalTriggerBoardMapping()
348{
349/// Return path to data file with local trigger board mapping.
350
31edb2d7 351 return GetTop() + GetDataDir()
4e51cfd2 352 + StationDataDir(AliMp::kStationTrigger, AliMq::kNotSt12)
31edb2d7 353 + GetTriggerGlobalBoards() + GetDataExt();;
40c8e44b 354}
355
dee1d5f1 356//_____________________________________________________________________________
cddd101e 357TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
7f54909e 358 const char* slatType,
cddd101e 359 AliMp::PlaneType plane)
dee1d5f1 360{
361/// \todo add ..
362
4e51cfd2 363 return TString(PlaneDataDir(stationType, AliMq::kNotSt12, plane)
364 + slatType + "." +
cddd101e 365 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
dee1d5f1 366}
367
368//_____________________________________________________________________________
cddd101e 369TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
7f54909e 370 const char* pcbType)
dee1d5f1 371{
372/// Get the full path for a given PCB (only relevant to stations 3,
7f54909e 373/// 4, 5 and trigger). The bending parameter below is of no use in this case, but
dee1d5f1 374/// we use it to re-use the PlaneDataDir() method untouched.
375
4e51cfd2 376 return TString(PlaneDataDir(stationType, AliMq::kNotSt12, AliMp::kNonBendingPlane)
377 + pcbType + ".pcb");
dee1d5f1 378}
379
5f91c9e8 380//______________________________________________________________________________
4e51cfd2 381TString AliMpFiles::SectorFilePath(AliMq::Station12Type station12Type,
cddd101e 382 AliMp::PlaneType plane)
5f91c9e8 383{
dee1d5f1 384/// Return path to data file with sector description.
5f91c9e8 385
4e51cfd2 386 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
31edb2d7 387 + GetSector() + GetDataExt());
be2a6782 388}
389
390//______________________________________________________________________________
4e51cfd2 391TString AliMpFiles::SectorSpecialFilePath(AliMq::Station12Type station12Type,
cddd101e 392 AliMp::PlaneType plane)
be2a6782 393{
dee1d5f1 394/// Return path to data file with sector special description (irregular motifs).
be2a6782 395
4e51cfd2 396 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
31edb2d7 397 + GetSectorSpecial() + GetDataExt());
5f91c9e8 398}
399
400//______________________________________________________________________________
4e51cfd2 401TString AliMpFiles::SectorSpecialFilePath2(AliMq::Station12Type station12Type,
cddd101e 402 AliMp::PlaneType plane)
5f91c9e8 403{
dee1d5f1 404/// Returns path to data file with sector special description (irregular motifs).
5f91c9e8 405
4e51cfd2 406 return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane)
31edb2d7 407 + GetSectorSpecial2() + GetDataExt());
5f91c9e8 408}
82915841 409
410//______________________________________________________________________________
411TString AliMpFiles::MotifFileName(const TString& motifTypeID)
412{
413 /// Returns name of data file for a given motif type.
414
31edb2d7 415 return TString(GetMotifPrefix() + motifTypeID + GetDataExt());
82915841 416}
417
5f91c9e8 418//______________________________________________________________________________
cddd101e 419TString AliMpFiles::MotifFilePath(AliMp::StationType station,
4e51cfd2 420 AliMq::Station12Type station12Type,
cddd101e 421 AliMp::PlaneType plane,
7f54909e 422 const TString& motifTypeID)
5f91c9e8 423{
dee1d5f1 424/// Returns path to data file for a given motif type.
5f91c9e8 425
4e51cfd2 426 return TString(PlaneDataDir(station, station12Type, plane)
427 + MotifFileName(motifTypeID));
5f91c9e8 428}
82915841 429
430//______________________________________________________________________________
431TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
432{
433 /// Returns name of data file with pad positions for a given motif type.
434
31edb2d7 435 return TString(GetPadPosPrefix() + motifTypeID + GetDataExt());
82915841 436}
437
5f91c9e8 438//______________________________________________________________________________
cddd101e 439TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
4e51cfd2 440 AliMq::Station12Type station12Type,
cddd101e 441 AliMp::PlaneType plane,
7f54909e 442 const TString& motifTypeID)
5f91c9e8 443{
dee1d5f1 444/// Returns path to data file with pad positions for a given motif type.
5f91c9e8 445
4e51cfd2 446 return TString(PlaneDataDir(station, station12Type, plane)
447 + PadPosFileName(motifTypeID));
82915841 448}
449
450//______________________________________________________________________________
451TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
452{
453 /// Returns name of data file with pad dimensions for a given motif ID.
454
31edb2d7 455 return TString(GetMotifSpecialPrefix() + motifID + GetDataExt());
82915841 456
5f91c9e8 457}
458
459//______________________________________________________________________________
cddd101e 460TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
4e51cfd2 461 AliMq::Station12Type station12Type,
cddd101e 462 AliMp::PlaneType plane,
7f54909e 463 const TString& motifID)
5f91c9e8 464{
dee1d5f1 465/// Returns path to data file with pad dimensions for a given motif ID.
5f91c9e8 466
4e51cfd2 467 return TString(PlaneDataDir(station, station12Type, plane)
468 + MotifSpecialFileName(motifID));
5f91c9e8 469}
470
471//______________________________________________________________________________
4e51cfd2 472TString AliMpFiles::BergToGCFilePath(AliMp::StationType station,
473 AliMq::Station12Type station12Type)
5f91c9e8 474{
dee1d5f1 475/// Returns the path of the file which describes the correspondance between
476/// the berg number and the gassiplex channel.
5f91c9e8 477
31edb2d7 478 return GetTop() + GetDataDir() + StationDataDir(station, station12Type)
479 + GetBergToGCFileName() + GetDataExt();
5f91c9e8 480}
7f54909e 481
ec5079b1 482//______________________________________________________________________________
4e51cfd2 483TString AliMpFiles::ManuToSerialPath(const TString& deName,
484 AliMp::StationType station,
485 AliMq::Station12Type station12Type)
ec5079b1 486{
487/// Returns the path of the file for the manu id to their serial number
488
31edb2d7 489 return GetTop() + GetDataRunDir() + StationDataDir(station, station12Type)
490 + deName + GetManuToSerial() + GetDataExt();
ec5079b1 491}
492
493
7f54909e 494//______________________________________________________________________________
495void
496AliMpFiles::SetTopPath(const TString& topPath)
497{
71a2d3aa 498/// Set top file path
499
d9100e8b 500 GetTop() = topPath;
7f54909e 501}
502
228fd720 503//______________________________________________________________________________
504TString AliMpFiles::GetTop()
505{
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.
509
510 TString top = getenv("MINSTALL");
511 if ( ! top.IsNull() ) return top;
512
513 TString ntop = getenv("ALICE_ROOT");
514 if ( ntop.IsNull() ) {
515 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
516 return ntop;
517 }
518 ntop += "/MUON/mapping";
519 return ntop;
520}
521
31edb2d7 522//
523// ctors, dtor
524//
525
526//______________________________________________________________________________
527AliMpFiles::~AliMpFiles()
528{
529/// Destructor
530}
531