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