/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /////////////////////////////////////////////////////////////////////////////// // // // ALICE Reconstruction parameterization: // // // // // // Base Class for Detector reconstruction parameters // // Revision: cvetan.cheshkov@cern.ch 12/06/2008 // // Its structure has been revised and it is interfaced to AliEventInfo. // // // /////////////////////////////////////////////////////////////////////////////// #include "TObjArray.h" #include "AliDetectorRecoParam.h" #include "AliLog.h" #include "AliRecoParam.h" #include "AliRunInfo.h" #include "AliEventInfo.h" ClassImp(AliRecoParam) AliRecoParam::AliRecoParam(): TObject(), fEventSpecie(kDefault) { // Default constructor // ... for(Int_t iDet = 0; iDet < kNDetectors; iDet++) fDetRecoParams[iDet] = NULL; for(Int_t iSpecie = 0; iSpecie < kNSpecies; iSpecie++) { for(Int_t iDet = 0; iDet < kNDetectors; iDet++) { fDetRecoParamsIndex[iSpecie][iDet] = -1; } } } AliRecoParam::AliRecoParam(const AliRecoParam& par) : TObject(), fEventSpecie(par.fEventSpecie) { // copy constructor for(Int_t iDet = 0; iDet < kNDetectors; iDet++) { if (par.fDetRecoParams[iDet]) fDetRecoParams[iDet] = (TObjArray*)(par.fDetRecoParams[iDet]->Clone()); else fDetRecoParams[iDet] = NULL; } for(Int_t iSpecie = 0; iSpecie < kNSpecies; iSpecie++) { for(Int_t iDet = 0; iDet < kNDetectors; iDet++) { fDetRecoParamsIndex[iSpecie][iDet] = par.fDetRecoParamsIndex[iSpecie][iDet]; } } } //_____________________________________________________________________________ AliRecoParam& AliRecoParam::operator = (const AliRecoParam& par) { // assignment operator if(&par == this) return *this; this->~AliRecoParam(); new(this) AliRecoParam(par); return *this; } AliRecoParam::~AliRecoParam(){ // Destructor // ... // Delete the array with the reco-param objects for(Int_t iDet = 0; iDet < kNDetectors; iDet++) { if (fDetRecoParams[iDet]){ fDetRecoParams[iDet]->Delete(); delete fDetRecoParams[iDet]; } } } void AliRecoParam::Print(Option_t *option) const { // // Print reconstruction setup // for(Int_t iDet = 0; iDet < kNDetectors; iDet++) { if (fDetRecoParams[iDet]){ printf("AliDetectorRecoParam objects for detector %d:\n",iDet); Int_t nparam = fDetRecoParams[iDet]->GetEntriesFast(); for (Int_t iparam=0; iparamAt(iparam); if (!param) continue; param->Print(option); } } else { printf("No AliDetectorRecoParam objects specified for detector %d\n",iDet); } } } 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, 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; iAt(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; for(Int_t iBit = 0; iBit < kNSpecies; iBit++) { if (fEventSpecie & (1 << iBit)) { if (fDetRecoParamsIndex[iBit][iDet] >= 0) return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[iBit][iDet]); else return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[0][iDet]); } } // Default one AliError(Form("Invalid event specie: %d!",fEventSpecie)); return (AliDetectorRecoParam *)fDetRecoParams[iDet]->At(fDetRecoParamsIndex[0][iDet]); } void AliRecoParam::AddDetRecoParam(Int_t iDet, AliDetectorRecoParam* param) { // Add an instance of reco params object into // the fDetRecoParams for detector iDet // Updates the fDetRecoParams index if (!fDetRecoParams[iDet]) fDetRecoParams[iDet] = new TObjArray; fDetRecoParams[iDet]->AddLast(param); Int_t index = fDetRecoParams[iDet]->GetLast(); // Index Int_t specie = param->GetEventSpecie(); for(Int_t iBit = 0; iBit < kNSpecies; iBit++) { if (specie & (1 << iBit)) { fDetRecoParamsIndex[iBit][iDet] = index; } } } Bool_t AliRecoParam::AddDetRecoParamArray(Int_t iDet, TObjArray* parArray) { // Add an array of reconstruction parameter objects // for a given detector // Basic check on the consistency of the array Bool_t defaultFound = kFALSE; for(Int_t i = 0; i < parArray->GetEntriesFast(); i++) { AliDetectorRecoParam *par = (AliDetectorRecoParam*)parArray->At(i); if (!par) continue; if (par->IsDefault()) defaultFound = kTRUE; Int_t specie = par->GetEventSpecie(); for(Int_t iBit = 0; iBit < kNSpecies; iBit++) { if (specie & (1 << iBit)) { fDetRecoParamsIndex[iBit][iDet] = i; } } } fDetRecoParams[iDet] = parArray; return defaultFound; } const char* AliRecoParam::PrintEventSpecie() const { // Print the current // event specie switch (fEventSpecie) { case kDefault: return "Default"; break; case kLowMult: return "Low-multiplicity"; break; case kHighMult: return "High-multiplicity"; break; case kCosmic: return "Cosmic"; break; case kCalib: return "Calibration"; break; default: return "Unknown"; break; } }