<commit_before>// Author: <NAME> <<EMAIL>>

Int_t nBins (Int_t min, Int_t max, Int_t binning) {
  return TMath::CeilNint((max - min) / binning);
}

Int_t nBins (Int_t min, Int_t max, Double_t binning) {
  return TMath::CeilNint((max - min) / binning);
}

Int_t nBins (Double_t min, Double_t max, Double_t binning) {
  return TMath::CeilNint((max - min) / binning);
}

inline Int_t SetHistOptions (TH1F &h, const char *xAxisTitle, const char *yAxisTitle,
                             Float_t TitleOffset, Float_t Minimum = 0.) {
  h.SetFillColor(kWhite);
  h.GetXaxis()->SetTitle(xAxisTitle);
  h.GetYaxis()->SetTitle(yAxisTitle);
  h.GetYaxis()->SetTitleOffset(TitleOffset);
  h.SetMinimum(Minimum);

  return 0;
} // SetHistOptions

inline Int_t SetHistOptions (TH2F &h, const char *xAxisTitle, const char *yAxisTitle,
                             Float_t TitleOffset, Float_t Minimum = 0.) {
  h.SetFillColor(kWhite);
  h.GetXaxis()->SetTitle(xAxisTitle);
  h.GetYaxis()->SetTitle(yAxisTitle);
  h.GetYaxis()->SetTitleOffset(TitleOffset);
  h.SetMinimum(Minimum);

  return 0;
} // SetHistOptions

Int_t NormalizeToUnity (TH1F &h) {
  Double_t norm = 1 / h.Integral();

  h.Scale(norm);

  return 0;
} // NormalizeToUnity

Int_t NormalizeToUnity (TH2F &h) {
  Double_t norm = 1 / h.Integral();

  h.Scale(norm);

  return 0;
} // NormalizeToUnity

inline Int_t DrawAsPDF (TH1F *h, const char *outputName) {
  TCanvas *c { new TCanvas() };
  TString  fout = outputName;

  fout += ".pdf";
  h->Draw();
  c->SaveAs(fout);

  return 0;
} // DrawAsPDF

inline Int_t DrawAsPDF (TH1F *h) {
  TCanvas *c { new TCanvas() };
  TString  fout = h->GetName();

  fout += ".pdf";
  h->Draw();
  c->SaveAs(fout);

  return 0;
} // DrawAsPDF

inline Int_t DrawCOLZ (TH2F *h, const char *outputName) {
  TCanvas *c { new TCanvas() };
  TString  fout = outputName;

  fout += ".pdf";
  h->Draw("COLZ");
  h->SetStats(kFALSE);
  c->SetRightMargin(0.13);
  c->SaveAs(fout);

  return 0;
} // DrawCOLZ

inline Int_t DrawCOLZ (TH2F *h) {
  TCanvas *c { new TCanvas() };
  TString  fout = h->GetName();

  fout += ".pdf";
  h->Draw("COLZ");
  h->SetStats(kFALSE);
  c->SetRightMargin(0.13);
  c->SaveAs(fout);

  return 0;
} // DrawCOLZ

void readTree (const char *inputFile = "MyAna.root",
               const char *outputFile = "histograms.root",
               Bool_t      DrawPlots = kFALSE) {
  // Load the TTree creaed from the xAOD
  gROOT->Reset();

  TFile *file { new TFile(inputFile) };
  TTree *MyTree { (TTree*)file->Get("MyTree") };

  // ### Long method

  // access the branches of the TTree
  static double Example1;
<commit_msg>Reduce code in overloaded functions for best practice<commit_after>// Author: <NAME> <<EMAIL>>

Int_t nBins (Int_t min, Int_t max, Int_t binning) {
  return TMath::CeilNint((max - min) / binning);
}

Int_t nBins (Int_t min, Int_t max, Double_t binning) {
  return TMath::CeilNint((max - min) / binning);
}

Int_t nBins (Double_t min, Double_t max, Double_t binning) {
  return TMath::CeilNint((max - min) / binning);
}

inline Int_t SetHistOptions (TH1F &h, const char *xAxisTitle, const char *yAxisTitle,
                             Float_t TitleOffset, Float_t Minimum = 0.) {
  h.SetFillColor(kWhite);
  h.GetXaxis()->SetTitle(xAxisTitle);
  h.GetYaxis()->SetTitle(yAxisTitle);
  h.GetYaxis()->SetTitleOffset(TitleOffset);
  h.SetMinimum(Minimum);

  return 0;
} // SetHistOptions

inline Int_t SetHistOptions (TH2F &h, const char *xAxisTitle, const char *yAxisTitle,
                             Float_t TitleOffset, Float_t Minimum = 0.) {
  h.SetFillColor(kWhite);
  h.GetXaxis()->SetTitle(xAxisTitle);
  h.GetYaxis()->SetTitle(yAxisTitle);
  h.GetYaxis()->SetTitleOffset(TitleOffset);
  h.SetMinimum(Minimum);

  return 0;
} // SetHistOptions

Int_t NormalizeToUnity (TH1F &h) {
  Double_t norm = 1 / h.Integral();

  h.Scale(norm);

  return 0;
} // NormalizeToUnity

Int_t NormalizeToUnity (TH2F &h) {
  Double_t norm = 1 / h.Integral();

  h.Scale(norm);

  return 0;
} // NormalizeToUnity

inline Int_t DrawAsPDF (TH1F *h, const char *outputName) {
  TCanvas *c { new TCanvas() };
  TString  fout = outputName;

  fout += ".pdf";
  h->Draw();
  c->SaveAs(fout);

  return 0;
} // DrawAsPDF

inline Int_t DrawAsPDF (TH1F *h) {
  DrawAsPDF(h, h->GetName());

  return 0;
} // DrawAsPDF

inline Int_t DrawCOLZ (TH2F *h, const char *outputName) {
  TCanvas *c { new TCanvas() };
  TString  fout = outputName;

  fout += ".pdf";
  h->Draw("COLZ");
  h->SetStats(kFALSE);
  c->SetRightMargin(0.13);
  c->SaveAs(fout);

  return 0;
} // DrawCOLZ

inline Int_t DrawCOLZ (TH2F *h) {
  DrawCOLZ(h, h->GetName());

  return 0;
} // DrawCOLZ

void readTree (const char *inputFile = "MyAna.root",
               const char *outputFile = "histograms.root",
               Bool_t      DrawPlots = kFALSE) {
  // Load the TTree creaed from the xAOD
  gROOT->Reset();

  TFile *file { new TFile(inputFile) };
  TTree *MyTree { (TTree*)file->Get("MyTree") };

  // ### Long method

  // access the branches of the TTree
  static double Example1;

{'fraction_non_alphanumeric': 0.149398065916716, 'fraction_numerical': 0.010065127294256957, 'mean_word_length': 3.248113998323554, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2700772', 'n_tokens_mistral': 2004, 'n_tokens_neox': 1919, 'n_words': 461}