]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALTriggerDCSConfigDB.cxx
Adding options to count false decisions also.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTriggerDCSConfigDB.cxx
index f2c26756e3a78984122469fce1e8c38846df26f1..525adfa8b0c76dd3114493b0ec0577c25ea5cce2 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+/*
+
+
+
+
+Adapted from TRD
+Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
+*/
+
 #include <TClonesArray.h>
 #include <TObjArray.h>
 
@@ -134,26 +143,11 @@ const TObject *AliEMCALTriggerDCSConfigDB::GetCachedCDBObject(Int_t id)
        // Retrieves a cdb object with the given id. The objects are cached as
        // long as the run number is not changed.
        //
-       // Put together the available objects here by using the lines
-       //   a) For usual calibration objects:
-       //      case kID<Name> : 
-       //        return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>"); 
-       //        break;
-       //      See function CacheCDBEntry for details.
-       //   and
-       //   b) For calibration data which depends on two objects: One containing 
-       //      a value per detector and one the local fluctuations per pad:
-       //      case kID<Name> :
-       //        return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>"); 
-       //        break;
-       //      See function CacheMergeCDBEntry for details.
-       //
-    
        switch (id) 
        {
                // Parameters defined per pad and chamber
                case kIDTriggerConfig : 
-                       return CacheCDBEntry(kIDTriggerConfig, "EMCAL/Config/Trigger"); 
+                       return CacheCDBEntry(kIDTriggerConfig, "EMCAL/Calib/Trigger"); 
                        break;
                default:                        
                        AliError("Object not found!");
@@ -253,29 +247,63 @@ const AliEMCALTriggerDCSConfig* AliEMCALTriggerDCSConfigDB::GetTriggerDCSConfig(
 }
 
 //_____________________________________________________________________________
-void AliEMCALTriggerDCSConfigDB::GetSTUSegmentation(Int_t ss[], Int_t sp[])
+void AliEMCALTriggerDCSConfigDB::GetSTUSegmentation(Int_t ssg[], Int_t spg[], Int_t ssj[], Int_t spj[])
 {
        //
        //
        //
        const AliEMCALTriggerDCSConfig* dcsConf = dynamic_cast<const AliEMCALTriggerDCSConfig*>(GetCachedCDBObject(kIDTriggerConfig));
+  if(dcsConf){
+    AliEMCALTriggerSTUDCSConfig* stuConf = dcsConf->GetSTUDCSConfig();
+    if(stuConf){
+      Int_t fw = stuConf->GetFw();
+      
+      switch ( fw )
+      {
+        case 2223:
+          ssg[0] = 1;
+          ssg[1] = 1;
+          spg[0] = 2;
+          spg[1] = 2;
+          
+          ssj[0] = 4;
+          ssj[1] = 4;
+          spj[0] = 2;
+          spj[1] = 2;
+          break;
+        default:
+          AliError("Firmware version do not match!");
+          break;
+      }
+    }
+    else {
+      AliError("STUDCSConfig is null!");
+    }
+  }
+  else {
+    AliError("DCSConfig is null!");
+  }
+  
+}
 
-       AliEMCALTriggerSTUDCSConfig* stuConf = dcsConf->GetSTUDCSConfig();
-       
-       Int_t fw = stuConf->GetFw();
+//_____________________________________________________________________________
+Int_t AliEMCALTriggerDCSConfigDB::GetTRUSegmentation(Int_t iTRU)
+{
+       //
+       const AliEMCALTriggerDCSConfig* dcsConf = dynamic_cast<const AliEMCALTriggerDCSConfig*>(GetCachedCDBObject(kIDTriggerConfig));
+  if(dcsConf){ 
+    AliEMCALTriggerTRUDCSConfig* truConf = dcsConf->GetTRUDCSConfig(iTRU);
+    if(truConf){
+      Int_t sel = truConf->GetL0SEL();
        
-       switch ( fw )
-       {
-               case 2223:
-                       ss[0] = 4;
-                       ss[1] = 4;
-                       sp[0] = 2;
-                       sp[1] = 2;
-                       break;
-               default:
-                       AliError("Firmware version do not match!");
-                       break;
-       }
+      if (sel & 0x0001)
+        return 2;
+      else
+        return 1;
+    } else AliError("TRUDCSConf Null!") ;
+  }else AliError("TriggerDCSConf Null!") ;
+  
+  return -1;
 }
 
 //_____________________________________________________________________________
@@ -285,8 +313,12 @@ Int_t AliEMCALTriggerDCSConfigDB::GetTRUGTHRL0(Int_t iTRU)
        //
        //
        const AliEMCALTriggerDCSConfig* dcsConf = dynamic_cast<const AliEMCALTriggerDCSConfig*>(GetCachedCDBObject(kIDTriggerConfig));
-       
-       AliEMCALTriggerTRUDCSConfig* truConf = dcsConf->GetTRUDCSConfig(iTRU);
-       
-       return truConf->GetGTHRL0();
+  if(dcsConf){ 
+    AliEMCALTriggerTRUDCSConfig* truConf = dcsConf->GetTRUDCSConfig(iTRU);
+    if(truConf){
+      return truConf->GetGTHRL0();
+    } else AliError("TRUDCSConf Null!") ;
+  }else AliError("TriggerDCSConf Null!") ;
+  
+  return -1;
 }