pxar
 All Classes Namespaces Functions Variables Typedefs Friends
PixTestTbm.cc
1 #include <stdlib.h> /* atof, atoi */
2 #include <algorithm> // std::find
3 #include <iostream>
4 #include "PixTestTbm.hh"
5 #include "log.h"
6 
7 #include <TH2.h>
8 
9 using namespace std;
10 using namespace pxar;
11 
12 ClassImp(PixTestTbm)
13 
14 // ----------------------------------------------------------------------
15 PixTestTbm::PixTestTbm(PixSetup *a, std::string name) : PixTest(a, name), fParNtrig(-1), fParVcal(-1) {
16  PixTest::init();
17  init();
18  LOG(logINFO) << "PixTestTbm ctor(PixSetup &a, string, TGTab *)";
19 }
20 
21 
22 //----------------------------------------------------------
23 PixTestTbm::PixTestTbm() : PixTest() {
24  LOG(logINFO) << "PixTestTbm ctor()";
25 }
26 
27 // ----------------------------------------------------------------------
28 bool PixTestTbm::setParameter(string parName, string sval) {
29  bool found(false);
30  for (unsigned int i = 0; i < fParameters.size(); ++i) {
31  LOG(logINFO) << "---> " << fParameters[i].first;
32  if (0 == fParameters[i].first.compare(parName)) {
33  found = true;
34  LOG(logDEBUG) << " ==> parName: " << parName;
35  LOG(logDEBUG) << " ==> sval: " << sval;
36  if (!parName.compare("Ntrig")) fParNtrig = atoi(sval.c_str());
37  if (!parName.compare("Vcal")) fParVcal = atoi(sval.c_str());
38  break;
39  }
40  }
41  return found;
42 }
43 
44 // ----------------------------------------------------------------------
46  fTestTip = string("test functionality of TBM channels\n")
47  + string("TO BE DEVELOPED!!")
48  ;
49  fSummaryTip = string("to be seen ... ")
50  ;
51 }
52 
53 
54 // ----------------------------------------------------------------------
55 void PixTestTbm::init() {
56  LOG(logINFO) << "PixTestTbm::init()";
57 
58  fDirectory = gFile->GetDirectory(fName.c_str());
59  if (!fDirectory) {
60  fDirectory = gFile->mkdir(fName.c_str());
61  }
62  fDirectory->cd();
63 
64 }
65 
66 
67 // ----------------------------------------------------------------------
68 void PixTestTbm::bookHist(string name) {
69  fDirectory->cd();
70  LOG(logINFO) << "nothing done with " << name;
71 }
72 
73 
74 //----------------------------------------------------------
75 PixTestTbm::~PixTestTbm() {
76  LOG(logINFO) << "PixTestTbm dtor";
77 }
78 
79 
80 // ----------------------------------------------------------------------
82  LOG(logINFO) << "PixTestTbm::doTest() ntrig = " << fParNtrig;
83  PixTest::update();
84 
85  if (fApi) fApi->_dut->testAllPixels(true);
86  vector<TH2D*> test2 = efficiencyMaps("PixelTbm", fParNtrig);
87  copy(test2.begin(), test2.end(), back_inserter(fHistList));
88 
89  TH2D *h = (TH2D*)(*fHistList.begin());
90 
91  h->Draw();
92  fDisplayedHist = find(fHistList.begin(), fHistList.end(), h);
93  PixTest::update();
94  LOG(logINFO) << "PixTestTbm::doTest() done";
95 }
virtual bool setParameter(std::string parName, std::string sval)
set the string value of a parameter
Definition: PixTestTbm.cc:28
std::vector< TH2D * > efficiencyMaps(std::string name, uint16_t ntrig=10, uint16_t FLAGS=FLAG_FORCE_MASKED)
returns TH2D's with hit maps
Definition: PixTest.cc:295
void doTest()
function connected to "DoTest" button of PixTab
Definition: PixTestTbm.cc:81
std::vector< std::pair< std::string, std::string > > fParameters
the parameters of this test
Definition: PixTest.hh:302
void setToolTips()
implement this to provide updated tool tips if the user changes test parameters
Definition: PixTestTbm.cc:45
TDirectory * fDirectory
where the root histograms will end up
Definition: PixTest.hh:306
dut * _dut
Definition: api.h:728
void testAllPixels(bool enable)
Definition: dut.cc:503
std::list< TH1 * >::iterator fDisplayedHist
pointer to the histogram currently displayed
Definition: PixTest.hh:309
std::list< TH1 * > fHistList
list of histograms available in PixTab::next and PixTab::previous
Definition: PixTest.hh:307
void update()
signal to PixTab to update the canvas
Definition: PixTest.cc:569
pxar::pxarCore * fApi
pointer to the API
Definition: PixTest.hh:289
void init()
sets all test parameters
Definition: PixTest.cc:62