]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliRecoParam.cxx
Removing the hard-wired particle masses (B. Hippolyte)
[u/mrichter/AliRoot.git] / STEER / AliRecoParam.cxx
index 00e3d3ce156b584cdabee1e8c01004d0e8ddab86..1425c390b3db415f58915fc9beec43f06ef39290 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "TObjArray.h"
+#include "TMath.h"
 #include "AliDetectorRecoParam.h"
 
 #include "AliLog.h"
 #include "AliRecoParam.h"
+#include "AliRunInfo.h"
+#include "AliEventInfo.h"
 
 ClassImp(AliRecoParam)
 
+TString AliRecoParam::fkgEventSpecieName[] = {"Default", "LowMultiplicity", "HighMultiplicity", "Cosmic", "Calibration", "Unknown"} ; 
+
 AliRecoParam::AliRecoParam(): 
   TObject(),
   fEventSpecie(kDefault)
@@ -54,17 +59,6 @@ AliRecoParam::AliRecoParam(const AliRecoParam& par) :
 {
   // copy constructor
   for(Int_t iDet = 0; iDet < kNDetectors; iDet++) {
-    //    fDetRecoParams[iDet] = new TObjArray;
-    //    for(Int_t i = 0; i < par.fDetRecoParams[iDet]->GetEntriesFast(); i++) {
-    //      if (!par.fDetRecoParams[iDet]->UncheckedAt(i)) {
-    // fDetRecoParams[iDet]->AddAt(NULL,i);
-    // continue;
-    //      }
-    //      fDetRecoParams[iDet]->AddAt(par.fDetRecoParams[iDet]->UncheckedAt(i)->Clone(),i);
-    //    }
-    //  }
-//    fDetRecoParams[iDet] = par.fDetRecoParams[iDet];
-//  }
     if (par.fDetRecoParams[iDet])
       fDetRecoParams[iDet] = (TObjArray*)(par.fDetRecoParams[iDet]->Clone());
     else
@@ -77,6 +71,18 @@ AliRecoParam::AliRecoParam(const AliRecoParam& par) :
   }
 }
 
+//_____________________________________________________________________________
+AliRecoParam& AliRecoParam::operator = (const AliRecoParam& par)
+{
+  // assignment operator
+
+  if(&par == this) return *this;
+
+  this->~AliRecoParam();
+  new(this) AliRecoParam(par);
+  return *this;
+}
+
 AliRecoParam::~AliRecoParam(){
   // Destructor
   // ...
@@ -89,6 +95,32 @@ AliRecoParam::~AliRecoParam(){
   }
 }
 
+Int_t AliRecoParam::AConvert(EventSpecie_t es)
+{
+  //Converts EventSpecie_t  into int
+  return static_cast<Int_t>(TMath::Log2(es)) ; 
+  
+}
+
+AliRecoParam::EventSpecie_t AliRecoParam::Convert(Int_t ies)
+{
+  //Converts int into EventSpecie_t
+  AliRecoParam::EventSpecie_t es = AliRecoParam::kDefault ; 
+  
+  Int_t i = (Int_t)TMath::Power(2, ies) ; 
+  
+  if ( i == AliRecoParam::kLowMult) 
+    es = kLowMult ; 
+  else if ( i == AliRecoParam::kHighMult) 
+    es = kHighMult ;   
+  else if ( i == AliRecoParam::kCosmic) 
+    es = kCosmic ;   
+  else if ( i == AliRecoParam::kCalib) 
+    es = kCalib ;   
+  
+  return es ;   
+}
+
 void  AliRecoParam::Print(Option_t *option) const {
   //
   // Print reconstruction setup
@@ -109,17 +141,110 @@ 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)
 {
   // To be implemented
   // Here we return always kDefault!!
+
   fEventSpecie = kDefault;
+
+  if (strcmp(runInfo->GetRunType(),"PHYSICS")) {
+    // Not a physics run, the event specie is set to kCalib
+    fEventSpecie = kCalib;
+    return;
+  }
+
+  if (strcmp(runInfo->GetLHCState(),"STABLE_BEAMS") == 0) {
+    // In case of stable beams
+//    if ((strcmp(runInfo->GetBeamType(),"A-A") == 0) ||
+//     (strcmp(runInfo->GetBeamType(),"A-") == 0) ||
+//     (strcmp(runInfo->GetBeamType(),"-A") == 0)) {
+      // Heavy ion run (any beam tha 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)) {
+      // Proton run, the event specie is set to kLowMult
+      fEventSpecie = kLowMult;
+    }
+    else if (strcmp(runInfo->GetBeamType(),"-") == 0) {
+      // 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;
+    }
+
+    TString triggerClasses = evInfo.GetTriggerClasses();
+    TObjArray* trClassArray = triggerClasses.Tokenize(" ");
+    Int_t nTrClasses = trClassArray->GetEntriesFast();
+    Bool_t cosmicTrigger = kFALSE,
+      laserTrigger = kFALSE,
+      highMultTrigger = 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;
+      }
+      else if (trClass.BeginsWith("C0SH")) {
+       // High-multiplicity SPD trugger
+       // Have to add other high-mult triggers here...
+       highMultTrigger = kTRUE;
+      }
+      else {
+       otherTrigger = kTRUE;
+      }
+    }
+
+    if (laserTrigger) {
+      fEventSpecie = kCalib;
+      return;
+    }
+    if (cosmicTrigger && !highMultTrigger && !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
 {
   // Return AliDetectorRecoParam object for a given detector
   // according to the event specie provided as an argument
+  if ( iDet >= kNDetectors) return NULL;
   if (!fDetRecoParams[iDet]) return NULL;
   if (fDetRecoParams[iDet]->GetEntries() == 0) return NULL;
 
@@ -178,3 +303,61 @@ Bool_t AliRecoParam::AddDetRecoParamArray(Int_t iDet, TObjArray* parArray)
 
   return defaultFound;
 }
+
+const char*  AliRecoParam::PrintEventSpecie() const
+{
+  // Print the current
+  // event specie
+  switch (fEventSpecie) {
+  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(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() ;
+}