]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpFiles.cxx
Introduced new DE names unique to each det element;
[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
490da820 19// ----------------
5f91c9e8 20// Class AliMpFiles
21// ----------------
22// Class for generating file names and paths.
23// The input files:
24// zones.dat, zones_special.dat - sector description
25// motif*.dat - motif description (generated from Exceed)
26// padPos*.dat - pad positions in motif
27//
dbe945cc 28// Included in AliRoot: 2003/05/02
5f91c9e8 29// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
30
5f91c9e8 31#include "AliMpFiles.h"
2c605e66 32
7f54909e 33#include "AliLog.h"
2c605e66 34
35#include <TClass.h>
36#include <Riostream.h>
37
38#include <stdlib.h>
5f91c9e8 39
13985652 40/// \cond CLASSIMP
41ClassImp(AliMpFiles)
42/// \endcond
7f54909e 43
13985652 44//
f023e45b 45// static
46
5f91c9e8 47// static data members
48
be2a6782 49const TString AliMpFiles::fgkDataDir = "/data";
50const TString AliMpFiles::fgkStationDir = "/station";
51const TString AliMpFiles::fgkBendingDir = "/bending_plane/";
52const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";
0025a53e 53const TString AliMpFiles::fgkDENames = "denames";
5f91c9e8 54const TString AliMpFiles::fgkSector = "zones";
55const TString AliMpFiles::fgkSectorSpecial = "zones_special";
be2a6782 56const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
5f91c9e8 57const TString AliMpFiles::fgkMotifPrefix = "motif";
58const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
59const TString AliMpFiles::fgkPadPosPrefix = "padPos";
60const TString AliMpFiles::fgkDataExt = ".dat";
7f54909e 61const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
f023e45b 62const TString AliMpFiles::fgkTriggerLocalBoards = "crate";
4df2ac68 63const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
7f54909e 64
5f91c9e8 65//______________________________________________________________________________
dee1d5f1 66AliMpFiles::~AliMpFiles()
67{
68/// Destructor
5f91c9e8 69}
70
5f91c9e8 71//
72// private methods
73//
74
7f54909e 75//______________________________________________________________________________
d9100e8b 76TString AliMpFiles::GetTop()
7f54909e 77{
490da820 78/// Return top path to mapping data defined either via MINSTALL
79/// or ALICE_ROOT environment variable. \n
80/// If both variables are defined, MINSTALL is used.
81
d9100e8b 82 TString top = getenv("MINSTALL");
527e050d 83 if ( ! top.IsNull() ) return top;
84
d9100e8b 85 TString ntop = getenv("ALICE_ROOT");
527e050d 86 if ( ntop.IsNull() ) {
87 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
88 return ntop;
89 }
90 ntop += "/MUON/mapping";
91 return ntop;
7f54909e 92}
93
5f91c9e8 94//______________________________________________________________________________
be2a6782 95TString AliMpFiles::PlaneDataDir(AliMpStationType station,
7f54909e 96 AliMpPlaneType plane)
5f91c9e8 97{
dee1d5f1 98/// Returns path to data files with sector description
99/// for a specified plane.
5f91c9e8 100
dee1d5f1 101 switch (station) {
102 case kStation1:
103 case kStation2:
104 switch (plane) {
5f91c9e8 105 case kBendingPlane:
d9100e8b 106 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
dee1d5f1 107 ;;
5f91c9e8 108 case kNonBendingPlane:
d9100e8b 109 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
dee1d5f1 110 ;;
111 }
112 break;
113 case kStation345:
7f54909e 114 case kStationTrigger:
d9100e8b 115 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
7f54909e 116 break;
117 default:
118 AliFatalClass("Incomplete switch on AliMpPlaneType");
dee1d5f1 119 break;
120 }
5f91c9e8 121 return TString();
122}
123
be2a6782 124//______________________________________________________________________________
7f54909e 125TString AliMpFiles::StationDataDir(AliMpStationType station)
be2a6782 126{
dee1d5f1 127/// Returns the station directory name for the specified station number.
be2a6782 128
129 TString stationDataDir(fgkStationDir);
130 switch (station) {
dee1d5f1 131 case kStation1:
0025a53e 132 stationDataDir += "1/";
dee1d5f1 133 break;
134 ;;
135 case kStation2:
0025a53e 136 stationDataDir += "2/";
dee1d5f1 137 break;
138 ;;
139 case kStation345:
140 stationDataDir += "345/";
141 break;
142 ;;
7f54909e 143 case kStationTrigger:
144 stationDataDir += "Trigger/";
145 break;
146 ;;
147 default:
148 stationDataDir += "Invalid/";
149 break;
be2a6782 150 }
151 return stationDataDir;
152}
153
5f91c9e8 154//
155// public methods
156//
157
4df2ac68 158//______________________________________________________________________________
159TString AliMpFiles::BusPatchFilePath()
160{
161/// Return path to data file with bus patch mapping.
162
d9100e8b 163 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
4df2ac68 164}
165
0025a53e 166//______________________________________________________________________________
167TString AliMpFiles::DENamesFilePath(AliMpStationType station)
168{
169/// Return path to data file with DE names for given station.
170
d9100e8b 171 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
0025a53e 172}
173
4df2ac68 174//______________________________________________________________________________
175TString AliMpFiles::LocalTriggerBoardMapping()
176{
f023e45b 177/// Return path to data file with local trigger board mapping.
490da820 178
f023e45b 179 return GetTop() + fgkDataDir + StationDataDir(kStationTrigger)
180 + fgkTriggerLocalBoards + fgkDataExt;;
4df2ac68 181}
182
dee1d5f1 183//_____________________________________________________________________________
7f54909e 184TString AliMpFiles::SlatFilePath(AliMpStationType stationType,
185 const char* slatType,
186 AliMpPlaneType plane)
dee1d5f1 187{
188/// \todo add ..
189
7f54909e 190 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
dee1d5f1 191 ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
192}
193
194//_____________________________________________________________________________
7f54909e 195TString AliMpFiles::SlatPCBFilePath(AliMpStationType stationType,
196 const char* pcbType)
dee1d5f1 197{
198/// Get the full path for a given PCB (only relevant to stations 3,
7f54909e 199/// 4, 5 and trigger). The bending parameter below is of no use in this case, but
dee1d5f1 200/// we use it to re-use the PlaneDataDir() method untouched.
201
7f54909e 202 return TString(PlaneDataDir(stationType,kNonBendingPlane) + pcbType +
203 ".pcb");
dee1d5f1 204}
205
5f91c9e8 206//______________________________________________________________________________
be2a6782 207TString AliMpFiles::SectorFilePath(AliMpStationType station,
7f54909e 208 AliMpPlaneType plane)
5f91c9e8 209{
dee1d5f1 210/// Return path to data file with sector description.
5f91c9e8 211
be2a6782 212 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
213}
214
215//______________________________________________________________________________
216TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station,
7f54909e 217 AliMpPlaneType plane)
be2a6782 218{
dee1d5f1 219/// Return path to data file with sector special description (irregular motifs).
be2a6782 220
221 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
5f91c9e8 222}
223
224//______________________________________________________________________________
be2a6782 225TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station,
7f54909e 226 AliMpPlaneType plane)
5f91c9e8 227{
dee1d5f1 228/// Returns path to data file with sector special description (irregular motifs).
5f91c9e8 229
be2a6782 230 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
5f91c9e8 231}
232
233//______________________________________________________________________________
be2a6782 234TString AliMpFiles::MotifFilePath(AliMpStationType station,
235 AliMpPlaneType plane,
7f54909e 236 const TString& motifTypeID)
5f91c9e8 237{
dee1d5f1 238/// Returns path to data file for a given motif type.
5f91c9e8 239
be2a6782 240 return TString(PlaneDataDir(station, plane)
241 + fgkMotifPrefix + motifTypeID + fgkDataExt);
5f91c9e8 242}
243
244//______________________________________________________________________________
be2a6782 245TString AliMpFiles::PadPosFilePath(AliMpStationType station,
246 AliMpPlaneType plane,
7f54909e 247 const TString& motifTypeID)
5f91c9e8 248{
dee1d5f1 249/// Returns path to data file with pad positions for a given motif type.
5f91c9e8 250
be2a6782 251 return TString(PlaneDataDir(station, plane)
252 + fgkPadPosPrefix + motifTypeID + fgkDataExt);
5f91c9e8 253}
254
255//______________________________________________________________________________
be2a6782 256TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station,
257 AliMpPlaneType plane,
7f54909e 258 const TString& motifID)
5f91c9e8 259{
dee1d5f1 260/// Returns path to data file with pad dimensions for a given motif ID.
5f91c9e8 261
be2a6782 262 return TString(PlaneDataDir(station, plane)
263 + fgkMotifSpecialPrefix + motifID + fgkDataExt);
5f91c9e8 264
265}
266
267//______________________________________________________________________________
7f54909e 268TString AliMpFiles::BergToGCFilePath(AliMpStationType station)
5f91c9e8 269{
dee1d5f1 270/// Returns the path of the file which describes the correspondance between
271/// the berg number and the gassiplex channel.
5f91c9e8 272
d9100e8b 273 return GetTop() + fgkDataDir + StationDataDir(station)
be2a6782 274 + fgkBergToGCFileName + fgkDataExt;
5f91c9e8 275}
7f54909e 276
277//______________________________________________________________________________
278void
279AliMpFiles::SetTopPath(const TString& topPath)
280{
d9100e8b 281 GetTop() = topPath;
7f54909e 282}
283