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::fgkPadPosPrefix = "padPos";
60 const TString AliMpFiles::fgkDataExt = ".dat";
61 const TString AliMpFiles::fgkBergToGCFileName = "/bergToGC";
62 const TString AliMpFiles::fgkTriggerLocalBoards = "crate";
63 const TString AliMpFiles::fgkBusPatchFileName = "DetElemIdToBusPatch";
65 //______________________________________________________________________________
66 AliMpFiles::~AliMpFiles()
75 //______________________________________________________________________________
76 TString AliMpFiles::GetTop()
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.
82 TString top = getenv("MINSTALL");
83 if ( ! top.IsNull() ) return top;
85 TString ntop = getenv("ALICE_ROOT");
86 if ( ntop.IsNull() ) {
87 AliErrorClassStream() << "Cannot find path to mapping data." << endl;
90 ntop += "/MUON/mapping";
94 //______________________________________________________________________________
95 TString AliMpFiles::PlaneDataDir(AliMpStationType station,
98 /// Returns path to data files with sector description
99 /// for a specified plane.
106 return GetTop() + fgkDataDir + StationDataDir(station) + fgkBendingDir;
108 case kNonBendingPlane:
109 return GetTop() + fgkDataDir + StationDataDir(station) + fgkNonBendingDir;
114 case kStationTrigger:
115 return GetTop() + fgkDataDir + StationDataDir(station) + "/";
118 AliFatalClass("Incomplete switch on AliMpPlaneType");
124 //______________________________________________________________________________
125 TString AliMpFiles::StationDataDir(AliMpStationType station)
127 /// Returns the station directory name for the specified station number.
129 TString stationDataDir(fgkStationDir);
132 stationDataDir += "1/";
136 stationDataDir += "2/";
140 stationDataDir += "345/";
143 case kStationTrigger:
144 stationDataDir += "Trigger/";
148 stationDataDir += "Invalid/";
151 return stationDataDir;
158 //______________________________________________________________________________
159 TString AliMpFiles::BusPatchFilePath()
161 /// Return path to data file with bus patch mapping.
163 return GetTop() + fgkDataDir + "/" + fgkBusPatchFileName + fgkDataExt;
166 //______________________________________________________________________________
167 TString AliMpFiles::DENamesFilePath(AliMpStationType station)
169 /// Return path to data file with DE names for given station.
171 return GetTop() + fgkDataDir + StationDataDir(station) + fgkDENames + fgkDataExt;
174 //______________________________________________________________________________
175 TString AliMpFiles::LocalTriggerBoardMapping()
177 /// Return path to data file with local trigger board mapping.
179 return GetTop() + fgkDataDir + StationDataDir(kStationTrigger)
180 + fgkTriggerLocalBoards + fgkDataExt;;
183 //_____________________________________________________________________________
184 TString AliMpFiles::SlatFilePath(AliMpStationType stationType,
185 const char* slatType,
186 AliMpPlaneType plane)
190 return TString(PlaneDataDir(stationType,plane) + slatType + "." +
191 ( plane == kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
194 //_____________________________________________________________________________
195 TString AliMpFiles::SlatPCBFilePath(AliMpStationType stationType,
198 /// Get the full path for a given PCB (only relevant to stations 3,
199 /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
200 /// we use it to re-use the PlaneDataDir() method untouched.
202 return TString(PlaneDataDir(stationType,kNonBendingPlane) + pcbType +
206 //______________________________________________________________________________
207 TString AliMpFiles::SectorFilePath(AliMpStationType station,
208 AliMpPlaneType plane)
210 /// Return path to data file with sector description.
212 return TString(PlaneDataDir(station, plane) + fgkSector + fgkDataExt);
215 //______________________________________________________________________________
216 TString AliMpFiles::SectorSpecialFilePath(AliMpStationType station,
217 AliMpPlaneType plane)
219 /// Return path to data file with sector special description (irregular motifs).
221 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial + fgkDataExt);
224 //______________________________________________________________________________
225 TString AliMpFiles::SectorSpecialFilePath2(AliMpStationType station,
226 AliMpPlaneType plane)
228 /// Returns path to data file with sector special description (irregular motifs).
230 return TString(PlaneDataDir(station, plane) + fgkSectorSpecial2 + fgkDataExt);
233 //______________________________________________________________________________
234 TString AliMpFiles::MotifFilePath(AliMpStationType station,
235 AliMpPlaneType plane,
236 const TString& motifTypeID)
238 /// Returns path to data file for a given motif type.
240 return TString(PlaneDataDir(station, plane)
241 + fgkMotifPrefix + motifTypeID + fgkDataExt);
244 //______________________________________________________________________________
245 TString AliMpFiles::PadPosFilePath(AliMpStationType station,
246 AliMpPlaneType plane,
247 const TString& motifTypeID)
249 /// Returns path to data file with pad positions for a given motif type.
251 return TString(PlaneDataDir(station, plane)
252 + fgkPadPosPrefix + motifTypeID + fgkDataExt);
255 //______________________________________________________________________________
256 TString AliMpFiles::MotifSpecialFilePath(AliMpStationType station,
257 AliMpPlaneType plane,
258 const TString& motifID)
260 /// Returns path to data file with pad dimensions for a given motif ID.
262 return TString(PlaneDataDir(station, plane)
263 + fgkMotifSpecialPrefix + motifID + fgkDataExt);
267 //______________________________________________________________________________
268 TString AliMpFiles::BergToGCFilePath(AliMpStationType station)
270 /// Returns the path of the file which describes the correspondance between
271 /// the berg number and the gassiplex channel.
273 return GetTop() + fgkDataDir + StationDataDir(station)
274 + fgkBergToGCFileName + fgkDataExt;
277 //______________________________________________________________________________
279 AliMpFiles::SetTopPath(const TString& topPath)