Commit dc7a4bcd authored by dauncey's avatar dauncey

More bug fixes

parent 2e079021
...@@ -22,11 +22,11 @@ public: ...@@ -22,11 +22,11 @@ public:
std::ostringstream sout; std::ostringstream sout;
sout << "BeSlinkAna" << std::setw(2) << std::setfill('0') sout << "BeSlinkAna" << std::setw(2) << std::setfill('0')
<< fBeSlinkSim->fSlink; << fBeSlinkSim->slinkNumber();
std::string sHgcroc[18]={"00","01","02","03","04","05","06","07","08", std::string sHgcroc[18]={"00","01","02","03","04","05","06","07","08",
"09","10","11","12","13","14","15","16","17"}; "09","10","11","12","13","14","15","16","17"};
/*
hBitmapWordsVsChannels=new TH1I((sout.str()+"BitmapWordsVsChannels").c_str(), hBitmapWordsVsChannels=new TH1I((sout.str()+"BitmapWordsVsChannels").c_str(),
";Number of channels per HGCROC packet;Number of words per HGCROC packet",73,-0.5,72.5); ";Number of channels per HGCROC packet;Number of words per HGCROC packet",73,-0.5,72.5);
hLabelsWordsVsChannels=new TH1I((sout.str()+"LabelsWordsVsChannels").c_str(), hLabelsWordsVsChannels=new TH1I((sout.str()+"LabelsWordsVsChannels").c_str(),
...@@ -36,18 +36,19 @@ public: ...@@ -36,18 +36,19 @@ public:
";ECON total number of channels",1300,0,1300); ";ECON total number of channels",1300,0,1300);
hTotalWords=new TH1D((sout.str()+"TotalWords").c_str(), hTotalWords=new TH1D((sout.str()+"TotalWords").c_str(),
";ECON total number of words",1000,0,1000); ";ECON total number of words",1000,0,1000);
*/
for(unsigned block(0);block<1;block++) {
hBlockTotalChannels[block]=new TH1D((sout.str()+"Block"+sHgcroc[block]+"TotalChannels").c_str(),
";Block total number of channels",1300,0,1300);
hBlockTotalWords[block]=new TH1D((sout.str()+"Block"+sHgcroc[block]+"TotalWords").c_str(),
";Block total number of words",1000,0,1000);
hEventBufferUsed[block]=new TH1D((sout.str()+"Block"+sHgcroc[block]+"EventBufferUsed").c_str(),
";Number of event buffer words used",50000,0,50000);
hEventBufferUsedHistory[block]=new TH1I((sout.str()+"Block"+sHgcroc[block]+"EventBufferUsedHistory").c_str(),
";BX;Number of event buffer words used",nHistory,0,nHistory);
}
const SlinkArch &slinkArch(*(fBeSlinkSim->fSlinkArch));
for(unsigned e(0);e<slinkArch.numberOfEcons();e++) {
const EconArch &econArch(slinkArch.econArch(e));
for(unsigned b(0);b<econArch.numberOfBlocks();b++) {
hEventBufferUsed[e][b]=new TH1D((sout.str()+"Econ"+sHgcroc[e]+"Block"+sHgcroc[b]+"EventBufferUsed").c_str(),
";Number of event buffer words used",1000,0,10000);
hEventBufferUsedHistory[e][b]=new TH1I((sout.str()+"Econ"+sHgcroc[e]+"Block"+sHgcroc[b]+"EventBufferUsedHistory").c_str(),
";BX;Number of event buffer words used",nHistory,0,nHistory);
}
}
/*
for(unsigned h(0);h<18;h++) { for(unsigned h(0);h<18;h++) {
hChannels[h]=new TH1D((sout.str()+"Hgcroc"+sHgcroc[h]+"Channels").c_str(), hChannels[h]=new TH1D((sout.str()+"Hgcroc"+sHgcroc[h]+"Channels").c_str(),
";Number of channels per HGCROC packet",73,0,73); ";Number of channels per HGCROC packet",73,0,73);
...@@ -56,6 +57,7 @@ public: ...@@ -56,6 +57,7 @@ public:
hWordsVsChannels[h]=new TH2D((sout.str()+"Hgcroc"+sHgcroc[h]+"WordsVsChannels").c_str(), hWordsVsChannels[h]=new TH2D((sout.str()+"Hgcroc"+sHgcroc[h]+"WordsVsChannels").c_str(),
";Number of channels per HGCROC packet;Number of words per HGCROC packet",73,-0.5,72.5,60,-0.5,59.5); ";Number of channels per HGCROC packet;Number of words per HGCROC packet",73,-0.5,72.5,60,-0.5,59.5);
} }
*/
} }
void analyseL1Accept(uint64_t bx) { void analyseL1Accept(uint64_t bx) {
...@@ -86,12 +88,14 @@ public: ...@@ -86,12 +88,14 @@ public:
} }
void analyseBx(uint64_t bx) { void analyseBx(uint64_t bx) {
/* const SlinkArch &slinkArch(*(fBeSlinkSim->fSlinkArch));
for(unsigned block(0);block<fEconSim->fEconArch.fNumberOfBlocks;block++) { for(unsigned e(0);e<slinkArch.numberOfEcons();e++) {
hEventBufferUsed[block]->Fill(fEconSim->fEventBuffer[block].used()); const EconArch &econArch(slinkArch.econArch(e));
hEventBufferUsedHistory[block]->Fill(bx,fEconSim->fEventBuffer[block].used()); for(unsigned b(0);b<econArch.numberOfBlocks();b++) {
hEventBufferUsed[e][b]->Fill(fBeSlinkSim->fEventBuffer[e][b].used());
hEventBufferUsedHistory[e][b]->Fill(bx,fBeSlinkSim->fEventBuffer[e][b].used());
}
} }
*/
} }
void eoj() { void eoj() {
...@@ -100,21 +104,22 @@ public: ...@@ -100,21 +104,22 @@ public:
private: private:
const BeSlinkSim *fBeSlinkSim; const BeSlinkSim *fBeSlinkSim;
TH1I *hBitmapWordsVsChannels; //TH1I *hBitmapWordsVsChannels;
TH1I *hLabelsWordsVsChannels; //TH1I *hLabelsWordsVsChannels;
TH1D *hMeans; //TH1D *hMeans;
TH1D *hChannels[18]; //TH1D *hChannels[18];
TH1D *hWords[18]; //TH1D *hWords[18];
TH2D *hWordsVsChannels[18]; //TH2D *hWordsVsChannels[18];
//TH1D *hTotalChannels;
//TH1D *hTotalWords;
//TH1D *hBlockTotalChannels[7];
//TH1D *hBlockTotalWords[7];
TH1D *hTotalChannels; TH1D *hEventBufferUsed[Dimensions::MaxNumberOfEconsPerSlink][Dimensions::MaxNumberOfBlocksPerEcon];
TH1D *hTotalWords; TH1I *hEventBufferUsedHistory[Dimensions::MaxNumberOfEconsPerSlink][Dimensions::MaxNumberOfBlocksPerEcon];
TH1D *hBlockTotalChannels[7];
TH1D *hBlockTotalWords[7];
TH1D *hEventBufferUsed[7];
TH1I *hEventBufferUsedHistory[7];
}; };
#endif #endif
This diff is collapsed.
...@@ -41,6 +41,8 @@ public: ...@@ -41,6 +41,8 @@ public:
<< "Entered" << std::endl; << "Entered" << std::endl;
} }
//if(a==0) return false;
if(!fActivePacket) { if(!fActivePacket) {
if(a!=0) { if(a!=0) {
fActivePacket=true; fActivePacket=true;
......
...@@ -634,7 +634,7 @@ private: ...@@ -634,7 +634,7 @@ private:
//unsigned fNumberOfHgcrocs; //unsigned fNumberOfHgcrocs;
//double fHgcrocMean[18]; //double fHgcrocMean[18];
unsigned fHgcrocToElink[18]; //unsigned fHgcrocToElink[18];
CircularBuffer<1> fElink[7]; CircularBuffer<1> fElink[7];
CircularBuffer<16> fEventBuffer[7]; CircularBuffer<16> fEventBuffer[7];
......
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
} }
void processEoj() { void eoj() {
hCounts->SetBinContent(1,fNumberOfBx); hCounts->SetBinContent(1,fNumberOfBx);
hCounts->SetBinContent(2,fNumberOfDeadtimeBx); hCounts->SetBinContent(2,fNumberOfDeadtimeBx);
} }
......
...@@ -15,7 +15,7 @@ public: ...@@ -15,7 +15,7 @@ public:
fWord=w; fWord=w;
} }
HgcrocBoe(uint8_t e, uint8_t h, uint8_t b, uint8_t l, uint8_t n, bool s=false) { HgcrocBoe(uint8_t e, uint8_t h, uint8_t b, uint8_t l, uint8_t n, bool s=true) {
assert(n<64); assert(n<64);
fWord=(b<<24)+((18*e+h)<<16)+(l<<8)+(n&0x3f)+(s?0x40:0); fWord=(b<<24)+((18*e+h)<<16)+(l<<8)+(n&0x3f)+(s?0x40:0);
} }
......
...@@ -188,7 +188,7 @@ private: ...@@ -188,7 +188,7 @@ private:
BlockCheck fBlockCheck[7]; BlockCheck fBlockCheck[7];
unsigned fNumberOfHgcrocs; //unsigned fNumberOfHgcrocs;
unsigned fHgcroc; unsigned fHgcroc;
const EconArch *fEconArch; const EconArch *fEconArch;
...@@ -199,7 +199,7 @@ private: ...@@ -199,7 +199,7 @@ private:
uint8_t fL1Accept; uint8_t fL1Accept;
uint8_t fBx; uint8_t fBx;
HgcrocBoe fHgcrocBoe; HgcrocBoe fHgcrocBoe;
unsigned fWords[7]; //unsigned fWords[7];
bool fHgcrocSeen[18]; bool fHgcrocSeen[18];
}; };
......
...@@ -61,6 +61,12 @@ public: ...@@ -61,6 +61,12 @@ public:
assert(fBoe.valid()); assert(fBoe.valid());
fL1Accept=(fL1Accept+1)&0xffffffff; fL1Accept=(fL1Accept+1)&0xffffffff;
assert(fBoe.eventId()==fL1Accept); assert(fBoe.eventId()==fL1Accept);
fEventDump.resize(0);
fEventDump.push_back(w.first&0xffffffff);
fEventDump.push_back(w.first>>32);
fEventDump.push_back(w.second&0xffffffff);
fEventDump.push_back(w.second>>32);
fEventActive=true; fEventActive=true;
fEconRead=0; fEconRead=0;
...@@ -77,6 +83,11 @@ public: ...@@ -77,6 +83,11 @@ public:
return; return;
} }
fEventDump.push_back(w.first&0xffffffff);
fEventDump.push_back(w.first>>32);
fEventDump.push_back(w.second&0xffffffff);
fEventDump.push_back(w.second>>32);
if(be) { if(be) {
fEoe.setWords(d); fEoe.setWords(d);
...@@ -93,6 +104,20 @@ public: ...@@ -93,6 +104,20 @@ public:
assert(fEoe.crc()==0xff); assert(fEoe.crc()==0xff);
assert(fEoe.eventLength()==nWords); assert(fEoe.eventLength()==nWords);
if(fPrintLevel>5) {
std::cout << std::endl << "SlinkCheck::processWord() "
<< "Event dump for L1Accept " << fL1Accept << std::endl;
for(unsigned i(0);i<fEventDump.size();i++) {
std::cout << " Word " << std::setw(4) << i
<< " = " << std::setw(10) << std::setfill(' ')
<< fEventDump[i] << " = 0x"
<< std::hex << std::setw(8) << std::setfill('0')
<< fEventDump[i] << std::dec << std::endl;
}
std::cout << std::endl;
}
if(nWords==0) { if(nWords==0) {
if(fPrintLevel>4) { if(fPrintLevel>4) {
std::cout << "SlinkCheck::processWord() " std::cout << "SlinkCheck::processWord() "
...@@ -228,6 +253,8 @@ private: ...@@ -228,6 +253,8 @@ private:
unsigned nHgcrocWords; unsigned nHgcrocWords;
bool completedHgcroc[5][18]; bool completedHgcroc[5][18];
std::vector<uint32_t> fEventDump;
}; };
unsigned SlinkCheck::fPrintLevel(1); unsigned SlinkCheck::fPrintLevel(1);
......
...@@ -891,7 +891,7 @@ int main(int argc, char* argv[]) { ...@@ -891,7 +891,7 @@ int main(int argc, char* argv[]) {
} }
if(doingBe) { if(doingBe) {
beSlinkSim[sl].boj(sl,slinkArch[sl]); beSlinkSim[sl].boj(slinkArch[sl]);
beSlinkAna[sl].boj(beSlinkSim[sl],nHistory); beSlinkAna[sl].boj(beSlinkSim[sl],nHistory);
slinkCheck[sl].boj(slinkArch[sl]); slinkCheck[sl].boj(slinkArch[sl]);
...@@ -1046,7 +1046,7 @@ int main(int argc, char* argv[]) { ...@@ -1046,7 +1046,7 @@ int main(int argc, char* argv[]) {
beSlinkAna[sl].analyseL1Accept(bx); beSlinkAna[sl].analyseL1Accept(bx);
} }
beSlinkSim[sl].processBx(slinkElinkData[sl]); beSlinkSim[sl].processBx(bx,slinkElinkData[sl]);
beSlinkAna[sl].analyseBx(bx); beSlinkAna[sl].analyseBx(bx);
for(unsigned w(0);w<beSlinkSim[sl].numberOfSlinkWords();w++) { for(unsigned w(0);w<beSlinkSim[sl].numberOfSlinkWords();w++) {
...@@ -1452,6 +1452,7 @@ int main(int argc, char* argv[]) { ...@@ -1452,6 +1452,7 @@ int main(int argc, char* argv[]) {
} // End of doingEcon } // End of doingEcon
// Increment some counters // Increment some counters
if(newL1AIn) numberL1AIn++; if(newL1AIn) numberL1AIn++;
if(newL1AOut) numberL1AOut++; if(newL1AOut) numberL1AOut++;
...@@ -1468,7 +1469,9 @@ int main(int argc, char* argv[]) { ...@@ -1468,7 +1469,9 @@ int main(int argc, char* argv[]) {
std::cout << "Number of HGCROC deadtime BXs = " << nHgcrocDeadtime std::cout << "Number of HGCROC deadtime BXs = " << nHgcrocDeadtime
<< ", fraction = " << 1.0*nHgcrocDeadtime/maxBx << std::endl; << ", fraction = " << 1.0*nHgcrocDeadtime/maxBx << std::endl;
hgcrocAna.processEoj(); // Finish up
hgcrocAna.eoj();
for(unsigned sl(0);sl<NumberOfSlinks;sl++) { for(unsigned sl(0);sl<NumberOfSlinks;sl++) {
for(unsigned ec(0);ec<5;ec++) { for(unsigned ec(0);ec<5;ec++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment