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 **************************************************************************/
16 //////////////////////////////////////////////////////////////////////////////
18 // The AliDAQ class is responsible for handling all the information about //
19 // Data Acquisition configuration. It defines the detector indexing, //
20 // the number of DDLs and LDCs per detector. //
21 // The number of LDCs per detector is used only in the simulation in order //
22 // to define the configuration of the dateStream application. Therefore the //
23 // numbers in the corresponding array can be changed without affecting the //
24 // rest of the aliroot code. //
25 // The equipment ID (DDL ID) is an integer (32-bit) number defined as: //
26 // Equipment ID = (detectorID << 8) + DDLIndex //
27 // where the detectorID is given by fgkDetectorName array and DDLIndex is //
28 // the index of the corresponding DDL inside the detector partition. //
29 // Due to DAQ/HLT limitations, the ddl indexes should be consequtive, or //
30 // at least without big gaps in between. //
31 // The sub-detector code use only this class in the simulation and reading //
32 // of the raw data. //
34 // cvetan.cheshkov@cern.ch 2006/06/09 //
36 //////////////////////////////////////////////////////////////////////////////
46 const char* AliDAQ::fgkDetectorName[AliDAQ::kNDetectors] = {
53 "RICH", // Name to be changed to HMPID
60 "START", // Name to be changed to T0
61 "VZERO", // Name to be changed to V0 ?
63 "CRT", // Name to be changed to ACCORDE
69 Int_t AliDAQ::fgkNumberOfDdls[AliDAQ::kNDetectors] = {
92 Float_t AliDAQ::fgkNumberOfLdcs[AliDAQ::kNDetectors] = {
114 AliDAQ::AliDAQ(const AliDAQ& source) :
118 // Nothing to be done
121 AliDAQ& AliDAQ::operator = (const AliDAQ& /* source */)
123 // Assignment operator
124 // Nothing to be done
128 Int_t AliDAQ::DetectorID(const char *detectorName)
130 // Return the detector index
131 // corresponding to a given
133 TString detStr = detectorName;
136 for(iDet = 0; iDet < kNDetectors; iDet++) {
137 if (detStr.CompareTo(fgkDetectorName[iDet],TString::kIgnoreCase) == 0)
140 if (iDet == kNDetectors) {
141 AliErrorClass(Form("Invalid detector name: %s !",detectorName));
147 const char *AliDAQ::DetectorName(Int_t detectorID)
149 // Returns the name of particular
150 // detector identified by its index
151 if (detectorID < 0 || detectorID >= kNDetectors) {
152 AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
155 return fgkDetectorName[detectorID];
158 Int_t AliDAQ::DdlIDOffset(const char *detectorName)
160 // Returns the DDL ID offset
161 // for a given detector
162 Int_t detectorID = DetectorID(detectorName);
166 return DdlIDOffset(detectorID);
169 Int_t AliDAQ::DdlIDOffset(Int_t detectorID)
171 // Returns the DDL ID offset
172 // for a given detector identified
174 if (detectorID < 0 || detectorID >= kNDetectors) {
175 AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
178 return (detectorID << 8);
181 const char *AliDAQ::DetectorNameFromDdlID(Int_t ddlID)
183 // Returns the detector name for
185 Int_t detectorID = DetectorIDFromDdlID(ddlID);
189 return DetectorName(detectorID);
192 Int_t AliDAQ::DetectorIDFromDdlID(Int_t ddlID)
194 // Returns the detector ID for
196 Int_t detectorID = ddlID >> 8;
197 if (detectorID < 0 || detectorID >= kNDetectors) {
198 AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
201 Int_t ddlIndex = ddlID & 0xFF;
202 if (ddlIndex >= fgkNumberOfDdls[detectorID]) {
203 AliErrorClass(Form("Invalid DDL index %d (%d -> %d) for detector %d",
204 ddlIndex,0,fgkNumberOfDdls[detectorID],detectorID));
210 Int_t AliDAQ::DdlID(const char *detectorName, Int_t ddlIndex)
212 // Returns the DDL ID starting from
213 // the detector name and the DDL
214 // index inside the detector
215 Int_t detectorID = DetectorID(detectorName);
219 return DdlID(detectorID,ddlIndex);
222 Int_t AliDAQ::DdlID(Int_t detectorID, Int_t ddlIndex)
224 // Returns the DDL ID starting from
225 // the detector ID and the DDL
226 // index inside the detector
227 Int_t ddlID = DdlIDOffset(detectorID);
231 if (ddlIndex >= fgkNumberOfDdls[detectorID]) {
232 AliErrorClass(Form("Invalid DDL index %d (%d -> %d) for detector %d",
233 ddlIndex,0,fgkNumberOfDdls[detectorID],detectorID));
241 Int_t AliDAQ::NumberOfDdls(const char *detectorName)
243 // Returns the number of DDLs for
245 Int_t detectorID = DetectorID(detectorName);
249 return NumberOfDdls(detectorID);
252 Int_t AliDAQ::NumberOfDdls(Int_t detectorID)
254 // Returns the number of DDLs for
256 if (detectorID < 0 || detectorID >= kNDetectors) {
257 AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
261 return fgkNumberOfDdls[detectorID];
264 Float_t AliDAQ::NumberOfLdcs(const char *detectorName)
266 // Returns the number of DDLs for
268 Int_t detectorID = DetectorID(detectorName);
272 return NumberOfLdcs(detectorID);
275 Float_t AliDAQ::NumberOfLdcs(Int_t detectorID)
277 // Returns the number of DDLs for
279 if (detectorID < 0 || detectorID >= kNDetectors) {
280 AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
284 return fgkNumberOfLdcs[detectorID];