7 #include <TStopwatch.h>
9 #include "PixTestDacScanRoc.hh"
19 :
PixTest(a, name), fParNtrig(-1), fParDAC("nada"),
20 fParLoDAC(-1), fParHiDAC(-1)
27 PixTestDacScanRoc::PixTestDacScanRoc() :
PixTest()
36 for( uint32_t i = 0; i <
fParameters.size(); ++i ) {
42 sval.erase(
remove( sval.begin(), sval.end(),
' '), sval.end() );
44 if( !parName.compare(
"ntrig") ) {
45 fParNtrig = atoi(sval.c_str() );
46 LOG(logDEBUG) <<
" setting fParNtrig ->" << fParNtrig
47 <<
"<- from sval = " << sval;
50 if( !parName.compare(
"dac") ) {
52 LOG(logDEBUG) <<
" setting fParDAC ->" << fParDAC
53 <<
"<- from sval = " << sval;
56 if( !parName.compare(
"daclo") ) {
57 fParLoDAC = atoi(sval.c_str() );
58 LOG(logDEBUG) <<
" setting fParLoDAC ->" << fParLoDAC
59 <<
"<- from sval = " << sval;
62 if( !parName.compare(
"dachi") ) {
63 fParHiDAC = atoi(sval.c_str() );
64 LOG(logDEBUG) <<
" setting fParHiDAC ->" << fParHiDAC
65 <<
"<- from sval = " << sval;
75 void PixTestDacScanRoc::init()
78 fDirectory = gFile->GetDirectory( fName.c_str() );
87 string( Form(
"scan DAC %s, count responding pixels per ROC\n", fParDAC.c_str() ) )
89 fSummaryTip = string(
"summary plot to be implemented")
94 void PixTestDacScanRoc::bookHist(
string name)
96 LOG(logDEBUG) <<
"nothing done with " << name;
100 PixTestDacScanRoc::~PixTestDacScanRoc()
111 LOG(logINFO) <<
"PixTestDacScanRoc::doTest() DAC = " << fParDAC;
116 LOG(logINFO) <<
"ERROR: " << fParDAC <<
" is not a ROC register";
120 if( fParHiDAC > maxDac ) {
121 LOG(logINFO) << fParDAC <<
" range only " << maxDac;
125 uint32_t nRocs =
fPixSetup->getConfigParameters()->getNrocs();
128 for( uint32_t roc = 0; roc < nRocs; ++roc )
131 LOG(logINFO) <<
"PixTestDacScanRoc::doTest() ntrig = " << fParNtrig;
137 vector<TH1D*> hAlive;
138 vector<TH1D*> hPerfect;
141 for( uint32_t roc = 0; roc < nRocs; ++roc ) {
143 h1 =
new TH1D( Form(
"Alive_pixels_vs_%s_C%d",
144 fParDAC.c_str(), roc ),
145 Form(
"Alive pixels vs %s C%d",
146 fParDAC.c_str(), roc ),
150 h1->SetMaximum(4200);
151 setTitles( h1, Form(
"%s [DAC]", fParDAC.c_str() ),
"alive pixels" );
152 hAlive.push_back(h1);
155 h1 =
new TH1D( Form(
"Perfect_pixels_vs_%s_C%d",
156 fParDAC.c_str(), roc ),
157 Form(
"Perfect pixels vs %s C%d",
158 fParDAC.c_str(), roc ),
162 h1->SetMaximum(4200);
163 setTitles( h1, Form(
"%s [DAC]", fParDAC.c_str() ),
"perfect pixels" );
164 hPerfect.push_back(h1);
173 for( int32_t idac = fParLoDAC; idac < fParHiDAC; ++idac ) {
185 while( sw.RealTime() < 0.1 );
191 LOG(logINFO) << fParDAC << setw(4) << idac <<
" " <<
id <<
" mA"
192 << setw(7) << vpix.size();
196 for(
size_t ipx = 0; ipx < vpix.size(); ++ipx ) {
198 uint8_t roc = vpix[ipx].roc();
201 int32_t readouts = (int32_t)vpix[ipx].value();
202 if( readouts == fParNtrig )
203 hPerfect[roc]->Fill( idac );
204 if( readouts >= fParNtrig/2 )
205 hAlive[roc]->Fill( idac );
214 for( uint32_t roc = 0; roc < nRocs; ++roc )
219 for(
size_t roc = 0; roc < nRocs; ++roc ) {
220 hPerfect[roc]->Draw();
virtual bool setParameter(std::string parName, std::string sval)
set the string value of a parameter
void doTest()
function connected to "DoTest" button of PixTab
bool setDAC(std::string dacName, uint8_t dacValue, uint8_t rocI2C)
void setToolTips()
implement this to provide updated tool tips if the user changes test parameters
PixSetup * fPixSetup
all necessary stuff in one place
uint8_t getDACRange(std::string dacName)
std::vector< std::pair< std::string, std::string > > fParameters
the parameters of this test
TDirectory * fDirectory
where the root histograms will end up
void testAllPixels(bool enable)
std::list< TH1 * >::iterator fDisplayedHist
pointer to the histogram currently displayed
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
std::vector< pixel > getEfficiencyMap(uint16_t flags, uint16_t nTriggers)
void update()
signal to PixTab to update the canvas
uint8_t getDAC(size_t rocId, std::string dacName)
pxar::pxarCore * fApi
pointer to the API
void init()
sets all test parameters