265 const string myname =
"AdcChannelPlotter::viewMap: ";
273 Index ndplt = ndx*ndy;
274 using ManMap = std::map<string, TPadManipulator>;
275 using NameMap = std::map<string, string>;
276 using IndexMap = std::map<string, Index>;
281 std::vector<TLatex*> labs;
282 bool useViewPort =
true;
283 for (
const AdcChannelDataMap::value_type& iacd : acds ) {
284 Index icha = iacd.first;
286 TLatex* ptxt =
new TLatex(0.98, 0.025, schan.c_str());
288 ptxt->SetTextFont(42);
289 ptxt->SetTextAlign(31);
290 labs.push_back(ptxt);
295 bool isRaw =
type ==
"raw";
296 bool isRawDist =
type ==
"rawdist" ||
type ==
"rawdistlog";
297 bool isLogY =
type ==
"rawdistlog";
298 float marginTop = 0.0;
299 float marginBottom = isRawDist ? 0.12 : 0.09;
300 float marginLeft = isRawDist ? 0.12 : 0.05;
301 float marginRight = isRawDist ? 0.02 : 0.01;
302 float xlab = isRawDist ? 0.95 : 0.98;
303 float ylab = 0.05 + marginBottom;
304 float hlab = isRawDist ? 0.08 : 0.16;
307 ptxt->SetTextSize(hlab);
308 if ( mans.find(
type) == mans.end() ) {
309 if (
m_LogLevel >= 3 ) cout <<
"Creating new top-level plot of type " <<
type <<
"." <<
endl;
314 float yview1 = isRawDist ? 0.0 : 0.00;
316 float yview2 = isRawDist ? 0.96 : 0.96;
317 if ( topman.
addPad(xview1, yview1, xview2, yview2) ) {
318 cout << myname <<
"ERROR: Unable to add subpad." <<
endl;
323 if ( isRaw ||
type ==
"prepared" ) {
325 for (
Index ipad=0; ipad<nplt; ++ipad ) {
331 }
else if ( isRawDist ) {
333 for (
Index ipad=0; ipad<ndplt; ++ipad ) {
341 nplts[
type] = ndx*ndy;
350 for (
Index ipsm=0; ipsm<man.
npad(); ++ipsm ) {
361 if (
m_LogLevel >= 3 ) cout << myname <<
" Adding subplot " << iplt <<
" for type " <<
type <<
"." <<
endl;
363 string sttl = ph->GetTitle();
364 Index ipos = sttl.find(
" channel");
365 sttl = sttl.substr(0, ipos);
368 man.
add(ph,
"hist",
false);
370 if (
type ==
"raw" ||
type ==
"prepared" ) {
374 if (
type ==
"raw" ) {
378 cout << myname <<
"Invalid raw PlotSigOpt = " <<
m_PlotSigOpt <<
". Using fixed." <<
endl;
383 int gSigMax = res.
getFloat(
"plotSigMax_" +
type) + 0.999;
384 if ( gSigMax - gSigMin < dSigMin ) {
385 while ( gSigMax - gSigMin < dSigMin ) {
386 if ( gSigMin > 0 ) --gSigMin;
387 if ( gSigMax - gSigMin < dSigMin ) ++gSigMax;
393 cout << myname <<
"Invalid " <<
type <<
" PlotSigOpt = " <<
m_PlotSigOpt <<
". Using fixed." <<
endl;
402 if (
type ==
"prepared" ) {
406 }
else if ( isRawDist ) {
416 cout << myname <<
"Invalid rawdist PlotSigOpt = " <<
m_PlotSigOpt <<
". Using full." <<
endl;
425 if ( ++iplt >= nplt ) {
427 for (
string type : m_HistTypes ) mans[
type].print(pfnames[
type]);
435 for ( ManMap::value_type& iman : mans ) iman.second.print(pfnames[iman.first]);
436 for ( TLatex* ptxt : labs )
delete ptxt;
int setLabelSizeX(double siz)
DataMap view(const AdcChannelData &acd) const override
int add(unsigned int ipad, TObject *pobj, std::string sopt="", bool replace=false)
Name nameReplace(Name name, const AdcChannelData &acd, Name type) const
void setMarginLeft(double xmar)
int addPad(double x1, double y1, double x2, double y2, int icol=-1)
int setLabelSizeY(double siz)
int setCanvasSize(int wx, int wy)
int split(Index nx, Index ny)
int showOverflow(bool show=true)
int setTitle(std::string sttl, float height=-1.0)
int addHorizontalLine(double yoff=0.0, double lenfrac=1.0, int isty=1)
int setLogY(bool flag=true)
int showUnderflow(bool show=true)
int addAxis(bool flag=true)
unsigned int npad() const
TPadManipulator * man(unsigned int ipad=0)
int addVerticalModLines(double xmod, double xoff=0.0, double lenfrac=1.0, int isty=3)
Float getFloat(Name name, Float def=0.0) const
void setMarginTop(double xmar)
int setLogRangeY(double y1, double y2)
int setRangeX(double x1, double x2)
void setMarginBottom(double xmar)
TH1 * getHist(Name name, TH1 *def=nullptr) const
int addHorizontalModLines(double ymod, double yoff=0.0, double lenfrac=1.0, int isty=3)
int setRangeY(double y1, double y2)
std::string to_string(ModuleType const mt)
void setMarginRight(double xmar)
QTextStream & endl(QTextStream &s)