11 #include "TStopwatch.h"
13 #include "PixTestBB2Map.hh"
16 #include "constants.h"
27 LOG(logDEBUG) <<
"PixTestBB2Map ctor(PixSetup &a, string, TGTab *)";
32 PixTestBB2Map::PixTestBB2Map():
PixTest() {
33 LOG(logDEBUG) <<
"PixTestBB2Map ctor()";
41 std::transform(parName.begin(), parName.end(), parName.begin(), ::tolower);
44 sval.erase(
remove(sval.begin(), sval.end(),
' '), sval.end());
47 if (!parName.compare(
"ntrig")) {
52 if (!parName.compare(
"vcals")) {
57 if (!parName.compare(
"Plwidth")) {
68 void PixTestBB2Map::init() {
69 LOG(logDEBUG) <<
"PixTestBB2Map::init()";
71 fDirectory = gFile->GetDirectory( fName.c_str() );
80 fTestTip = string(
"Bump Bonding Test = threshold map for CalS");
81 fSummaryTip = string(
"module summary");
86 PixTestBB2Map::~PixTestBB2Map() {
87 LOG(logDEBUG) <<
"PixTestBB2Map dtor";
97 bigBanner(Form(
"PixTestBB2Map::doTest() Ntrig = %d, VcalS = %d, PlWidth = %d", fParNtrig, fParVcalS, fParPlWidth));
112 uint16_t FLAGS0 = flag | FLAG_FORCE_MASKED;
118 for (
unsigned int idx = 0; idx < rocIds.size(); ++idx){
122 vector<pair<uint8_t, vector<pixel> > > results_bbmap;
134 TH2D *h22 =
new TH2D(Form(
"h22_C%d", rocId),Form(
"h22_C%d",rocId), 4160, -0.5, 4160 - 0.5, 250, -0.5, 249.5 );
135 h22->SetTitle(Form(
"%s_%i_%s",
"N_DAC12_CR4_Vcal",fParVcalS,
"map"));
137 setTitles(h22,
"Pixel 80*ic+ir",
"VthrComp");
139 for (
unsigned int idac = 0; idac < results_bbmap.size(); ++idac) {
140 int dac = results_bbmap[idac].first;
141 for (
unsigned int ipix = 0; ipix < results_bbmap[idac].second.size(); ++ipix) {
142 ic = results_bbmap[idac].second[ipix].column();
143 ir = results_bbmap[idac].second[ipix].row();
144 iroc = results_bbmap[idac].second[ipix].roc();
145 if (ic > 51 || ir > 79) {
148 val = results_bbmap[idac].second[ipix].value();
149 h22->Fill(80 * ic + ir, dac, val);
159 TH1D *h12 =
new TH1D( Form(
"CalsVthrPlateauWidth_C%d",rocId),
160 "Width of VthrComp plateau for cals;width of VthrComp plateau for cals [DAC];pixels",
163 TH2D *h24 =
new TH2D( Form(
"BBtestMap_C%d",rocId),
164 "BBtest map;col;row;max responses",
165 52, -0.5, 51.5, 80, -0.5, 79.5 );
169 int nbinx = h22->GetNbinsX( );
170 int nbiny = h22->GetNbinsY( );
184 for(
int ibin = 1; ibin <= nbinx; ibin++ ) {
186 ibinCenter = h22->GetXaxis( )->GetBinCenter( ibin );
191 for(
int j = 1; j <= nbiny; ++j ) {
192 int cnt = h22->GetBinContent( ibin, j );
198 if( imax < fParNtrig / 2 ) {
200 cout <<
"Dead pixel at raw col: " << ibinCenter % 80
201 <<
" " << ibinCenter / 80 << endl;
211 for(
int jbin = 0; jbin <= nbiny; jbin++ ) {
212 int cnt = h22->GetBinContent( ibin, jbin );
214 if( cnt >= imax / 2 ) {
224 h12->Fill( iEnd - iBegin );
226 if( iEnd - iBegin < fParPlWidth ) {
229 cout <<
"[Missing Bump at raw col:] " << ibinCenter% 80 <<
" " << ibinCenter / 80 << endl;
231 h24->Fill( ibinCenter / 80, ibinCenter % 80, 2 );
236 h24->Fill( ibinCenter / 80, ibinCenter % 80, 1 );
257 int seconds = t.RealTime();
258 LOG(logINFO) <<
"PixTestBB2Map::doTest() done"
259 << (fNDaqErrors>0? Form(
" with %d decoding errors: ", static_cast<int>(fNDaqErrors)):
"")
260 <<
", duration: " << seconds <<
" seconds";
std::map< TH1 *, std::string > fHistOptions
options can be stored with each histogram
bool setDAC(std::string dacName, uint8_t dacValue, uint8_t rocI2C)
void doTest()
function connected to "DoTest" button of PixTab
virtual bool setParameter(std::string parName, std::string sval)
set the string value of a parameter
std::vector< std::pair< std::string, std::string > > fParameters
the parameters of this test
void maskAllPixels(bool mask, uint8_t rocid)
TDirectory * fDirectory
where the root histograms will end up
std::vector< std::pair< uint8_t, std::vector< pixel > > > getEfficiencyVsDAC(std::string dacName, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTriggers)
void restoreDacs(bool verbose=false)
restore all DACs
std::vector< uint8_t > getEnabledRocIDs()
void testAllPixels(bool enable)
std::list< TH1 * >::iterator fDisplayedHist
pointer to the histogram currently displayed
virtual std::string getHistOption(TH1 *)
get the hist display options (if stored in fHistOptions)
void cacheDacs(bool verbose=false)
cache all DACs
std::list< TH1 * > fHistList
list of histograms available in PixTab::next and PixTab::previous
void setTitles(TH1 *h, const char *sx, const char *sy, float size=0.05, float xoff=1.1, float yoff=1.1, float lsize=0.05, int font=42)
utility to set histogram titles
void update()
signal to PixTab to update the canvas
void setToolTips()
implement this to provide updated tool tips if the user changes test parameters
pxar::pxarCore * fApi
pointer to the API
void init()
sets all test parameters
int getIdFromIdx(int idx)
provide the mapping between ROC ID and index