#include "hmdcdedx2scale.h" #include "TH2.h" ClassImp(HMdcDeDx2Scale) HMdcDeDx2Scale::HMdcDeDx2Scale(const Char_t* name,const Char_t* title,const Char_t* context) : HParCond(name,title,context) { fNbinTheta = 90; //45; fNbinPhi = 360; //180; fScale.Set(fNbinTheta*fNbinPhi); // fScale.Reset(1.); fScaleSim.Set(fNbinTheta*fNbinPhi); // fScaleSim.Reset(1.); fPhiBin = 360./fNbinPhi; fThetaBin = 90./fNbinTheta; } HMdcDeDx2Scale::~HMdcDeDx2Scale() { // destructor } void HMdcDeDx2Scale::clear() { fScale.Reset(1.); fScaleSim.Reset(1.); status = kFALSE; resetInputVersions(); changed = kFALSE; } Bool_t HMdcDeDx2Scale::fillScaleTable(TH2* hPhiTheta) { if(hPhiTheta->GetNbinsY() != fNbinTheta) return kFALSE; if(hPhiTheta->GetNbinsX() != fNbinPhi) return kFALSE; if(hPhiTheta->GetXaxis()->GetXmin() != 0.) return kFALSE; if(hPhiTheta->GetYaxis()->GetXmin() != 0.) return kFALSE; if(hPhiTheta->GetXaxis()->GetXmax() != 360.) return kFALSE; if(hPhiTheta->GetYaxis()->GetXmax() != 90.) return kFALSE; fScale.Reset(1.); for(Int_t bph=0;bphGetBinContent(bph+1,bth+1); if(bin > 0.) fScale[index(bph,bth)] = 1./bin; } } return kTRUE; } Bool_t HMdcDeDx2Scale::fillScaleTableSim(TH2* hPhiTheta) { if(hPhiTheta->GetNbinsY() != fNbinTheta) return kFALSE; if(hPhiTheta->GetNbinsX() != fNbinPhi) return kFALSE; if(hPhiTheta->GetXaxis()->GetXmin() != 0.) return kFALSE; if(hPhiTheta->GetYaxis()->GetXmin() != 0.) return kFALSE; if(hPhiTheta->GetXaxis()->GetXmax() != 360.) return kFALSE; if(hPhiTheta->GetYaxis()->GetXmax() != 90.) return kFALSE; fScaleSim.Reset(1.); for(Int_t bph=0;bphGetBinContent(bph+1,bth+1); if(bin > 0.) fScaleSim[index(bph,bth)] = 1./bin; } } return kTRUE; } TH2F* HMdcDeDx2Scale::getScaleTable(void) { TH2F* hout = new TH2F("hMdcDeDx2Scale","HMdcDeDx2Scale",fNbinPhi,0,360.,fNbinTheta,0,90.); for(Int_t bph=0;bphSetBinContent(bph+1,bth+1,fScale[index(bph,bth)]); } } return hout; } TH2F* HMdcDeDx2Scale::getScaleTableSim(void) { TH2F* hout = new TH2F("hMdcDeDx2ScaleSim","HMdcDeDx2ScaleSim",fNbinPhi,0,360.,fNbinTheta,0,90.); for(Int_t bph=0;bphSetBinContent(bph+1,bth+1,fScaleSim[index(bph,bth)]); } } return hout; } void HMdcDeDx2Scale::putParams(HParamList* l) { // Puts all params of HMdcDeDx2Scale to the parameter list of // HParamList (which ist used by the io); if (!l) return; l->add("fNbinTheta" ,fNbinTheta); l->add("fNbinPhi" ,fNbinPhi ); l->add("fScale" ,fScale ); l->add("fScaleSim" ,fScaleSim ); l->add("fPhiBin" ,fPhiBin ); l->add("fThetaBin " ,fThetaBin ); } Bool_t HMdcDeDx2Scale::getParams(HParamList* l) { if (!l) return kFALSE; if(!( l->fill("fNbinTheta" ,&fNbinTheta))) return kFALSE; if(!( l->fill("fNbinPhi" ,&fNbinPhi ))) return kFALSE; if(!( l->fill("fScale" ,&fScale ))) return kFALSE; if(!( l->fill("fScaleSim" ,&fScaleSim ))) return kFALSE; if(!( l->fill("fPhiBin" ,&fPhiBin ))) return kFALSE; if(!( l->fill("fThetaBin " ,&fThetaBin ))) return kFALSE; return kTRUE; }