Rivet: /Users/chrisg/software/rivet/include/Rivet/Projections/SmearedMET.hh Source File

| Rivet 3.1.9

SmearedMET.hh
1// -*- C++ -*-
2#ifndef RIVET_SmearedMET_HH
3#define RIVET_SmearedMET_HH
4
5#include "Rivet/Projection.hh"
6#include "Rivet/Projections/METFinder.hh"
7#include "Rivet/Projections/MissingMomentum.hh"
8#include "Rivet/Tools/SmearingFunctions.hh"
9#include <functional>
10
11namespace Rivet {
12
13
15 class SmearedMET : public METFinder {
16 public:
17
20
24 template <typename V2VFN>
25 SmearedMET(const MissingMomentum& mm, const V2VFN& metSmearFn)
26 : _metSmearFn(metSmearFn)
27 {
28 setName("SmearedMET");
29 declare(mm, "TruthMET");
30 }
31
33 template <typename V2VFN>
34 SmearedMET(const V2VFN& metSmearFn, const Cut& cut)
35 : _metSmearFn(metSmearFn)
36 {
37 setName("SmearedMET");
38 declare(MissingMomentum(cut), "TruthMET");
39 }
40
41
43 DEFAULT_RIVET_PROJ_CLONE(SmearedMET);
44
46
48 using Projection::operator =;
49
50
52 CmpState compare(const Projection& p) const {
53 const SmearedMET& other = dynamic_cast<const SmearedMET&>(p);
54 if (get_address(_metSmearFn) == 0) return cmp((size_t)this, (size_t)&p);
55 MSG_TRACE("Smear hashes = " << get_address(_metSmearFn) << "," << get_address(other._metSmearFn));
56 return mkPCmp(other, "TruthMET") || cmp(get_address(_metSmearFn), get_address(other._metSmearFn));
57 }
58
59
61 void project(const Event& e) {
62 const auto& mm = apply<MissingMomentum>(e, "TruthMET");
63 _vet = mm.vectorEt();
64 if (_metSmearFn) _vet = _metSmearFn(_vet, mm.scalarEt()); //< smearing
65 }
66
67
72
77 const Vector3& vectorPt() const { return vectorEt(); }
78
80
81
86
90 const Vector3& vectorEt() const { return _vet; }
91
93
94
96 void reset() { }
97
98
99 protected:
100
101 Vector3 _vet;
102
104 std::function<Vector3(const Vector3&, double)> _metSmearFn;
105
106 };
107
108
109}
110
111#endif
Rivet::Event
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Rivet::METFinder
Interface for projections that find missing transverse energy/momentum.
Definition METFinder.hh:11
Rivet::MissingMomentum
Calculate missing , etc. as complements to the total visible momentum.
Definition MissingMomentum.hh:22
Rivet::ProjectionApplier::declare
const PROJ & declare(const PROJ &proj, const std::string &name)
Register a contained projection (user-facing version)
Definition ProjectionApplier.hh:170
Rivet::Projection
Base class for all Rivet projections.
Definition Projection.hh:29
Rivet::Projection::mkPCmp
Cmp< Projection > mkPCmp(const Projection &otherparent, const std::string &pname) const
Rivet::Projection::setName
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:142
Rivet::SmearedMET
Wrapper projection for smearing missing (transverse) energy/momentum with detector resolutions.
Definition SmearedMET.hh:15
Rivet::SmearedMET::DEFAULT_RIVET_PROJ_CLONE
DEFAULT_RIVET_PROJ_CLONE(SmearedMET)
Clone on the heap.
Rivet::SmearedMET::SmearedMET
SmearedMET(const MissingMomentum &mm, const V2VFN &metSmearFn)
Constructor from a MissingMomentum projection and a smearing function.
Definition SmearedMET.hh:25
Rivet::SmearedMET::reset
void reset()
Reset the projection. Smearing functions will be unchanged.
Definition SmearedMET.hh:96
Rivet::SmearedMET::vectorPt
const Vector3 & vectorPt() const
Definition SmearedMET.hh:77
Rivet::SmearedMET::vectorEt
const Vector3 & vectorEt() const
Definition SmearedMET.hh:90
Rivet::SmearedMET::project
void project(const Event &e)
Perform the MET finding & smearing calculation.
Definition SmearedMET.hh:61
Rivet::SmearedMET::SmearedMET
SmearedMET(const V2VFN &metSmearFn, const Cut &cut)
Constructor from a Cut (on the particles used to determine missing momentum) and a smearing function.
Definition SmearedMET.hh:34
Rivet::SmearedMET::compare
CmpState compare(const Projection &p) const
Compare to another SmearedMET.
Definition SmearedMET.hh:52
Rivet::Vector3
Three-dimensional specialisation of Vector.
Definition Vector3.hh:40
MSG_TRACE
#define MSG_TRACE(x)
Lowest-level, most verbose messaging, using MSG_LVL.
Definition Logging.hh:193
Rivet::Kin::p
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
Rivet
Definition MC_Cent_pPb.hh:10
Rivet::cmp
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition Cmp.hh:255
std::get_address
uintptr_t get_address(std::function< T(U...)> f)
Get a function pointer / hash integer from an std::function.
Definition RivetSTL.hh:193