-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventWeightProcessor.h
64 lines (56 loc) · 2.14 KB
/
EventWeightProcessor.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
//!
//! \brief Apply event weights
//!
//! A weighting factor \f$ w \f$ is calculated per
//! \f$ \hat{p}_{T} \f$ bin \f$ i \f$ as
//! \f[
//! w = N_{ref} \frac{\sigma_{i}}{N_{i}}
//! \f]
//! where \f$ \sigma_{i} \f$ is the cross section and
//! \f$ N_{i} \f$ the number of events in that bin.
//! \f$ N_{ref} \f$ is the reference to which the weight
//! is normalized. This is either the luminosity
//! (\f$ N_{ref} = \mathcal{L} \f$) or else the number of
//! events in a reference bin \p k \p
//! (\f$ N_{ref} = N_{k} / \sigma_{k} \f$).
//!
//! The cross sections, number of events and reference have
//! to be specified in the config file.
//!
//! \author Matthias Schroeder
//! \date 2009/07/22
//! $Id: EventWeightProcessor.h,v 1.6 2010/12/20 11:08:13 stadie Exp $
// -----------------------------------------------------------------
#ifndef EVENT_WEIGHT_PROCESSOR_H
#define EVENT_WEIGHT_PROCESSOR_H
#include <string>
#include <vector>
#include "CalibData.h"
#include "ConfigFile.h"
#include "EventProcessor.h"
#include "Parameters.h"
class EventWeightProcessor : public EventProcessor
{
public:
EventWeightProcessor(const std::string& configfile, Parameters* param);
~EventWeightProcessor();
protected:
virtual int preprocess(std::vector<Event*>& data,
std::vector<Event*>& control1,
std::vector<Event*>& control2);
virtual int postprocess(std::vector<Event*>& data,
std::vector<Event*>& control1,
std::vector<Event*>& control2) { return data.size();}
bool applyWeights() const { return weightEvents_; }
private:
void calculateWeightsForBins(const std::vector<double>& xSection,
const std::vector<int>& nEvents,
double lumi, int refPtHatBin);
bool weightEvents_; //!< Apply weighting if true
int type_; //!< Type of weighting method
std::vector<double> minPtHat_; //!< Minima of \f$ \hat{p}_{T} \f$ bins (type 0)
std::vector<double> weights_; //!< Weights of \f$ \hat{p}_{T} \f$ bins (type 0)
double globalWeight_; //!< \f$ L\sigma/N_{MC} \f$ (type 1)
double expo_; //!< Exponent for pthat weighting (type 1)
};
#endif