//***************************************************************************** // File: $RCSfile: $ // // Author: Joern Wuestenfeld // // Version: $Revision $ // Modified by $Author $ // // //***************************************************************************** //_HADES_CLASS_DESCRIPTION /////////////////////////////////////////////////////////////////////////////// // HMdcOepAddrCorrPar // // Parameter container for the MDC unapcker. // This container keeps all parameters that are needed for the unpacker of // the MDC data to correct wrong OEP addresses. // //***************************************************************************** #include "hmdcoepaddrcorrpar.h" #include "hpario.h" #include "hdetpario.h" #include "hparamlist.h" #include #include #include HMdcOepAddrCorrPar::HMdcOepAddrCorrPar(const char* name, const char* title, const char* context) : HParCond(name,title,context) { // default constructor } HMdcOepAddrCorrPar::HMdcOepAddrCorrPar(HMdcOepAddrCorrPar &par) { // copy constructor } HMdcOepAddrCorrPar::~HMdcOepAddrCorrPar(void) { //destructor } Bool_t HMdcOepAddrCorrPar::checkAddress(Int_t *addr) { // check if the passeda ddress is in the map, and return the corrected address then. // If address has been mapped, return true, else false. map::iterator it = address.find(*addr); if (it != address.end()) { *addr = (*it).second; return kTRUE; } else return kFALSE; } Bool_t HMdcOepAddrCorrPar::init(HParIo* inp,Int_t* set) { // intitializes the container from an input HDetParIo* input=inp->getDetParIo("HCondParIo"); if (input) { Bool_t rc = input->init(this,set); if (rc && changed){ address.clear(); for(Int_t i = 0; i < AddressLookupMap.GetSize()/2; i++) { address[AddressLookupMap[i*2+0]] = AddressLookupMap[i*2+1]; // set addFrom,addTo } return rc; } } return kFALSE; } void HMdcOepAddrCorrPar::putParams(HParamList* l) { // put parameters to param list putToArray(); l->add("AddressLookupMap",AddressLookupMap); } Bool_t HMdcOepAddrCorrPar::getParams(HParamList* l) { // Retrieve parameters from HParamList, if (!l) return kFALSE; if(! (l->fill("AddressLookupMap", &AddressLookupMap) )) { return kFALSE; } address.clear(); for(Int_t i = 0; i::iterator it; it = address.find(mapFrom); if(it == address.end()) { // new address address.insert(make_pair(mapFrom,mapTo)); } else { // already existing address modified (*it).second = mapTo; } } void HMdcOepAddrCorrPar::putToArray(void) { // put all mapping pairs from map address // and put them into the TArrayI. This methode // should be used only if values should // be set from macro to create the container // content after the values have been added // to the map using setMapping() map::iterator it; Int_t s,i = 0; s = address.size(); AddressLookupMap.Reset(); AddressLookupMap.Set(s*2); for(it= address.begin(); it!= address.end(); it++) { AddressLookupMap[i*2+0] = (*it).first; AddressLookupMap[i*2+1] = (*it).second; i++; } } void HMdcOepAddrCorrPar::printParam(void) { print(); cout<<"size="< 0x"<