#include "AliZDCPedestals.h"
ClassImp(AliZDCPedestals)
AliZDCPedestals::AliZDCPedestals():
TNamed()
{
Reset();
}
AliZDCPedestals::AliZDCPedestals(const char* name):
TNamed()
{
TString namst = "Calib_";
namst += name;
SetName(namst.Data());
SetTitle(namst.Data());
Reset();
for(Int_t i=0; i<48; i++){
fMeanPedestal[i] = 0.;
fMeanPedWidth[i] = 0.;
fOOTPedestal[i] = 0.;
fOOTPedWidth[i] = 0.;
for(Int_t j=0; j<2; j++) fPedCorrCoeff[j][i] = 0.;
}
}
AliZDCPedestals::AliZDCPedestals(const AliZDCPedestals& calibda) :
TNamed(calibda)
{
SetName(calibda.GetName());
SetTitle(calibda.GetName());
Reset();
for(int t=0; t<48; t++){
fMeanPedestal[t] = calibda.GetMeanPed(t);
fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
fOOTPedestal[t] = calibda.GetOOTPed(t);
fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
}
}
AliZDCPedestals &AliZDCPedestals::operator =(const AliZDCPedestals& calibda)
{
SetName(calibda.GetName());
SetTitle(calibda.GetName());
Reset();
for(int t=0; t<48; t++){
fMeanPedestal[t] = calibda.GetMeanPed(t);
fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
fOOTPedestal[t] = calibda.GetOOTPed(t);
fOOTPedWidth[t] = calibda.GetOOTPedWidth(t);
fPedCorrCoeff[0][t] = calibda.GetPedCorrCoeff0(t);
fPedCorrCoeff[1][t] = calibda.GetPedCorrCoeff1(t);
}
return *this;
}
AliZDCPedestals::~AliZDCPedestals()
{
}
void AliZDCPedestals::Reset()
{
memset(fMeanPedestal,0,48*sizeof(Float_t));
memset(fMeanPedWidth,0,48*sizeof(Float_t));
memset(fOOTPedestal,0,48*sizeof(Float_t));
memset(fOOTPedWidth,0,48*sizeof(Float_t));
}
void AliZDCPedestals::Print(Option_t *) const
{
printf("\n ####### In-time pedestal values (mean value, sigma) ####### \n");
for(int t=0; t<48; t++)
printf("\t ADC%d (%.1f, %.1f)\n",t,fMeanPedestal[t],fMeanPedWidth[t]);
printf("\n\n ####### Out-of-time pedestal values (mean value, sigma) ####### \n");
for(int t=0; t<48; t++)
printf("\t ADC-OoT%d (%.1f, %.1f)\n",t,fOOTPedestal[t],fOOTPedWidth[t]);
}
void AliZDCPedestals::SetMeanPed(Float_t* MeanPed)
{
if(MeanPed) for(int t=0; t<48; t++) fMeanPedestal[t] = MeanPed[t];
else for(int t=0; t<48; t++) fMeanPedestal[t] = 0.;
}
void AliZDCPedestals::SetMeanPedWidth(Float_t* MeanPedWidth)
{
if(MeanPedWidth) for(int t=0; t<48; t++) fMeanPedWidth[t] = MeanPedWidth[t];
else for(int t=0; t<48; t++) fMeanPedWidth[t] = 0.;
}
void AliZDCPedestals::SetOOTPed(Float_t* OOTPed)
{
if(OOTPed) for(int t=0; t<48; t++) fOOTPedestal[t] = OOTPed[t];
else for(int t=0; t<48; t++) fOOTPedestal[t] = 0.;
}
void AliZDCPedestals::SetOOTPedWidth(Float_t* OOTPedWidth)
{
if(OOTPedWidth) for(int t=0; t<48; t++) fOOTPedWidth[t] = OOTPedWidth[t];
else for(int t=0; t<48; t++) fOOTPedWidth[t] = 0.;
}
void AliZDCPedestals:: SetPedCorrCoeff(Float_t* PedCorrCoeff)
{
if(PedCorrCoeff){
for(Int_t j=0; j<2; j++){
for(int t=0; t<48; t++)
fPedCorrCoeff[j][t] = PedCorrCoeff[t];
}
}
else{
for(Int_t j=0; j<2; j++){
for(int t=0; t<48; t++)
fPedCorrCoeff[j][t] = 0.;
}
}
}
void AliZDCPedestals:: SetPedCorrCoeff(Float_t* PedCorrCoeff0, Float_t* PedCorrCoeff1)
{
if(PedCorrCoeff0 && PedCorrCoeff1){
for(int t=0; t<48; t++){
fPedCorrCoeff[0][t] = PedCorrCoeff0[t];
fPedCorrCoeff[1][t] = PedCorrCoeff1[t];
}
}
else{
for(int t=0; t<48; t++){
fPedCorrCoeff[0][t] = 0.;
fPedCorrCoeff[1][t] = 0.;
}
}
}