]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpFiles.cxx
Removing useless ifs
[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$
0025a53e 17// $MpId: AliMpFiles.cxx,v 1.6 2006/01/11 10:05:08 ivana Exp $
dee1d5f1 18// Category: basic
5f91c9e8 19//
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
d9100e8b 31#include <stdlib.h>
527e050d 32#include <Riostream.h>
5f91c9e8 33
34#include "AliMpFiles.h"
7f54909e 35#include "AliLog.h"
36#include "TClass.h"
5f91c9e8 37
38ClassImp(AliMpFiles)
39
7f54909e 40//
41// static
42
5f91c9e8 43// static data members
44
be2a6782 45const TString AliMpFiles::fgkDataDir = "/data";
46const TString AliMpFiles::fgkStationDir = "/station";
47const TString AliMpFiles::fgkBendingDir = "/bending_plane/";
48const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";
0025a53e 49const TString AliMpFiles::fgkDENames = "denames";
5f91c9e8 50const TString AliMpFiles::fgkSector = "zones";
51const TString AliMpFiles::fgkSectorSpecial = "zones_special";
be2a6782 52const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
5f91c9e8 53const TString AliMpFiles::fgkMotifPrefix = "motif";
54const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
55const TString AliMpFiles::fgkPadPosPrefix = "padPos";
56const TString AliMpFiles::fgkDataExt = ".dat";
7f54909e 57const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
58const TString AliMpFiles::fgkTriggerLocalBoards = "MUONLocalTriggerBoard";
4df2ac68 59const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
7f54909e 60
5f91c9e8 61//______________________________________________________________________________
62AliMpFiles::AliMpFiles()
7f54909e 63 : TObject()
5f91c9e8 64{
dee1d5f1 65/// Default constructor
5f91c9e8 66}
67
68//______________________________________________________________________________
be2a6782 69AliMpFiles::AliMpFiles(const AliMpFiles& right)
70 : TObject(right)
71{
dee1d5f1 72/// Protected copy constructor
73
7f54909e 74 AliFatalClass("Attempt to copy AliMpFiles singleton.");
5f91c9e8 75}
76
77
78//______________________________________________________________________________
dee1d5f1 79AliMpFiles::~AliMpFiles()
80{
81/// Destructor
5f91c9e8 82}
83
84// operators
85
86//______________________________________________________________________________
87AliMpFiles& AliMpFiles::operator=(const AliMpFiles& right)
88{
dee1d5f1 89/// Assignment operator
90
91 // check assignment to self
5f91c9e8 92 if (this == &right) return *this;
93
7f54909e 94 AliFatalClass("Attempt to assign AliMpFiles singleton.");
5f91c9e8 95
96 return *this;
97}
98
99//
100// private methods
101//
102
7f54909e 103//______________________________________________________________________________
d9100e8b 104TString AliMpFiles::GetTop()
7f54909e 105{
d9100e8b 106 TString top = getenv("MINSTALL");
527e050d 107 if ( ! top.IsNull() ) return top;
108
d9100e8b 109 TString ntop = getenv("ALICE_ROOT");
527e050d 110 if ( ntop.IsNull() ) {
111 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
112 return ntop;
113 }
114 ntop += "/MUON/mapping";
115 return ntop;
7f54909e 116}
117
5f91c9e8 118//______________________________________________________________________________
be2a6782 119TString AliMpFiles::PlaneDataDir(AliMpStationType station,
7f54909e 120 AliMpPlaneType plane)
5f91c9e8 121{
dee1d5f1 122/// Returns path to data files with sector description
123/// for a specified plane.
5f91c9e8 124
dee1d5f1 125 switch (station) {
126 case kStation1:
127 case kStation2:
128 switch (plane) {
5f91c9e8 129 case kBendingPlane:
d9100e8b 130 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
dee1d5f1 131 ;;
5f91c9e8 132 case kNonBendingPlane:
d9100e8b 133 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
dee1d5f1 134 ;;
135 }
136 break;
137 case kStation345:
7f54909e 138 case kStationTrigger:
d9100e8b 139 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
7f54909e 140 break;
141 default:
142 AliFatalClass("Incomplete switch on AliMpPlaneType");
dee1d5f1 143 break;
144 }
5f91c9e8 145 return TString();
146}
147
be2a6782 148//______________________________________________________________________________
7f54909e 149TString AliMpFiles::StationDataDir(AliMpStationType station)
be2a6782 150{
dee1d5f1 151/// Returns the station directory name for the specified station number.
be2a6782 152
153 TString stationDataDir(fgkStationDir);
154 switch (station) {
dee1d5f1 155 case kStation1:
0025a53e 156 stationDataDir += "1/";
dee1d5f1 157 break;
158 ;;
159 case kStation2:
0025a53e 160 stationDataDir += "2/";
dee1d5f1 161 break;
162 ;;
163 case kStation345:
164 stationDataDir += "345/";
165 break;
166 ;;
7f54909e 167 case kStationTrigger:
168 stationDataDir += "Trigger/";
169 break;
170 ;;
171 default:
172 stationDataDir += "Invalid/";
173 break;
be2a6782 174 }
175 return stationDataDir;
176}
177
5f91c9e8 178//
179// public methods
180//
181
4df2ac68 182//______________________________________________________________________________
183TString AliMpFiles::BusPatchFilePath()
184{
185/// Return path to data file with bus patch mapping.
186
d9100e8b 187 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
4df2ac68 188}
189
0025a53e 190//______________________________________________________________________________
191TString AliMpFiles::DENamesFilePath(AliMpStationType station)
192{
193/// Return path to data file with DE names for given station.
194
d9100e8b 195 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
0025a53e 196}
197
4df2ac68 198//______________________________________________________________________________
199TString AliMpFiles::LocalTriggerBoardMapping()
200{
201 return TString(PlaneDataDir(kStationTrigger,kNonBendingPlane)
202 + fgkTriggerLocalBoards
203 + fgkDataExt);
204}
205
dee1d5f1 206//_____________________________________________________________________________
7f54909e 207TString AliMpFiles::SlatFilePath(AliMpStationType stationType,
208 const char* slatType,
209 AliMpPlaneType plane)
dee1d5f1 210{
211/// \todo add ..
212
7f54909e 213 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
dee1d5f1 214 ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
215}
216
217//_____________________________________________________________________________
7f54909e 218TString AliMpFiles::SlatPCBFilePath(AliMpStationType stationType,
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
7f54909e 225 return TString(PlaneDataDir(stationType,kNonBendingPlane) + pcbType +
226 ".pcb");
dee1d5f1 227}
228
5f91c9e8 229//______________________________________________________________________________
be2a6782 230TString AliMpFiles::SectorFilePath(AliMpStationType station,
7f54909e 231 AliMpPlaneType 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//______________________________________________________________________________
239TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station,
7f54909e 240 AliMpPlaneType 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//______________________________________________________________________________
be2a6782 248TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station,
7f54909e 249 AliMpPlaneType 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}
255
256//______________________________________________________________________________
be2a6782 257TString AliMpFiles::MotifFilePath(AliMpStationType station,
258 AliMpPlaneType plane,
7f54909e 259 const TString& motifTypeID)
5f91c9e8 260{
dee1d5f1 261/// Returns path to data file for a given motif type.
5f91c9e8 262
be2a6782 263 return TString(PlaneDataDir(station, plane)
264 + fgkMotifPrefix + motifTypeID + fgkDataExt);
5f91c9e8 265}
266
267//______________________________________________________________________________
be2a6782 268TString AliMpFiles::PadPosFilePath(AliMpStationType station,
269 AliMpPlaneType plane,
7f54909e 270 const TString& motifTypeID)
5f91c9e8 271{
dee1d5f1 272/// Returns path to data file with pad positions for a given motif type.
5f91c9e8 273
be2a6782 274 return TString(PlaneDataDir(station, plane)
275 + fgkPadPosPrefix + motifTypeID + fgkDataExt);
5f91c9e8 276}
277
278//______________________________________________________________________________
be2a6782 279TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station,
280 AliMpPlaneType plane,
7f54909e 281 const TString& motifID)
5f91c9e8 282{
dee1d5f1 283/// Returns path to data file with pad dimensions for a given motif ID.
5f91c9e8 284
be2a6782 285 return TString(PlaneDataDir(station, plane)
286 + fgkMotifSpecialPrefix + motifID + fgkDataExt);
5f91c9e8 287
288}
289
290//______________________________________________________________________________
7f54909e 291TString AliMpFiles::BergToGCFilePath(AliMpStationType station)
5f91c9e8 292{
dee1d5f1 293/// Returns the path of the file which describes the correspondance between
294/// the berg number and the gassiplex channel.
5f91c9e8 295
d9100e8b 296 return GetTop() + fgkDataDir + StationDataDir(station)
be2a6782 297 + fgkBergToGCFileName + fgkDataExt;
5f91c9e8 298}
7f54909e 299
300//______________________________________________________________________________
301void
302AliMpFiles::SetTopPath(const TString& topPath)
303{
d9100e8b 304 GetTop() = topPath;
7f54909e 305}
306