/* History of cvs commits:
*
* $Log$
+ * Revision 1.82 2005/09/02 15:43:13 kharlov
+ * Add comments in GetCalibrationParameters and Calibrate
+ *
+ * Revision 1.81 2005/09/02 14:32:07 kharlov
+ * Calibration of raw data
+ *
+ * Revision 1.80 2005/08/24 15:31:36 kharlov
+ * Setting raw digits flag
+ *
+ * Revision 1.79 2005/07/25 15:53:53 kharlov
+ * Read raw data
+ *
+ * Revision 1.78 2005/05/28 14:19:04 schutz
+ * Compilation warnings fixed by T.P.
+ *
*/
//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
#include "AliPHOSDigit.h"
#include "AliPHOSDigitizer.h"
#include "AliPHOSCalibrationDB.h"
+#include "AliCDBStorage.h"
+#include "AliCDBLocal.h"
ClassImp(AliPHOSClusterizerv1)
}
//____________________________________________________________________________
-Float_t AliPHOSClusterizerv1::Calibrate(Int_t amp, Int_t absId) const
+Float_t AliPHOSClusterizerv1::Calibrate(Int_t amp, Int_t absId)
{
- //To be replaced later by the method, reading individual parameters from the database
- if(fCalibrationDB){
- return fCalibrationDB->Calibrate(amp,absId) ;
+ // Convert digitized amplitude into energy.
+ // Calibration parameters are taken from calibration data base for raw data,
+ // or from digitizer parameters for simulated data.
+
+ if(fCalibData){
+ Int_t relId[4];
+ AliPHOSGetter *gime = AliPHOSGetter::Instance();
+ gime->PHOSGeometry()->AbsToRelNumbering(absId,relId) ;
+ Int_t module = relId[0];
+ Int_t column = relId[3];
+ Int_t row = relId[2];
+ if(absId <= fEmcCrystals) { //calibrate as EMC
+ fADCchanelEmc = fCalibData->GetADCchannelEmc (module,column,row);
+ fADCpedestalEmc = fCalibData->GetADCpedestalEmc(module,column,row);
+ return fADCpedestalEmc + amp*fADCchanelEmc ;
+ }
+ else //calibrate as CPV, not implemented yet
+ return 0;
}
else{ //simulation
if(absId <= fEmcCrystals) //calibrate as EMC
return ;
}
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
GetCalibrationParameters() ;
+
+ AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
+ if (fRawReader == 0)
+ gime->SetRawDigits(kFALSE);
+ else
+ gime->SetRawDigits(kTRUE);
if (fLastEvent == -1)
fLastEvent = gime->MaxEvent() - 1 ;
Int_t ievent ;
for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
- gime->Event(ievent, "D");
+ if (fRawReader == 0)
+ gime->Event(ievent ,"D"); // Read digits from simulated data
+ else
+ gime->Event(fRawReader,"W"); // Read digits from raw data
fNumberOfEmcClusters = fNumberOfCpvClusters = 0 ;
//____________________________________________________________________________
void AliPHOSClusterizerv1::GetCalibrationParameters()
{
+ // Set calibration parameters:
+ // if calibration database exists, they are read from database,
+ // otherwise, they are taken from digitizer.
+ //
+ // It is a user responsilibity to open CDB before reconstruction:
+ // AliCDBLocal *loc = new AliCDBLocal("CalibDB");
AliPHOSGetter * gime = AliPHOSGetter::Instance();
- if(gime->IsRawDigits()){
- fCalibrationDB = gime->CalibrationDB();
- }
- else{
- if ( !gime->Digitizer() )
- gime->LoadDigitizer();
- AliPHOSDigitizer * dig = gime->Digitizer();
- fADCchanelEmc = dig->GetEMCchannel() ;
- fADCpedestalEmc = dig->GetEMCpedestal();
+
+ if(AliCDBStorage::Instance())
+ fCalibData = (AliPHOSCalibData*)AliCDBStorage::Instance()
+ ->Get("PHOS/Calib/GainFactors_and_Pedestals",gAlice->GetRunNumber());
+
+ if(!fCalibData)
+ {
+ if ( !gime->Digitizer() )
+ gime->LoadDigitizer();
+ AliPHOSDigitizer * dig = gime->Digitizer();
+ fADCchanelEmc = dig->GetEMCchannel() ;
+ fADCpedestalEmc = dig->GetEMCpedestal();
- fADCchanelCpv = dig->GetCPVchannel() ;
- fADCpedestalCpv = dig->GetCPVpedestal() ;
- }
+ fADCchanelCpv = dig->GetCPVchannel() ;
+ fADCpedestalCpv = dig->GetCPVpedestal() ;
+ }
}
//____________________________________________________________________________
fWrite = kTRUE ;
- fCalibrationDB = 0 ;
+ fCalibData = 0 ;
SetEventRange(0,-1) ;
}