forked from CMSAachen3B/PlottingTool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configInfo.h
63 lines (54 loc) · 1.75 KB
/
configInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef configInfo_h
#define configInfo_h
#include "userConfig.h"
/////////////////////////////////////////////////
//
// configInfo: struct to hold user specific information
// to be used in plotting macro
//
/////////////////////////////////////////////////
struct configInfo{
TString fileName;
TFile* file;
bool isFileLumiScaled;
TString prefix;
double lumi;
// constructors
// default constructor
configInfo() {};
// main constructor
configInfo(TString inputFile, bool IsFileLumiScaled, TString Prefix, double Lumi){
fileName = inputFile;
file = new TFile(fileName, "READ");
isFileLumiScaled = IsFileLumiScaled;
prefix = Prefix;
lumi = Lumi;
}
};
// check validity of configuration
bool testConfigInfo(configInfo config, bool verbose){
bool isZombie = config.file->IsZombie();
bool isOpen = config.file->IsOpen();
if(verbose){
std::cout << "### Info on used configInfo object:" << std::endl;
std::cout << " Input file name: " << config.fileName << std::endl;
if(!isZombie && isOpen) std::cout << " Input file is open and valid." << std::endl;
std::cout << " Histograms will be accessed by using prefix " << config.prefix << std::endl;
std::cout << " Input will be scaled by lumi: " << !config.isFileLumiScaled << std::endl;
if(!config.isFileLumiScaled) std::cout << " For scaling will use lumi = " << config.lumi << std::endl;
}
if(!isOpen) {
std::cout << "ERROR: Input file has not been opened!" << std::endl;
return false;
}
else if(isZombie) {
std::cout << "ERROR: Input file is in zombie state." << std::endl;
return false;
}
if(!config.isFileLumiScaled && config.lumi < 0.1){
std::cout << "ERROR: Input histos need to be scaled, but lumi is missing." << std::endl;
return false;
}
return true;
}
#endif