Fork me on GitHub

source: git/external/ExRootAnalysis/ExRootUtilities.cc

Last change on this file was 341014c, checked in by Pavel Demin <pavel-demin@…>, 6 years ago

apply .clang-format to all .h, .cc and .cpp files

  • Property mode set to 100644
File size: 1.8 KB
Line 
1
2/** \class ExRootUtilities
3 *
4 * Functions simplifying ROOT tree analysis
5 *
6 * \author P. Demin - UCL, Louvain-la-Neuve
7 *
8 */
9
10#include "ExRootAnalysis/ExRootUtilities.h"
11
12#include "TChain.h"
13#include "TH1.h"
14#include "TROOT.h"
15
16#include <fstream>
17#include <iostream>
18
19using namespace std;
20
21static const Font_t kExRootFont = 42;
22static const Float_t kExRootFontSize = 0.04;
23
24void HistStyle(TH1 *hist, Bool_t stats)
25{
26 hist->SetLineWidth(2);
27 hist->SetLineColor(kBlack);
28 hist->SetMarkerStyle(kFullSquare);
29 hist->SetMarkerColor(kBlack);
30
31 hist->GetXaxis()->SetTitleOffset(1.5);
32 hist->GetYaxis()->SetTitleOffset(1.75);
33 hist->GetZaxis()->SetTitleOffset(1.5);
34
35 hist->GetXaxis()->SetTitleFont(kExRootFont);
36 hist->GetYaxis()->SetTitleFont(kExRootFont);
37 hist->GetZaxis()->SetTitleFont(kExRootFont);
38 hist->GetXaxis()->SetTitleSize(kExRootFontSize);
39 hist->GetYaxis()->SetTitleSize(kExRootFontSize);
40 hist->GetZaxis()->SetTitleSize(kExRootFontSize);
41
42 hist->GetXaxis()->SetLabelFont(kExRootFont);
43 hist->GetYaxis()->SetLabelFont(kExRootFont);
44 hist->GetZaxis()->SetLabelFont(kExRootFont);
45 hist->GetXaxis()->SetLabelSize(kExRootFontSize);
46 hist->GetYaxis()->SetLabelSize(kExRootFontSize);
47 hist->GetZaxis()->SetLabelSize(kExRootFontSize);
48
49 hist->SetStats(stats);
50}
51
52//------------------------------------------------------------------------------
53
54Bool_t FillChain(TChain *chain, const char *inputFileList)
55{
56 ifstream infile(inputFileList);
57 string buffer;
58
59 if(!infile.is_open())
60 {
61 cerr << "** ERROR: Can't open '" << inputFileList << "' for input" << endl;
62 return kFALSE;
63 }
64
65 while(1)
66 {
67 infile >> buffer;
68 if(!infile.good()) break;
69 chain->Add(buffer.c_str());
70 }
71
72 return kTRUE;
73}
74
75//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.