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