From 6769d914a757f672b4cd021ba6b87fb57467a37e Mon Sep 17 00:00:00 2001 From: cvetan Date: Thu, 12 Jun 2008 13:57:47 +0000 Subject: [PATCH] First prototype of the reco-param classes. Removal of static instance in the muon reconstructor. --- MUON/AliMUONReconstructor.cxx | 22 +------ STEER/AliDetectorRecoParam.cxx | 1 - STEER/AliDetectorRecoParam.h | 6 +- STEER/AliEventInfo.cxx | 107 +++++++++++++++++++++++++++++++++ STEER/AliEventInfo.h | 55 +++++++++++++++++ STEER/AliRecoParam.cxx | 88 +++++++-------------------- STEER/AliRecoParam.h | 21 ++++--- STEER/STEERLinkDef.h | 2 + STEER/libSTEER.pkg | 3 +- 9 files changed, 208 insertions(+), 97 deletions(-) create mode 100644 STEER/AliEventInfo.cxx create mode 100644 STEER/AliEventInfo.h diff --git a/MUON/AliMUONReconstructor.cxx b/MUON/AliMUONReconstructor.cxx index d34ad4969a2..b3b94c5768e 100644 --- a/MUON/AliMUONReconstructor.cxx +++ b/MUON/AliMUONReconstructor.cxx @@ -178,25 +178,9 @@ const AliMUONRecoParam* AliMUONReconstructor::GetRecoParam() { /// get reconstruction parameters - if (!fgRecoParam) { - - // get reconstruction parameters from AliRecoParam if any - TObjArray *recoParams = AliRecoParam::Instance()->GetRecoParam("MUON"); - - if (recoParams) { - - fgRecoParam = (AliMUONRecoParam*) recoParams->Last(); - - } else { - - // initialize reconstruction parameters if not already done - cout<<"W-AliMUONReconstructor::GetRecoParam: Reconstruction parameters not initialized - Use default one"<RegisterRecoParam(fgRecoParam); - - } - - } + // initialize reconstruction parameters if not already done + cout<<"W-AliMUONReconstructor::GetRecoParam: Reconstruction parameters not initialized - Use default one"<operator=(evInfo); + + fLHCState = evInfo.fLHCState; + fRunType = evInfo.fRunType; + fActiveDetectors = evInfo.fActiveDetectors; + fEventType = evInfo.fEventType; + fTriggerClasses = evInfo.fTriggerClasses; + fTriggerMask = evInfo.fTriggerMask; + fTriggerCluster = evInfo.fTriggerCluster; + + return *this; +} + +//______________________________________________________________________________ +void AliEventInfo::Reset() +{ + // Reset the contents + // ... + fLHCState = "UNKNOWN"; + fRunType = "UNKNOWN"; + fActiveDetectors = ""; + fEventType = 0; + fTriggerClasses = ""; + fTriggerMask = 0; + fTriggerCluster = ""; +} diff --git a/STEER/AliEventInfo.h b/STEER/AliEventInfo.h new file mode 100644 index 00000000000..bce4d94e159 --- /dev/null +++ b/STEER/AliEventInfo.h @@ -0,0 +1,55 @@ +#ifndef ALIEVENTINFO_H +#define ALIEVENTINFO_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +////////////////////////////////////////////////////////////////////////////// +// Class AliEventInfo // +// Container class for all the information related to LHCstate, run and // +// event types, trigger mask and trigger clusters. // +// It is used in order to provide the detector's AliRecoParam objects with// +// the necessary information so that they can decide which instance of // +// AliDetectorRecoParam to use in reconstruction one particular event. // +// // +// cvetan.cheshkov@cern.ch 12/06/2008 // +////////////////////////////////////////////////////////////////////////////// + +#include +#include + +class AliEventInfo : public TObject { + + public: + AliEventInfo(); + AliEventInfo(const char *lhcState, + const char *runType, + const char *activeDetectors); + virtual ~AliEventInfo() {} + + void SetEventType(UInt_t evType) { fEventType = evType; } + void SetTriggerClasses(const char *classes) { fTriggerClasses.SetString(classes); } + void SetTriggerMask(ULong_t mask) { fTriggerMask = mask; } + void SetTriggerCluster(const char *cluster) { fTriggerCluster.SetString(cluster); } + + virtual void Print(Option_t */*option=""*/) const { Dump(); } + + const char *GetLHCState() const { return fLHCState.GetString().Data(); } + + AliEventInfo(const AliEventInfo &evInfo); + AliEventInfo& operator= (const AliEventInfo& evInfo); + + void Reset(); + private: + + TObjString fLHCState; // state of the machine as provided by DCS and DAQ log-book (per run) + TObjString fRunType; // run type accoring to ECS (per run) + TObjString fActiveDetectors;// list of active detectors (per run) + UInt_t fEventType; // event type as defined by DAQ (start_of_*,calibration,physics etc) (per event) + TObjString fTriggerClasses; // list of fired trigger classes (per event) + ULong_t fTriggerMask; // trigger mask as received from DAQ or CTP raw-data payload (per event) + TObjString fTriggerCluster; // list of detectors that have been read out (per event) + + ClassDef(AliEventInfo,1) // Event info class +}; + +#endif diff --git a/STEER/AliRecoParam.cxx b/STEER/AliRecoParam.cxx index bbdb5bd7381..9741d410a85 100644 --- a/STEER/AliRecoParam.cxx +++ b/STEER/AliRecoParam.cxx @@ -16,21 +16,12 @@ /////////////////////////////////////////////////////////////////////////////// // // -// ALICE Reconstruction parameterization: -// -// -// Retrieving paramaters: -// 0. Read the parameters from database -// 1. Using the ConfigRecoParam.C script (example : $ALICE_ROOT/macros) -// 2. Register additional parametes (AliRecoParam::Instance()->RegisterRecoParam(tpcRecoParam); -// -// -// Using the reconstruction parameters -// AliRecoParam::Instance()->GetRecoParam(detType, eventType) // -// detType: -// 1. Detectors - ITS, TPC, TRD, TOF ... -// 2. Process - V0, Kink, ESDcuts - +// 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. // // // /////////////////////////////////////////////////////////////////////////////// @@ -42,49 +33,37 @@ ClassImp(AliRecoParam) - -AliRecoParam* AliRecoParam::fgInstance = 0x0; - - -//_____________________________________________________________________________ -AliRecoParam* AliRecoParam::Instance() +AliRecoParam::AliRecoParam(): + TNamed("",""), + fRecoParamArray(0) { - // - // returns AliRecoParam instance (singleton) - // - if (!fgInstance) { - fgInstance = new AliRecoParam(); - } - - return fgInstance; + // Default constructor + // ... } - - -AliRecoParam::AliRecoParam(): - TNamed("ALICE","ALICE"), +AliRecoParam::AliRecoParam(const char *detector): + TNamed(detector,detector), fRecoParamArray(0) { - // - // - // + // Default constructor + // ... } AliRecoParam::~AliRecoParam(){ - // - // - // + // Destructor + // ... + // Delete the array with the reco-param objects if (fRecoParamArray){ fRecoParamArray->Delete(); delete fRecoParamArray; } } -void AliRecoParam::Print(Option_t *option) const{ +void AliRecoParam::Print(Option_t *option) const { // // Print reconstruction setup // - printf("AliRecoParam\n"); + printf("AliRecoParam object for %s\n",GetName()); if (!fRecoParamArray) return; Int_t nparam = fRecoParamArray->GetEntriesFast(); for (Int_t iparam=0; iparamAddLast(param); } - -TObjArray * AliRecoParam::GetRecoParam(const char * detType, Int_t */*eventType*/){ - // - // Get the list of Reconstruction parameters for given detector - // and event type - // - if (!fRecoParamArray) return 0; - TObjArray * array = 0; - Int_t nparam = fRecoParamArray->GetEntriesFast(); - for (Int_t iparam=0;iparamAt(iparam); - if (!param) continue; - TString str(param->GetName()); - if (!str.Contains(detType)) continue; - if (!array) array = new TObjArray; - array->AddLast(param); - } - return array; -} - - diff --git a/STEER/AliRecoParam.h b/STEER/AliRecoParam.h index 36c54b65f32..0f9dadfee93 100644 --- a/STEER/AliRecoParam.h +++ b/STEER/AliRecoParam.h @@ -6,34 +6,39 @@ /////////////////////////////////////////////////////////////////////////////// // // // 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 "TNamed.h" class AliDetectorRecoParam; +class AliEventInfo; class AliRecoParam : public TNamed { - enum EventType0 {kUndef=0, kPhysic=1, kCalib=2}; + public: AliRecoParam(); + AliRecoParam(const char *detector); virtual ~AliRecoParam(); - static AliRecoParam * Instance(); // - virtual void Print(Option_t *option="") const; - TObjArray * GetRecoParam(const char * detType, Int_t *eventType=0); - void RegisterRecoParam(AliDetectorRecoParam* param); + virtual void Print(Option_t *option="") const; + TObjArray *GetAllRecoParams() const { return fRecoParamArray; } + virtual AliDetectorRecoParam *GetRecoParam(const AliEventInfo &evInfo) const = 0; + void AddRecoParam(AliDetectorRecoParam* param); protected: - TObjArray *fRecoParamArray; //array with registerd reconstruction parameters - static AliRecoParam* fgInstance; // Reconstruction parameters instance + + TObjArray *fRecoParamArray; //array with reconstruction-parameter objects private: + AliRecoParam(const AliRecoParam&); // Not implemented AliRecoParam& operator=(const AliRecoParam&); // Not implemented - ClassDef(AliRecoParam, 1) + ClassDef(AliRecoParam, 2) }; diff --git a/STEER/STEERLinkDef.h b/STEER/STEERLinkDef.h index e4ca2e00771..c59e7a690ed 100644 --- a/STEER/STEERLinkDef.h +++ b/STEER/STEERLinkDef.h @@ -146,4 +146,6 @@ #pragma link C++ class AliTriggerRunScalers+; #pragma link C++ class AliGRPPreprocessor+; +#pragma link C++ class AliEventInfo+; + #endif diff --git a/STEER/libSTEER.pkg b/STEER/libSTEER.pkg index dd6d15a2c5f..a0c82d29ad3 100644 --- a/STEER/libSTEER.pkg +++ b/STEER/libSTEER.pkg @@ -61,7 +61,8 @@ AliMillepede.cxx \ AliRecoParam.cxx \ AliDetectorRecoParam.cxx \ AliPlaneEff.cxx \ -AliTriggerRunScalers.cxx AliGRPPreprocessor.cxx +AliTriggerRunScalers.cxx AliGRPPreprocessor.cxx \ +AliEventInfo.cxx HDRS:= $(SRCS:.cxx=.h) -- 2.39.3