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