//*-- AUTHOR : J.Wuestenfeld //*-- Modified : 13/08/2003 by J. Wuestenfeld //_HADES_CLASS_DESCRIPTION //////////////////////////////////////////////////////////////////////////// // HMdcTdcChannel // // Container class for the TDC channle masks of the MDC // //////////////////////////////////////////////////////////////////////////// using namespace std; #include #include "hmdctdcchannel.h" #include "hades.h" #include "hruntimedb.h" #include "hspectrometer.h" #include "hmdcdetector.h" #include "hpario.h" #include "hdetpario.h" #include "hmdcrawstruct.h" #include "hmdclookupgeom.h" #include "hmessagemgr.h" #include "TSystem.h" #include #include #include ClassImp(HMdcTdcChannelTdc) ClassImp(HMdcTdcChannelMbo) ClassImp(HMdcTdcChannelMod) ClassImp(HMdcTdcChannelSec) ClassImp(HMdcTdcChannel) void HMdcTdcChannelTdc::fill(HMdcTdcChannelTdc& r) { channelMask[0]=r.getChannelMask(0); channelMask[1]=r.getChannelMask(1); } HMdcTdcChannelMbo::HMdcTdcChannelMbo(Int_t tdc, const Text_t* name) { // constructor takes the number of TDCs and the name of the MBO SetName(name); array = new TObjArray(tdc); for (Int_t i=0; iAddAt(new HMdcTdcChannelTdc(),i); } HMdcTdcChannelMbo::~HMdcTdcChannelMbo() { // destructor array->Delete(); delete array; } HMdcTdcChannelMod::HMdcTdcChannelMod(Int_t mbo) { // constructor takes the number of MBOs // The array objects of type HMdcTdcChannelMbo are created in the init function. array = new TObjArray(mbo); } HMdcTdcChannelMod::~HMdcTdcChannelMod() { // destructor array->Delete(); delete array; } void HMdcTdcChannelMod::createMbo(Int_t mbo, Int_t nTdcs, const Char_t* mboName) { // creates the array object of type HMdcTdcChannelMbo if (mboGetSize() && array->At(mbo)==NULL) { array->AddAt(new HMdcTdcChannelMbo(nTdcs,mboName),mbo); } } HMdcTdcChannelSec::HMdcTdcChannelSec(Int_t mod) { // constructor takes the number of modules array = new TObjArray(mod); for (Int_t i=0; iAddAt(new HMdcTdcChannelMod(),i); } HMdcTdcChannelSec::~HMdcTdcChannelSec() { // destructor array->Delete(); delete array; } HMdcTdcChannel::HMdcTdcChannel(const Char_t* name,const Char_t* title, const Char_t* context,Int_t n) : HParSet(name,title,context) { // constructor strcpy(detName,"Mdc"); oraVersion=-1; array = new TObjArray(n); mapNotConnectedChannels = kFALSE; status = kTRUE; for (Int_t i=0; iAddAt(new HMdcTdcChannelSec(),i); pRawStruct=(HMdcRawStruct*)(gHades->getRuntimeDb()->getContainer("MdcRawStruct")); pLookupGeom = (HMdcLookupGeom *)(gHades->getRuntimeDb()->getContainer("MdcLookupGeom")); } HMdcTdcChannel::~HMdcTdcChannel() { // destructor array->Delete(); delete array; } Bool_t HMdcTdcChannel::init(HParIo* inp,Int_t* set) { // creates the array objects of type HMdcTdcChannelMbo using the data in the parameter container // MdcRawStruct and initializes the container from an input if (pRawStruct==NULL) { Error("HMdcTdcChannel::init()","MdcTdcChannel not initialized, container MdcRawStruct is NULL"); return kFALSE; } for(Int_t s=0;sgetDetParIo("HMdcParIo"); if(input) if (!input->init(this,set)) return kFALSE; return kTRUE; } Int_t HMdcTdcChannel::write(HParIo* output) { // writes the container to an output HDetParIo* out=output->getDetParIo("HMdcParIo"); if (out) return out->write(this); return -1; } void HMdcTdcChannel::readline(const Char_t* buf, Int_t* set) { // decodes one line read from ascii file I/O and calls HMdcTdcChannelTdc::fill(...) Int_t sec, mod, mbo, dbo; Int_t cal,meas; Char_t mboName[20]; sscanf(buf,"%i%i%i%s%i%x%x",&sec, &mod, &mbo, mboName, &dbo, &cal,&meas); Int_t n=sec*4+mod; if (!set[n]) return; HMdcTdcChannelMbo& rMbo=(*this)[sec][mod][mbo]; rMbo.SetName(mboName); HMdcTdcChannelTdc& tdc=rMbo[dbo]; tdc.fill(cal,0); tdc.fill(meas,1); set[n]=999; } void HMdcTdcChannel::readLineFromFile(const Char_t* buf) { // decodes one line read from ascii file I/O and calls HMdcTdcChannelTdc::fill(...) Int_t sec, mod, mbo, dbo; Int_t cal,meas; sscanf(buf,"%i%i%i%i%x%x", &mod, &sec, &mbo, &dbo, &cal,&meas); HMdcRawModStru & rawMod=(*pRawStruct)[sec][mod]; HMdcRawMothStru &rawMbo=rawMod[mbo]; if (rawMbo.getNTdcs() >= dbo*16 ) { HMdcTdcChannelMbo& rMbo=(*this)[sec][mod][mbo]; HMdcTdcChannelTdc& db=rMbo[dbo-1]; db.fill(cal,0); db.fill(meas,1); } } void HMdcTdcChannel::putAsciiHeader(TString& header) { // puts the ascii header to the string used in HMdcParAsciiFileIo header= "# Channelmasks of the MDC TDC\n" "# Format:\n" "# sector module mbo mboName TDC# cal. mask meas. mask\n"; } Bool_t HMdcTdcChannel::writeline(Char_t *buf, Int_t sec, Int_t mod, Int_t mbo, Int_t dbo) { // writes one line to the buffer used by ascii file I/O HMdcTdcChannelMbo& rMbo=(*this)[sec][mod][mbo]; HMdcTdcChannelTdc& db=rMbo[dbo]; sprintf(buf,"%1i %1i %2i %s %2i %2x %2x\n", sec, mod, mbo, rMbo.GetName(), dbo, db.getChannelMask(0),db.getChannelMask(1)); return kTRUE; } void HMdcTdcChannel::clear() { // clears the container oraVersion=-1; for(Int_t s=0;sgetMsg()->info(10,HMessageMgr::DET_MDC,GetName(), "%1i %1i %2i %s %1i %2x %2x", s, m, l, mbo.GetName(), c, mbo[c].getChannelMask(0), mbo[c].getChannelMask(1)); } } } } SEPERATOR_msg("-",60); } void HMdcTdcChannel::mapOutUnusedChannels(void) { // Maps out all channels that have no wire connected. Test is done against HMdcLookupGeom container. for(Int_t s=0;s> array; R__b >> oraVersion; R__b >> status; R__b >> mapNotConnectedChannels; if (R__v==1) { Int_t* dummy; R__b >> dummy; // HMdcEvReadout* } R__b.CheckByteCount(R__s, R__c, HMdcTdcChannel::IsA()); } else { R__c = R__b.WriteVersion(HMdcTdcChannel::IsA(), kTRUE); HParSet::Streamer(R__b); R__b << array; R__b << oraVersion; R__b << status; R__b << mapNotConnectedChannels; R__b.SetByteCount(R__c, kTRUE); } }