]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliDAQ.cxx
renamed Cosmics folder to Cosmic
[u/mrichter/AliRoot.git] / RAW / AliDAQ.cxx
index 3107f1d27760559dae0793660d3f2a3229474e54..99f4521279a1b062cbb5afc033b558c2c72877f9 100644 (file)
@@ -50,19 +50,20 @@ 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",
+  "DAQ_TEST",
   "HLT"
 };
 
@@ -85,7 +86,8 @@ Int_t AliDAQ::fgkNumberOfDdls[AliDAQ::kNDetectors] = {
   1,
   1,
   1,
-  24,
+  46,
+  1,
   10
 };
 
@@ -100,7 +102,7 @@ Float_t AliDAQ::fgkNumberOfLdcs[AliDAQ::kNDetectors] = {
   4,
   2,
   1,
-  4,
+  5,
   1,
   1,
   0.5,
@@ -108,10 +110,59 @@ Float_t AliDAQ::fgkNumberOfLdcs[AliDAQ::kNDetectors] = {
   1,
   1,
   1,
-  4,
+  8,
+  1,
   5
 };
 
+const char* AliDAQ::fgkOfflineModuleName[AliDAQ::kNDetectors] = {
+  "ITS",
+  "ITS",
+  "ITS",
+  "TPC",
+  "TRD",
+  "TOF",
+  "HMPID",
+  "PHOS",
+  "CPV",
+  "PMD",
+  "MUON",
+  "MUON",
+  "FMD",
+  "T0",
+  "VZERO",
+  "ZDC",
+  "ACORDE",
+  "CTP",
+  "EMCAL",
+  "",
+  "HLT"
+};
+
+const char* AliDAQ::fgkOnlineName[AliDAQ::kNDetectors] = {
+  "SPD",
+  "SDD",
+  "SSD",
+  "TPC",
+  "TRD",
+  "TOF",
+  "HMP",
+  "PHS",
+  "CPV",
+  "PMD",
+  "MCH",
+  "MTR",
+  "FMD",
+  "T00",
+  "V00",
+  "ZDC",
+  "ACO",
+  "TRI",
+  "EMC",
+  "TST",
+  "HLT"
+};
+
 AliDAQ::AliDAQ(const AliDAQ& source) :
   TObject(source)
 {
@@ -176,6 +227,9 @@ Int_t AliDAQ::DdlIDOffset(Int_t detectorID)
     AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
     return -1;
   }
+  // HLT has a DDL offset = 30
+  if (detectorID == (kNDetectors-1)) return (kHLTId << 8);
+
   return (detectorID << 8);
 }
 
@@ -198,6 +252,10 @@ Int_t AliDAQ::DetectorIDFromDdlID(Int_t ddlID,Int_t &ddlIndex)
   // detector range for
   // a given input DDL ID
   Int_t detectorID = ddlID >> 8;
+
+  // HLT
+  if (detectorID == kHLTId) detectorID = kNDetectors-1;
+
   if (detectorID < 0 || detectorID >= kNDetectors) {
     AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
     return -1;
@@ -273,7 +331,9 @@ const char *AliDAQ::DdlFileName(Int_t detectorID, Int_t ddlIndex)
   }
 
   ddlID += ddlIndex;
-  TString fileName = DetectorName(detectorID);
+  static TString fileName;
+
+  fileName = DetectorName(detectorID);
   fileName += "_";
   fileName += ddlID;
   fileName += ".ddl";
@@ -330,15 +390,110 @@ 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");
+  printf("===================================================================================================\n"
+        "|                              ALICE Data Acquisition Configuration                               |\n"
+        "===================================================================================================\n"
+        "| Detector ID | Detector Name | DDL Offset | # of DDLs | # of LDCs | Online Name | AliRoot Module |\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("|%11d  |%13s  |%10d  |%9d  |%9.1f  |%11s  |%14s  |\n",
+          iDet,DetectorName(iDet),DdlIDOffset(iDet),NumberOfDdls(iDet),NumberOfLdcs(iDet),
+          OnlineName(iDet),OfflineModuleName(iDet));
+  }
+  printf("===================================================================================================\n");
+
+}
+
+const char *AliDAQ::ListOfTriggeredDetectors(UInt_t detectorPattern)
+{
+  // Returns a string with the list of
+  // active detectors. The input is the
+  // trigger pattern word contained in
+  // the raw-data event header.
+
+  static TString detList;
+  detList = "";
+  for(Int_t iDet = 0; iDet < (kNDetectors-1); iDet++) {
+    if ((detectorPattern >> iDet) & 0x1) {
+      detList += fgkDetectorName[iDet];
+      detList += " ";
+    }
+  }
+
+  // Always remember HLT
+  if ((detectorPattern >> kHLTId) & 0x1) detList += fgkDetectorName[kNDetectors-1];
+
+  return detList.Data();
+}
+
+UInt_t  AliDAQ::DetectorPattern(const char *detectorList)
+{
+  // Returns a 32-bit word containing the
+  // the detector pattern corresponding to a given
+  // list of detectors
+  UInt_t pattern = 0;
+  TString detList = detectorList;
+  for(Int_t iDet = 0; iDet < (kNDetectors-1); iDet++) {
+    TString det = fgkDetectorName[iDet];
+    if((detList.CompareTo(det) == 0) || 
+       detList.BeginsWith(det) ||
+       detList.EndsWith(det) ||
+       detList.Contains( " "+det+" " )) pattern |= (1 << iDet) ;
+  }
+
+  // HLT
+  TString hltDet = fgkDetectorName[kNDetectors-1];
+  if((detList.CompareTo(hltDet) == 0) || 
+       detList.BeginsWith(hltDet) ||
+       detList.EndsWith(hltDet) ||
+       detList.Contains( " "+hltDet+" " )) pattern |= (1 << kHLTId) ;
+  
+  return pattern;
+}
+
+const char *AliDAQ::OfflineModuleName(const char *detectorName)
+{
+  // Returns the name of the offline module
+  // for a given detector (online naming convention)
+  Int_t detectorID = DetectorID(detectorName);
+  if (detectorID < 0)
+    return "";
+
+  return OfflineModuleName(detectorID);
+}
+
+const char *AliDAQ::OfflineModuleName(Int_t detectorID)
+{
+  // Returns the name of the offline module
+  // for a given detector (online naming convention)
+  if (detectorID < 0 || detectorID >= kNDetectors) {
+    AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
+    return "";
   }
-  printf("====================================================================\n");
 
+  return fgkOfflineModuleName[detectorID];
+}
+
+const char *AliDAQ::OnlineName(const char *detectorName)
+{
+  // Returns the name of the online detector name (3 characters)
+  // for a given detector
+  Int_t detectorID = DetectorID(detectorName);
+  if (detectorID < 0)
+    return "";
+
+  return OnlineName(detectorID);
 }
+
+const char *AliDAQ::OnlineName(Int_t detectorID)
+{
+  // Returns the name of the online detector name (3 characters)
+  // for a given detector
+  if (detectorID < 0 || detectorID >= kNDetectors) {
+    AliErrorClass(Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1));
+    return "";
+  }
+
+  return fgkOnlineName[detectorID];
+}
+