530 const string myname =
"AdcChannelDftPlotter::fillPad: ";
531 const bool dbg =
false;
532 TGraph* pg = dm.
getGraph(
"dftGraph");
533 TH1* ph = dm.
getHist(
"dftHist");
534 float yValMax = dm.
getFloat(
"dftYValMax");
549 else if ( m_YMax < 0 && -m_YMax > yValMax ) ymax = -
m_YMax;
550 else ymax = yValMax*1.02;
560 bool manyCR = ncr > 1;
563 icr = dm.
getInt(
"dftCRIndex");
564 lastCR = icr + 1 == ncr;
566 if ( pg !=
nullptr ) {
567 xmax = pg->GetXaxis()->GetXmax();
572 pg->SetMarkerColor(icol);
575 }
else if ( ph !=
nullptr ) {
577 if ( icr > 0 ) dopt +=
" same";
579 ph->SetLineColor(icol);
580 if ( dbg ) cout << myname <<
"DEBUG: Color[" << icr <<
"] = " << icol <<
", dopt = " << dopt <<
endl;
584 cout << myname <<
"ERROR: Neither hist or graph is defined." <<
endl;
587 if ( dbg ) cout << myname <<
"DEBUG: CR " << icr <<
"/" << ncr <<
endl;
590 if ( dm.
haveInt(
"dftEventCount") ) {
592 ssout <<
"N_{ev} = " << dm.
getInt(
"dftEventCount");
598 ostringstream ssoutch;
599 ostringstream ssoutve;
600 ssoutch.precision(1);
601 ssoutve.precision(1);
602 if ( dm.
haveFloat(
"dftChanPerEventCount") ) {
603 ssoutch <<
"N_{ch} = " << fixed << dm.
getFloat(
"dftChanPerEventCount");
604 ssoutve <<
"N_{ve} = " << fixed << dm.
getFloat(
"dftViewEntryPerEventCount");
608 Index nven = allchans.size();
611 if ( find(allchans.begin(), iven, *iven) == iven ) ++ncha;
613 ssoutch <<
"N_{ch} = " << ncha;
614 ssoutve <<
"N_{ve} = " << nven;
618 if ( nven != ncha ) {
619 cout <<
"ERROR: View entry count differs from channel count: " 620 << nven <<
" != " << ncha <<
"." <<
endl;
627 sncha = ssoutch.str();
628 snven = ssoutve.str();
633 double sum = ph->Integral(0, ph->GetNbinsX()+1);
635 ssout <<
"#sqrt{#Sigma} = " << fixed <<
setw(2) << sqrt(sum);
640 if ( dbg ) cout << myname <<
"DEBUG: Closing plot." <<
endl;
642 if ( xmax > xmin ) man.
setRangeX(xmin, xmax);
643 if ( ymax > ymin ) man.
setRangeY(ymin, ymax);
647 double textSize = 0.04;
652 double dylab = 1.2*textSize;
654 TLatex* ptxt =
new TLatex(xlab, ylab, spow.c_str());
656 ptxt->SetTextFont(textFont);
657 ptxt->SetTextSize(textSize);
661 if ( sncha.size() ) {
662 TLatex* ptxt =
new TLatex(xlab, ylab, sncha.c_str());
664 ptxt->SetTextFont(textFont);
665 ptxt->SetTextSize(textSize);
669 if ( snven.size() ) {
670 TLatex* ptxt =
new TLatex(xlab, ylab, snven.c_str());
672 ptxt->SetTextFont(textFont);
673 ptxt->SetTextSize(textSize);
677 if ( snevt.size() ) {
678 TLatex* ptxt =
new TLatex(xlab, ylab, snevt.c_str());
680 ptxt->SetTextFont(textFont);
681 ptxt->SetTextSize(textSize);
688 if ( snevt.size() ) {
689 TLatex* ptxt =
new TLatex(xlab, ylab, snevt.c_str());
691 ptxt->SetTextFont(textFont);
692 ptxt->SetTextSize(textSize);
699 TObject* pobj = man.
object();
700 Name lopt = pg ==
nullptr ?
"l" :
"p";
705 double ylmin = ylmax - 0.05*(ncr+0.5);
706 if ( ylmin < 0.40 ) ylmin = 0.40;
707 man.
addLegend(xlmin, ylmin, xlmax, ylmax);
713 if ( pleg !=
nullptr ) {
714 pleg->SetMargin(0.1);
715 if ( spow.size() ) slab +=
" " + spow;
716 if ( sncha.size() ) slab +=
" " + sncha;
717 pleg->AddEntry(pobj, slab.c_str(), lopt.c_str());
int setGridY(bool flag=true)
int add(unsigned int ipad, TObject *pobj, std::string sopt="", bool replace=false)
TLegend * addLegend(double x1, double y1, double x2, double y2)
ChannelGroupService::Name Name
bool haveInt(Name name) const
const IntVector & getIntVector(Name name) const
TGraph * getGraph(Name name) const
static ColorType color(Index icolin, Index ncol=size())
std::vector< int > IntVector
String getString(Name name, String def="") const
TLegend * getLegend() const
int setLogY(bool flag=true)
int showUnderflow(bool show=true)
int addAxis(bool flag=true)
Q_EXPORT QTSManip setw(int w)
Float getFloat(Name name, Float def=0.0) const
std::vector< int > IntVector
int getInt(Name name, int def=0) const
bool haveFloat(Name name) const
int setRangeX(double x1, double x2)
TH1 * getHist(Name name, TH1 *def=nullptr) const
int setRangeY(double y1, double y2)
QTextStream & endl(QTextStream &s)