851 const string myname =
"AdcChannelMetric::processMetricsForOneRange: ";
853 NameVector statNames = {
"All",
"Good",
"Bad",
"Noisy"};
856 Name hname = ph->GetName();
857 Name htitl = ph->GetTitle();
860 if (
m_LogLevel >= 2 ) cout << myname <<
"Plotting # channels vs. metric. Count is " << mets.size() <<
endl;
861 for ( MetricMap::value_type imet : mets ) {
862 double met = imet.second.value;
865 if ( ofpname.size() ) {
876 Name slaby = ph->GetYaxis()->GetTitle();
879 if (
m_LogLevel >= 2 ) cout << myname <<
"Plotting metric vs. channel. Count is " << mets.size() <<
endl;
880 for (
Index igra=0; igra<ngraph; ++igra ) {
881 string gname = hname;
882 string gtitl = htitl;
884 smanName.replace(
"%STATUS%", statNames[igra]);
886 smanTitl.replace(
"%STATUS%", statNames[igra]);
888 egraphs[igra] =
new TGraphErrors;
889 graphs[igra] = egraphs[igra];
891 graphs[igra] =
new TGraph;
893 TGraph* pg = graphs[igra];
894 pg->SetName(gname.c_str());
895 pg->SetTitle(gtitl.c_str());
896 if ( ! useErrors ) pg->SetMarkerStyle(2);
897 pg->SetMarkerColor(statCols[igra]);
898 pg->SetLineColor(statCols[igra]);
899 pg->GetXaxis()->SetTitle(
"Channel");
900 pg->GetYaxis()->SetTitle(slaby.c_str());
902 TGraph* pgAll = graphs[0];
903 TGraphErrors* pgeAll = egraphs[0];
907 for ( MetricMap::value_type imet : mets ) {
908 Index icha = imet.first;
909 double met = imet.second.value;
910 double err = imet.second.error;
912 cout << myname <<
" " << met <<
": " << met <<
" +/- " << err <<
endl;
915 ph->SetBinContent(bin, met);
916 if ( err ) ph->SetBinError(bin, err);
918 Index iptAll = pgAll->GetN();
919 float xcha = icha + 0.5;
920 pgAll->SetPoint(iptAll, xcha, gval);
921 if ( pgeAll !=
nullptr ) pgeAll->SetPointError(iptAll, ex, err);
925 TGraph* pgStat = graphs[
stat];
926 TGraphErrors* pgeStat = egraphs[
stat];
927 Index iptStat = pgStat->GetN();
928 pgStat->SetPoint(iptStat, xcha, gval);
929 if ( pgeStat !=
nullptr ) pgeStat->SetPointError(iptStat, ex, err);
934 if (
m_LogLevel >= 3 ) cout << myname <<
"Filled " << nfill <<
" channels." <<
endl;
935 if ( ofpname.size() && nfill > 0 ) {
942 for (
int igra : {1, 3, 2} ) {
943 TGraph* pgra = graphs[igra];
944 if ( pgra->GetN() ) man.
add(pgra,
"P");
956 for (
Index icha : m_ChannelLinePattern ) {
957 if ( icha > icha0 && icha < ran.
last() ) {
961 for (
Index icha : m_ChannelLinePatternSolid ) {
962 if ( icha > icha0 && icha < ran.
last() ) {
970 if ( mmax > mmin ) man.
setRangeY(mmin, mmax);
976 cout << myname <<
"Created plot ";
977 cout <<
"for " << nfill <<
" channels in range " << ran.
name <<
endl;
978 cout << myname <<
" Output file: " << ofpname <<
endl;
981 if ( ofrname.size() ) {
982 TFile* pfile = TFile::Open(ofrname.c_str(),
"UPDATE");
984 if (
m_LogLevel > 1 ) cout << myname <<
"Wrote " << ph->GetName() <<
" to " << ofrname <<
endl;
int setGridY(bool flag=true)
int add(unsigned int ipad, TObject *pobj, std::string sopt="", bool replace=false)
Index m_ChannelLineModulus
ChannelGroupService::Name Name
int setCanvasSize(int wx, int wy)
int showOverflow(bool show=true)
int showUnderflow(bool show=true)
Index channelStatus(Index icha) const
int addAxis(bool flag=true)
IndexVector m_ChannelLinePattern
void err(const char *fmt,...)
int addVerticalModLines(double xmod, double xoff=0.0, double lenfrac=1.0, int isty=3)
int setRangeX(double x1, double x2)
int addVerticalLine(double xoff=0.0, double lenfrac=1.0, int isty=1)
QTextStream & bin(QTextStream &s)
int setRangeY(double y1, double y2)
int print(std::string fname, std::string spat="{,}")
IndexVector m_ChannelLinePatternSolid
QTextStream & endl(QTextStream &s)