Commit e81776e8 by dauncey

New mains

parent 87bcf303
No preview for this file type
 ... ... @@ -497,7 +497,6 @@ $E=0$ & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \cr \end{tabular} \end{center} %\newpage For the extreme values of $E$, then $E=0$ and $E=1$ both give an exact representation as they only use the lowest range or two lowest ranges, ... ... @@ -568,6 +567,7 @@ Representation & Exponent & Mantissa & Value & $2\times$Rep & Appended & $2\time \end{tabular} \end{center} \newpage \section{Template fit of energy in depth} Assume a template shape for a photon of$P_l\$ per photon energy GeV ... ...
 ... ... @@ -12,7 +12,7 @@ public: reset(); } Average(unsigned n, double a, double s) { Average(unsigned long n, double a, double s) { _number=n; _sum=n*a; if(n>1) _sumOfSquares=(n-1.0)*s*s+n*a*a; ... ... @@ -59,7 +59,7 @@ public: operator+=(x); } virtual unsigned number() const { virtual unsigned long number() const { return _number; } ... ... @@ -88,7 +88,7 @@ public: private: unsigned _number; unsigned long _number; double _sum; double _sumOfSquares; }; ... ...
 ... ... @@ -6,6 +6,7 @@ #include #include #include "Backtrace.hh" #include "PackerBase.hh" class PackerFloat22 : public PackerBaseUint { ... ... @@ -24,15 +25,22 @@ public: virtual std::string name() const { std::ostringstream sout; sout << "PackerFloat22E" << fExp << "M" << fMan; sout << "PackerFloat22_" << fExp << "E" << fMan << "M"; return sout.str(); } void pack(uint32_t d) { uint32_t dSave(d); assert(d<=fDataMax); /* std::cout << name() << "::pack() Bits in mantissa = " << fMan << ", exponent = " << fExp << ", total range = " << fBit << ", data maximum = 0x" << std::hex << fDataMax << std::dec << " = " << fDataMax << ", data = " << d << std::endl; */ BACKTRACE_AND_ASSERT(d<=fDataMax); if(d<(uint32_t(1)<
 ... ... @@ -42,6 +42,10 @@ public: } } TH1F* Int() { return i; } protected: bool up; double wSum; ... ...
src/Annoying.cpp 0 → 100644
 #include "Hack.hh" #include #include #include #include #include "TH1F.h" #include "TH2F.h" #include "TH1D.h" #include "TH2D.h" #include "TFileHandler.hh" #include "Backtrace.hh" #include "Random.hh" #include "TE1F.hh" class LosingPoint { public: LosingPoint(int n, int m) : fN(n), fM(m) { } bool isWinningPoint(int n, int m) { if(n vLp; vLp.push_back(LosingPoint(0,0)); hLose->SetBinContent(1,1,1); unsigned s(1); unsigned nX[2][2]={{0xffffffff,0},{0xffffffff,0}}; for(;s<=100;s++) { nX[0][0]=0xffffffff; nX[0][1]=0; nX[1][0]=0xffffffff; nX[1][1]=0; unsigned nLp(vLp.size()); if((s%10)==0) std::cout << "Sum = " << s << ", number of losing points so far = " << nLp << std::endl; for(unsigned n(0);n<=s;n++) { unsigned m(s-n); bool wp(false); for(unsigned v(0);vFill((1.0*n)/s); vLp.push_back(LosingPoint(n,m)); hLose->SetBinContent(n+1,m+1,1); if(n<0.35*s) { if(nX[0][0]>n) nX[0][0]=n; if(nX[0][1]n) nX[1][0]=n; if(nX[1][1]
 #include "Hack.hh" #include #include #include #include #include "TH1F.h" #include "TH2F.h" #include "TH1D.h" #include "TH2D.h" #include "TFileHandler.hh" #include "Backtrace.hh" #include "Random.hh" #include "TE1F.hh" unsigned bitsPerModule(unsigned n) { if(n<8) return 16+13*n; return 16+48+7*n; } int main(int argc, char* argv[]) { TFileHandler tfh("DumbBuffer"); TH1D *hBits=new TH1D("Bits",";Number of trigger cells;Bits per module", 49,0.0,49.0); TH1D *hBitsBx=new TH1D("BitsBx",";Number of trigger cells;BX per module", 49,0.0,49.0); TH1D *hHits=new TH1D("Hits",";Number of trigger cells;Number", 49,0.0,49.0); TH1D *hBiocc=new TH1D("Biocc",";Buffer after filling (bits)", 100,0,500); TH1D *hBiobx=new TH1D("Biobx",";Buffer after filling (BX)", 100,0,20); TH1D *hBoocc=new TH1D("Boocc",";Buffer after emptying (bits)", 100,0,500); TH1D *hBoobx=new TH1D("Boobx",";Buffer after emptying (BX)", 100,0,20); TE1F *hBioccE=new TE1F("BioccE",";Buffer after filling (bits)", 200,0,1000); TE1F *hBiobxE=new TE1F("BiobxE",";Buffer after filling (BX)", 200,0,40); TE1F *hBooccE=new TE1F("BooccE",";Buffer after emptying (bits)", 200,0,1000); TE1F *hBoobxE=new TE1F("BoobxE",";Buffer after emptying (BX)", 200,0,40); unsigned bxHist(1000); TH1D *hBinp=new TH1D("Binp",";BX;Buffer after filling (bits)", bxHist,0,bxHist); TH1D *hBout=new TH1D("Bout",";BX;Buffer after emptying (bits)", bxHist,0,bxHist); TH1D *hBibx=new TH1D("Bibx",";BX;Buffer after filling (BX)", bxHist,0,bxHist); TH1D *hBobx=new TH1D("Bobx",";BX;Buffer after emptying (BX)", bxHist,0,bxHist); TH1D *hLat=new TH1D("Lat",";Mean occupancy;Latency (BX)", 15,0.0,1.5); for(unsigned n(0);n<49;n++) { hBits->SetBinContent(n+1,bitsPerModule(n)); hBitsBx->SetBinContent(n+1,bitsPerModule(n)/32.0); } for(unsigned m(0);m<15;m++) { const double meanHits(0.1*(m+0.5)); std::cout << m << " Mean number of hits = " << meanHits << " per BX" << std::endl; unsigned nBuffer(0); unsigned nBx(5000000); for(unsigned bx(0);bxFill(nHits); // Into buffer unsigned nBits(bitsPerModule(nHits)); nBuffer+=nBits; hBiocc->Fill(nBuffer); hBiobx->Fill(nBuffer/32.0); hBioccE->Fill(nBuffer); hBiobxE->Fill(nBuffer/32.0); if(bxSetBinContent(bx+1,nBuffer); hBibx->SetBinContent(bx+1,nBuffer/32.0); } // Out of buffer if(nBuffer<32) nBuffer=0; else nBuffer-=32; hBoocc->Fill(nBuffer); hBoobx->Fill(nBuffer/32.0); hBooccE->Fill(nBuffer); hBoobxE->Fill(nBuffer/32.0); if(bxSetBinContent(bx+1,nBuffer); hBobx->SetBinContent(bx+1,nBuffer/32.0); } } unsigned nBxInt(nBx/100000); bool done(false); for(unsigned i(0);i<200 && !done;i++) { if(hBiobxE->Int()->GetBinContent(i+1)SetBinContent(m+1,0.2*i); } } if(!done) hLat->SetBinContent(m+1,0.2*200); } return 0; }
src/DumbTm.cpp 0 → 100644
 #include "Hack.hh" #include #include #include #include #include #include "TH1F.h" #include "TH2F.h" #include "TH1D.h" #include "TH2D.h" #include "TFileHandler.hh" #include "Backtrace.hh" #include "Random.hh" #include "TE1F.hh" /* unsigned bitsPerModule(unsigned n) { if(n<8) return 16+13*n; return 16+48+7*n; } */ class System { public: System(unsigned l, unsigned r, unsigned t, unsigned m) : fLinks(l), fRepeat(r), fTimeMx(t), fM(m), fInput((fLinks+71)/72), fN1((fInput+fRepeat-1)/fRepeat) { } bool valid(bool var) const { if(fM*fTimeMx>72) return false; // S1 FPGA input if(fM*fN1>72) return false; // S2 FPGA input unsigned nOverlap((72+fTimeMx-1)/fTimeMx); if(fRepeat==1) nOverlap=0; if(2*nOverlap>=fN1) return false; double ratio(((fN1-2*nOverlap)*fM*fTimeMx+2*nOverlap*(fM-1)*fTimeMx)/(42.0*fN1)); if(ratio<(var?1.4:1.1)) return false; return true; } unsigned latency() const { std::cout << "r, n1, t, m = " << fRepeat << ", " << fN1 << ", " << fTimeMx << ", " << fM << ", latency = " << fTimeMx << std::endl; return fTimeMx; } unsigned cost() const { unsigned cost(1.25*(30*fN1*fRepeat+18*fTimeMx*fRepeat)); std::cout << "r, n1, t, m = " << fRepeat << ", " << fN1 << ", " << fTimeMx << ", " << fM << ", cost = " << cost << std::endl; return cost; } private: unsigned fLinks; unsigned fRepeat; unsigned fTimeMx; unsigned fM; unsigned fInput; unsigned fN1; }; int main(int argc, char* argv[]) { bool var(true); bool l25(false); std::string fn("DumbTm"); if(var) fn+="Var"; else fn+="Fix"; if(l25) fn+="L25"; else fn+="L16"; TFileHandler tfh(fn); const unsigned nL(60); /* std::string sL[nL]={//"3888", "3500","3600","3700","3800","3900", "4000","4100","4200","4300","4400", "4500","4600","4700","4800","4900", "5000","5100","5200","5300","5400", "5500","5600","5700","5800","5900", "6000"}; */ TH2F *hCvsL[nL]; for(unsigned l(0);l(var?1.4:1.1)) { // Find latency, cost and overhead ratio unsigned latency(t); unsigned cost; if(l25) cost=1.25*(35*n1*r+23*t*r); else cost=1.25*(30*n1*r+18*t*r); std::cout << "r, n1, t, m = " << r << ", " << n1 << ", " << t << ", " << m << ", latency, cost, ratio = " << latency << ", " << cost << ", " << ratio << std::endl; hCvsKT[t-1]->Fill(2*nLinks,cost); if(tmMinCost>=cost) { std::cout << "New TM minimum cost" << std::endl; tmMinCost=cost; tmMinLatency=latency; tmMinRegions=r; tmMinN1=n1; } if(minCost>=cost) { std::cout << "New minimum cost" << std::endl; minCost=cost; minLatency=latency; } hCvsL[l]->Fill(latency,cost); } } } } } } hTCvsK[t-1]->Fill(2*nLinks,tmMinCost); hTRvsK[t-1]->Fill(2*nLinks,tmMinRegions); hTN1vsK[t-1]->Fill(2*nLinks,tmMinN1); } hCvsK->Fill(2*nLinks,minCost); hLvsK->Fill(2*nLinks,minLatency);