7 #include "pxardllexport.h"
11 typedef char __signed;
22 #include <TProfile2D.h>
24 #include <TDirectory.h>
27 #include <TTimeStamp.h>
32 #include "PixInitFunc.hh"
33 #include "PixSetup.hh"
34 #include "PixTestParameters.hh"
35 #include "shist256.hh"
41 uint16_t numDecoderErrors;
65 class DLLEXPORT
PixTest:
public TQObject {
74 void bookHist(std::string name);
78 virtual void doAnalysis();
80 virtual void doTest();
82 virtual void fullTest();
84 virtual void runCommand(std::string command);
90 void saveTbParameters();
92 std::vector<std::vector<std::pair<int, int> > > deadPixels(
int ntrig,
bool scanCalDel =
false);
99 virtual void setToolTips();
107 virtual std::string getHistOption(TH1*);
110 int pixelThreshold(std::string dac,
int ntrig,
int dacmin,
int dacmax);
112 void dacScan(std::string dac,
int ntrig,
int dacmin,
int dacmax, std::vector<shist256*> maps,
int ihit,
int flag = 0);
114 void preScan(std::string dac, std::vector<shist256*> maps,
int &dacmin,
int &dacmax);
116 void scurveAna(std::string dac, std::string name, std::vector<shist256*> maps, std::vector<TH1*> &resultMaps,
int result);
118 void getPhError(std::string dac,
int dacmin,
int dacmax,
int FLAGS,
int ntrig);
120 std::vector<TH2D*> phMaps(std::string name, uint16_t ntrig = 10, uint16_t FLAGS = FLAG_FORCE_MASKED);
122 std::vector<TH2D*> efficiencyMaps(std::string name, uint16_t ntrig = 10, uint16_t FLAGS = FLAG_FORCE_MASKED);
134 std::vector<TH1*> scurveMaps(std::string dac, std::string name,
int ntrig = 10,
int daclo = 0,
int dachi = 255,
int dacsperstep = -1,
135 int result = 15,
int ihit = 1,
int flag = FLAG_FORCE_MASKED);
137 std::vector<TH1*> thrMaps(std::string dac, std::string name, uint8_t dacmin, uint8_t dachi,
int ntrig, uint16_t flag = 0);
138 std::vector<TH1*> thrMaps(std::string dac, std::string name,
int ntrig, uint16_t flag = 0);
145 std::vector<std::pair<int,int> > checkHotPixels(TH2D* h);
148 std::pair<std::vector<TH2D*>,std::vector<TH2D*> > xEfficiencyMaps(std::string name, uint16_t ntrig,
149 uint16_t FLAGS = FLAG_CHECK_ORDER | FLAG_FORCE_UNMASKED);
152 void maskHotPixels(std::vector<TH2D*>);
158 uint16_t prepareDaq(
int triggerFreq, uint8_t trgTkDel);
160 uint16_t setTriggerFrequency(
int triggerFreq, uint8_t TrgTkDel);
166 TH1D* bookTH1D(std::string sname, std::string title,
int nbins,
double xmin,
double xmax);
168 TH2D* bookTH2D(std::string sname, std::string title,
int nbinsx,
double xmin,
double xmax,
int nbinsy,
double ymin,
double max);
170 TProfile2D* bookTProfile2D(std::string sname, std::string title,
171 int nbinsx,
double xmin,
double xmax,
int nbinsy,
double ymin,
double max,
172 std::string option =
"");
174 void fillDacHist(std::vector<std::pair<uint8_t, std::vector<pxar::pixel> > > &results, TH1D *h,
175 int icol = -1,
int irow = -1,
int iroc = -1);
178 virtual void sparseRoc(
int npix = 8);
181 TH1D* distribution(TH2D *,
int nbins,
double xmin,
double xmax);
183 bool threshold(TH1 *);
185 int simpleThreshold(TH1 *);
187 std::vector<int> getMaximumVthrComp(
int ntrig,
double frac = 0.8,
int reserve = 10);
189 std::vector<int> getMinimumVthrComp(std::vector<TH1*>,
int reserve = 10,
double nsigma = 3.);
191 double getMinimumThreshold(std::vector<TH1*>);
193 double getMaximumThreshold(std::vector<TH1*>);
195 std::vector<TH1*> mapsWithString(std::vector<TH1*>, std::string name);
196 std::vector<TH2D*> mapsWithString(std::vector<TH2D*>, std::string name);
199 void print(std::string, pxar::TLogLevel log = pxar::logINFO);
200 void banner(std::string, pxar::TLogLevel log = pxar::logINFO);
201 void bigBanner(std::string, pxar::TLogLevel log = pxar::logINFO);
204 void cacheDacs(
bool verbose =
false);
206 void restoreDacs(
bool verbose =
false);
209 std::vector<uint8_t> getDacs(std::string dacName);
211 void setDacs(std::string dacName, std::vector<uint8_t> dacVector);
213 std::string getDacsString(std::string dacName);
216 virtual TH1* moduleMap(std::string histname);
219 void clearHistList();
224 void resetDirectory();
229 std::vector<std::pair<std::string, std::string> >
getParameters() {
return fParameters;}
231 bool getParameter(std::string parName,
int &);
233 bool getParameter(std::string parName,
float &);
235 std::string getParameter(std::string parName);
237 virtual bool setParameter(std::string parName, std::string sval);
239 virtual void setDAC(std::string parName, uint8_t val) {fApi->setDAC(parName, val);}
241 virtual void setDAC(std::string parName, uint8_t val, uint8_t rocid) {fApi->setDAC(parName, val, rocid);}
243 void dumpParameters();
245 void setTitles(TH1 *h,
const char *sx,
const char *sy,
246 float size = 0.05,
float xoff = 1.1,
float yoff = 1.1,
float lsize = 0.05,
int font = 42);
249 void setId2Idx(std::map<int, int> a);
251 int getIdFromIdx(
int idx);
253 int getIdxFromId(
int id);
255 bool selectedRoc(
int id);
257 void clearSelectedPixels();
259 void addSelectedPixels(std::string sval);
261 bool setTestParameter(std::string parname, std::string value);
264 static std::string stripPos(std::string);
286 int histCycle(std::string hname);
287 void fillMap(TH2D *hmod, TH2D *hroc,
int iroc);
294 double fThreshold, fThresholdE, fSigma,
fSigmaE;
297 std::vector<double> fPhErrP0, fPhErrP1;
298 uint32_t fNDaqErrors;
300 std::string fName, fTestTip, fSummaryTip,
fStopTip;
304 std::vector<std::vector<std::pair<std::string,uint8_t> > >
fDacCache;
311 std::vector<std::pair<int, int> >
fPIX;
315 TTimeStamp *fTimeStamp;
321 std::vector<std::pair<std::string, uint8_t> > fPg_setup;
322 std::vector<std::vector<std::pair<int, int> > > fHotPixels;
std::vector< std::pair< std::string, std::string > > getParameters()
returns a vector of test parameter names and string values
double fThresholdN
variable for passing back the threshold where noise leads to loss of efficiency
std::map< TH1 *, std::string > fHistOptions
options can be stored with each histogram
std::string fStopTip
information for this test
PixSetup * fPixSetup
all necessary stuff in one place
bool testProblem()
query whether test 'failed'
std::vector< std::pair< int, int > > fPIX
range of enabled pixels for time-consuming tests
std::vector< std::vector< std::pair< std::string, uint8_t > > > fDacCache
vector for all ROCs
std::vector< std::pair< std::string, std::string > > fParameters
the parameters of this test
std::string getName()
returns the test name
TDirectory * fDirectory
where the root histograms will end up
virtual std::string getTestTip()
get the string describing the test (called from PixTab::updateToolTips)
double fSigmaE
variables for passing back s-curve results
std::list< TH1 * >::iterator fDisplayedHist
pointer to the histogram currently displayed
virtual std::string getSummaryTip()
hint to what happens if the user hits the "summary" button
virtual void setDAC(std::string parName, uint8_t val)
allow setting DACs in scripts for entire DUT
std::list< TH1 * > fHistList
list of histograms available in PixTab::next and PixTab::previous
PixInitFunc * fPIF
function instantiation and automatic initialization
TDirectory * getDirectory()
return fDirectory
virtual void setDAC(std::string parName, uint8_t val, uint8_t rocid)
allow setting DACs in scripts for spcific ROCs
PixTestParameters * fTestParameters
the repository of all test parameters
virtual std::string getStopTip()
hint to what happens if the user hits the "stop" button
pxar::pxarCore * fApi
pointer to the API
std::map< int, int > fId2Idx
map the ROC ID onto the (results vector) index of the ROC