Commit 914d7a6a authored by dauncey's avatar dauncey

A few tweaks to histograms

parent 64e94a28
......@@ -36,10 +36,26 @@ unsigned numberOfBits(unsigned pack, double nTc) {
int main(int argc, const char **argv) {
const unsigned nBx(10000);
const unsigned nLatency(4);
unsigned nLatency(12);
unsigned nBx(100000);
if(argc>=2) {
std::istringstream sin(argv[1]);
sin >> nLatency;
std::cout << "Argument = " << argv[1] << " = " << nLatency << std::endl;
}
if(argc>=3) {
std::istringstream sin(argv[2]);
sin >> nBx;
std::cout << "Argument = " << argv[2] << " = " << nBx << std::endl;
}
std::ostringstream sout;
sout << "BufferTestL" << std::setw(2) << std::setfill('0') << nLatency;
TFileHandler tfh("BufferTest");
TFileHandler tfh(sout.str());
unsigned bInp(999);
......@@ -50,7 +66,7 @@ int main(int argc, const char **argv) {
unsigned nBitMax(numberOfBits(pack,48));
std::ostringstream sout1;
sout1 << "Binp" << std::setw(3) << std::setfill('0') << bInp
sout1 << sout0.str()
<< "Pack" << std::setw(3) << std::setfill('0') << pack;
std::cout << sout1.str()
......@@ -59,48 +75,51 @@ int main(int argc, const char **argv) {
TH1F *hL1[10];
hL1[0]=new TH1F((sout1.str()+"_DataVsTCs").c_str(),
";Average number of TCs;Average data size (bits)",
48,0.0,48.0);
150,0.0,30.0);
hL1[1]=new TH1F((sout1.str()+"_MinBoutTrc").c_str(),
";Average number of TCs;Minimum bandwidth (bits/BX)",
48,0.0,48.0);
150,0.0,30.0);
hL1[2]=new TH1F((sout1.str()+"_MinBoutCut").c_str(),
";Average number of TCs;Minimum bandwidth (bits/BX)",
48,0.0,48.0);
150,0.0,30.0);
hL1[3]=new TH1F((sout1.str()+"_NaiveMinBout").c_str(),
";Average number of TCs; Naive minimum bandwidth (bits/BX)",
150,0.0,30.0);
for(unsigned nAvg(5);nAvg<480;nAvg+=10) {
for(unsigned nAvg(1);nAvg<300;nAvg+=2) {
double dAvg(0.1*nAvg);
hL1[0]->Fill(dAvg,numberOfBits(pack,dAvg));
hL1[3]->Fill(dAvg,max(double(nBitMax)/nLatency,double(numberOfBits(pack,dAvg))));
std::ostringstream sout2;
sout2 << "Binp" << std::setw(3) << std::setfill('0') << bInp
<< "Pack" << std::setw(3) << std::setfill('0') << pack
sout2 << sout1.str()
<< "Navg" << std::setw(3) << std::setfill('0') << nAvg;
TH1F *hL2[10];
hL2[0]=new TH1F((sout2.str()+"_OccMax").c_str(),
";Bandwidth out (bits/BX);Buffer depth",
100,0.0,800);
250,0.0,500);
hL2[1]=new TH1F((sout2.str()+"_OccCut").c_str(),
";Bandwidth out (bits/BX);Buffer danger level",
100,0.0,800);
250,0.0,500);
hL2[2]=new TH1F((sout2.str()+"_AvgOccVsBout").c_str(),
";Bandwidth out (bits/BX);Fractional buffer occupancy",
100,0.0,800);
250,0.0,500);
hL2[3]=new TH1F((sout2.str()+"_FractionTruncVsBout").c_str(),
";Bandwidth out (bits/BX);Fraction of BX truncated",
100,0.0,800);
250,0.0,500);
hL2[4]=new TH1F((sout2.str()+"_FractionDangerVsBout").c_str(),
";Bandwidth out (bits/BX);Fraction of BX almost full",
100,0.0,800);
250,0.0,500);
std::cout << sout2.str() << std::endl;
unsigned bOutTrc(999999999);
unsigned bOutCut(999999999);
for(unsigned bOut(4);bOut<800;bOut+=8) {
for(unsigned bOut(1);bOut<500;bOut+=2) {
unsigned nOccMax(nLatency*bOut);
unsigned nOccCut(nBitMax>nOccMax?0:nOccMax-nBitMax);
......@@ -108,9 +127,7 @@ int main(int argc, const char **argv) {
hL2[1]->Fill(bOut,nOccCut);
std::ostringstream sout3;
sout3 << "Binp" << std::setw(3) << std::setfill('0') << bInp
<< "Pack" << std::setw(3) << std::setfill('0') << pack
<< "Navg" << std::setw(3) << std::setfill('0') << nAvg
sout3 << sout2.str()
<< "Bout" << std::setw(3) << std::setfill('0') << bOut;
std::cout << sout3.str()
......@@ -118,64 +135,87 @@ int main(int argc, const char **argv) {
<< ", nOccCut = " << nOccCut << std::endl;
TH1F *hL3[10];
hL3[0]=new TH1F((sout3.str()+"_DataInpVsBx").c_str(),
";BX;Data in (bits)",nBx,0.0,nBx);
hL3[1]=new TH1F((sout3.str()+"_DataOutVsBx").c_str(),
";BX;Data out (bits)",nBx,0.0,nBx);
hL3[2]=new TH1F((sout3.str()+"_BufferOccupancyAVsBx").c_str(),
";BX;Buffer occupancy pre-out (bits)",nBx,0.0,nBx);
hL3[3]=new TH1F((sout3.str()+"_BufferOccupancyBVsBx").c_str(),
";BX;Buffer occupancy post-out (bits)",nBx,0.0,nBx);
hL3[4]=new TH1F((sout3.str()+"_NumberOfTCs").c_str(),
";Number of trigger cells",49,0.0,49.0);
hL3[5]=new TH1F((sout3.str()+"_NumberOfBits").c_str(),
";Number of bits",1000,0.0,1000);
hL3[6]=new TH1F((sout3.str()+"_DataInp").c_str(),
";Data in (bits)",1000,0.0,1000);
hL3[7]=new TH1F((sout3.str()+"_DataOut").c_str(),
";Data out (bits)",1000,0.0,1000);
hL3[8]=new TH1F((sout3.str()+"_BufferOccupancyA").c_str(),
";Buffer occupancy pre-out (bits)",nOccMax/8,0.0,nOccMax);
hL3[9]=new TH1F((sout3.str()+"_BufferOccupancyB").c_str(),
";Buffer occupancy post-out (bits)",nOccMax/8,0.0,nOccMax);
bool l3Hists(pack==0 && nAvg==99 &&
(bOut==161 || bOut==171 || bOut==181 || bOut==191));
if(l3Hists) {
hL3[0]=new TH1F((sout3.str()+"_DataInpVsBx").c_str(),
";BX;Data in (bits)",nBx,0.0,nBx);
hL3[1]=new TH1F((sout3.str()+"_DataOutVsBx").c_str(),
";BX;Data out (bits)",nBx,0.0,nBx);
hL3[2]=new TH1F((sout3.str()+"_BufferOccupancyAVsBx").c_str(),
";BX;Buffer occupancy pre-out (bits)",nBx,0.0,nBx);
hL3[3]=new TH1F((sout3.str()+"_BufferOccupancyBVsBx").c_str(),
";BX;Buffer occupancy post-out (bits)",nBx,0.0,nBx);
hL3[4]=new TH1F((sout3.str()+"_NumberOfTCs").c_str(),
";Number of trigger cells",49,0.0,49.0);
hL3[5]=new TH1F((sout3.str()+"_NumberOfBits").c_str(),
";Number of bits",1000,0.0,1000);
hL3[6]=new TH1F((sout3.str()+"_DataInp").c_str(),
";Data in (bits)",1000,0.0,1000);
hL3[7]=new TH1F((sout3.str()+"_DataOut").c_str(),
";Data out (bits)",1000,0.0,1000);
hL3[8]=new TH1F((sout3.str()+"_BufferOccupancyA").c_str(),
";Buffer occupancy pre-out (bits)",nOccMax/8,0.0,nOccMax);
hL3[9]=new TH1F((sout3.str()+"_BufferOccupancyB").c_str(),
";Buffer occupancy post-out (bits)",nOccMax/8,0.0,nOccMax);
}
unsigned nOcc(0);
unsigned nOccCutBx(0);
unsigned nOccTrcBx(0);
double nOccAvg(0.0);
for(unsigned iBx(0);iBx<nBx;iBx++) {
unsigned nTc(Random::random().Binomial(48,dAvg/48.0));
hL3[4]->Fill(nTc);
double dAvgBx(dAvg+0.2*dAvg*Random::random().Gaus());
if(dAvgBx< 0.1) dAvgBx= 0.1;
if(dAvgBx>47.9) dAvgBx=47.9;
unsigned nTc(Random::random().Binomial(48,dAvgBx/48.0));
unsigned dTc(numberOfBits(pack,nTc));
hL3[5]->Fill(dTc);
unsigned dInp(dTc);
hL3[0]->Fill(iBx,dInp);
hL3[6]->Fill(dInp);
if(l3Hists) {
hL3[4]->Fill(nTc);
hL3[5]->Fill(dTc);
}
unsigned dInp(dTc);
if(l3Hists) {
hL3[0]->Fill(iBx,dInp);
hL3[6]->Fill(dInp);
}
nOcc+=dInp;
if(nOcc>nOccMax) {
nOcc=nOccMax;
nOccTrcBx++;
}
hL3[2]->Fill(iBx,nOcc);
hL3[8]->Fill(nOcc);
if(l3Hists) {
hL3[2]->Fill(iBx,nOcc);
hL3[8]->Fill(nOcc);
}
unsigned dOut(nOcc>bOut?bOut:nOcc);
hL3[1]->Fill(iBx,dOut);
hL3[7]->Fill(dOut);
if(l3Hists) {
hL3[1]->Fill(iBx,dOut);
hL3[7]->Fill(dOut);
}
nOcc-=dOut;
if(nOcc>nOccCut) nOccCutBx++;
if(nOcc>=nOccCut) nOccCutBx++;
nOccAvg+=nOcc;
hL3[3]->Fill(iBx,nOcc);
hL3[9]->Fill(nOcc);
if(l3Hists) {
hL3[3]->Fill(iBx,nOcc);
hL3[9]->Fill(nOcc);
}
}
hL2[2]->Fill(bOut,hL3[9]->GetMean()/nOccMax);
nOccAvg/=nBx;
hL2[2]->Fill(bOut,nOccAvg/nOccMax);
hL2[3]->Fill(bOut,double(nOccTrcBx)/nBx);
hL2[4]->Fill(bOut,double(nOccCutBx)/nBx);
......
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