[d7d2da3] | 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 "TROOT.h"
|
---|
| 13 | #include "TH1.h"
|
---|
| 14 | #include "TChain.h"
|
---|
| 15 |
|
---|
| 16 | #include <iostream>
|
---|
| 17 | #include <fstream>
|
---|
| 18 |
|
---|
| 19 | using namespace std;
|
---|
| 20 |
|
---|
| 21 | static const Font_t kExRootFont = 42;
|
---|
| 22 | static const Float_t kExRootFontSize = 0.04;
|
---|
| 23 |
|
---|
| 24 | void 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 |
|
---|
| 54 | Bool_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 | //------------------------------------------------------------------------------
|
---|
| 76 |
|
---|