]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Utils for HLT-EMCAL
authormploskon <mploskon@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Jun 2008 06:08:04 +0000 (06:08 +0000)
committermploskon <mploskon@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Jun 2008 06:08:04 +0000 (06:08 +0000)
HLT/EMCAL/AliHLTEMCALUtils.cxx [new file with mode: 0644]
HLT/EMCAL/AliHLTEMCALUtils.h [new file with mode: 0644]

diff --git a/HLT/EMCAL/AliHLTEMCALUtils.cxx b/HLT/EMCAL/AliHLTEMCALUtils.cxx
new file mode 100644 (file)
index 0000000..7e8c7ac
--- /dev/null
@@ -0,0 +1,144 @@
+#include "AliHLTEMCALUtils.h"
+
+#include "TClass.h"
+
+#include "AliEMCALRecParam.h"
+#include "AliEMCALReconstructor.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+
+#include "AliEMCALGeometry.h"
+#include "AliEMCALClusterizerv1.h" 
+#include "AliEMCALRawUtils.h"      
+
+ClassImp(AliHLTEMCALUtils);
+
+AliEMCALGeometry*      AliHLTEMCALUtils::fgGeom        = NULL;
+AliEMCALClusterizerv1* AliHLTEMCALUtils::fgClusterizer = NULL;
+AliEMCALRecParam*      AliHLTEMCALUtils::fgRecParam    = NULL;
+AliEMCALRawUtils*      AliHLTEMCALUtils::fgRawUtils    = NULL;
+
+AliHLTEMCALUtils::AliHLTEMCALUtils()
+  : TObject()
+{
+  //
+  // Default constructor
+  //
+  ;
+}
+
+AliHLTEMCALUtils::~AliHLTEMCALUtils()
+{
+  //
+  // Destructor
+  //
+  ;
+}
+
+AliHLTEMCALUtils::AliHLTEMCALUtils(const AliHLTEMCALUtils & /*t*/)  
+  : TObject()
+{
+  //
+  // copy ctor not to be used
+  //
+  AliFatal("May not use.");  
+}
+  
+AliHLTEMCALUtils& AliHLTEMCALUtils::operator = (const AliHLTEMCALUtils & /*t*/)  
+{
+  //
+  // assignement operator not to be used
+  //
+  AliFatal("May not use.") ;
+  return *this ; 
+}
+
+void AliHLTEMCALUtils::InitRecParam()
+{
+  //
+  // Please check the AliEMCALReconstructor for comparison
+  // Check if the instance of AliEMCALRecParam exists, 
+  // if not, get it from OCDB if available, otherwise create a default one
+  //
+
+  fgRecParam = (AliEMCALRecParam*) AliEMCALReconstructor::GetRecParam();
+  if (fgRecParam)
+    return;
+  
+ if (!fgRecParam  && (AliCDBManager::Instance()->IsDefaultStorageSet())) 
+   {
+     AliCDBEntry *entry = (AliCDBEntry*) 
+       AliCDBManager::Instance()->Get("EMCAL/Config/RecParam");
+     if (entry) fgRecParam = (AliEMCALRecParam*) entry->GetObject();
+   }
+  if(!fgRecParam)
+    {
+      AliWarningClass("The Reconstruction parameters initialized to default.");
+      fgRecParam = new AliEMCALRecParam;
+    }
+
+  if (!fgRecParam)
+    {
+      AliErrorClass("Unable to init the reco params. Something is really wrong. Memory?");
+    }
+  
+  AliEMCALReconstructor::SetRecParam(fgRecParam);
+}
+
+const AliEMCALRecParam* AliHLTEMCALUtils::GetRecParam()
+{
+  //
+  // Init the parameters and reuse the Reconstructor
+  //
+  AliHLTEMCALUtils::InitRecParam();
+  return fgRecParam;
+}
+
+const AliEMCALRawUtils*      AliHLTEMCALUtils::GetRawUtils()
+{
+  //
+  // Init EMCAL raw utils
+  //
+  if (fgRawUtils == NULL)
+    {
+      if (AliCDBManager::Instance()->IsDefaultStorageSet())
+       {
+         fgRawUtils = new AliEMCALRawUtils;
+         AliInfoClass("Raw Utils initialized.");
+       }
+      else
+       {
+         AliErrorClass("OCDB not initialized. Unable to init raw utils.");
+       }
+    }
+
+  return fgRawUtils;
+}
+
+const AliEMCALClusterizerv1* AliHLTEMCALUtils::GetClusterizer()
+{
+  //
+  // Init EMCAL clusterizer
+  //
+  if (fgClusterizer == NULL)
+    {
+      fgClusterizer = new AliEMCALClusterizerv1;
+      AliInfoClass("ClusterizerV1 initialized.");
+   }
+
+  return fgClusterizer;
+}
+
+const AliEMCALGeometry*      AliHLTEMCALUtils::GetGeometry()
+{
+  //
+  // Init EMCAL geometry
+  //
+  if (fgGeom == NULL)
+    {
+      AliInfoClass(Form("Using default geometry"));
+      fgGeom =  AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName());
+    }
+  return fgGeom;
+}
diff --git a/HLT/EMCAL/AliHLTEMCALUtils.h b/HLT/EMCAL/AliHLTEMCALUtils.h
new file mode 100644 (file)
index 0000000..e193479
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef ALIHLTEMCALUTILS_H
+#define ALIHLTEMCALUTILS_H
+
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTEMCALUtils.h
+    @author m. ploskon
+    @date   
+    @brief  Utils for EMCAL-HLT
+*/
+
+#include <TObject.h>
+
+/**
+ * @class AliHLTEMCALUtils
+ */
+
+class AliEMCALGeometry; 
+class AliEMCALClusterizerv1;
+class AliEMCALRecParam;    
+class AliEMCALRawUtils;
+
+class AliHLTEMCALUtils : public TObject
+{
+ public:
+  AliHLTEMCALUtils();
+  AliHLTEMCALUtils(const AliHLTEMCALUtils & /*t*/);
+  AliHLTEMCALUtils & operator = (const AliHLTEMCALUtils & /*t*/);
+  virtual ~AliHLTEMCALUtils();
+
+  static void                         InitRecParam();
+  static const AliEMCALRecParam*      GetRecParam();
+
+  static const AliEMCALRawUtils*      GetRawUtils();
+  static const AliEMCALClusterizerv1* GetClusterizer();
+  static const AliEMCALGeometry*      GetGeometry();
+
+ protected:
+ private:
+
+  static AliEMCALGeometry*      fgGeom;        // EMCAL geometry
+  static AliEMCALClusterizerv1* fgClusterizer; // ECMAL clusterizer
+  static AliEMCALRecParam*      fgRecParam;    // EMCAL reconstruction parameters
+  static AliEMCALRawUtils*      fgRawUtils;    // EMCAL raw utilities 
+  ClassDef(AliHLTEMCALUtils, 0)
+};
+
+#endif