Fork me on GitHub

source: svn/trunk/external/ExRootAnalysis/ExRootUtilities.cc@ 1147

Last change on this file since 1147 was 1049, checked in by Pavel Demin, 11 years ago

declare constants as static

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