10 #include <TStopwatch.h>
12 #include "PixTestSetVana.hh"
22 :
PixTest(a, name), fTargetIa(24)
29 PixTestSetVana::PixTestSetVana() :
PixTest()
38 for (
unsigned int i = 0; i <
fParameters.size(); ++i) {
42 LOG(logDEBUG) <<
" ==> parName: " << parName;
43 LOG(logDEBUG) <<
" ==> sval: " << sval;
44 if (!parName.compare(
"targetia")) {
45 fTargetIa = atoi(sval.c_str());
55 void PixTestSetVana::init()
57 fDirectory = gFile->GetDirectory( fName.c_str() );
64 void PixTestSetVana::bookHist(
string name)
66 LOG(logDEBUG) <<
"not using " << name;
72 PixTestSetVana::~PixTestSetVana()
74 LOG(logDEBUG) <<
"PixTestSetVana dtor";
75 std::list<TH1*>::iterator il;
78 LOG(logDEBUG) <<
"Write out " << (*il)->GetName();
90 LOG(logINFO) <<
"PixTestSetVana::doTest() target Ia " << fTargetIa <<
" mA/ROC";
98 uint32_t nRocs =
fPixSetup->getConfigParameters()->getNrocs();
102 for( uint32_t roc = 0; roc < nRocs; ++roc ) {
116 while( sw.RealTime() < 0.1 );
118 LOG(logINFO) <<
"delay " << sw.RealTime() <<
" s"
119 <<
", Stopwatch counter " << sw.Counter();
124 double i015 = (nRocs-1) * i016 / nRocs;
126 LOG(logINFO) <<
"offset current from other " << nRocs-1 <<
" ROCs is "
131 const double extra = 0.1;
132 const double eps = 0.25;
133 const double slope = 6;
135 for( uint32_t roc = 0; roc < nRocs; ++roc ) {
137 int vana = vana16[roc];
148 while( sw.RealTime() < 0.1 );
150 LOG(logINFO) <<
"delay " << sw.RealTime() <<
" s"
151 <<
", Stopwatch counter " << sw.Counter();
153 double diff = fTargetIa + extra - (ia - i015);
156 LOG(logINFO) <<
"ROC " << roc <<
" iter " << iter
158 <<
" Ia " << ia-i015 <<
" mA";
160 while( fabs(diff) > eps && iter < 11 && vana > 0 && vana < 255 ) {
162 int stp = int( fabs(slope*diff) );
163 if( stp == 0 ) stp = 1;
164 if( diff < 0 ) stp = -stp;
182 while( sw.RealTime() < 0.1 );
184 diff = fTargetIa + extra - (ia - i015);
186 LOG(logINFO) <<
"ROC " << roc <<
" iter " << iter
188 <<
" Ia " << ia-i015 <<
" mA";
198 for( uint32_t roc = 0; roc < nRocs; ++roc ) {
200 LOG(logINFO) <<
"ROC " << setw(2) << roc
201 <<
" Vana " << vana16[roc];
211 while( sw.RealTime() < 0.1 );
213 LOG(logINFO) <<
"Module Ia " << ia16 <<
" mA = " << ia16/nRocs <<
" mA/ROC";
bool setDAC(std::string dacName, uint8_t dacValue, uint8_t rocI2C)
PixSetup * fPixSetup
all necessary stuff in one place
std::vector< std::pair< std::string, std::string > > fParameters
the parameters of this test
virtual bool setParameter(std::string parName, std::string sval)
set the string value of a parameter
TDirectory * fDirectory
where the root histograms will end up
void testAllPixels(bool enable)
std::list< TH1 * > fHistList
list of histograms available in PixTab::next and PixTab::previous
virtual void setToolTips()
implement this to provide updated tool tips if the user changes test parameters
void doTest()
function connected to "DoTest" button of PixTab
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