]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliRecoParam.cxx
orrection in order to get the cosmic event specie properly set. Only lowMult and...
[u/mrichter/AliRoot.git] / STEER / AliRecoParam.cxx
index 77d06fd4fb4c9c6e44c6276dd7585c40849de397..3f6f646df2a8a990710da614f188b7807f5f3d00 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include "TClass.h"
 #include "TObjArray.h"
+#include "TMath.h"
+#include "THashTable.h"
 #include "AliDetectorRecoParam.h"
 
 #include "AliLog.h"
 #include "AliRecoParam.h"
 #include "AliRunInfo.h"
 #include "AliEventInfo.h"
+#include "AliLog.h"
 
 ClassImp(AliRecoParam)
 
+TString AliRecoParam::fkgEventSpecieName[] = {"Default", "LowMultiplicity", "HighMultiplicity", "Cosmic", "Calibration", "Unknown"} ; 
+
 AliRecoParam::AliRecoParam(): 
   TObject(),
   fEventSpecie(kDefault)
@@ -92,6 +98,78 @@ AliRecoParam::~AliRecoParam(){
   }
 }
 
+Int_t AliRecoParam::AConvert(EventSpecie_t es)
+{
+  //Converts EventSpecie_t  into int
+  Int_t rv = -1 ; 
+  switch (es) {
+    case kDefault:
+      rv = 0 ; 
+      break;
+    case kLowMult:
+      rv = 1 ; 
+      break;
+    case kHighMult:
+      rv = 2 ; 
+      break;
+    case kCosmic:
+      rv = 3 ; 
+      break;
+    case kCalib:
+      rv = 4 ; 
+      break;
+    default:
+      break;
+  }
+
+  if (rv < 0) 
+    AliFatalClass(Form("Wrong event specie conversion %d", es)) ; 
+
+  return rv ;
+}
+
+AliRecoParam::EventSpecie_t AliRecoParam::Convert(Int_t ies)
+{
+  //Converts int into EventSpecie_t
+  AliRecoParam::EventSpecie_t es = kDefault ; 
+  if ( ies >> 1) 
+    es = kLowMult ; 
+  if ( ies >> 2) 
+    es = kHighMult ;   
+  if ( ies >> 3) 
+    es = kCosmic ;   
+  if ( ies >> 4) 
+    es = kCalib ;
+
+  return es ;   
+}
+
+AliRecoParam::EventSpecie_t AliRecoParam::ConvertIndex(Int_t index)
+{
+  //Converts index of lists into eventspecie
+  EventSpecie_t es = kDefault ; 
+  switch (index) {
+    case 0:
+      es = kDefault ; 
+      break;
+    case 1:
+      es = kLowMult ; 
+      break;
+    case 2:
+      es = kHighMult ;   
+      break;
+    case 3:
+      es = kCosmic ;   
+      break;
+    case 4:
+      es = kCalib ;
+      break;
+    default:
+      break;
+  }
+  return es ;
+}
+
 void  AliRecoParam::Print(Option_t *option) const {
   //
   // Print reconstruction setup
@@ -112,10 +190,11 @@ void  AliRecoParam::Print(Option_t *option) const {
   }
 }
 
-void AliRecoParam::SetEventSpecie(const AliRunInfo *runInfo, const AliEventInfo &evInfo)
+void AliRecoParam::SetEventSpecie(const AliRunInfo *runInfo, const AliEventInfo &evInfo,
+                                 const THashTable *cosmicTriggersList)
 {
-  // To be implemented
-  // Here we return always kDefault!!
+  // Implemented according to the discussions
+  // and meetings with physics and trigger coordination
 
   fEventSpecie = kDefault;
 
@@ -125,20 +204,27 @@ void AliRecoParam::SetEventSpecie(const AliRunInfo *runInfo, const AliEventInfo
     return;
   }
 
-  if (strcmp(runInfo->GetLHCState(),"STABLE_BEAMS") == 0) {
-    // In case of stable beams
-    if ((strcmp(runInfo->GetBeamType(),"A-A") == 0) ||
+  // Special DAQ events considered as calibration events
+  if (evInfo.GetEventType() != 7) {
+    // START_OF_*, END_OF_*, CALIBRATION etc events
+    fEventSpecie = kCalib;
+    return;
+  }
+
+    if ((strcmp(runInfo->GetLHCState(),"STABLE_BEAMS") == 0) &&
+       ((strcmp(runInfo->GetBeamType(),"A-A") == 0) ||
        (strcmp(runInfo->GetBeamType(),"A-") == 0) ||
-       (strcmp(runInfo->GetBeamType(),"-A") == 0)) {
-      // Heavy ion run, the event specie is set to kHighMult
+       (strcmp(runInfo->GetBeamType(),"-A") == 0))) {
+      // Heavy ion run (any beam that is not pp, the event specie is set to kHighMult
       fEventSpecie = kHighMult;
     }
-    else if ((strcmp(runInfo->GetBeamType(),"p-p") == 0) ||
-            (strcmp(runInfo->GetBeamType(),"p-") == 0) ||
-            (strcmp(runInfo->GetBeamType(),"-p") == 0) ||
-            (strcmp(runInfo->GetBeamType(),"P-P") == 0) ||
-            (strcmp(runInfo->GetBeamType(),"P-") == 0) ||
-            (strcmp(runInfo->GetBeamType(),"-P") == 0)) {
+    else if ((strcmp(runInfo->GetLHCState(),"STABLE_BEAMS") == 0) &&
+            ((strcmp(runInfo->GetBeamType(),"p-p") == 0) ||
+             (strcmp(runInfo->GetBeamType(),"p-") == 0) ||
+             (strcmp(runInfo->GetBeamType(),"-p") == 0) ||
+             (strcmp(runInfo->GetBeamType(),"P-P") == 0) ||
+             (strcmp(runInfo->GetBeamType(),"P-") == 0) ||
+             (strcmp(runInfo->GetBeamType(),"-P") == 0))) {
       // Proton run, the event specie is set to kLowMult
       fEventSpecie = kLowMult;
     }
@@ -146,68 +232,53 @@ void AliRecoParam::SetEventSpecie(const AliRunInfo *runInfo, const AliEventInfo
       // No beams, we assume cosmic data
       fEventSpecie = kCosmic;
     }
-    else if (strcmp(runInfo->GetBeamType(),"UNKNOWN") == 0) {
-      // No LHC beam information is available, we the default
-      // event specie
-      fEventSpecie = kDefault;
-    }
 
     // Now we look into the trigger type in order to decide
     // on the remaining cases (cosmic event within LHC run,
-    // high-mult event based on high-mult SPD trigger
-    // within p-p run, laser triggers within physics run,
-    // special DAQ events considered as calibration etc...)
-    if (evInfo.GetEventType() != 7) {
-      // START_OF_*, END_OF_*, CALIBRATION etc events
-      fEventSpecie = kCalib;
-    }
-
+    // calibration, for example TPC laser, triggers within physics run
     TString triggerClasses = evInfo.GetTriggerClasses();
     TObjArray* trClassArray = triggerClasses.Tokenize(" ");
     Int_t nTrClasses = trClassArray->GetEntriesFast();
     Bool_t cosmicTrigger = kFALSE,
-      laserTrigger = kFALSE,
-      highMultTrigger = kFALSE,
+      calibTrigger = kFALSE,
       otherTrigger = kFALSE;
     for( Int_t i=0; i<nTrClasses; ++i ) {
       TString trClass = ((TObjString*)trClassArray->At(i))->String();
-      if (trClass.BeginsWith("C0A") ||
-         trClass.BeginsWith("C0SC") ||
-         trClass.BeginsWith("C0OC")) {
-      // ACORDE/SPD/TOF cosmic trigger, so we have cosmic event
-      // not always true, but we don't have a better idea...
-       cosmicTrigger = kTRUE;
-      }
-      else if (trClass.BeginsWith("C0LSR")) {
-       // Laser trigger
-       laserTrigger = kTRUE;
+
+      if (trClass.BeginsWith("C0L")) {
+       // Calibration triggers always start with C0L
+       calibTrigger = kTRUE;
+       continue;
       }
-      else if (trClass.BeginsWith("C0SH")) {
-       // High-multiplicity SPD trugger
-       // Have to add other high-mult triggers here...
-       highMultTrigger = kTRUE;
+
+      if (cosmicTriggersList) {
+       if (cosmicTriggersList->FindObject(trClass.Data())) {
+         // Cosmic trigger accorind to the table
+         // provided in OCDB
+         cosmicTrigger = kTRUE;
+         AliDebug(1,Form("Trigger %s identified as cosmic according to the list defined in OCDB.",
+                         trClass.Data()));
+         continue;
+       }
       }
       else {
-       otherTrigger = kTRUE;
+       AliDebug(1,"Cosmic trigger list is not provided, cosmic event specie is effectively disabled!");
       }
+
+      otherTrigger = kTRUE;
     }
 
-    if (laserTrigger) {
+    if (calibTrigger) {
       fEventSpecie = kCalib;
       return;
     }
-    if (cosmicTrigger && !highMultTrigger && !otherTrigger) {
+    if (cosmicTrigger && !otherTrigger) {
       fEventSpecie = kCosmic;
       return;
     }
-    if (highMultTrigger) {
-      fEventSpecie = kHighMult;
-      return;
-    }
 
     // Here we have to add if we have other cases
     // and also HLT info if any...
-  }
 }
 
 const AliDetectorRecoParam *AliRecoParam::GetDetRecoParam(Int_t iDet) const
@@ -280,22 +351,54 @@ const char*  AliRecoParam::PrintEventSpecie() const
   // event specie
   switch (fEventSpecie) {
   case kDefault:
-    return "Default";
+    return fkgEventSpecieName[0].Data() ;
     break;
   case kLowMult:
-    return "Low-multiplicity";
+    return fkgEventSpecieName[1].Data() ;
     break;
   case kHighMult:
-    return "High-multiplicity";
+    return fkgEventSpecieName[2].Data() ;
     break;
   case kCosmic:
-    return "Cosmic";
+    return fkgEventSpecieName[3].Data() ;
     break;
   case kCalib:
-    return "Calibration";
+    return fkgEventSpecieName[4].Data() ;
     break;
   default:
-    return "Unknown";
+    return fkgEventSpecieName[5].Data() ;
     break;
   }
 }
+
+const char * AliRecoParam::GetEventSpecieName(EventSpecie_t es)
+{
+  switch (es) {
+    case kDefault:
+      return fkgEventSpecieName[0].Data() ;
+      break;
+    case kLowMult:
+      return fkgEventSpecieName[1].Data() ;
+      break;
+    case kHighMult:
+      return fkgEventSpecieName[2].Data() ;
+      break;
+    case kCosmic:
+      return fkgEventSpecieName[3].Data() ;
+      break;
+    case kCalib:
+      return fkgEventSpecieName[4].Data() ;
+      break;
+    default:
+      return fkgEventSpecieName[5].Data() ;
+      break;
+  }
+}
+
+const char * AliRecoParam::GetEventSpecieName(Int_t esIndex)
+{
+  if ( esIndex >= 0 && esIndex < kNSpecies) 
+    return fkgEventSpecieName[esIndex].Data() ;
+  else 
+    return fkgEventSpecieName[kNSpecies].Data() ;
+}