233   gStyle->SetLegendBorderSize(0);
 
  234   struct timeval startTimeTv;
 
  235   gettimeofday(&startTimeTv, NULL);
 
  236   time_t startTime = (time_t)startTimeTv.tv_sec;
 
  237   tm* startGmTime = gmtime(&startTime);
 
  238   const string startUTCTime = asctime(startGmTime);
 
  261     zap[
'T'] = 
make_field(testType) = 
"HV-TUNING-V2";
 
  266   catch(
const exception& error) {
 
  267     FATAL(error.what() << endl);
 
  275     FATAL(
"No trigger parameters from input:" << error.
what() << endl);
 
  281     load(detectorFile, detector);
 
  290   const int runNb = vInputFiles.size();
 
  293   const double diffHVMax = 250;
 
  295   string cookiesContent;
 
  297   getline(incookies, cookiesContent);
 
  306   int detid = detector.
getID();
 
  307   string streamName = 
"detectors";
 
  308   string location = 
"";
 
  309   AccessDB(vvvupi, vvvHv, cookiesContent, usr, pwd, streamName, detid, 
"-2", lineIds, location);
 
  310   streamName = 
"pmt_hv_settings";
 
  311   AccessDB(vvvupi, vvvHv, cookiesContent, usr, pwd, streamName, detid, 
"-1", lineIds, location);
 
  317   vhToTReducedChi2.resize(runNb);
 
  318   for (
int run = 0; run < runNb; ++run) {
 
  319     ostringstream plotname;
 
  320     plotname << 
"hToTReducedChi2-run" << run + 1;
 
  321     vhToTReducedChi2[run] = 
new TH1D(plotname.str().c_str(), plotname.str().c_str(), 101, -0.05, 10.05);
 
  322     for (
int line = 0; line < lineNb; ++line) {
 
  323       for (
int dom = 0; dom < domNb; ++dom) {
 
  327           plotname << 
"hToT-run" << run + 1 << 
"-line" << line + 1 << 
"-dom" << dom + 1 << 
"-pmt" << 
pmt;
 
  328           vhToT[run][line][dom][
pmt] = 
new TH1D(plotname.str().c_str(), plotname.str().c_str(), 301, -0.5, 300.5);
 
  341   for ( ; 
in.hasNext() && counter != vInputFiles.getLimit(); ++counter) {
 
  344     if (newRun != oldRun) {
 
  345       streamName = 
"pmt_hv_run_settings";
 
  346       stringstream runIdSStr;
 
  348       const string newRunStr = runIdSStr.str();
 
  349       AccessDB(vvvupi, vvvRunHv[runCounter], cookiesContent, usr, pwd, streamName, detid, newRunStr, lineIds, location);
 
  351       runList.push_back(newRun);
 
  354     for (JDAQTimeslice::const_iterator super_frame = timeslice->begin(); super_frame != timeslice->end(); ++super_frame) {
 
  355       const int domId = super_frame->getModuleID();
 
  356       const JModule module = moduleRouter.getModule(domId);
 
  357       const int lineIndex = module.
getString() - 1; 
 
  358       const int domIndex = module.
getFloor() - 1;
 
  360         const double hitToT = hit->getToT();
 
  361         const int pmtIndex = hit->getPMT();
 
  363         const string pmtIdDBStr = vvvupi[lineIndex][domIndex][pmtIndex].substr(22);
 
  364         const int pmtIdDB = atoi(pmtIdDBStr.c_str());
 
  365         if (pmtId != pmtIdDB) {
 
  366           DEBUG(
"mismatch between pmt ids of detector file " << pmtId << 
" and database " 
  367                 << vvvupi[lineIndex][domIndex][pmtIndex] << endl);
 
  370         vhToT[runCounter - 1][lineIndex][domIndex][pmtIndex]->Fill(hitToT);
 
  377   for (
int line = 0; line < lineNb; ++line) {
 
  378     for (
int dom = 0; dom < domNb; ++dom) {
 
  381         vgToTvsHV[line][dom][
pmt] = 
new TGraphErrors();
 
  382         int localCounter = 0;
 
  383         for (
int run = 0; run < runNb; ++run) {
 
  384           if (vvvRunHv[run][line][dom][
pmt] == 0) 
continue;
 
  385           FillGraph(vgToTvsHV[line][dom][
pmt], vhToTReducedChi2[run], vhToT[run][line][dom][pmt], vvvRunHv[run][line][dom][pmt] - vvvHv[line][dom][pmt], localCounter);
 
  387         if ((localCounter < runNb) && (localCounter > 0))
 
  388           DEBUG(
"only " << localCounter << 
" runs out of " << runNb << 
" have ToT data for line " << line + 1 << 
" - dom " << dom + 1 << 
" - pmt " << 
pmt << endl);
 
  389         if (localCounter == 0) ++fullDom;
 
  392         DEBUG(fullDom << 
" pmt do not have data in dom " << dom + 1 << 
" of line " << line + 1 << endl);
 
  397   fstream outCalibXml(outXMLFile.c_str(), ofstream::out);
 
  398   struct timeval endTimeTv;
 
  399   gettimeofday(&endTimeTv, NULL);
 
  400   time_t endTime = (time_t)endTimeTv.tv_sec;
 
  401   tm* endGmTime = gmtime(&endTime);
 
  402   const string endUTCTime = asctime(endGmTime);
 
  404   ostringstream endTimeStr;
 
  405   endTimeStr << 1900 + endGmTime->tm_year << 
"-" << std::setw(2) << std::setfill(
'0') 
 
  406              << endGmTime->tm_mon + 1 << 
"-" << std::setw(2) << std::setfill(
'0')  
 
  407              << endGmTime->tm_mday << 
"T" << std::setw(2) << std::setfill(
'0') 
 
  408              << endGmTime->tm_hour << 
":" << std::setw(2) << std::setfill(
'0') 
 
  409              << endGmTime->tm_min << 
":" << std::setw(2) << std::setfill(
'0') 
 
  410              << endGmTime->tm_sec << 
"." << std::setw(6) << std::setfill(
'0') 
 
  411              << endTimeTv.tv_usec << 
"+01:00";
 
  412   ostringstream startTimeStr; 
 
  413   startTimeStr << 1900 + startGmTime->tm_year << 
"-" << std::setw(2) << std::setfill(
'0')
 
  414                << startGmTime->tm_mon + 1 << 
"-" << std::setw(2) << std::setfill(
'0')
 
  415                << startGmTime->tm_mday << 
"T" << std::setw(2) << std::setfill(
'0')
 
  416                << startGmTime->tm_hour << 
":" << std::setw(2) << std::setfill(
'0')
 
  417                << startGmTime->tm_min << 
":" << std::setw(2) << std::setfill(
'0')
 
  418                << startGmTime->tm_sec << 
"." << std::setw(6) << std::setfill(
'0')
 
  419                << startTimeTv.tv_usec << 
"+01:00";
 
  420   outCalibXml << 
"<ProductTestSession>\r\n";
 
  421   outCalibXml << 
"\t<User>" << usr << 
"</User>\r\n";
 
  422   outCalibXml << 
"\t<Location>" << location << 
"</Location>\r\n";
 
  423   outCalibXml << 
"\t<StartTime>" << startTimeStr.str() << 
"</StartTime>\r\n";
 
  424   outCalibXml << 
"\t<EndTime>" << endTimeStr.str() << 
"</EndTime>\r\n";
 
  425   outCalibXml << 
"\t<TestType>" << testType << 
"</TestType>\r\n";
 
  426   outCalibXml << 
"\t<Tests>\r\n";
 
  427   TCanvas* cToTvsHV = 
new TCanvas(
"cToTvsHV", 
"cToTvsHV", 800, 600);
 
  428   TH1D* hToTvsHVReducedChi2 = 
new TH1D(
"hToTvsHVReducedChi2", 
"hToTvsHVReducedChi2", 101, -0.05, 10.05);
 
  429   TH1D* hToTExpected = 
new TH1D(
"hToTExpected", 
"hToTExpected", 100001, -0.0005, 100.0005);
 
  430   bool firstEvent = 
true;
 
  436   int counterLinear = 0;
 
  437   int counter2Order = 0;
 
  438   int counter2OrderPos = 0;
 
  439   int counter2OrderNeg = 0;
 
  441   double aveLinearSlope = 0;
 
  442   for (
int line = 0; line < lineNb; ++line) {
 
  443     for (
int dom = 0; dom < domNb; ++dom) {
 
  445         stringstream filename;
 
  448         filename << 
"ToTvsHV-line" << line + 1 << 
"-dom" << dom + 1 << 
"-pmt" << 
pmt;
 
  449         vgToTvsHV[line][dom][
pmt]->SetName(filename.str().c_str());
 
  450         const int pointNb = vgToTvsHV[line][dom][
pmt]->GetN();
 
  453           vgToTvsHV[line][dom][
pmt]->SetLineColor(line*18 + dom*31 + pmt);
 
  454           vgToTvsHV[line][dom][
pmt]->SetMarkerColor(line*18 + dom*31 + pmt);
 
  455           vgToTvsHV[line][dom][
pmt]->SetMarkerStyle(2);
 
  456           vgToTvsHV[line][dom][
pmt]->SetMarkerSize(1);
 
  457           if (firstEvent == 
true) {
 
  459             vgToTvsHV[line][dom][
pmt]->SetTitle(
"");
 
  460             vgToTvsHV[line][dom][
pmt]->GetXaxis()->SetTitle(
"HV_{offset}  [V]");
 
  461             vgToTvsHV[line][dom][
pmt]->GetXaxis()->CenterTitle();
 
  462             vgToTvsHV[line][dom][
pmt]->GetXaxis()->SetTitleOffset(1.2);
 
  463             vgToTvsHV[line][dom][
pmt]->GetXaxis()->SetRangeUser(-200, +200);
 
  464             vgToTvsHV[line][dom][
pmt]->GetYaxis()->SetTitle(
"ToT values  [ns]");
 
  465             vgToTvsHV[line][dom][
pmt]->GetYaxis()->CenterTitle();
 
  466             vgToTvsHV[line][dom][
pmt]->GetYaxis()->SetTitleOffset(1.2);
 
  467             vgToTvsHV[line][dom][
pmt]->GetYaxis()->SetRangeUser(0, 80);
 
  468             vgToTvsHV[line][dom][
pmt]->Draw(
"APL");
 
  470             vgToTvsHV[line][dom][
pmt]->GetXaxis()->SetRangeUser(-200, +200);
 
  471             vgToTvsHV[line][dom][
pmt]->Draw(
"samePL");
 
  475         string functionFormula = 
"";
 
  478           const string pol2Name = 
"pol2";
 
  481           const string pol1Name = 
"pol1";
 
  484           const string sqrtName = 
"[0] + sqrt([1] - [2]*x)";
 
  487           const double testChi2 = min({fabs(vParameterPol1[0] - 1), fabs(vParameterPol2[0] - 1), fabs(vParameterSqrt[0] - 1)});
 
  488           if (testChi2 == fabs(vParameterPol1[0] - 1)) {
 
  489             vParameter = vParameterPol1;
 
  490             functionFormula = pol1Name;
 
  491             aveLinearSlope += vParameterPol1[2];
 
  493           } 
else if (testChi2 == fabs(vParameterPol2[0] - 1)) {
 
  494             vParameter = vParameterPol2;
 
  495             functionFormula = pol2Name;
 
  497             if (vParameterPol2[3] > 0) ++counter2OrderPos;
 
  498             else ++counter2OrderNeg;
 
  499           } 
else if (testChi2 == fabs(vParameterSqrt[0] - 1)) {
 
  500             vParameter = vParameterSqrt;
 
  501             functionFormula = sqrtName;
 
  504             DEBUG(
"problem in the function definition, check the code at about line 500");
 
  506           vgToTvsHV[line][dom][
pmt]->Fit(functionFormula.c_str(), 
"RQ");
 
  507           hToTvsHVReducedChi2->Fill(vParameter[0]);
 
  508           if (vParameter[0] > redChi2Max) 
DEBUG(
"ToTvsHV fit may be bad for pmt " << pmt << 
" of dom " << dom + 1 << 
" of line " << line + 1 << 
", the reduced chi square is " << vParameter[0] << endl);
 
  509           hvAndToTOpt = 
Solve(vParameter, functionFormula, tot);
 
  510           if ((hvAndToTOpt.first == -1) && (hvAndToTOpt.second == -1))
 
  511             DEBUG(
"function used for fitting " << functionFormula << 
" is not handled by the code. Change the code or use a predefined function such as pol1 or pol2" << endl);
 
  512           if ((fabs(vParameter[2]) > slopeMax) && ((functionFormula == 
"pol1") || (functionFormula == 
"pol2")))
 
  513             DEBUG(
"ToTvsHV fit may be bad for pmt " << pmt << 
" of dom " << dom + 1 << 
" of line " << line + 1 << 
", the slope at 0 is " << vParameter[2] << endl);
 
  514           hToTExpected->Fill(hvAndToTOpt.second);
 
  516         if (fabs(hvAndToTOpt.first) > diffHVMax) hvAndToTOpt.first = 0;
 
  517         vvvHvOpt[line][dom][
pmt] = hvAndToTOpt.first;
 
  518         outCalibXml << 
"\t\t<ProductTest>\r\n";
 
  519         outCalibXml << 
"\t\t\t<UPI>" << vvvupi[line][dom][
pmt] << 
"</UPI>\r\n";
 
  520         outCalibXml << 
"\t\t\t<TestResult>OK</TestResult>\r\n";
 
  521         outCalibXml << 
"\t\t\t<TestParameters>\r\n";
 
  522         outCalibXml << 
"\t\t\t\t<ProductTestParameter>\r\n";
 
  523         outCalibXml << 
"\t\t\t\t\t<Name>PMT_Supply_Voltage</Name>\r\n";
 
  524         outCalibXml << 
"\t\t\t\t\t<Values>\r\n";
 
  525         outCalibXml << 
"\t\t\t\t\t\t<string>" << hvAndToTOpt.first + vvvHv[line][dom][
pmt] << 
"</string>\r\n";
 
  526         outCalibXml << 
"\t\t\t\t\t</Values>\r\n";
 
  527         outCalibXml << 
"\t\t\t\t</ProductTestParameter>\r\n";
 
  528         outCalibXml << 
"\t\t\t\t<ProductTestParameter>\r\n";
 
  529         outCalibXml << 
"\t\t\t\t\t<Name>RUN_NUMBER</Name>\r\n";
 
  530         outCalibXml << 
"\t\t\t\t\t<Values>\r\n";
 
  531         for (
int run = 0; run < runNb; ++run) {
 
  532           outCalibXml << 
"\t\t\t\t\t\t<string>" << runList[run] << 
"</string>\r\n";
 
  534         outCalibXml << 
"\t\t\t\t\t</Values>\r\n";
 
  535         outCalibXml << 
"\t\t\t\t</ProductTestParameter>\r\n";
 
  536         outCalibXml << 
"\t\t\t\t<ProductTestParameter>\r\n";
 
  537         outCalibXml << 
"\t\t\t\t\t<Name>PMT_Time_over_Threshold</Name>\r\n";
 
  538         outCalibXml << 
"\t\t\t\t\t<Values>\r\n";
 
  539         outCalibXml << 
"\t\t\t\t\t\t<string>" << tot*1e-9 << 
"</string>\r\n";
 
  540         outCalibXml << 
"\t\t\t\t\t</Values>\r\n";
 
  541         outCalibXml << 
"\t\t\t\t</ProductTestParameter>\r\n";
 
  542         outCalibXml << 
"\t\t\t</TestParameters>\r\n";
 
  543         outCalibXml << 
"\t\t</ProductTest>\r\n";
 
  547   cout << 
"linear:" << counterLinear << 
" - 2nd order (pos, neg):" << counter2Order 
 
  548        << 
"(" << counter2OrderPos << 
"," << counter2OrderNeg << 
")" 
  549        << 
" - sqrt:" << counterSqrt << 
" - linear slope average: "  
  550        << aveLinearSlope/counterLinear << endl;
 
  551   outCalibXml << 
"\t</Tests>\r\n";
 
  552   outCalibXml << 
"</ProductTestSession>\r\n";
 
  554   cToTvsHV->SaveAs(
"figs/cToTvsHV.png");
 
  555   cToTvsHV->SaveAs(
"figs/cToTvsHV.root");
 
  557   ostringstream osstxt;
 
  560   osstxt << 
"results/HVTuning-det" << detid << 
".txt";
 
  562   ofstream outHv(osstxt.str().c_str(), ofstream::out);
 
  563   for (
int line = 0; line < lineNb; ++line) {
 
  564     for (
int dom = 0; dom < domNb; ++dom) {
 
  565       for (
int pmt = 0; pmt < pmtNb; ++
pmt) {
 
  566         outHv << line + 1 << 
' ' << dom + 1 << 
' ' << pmt << 
' ' << vvvupi[line][dom][
pmt] << 
' ' << vvvHv[line][dom][
pmt] << 
' ' << vvvHvOpt[line][dom][
pmt] + vvvHv[line][dom][
pmt] << endl;
 
  572   TCanvas* cToTs[lineNb][domNb];
 
  573   for (
int line = 0; line < lineNb; ++line) {
 
  574     for (
int dom = 0; dom < domNb; ++dom) {
 
  578       iss << 
"cToTs-line" << line + 1 << 
"-dom" << dom + 1; 
 
  579       cToTs[line][dom] = 
new TCanvas(iss.str().c_str(), iss.str().c_str(), 800, 600);
 
  580       cToTs[line][dom]->Divide(8,4);
 
  581       for (
int pmt = 0; pmt < pmtNb; ++
pmt) {
 
  582         cToTs[line][dom]->cd(pmt + 1);
 
  584         for (
int run = 0; run < runNb; ++run) { 
 
  585           vhToT[run][line][dom][
pmt]->SetLineColor(run + 1);
 
  586           if (vhToT[run][line][dom][pmt]->GetMaximum() > localMax) localMax = vhToT[run][line][dom][
pmt]->GetMaximum();
 
  588             vhToT[run][line][dom][
pmt]->SetTitle(
"");
 
  589             vhToT[run][line][dom][
pmt]->SetStats(0);
 
  590             vhToT[run][line][dom][
pmt]->GetXaxis()->SetTitle(
"ToT values  [ns]");
 
  591             vhToT[run][line][dom][
pmt]->GetXaxis()->CenterTitle();
 
  592             vhToT[run][line][dom][
pmt]->GetXaxis()->SetTitleOffset(1.2);
 
  593             vhToT[run][line][dom][
pmt]->GetXaxis()->SetRange(0, 100);
 
  594             vhToT[run][line][dom][
pmt]->Draw();
 
  596             vhToT[run][line][dom][
pmt]->Draw(
"same");      
 
  600         vhToT[0][line][dom][
pmt]->GetYaxis()->SetRangeUser(0.1, 2*localMax);
 
  604       iss << 
"figs/cToTs-line" << line + 1 << 
"-dom" << dom + 1 << 
".png"; 
 
  605       cToTs[line][dom]->SaveAs(iss.str().c_str());
 
  608       iss << 
"figs/cToTs-line" << line + 1 << 
"-dom" << dom + 1 << 
".root";  
 
  609       cToTs[line][dom]->SaveAs(iss.str().c_str());
 
  613   TCanvas* cToTReducedChi2 = 
new TCanvas(
"cToTReducedChi2", 
"cToTReducedChi2", 800, 600);
 
  614   for (
int run = 0; run < runNb; ++run) {
 
  616       vhToTReducedChi2[run]->SetTitle(
"");
 
  617       vhToTReducedChi2[run]->SetStats(0);
 
  618       vhToTReducedChi2[run]->GetXaxis()->SetTitle(
"reduced #chi^{2}");
 
  619       vhToTReducedChi2[run]->GetXaxis()->CenterTitle();
 
  620       vhToTReducedChi2[run]->GetXaxis()->SetTitleOffset(1.2);
 
  621       vhToTReducedChi2[run]->Draw();
 
  623       vhToTReducedChi2[run]->Draw(
"same");
 
  625     vhToTReducedChi2[run]->SetLineColor(run + 1);
 
  627   cToTReducedChi2->SetLogy();
 
  628   cToTReducedChi2->SaveAs(
"figs/cToT-ReducedChi2.png");
 
  629   cToTReducedChi2->SaveAs(
"figs/cToT-ReducedChi2.root");
 
  631   TCanvas* cToTvsHVReducedChi2 = 
new TCanvas(
"cToTvsHVReducedChi2", 
"cToTvsHVReducedChi2", 800, 600);
 
  632   hToTvsHVReducedChi2->SetTitle(
"");
 
  633   hToTvsHVReducedChi2->SetStats(0);
 
  634   hToTvsHVReducedChi2->GetXaxis()->SetTitle(
"reduced #chi^{2}");
 
  635   hToTvsHVReducedChi2->GetXaxis()->CenterTitle();
 
  636   hToTvsHVReducedChi2->GetXaxis()->SetTitleOffset(1.2);
 
  637   hToTvsHVReducedChi2->Draw();
 
  638   cToTvsHVReducedChi2->SetLogy();
 
  639   cToTvsHVReducedChi2->SaveAs(
"figs/cToTvsHV-ReducedChi2.png");
 
  640   cToTvsHVReducedChi2->SaveAs(
"figs/cToTvsHV-ReducedChi2.root");
 
  642   TCanvas* cToTExpected = 
new TCanvas(
"cToTExpected", 
"cToTExpected", 800, 600);
 
  643   hToTExpected->SetTitle(
"");
 
  644   hToTExpected->SetStats(0);
 
  645   hToTExpected->GetXaxis()->SetTitle(
"Expected ToT value  [ns]");
 
  646   hToTExpected->GetXaxis()->CenterTitle();
 
  647   hToTExpected->GetXaxis()->SetTitleOffset(1.2);
 
  648   hToTExpected->Draw();
 
  650   cToTExpected->SaveAs(
"figs/cToTExpected.png");
 
  651   cToTExpected->SaveAs(
"figs/cToTExpected.root");
 
  653   const int lineId1 = 0;
 
  654   const int domId1 = 2;
 
  655   const int pmtId1 = 5;
 
  656   const int lineId2 = 0;
 
  657   const int domId2 = 5;
 
  658   const int pmtId2 = 7;
 
  659   ostringstream issTemp;
 
  660   issTemp << 
"cToTsdom" << domId1 + 1 << 
"pmt" << pmtId1;
 
  661   TCanvas* cToTsdomxpmtx = 
new TCanvas(issTemp.str().c_str(), issTemp.str().c_str(), 800, 600);
 
  663   TLegend* leg1 = 
new TLegend(0.70,0.55,0.90,0.90);
 
  664   leg1->SetFillStyle(0);
 
  665   double localMaxTemp = 0;
 
  666   if ((lineId1 > lineNb - 1) || (domId1 > domNb - 1) || (pmtId1 > pmtNb - 1))
 
  668   if (pmtTest == 
false) {
 
  669     DEBUG(
"wrong PMT1 identification for sample plot");
 
  671     ostringstream plotname0;
 
  672     for (
int run = 0; run < runNb; ++run) {
 
  673       vhToT[run][lineId1][domId1][pmtId1]->SetLineColor(run + 1);
 
  674       if (vhToT[run][lineId1][domId1][pmtId1]->GetMaximum() > localMaxTemp) localMaxTemp = vhToT[run][lineId1][domId1][pmtId1]->GetMaximum();
 
  676         vhToT[run][lineId1][domId1][pmtId1]->SetTitle(
"");
 
  677         vhToT[run][lineId1][domId1][pmtId1]->SetStats(0);
 
  678         vhToT[run][lineId1][domId1][pmtId1]->GetXaxis()->SetTitle(
"ToT values  [ns]");
 
  679         vhToT[run][lineId1][domId1][pmtId1]->GetXaxis()->CenterTitle();
 
  680         vhToT[run][lineId1][domId1][pmtId1]->GetXaxis()->SetTitleOffset(1.2);
 
  681         vhToT[run][lineId1][domId1][pmtId1]->GetXaxis()->SetRange(0, 100);
 
  682         vhToT[run][lineId1][domId1][pmtId1]->Draw();
 
  684         vhToT[run][lineId1][domId1][pmtId1]->Draw(
"same");
 
  688       plotname0 << 
"HV: " << setprecision(2) << fixed
 
  689                 << vvvRunHv[run][lineId1][domId1][pmtId1] << 
"V";
 
  690       leg1->AddEntry(vhToT[run][lineId1][domId1][pmtId1], plotname0.str().c_str(), 
"l");
 
  693     vhToT[0][lineId1][domId1][pmtId1]->GetYaxis()->SetRangeUser(0.1, 2*localMaxTemp);
 
  697     issTemp << 
"figs/cToTs-line" << lineId1 + 1 << 
"-dom" << domId1 + 1 << 
"-pmt" << pmtId1 << 
".png";
 
  698     cToTsdomxpmtx->SaveAs(issTemp.str().c_str());
 
  701     issTemp << 
"figs/cToTs-line" << lineId1 + 1 << 
"-dom" << domId1 + 1 << 
"-pmt" << pmtId1 << 
".root";
 
  702     cToTsdomxpmtx->SaveAs(issTemp.str().c_str());
 
  707   issTemp << 
"cToTsdom" << domId2 + 1 << 
"pmt" << pmtId2;
 
  708   TCanvas* cToTsdomxpmty = 
new TCanvas(issTemp.str().c_str(), issTemp.str().c_str(), 800, 600);
 
  710   TLegend* leg2 = 
new TLegend(0.70,0.55,0.90,0.90);
 
  711   if ((lineId2 > lineNb - 1) || (domId2 > domNb - 1) || (pmtId2 > pmtNb - 1))
 
  713   if (pmtTest == 
false) {
 
  714     DEBUG(
"wrong PMT2 identification for sample plot");
 
  716     ostringstream plotname0;
 
  717     for (
int run = 0; run < runNb; ++run) {
 
  718       vhToT[run][lineId2][domId2][pmtId2]->SetLineColor(run + 1);
 
  719       if (vhToT[run][lineId2][domId2][pmtId2]->GetMaximum() > localMaxTemp) localMaxTemp = vhToT[run][lineId2][domId2][pmtId2]->GetMaximum();
 
  721         vhToT[run][lineId2][domId2][pmtId2]->SetTitle(
"");
 
  722         vhToT[run][lineId2][domId2][pmtId2]->SetStats(0);
 
  723         vhToT[run][lineId2][domId2][pmtId2]->GetXaxis()->SetTitle(
"ToT values  [ns]");
 
  724         vhToT[run][lineId2][domId2][pmtId2]->GetXaxis()->CenterTitle();
 
  725         vhToT[run][lineId2][domId2][pmtId2]->GetXaxis()->SetTitleOffset(1.2);
 
  726         vhToT[run][lineId2][domId2][pmtId2]->GetXaxis()->SetRange(0, 100);
 
  727         vhToT[run][lineId2][domId2][pmtId2]->Draw();
 
  729         vhToT[run][lineId2][domId2][pmtId2]->Draw(
"same");
 
  733       plotname0 << 
"HV: " << setprecision(2) << fixed
 
  734                 << vvvRunHv[run][lineId2][domId2][pmtId2] << 
"V";
 
  735       leg2->AddEntry(vhToT[run][lineId2][domId2][pmtId2], plotname0.str().c_str(), 
"l");
 
  738     vhToT[0][lineId2][domId2][pmtId2]->GetYaxis()->SetRangeUser(0.1, 2*localMaxTemp);
 
  742     issTemp << 
"figs/cToTs-line" << lineId2 + 1 << 
"-dom" << domId2 + 1 << 
"-pmt" << pmtId2 << 
".png";
 
  743     cToTsdomxpmty->SaveAs(issTemp.str().c_str());
 
  746     issTemp << 
"figs/cToTs-line" << lineId2 + 1 << 
"-dom" << domId2 + 1 << 
"-pmt" << pmtId2 << 
".root";
 
  747     cToTsdomxpmty->SaveAs(issTemp.str().c_str());
 
  750   DEBUG(
"analysis duration: " << difftime(endTime, startTime) << endl);
 
Utility class to parse command line options. 
 
int getFloor() const 
Get floor number. 
 
Data structure for a composite optical module. 
 
void AccessDB(vector< vector< vector< string > > > &vvvupi, vector< vector< vector< double > > > &vvvHv, string &cookie, string &usr, string &pwd, string &query, const int detid, const string runId, const set< int > &lineIds, string &location)
 
Auxiliary class to select ROOT class based on class name. 
 
Router for direct addressing of module data in detector data structure. 
 
std::set< int > getStringIDs(const JDetector &detector)
Get list of strings IDs. 
 
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
 
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
 
void FillParameterFitFunction(vector< double > &vParameter, TGraphErrors *&localGraph, const string &curFunction, const string &curOptions, const pair< double, double > range)
 
Long64_t counter_type
Type definition for counter. 
 
Auxiliary class for multiplexing object iterators. 
 
int getRunNumber() const 
Get run number. 
 
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
int getID() const 
Get identifier. 
 
int getNumberOfFloors(const JDetector &detector)
Get number of floors. 
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line. 
 
void load(const JString &file_name, JDetector &detector)
Load detector from input file. 
 
const JPMT & getPMT(const int index) const 
Get PMT. 
 
static const JStringCounter getNumberOfStrings
Function object to count unique strings. 
 
int getString() const 
Get string number. 
 
void FindHVRange(vector< vector< vector< pair< double, double > > > > &vvvHvRange, vector< vector< vector< vector< double > > > > &vvvRunHv, vector< vector< vector< double > > > &vvvHv)
 
void FillGraph(TGraphErrors *&graph, TH1D *&hChi2, TH1D *&histo, const double hv, int &localCounter)
 
General purpose class for object reading from a list of file names. 
 
virtual const char * what() const 
Get error message. 
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters. 
 
#define DEBUG(A)
Message macros. 
 
pair< double, double > Solve(vector< double > &vParameter, const string &curFunction, const double tot)