-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLumi3DReWeighting.h
executable file
·76 lines (47 loc) · 1.78 KB
/
Lumi3DReWeighting.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
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef PhysicsTools_Utilities_interface_Lumi3DReWeighting_h
#define PhysicsTools_Utilities_interface_Lumi3DReWeighting_h
/**
\class Lumi3DReWeighting Lumi3DReWeighting.h "PhysicsTools/Utilities/interface/Lumi3DReWeighting.h"
\brief Class to provide lumi weighting for analyzers to weight "flat-to-N" MC samples to data
This class will trivially take two histograms:
1. The generated "flat-to-N" distributions from a given processing
2. A histogram generated from the "estimatePileup" macro here:
https://twiki.cern.ch/twiki/bin/view/CMS/LumiCalc#How_to_use_script_estimatePileup
\author Salvatore Rappoccio
*/
#include "TH1.h"
#include "TFile.h"
#include <cmath>
#include <string>
//#include <boost/shared_ptr.hpp>
#include <vector>
//namespace edm {
//class EventBase;
class Lumi3DReWeighting {
public:
Lumi3DReWeighting( std::string generatedFile,
std::string dataFile,
std::string GenHistName,
std::string DataHistName);
Lumi3DReWeighting( std::vector< float > MC_distr, std::vector< float > Lumi_distr);
Lumi3DReWeighting ( ) { } ;
~Lumi3DReWeighting ( ) { } ;
//double weight3D( const edm::EventBase &e );
double weight3D( int, int, int );
void weight3D_init( float Scale );
void weight3D_init( std::string WeightFileName ); // initialize from root file
void weight3D_init( std::string MCFileName, std::string DataFileName ); // initialize from root files
protected:
std::string generatedFileName_;
std::string dataFileName_;
std::string GenHistName_;
std::string DataHistName_;
TFile * generatedFile_;
TFile * dataFile_;
TH1 * weights_;
//keep copies of normalized distributions:
TH1 * MC_distr_;
TH1 * Data_distr_;
double Weight3D_[50][50][50];
};
#endif