void AliEMCALDigitizer::InitParameters()
{
// Parameter initialization for digitizer
-
- fMeanPhotonElectron = AliEMCALSimParam::GetInstance()->GetMeanPhotonElectron();//4400; // electrons per GeV
- fPinNoise = AliEMCALSimParam::GetInstance()->GetPinNoise();//0.012; // pin noise in GeV from analysis test beam data
+
+ // Get the parameters from the OCDB via the loader
+ AliRunLoader *rl = AliRunLoader::Instance();
+ AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
+ AliEMCALSimParam * simParam = 0x0;
+ if(emcalLoader) simParam = emcalLoader->SimulationParameters();
+
+ if(!simParam){
+ simParam = AliEMCALSimParam::GetInstance();
+ AliWarning("Simulation Parameters not available in OCDB?");
+ }
+
+ fMeanPhotonElectron = simParam->GetMeanPhotonElectron();//4400; // electrons per GeV
+ fPinNoise = simParam->GetPinNoise();//0.012; // pin noise in GeV from analysis test beam data
if (fPinNoise < 0.0001 )
Warning("InitParameters", "No noise added\n") ;
- fDigitThreshold = AliEMCALSimParam::GetInstance()->GetDigitThreshold(); //fPinNoise * 3; // 3 * sigma
- fTimeResolution = AliEMCALSimParam::GetInstance()->GetTimeResolution(); //0.6e-9 ; // 600 psc
+ fDigitThreshold = simParam->GetDigitThreshold(); //fPinNoise * 3; // 3 * sigma
+ fTimeResolution = simParam->GetTimeResolution(); //0.6e-9 ; // 600 psc
// These defaults are normally not used.
// Values are read from calibration database instead
fADCchannelEC = 0.0153; // Update 24 Apr 2007: 250./16/1024 - width of one ADC channel in GeV
fADCpedestalEC = 0.0 ; // GeV
- fNADCEC = AliEMCALSimParam::GetInstance()->GetNADCEC();//(Int_t) TMath::Power(2,16) ; // number of channels in Tower ADC - 65536
+ fNADCEC = simParam->GetNADCEC();//(Int_t) TMath::Power(2,16) ; // number of channels in Tower ADC - 65536
AliDebug(2,Form("Mean Photon Electron %d, Noise %f, E Threshold %f,Time Resolution %g,NADCEC %d",
fMeanPhotonElectron,fPinNoise,fDigitThreshold,fTimeResolution,fNADCEC));
//Float_t GetPedestal() const { return fPedestal; }
Float_t GetPinNoise() const { return fPinNoise;}
//Float_t GetSlope() const { return fSlope; }
- Float_t GetTimeResolution() const { return fTimeResolution ; }
+ Double_t GetTimeResolution() const { return fTimeResolution ; }
Float_t GetECAchannel() const { return fADCchannelEC ; }
Float_t GetECApedestal() const { return fADCpedestalEC ; }
void SetEventRange(Int_t first=0, Int_t last=-1) {fFirstEvent=first; fLastEvent=last; }
//Float_t fPedestal ; // Calibration parameters //Not used, remove?
//Float_t fSlope ; // read from SDigitizer //Not used, remove?
Float_t fPinNoise ; // Electronics noise in EMC
- Float_t fTimeResolution ; // Time resolution of FEE electronics
+ Double_t fTimeResolution ; // Time resolution of FEE electronics
//Float_t fTimeThreshold ; // Threshold to start timing for given crystall //Not used, remove?
//Float_t fTimeSignalLength ; // Length of the timing signal //Not used, remove?
Float_t fADCchannelEC ; // width of one ADC channel in EC section (GeV)
ClassImp(AliEMCALLoader)
-const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
-AliEMCALCalibData* AliEMCALLoader::fgCalibData = 0; //calibation data
+const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
+AliEMCALCalibData* AliEMCALLoader::fgCalibData = 0; //calibration data
AliCaloCalibPedestal* AliEMCALLoader::fgCaloPed = 0; //dead map data
+AliEMCALSimParam* AliEMCALLoader::fgSimParam = 0; //simulation parameters
//____________________________________________________________________________
AliEMCALLoader::AliEMCALLoader()
}
+//____________________________________________________________________________
+AliEMCALSimParam* AliEMCALLoader::SimulationParameters()
+{
+ // Check if the instance of AliEMCALSimParam exists, if not, create it if
+ // the OCDB is available, and finally return it.
+
+ if(!fgSimParam && (AliCDBManager::Instance()->IsDefaultStorageSet()))
+ {
+ AliCDBEntry *entry = (AliCDBEntry*)
+ AliCDBManager::Instance()->Get("EMCAL/Calib/SimParam");
+ if (entry) fgSimParam = (AliEMCALSimParam*) entry->GetObject();
+
+ }
+
+ if(!fgSimParam)
+ AliFatal("Simulations parameters not found in CDB!");
+
+ return fgSimParam;
+
+}
//____________________________________________________________________________
Int_t AliEMCALLoader::CalibrateRaw(Double_t energy, Int_t module,
#include "AliLoader.h"
#include "AliEMCALCalibData.h"
#include "AliCaloCalibPedestal.h"
+#include "AliEMCALSimParam.h"
class AliLoader ;
class AliEMCAL ;
void SetDebug(Int_t level) {fDebug = level;} // Set debug level
//Calibration
-
Int_t CalibrateRaw (Double_t energy, Int_t module, Int_t column, Int_t row);//take real calibration coefficients
-
+
void SetCalibData(AliEMCALCalibData* calibda) { fgCalibData = calibda; }
AliEMCALCalibData * CalibData(); // to get the calibration CDB object
-
+
void SetPedestalData(AliCaloCalibPedestal* caloped) { fgCaloPed = caloped; }
AliCaloCalibPedestal* PedestalData(); // to get the pedestal CDB object
+ void SetSimParam(AliEMCALSimParam* simparam) { fgSimParam = simparam; }
+ AliEMCALSimParam* SimulationParameters(); // to get the simulation parameter CDB object
+
private:
TObjArray *fRecPoints; //! TClonesArray of recpoints (for tree reading)
static AliEMCALCalibData * fgCalibData; // calibration data
- static AliCaloCalibPedestal * fgCaloPed; // dead map
+ static AliCaloCalibPedestal * fgCaloPed; // dead map
+ static AliEMCALSimParam * fgSimParam; // sim param
- ClassDef(AliEMCALLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index
+ ClassDef(AliEMCALLoader,4) // Algorithm class that provides methods to retrieve objects from a list knowing the index
};
Fatal("InitParameters", "Sampling factor not set !") ;
}
+ // Get the parameters from the OCDB via the loader
+ AliRunLoader *rl = AliRunLoader::Instance();
+ AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
+ AliEMCALSimParam * simParam = 0x0;
+ if(emcalLoader) simParam = emcalLoader->SimulationParameters();
+
+ if(!simParam){
+ simParam = AliEMCALSimParam::GetInstance();
+ AliWarning("Simulation Parameters not available in OCDB?");
+ }
+
//
//JLK 26-Jun-2008 THIS SHOULD HAVE BEEN EXPLAINED AGES AGO:
//
//Digitize() and Calibrate() methods
//
// Initializes parameters
- fA = AliEMCALSimParam::GetInstance()->GetA(); //0;
- fB = AliEMCALSimParam::GetInstance()->GetB(); //1.e+6; // Changed 24 Apr 2007. Dynamic range now 2 TeV
+ fA = simParam->GetA(); //0;
+ fB = simParam->GetB(); //1.e+6; // Changed 24 Apr 2007. Dynamic range now 2 TeV
fSampling = geom->GetSampling();
// threshold for deposit energy of hit
- fECPrimThreshold = AliEMCALSimParam::GetInstance()->GetECPrimaryThreshold();//0.05;// GeV // 22-may-07 was 0// 24-nov-04 - was 1.e-6;
+ fECPrimThreshold = simParam->GetECPrimaryThreshold();//0.05;// GeV // 22-may-07 was 0// 24-nov-04 - was 1.e-6;
AliDebug(2,Form("Print: \n------------------- %s -------------\n",GetName()));
AliDebug(2,Form(" fInit %i\n", int(fInit)));
return ;
}
-
+
+
if(strstr(option,"tim"))
gBenchmark->Start("EMCALSDigitizer");
Int_t nSdigits = 0 ;
Int_t i;
- AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
+
+ AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
for ( i = 0 ; i < hits->GetEntries() ; i++ ) {
AliEMCALHit * hit = dynamic_cast<AliEMCALHit*>(hits->At(i)) ;
AliEMCALDigit * curSDigit = 0 ;
//Parameters used in Digitizer
Int_t GetDigitThreshold() const { return fDigitThreshold;}
Float_t GetPinNoise() const { return fPinNoise;}
- Float_t GetTimeResolution() const { return fTimeResolution ; }
+ Double_t GetTimeResolution() const { return fTimeResolution ; }
Int_t GetNADCEC() const { return fNADCEC ; }
Int_t GetMeanPhotonElectron() const { return fMeanPhotonElectron ; }
void SetDigitThreshold(Int_t val) { fDigitThreshold = val ; }
void SetPinNoise(Float_t val) { fPinNoise = val ; }
- void SetTimeResolution(Float_t val) { fTimeResolution = val ; }
+ void SetTimeResolution(Double_t val) { fTimeResolution = val ; }
void SetNADCED(Int_t val) { fNADCEC = val ; }
void SetMeanPhotonElectron(Int_t val){ fMeanPhotonElectron = val ; }
void SetB(Float_t val) { fB = val ; }
void SetECPrimaryThreshold(Float_t val) { fECPrimThreshold = val ;}
-private:
-
- AliEMCALSimParam(Int_t i); //True constructor which should be called by GetInstance()
private:
Int_t fDigitThreshold ; // Threshold for storing digits in EMC
Int_t fMeanPhotonElectron ; // number of photon electrons per GeV deposited energy
Float_t fPinNoise ; // Electronics noise in EMC
- Float_t fTimeResolution ; // Time resolution of FEE electronics
+ Double_t fTimeResolution ; // Time resolution of FEE electronics
//Float_t fTimeThreshold ; // Threshold to start timing for given crystall
//Float_t fTimeSignalLength ; // Length of the timing signal
Int_t fNADCEC ; // number of channels in EC section ADC
Float_t fB ; // Slope Digitizition parameters
Float_t fECPrimThreshold ; // To store primary if EC Shower Elos > threshold
- ClassDef(AliEMCALSimParam,1)
+ ClassDef(AliEMCALSimParam,2)
};
#endif
--- /dev/null
+// Script to create simulation parameters and store them into CDB
+// Author: Gustavo Conesa Balbastre
+
+/* $Id: AliEMCALSetSimParamCDB.C 37597 2009-12-04 13:48:42Z gconesab $ */
+
+#if !defined(__CINT__)
+#include "TControlBar.h"
+#include "TString.h"
+
+#include "AliEMCALSimParam.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBId.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#endif
+
+
+void AliEMCALSetSimParamCDB()
+{
+
+ // Create an object AliEMCALRecParam and store it to OCDB
+
+ //Activate CDB storage
+ AliCDBManager* cdb = AliCDBManager::Instance();
+ if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+
+ // Create simulation parameter object and set parameter values
+ AliEMCALSimParam *simParam = new AliEMCALSimParam();
+ //Digits
+// simParam->SetDigitThreshold(3) ;
+// simParam->SetPinNoise(0.012) ;
+// simParam->SetTimeResolution(0.6e-9) ;
+// simParam->SetNADCED( (Int_t) TMath::Power(2,16)) ;
+// simParam->SetMeanPhotonElectron(4400);
+ //SDigits
+// simParam->SetA(0) ;
+// simParam->SetB(1e6) ;
+// simParam->SetECPrimaryThreshold(0.05);
+
+ // Store calibration data into database
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("G. Conesa");
+ md->SetComment("Simulation Parameters: EMCAL");
+ md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+ md->SetBeamPeriod(0);
+
+ AliCDBId id("EMCAL/Calib/SimParam",0,AliCDBRunRange::Infinity());
+ cdb->GetDefaultStorage()->Put(simParam, id, md);
+
+ return;
+}
+
+
+
--- /dev/null
+// Macro to print the values stored in the OCDB with AliEMCALRecParam
+// These parameters are used during reconstruction
+
+// Author: Gustavo Conesa (INFN-LNF)
+
+
+void PrintEMCALSimParam(char * file = "$ALICE_ROOT/OCDB/EMCAL/Calib/SimParam/Run0_999999999_v0_s0.root"){
+
+
+ TFile * f = new TFile(file,"READ");
+
+ AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry");
+ AliEMCALSimParam * sparam = cdb->GetObject();
+
+
+ cout<<"============== "<<sparam->GetName()<<" ==============="<<endl;
+
+ sparam->Print("");
+
+}