File indexing completed on 2025-08-06 08:13:55
0001 #pragma once
0002
0003 template < typename TH >
0004 TPaletteAxis* DrawPaletteAxis( TH* hist,
0005 double xmin, double ymin,
0006 double xmax, double ymax,
0007 double label_size)
0008
0009 {
0010
0011 gPad->Update();
0012 TPaletteAxis *pal = (TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette");
0013 if( pal == nullptr )
0014 {
0015 string color_red = "\033[31m";
0016 string color_cancel = "\033[m";
0017
0018 cerr << color_red << endl;
0019 cerr << " " << string( 50, '=' ) << endl;
0020 cerr << "template <typename TH> TPaletteAxis* DrawPaletteAxis( TH* hist , double xmin, double ymin, double xmax, double ymax , double label_size)" << endl;
0021 cerr << "TPaletteAxis *pal = (TPaletteAxis*)hist->GetListOfFunctions()->FindObject(\"palette\") ---> nullptr" << endl;
0022 cerr << " Someting wrong!!!" << endl;
0023 cerr << " " << string( 50, '=' ) << endl;
0024 cerr << color_cancel << endl;
0025
0026 return new TPaletteAxis();
0027 }
0028
0029 pal->GetAxis()->SetLabelSize( label_size );
0030 pal->GetAxis()->CenterTitle();
0031
0032 pal->SetX1NDC( xmin );
0033 pal->SetX2NDC( xmax );
0034
0035 pal->SetY1NDC( ymin );
0036 pal->SetY2NDC( ymax );
0037 pal->Draw();
0038
0039 return pal;
0040 }