#include "hades.h"
#include "hcategory.h"
#include "hdatasource.h"
#include "hiterator.h"
#include "hldsubevt.h"
#include "hevent.h"
#include "hmdcraw.h"
#include "hmdcrawstruct.h"
#include "hspectrometer.h"
#include "hmdcdetector.h"
#include "hruntimedb.h"
#include "heventheader.h"
#include "hmdcdef.h"
#include "TSystem.h"
#include "hmdcdataword.h"
#include "hmdcevreadout.h"
#include "hmdcraweventheader.h"
#include "hmdcunpacker.h"
#include "hmessagemgr.h"
ClassImp(HMdcUnpacker)
HMdcDataWord *HMdcUnpacker::dataword=0;
Bool_t HMdcUnpacker::noComment=kFALSE;
const TString HMdcUnpacker::excludeBlackListContextDefaultString="undefined exclude black list context";
const TString HMdcUnpacker::recoverBlackListContextDefaultString="undefined recover black list context";
HMdcUnpacker::HMdcUnpacker(Int_t id , Bool_t dbg, Bool_t consisCheck) : HldUnpack()
{
subEvtId = id;
dataword = new HMdcDataWord();
debug=dbg;
consistencyCheck=consisCheck;
setDefaults();
}
HMdcUnpacker::HMdcUnpacker(Int_t id, Int_t myversion, Bool_t dbg, Bool_t consisCheck)
{
HMdcUnpacker::HMdcUnpacker(id, dbg, consisCheck);
setDecodeVersion(myversion);
}
HMdcUnpacker::HMdcUnpacker(HMdcUnpacker& mdc)
{
subEvtId = mdc.subEvtId;
dataword = mdc.dataword;
debug = mdc.debug;
consistencyCheck = mdc.consistencyCheck;
setDefaults();
setDecodeVersion(mdc.getDecodeVersion());
}
HMdcUnpacker::~HMdcUnpacker()
{
if(dataword) delete dataword;
dataword=0;
if (excludeBlackListMask) delete[] excludeBlackListMask ;
if (excludeBlackListAdress) delete[] excludeBlackListAdress;
if (excludedBlackListCounters) delete[] excludedBlackListCounters;
if (recoverBlackListMask) delete[] recoverBlackListMask ;
if (recoverBlackListAdress) delete[] recoverBlackListAdress;
if (recoveredBlackListCounters) delete[] recoveredBlackListCounters;
}
void HMdcUnpacker::setDefaults(void)
{
pReadout = NULL;
standalone=kFALSE;
tdcMode=0;
pMdcRawEventHeaderCat=0;
disableSamNrConsistencyCheck=kFALSE;
mdcRawEventHeaderCatPersistency=kFALSE;
mdcDataWordCatPersistency=kFALSE;
fillDataWord=kFALSE;
subHeaderDecodeVersion=0;
maxDecodeVersion=1;
setDecodeVersion(1,kFALSE);
unpackerDebug=kFALSE;
rocEvtHeaderSize = UNCOMPRESSED_ROC_HEADERSIZE;
noComment=kFALSE;
for(Int_t s=0; s<6; s++) {
for(Int_t m=0; m<4; m++) {
setup[s][m]=0;
}
}
rawc=NULL;
pRawCat = NULL;
pMdcRawEventHeaderCat = NULL;
pMdcDataWordCat = NULL;
continueDecodingAfterInconsistency=kFALSE;
excludeBlackList=kFALSE;
excludedBlackListCounters=NULL;
excludeBlackListMask=NULL;
excludeBlackListAdress=NULL;
excludeBlackListContext=excludeBlackListContextDefaultString;
excludeBlackListSize = 0;
recoverBlackList=kFALSE;
recoveredBlackListCounters=NULL;
recoverBlackListMask=NULL;
recoverBlackListAdress=NULL;
recoverBlackListContext=recoverBlackListContextDefaultString;
recoveryStorage = NULL;
recoveryStorageCounter = 0;
recoverBlackListSize = 0;
createBlackListRecoveryTools=0;
}
Bool_t HMdcUnpacker::getQuietMode()
{
return noComment;
}
void HMdcUnpacker::setQuietMode(Bool_t quiet)
{
noComment = quiet;
dataword->setQuietMode(quiet);
if (quiet) warningSetQuietMode();
}
void HMdcUnpacker::setContinueDecodingAfterInconsistency(Bool_t cont)
{
continueDecodingAfterInconsistency=cont;
}
UInt_t HMdcUnpacker::getDecodeVersion(void)
{
return decodeVersion;
}
void HMdcUnpacker::setDecodeVersion(UInt_t version,Bool_t manual)
{
if (version>maxDecodeVersion || version < 0)
{
errorAndExitSetDecodeVersion(version);
}
else
{
decodeVersion=version;
versionSetManual=manual;
}
}
Int_t HMdcUnpacker::getTdcMode(void)
{
return tdcMode;
}
void HMdcUnpacker::setTdcMode(Int_t i)
{
tdcMode=(i == 0 || i == 1)? i : 0;
return;
}
void HMdcUnpacker::setRocEvtHeaderSize(UInt_t ui)
{
rocEvtHeaderSize=ui;
}
TString HMdcUnpacker::myexec(Char_t * in)
{
Char_t textfile[1000];
FILE *pipe = gSystem->OpenPipe(in,"r");
fscanf(pipe,"%s",textfile);
gSystem->ClosePipe(pipe);
return TString(textfile);
}
void HMdcUnpacker::print(TString parent)
{
Info(parent.Data(),"############################################################");
Info(parent.Data(),"HMdcUnpacker: ClassName %s :",this->ClassName());
Info(parent.Data(),"%s: %p ClassName %s","HMdcEvReadout",pReadout,(pReadout)?pReadout->ClassName():"---");
Info(parent.Data(),"%s: %3i ","sub event Id",subEvtId);
Info(parent.Data(),"%s: %i","TdcMode",tdcMode);
Info(parent.Data(),"%s: %s","debug",(debug)?"kTRUE":"kFALSE");
Info(parent.Data(),"%s: %s","consistencyCheck",(consistencyCheck)?"kTRUE":"kFALSE");
Info(parent.Data(),"%s: %s","disableSamNrConsistencyCheck",(disableSamNrConsistencyCheck)?"kTRUE":"kFALSE");
Info(parent.Data(),"%s: %s","mdcRawEventHeaderCatPersistency",(mdcRawEventHeaderCatPersistency)?"kTRUE":"kFALSE");
Info(parent.Data(),"%s: %s","mdcDataWordCatPersistency",(mdcDataWordCatPersistency)?"kTRUE":"kFALSE");
Info(parent.Data(),"%s: %s","fillDataWord",(fillDataWord)?"kTRUE":"kFALSE");
Info(parent.Data(),"%s: %s","standalone",standalone?"kTRUE":"kFALSE");
Info(parent.Data(),"%s: %3i ","decodeVersion",decodeVersion);
Info(parent.Data(),"%s: %2i ","subHeaderDecodeVersion",subHeaderDecodeVersion);
Info(parent.Data(),"%s: %10i ","versionSwitchId (RunId) from which on to use version 1",versionSwitchId);
Info(parent.Data(),"%s: %3i ","ROC headerSize",rocEvtHeaderSize);
};
Bool_t HMdcUnpacker::init()
{
getMdcSetup();
pRawCat = NULL;
HRuntimeDb *rtdb = gHades->getRuntimeDb();
rawc = (HMdcRawStruct*) rtdb->getContainer("MdcRawStruct");
if (!rawc)
{
errorInitCannotGetParameterContainer("MdcRawStruct");
return kFALSE;
}
if (!rawc->isStatic()) ((HParSet*)rawc)->init();
pReadout = (HMdcEvReadout*) rtdb->getContainer("MdcEvReadout");
if (!pReadout)
{
errorInitCannotGetParameterContainer("MdcEvReadout");
return kFALSE;
}
if (excludeBlackList)
{ if (initExcludeBlackList() == EXIT_FAILURE) {exit(EXIT_FAILURE);} }
if (recoverBlackList)
{ if (initRecoverBlackList() == EXIT_FAILURE) {exit(EXIT_FAILURE);} }
if(!(pRawCat = initCategory(catMdcRaw, "catMdcRaw")) ){ return kFALSE; }
if(!(pMdcRawEventHeaderCat = initCategory(catMdcRawEventHeader,"catMdcRawEventHeader"))){ return kFALSE; }
if (debug && fillDataWord)
{ if (!(pMdcDataWordCat = initCategory(catMdcDataWord, "catMdcDataWord")) ){ return kFALSE; }}
pMdcRawEventHeaderCat->setPersistency(mdcRawEventHeaderCatPersistency);
if (debug && fillDataWord)
{ pMdcDataWordCat->setPersistency(mdcDataWordCatPersistency); }
return kTRUE;
}
void HMdcUnpacker::getMdcSetup()
{
HMdcDetector* mdcDet=(HMdcDetector*)(((HSpectrometer*)(gHades->getSetup()))->getDetector("Mdc"));
if (!mdcDet)
{
errorAndExitGetMdcSetup();
}
for(Int_t sector=0; sector<6; sector++)
{
for(Int_t module=0; module<4; module++)
{
setup[sector][module]=(mdcDet->getModule(sector, module)) ? 1:0;
}
}
}
HCategory* HMdcUnpacker::initCategory(Cat_t cat, TString catname, TString detector)
{
HCategory * category = 0;
category = (HCategory*)(((HEvent*)(gHades->getCurrentEvent()))->getCategory(cat));
if (!category)
{
category=(HCategory*)((HMdcDetector*)(((HSpectrometer*)(gHades->getSetup()))->getDetector(detector.Data()))->buildCategory(cat));
if (!category)
{
errorInitCategoryCannotGetCategory(catname);
return NULL;
}
if (!((HEvent*)(gHades->getCurrentEvent()))->addCategory(cat,category,detector.Data()))
{
errorInitCategoryCannotAddCategory(catname,detector);
return NULL;
}
}
return category;
}
Int_t HMdcUnpacker::initExcludeBlackList(void)
{
if (
!excludeBlackListContext.CompareTo("sep05") ||
!excludeBlackListContext.CompareTo("apr06") ||
!excludeBlackListContext.CompareTo("may06")
)
{
excludeBlackListSize=1;
if (excludeBlackListSize)
{
excludeBlackListMask = new UInt_t[excludeBlackListSize];
excludeBlackListAdress = new UInt_t[excludeBlackListSize];
excludedBlackListCounters = new Int_t[excludeBlackListSize];
excludeBlackListMask [0]=0xffe00000;
excludeBlackListAdress[0]=0x2cc00000;
for (Int_t arrayIndex=0; arrayIndex<excludeBlackListSize; arrayIndex++)
{
excludedBlackListCounters[arrayIndex]=0;
}
}
}
else
{
if(!excludeBlackListContext.CompareTo("sep08"))
{
if((subEvtId==222) || (subEvtId == 204))
{
excludeBlackListSize=1;
excludeBlackListMask = new UInt_t[excludeBlackListSize];
excludeBlackListAdress = new UInt_t[excludeBlackListSize];
excludedBlackListCounters = new Int_t[excludeBlackListSize];
if(subEvtId==222)
excludeBlackListMask[0] = 0xffe00000;
else
if(subEvtId == 204)
excludeBlackListMask[0] = 0xffe00000;
if(subEvtId == 222)
excludeBlackListAdress[0] = 0x2cc00000;
else
if(subEvtId == 204)
excludeBlackListAdress[0]= 0x08800000;
for (Int_t arrayIndex=0; arrayIndex<excludeBlackListSize; arrayIndex++)
{
excludedBlackListCounters[arrayIndex]=0;
}
}
}
else
if (!excludeBlackListContext.CompareTo(excludeBlackListContextDefaultString))
{
errorAndExitInitExcludeBlackListNoValidContext();
}
else
{
warningInitExcludeBlackListNoValidContext(excludeBlackListContext);
disableExcludeBlackList();
}
}
return EXIT_SUCCESS;
}
Int_t HMdcUnpacker::initRecoverBlackList(void)
{
if (
!recoverBlackListContext.CompareTo("sep05") ||
!recoverBlackListContext.CompareTo("apr06") ||
!recoverBlackListContext.CompareTo("may06")
)
{
recoverBlackListSize=1;
if (recoverBlackListSize)
{
recoverBlackListMask = new UInt_t[recoverBlackListSize];
recoverBlackListAdress = new UInt_t[recoverBlackListSize];
recoveredBlackListCounters = new Int_t[recoverBlackListSize];
if (! excludeBlackListMask )
{
recoverBlackListMask [0]=0xffe00000;
recoverBlackListAdress[0]=0x2cc00000;
}
else
{
recoverBlackListMask [0]=excludeBlackListMask [0];
recoverBlackListAdress[0]=excludeBlackListAdress[0];
}
for (Int_t arrayIndex=0; arrayIndex<recoverBlackListSize; arrayIndex++)
{
recoveredBlackListCounters[arrayIndex]=0;
}
}
}
else
{
if(!recoverBlackListContext.CompareTo("sep08"))
{
if((subEvtId == 222) || (subEvtId == 204))
{
recoverBlackListSize=1;
recoverBlackListMask = new UInt_t[recoverBlackListSize];
recoverBlackListAdress = new UInt_t[recoverBlackListSize];
recoveredBlackListCounters = new Int_t[recoverBlackListSize];
if(subEvtId == 222)
recoverBlackListMask [0]=0xffe00000;
else
if(subEvtId == 204)
recoverBlackListMask [0]=0xffe00000;
if(subEvtId == 222)
recoverBlackListAdress[0]=0x2cc00000;
else
if(subEvtId == 204)
recoverBlackListAdress[0]=0x08800000;
for (Int_t arrayIndex=0; arrayIndex<recoverBlackListSize; arrayIndex++)
{
recoveredBlackListCounters[arrayIndex]=0;
}
}
}
else
if (!recoverBlackListContext.CompareTo(recoverBlackListContextDefaultString))
{
errorAndExitInitRecoverBlackListNoValidContext();
}
else
{
warningInitRecoverBlackListNoValidContext(recoverBlackListContext);
disableRecoverBlackList();
}
}
return EXIT_SUCCESS;
}
Bool_t HMdcUnpacker::reinit()
{
if (!versionSetManual)
{
determineDecodeVersionCtr=0;
}
if (recoverBlackList) { reinitBlackListRecovery(); }
if (unpackerDebug) print("reinit()");
return kTRUE;
}
void HMdcUnpacker::reinitBlackListRecovery()
{
createBlackListRecoveryTools=0;
if (!recoverBlackListContext.CompareTo("sep05"))
{
if (subEvtId==222)
{
createBlackListRecoveryTools=0x092005;
}
}
if (!recoverBlackListContext.CompareTo("apr06"))
{
if (subEvtId==222)
{
createBlackListRecoveryTools=0x042006;
}
}
if (!recoverBlackListContext.CompareTo("may06"))
{
if (subEvtId==222)
{
createBlackListRecoveryTools=0x042006;
}
}
if (!recoverBlackListContext.CompareTo("sep08"))
{
if((subEvtId==204) || (subEvtId == 222))
createBlackListRecoveryTools=0x092008;
}
}
Int_t HMdcUnpacker::execute()
{
if (!pSubEvt) return 1;
if (!pReadout)
{
if(!noComment) errorExecuteNoValidPointerTo("Lookup-Table");
return 1;
}
Int_t samNr = getSubEvtIdToSamNr(subEvtId,kTRUE);
if (samNr < 0)
{
if(!noComment) warningExecuteSamNrNegative(samNr);
return 1;
}
Int_t sector = pReadout->getSamNumberToSector(samNr);
if (sector < 0)
{
if(!noComment) warningExecuteNoValidSectorEntryInLookupTableForSamNr(samNr);
return 1;
}
Int_t module = pReadout->getSamNumberToModule(samNr);
if (module < 0)
{
if(!noComment) warningExecuteNoValidModuleEntryInLookupTableForSamNr(samNr);
return 1;
}
if (testMdcSetup(sector, module))
{
if (0 > fill())
{
if(!noComment) errorExecuteErrorInFill();
return 1;
}
}
return 1;
}
Bool_t HMdcUnpacker::testMdcSetup(Int_t sector, Int_t module)
{
return (setup[sector][module]==1);
}
Int_t HMdcUnpacker::getSubEvtIdToSamNr(Int_t localSubEvtId, Bool_t expectUndefined)
{
Int_t samNr;
switch(decodeVersion)
{
case 0:
samNr = 2*(localSubEvtId - 201);
break;
case 1:
samNr = localSubEvtId - 201;
break;
default:
samNr = -1;
}
if (disableSamNrConsistencyCheck)
{
if (samNr < 0) return -1;
return samNr;
}
switch(decodeVersion)
{
case 0:
if (!(200 < localSubEvtId && localSubEvtId < 300))
{
if(!noComment) errorGetSubEvtIdToSamNrSubEvtIdOutOfMdcRange(localSubEvtId, "]200,300[");
return -1;
}
break;
case 1:
if (!(200 <= localSubEvtId && localSubEvtId < 300))
{
if(!noComment) errorGetSubEvtIdToSamNrSubEvtIdOutOfMdcRange(localSubEvtId, "[200,300[");
return -1;
}
break;
default:
samNr = -1;
}
Int_t rocSector = pReadout->getSamNumberToSector(samNr);
if (rocSector==-1 && !expectUndefined)
{
if(!noComment) errorGetSubEvtIdToSamNrSamNrNotInLookupTable(localSubEvtId,samNr);
return -1;
}
return samNr;
}
Int_t HMdcUnpacker::fill()
{
if (pSubEvt && pReadout)
{
if (!versionSetManual) determineDecodeVersion();
UInt_t* data = pSubEvt->getData();
UInt_t* end = pSubEvt->getEnd();
UInt_t subEvtSize = 0;
UInt_t offset = 0;
UInt_t *enddata = 0;
Int_t diff = (end-data);
if (diff<0)
{
return -1;
}
UInt_t eventSize = ((diff))+1;
if (!decodingMode()) return -1;
rocEvtHeaderSize = getRocEvtHeaderSize();
if (recoverBlackList) { prepareBlackListRecovery(eventSize); }
while( data < end )
{
dataword->clearAll();
if (rocEvtHeaderSize > 0)
{
if (!decodeSubHeader(data,subEvtSize))
{
if(!noComment) errorFillDecodeSubHeaderFailed();
return -1;
}
offset = subEvtSize + rocEvtHeaderSize;
enddata = data+offset;
}
else
{
enddata = end;
}
for(UInt_t* dataPointer=data+rocEvtHeaderSize; dataPointer<enddata; dataPointer++)
{
dataword->clear();
dataword->clearHeader();
if (dataPointer > end)
{
if(!noComment) errorFillDataPointerExceedingRange(dataPointer,end,enddata);
if (continueDecodingAfterInconsistency) continue;
if(!noComment) errorFillSkippingRestOfSubEvent();
return -1;
}
if (recoverBlackList && (recoverBlackListSize >0))
{
if (storeForRecoveryFromBlackList(dataPointer)) continue;
}
if (excludeBlackList && (excludeBlackListSize > 0))
{
if (excludeBlackListData(dataPointer)) continue;
}
if(!dataword->decode(*dataPointer, decodeVersion,consistencyCheck))
{
if(!noComment && unpackerDebug) dataword->dump(decodeVersion);
if (continueDecodingAfterInconsistency) continue;
if(!noComment) errorFillSkippingRestOfSubEvent();
return -1;
}
switch(fillData())
{
case 0: break;
case 1: continue;
case -2: return -2;
default: errorAndExitFillUnknownReturnValueOfFillData();
}
}
data += offset;
}
if(recoverBlackList && recoveryStorageCounter>0)
{
switch(executeBlackListRecovery())
{
case 0: break;
case -2: return -2;
default: errorAndExitFillUnknownReturnValueOfFillData();
}
}
}
return 1;
}
void HMdcUnpacker::determineDecodeVersion(void)
{
if (!versionSetManual)
{
determineDecodeVersionCtr++;
if ( determineDecodeVersionCtr == 1)
{
switch(compareEventDateTimeTo(2002,10,1,12,0,0))
{
case 0:
setDecodeVersion(1,kFALSE);
break;
case 1:
setDecodeVersion(1,kFALSE);
break;
case -1:
setDecodeVersion(0,kFALSE);
break;
default:
errorAndExitDetermineDecodeVersion();
break;
}
if (unpackerDebug) {infoDetermineDecodeVersion();}
}
}
}
Int_t HMdcUnpacker::compareEventDateTimeTo(UInt_t cyear,UInt_t cmonth, UInt_t cday,UInt_t chour,UInt_t cmin,UInt_t csec)
{
HEventHeader * header = 0;
header = ((HEvent*)(gHades->getCurrentEvent()))->getHeader();
if (header != 0)
{
Char_t command[1000];
sprintf(command,"date --date=\"%04i-%02i-%02i %02i:%02i:%02i\" +%%s",cyear,cmonth,cday,chour,cmin,csec);
Int_t ctime = atoi((myexec(command)).Data());
UInt_t date = header->getDate();
UInt_t time = header->getTime();
UInt_t year = (date & 0xFF0000) >> 16;
year = (year < 94)? year + 2000 : year + 1900;
UInt_t month = ((date & 0xFF00) >> 8) + 1;
UInt_t day = date & 0xFF;
UInt_t hour = (time & 0xFF0000) >> 16;
UInt_t min = (time & 0xFF00) >> 8;
UInt_t sec = (time & 0xFF);
if (unpackerDebug) Info("compareEventDateTimeTo()"," SubEvtId %i - time-stamp: %04i-%02i-%02i %02i:%02i:%02i",
subEvtId,year,month,day,hour,min,sec);
sprintf(command,"date --date=\"%04i-%02i-%02i %02i:%02i:%02i\" +%%s",year,month,day,hour,min,sec);
Int_t evttime = atoi((myexec(command)).Data());
if (evttime == ctime) return 0;
if (evttime >= ctime) return 1;
if (evttime <= ctime) return -1;
}
else
{
errorAndExitCompareEventDateTimeTo();
}
return -99;
}
Bool_t HMdcUnpacker::decodingMode(void)
{
Int_t rocSector = 0;
Int_t rocModule = 0;
UInt_t decoding = pSubEvt->getDecoding();
UInt_t compressMode = decoding & 0xf;
UInt_t errorBits = decoding & 0xf0;
switch(compressMode)
{
case UNCOMPRESSED:
setRocEvtHeaderSize(UNCOMPRESSED_ROC_HEADERSIZE);
return kTRUE;
break;
case COMPRESSED:
setRocEvtHeaderSize(COMPRESSED_ROC_HEADERSIZE);
if (errorBits!=0 || debug)
{
UInt_t size = pSubEvt->getSize();
UInt_t id = pSubEvt->getId() & 0x7fffffff;
Int_t samNr = getSubEvtIdToSamNr(subEvtId);
if (samNr != -1)
{
rocSector = pReadout->getSamNumberToSector(samNr);
rocModule = pReadout->getSamNumberToModule(samNr);
}
else
{
rocSector = 0 - subEvtId;
rocModule = 0 - subEvtId;
}
for (Int_t rocNumber=1; rocNumber<=5; rocNumber++)
{
fillMdcRawEventHeader(errorBits, rocModule, rocNumber, rocSector, 0-size, id);
}
}
return kTRUE;
break;
default:
if(!noComment) errorDecodingModeInvalidCompressMode(compressMode,decoding);
break;
}
return kFALSE;
}
Bool_t HMdcUnpacker::decodeSubHeader(UInt_t *data, UInt_t &subEvtSize)
{
Int_t errorFlag = 0;
Int_t trigType = 0;
Int_t rocNumber = 0;
Int_t rocSector = 0;
Int_t rocModule = 0;
dataword->clearHeader();
if(!dataword->subHeader(data,subHeaderDecodeVersion,consistencyCheck))
{
if(!noComment) errorDecodeSubHeaderCannotDecode();
return kFALSE;
}
rocNumber = dataword->getRocNb();
errorFlag = dataword->getErrorFlag();
trigType = dataword->getTrigType();
subEvtSize = dataword->getSubEvtSize();
if (errorFlag!=0 || debug)
{
fillMdcRawEventHeader(errorFlag, rocModule, rocNumber, rocSector, subEvtSize, trigType);
}
if (standalone)
{
static const Int_t kMdc_Standalone_CalibrationEvent=9;
if (trigType == kMdc_Standalone_CalibrationEvent)
{
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent()))->getHeader())->setId(kMdc_Standalone_CalibrationEvent);
}
}
return kTRUE;
}
Int_t HMdcUnpacker::fillMdcRawEventHeader(Int_t errorFlag, Int_t rocModule, Int_t rocNumber,
Int_t rocSector, Int_t subEvtSize,
Int_t trigType)
{
HLocation dummy;
HMdcRawEventHeader *pMdcRawEventHeader= NULL;
pMdcRawEventHeader = (HMdcRawEventHeader*) pMdcRawEventHeaderCat->getNewSlot(dummy);
if (pMdcRawEventHeader)
{
pMdcRawEventHeader = new (pMdcRawEventHeader) HMdcRawEventHeader();
}
else
{
if(!noComment) errorFillMdcRawEventHeaderCannotGetSlot();
return -2;
}
Int_t samNr;
samNr = -1;
samNr = getSubEvtIdToSamNr(subEvtId);
if (samNr != -1)
{
rocSector = pReadout->getSamNumberToSector(samNr);
rocModule = pReadout->getSamNumberToModule(samNr);
}
else
{
rocSector = 0 - subEvtId;
rocModule = 0 - subEvtId;
}
pMdcRawEventHeader->set(errorFlag, rocModule, rocNumber,
rocSector, subEvtId, subEvtSize, trigType);
return 0;
}
void HMdcUnpacker::prepareBlackListRecovery(UInt_t eventSize)
{
if (0!=createBlackListRecoveryTools)
{
recoveryStorageCounter=0;
if (recoveryStorage) delete[] recoveryStorage;
recoveryStorage = NULL;
recoveryStorage = new UInt_t[eventSize];
recoveryStorageCounter=0;
memset(recoveryStorage,0,eventSize*sizeof(UInt_t));
}
}
Int_t HMdcUnpacker::executeBlackListRecovery()
{
Int_t returnValue=0;
if (0!=createBlackListRecoveryTools)
{
switch(createBlackListRecoveryTools)
{
case 0x092005:
returnValue = recoverBlackListSep2005();
break;
case 0x042006:
returnValue = recoverBlackListApr2006();
break;
case 0x092008:
if(subEvtId == 222)
returnValue = recoverBlackListSep2005();
else
if(subEvtId == 204)
returnValue = recoverBlackListSep2008();
break;
default:
returnValue=0;
errorFillUnknownCodeForBlacklistRecovery();
break;
}
if (recoveryStorage) delete[] recoveryStorage;
recoveryStorage=NULL;
}
return returnValue;
}
Bool_t HMdcUnpacker::storeForRecoveryFromBlackList(UInt_t *data)
{
static Bool_t skipDataWord;
skipDataWord=kFALSE;
for (Int_t arrayIndex=0; arrayIndex< recoverBlackListSize; arrayIndex++)
{
if ((*data & recoverBlackListMask[arrayIndex])==recoverBlackListAdress[arrayIndex])
{
recoveredBlackListCounters[arrayIndex]++;
recoveryStorage[recoveryStorageCounter]=*data;
recoveryStorageCounter++;
skipDataWord=kTRUE;
break;
}
}
if (skipDataWord) return kTRUE;
else return kFALSE;
}
Bool_t HMdcUnpacker::excludeBlackListData(UInt_t* data)
{
static Bool_t skipDataWord;
skipDataWord=kFALSE;
for (Int_t arrayIndex=0; arrayIndex< excludeBlackListSize; arrayIndex++)
{
if ((*data & excludeBlackListMask[arrayIndex])==excludeBlackListAdress[arrayIndex])
{
excludedBlackListCounters[arrayIndex]++;
if (unpackerDebug && !noComment)
{
warningExcludeDataWords(*data,
excludeBlackListMask[arrayIndex],
excludeBlackListAdress[arrayIndex]);
}
skipDataWord=kTRUE;
break;
}
}
if (skipDataWord) { return kTRUE;}
else return kFALSE;
}
Int_t HMdcUnpacker::fillData(void)
{
static Int_t sector;
static Int_t module;
static Int_t mbo ;
static Int_t tdc ;
sector = module = mbo = tdc = -1;
if (!matchHardwareAdressToSecModMboTdc(sector, module, mbo, tdc))
{
return 1;
}
dataword->setAddress(sector,module,mbo,tdc,0);
static HMdcRaw *pMdcRaw;
pMdcRaw = NULL;
pMdcRaw = getFreeOrExistingSlot(sector, module, mbo, tdc);
if (!pMdcRaw) return -2;
if (!pMdcRaw->setTime(dataword->getTime(),tdcMode, noComment))
{
if(!noComment) errorFillErrorFillingDataWord();
if (unpackerDebug) dataword->dump(decodeVersion);
}
if(fillDataWord) fillMdcDataWord(sector,module,mbo,tdc);
return 0;
}
Bool_t HMdcUnpacker::matchHardwareAdressToSecModMboTdc(Int_t §or, Int_t &module,
Int_t &mbo, Int_t &tdc)
{
Int_t nsam = -1;
switch (decodeVersion)
{
case 0:
nsam = dataword->getSam()*2+dataword->getSamP();
break;
case 1:
nsam = dataword->getVirtualSamNr();
break;
}
Int_t nroc = dataword->getRoc();
Int_t nrocP = dataword->getRocP();
Int_t nbus = dataword->getBus();
if (nsam <0 || nroc <0 || nrocP <0 || nbus <0)
{
if (!noComment) errorFillNoValidAddressInLookUpTable();
if (unpackerDebug) dataword->dump(decodeVersion);
return kFALSE;
}
HMdcEvReadoutBus& bus =(*pReadout)[nsam][nroc][nrocP][nbus];
sector= bus.getSec();
module= bus.getMod();
mbo = bus.getMbo();
tdc = getTdc(dataword->getTdc(),dataword->getChan());
if(!checkMdcSetup(sector,module)) { return kFALSE; }
if(!checkMboRawStructBounds(sector,module,mbo,tdc)) { return kFALSE; }
return kTRUE;
}
Bool_t HMdcUnpacker::checkMdcSetup(Int_t sector, Int_t module)
{
if(!testMdcSetup(sector,module))
{
if(!noComment)
{
errorCheckMdcSetup(sector,module);
if (unpackerDebug) dataword->dump(decodeVersion);
}
return kFALSE;
}
return kTRUE;
}
Bool_t HMdcUnpacker::checkMboRawStructBounds(Int_t sector,Int_t module, Int_t mbo, Int_t tdc)
{
Int_t nMaxSector = rawc->getSize() ;
if (sector >= nMaxSector || sector < 0 )
{
if (!noComment)
{
errorCheckMboRawStructBoundsOutOfBounds(tdc, nMaxSector);
if (unpackerDebug) dataword->dump(decodeVersion);
}
return kFALSE;
}
Int_t nMaxModule = (*rawc)[sector].getSize() ;
if (module >= nMaxModule || module < 0 )
{
if (!noComment)
{
errorCheckMboRawStructBoundsOutOfBounds(tdc, nMaxModule, sector);
if (unpackerDebug) dataword->dump(decodeVersion);
}
return kFALSE;
}
Int_t nMaxMbo = (*rawc)[sector][module].getSize() ;
if (mbo >= nMaxMbo || mbo < 0 )
{
if (!noComment)
{
errorCheckMboRawStructBoundsOutOfBounds(tdc, nMaxMbo, sector, module);
if (unpackerDebug) dataword->dump(decodeVersion);
}
return kFALSE;
}
Int_t nMaxTdc = (*rawc)[sector][module][mbo].getNTdcs() ;
if (tdc >= nMaxTdc || tdc < 0 )
{
if (!noComment)
{
errorCheckMboRawStructBoundsOutOfBounds(tdc, nMaxTdc, sector, module, mbo);
if (unpackerDebug) dataword->dump(decodeVersion);
}
return kFALSE;
}
return kTRUE;
}
HMdcRaw* HMdcUnpacker::getFreeOrExistingSlot(Int_t §or, Int_t &module, Int_t &mbo, Int_t &tdc)
{
HLocation loc;
loc.set(4, 0, 0, 0, 0);
loc[0] = sector;
loc[1] = module;
loc[2] = mbo;
loc[3] = tdc;
HMdcRaw *pMdcRaw = (HMdcRaw*) pRawCat->getObject(loc);
if (!pMdcRaw)
{
pMdcRaw = (HMdcRaw*) pRawCat->getSlot(loc);
if (pMdcRaw)
{
pMdcRaw = new (pMdcRaw) HMdcRaw();
pMdcRaw->setAddress(sector,module,mbo,tdc);
}
else
{
if(!noComment) errorFillCannotGetSlot(sector,module,mbo,tdc);
if (unpackerDebug) pSubEvt->dumpIt();
}
}
return pMdcRaw;
}
Int_t HMdcUnpacker::fillMdcDataWord(Int_t sector,Int_t module,Int_t mbo,Int_t tdc)
{
Int_t entry=0;
UChar_t maxentry=10;
maxentry=8;
HLocation dataLoc;
dataLoc.set(5,0,0,0,0,0);
dataLoc[0] = sector;
dataLoc[1] = module;
dataLoc[2] = mbo;
dataLoc[3] = tdc;
dataLoc[4] = entry;
HMdcDataWord *pMdcDataWord=NULL;
for (entry = 0; entry < maxentry; entry++)
{
pMdcDataWord = NULL;
dataLoc[4] = entry;
pMdcDataWord = (HMdcDataWord*) pMdcDataWordCat->getObject(dataLoc);
if (!pMdcDataWord) break;
}
if (pMdcDataWord)
{
if (entry==maxentry-1)
{
if(!noComment) errorFillMdcDataWordTooManyEntriesToSameLocation(maxentry);
}
else
{
if(!noComment) errorFillMdcDataWordCannotGetSlot();
}
return -2;
}
else
{
pMdcDataWord = (HMdcDataWord*) pMdcDataWordCat->getSlot(dataLoc);
if (pMdcDataWord)
{
pMdcDataWord = new (pMdcDataWord) HMdcDataWord(*dataword);
pMdcDataWord->setAdress(sector,module,mbo,tdc,entry);
}
else
{
if(!noComment) errorFillMdcDataWordCannotGetSlot();
return -2;
}
}
return 1;
}
Int_t HMdcUnpacker::recoverBlackListApr2006()
{
return recoverBlackListSep2005();
}
Int_t HMdcUnpacker::recoverBlackListSep2005()
{
UInt_t datum;
Int_t arrayIndex;
Int_t hitCounter[64];
Int_t hitCounterRecovered[64];
memset(hitCounter ,0,64*sizeof(Int_t));
memset(hitCounterRecovered,0,64*sizeof(Int_t));
Int_t tdc;
for (UInt_t index=0; index< recoveryStorageCounter; index++)
{
datum = recoveryStorage[index];
arrayIndex=0;
if ((datum & recoverBlackListMask[arrayIndex])==recoverBlackListAdress[arrayIndex])
{
if(!dataword->decode( datum, decodeVersion))
{
if(!noComment){ warningRecoverBlackListSep2005SkippingDataWord(datum); }
continue;
}
tdc = -1;
tdc = getTdc(dataword->getTdc(),dataword->getChan());
if (tdc < 0) continue;
if (tdc > 63)
{
dataword->setMboNb(2);
if (!dataword->decode(dataword->getCodedDataWord(), decodeVersion, consistencyCheck)) {continue;}
switch(fillData())
{
case 0: break;
case 1: continue;
case -2: return -2;
default: errorAndExitRecoverBlackListSep2005UnknownReturnValueOfFillData();
}
recoveredBlackListCounters[arrayIndex]++;
}
else
{
hitCounter[tdc]++;
}
}
}
for (UInt_t index=0; index< recoveryStorageCounter; index++)
{
datum = recoveryStorage[index];
arrayIndex=0;
if ((datum & recoverBlackListMask[arrayIndex])==recoverBlackListAdress[arrayIndex])
{
if(!dataword->decode( datum, decodeVersion)) { continue; }
tdc = -1;
tdc = getTdc(dataword->getTdc(),dataword->getChan());
if (tdc < 0) continue;
if (tdc < 64)
{
if (hitCounter[tdc] == 2 || hitCounter[tdc] == 6)
{
dataword->setMboNb(1);
if (!dataword->decode(dataword->getCodedDataWord(), decodeVersion, consistencyCheck)) {continue;}
switch(fillData())
{
case 0: break;
case 1: continue;
case -2: return -2;
default: errorAndExitRecoverBlackListSep2005UnknownReturnValueOfFillData();
}
dataword->setMboNb(2);
if (!dataword->decode(dataword->getCodedDataWord(), decodeVersion, consistencyCheck)) {continue;}
switch(fillData())
{
case 0: break;
case 1: continue;
case -2: return -2;
default: errorAndExitRecoverBlackListSep2005UnknownReturnValueOfFillData();
}
hitCounterRecovered[tdc]++;
recoveredBlackListCounters[arrayIndex]++;
}
else if (hitCounter[tdc] == 4)
{
if (hitCounterRecovered[tdc] < 2)
{ dataword->setMboNb(1); }
else
{ dataword->setMboNb(2); }
if (!dataword->decode(dataword->getCodedDataWord(), decodeVersion, consistencyCheck)) {continue;}
switch(fillData())
{
case 0: break;
case 1: continue;
case -2: return -2;
default: errorAndExitRecoverBlackListSep2005UnknownReturnValueOfFillData();
}
hitCounterRecovered[tdc]++;
recoveredBlackListCounters[arrayIndex]++;
}
else if (hitCounter[tdc] == 12)
{
if (hitCounterRecovered[tdc] < 6)
{ dataword->setMboNb(1); }
else
{ dataword->setMboNb(2); }
if (!dataword->decode(dataword->getCodedDataWord(), decodeVersion, consistencyCheck)) {continue;}
switch(fillData())
{
case 0: break;
case 1: continue;
case -2: return -2;
default: errorAndExitRecoverBlackListSep2005UnknownReturnValueOfFillData();
}
hitCounterRecovered[tdc]++;
recoveredBlackListCounters[arrayIndex]++;
}
else
{
if(!noComment){ warningRecoverBlackListSep2005IgnoringDatum(hitCounter[tdc],datum); }
}
}
}
}
return 0;
}
Int_t HMdcUnpacker::recoverBlackListSep2008(void)
{
UInt_t datum;
Int_t arrayIndex;
for (UInt_t index=0; index< recoveryStorageCounter; index++)
{
datum = recoveryStorage[index];
arrayIndex=0;
if ((datum & recoverBlackListMask[arrayIndex])==recoverBlackListAdress[arrayIndex])
{
if(!dataword->decode( datum, decodeVersion)) { continue; }
if(dataword->getTdc() >= 8)
dataword->setTdcNb(dataword->getTdc()-8);
dataword->setMboNb(1);
if (!dataword->decode(dataword->getCodedDataWord(), decodeVersion, consistencyCheck)) {continue;}
switch(fillData())
{
case 0: break;
case 1: continue;
case -2: return -2;
default: errorAndExitRecoverBlackListSep2005UnknownReturnValueOfFillData();
}
recoveredBlackListCounters[arrayIndex]++;
}
}
return 0;
}
void HMdcUnpacker::enableExcludeBlackList(TString context)
{
gHades->getMsg()->info(10,HMessageMgr::DET_MDC,GetName(),"Setting up exclude blacklist for subevent %i\n",subEvtId);
setExcludeBlackListInternal(kTRUE);
setExcludeBlackListContext(context);
}
void HMdcUnpacker::disableExcludeBlackList()
{
setExcludeBlackListInternal(kFALSE);
setExcludeBlackListContext(HMdcUnpacker::excludeBlackListContextDefaultString);
}
void HMdcUnpacker::setExcludeBlackList(Bool_t b)
{
if(b) { errorAndExitSetExcludeBlackListObsoleteCall(); }
else { disableExcludeBlackList(); }
}
void HMdcUnpacker::setExcludeBlackListContext(TString context)
{
context.ToLower();
excludeBlackListContext=context;
}
void HMdcUnpacker::setExcludeBlackList(TString context)
{
setExcludeBlackListContext(context);
if (!context.IsNull() && context.CompareTo(excludeBlackListContextDefaultString))
{ setExcludeBlackList(kTRUE); }
else
{ setExcludeBlackList(kFALSE);}
}
void HMdcUnpacker::enableRecoverBlackList(TString context)
{
gHades->getMsg()->info(10,HMessageMgr::DET_MDC,GetName(),"Setting up recovery blacklist for subevent %i\n",subEvtId);
setRecoverBlackListInternal(kTRUE);
setRecoverBlackListContext(context);
}
void HMdcUnpacker::disableRecoverBlackList()
{
setRecoverBlackListInternal(kFALSE);
setRecoverBlackListContext(HMdcUnpacker::recoverBlackListContextDefaultString);
}
void HMdcUnpacker::setRecoverBlackList(Bool_t b)
{
if(b) { errorAndExitSetRecoverBlackListObsoleteCall(); }
else { disableRecoverBlackList(); }
}
void HMdcUnpacker::setRecoverBlackListContext(TString context)
{
context.ToLower();
recoverBlackListContext=context;
}
void HMdcUnpacker::setRecoverBlackList(TString context)
{
setRecoverBlackListContext(context);
if (!context.IsNull() && context.CompareTo(recoverBlackListContextDefaultString))
{ setRecoverBlackList(kTRUE); }
else
{ setRecoverBlackList(kFALSE);}
}
Bool_t HMdcUnpacker::finalize()
{
if (excludeBlackList) printExcludedBlackListCounter();
if (recoverBlackList) printRecoveredBlackListCounter();
return kTRUE;
}
void HMdcUnpacker::printExcludedBlackListCounter()
{
Bool_t print=kFALSE;
for (Int_t arrayIndex=0; arrayIndex< excludeBlackListSize; arrayIndex++)
{
if (excludedBlackListCounters[arrayIndex]>0)
{
print=kTRUE;
break;
}
}
if (print)
{
for (Int_t arrayIndex=0; arrayIndex< excludeBlackListSize; arrayIndex++)
{
Warning("printExcludedBlackListCounter",
" subEvtId: %i - %i Data words were excluded by mask 0x%x and adress 0x%x",
subEvtId,
excludedBlackListCounters[arrayIndex],
excludeBlackListMask [arrayIndex],
excludeBlackListAdress [arrayIndex]
);
}
}
}
void HMdcUnpacker::printRecoveredBlackListCounter()
{
Bool_t print=kFALSE;
for (Int_t arrayIndex=0; arrayIndex< recoverBlackListSize; arrayIndex++)
{
if (recoveredBlackListCounters[arrayIndex]>0)
{
print=kTRUE;
break;
}
}
if (print)
{
for (Int_t arrayIndex=0; arrayIndex< recoverBlackListSize; arrayIndex++)
{
Info("printRecoverdBlackListCounter",
" subEvtId: %i - %i Data words were recovered by mask 0x%x and adress 0x%x",
subEvtId,
recoveredBlackListCounters[arrayIndex],
recoverBlackListMask [arrayIndex],
recoverBlackListAdress [arrayIndex]
);
}
}
}
void HMdcUnpacker::infoDetermineDecodeVersion(void)
{
Info("determineDecodeVersion()"," SubEvtId %i - decode version: %i ",
subEvtId, getDecodeVersion());
}
void HMdcUnpacker::warningExcludeDataWords(UInt_t data, UInt_t mask, UInt_t adress)
{
Warning("fill()"," Event: %i - SubEvtId %i - excluded data word %x due to matching mask 0x%x and adress 0x%x",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,
data,
mask,
adress);
}
void HMdcUnpacker::warningExecuteNoValidModuleEntryInLookupTableForSamNr(Int_t samNr)
{
Warning("execute",
" Event: %i - SubEvtId %i - no valid module entry in lookuptable for virtual samNr: %i (=lookup table index+1) ... sub event id %i ignored",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,samNr,subEvtId);
}
void HMdcUnpacker::warningExecuteNoValidSectorEntryInLookupTableForSamNr(Int_t samNr)
{
Warning("execute",
" Event: %i - SubEvtId %i - no valid sector entry in lookuptable for virtual samNr: %i (=lookup table index+1) ... sub event id %i ignored",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,samNr,subEvtId);
}
void HMdcUnpacker::warningExecuteSamNrNegative(Int_t samNr)
{
Warning("execute",
" Event: %i - SubEvtId %i - samNr: %i (=lookup table index+1) negative ... sub event id %i ignored",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,samNr,subEvtId);
}
void HMdcUnpacker::warningInitExcludeBlackListNoValidContext(TString context)
{
Warning("init()",
"No valid exclude list defined for context \"%s\" ... 'BlackList' feature is deaktivated",
context.Data());
}
void HMdcUnpacker::warningInitRecoverBlackListNoValidContext(TString context)
{
Warning("init()",
"No valid exclude list defined for context \"%s\" ... 'BlackList' feature is deaktivated",
context.Data());
}
void HMdcUnpacker::warningRecoverBlackListSep2005IgnoringDatum(Int_t ctr, UInt_t datum)
{
Warning("recoverBlackList",
"sep05: neither 2, 4, 6 or 12 Hits but %i ... ignoring datum: 0x%x",
ctr, datum);
}
void HMdcUnpacker::warningRecoverBlackListSep2005SkippingDataWord(UInt_t datum)
{
Warning("recoverBlackListSep2005()","skipping dataword %x",datum);
}
void HMdcUnpacker::warningSetQuietMode(void)
{
Warning("setQuietMode",
"subEvtId %i - from now on all error and warning messages of this unpacker are skipped, be aware of the consequences",
subEvtId);
}
void HMdcUnpacker::errorCheckMboRawStructBoundsOutOfBounds(Int_t value, Int_t maxValue,
Int_t sector, Int_t module, Int_t mbo)
{
Int_t eventSeqNr = -1;
if (gHades) eventSeqNr = (((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber());
if (sector == -100 && module==-100 && mbo ==-100)
{
Error("checkMboRawStructBounds",
" Event: %i - SubEvtId %3i - sector %i, number out of bounds [0,%i[ for dataword 0x%x",
eventSeqNr, subEvtId, value, maxValue,
dataword->getCodedDataWord());
}
else if (module==-100 && mbo ==-100)
{
Error("checkMboRawStructBounds",
" Event: %i - SubEvtId %3i - module %i, number out of bounds [0,%i[ for sector: %i for dataword 0x%x ",
eventSeqNr, subEvtId, value, maxValue, sector,
dataword->getCodedDataWord());
}
else if (mbo ==-100)
{
Error("checkMboRawStructBounds",
" Event: %i - SubEvtId %3i - mbo %i, number out of bounds [0,%i[ for sector: %i, module: %i for dataword 0x%x",
eventSeqNr, subEvtId, value, maxValue, sector, module,
dataword->getCodedDataWord());
}
else
{
Error("checkMboRawStructBounds",
" Event: %i - SubEvtId %3i - tdc %i, number out of bounds [0,%i[ for sector: %i, module: %i, mbo: %i for dataword 0x%x",
eventSeqNr, subEvtId, value, maxValue, sector, module, mbo,
dataword->getCodedDataWord());
}
}
void HMdcUnpacker::errorCheckMdcSetup(Int_t sector, Int_t module)
{
Int_t eventSeqNr = -1;
if (gHades) eventSeqNr = (((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber());
Error("checkMdcSetup()",
" Event: %i - SubEvtId %3i - though sector %i, module %i are excluded in the setup, dataword: 0x%08x points to this detector.",
eventSeqNr,subEvtId,sector,module,
dataword->getCodedDataWord());
}
void HMdcUnpacker::errorDecodeSubHeaderCannotDecode()
{
Error("decodeSubHeader()","SubEvtId %i - can't decode sub header ",subEvtId);
}
void HMdcUnpacker::errorDecodingModeInvalidCompressMode(UInt_t compressMode,UInt_t decoding)
{
Error("decodingMode()"," Event: %i - SubEvtId %i - compressMode %i from decoding word 0x%x invalid ... sub event id %i ignored",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,compressMode,decoding,subEvtId);
}
void HMdcUnpacker::errorExecuteErrorInFill()
{
if(!noComment) Error("execute"," Event: %i - SubEvtId %i - error in unpacking",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId);
}
void HMdcUnpacker::errorExecuteNoValidPointerTo(TString pointerName)
{
Error("execute"," Event: %i - SubEvtId %i - pointer to %s zero",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId, pointerName.Data());
}
void HMdcUnpacker::errorFillCannotGetSlot(Int_t sector, Int_t module, Int_t mbo, Int_t tdc)
{
Error("fill()", " Event: %i - SubEvtId %i - can't get slot for s:%i m:%i mb:%i tdc:%i ...",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,sector,module,mbo,tdc);
Error("fill()", " ..... skipping unpacking for the rest of this sub event!!!");
}
void HMdcUnpacker::errorFillDecodeSubHeaderFailed()
{
Error("fill()"," Event: %i - SubEvtId %i - decoding of sub header (ROC) failed",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId);
Error("fill()", " ..... skipping unpacking for the rest of this sub event!!!");
}
void HMdcUnpacker::errorFillDataPointerExceedingRange(UInt_t* deb, UInt_t* end, UInt_t* enddata)
{
Error("fill()",
" Event: %i - SubEvtId %i - data pointer %p exceeding range of sub event end %p\n with calculated end point at %p",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,deb,end,enddata);
}
void HMdcUnpacker::errorFillErrorFillingDataWord()
{
Error("fill()"," Event: %i - SubEvtId %i - error filling slot for dataword 0x%08x",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,
dataword->getCodedDataWord());
}
void HMdcUnpacker::errorFillMdcDataWordTooManyEntriesToSameLocation(Int_t maxentry)
{
Error("fillMdcDataWord()", " SubEvtId %i - to many entries to the same location entries>%i",
subEvtId,maxentry);
}
void HMdcUnpacker::errorFillMdcDataWordCannotGetSlot()
{
Error("fillMdcRawEventHeader()", "SubEvtId %i - can't get slot for MdcDataWord",subEvtId);
Error("fillMdcRawEventHeader()", " ..... but continuing unpacking for the rest of this sub event!!!");
}
void HMdcUnpacker::errorFillMdcRawEventHeaderCannotGetSlot()
{
Error("fillMdcRawEventHeader()", "SubEvtId %i - can't get slot for MdcEventHeader",subEvtId);
Error("fillMdcRawEventHeader()", " ..... but continuing unpacking for the rest of this sub event!!!");
}
void HMdcUnpacker::errorFillNoValidAddressInLookUpTable()
{
Error("fill()",
" Event: %i - SubEvtId %3i - No valid address in lookup table [HMdcEvReadout] for this dataword: 0x%08x",
((HEventHeader*)((HEvent*)(gHades->getCurrentEvent())->getHeader()))->getEventSeqNumber(),
subEvtId,
dataword->getCodedDataWord());
}
void HMdcUnpacker::errorFillSkippingRestOfSubEvent(void)
{
Error("fill()", " ..... skipping unpacking for the rest of this sub event!!!");
}
void HMdcUnpacker::errorFillUnknownCodeForBlacklistRecovery()
{
Error("fill()","unknown code for blacklist recovery");
}
void HMdcUnpacker::errorGetSubEvtIdToSamNrSamNrNotInLookupTable(UInt_t localSubEvtId, Int_t samNr)
{
Error("getSubEvtIdToSamNr()",
"SubEvtId %i - calculated samNr: %i is not in the lookup table (HMdcEvReadout)",
localSubEvtId,samNr);
}
void HMdcUnpacker::errorGetSubEvtIdToSamNrSubEvtIdOutOfMdcRange(UInt_t localSubEvtId, TString range)
{
Error("getSubEvtIdToSamNr()"," SubEvtId %i - sub event id: %i, out of mdc range %s",
localSubEvtId,localSubEvtId,
range.Data());
}
void HMdcUnpacker::errorInitCannotGetParameterContainer(TString container)
{
Error("init()"," SubEvtId %i - can't get parameter container \"%s\" ",subEvtId,container.Data());
}
void HMdcUnpacker::errorInitCategoryCannotAddCategory(TString catname, TString detector)
{
Error("initCategory()"," SubEvtId %i - can't add category \"%s\" to detector \"%s\"",subEvtId,catname.Data(),detector.Data());
}
void HMdcUnpacker::errorInitCategoryCannotGetCategory(TString catname)
{
Error("initCategory()"," SubEvtId %i - can't create or get category \"%s\"",subEvtId,catname.Data());
}
void HMdcUnpacker::errorAndExitCompareEventDateTimeTo()
{
Error("compareEventDateTimeTo()",
" SubEvtId %i - no data header defined in current event of gHades ... exiting",
subEvtId);
exit(EXIT_FAILURE);
}
void HMdcUnpacker::errorAndExitDetermineDecodeVersion(void)
{
Error("determineDecodeVersion()",
" SubEvtId %i - cannot determine decode version ... exiting",subEvtId);
exit(EXIT_FAILURE);
}
void HMdcUnpacker::errorAndExitFillUnknownReturnValueOfFillData()
{
Error("fill()","unknown return value by fillData()... exiting()");
exit(EXIT_FAILURE);
}
void HMdcUnpacker::errorAndExitGetMdcSetup()
{
Error("getMdcSetup()"," SubEvtId %i - Mdc-Detector setup (gHades->getSetup()->getDetector(\"Mdc\")) missing... exiting()",
subEvtId);
exit(EXIT_FAILURE);
}
void HMdcUnpacker::errorAndExitInitExcludeBlackListNoValidContext()
{
Error("initExcludeBlackList()","you have activated the excludeBlackList feature w/o specifying any context. \
\n Add setExcludeBlackListContext(\"context\") for the HMdcUnpacker object to your code! \n \
... exiting!");
exit(EXIT_FAILURE);
}
void HMdcUnpacker::errorAndExitInitRecoverBlackListNoValidContext()
{
Error("initRecoverBlackList()","you have activated the excludeBlackList feature w/o specifying any context. \
\n Add setRecoverBlackListContext(\"context\") for the HMdcUnpacker object to your code! \n \
... exiting!");
exit(EXIT_FAILURE);
}
void HMdcUnpacker::errorAndExitRecoverBlackListSep2005UnknownReturnValueOfFillData()
{
Error("fill()","unknown return value by fillData()... exiting()");
exit(EXIT_FAILURE);
}
void HMdcUnpacker::errorAndExitSetDecodeVersion(UInt_t version)
{
Error("setDecodeVersion()",
" SubEvtId %i - selected version %i out of range [0,%i] ... exiting",
subEvtId, version, maxDecodeVersion);
exit(EXIT_FAILURE);
};
void HMdcUnpacker::errorAndExitSetExcludeBlackListObsoleteCall()
{
Error("setExcludeBlackList(Bool_t b)",
"obsolete function not supporting any context ... use enableExcludeBlackList(TString context) instead ... exiting\n");
exit(EXIT_FAILURE);
}
void HMdcUnpacker::errorAndExitSetRecoverBlackListObsoleteCall()
{
Error("setExcludeBlackList(Bool_t b)",
"obsolete function not supporting any context ... use enableExcludeBlackList(TString context) instead ... exiting\n");
exit(EXIT_FAILURE);
}
Last change: Sat May 22 13:04:19 2010
Last generated: 2010-05-22 13:04
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.