Macro for checking the serial & bin number of the mounted manus
[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//
f023e45b 47// static
48
5f91c9e8 49// static data members
50
be2a6782 51const TString AliMpFiles::fgkDataDir = "/data";
52const TString AliMpFiles::fgkStationDir = "/station";
53const TString AliMpFiles::fgkBendingDir = "/bending_plane/";
54const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";
0025a53e 55const TString AliMpFiles::fgkDENames = "denames";
5f91c9e8 56const TString AliMpFiles::fgkSector = "zones";
57const TString AliMpFiles::fgkSectorSpecial = "zones_special";
be2a6782 58const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
5f91c9e8 59const TString AliMpFiles::fgkMotifPrefix = "motif";
60const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
67f410f1 61const TString AliMpFiles::fgkManuToSerialDir ="manu_serial/";
ec5079b1 62const TString AliMpFiles::fgkManuToSerial ="_manu";
5f91c9e8 63const TString AliMpFiles::fgkPadPosPrefix = "padPos";
64const TString AliMpFiles::fgkDataExt = ".dat";
7f54909e 65const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
40c8e44b 66const TString AliMpFiles::fgkTriggerLocalBoards = "RegionalCrate";
67const TString AliMpFiles::fgkTriggerGlobalBoards = "GlobalCrate";
4df2ac68 68const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
0b121e9e 69const TString AliMpFiles::fgkBusPatchLengthFileName = "BusPatchLength";
ae649dcb 70const TString AliMpFiles::fgkBusPatchSpecialFileName = "BusPatchSpecial";
8b68068b 71const TString AliMpFiles::fgkSerialToBinFileName = "ManuSerialToBin";
72
5f91c9e8 73//______________________________________________________________________________
dee1d5f1 74AliMpFiles::~AliMpFiles()
75{
76/// Destructor
5f91c9e8 77}
78
5f91c9e8 79//
80// private methods
81//
82
7f54909e 83//______________________________________________________________________________
d9100e8b 84TString AliMpFiles::GetTop()
7f54909e 85{
490da820 86/// Return top path to mapping data defined either via MINSTALL
87/// or ALICE_ROOT environment variable. \n
88/// If both variables are defined, MINSTALL is used.
89
d9100e8b 90 TString top = getenv("MINSTALL");
527e050d 91 if ( ! top.IsNull() ) return top;
92
d9100e8b 93 TString ntop = getenv("ALICE_ROOT");
527e050d 94 if ( ntop.IsNull() ) {
95 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
96 return ntop;
97 }
98 ntop += "/MUON/mapping";
99 return ntop;
7f54909e 100}
101
5f91c9e8 102//______________________________________________________________________________
cddd101e 103TString AliMpFiles::PlaneDataDir(AliMp::StationType station,
104 AliMp::PlaneType plane)
5f91c9e8 105{
dee1d5f1 106/// Returns path to data files with sector description
107/// for a specified plane.
5f91c9e8 108
dee1d5f1 109 switch (station) {
cddd101e 110 case AliMp::kStation1:
111 case AliMp::kStation2:
dee1d5f1 112 switch (plane) {
cddd101e 113 case AliMp::kBendingPlane:
d9100e8b 114 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
dee1d5f1 115 ;;
cddd101e 116 case AliMp::kNonBendingPlane:
d9100e8b 117 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
dee1d5f1 118 ;;
119 }
120 break;
cddd101e 121 case AliMp::kStation345:
122 case AliMp::kStationTrigger:
d9100e8b 123 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
7f54909e 124 break;
125 default:
cddd101e 126 AliFatalClass("Incomplete switch on AliMp::PlaneType");
dee1d5f1 127 break;
128 }
5f91c9e8 129 return TString();
130}
131
be2a6782 132//______________________________________________________________________________
cddd101e 133TString AliMpFiles::StationDataDir(AliMp::StationType station)
be2a6782 134{
dee1d5f1 135/// Returns the station directory name for the specified station number.
be2a6782 136
137 TString stationDataDir(fgkStationDir);
138 switch (station) {
cddd101e 139 case AliMp::kStation1:
0025a53e 140 stationDataDir += "1/";
dee1d5f1 141 break;
142 ;;
cddd101e 143 case AliMp::kStation2:
0025a53e 144 stationDataDir += "2/";
dee1d5f1 145 break;
146 ;;
cddd101e 147 case AliMp::kStation345:
dee1d5f1 148 stationDataDir += "345/";
149 break;
150 ;;
cddd101e 151 case AliMp::kStationTrigger:
7f54909e 152 stationDataDir += "Trigger/";
153 break;
154 ;;
155 default:
156 stationDataDir += "Invalid/";
157 break;
be2a6782 158 }
159 return stationDataDir;
160}
161
5f91c9e8 162//
163// public methods
164//
165
4df2ac68 166//______________________________________________________________________________
167TString AliMpFiles::BusPatchFilePath()
168{
169/// Return path to data file with bus patch mapping.
170
d9100e8b 171 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
4df2ac68 172}
173
0b121e9e 174//______________________________________________________________________________
175TString AliMpFiles::BusPatchLengthFilePath()
176{
177/// Return path to data file with bus patch mapping.
178
179 return GetTop() + fgkDataDir + "/" + fgkBusPatchLengthFileName + fgkDataExt;
180}
181
ae649dcb 182//______________________________________________________________________________
183TString AliMpFiles::BusPatchSpecialFilePath()
184{
185/// Return path to data file with special bus patch mapping.
186
187 return GetTop() + fgkDataDir + "/" + fgkBusPatchSpecialFileName + fgkDataExt;
188}
189
8b68068b 190//______________________________________________________________________________
191TString AliMpFiles::SerialToBinFilePath()
192{
193/// Return path to data file containing manu serial numbers with their bin.
194
195 return GetTop() + fgkDataDir + "/" + fgkSerialToBinFileName + fgkDataExt;
196}
197
198
0025a53e 199//______________________________________________________________________________
cddd101e 200TString AliMpFiles::DENamesFilePath(AliMp::StationType station)
0025a53e 201{
202/// Return path to data file with DE names for given station.
203
d9100e8b 204 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
0025a53e 205}
206
4df2ac68 207//______________________________________________________________________________
208TString AliMpFiles::LocalTriggerBoardMapping()
209{
f023e45b 210/// Return path to data file with local trigger board mapping.
490da820 211
cddd101e 212 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
f023e45b 213 + fgkTriggerLocalBoards + fgkDataExt;;
4df2ac68 214}
215
40c8e44b 216//______________________________________________________________________________
217TString AliMpFiles::GlobalTriggerBoardMapping()
218{
219/// Return path to data file with local trigger board mapping.
220
221 return GetTop() + fgkDataDir + StationDataDir(AliMp::kStationTrigger)
222 + fgkTriggerGlobalBoards + fgkDataExt;;
223}
224
dee1d5f1 225//_____________________________________________________________________________
cddd101e 226TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
7f54909e 227 const char* slatType,
cddd101e 228 AliMp::PlaneType plane)
dee1d5f1 229{
230/// \todo add ..
231
7f54909e 232 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
cddd101e 233 ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
dee1d5f1 234}
235
236//_____________________________________________________________________________
cddd101e 237TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
7f54909e 238 const char* pcbType)
dee1d5f1 239{
240/// Get the full path for a given PCB (only relevant to stations 3,
7f54909e 241/// 4, 5 and trigger). The bending parameter below is of no use in this case, but
dee1d5f1 242/// we use it to re-use the PlaneDataDir() method untouched.
243
cddd101e 244 return TString(PlaneDataDir(stationType,AliMp::kNonBendingPlane) + pcbType +
7f54909e 245 ".pcb");
dee1d5f1 246}
247
5f91c9e8 248//______________________________________________________________________________
cddd101e 249TString AliMpFiles::SectorFilePath(AliMp::StationType station,
250 AliMp::PlaneType plane)
5f91c9e8 251{
dee1d5f1 252/// Return path to data file with sector description.
5f91c9e8 253
be2a6782 254 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
255}
256
257//______________________________________________________________________________
cddd101e 258TString AliMpFiles::SectorSpecialFilePath(AliMp::StationType station,
259 AliMp::PlaneType plane)
be2a6782 260{
dee1d5f1 261/// Return path to data file with sector special description (irregular motifs).
be2a6782 262
263 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
5f91c9e8 264}
265
266//______________________________________________________________________________
cddd101e 267TString AliMpFiles::SectorSpecialFilePath2(AliMp::StationType station,
268 AliMp::PlaneType plane)
5f91c9e8 269{
dee1d5f1 270/// Returns path to data file with sector special description (irregular motifs).
5f91c9e8 271
be2a6782 272 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
5f91c9e8 273}
82915841 274
275//______________________________________________________________________________
276TString AliMpFiles::MotifFileName(const TString& motifTypeID)
277{
278 /// Returns name of data file for a given motif type.
279
280 return TString(fgkMotifPrefix + motifTypeID + fgkDataExt);
281}
282
5f91c9e8 283//______________________________________________________________________________
cddd101e 284TString AliMpFiles::MotifFilePath(AliMp::StationType station,
285 AliMp::PlaneType plane,
7f54909e 286 const TString& motifTypeID)
5f91c9e8 287{
dee1d5f1 288/// Returns path to data file for a given motif type.
5f91c9e8 289
82915841 290 return TString(PlaneDataDir(station, plane) + MotifFileName(motifTypeID));
5f91c9e8 291}
82915841 292
293//______________________________________________________________________________
294TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
295{
296 /// Returns name of data file with pad positions for a given motif type.
297
298 return TString(fgkPadPosPrefix + motifTypeID + fgkDataExt);
299}
300
5f91c9e8 301//______________________________________________________________________________
cddd101e 302TString AliMpFiles::PadPosFilePath(AliMp::StationType station,
303 AliMp::PlaneType plane,
7f54909e 304 const TString& motifTypeID)
5f91c9e8 305{
dee1d5f1 306/// Returns path to data file with pad positions for a given motif type.
5f91c9e8 307
82915841 308 return TString(PlaneDataDir(station, plane) + PadPosFileName(motifTypeID));
309}
310
311//______________________________________________________________________________
312TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
313{
314 /// Returns name of data file with pad dimensions for a given motif ID.
315
316 return TString(fgkMotifSpecialPrefix + motifID + fgkDataExt);
317
5f91c9e8 318}
319
320//______________________________________________________________________________
cddd101e 321TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station,
322 AliMp::PlaneType plane,
7f54909e 323 const TString& motifID)
5f91c9e8 324{
dee1d5f1 325/// Returns path to data file with pad dimensions for a given motif ID.
5f91c9e8 326
82915841 327 return TString(PlaneDataDir(station, plane) + MotifSpecialFileName(motifID));
5f91c9e8 328}
329
330//______________________________________________________________________________
cddd101e 331TString AliMpFiles::BergToGCFilePath(AliMp::StationType station)
5f91c9e8 332{
dee1d5f1 333/// Returns the path of the file which describes the correspondance between
334/// the berg number and the gassiplex channel.
5f91c9e8 335
d9100e8b 336 return GetTop() + fgkDataDir + StationDataDir(station)
be2a6782 337 + fgkBergToGCFileName + fgkDataExt;
5f91c9e8 338}
7f54909e 339
ec5079b1 340//______________________________________________________________________________
cddd101e 341TString AliMpFiles::ManuToSerialPath(const TString& deName, AliMp::StationType station)
ec5079b1 342{
343/// Returns the path of the file for the manu id to their serial number
344
67f410f1 345 return GetTop() + fgkDataDir + StationDataDir(station)
346 + fgkManuToSerialDir + deName + fgkManuToSerial + fgkDataExt;
ec5079b1 347}
348
349
7f54909e 350//______________________________________________________________________________
351void
352AliMpFiles::SetTopPath(const TString& topPath)
353{
71a2d3aa 354/// Set top file path
355
d9100e8b 356 GetTop() = topPath;
7f54909e 357}
358