4 #include "PixTestThreshMap.hh"
18 LOG(logDEBUG) <<
"PixTestThreshMap ctor(PixSetup &a, string, TGTab *)";
23 PixTestThreshMap::PixTestThreshMap() :
PixTest() {
24 LOG(logDEBUG) <<
"PixTestThreshMap ctor()";
31 std::transform(parName.begin(), parName.end(), parName.begin(), ::tolower);
32 for (
unsigned int i = 0; i <
fParameters.size(); ++i) {
36 LOG(logDEBUG) <<
" ==> parName: " << parName;
37 LOG(logDEBUG) <<
" ==> sval: " << sval;
38 if (!parName.compare(
"dac")) {
39 fParDac = sval.c_str();
42 if (!parName.compare(
"ntrig")) {
43 fParNtrig =
static_cast<uint16_t
>(atoi(sval.c_str()));
46 if (!parName.compare(
"thresholdpercent")) {
47 fParThresholdLevel =
static_cast<uint8_t
>(atoi(sval.c_str()));
50 if (!parName.compare(
"daclo")) {
51 fParLoDAC =
static_cast<uint16_t
>(atoi(sval.c_str()));
54 if (!parName.compare(
"dachi")) {
55 fParHiDAC =
static_cast<uint16_t
>(atoi(sval.c_str()));
58 if (!parName.compare(
"stepsize")) {
59 fParStepSize =
static_cast<uint16_t
>(atoi(sval.c_str()));
62 if (!parName.compare(
"risingedge")) {
63 fParRisingEdge = atoi(sval.c_str()) != 0;
66 if (!parName.compare(
"cals")) {
67 fParCalS = atoi(sval.c_str()) != 0;
78 void PixTestThreshMap::init() {
79 LOG(logINFO) <<
"PixTestThreshMap::init()";
82 fDirectory = gFile->GetDirectory(fName.c_str());
92 fTestTip = string(
"send Ntrig \"calibrates\" and count how many hits were measured\n")
93 + string(
"the result is a hitmap, not an efficiency map")
95 fSummaryTip = string(
"all ROCs are displayed side-by-side. Note the orientation:\n")
96 + string(
"the canvas bottom corresponds to the narrow module side with the cable")
102 void PixTestThreshMap::bookHist(
string name) {
104 LOG(logDEBUG) <<
"nothing done with " << name;
109 PixTestThreshMap::~PixTestThreshMap() {
110 LOG(logDEBUG) <<
"PixTestThreshMap dtor";
118 LOG(logINFO) <<
"PixTestThreshMap::doTest() ntrig = " << int(fParNtrig);
123 vector<TH1D*> hResults;
125 string name(
"Thresh");
129 for (
unsigned int iroc = 0; iroc < rocIds.size(); ++iroc){
130 id2idx.insert(make_pair(rocIds[iroc], iroc));
131 std::string rising = (fParRisingEdge ?
"Rising" :
"Falling");
132 std::string cals = (fParCalS ?
"_CalS" :
"");
133 h2 =
bookTH2D(Form(
"%s_C%d", name.c_str(), iroc), Form(
"%s%d_%s_%s%s_C%d", name.c_str(), fParThresholdLevel, fParDac.c_str(), rising.c_str(), cals.c_str(), rocIds[iroc]), 52, 0., 52., 80, 0., 80.);
143 LOG(logINFO) <<
"Recording Threshold Map...";
145 if(fParRisingEdge) flags |= FLAG_RISING_EDGE;
146 if(fParCalS) flags |= FLAG_CALS;
147 std::vector<pixel> results =
fApi->
getThresholdMap(fParDac, fParStepSize, fParLoDAC,fParHiDAC,fParThresholdLevel,flags, fParNtrig);
149 LOG(logINFO) <<
"Pixels returned: " << results.size();
151 for(std::vector<pixel>::size_type idx = 0; idx < results.size() ; idx++) {
152 maps[id2idx[results[idx].roc()]]->SetBinContent(results[idx].column()+1,results[idx].row()+1,results[idx].value());
155 for (
unsigned int i = 0; i < maps.size(); ++i) {
159 copy(maps.begin(), maps.end(), back_inserter(
fHistList));
166 LOG(logINFO) <<
"PixTestThreshMap::doTest() done";
std::map< TH1 *, std::string > fHistOptions
options can be stored with each histogram
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< pixel > getThresholdMap(std::string dacName, uint8_t dacStep, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTriggers)
void setToolTips()
implement this to provide updated tool tips if the user changes test parameters
std::vector< uint8_t > getEnabledRocIDs()
void testAllPixels(bool enable)
std::list< TH1 * >::iterator fDisplayedHist
pointer to the histogram currently displayed
void doTest()
function connected to "DoTest" button of PixTab
virtual std::string getHistOption(TH1 *)
get the hist display options (if stored in fHistOptions)
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
TH2D * bookTH2D(std::string sname, std::string title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double max)
book a TH2D, adding version information to the name and title
void update()
signal to PixTab to update the canvas
virtual bool setParameter(std::string parName, std::string sval)
set the string value of a parameter
pxar::pxarCore * fApi
pointer to the API
void init()
sets all test parameters