//*-- Author : Ilse Koenig //*-- Modified: 10/03/2000 by Ilse Koenig //*-- Modified: 27/11/2000 by R. Holzmann //*-- Modified: 09/05/2002 by D.Zovinec //_HADES_CLASS_DESCRIPTION /////////////////////////////////////////////////////////////////////////////// // HTofCalPar // // Calibration parameters for TOF // /////////////////////////////////////////////////////////////////////////////// using namespace std; #include "htofcalpar.h" #include "hades.h" #include "hruntimedb.h" #include "hspectrometer.h" #include "htofdetector.h" #include "hpario.h" #include "hdetpario.h" #include #include ClassImp(HTofCalPar) ClassImp(HTofCalParSec) ClassImp(HTofCalParMod) ClassImp(HTofCalParCell) void HTofCalParCell::setDefaults(void) { // sets the default values leftK=0.065; // in ns/ch rightK=0.065; vGroup=160.0; // in mm/ns posK=0.0; timK=0.0; pedestalL=0.0; pedestalR=0.0; attLen=0.0; gainAsym=0.0; edepK=1.0; twC1=0.0; twC2=0.0; twC3=0.0; } void HTofCalParCell::Streamer(TBuffer &R__b) { if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(); TObject::Streamer(R__b); R__b >> leftK; R__b >> rightK; R__b >> vGroup; R__b >> posK; R__b >> timK; R__b >> pedestalL; R__b >> pedestalR; R__b >> attLen; R__b >> gainAsym; if(R__v <= 1){ edepK = 0.0; twC1 = 0.0; twC2 = 0.0; twC3 = 0.0; } if(R__v == 2){ R__b >> edepK; twC1 = 0.0; twC2 = 0.0; twC3 = 0.0; } if(R__v >= 3){ R__b >> edepK; R__b >> twC1; R__b >> twC2; R__b >> twC3; } } else { R__b.WriteVersion(HTofCalParCell::IsA()); TObject::Streamer(R__b); R__b << leftK; R__b << rightK; R__b << vGroup; R__b << posK; R__b << timK; R__b << pedestalL; R__b << pedestalR; R__b << attLen; R__b << gainAsym; R__b << edepK; R__b << twC1; R__b << twC2; R__b << twC3; } } HTofCalParMod::HTofCalParMod(Int_t s, Int_t m) { // constructor creates an array of pointers of type HTofCalParCell HDetector* det=gHades->getSetup()->getDetector("Tof"); Int_t n=det->getMaxComponents(); if (det->getModule(s,m)) { array = new TObjArray(n); for(Int_t i=0 ; iAddAt(new HTofCalParCell(),i); } else array = new TObjArray(0); } HTofCalParMod::~HTofCalParMod(void) { // destructor if(array) { array->Delete(); delete array; } } HTofCalParSec::HTofCalParSec(Int_t s, Int_t n) { // constructor creates an array of pointers of type HTofCalParCell array = new TObjArray(n); for(Int_t i=0 ; iAddAt(new HTofCalParMod(s,i),i); } HTofCalParSec::~HTofCalParSec(void) { // destructor array->Delete(); delete array; } HTofCalPar::HTofCalPar(const Char_t* name,const Char_t* title, const Char_t* context) : HParSet(name,title,context) { // constructor creates an array of pointers of type HTofCalParSec // The container name is set to "TofCalPar" strcpy(detName,"Tof"); array = new TObjArray(6); for (Int_t i=0; i<6; i++) array->AddAt(new HTofCalParSec(i,22),i); } HTofCalPar::~HTofCalPar(void) { // destructor array->Delete(); delete array; } Bool_t HTofCalPar::init(HParIo* inp,Int_t* set) { // intitializes the container from an input HDetParIo* input=inp->getDetParIo("HTofParIo"); if (input) return (input->init(this,set)); return kFALSE; } Int_t HTofCalPar::write(HParIo* output) { // writes the container to an output HDetParIo* out=output->getDetParIo("HTofParIo"); if (out) return out->write(this); return -1; } void HTofCalPar::clear() { // sets the default values for(Int_t i0=0;i0