]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added class to read reconstruction parameters from OCDB (Yuri)
authorgustavo <gustavo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Jun 2007 12:39:22 +0000 (12:39 +0000)
committergustavo <gustavo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Jun 2007 12:39:22 +0000 (12:39 +0000)
EMCAL/AliEMCALClusterizerv1.cxx
EMCAL/AliEMCALLoader.cxx
EMCAL/AliEMCALLoader.h
EMCAL/AliEMCALRecParam.cxx [new file with mode: 0644]
EMCAL/AliEMCALRecParam.h [new file with mode: 0644]
EMCAL/EMCALLinkDefrec.h
EMCAL/RecParam/Data/Run0_999999_v0_s0.root [new file with mode: 0644]
EMCAL/libEMCALrec.pkg
EMCAL/macros/RecParamDB/AliEMCALSetRecParamCDB.C [new file with mode: 0644]

index c6de73b0c1c5d04d9624703f9d0a4517965c3ae1..4e9786a76e92e06c90816211f3dbe33d7a4bf1ac 100644 (file)
@@ -15,7 +15,7 @@
 
 /* $Id$ */
 
-//*-- Author: Yves Schutz (SUBATECH)  & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
+//-- Author: Yves Schutz (SUBATECH)  & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
 //  August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
 //                           of new  IO (à la PHOS)
 //  Mar 2007, Aleksei Pavlinov - new algoritmh of pseudo clusters
@@ -410,6 +410,20 @@ void AliEMCALClusterizerv1::InitParameters()
   fMinECut = 0.45; // Best value for 2 GeV gamma merged with Ideal HIJING. Retune later? 
 
   fCalibData               = 0 ;
+
+  // If reconstruction parameters are found in OCDB, take them from it
+
+  AliEMCALLoader *emcalLoader = 
+    dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+  AliEMCALRecParam *recParamDB = emcalLoader->RecParam();
+  if (recParamDB != 0) {
+    fECAClusteringThreshold = recParamDB->GetClusteringThreshold();
+    fECAW0                  = recParamDB->GetW0();
+    fMinECut                = recParamDB->GetMinECut();
+    AliDebug(1,Form("Reconstruction parameters were taken from OCDB: fECAClusteringThreshold=%.3f, fECAW=%.3f, fMinECut=%.3f",
+                fECAClusteringThreshold,fECAW0,fMinECut));
+  }
+
 }
 
 //____________________________________________________________________________
index bd6e367b17f8ac01d40095ceb50c3175cf80258c..154740f91b7eb2a02499d81cf51259bf049469d4 100644 (file)
@@ -58,6 +58,7 @@ ClassImp(AliEMCALLoader)
   
 const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
 AliEMCALCalibData* AliEMCALLoader::fgCalibData = 0; //calibation data
+AliEMCALRecParam * AliEMCALLoader::fgRecParam  = 0; //reconstruction parameters
 
 //____________________________________________________________________________ 
 AliEMCALLoader::AliEMCALLoader()
@@ -165,6 +166,25 @@ AliEMCALCalibData* AliEMCALLoader::CalibData()
   
 }
 
+//____________________________________________________________________________ 
+AliEMCALRecParam* AliEMCALLoader::RecParam()
+{ 
+  // Check if the instance of AliEMCALRecParam exists, if not, create it if 
+  // the OCDB is available, and finally return it.
+
+  if(!fgRecParam && (AliCDBManager::Instance()->IsDefaultStorageSet())) {
+    AliCDBEntry *entry = (AliCDBEntry*) 
+      AliCDBManager::Instance()->Get("EMCAL/RecParam/Data");
+    if (entry) fgRecParam =  (AliEMCALRecParam*) entry->GetObject();
+  }
+  
+  if(!fgRecParam)
+    AliWarning("Recostruction parameters not found in CDB!");
+  
+  return fgRecParam;
+  
+}
+
 //____________________________________________________________________________ 
 Int_t AliEMCALLoader::CalibrateRaw(Double_t energy, Int_t module, 
                                   Int_t column, Int_t row)
index e304b3c465344b781817a749b4225a3d9a32296e..bd361cad85f2c82bf05d71ff5a7669dbc7503b1e 100644 (file)
@@ -27,6 +27,7 @@ class TTask ;
 // --- AliRoot header files ---
 #include "AliLoader.h"
 #include "AliEMCALCalibData.h"
+#include "AliEMCALRecParam.h"
 
 class AliLoader ;
 class AliEMCAL ; 
@@ -108,6 +109,8 @@ class AliEMCALLoader : public AliLoader {
   void  SetCalibData(AliEMCALCalibData* calibda)  { fgCalibData = calibda; }
   AliEMCALCalibData * CalibData(); // to get the calibration CDB object
 
+  AliEMCALRecParam * RecParam();   // to get rec.parameters from CDB
+
 private:
  
   static const TString fgkECARecPointsBranchName; //! Name of branch with ECA Reconstructed Points
@@ -123,8 +126,9 @@ private:
   TObjArray        *fRecPoints;    //! TClonesArray of recpoints (for tree reading)   
   
   static AliEMCALCalibData * fgCalibData;  //  calibration data 
+  static AliEMCALRecParam  * fgRecParam ;  //  reconstruction parameters
 
-  ClassDef(AliEMCALLoader,0)  // Algorithm class that provides methods to retrieve objects from a list knowing the index 
+  ClassDef(AliEMCALLoader,1)  // Algorithm class that provides methods to retrieve objects from a list knowing the index 
    
 };
 
diff --git a/EMCAL/AliEMCALRecParam.cxx b/EMCAL/AliEMCALRecParam.cxx
new file mode 100644 (file)
index 0000000..efe4f74
--- /dev/null
@@ -0,0 +1,42 @@
+ /**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+// --- AliRoot header files ---
+#include "AliEMCALRecParam.h"
+#include "AliLog.h"
+
+ClassImp(AliEMCALRecParam)
+
+//-----------------------------------------------------------------------------
+// Container of EMCAL reconstruction parameters
+// The purpose of this object is to store it to OCDB
+// and retrieve it in AliEMCALClusterizerv1
+// Author: Yuri Kharlov
+//-----------------------------------------------------------------------------
+
+AliEMCALRecParam::AliEMCALRecParam():
+  fClusteringThreshold(0),fW0(0),fMinECut(0)
+{}
+
+//-----------------------------------------------------------------------------
+void AliEMCALRecParam::Print(Option_t *) const
+{
+  printf("AliEMCALRecParam::Print()\n");
+  // Print reconstruction parameters to stdout
+  AliInfo(Form("Reconstruction parameters:\n fClusteringThreshold=%.3f,\n fW0=%.3f,\n fMinECut=%.3f",
+              fClusteringThreshold,fW0,fMinECut));
+
+}
diff --git a/EMCAL/AliEMCALRecParam.h b/EMCAL/AliEMCALRecParam.h
new file mode 100644 (file)
index 0000000..c889cf6
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef ALIEMCALRECPARAM_H
+#define ALIEMCALRECPARAM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//-----------------------------------------------------------------------------
+// Container of EMCAL reconstruction parameters
+// The purpose of this object is to store it to OCDB
+// and retrieve it in AliEMCALClusterizerv1
+// Author: Yuri Kharlov
+//-----------------------------------------------------------------------------
+
+// --- ROOT system ---
+
+#include "TObject.h" 
+
+class AliEMCALRecParam : public TObject
+{
+public:
+  
+  AliEMCALRecParam() ;
+  virtual ~AliEMCALRecParam() {}
+  Float_t GetClusteringThreshold()      {return fClusteringThreshold;}
+  Float_t GetW0                 ()      {return fW0                 ;}
+  Float_t GetMinECut            ()      {return fMinECut            ;}
+  void SetClusteringThreshold(Float_t thrsh)   {fClusteringThreshold = thrsh;}
+  void SetW0                 (Float_t w0)      {fW0 = w0                    ;}
+  void SetMinECut            (Float_t minEcut) {fMinECut = minEcut          ;}
+  virtual void Print(Option_t * option="") const ; 
+
+private:
+  Float_t fClusteringThreshold ; // minimum energy to seed a EC digit in a cluster
+  Float_t fW0 ;                  // logarithmic weight for the cluster center of gravity calculation
+  Float_t fMinECut;              // Minimum energy for a digit to be a member of a cluster
+
+  ClassDef(AliEMCALRecParam,1)   // Reconstruction parameters
+
+} ;
+
+#endif //  ALIEMCALRECPARAM_H
index f640656f5d58342c05edd488fdee85d05276951a..73763181e3b334223eba5eb6a9860d4676133fd2 100644 (file)
@@ -9,5 +9,6 @@
 #pragma link C++ class AliEMCALTrack+;
 #pragma link C++ class AliEMCALTracker+;
 #pragma link C++ class AliEMCALPID+;
+#pragma link C++ class AliEMCALRecParam+;
 
 #endif
diff --git a/EMCAL/RecParam/Data/Run0_999999_v0_s0.root b/EMCAL/RecParam/Data/Run0_999999_v0_s0.root
new file mode 100644 (file)
index 0000000..a0926f7
Binary files /dev/null and b/EMCAL/RecParam/Data/Run0_999999_v0_s0.root differ
index 425506175c818a5b7d6aa427ab7b5d8b8cd7296e..23ccdb76a9da359dd4ec09561437e09ef5855a74 100644 (file)
@@ -4,7 +4,8 @@ AliEMCALReconstructor.cxx \
 AliEMCALClusterizerv1.cxx \
 AliEMCALTrack.cxx \
 AliEMCALTracker.cxx \
-AliEMCALPID.cxx
+AliEMCALPID.cxx \
+AliEMCALRecParam.cxx
 
 HDRS= $(SRCS:.cxx=.h) 
 
diff --git a/EMCAL/macros/RecParamDB/AliEMCALSetRecParamCDB.C b/EMCAL/macros/RecParamDB/AliEMCALSetRecParamCDB.C
new file mode 100644 (file)
index 0000000..21e9c2b
--- /dev/null
@@ -0,0 +1,100 @@
+// Script to create reconstruction parameters and store them into CDB
+// Author: Yuri Kharlov
+
+/* $Id$ */
+
+#if !defined(__CINT__)
+#include "TControlBar.h"
+#include "TString.h"
+
+#include "AliEMCALRecParam.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBId.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#endif
+
+
+void AliEMCALSetRecParamCDB()
+{
+  TControlBar *menu = new TControlBar("vertical","EMCAL CDB");
+  menu->AddButton("Help to run EMCAL CDB","Help()",
+                 "Explains how to use EMCAL CDS menus");
+  menu->AddButton("Set RecParam","SetRecParam()",
+                 "Set clusterization parameters");
+  menu->AddButton("Get RecParam","GetRecParam()",
+                 "Get clusterization parameters");
+  menu->AddButton("Exit","gApplication->Terminate(0)","Quit aliroot session");
+  menu->Show();
+}
+
+//------------------------------------------------------------------------
+void Help()
+{
+  char *string =
+    "\n\nSet reconstruction parameters and write them into ALICE OCDB. \nPress button \"Set RecParam\" to create an object AliEMCALRecParam \nand store it to OCDB. \nPress button \"Get RecParam\" to read reconstruction parameters from OCDB \nand print then to stdout.\n\n";
+  printf(string);
+}
+
+//------------------------------------------------------------------------
+void SetRecParam()
+{
+  // Create an object AliEMCALRecParam and store it to OCDB
+
+  TString DBFolder;
+  Int_t firstRun   =  0;
+  Int_t lastRun    =  999999;
+  Int_t beamPeriod =  1;
+  char* objFormat  = "";
+
+  DBFolder  ="local://LocalCDB";
+  objFormat = "EMCAL reconstruction parameters";
+
+  // Create reconstruction parameter object and set parameter values
+  
+  AliEMCALRecParam *recParamDB = new AliEMCALRecParam();
+  recParamDB->SetClusteringThreshold(0.5);
+  recParamDB->SetW0(4.5);
+  recParamDB->SetMinECut(0.45);
+
+  // Store calibration data into database
+  
+  AliCDBMetaData md;
+  md.SetComment(objFormat);
+  md.SetBeamPeriod(beamPeriod);
+  md.SetResponsible("Yuri Kharlov");
+  
+  AliCDBId id("EMCAL/RecParam/Data",firstRun,lastRun);
+
+  AliCDBManager* man = AliCDBManager::Instance();  
+  AliCDBStorage* loc = man->GetStorage(DBFolder.Data());
+  loc->Put(recParamDB, id, &md);
+  recParamDB->Print();
+}
+
+//------------------------------------------------------------------------
+void GetRecParam()
+{
+  // Read reconstruction parameters from OCDB
+
+  TString DBFolder;
+
+  DBFolder  ="local://LocalCDB";
+  Int_t runNumber = 0;
+
+  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+  AliCDBManager::Instance()->SetSpecificStorage("EMCAL/*",DBFolder.Data());
+
+  AliCDBEntry* cdbEntry = AliCDBManager::Instance()->Get("EMCAL/RecParam/Data",runNumber);
+  if (cdbEntry == 0) {
+    cerr << "No CDBEntry found at path "<<DBFolder.Data()<<"/"<<"EMCAL/RecParam/Data"<<endl;
+    return;
+  }
+
+  AliEMCALRecParam* recParam  = (AliEMCALRecParam*)cdbEntry->GetObject();
+  if (recParam != 0) recParam->Print("");
+  else
+    cerr << "GetRecParam(): no AliEMCALRecParam object is found in OCDB" << endl;
+
+}