HackAnalysis  2
HEPData.h
1 /*
2 
3  Routines for reading HEPData csv and YODA files into efficiency functions
4 
5  */
6 
7 
8 
9 #pragma once
10 
11 #include <cmath>
12 #include <ctype.h>
13 #include <iostream>
14 #include <iomanip>
15 #include <sstream>
16 #include <fstream>
17 #include <string>
18 #include <algorithm> // for find
19 #include <cfloat> // for DBL_MAX
20 #include "ExHEPUtils/BinnedFn.h"
21 #include "useYoda.h"
22 
23 
24 #ifndef HEPDATAINCLUDEDIR
25 #define HEPDATAINCLUDEDIR ""
26 #endif
27 
28 
29 using namespace std;
30 
31 
32 void readHEPDatacsv(std::string filename, vector<vector<double>> & datas);
33 
34 
35 
37 {
38 private:
40 
41 public:
42 
43 
44 
45  Efficiency1D() {};
46  ~Efficiency1D();
47 
48  Efficiency1D(std::string filename, bool return_uncert=false);
49 
50  void readcsv(std::string filename, bool return_uncert=false);
51 
52  double get_at(double x);
53 
54 
55 };
56 
57 
58 
60 {
61 private:
63 
64 public:
65 
66  Efficiency2D() {};
67  ~Efficiency2D();
68 
69  Efficiency2D(std::string filename, bool return_uncert=false);
70 
71  void readcsv(std::string filename, bool return_uncert=false);
72 
73  double get_at(double x, double y);
74 
75 
76 };
77 
78 
79 
81 {
82  private:
83  //map<std::string, YODA:Histo1D*> _1dhistos;
84  //vector<HEP::BinnedFn1D<double>*> _1dhistos;
85  //vector<HEP::BinnedFn1D<double>*> _1dhistos_err;
86  map<std::string, HEP::BinnedFn1D<double>*> _1dhistos;
87  map<std::string, HEP::BinnedFn1D<double>*> _1dhistos_err;
88 
89  map<std::string, HEP::BinnedFn2D<double>*> _2dhistos;
90  map<std::string, HEP::BinnedFn2D<double>*> _2dhistos_err;
91 
92 
93  public:
94  YodaEfficiencies() {};
96 
97  void read(std::string filename);
98 
99  double get_at(std::string histoname, double x);
100  double get_at_err(std::string histoname, double x);
101  double get_at(std::string histoname, double x, double y);
102  double get_at_err(std::string histoname, double x, double y);
103 
104  HEP::BinnedFn1D<double>* Efficiency1D(std::string histoname);
105  HEP::BinnedFn1D<double>* Efficiency1D_err(std::string histoname);
106 
107  HEP::BinnedFn2D<double>* Efficiency2D(std::string histoname);
108  HEP::BinnedFn2D<double>* Efficiency2D_err(std::string histoname);
109 
110 };
111 
Definition: HEPData.h:37
Definition: HEPData.h:60
Definition: HEPData.h:81