1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // $MpId: AliMpFiles.cxx,v 1.12 2006/05/23 13:09:54 ivana Exp $
22 // Class for generating file names and paths.
24 // zones.dat, zones_special.dat - sector description
25 // motif*.dat - motif description (generated from Exceed)
26 // padPos*.dat - pad positions in motif
28 // Included in AliRoot: 2003/05/02
29 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
31 #include "AliMpFiles.h"
36 #include <Riostream.h>
47 // static data members
49 const TString AliMpFiles::fgkDataDir = "/data";
50 const TString AliMpFiles::fgkStationDir = "/station";
51 const TString AliMpFiles::fgkBendingDir = "/bending_plane/";
52 const TString AliMpFiles::fgkNonBendingDir = "/non-bending_plane/";
53 const TString AliMpFiles::fgkDENames = "denames";
54 const TString AliMpFiles::fgkSector = "zones";
55 const TString AliMpFiles::fgkSectorSpecial = "zones_special";
56 const TString AliMpFiles::fgkSectorSpecial2 = "zones_special_outer";
57 const TString AliMpFiles::fgkMotifPrefix = "motif";
58 const TString AliMpFiles::fgkMotifSpecialPrefix ="motifSpecial";
59 const TString AliMpFiles::fgkManuToSerial ="_manu";
60 const TString AliMpFiles::fgkPadPosPrefix = "padPos";
61 const TString AliMpFiles::fgkDataExt = ".dat";
62 const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
63 const TString AliMpFiles::fgkTriggerLocalBoards = "crate";
64 const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
66 //______________________________________________________________________________
67 AliMpFiles::~AliMpFiles()
76 //______________________________________________________________________________
77 TString AliMpFiles::GetTop()
79 /// Return top path to mapping data defined either via MINSTALL
80 /// or ALICE_ROOT environment variable. \n
81 /// If both variables are defined, MINSTALL is used.
83 TString top = getenv("MINSTALL");
84 if ( ! top.IsNull() ) return top;
86 TString ntop = getenv("ALICE_ROOT");
87 if ( ntop.IsNull() ) {
88 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
91 ntop += "/MUON/mapping";
95 //______________________________________________________________________________
96 TString AliMpFiles::PlaneDataDir(AliMpStationType station,
99 /// Returns path to data files with sector description
100 /// for a specified plane.
107 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
109 case kNonBendingPlane:
110 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
115 case kStationTrigger:
116 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
119 AliFatalClass("Incomplete switch on AliMpPlaneType");
125 //______________________________________________________________________________
126 TString AliMpFiles::StationDataDir(AliMpStationType station)
128 /// Returns the station directory name for the specified station number.
130 TString stationDataDir(fgkStationDir);
133 stationDataDir += "1/";
137 stationDataDir += "2/";
141 stationDataDir += "345/";
144 case kStationTrigger:
145 stationDataDir += "Trigger/";
149 stationDataDir += "Invalid/";
152 return stationDataDir;
159 //______________________________________________________________________________
160 TString AliMpFiles::BusPatchFilePath()
162 /// Return path to data file with bus patch mapping.
164 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
167 //______________________________________________________________________________
168 TString AliMpFiles::DENamesFilePath(AliMpStationType station)
170 /// Return path to data file with DE names for given station.
172 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
175 //______________________________________________________________________________
176 TString AliMpFiles::LocalTriggerBoardMapping()
178 /// Return path to data file with local trigger board mapping.
180 return GetTop() + fgkDataDir + StationDataDir(kStationTrigger)
181 + fgkTriggerLocalBoards + fgkDataExt;;
184 //_____________________________________________________________________________
185 TString AliMpFiles::SlatFilePath(AliMpStationType stationType,
186 const char* slatType,
187 AliMpPlaneType plane)
191 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
192 ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
195 //_____________________________________________________________________________
196 TString AliMpFiles::SlatPCBFilePath(AliMpStationType stationType,
199 /// Get the full path for a given PCB (only relevant to stations 3,
200 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
201 /// we use it to re-use the PlaneDataDir() method untouched.
203 return TString(PlaneDataDir(stationType,kNonBendingPlane) + pcbType +
207 //______________________________________________________________________________
208 TString AliMpFiles::SectorFilePath(AliMpStationType station,
209 AliMpPlaneType plane)
211 /// Return path to data file with sector description.
213 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
216 //______________________________________________________________________________
217 TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station,
218 AliMpPlaneType plane)
220 /// Return path to data file with sector special description (irregular motifs).
222 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
225 //______________________________________________________________________________
226 TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station,
227 AliMpPlaneType plane)
229 /// Returns path to data file with sector special description (irregular motifs).
231 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
234 //______________________________________________________________________________
235 TString AliMpFiles::MotifFilePath(AliMpStationType station,
236 AliMpPlaneType plane,
237 const TString& motifTypeID)
239 /// Returns path to data file for a given motif type.
241 return TString(PlaneDataDir(station, plane)
242 + fgkMotifPrefix + motifTypeID + fgkDataExt);
245 //______________________________________________________________________________
246 TString AliMpFiles::PadPosFilePath(AliMpStationType station,
247 AliMpPlaneType plane,
248 const TString& motifTypeID)
250 /// Returns path to data file with pad positions for a given motif type.
252 return TString(PlaneDataDir(station, plane)
253 + fgkPadPosPrefix + motifTypeID + fgkDataExt);
256 //______________________________________________________________________________
257 TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station,
258 AliMpPlaneType plane,
259 const TString& motifID)
261 /// Returns path to data file with pad dimensions for a given motif ID.
263 return TString(PlaneDataDir(station, plane)
264 + fgkMotifSpecialPrefix + motifID + fgkDataExt);
268 //______________________________________________________________________________
269 TString AliMpFiles::BergToGCFilePath(AliMpStationType station)
271 /// Returns the path of the file which describes the correspondance between
272 /// the berg number and the gassiplex channel.
274 return GetTop() + fgkDataDir + StationDataDir(station)
275 + fgkBergToGCFileName + fgkDataExt;
278 //______________________________________________________________________________
279 TString AliMpFiles::ManuToSerialPath(const TString& deName, AliMpStationType station)
281 /// Returns the path of the file for the manu id to their serial number
283 return GetTop() + fgkDataDir + StationDataDir(station)
284 + deName + fgkManuToSerial + fgkDataExt;
288 //______________________________________________________________________________
290 AliMpFiles::SetTopPath(const TString& topPath)