]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliDAQ.cxx
reading RAW without data
[u/mrichter/AliRoot.git] / RAW / AliDAQ.cxx
index d79622c54d51421d16cd3888e1d3f28e3b7cf6ec..0b3087c769b7574b3d16620af749aefef6d6f407 100644 (file)
@@ -50,17 +50,17 @@ const char* AliDAQ::fgkDetectorName[AliDAQ::kNDetectors] = {
   "TPC",
   "TRD",
   "TOF",
-  "RICH",  // Name to be changed to HMPID
+  "HMPID",
   "PHOS",
   "CPV",
   "PMD",
   "MUONTRK",
   "MUONTRG",
   "FMD",
-  "START", // Name to be changed to T0
+  "T0",
   "VZERO", // Name to be changed to V0 ?
   "ZDC",
-  "CRT",   // Name to be changed to ACCORDE
+  "ACORDE",
   "TRG",
   "EMCAL",
   "HLT"
@@ -90,10 +90,10 @@ Int_t AliDAQ::fgkNumberOfDdls[AliDAQ::kNDetectors] = {
 };
 
 Float_t AliDAQ::fgkNumberOfLdcs[AliDAQ::kNDetectors] = {
-  36,
   4,
   4,
   4,
+  36,
   3,
   12,
   4,
@@ -108,7 +108,8 @@ Float_t AliDAQ::fgkNumberOfLdcs[AliDAQ::kNDetectors] = {
   1,
   1,
   1,
-  4
+  4,
+  5
 };
 
 AliDAQ::AliDAQ(const AliDAQ& source) :
@@ -178,30 +179,34 @@ Int_t AliDAQ::DdlIDOffset(Int_t detectorID)
   return (detectorID << 8);
 }
 
-const char *AliDAQ::DetectorNameFromDdlID(Int_t ddlID)
+const char *AliDAQ::DetectorNameFromDdlID(Int_t ddlID,Int_t &ddlIndex)
 {
   // Returns the detector name for
   // a given DDL ID
-  Int_t detectorID = DetectorIDFromDdlID(ddlID);
+  ddlIndex = -1;
+  Int_t detectorID = DetectorIDFromDdlID(ddlID,ddlIndex);
   if (detectorID < 0)
     return "";
 
   return DetectorName(detectorID);
 }
 
-Int_t AliDAQ::DetectorIDFromDdlID(Int_t ddlID)
+Int_t AliDAQ::DetectorIDFromDdlID(Int_t ddlID,Int_t &ddlIndex)
 {
-  // Returns the detector ID for
-  // a given DDL ID
+  // Returns the detector ID and
+  // the ddl index within the
+  // detector range for
+  // a given input DDL ID
   Int_t detectorID = ddlID >> 8;
   if (detectorID < 0 || detectorID >= kNDetectors) {
     AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
     return -1;
   }
-  Int_t ddlIndex = ddlID & 0xFF;
+  ddlIndex = ddlID & 0xFF;
   if (ddlIndex >= fgkNumberOfDdls[detectorID]) {
     AliErrorClass(Form("Invalid DDL index %d (%d -> %d) for detector %d",
                       ddlIndex,0,fgkNumberOfDdls[detectorID],detectorID));
+    ddlIndex = -1;
     return -1;
   }
   return detectorID;
@@ -238,6 +243,45 @@ Int_t AliDAQ::DdlID(Int_t detectorID, Int_t ddlIndex)
   return ddlID;
 }
 
+const char *AliDAQ::DdlFileName(const char *detectorName, Int_t ddlIndex)
+{
+  // Returns the DDL file name
+  // (used in the simulation) starting from
+  // the detector name and the DDL
+  // index inside the detector
+  Int_t detectorID = DetectorID(detectorName);
+  if (detectorID < 0)
+    return "";
+
+  return DdlFileName(detectorID,ddlIndex);
+}
+
+const char *AliDAQ::DdlFileName(Int_t detectorID, Int_t ddlIndex)
+{
+  // Returns the DDL file name
+  // (used in the simulation) starting from
+  // the detector ID and the DDL
+  // index inside the detector
+  Int_t ddlID = DdlIDOffset(detectorID);
+  if (ddlID < 0)
+    return "";
+  
+  if (ddlIndex >= fgkNumberOfDdls[detectorID]) {
+    AliErrorClass(Form("Invalid DDL index %d (%d -> %d) for detector %d",
+                      ddlIndex,0,fgkNumberOfDdls[detectorID],detectorID));
+    return "";
+  }
+
+  ddlID += ddlIndex;
+  static TString fileName;
+
+  fileName = DetectorName(detectorID);
+  fileName += "_";
+  fileName += ddlID;
+  fileName += ".ddl";
+  return fileName.Data();
+}
+
 Int_t AliDAQ::NumberOfDdls(const char *detectorName)
 {
   // Returns the number of DDLs for
@@ -283,3 +327,20 @@ Float_t AliDAQ::NumberOfLdcs(Int_t detectorID)
 
   return fgkNumberOfLdcs[detectorID];
 }
+
+void AliDAQ::PrintConfig()
+{
+  // Print the DAQ configuration
+  // for all the detectors
+  printf("====================================================================\n"
+        "|                ALICE Data Acquisition Configuration              |\n"
+        "====================================================================\n"
+        "| Detector ID | Detector Name | DDL Offset | # of DDLs | # of LDCs |\n"
+        "====================================================================\n");
+  for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
+    printf("|%11d  |%13s  |%10d  |%9d  |%9.1f  |\n",
+          iDet,DetectorName(iDet),DdlIDOffset(iDet),NumberOfDdls(iDet),NumberOfLdcs(iDet));
+  }
+  printf("====================================================================\n");
+
+}