#include "TString.h" #include "hemcdigipar.h" #include "hpario.h" #include "hdetpario.h" #include "hparamlist.h" //_HADES_CLASS_DESCRIPTION ///////////////////////////////////////////////////////////////////////// // // HEmcDigiPar: // Container for the EMC digitization parameters // // (Condition Style) // ///////////////////////////////////////////////////////////////////////// ClassImp(HEmcDigiPar) HEmcDigiPar::HEmcDigiPar(const char* name,const char* title,const char* context) : HParCond(name,title,context) { // constructor enCorrection.Set(256); fsigmaTFunc = 0; fsigmaTFunc2 = 0; clear(); } Double_t HEmcDigiPar::calcSigmaT(Int_t type, Double_t energy) { // return sigma T from TF1 // type 1 = 1.5 inch PMT // else 3 inch PMT // return -1 if TF! are not initialized if(fsigmaTFunc == 0 || fsigmaTFunc2 == 0){ Error("calcSigmaT()","TF1 not yet initialized!"); return -1; } if(type == 1) return fsigmaTFunc ->Eval(energy); else return fsigmaTFunc2->Eval(energy); } Bool_t HEmcDigiPar::init(HParIo* inp,Int_t* set) { // intitializes the container from an input Bool_t rc = HParCond::init(inp,set); if (rc && changed){ // make TF1 new if(fsigmaTFunc ) delete fsigmaTFunc; if(fsigmaTFunc2) delete fsigmaTFunc2; fsigmaTFunc = new TF1("fsigmaTFunc","[0]+[1]/(x+[2])",10,3000); fsigmaTFunc->SetParameters(sigmaTFunc.GetArray()); fsigmaTFunc2 = new TF1("fsigmaTFunc2","[0]+[1]/(x+[2])",10,3000); fsigmaTFunc2->SetParameters(sigmaTFunc2.GetArray()); } return rc; } void HEmcDigiPar::clear(void) { // clears the container sigmaT = phot2E = phot2E2 = sigmaEIntern = sigmaEReal = sigmaEReal2 = 0.F; enCorrection.Reset(); sigmaTFunc .Reset(); sigmaTFunc2.Reset(); } void HEmcDigiPar::fill(Float_t sT, Float_t p2e, Float_t p2e2, Float_t seI, Float_t seR, Float_t seR2) { // sets the parameters sigmaT = sT; phot2E = p2e; phot2E2 = p2e2; sigmaEIntern = seI; sigmaEReal = seR; sigmaEReal2 = seR2; } void HEmcDigiPar::putParams(HParamList* l) { // puts all parameters to the parameter list, which is used by the io if (!l) return; l->add("sigmaT", sigmaT); l->add("phot2E", phot2E); l->add("phot2E2", phot2E2); l->add("sigmaEIntern",sigmaEIntern); l->add("sigmaEReal", sigmaEReal); l->add("sigmaEReal2", sigmaEReal2); l->add("enCorrection", enCorrection); l->add("sigmaTFunc" , sigmaTFunc); l->add("sigmaTFunc2", sigmaTFunc2); } Bool_t HEmcDigiPar::getParams(HParamList* l) { // gets all parameters from the parameter list, which is used by the io if (!l) return kFALSE; if (!(l->fill("sigmaT", &sigmaT))) return kFALSE; if (!(l->fill("phot2E", &phot2E))) return kFALSE; if (!(l->fill ("phot2E2", &phot2E2))) return kFALSE; if (!(l->fill("sigmaEIntern",&sigmaEIntern))) return kFALSE; if (!(l->fill("sigmaEReal", &sigmaEReal))) return kFALSE; if (!(l->fill("sigmaEReal2", &sigmaEReal2))) return kFALSE; if (!(l->fill("enCorrection", &enCorrection))) return kFALSE; if (!(l->fill("sigmaTFunc" , &sigmaTFunc ))) return kFALSE; if (!(l->fill("sigmaTFunc2", &sigmaTFunc2))) return kFALSE; return kTRUE; } void HEmcDigiPar::Streamer(TBuffer &R__b) { // Stream an object of class HForwardCandFinderPar. UInt_t R__s, R__c; if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { } HParCond::Streamer(R__b); R__b >> sigmaT; R__b >> phot2E; R__b >> phot2E2; R__b >> sigmaEIntern; R__b >> sigmaEReal; R__b >> sigmaEReal2; if(R__v > 1) { enCorrection.Streamer(R__b); } else { enCorrection.Set(256); } if(R__v > 2) { sigmaTFunc.Streamer(R__b); sigmaTFunc2.Streamer(R__b); } R__b.CheckByteCount(R__s, R__c, HEmcDigiPar::IsA()); } else { R__c = R__b.WriteVersion(HEmcDigiPar::IsA(), kTRUE); HParCond::Streamer(R__b); R__b << sigmaT; R__b << phot2E; R__b << phot2E2; R__b << sigmaEIntern; R__b << sigmaEReal; R__b << sigmaEReal2; enCorrection.Streamer(R__b); sigmaTFunc.Streamer(R__b); sigmaTFunc2.Streamer(R__b); R__b.SetByteCount(R__c, kTRUE); } }