1 |
#ifndef SAMPLEWEIGHT
|
2 |
#define SAMPLEWEIGHT
|
3 |
|
4 |
#include <map>
|
5 |
#include <string>
|
6 |
#include <THashTable.h>
|
7 |
#include <TParameter.h>
|
8 |
#include <TChain.h>
|
9 |
#include <TString.h>
|
10 |
#include <TRegexp.h>
|
11 |
#include <TFile.h>
|
12 |
#include <TTree.h>
|
13 |
|
14 |
// get dataset name from the chain (only works on summer mc and 2011 data)
|
15 |
std::string getDatasetName(TChain *chain);
|
16 |
|
17 |
// get the number of events in the unskimmed ntuple
|
18 |
double unskimmedEntries(TString skimname);
|
19 |
|
20 |
//
|
21 |
// table for reading xs data file (see MitAna/Utils/interface/SimpleTable.h)
|
22 |
//
|
23 |
class SimpleTable : public TObject
|
24 |
{
|
25 |
public:
|
26 |
class MyParameter : public TParameter<double>
|
27 |
{
|
28 |
public:
|
29 |
MyParameter() {}
|
30 |
MyParameter(const char *n, Double_t v) :
|
31 |
TParameter<double>(n,v), fHash(TString(n).Hash()) {}
|
32 |
|
33 |
ULong_t Hash() const { return fHash; }
|
34 |
void Print(Option_t */*option*/="") const;
|
35 |
|
36 |
protected:
|
37 |
ULong_t fHash; //stored hash value
|
38 |
};
|
39 |
|
40 |
public:
|
41 |
SimpleTable(const char *input);
|
42 |
~SimpleTable() {}
|
43 |
|
44 |
Double_t Get(const char *name) const;
|
45 |
Double_t Has(const char *name) const;
|
46 |
void Print(Option_t *opt="") const;
|
47 |
|
48 |
protected:
|
49 |
THashTable fTable;
|
50 |
};
|
51 |
|
52 |
// get event weight for this mc sample
|
53 |
double getWeight( SimpleTable &xstab, std::map<std::string,double> entrymap, TChain *chain );
|
54 |
|
55 |
#endif
|