Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:14:00

0001 #pragma once
0002 
0003 template < class T >
0004 void HistSetting1D( T* hist )
0005 {
0006 
0007   double content = 0;
0008   for( int i=1; i<hist->GetNbinsX()+1; i++ )
0009     if( content < hist->GetBinContent( i ) )
0010       content =  hist->GetBinContent( i ) ;
0011 
0012   double label_size = 0.05;
0013   double title_size = 0.05;
0014   int digits = TMath::Log10( content ) ;
0015   if( digits > 2 )
0016     {
0017       label_size = 0.04;
0018       title_size = 0.04;
0019     }
0020   HistSetting( hist, label_size, title_size );  
0021 }
0022 
0023 template < class T >
0024 void HistSetting( T* hist, double label_size=0.05, double title_size=0.05 )
0025 {
0026   
0027   hist->GetXaxis()->SetLabelSize( label_size );
0028   hist->GetXaxis()->SetTitleSize( title_size );
0029   hist->GetXaxis()->CenterTitle();
0030   
0031   hist->GetYaxis()->SetLabelSize( label_size );
0032   hist->GetYaxis()->SetTitleSize( title_size );
0033   //hist->GetYaxis()->SetTitleOffset( 1. );
0034   hist->GetYaxis()->CenterTitle();
0035   
0036   hist->GetZaxis()->SetLabelSize( label_size );
0037   hist->GetZaxis()->SetTitleSize( title_size );
0038   hist->GetZaxis()->CenterTitle();  
0039 }