7 #include "PixTestDacScanPh.hh"
17 :
PixTest(a, name), fParNtrig(-1),
18 fParDAC("nada"), fParLoDAC(-1), fParHiDAC(-1),
26 PixTestDacScanPh::PixTestDacScanPh() :
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;
61 if( !parName.compare(
"dachi" ) ) {
62 fParHiDAC = atoi( sval.c_str() );
63 LOG(logDEBUG) <<
" setting fParHiDAC ->" << fParHiDAC
64 <<
"<- from sval = " << sval;
66 if( !parName.compare(
"cals" ) ) {
67 fParCals = atoi( sval.c_str() );
68 LOG(logDEBUG) <<
" setting fParCals ->" << fParCals
69 <<
"<- from sval = " << sval;
72 if( !parName.compare(
"pix1" ) ) {
73 string::size_type s1 = sval.find(
"," );
74 if( string::npos != s1 ) {
75 string str1 = sval.substr(0, s1);
76 int pixc = atoi( str1.c_str() );
77 string str2 = sval.substr(s1+1);
78 int pixr = atoi( str2.c_str() );
79 fPIX.push_back( make_pair( pixc, pixr ) );
80 LOG(logDEBUG) <<
"new coordinates: (" << fPIX[fPIX.size()-1].first
81 <<
" | " << fPIX[fPIX.size()-1].second <<
") with currently "
82 << fPIX.size() <<
" entries in the Vector" << endl;
85 fPIX.push_back( make_pair( -1, -1 ) );
96 void PixTestDacScanPh::init()
98 fDirectory = gFile->GetDirectory( fName.c_str() );
107 fTestTip = string(
"measure pixel pulse height vs DAC");
108 fSummaryTip = string(
"summary plot to be implemented");
112 void PixTestDacScanPh::bookHist(
string name)
114 LOG(logDEBUG) <<
"nothing done with " << name;
118 PixTestDacScanPh::~PixTestDacScanPh()
120 std::list<TH1*>::iterator il;
123 LOG(logINFO) <<
"Write out " << (*il)->GetName();
136 LOG(logINFO) <<
"PixTestCurrentVsDac::doTest() DAC = " << fParDAC;
141 LOG(logINFO) <<
"ERROR: " << fParDAC <<
" is not a ROC register";
145 if( fParHiDAC > maxDac ) {
146 LOG(logINFO) << fParDAC <<
" range only " << maxDac;
150 LOG(logINFO) <<
"PixTestDacScanPh::doTest() ntrig = " << fParNtrig;
157 int32_t col = fPIX[fPIX.size()-1].first;
158 int32_t row = fPIX[fPIX.size()-1].second;
166 if( fParCals ) flags = FLAG_CALS;
167 LOG(logINFO) <<
"flag " << flags;
171 LOG(logINFO) <<
"CtrlReg 4 (large Vcal)";
174 vector<pair<uint8_t, vector<pixel> > >
179 LOG(logINFO) <<
"back to CtrlReg " << ctl;
187 uint32_t nRocs =
fPixSetup->getConfigParameters()->getNrocs();
189 for( uint32_t roc = 0; roc < nRocs; ++roc ) {
191 h1 =
new TH1D( Form(
"PH_vs_%s_c%02d_r%02d_C%02d",
192 fParDAC.c_str(), col, row, roc ),
193 Form(
"PH vs %s c%02d r%02d C%02d",
194 fParDAC.c_str(), col, row, roc ),
198 setTitles( h1, Form(
"%s [DAC]", fParDAC.c_str() ),
"<PH> [ADC]" );
206 for(
size_t i = 0; i < result.size(); ++i ) {
208 int idac = result[i].first;
210 vector<pixel> vpix = result[i].second;
212 for(
size_t ipx = 0; ipx < vpix.size(); ++ipx ) {
214 uint8_t roc = vpix[ipx].roc();
217 vpix[ipx].column() == col &&
218 vpix[ipx].row() == row ) {
220 h1->Fill( idac, vpix[ipx].value());
227 for(
size_t roc = 0; roc < nRocs; ++roc ) {
235 flags = FLAG_RISING_EDGE;
237 for(
size_t ipx = 0; ipx < vpix9.size(); ++ipx )
239 <<
"roc " << setw(2) << (int) vpix9[ipx].roc()
240 <<
" pix " << setw(2) << (int) vpix9[ipx].column()
241 <<
" " << setw(2) << (int) vpix9[ipx].row()
242 <<
" thr " << setw(3) << vpix9[ipx].value();
std::vector< std::pair< uint8_t, std::vector< pixel > > > getPulseheightVsDAC(std::string dacName, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTriggers)
bool setDAC(std::string dacName, uint8_t dacValue, uint8_t rocI2C)
void doTest()
function connected to "DoTest" button of PixTab
PixSetup * fPixSetup
all necessary stuff in one place
uint8_t getDACRange(std::string dacName)
void setToolTips()
implement this to provide updated tool tips if the user changes test parameters
void testPixel(uint8_t column, uint8_t row, bool enable)
std::vector< std::pair< std::string, std::string > > fParameters
the parameters of this test
TDirectory * fDirectory
where the root histograms will end up
std::vector< pixel > getThresholdMap(std::string dacName, uint8_t dacStep, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTriggers)
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
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
virtual bool setParameter(std::string parName, std::string sval)
set the string value of a parameter