Functions
coredistribution.cc File Reference
#include <iostream>
#include <fstream>
#include <string>
#include <TCanvas.h>
#include <TH2F.h>
#include <TMath.h>
#include <TFile.h>
#include <TGraph.h>
#include <TGraph2D.h>
#include <TROOT.h>
#include <TStyle.h>
#include <TColor.h>
#include <TTimeStamp.h>
#include <TVector3.h>
#include <TProfile.h>
#include <TLine.h>
#include "RecEventFile.h"
#include "RecEvent.h"
#include "RdEvent.h"
#include "DetectorGeometry.h"
#include "SDEvent.h"
#include "SdRecStation.h"
#include "ShowerRRecDataQuantities.h"
#include "StationRRecDataQuantities.h"
#include "RdTrace.h"

Go to the source code of this file.

Functions

int main ()
 
bool SetRealAspectRatio (TCanvas *const c, const Int_t axis=1)
 Function to resize a canvas so that a 2D histogram or TGraph / TGraph2D are shown in real aspect ratio. More...
 

Function Documentation

int main ( void  )

Definition at line 152 of file coredistribution.cc.

References io::eSuccess, file, filename, and SetRealAspectRatio().

bool SetRealAspectRatio ( TCanvas *const  c,
const Int_t  axis = 1 
)

Function to resize a canvas so that a 2D histogram or TGraph / TGraph2D are shown in real aspect ratio.

Parameters
cpointer to a TCanvas
axis1 for resizing horizontally (x-axis) in order to get real aspect ratio, 2 for the resizing vertically (y-axis)
Returns
false if error is encountered, true otherwise
Note
For defining the concept real aspect ratio, it is assumed that x and y axes are in same units, e.g. both in MeV or both in ns
You can resize either the the width of the canvas or the height, but not both at the same time
Resize the canvas before calling this function, if you want a larger height or width of reference if you call with parameter axis= 1 or 2, respectively
Call this function AFTER drawing AND zooming (SetUserRange) your TGraph or Histogram, otherwise it cannot infer your actual axes lengths
This function ensures that the TFrame has a real aspect ratio, this does not mean that the full pad (i.e. the canvas or png output) including margins has exactly the same ratio
This function does not work if canvas is divided in several subpads
See Also
https://root-forum.cern.ch/t/resize-canvas-to-get-real-aspect-ratio-of-th2-or-tgraph/20718/1

Definition at line 45 of file coredistribution.cc.

References utl::abs().

Referenced by main().


, generated on Tue Sep 26 2023.