SmearedMET.hh
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #ifndef RIVET_SmearedMET_HH 00003 #define RIVET_SmearedMET_HH 00004 00005 #include "Rivet/Projection.hh" 00006 #include "Rivet/Projections/MissingMomentum.hh" 00007 #include "Rivet/Tools/SmearingFunctions.hh" 00008 #include <functional> 00009 00010 namespace Rivet { 00011 00012 00013 /// Wrapper projection for smearing missing (transverse) energy/momentum with detector resolutions 00014 class SmearedMET : public Projection { 00015 public: 00016 00017 /// @name Constructors etc. 00018 //@{ 00019 00020 /// @brief Constructor from a MissingMomentum projection and a smearing function 00021 /// 00022 /// Smearing function maps a 3-vector MET and scalar SET to a new MET 3-vector: f(V3, double) -> V3 00023 template <typename V2VFN> 00024 SmearedMET(const MissingMomentum& mm, const V2VFN& metSmearFn) 00025 : _metSmearFn(metSmearFn) 00026 { 00027 setName("SmearedMET"); 00028 addProjection(mm, "TruthMET"); 00029 } 00030 00031 /// @brief Constructor from a Cut (on the particles used to determine missing momentum) and a smearing function 00032 template <typename V2VFN> 00033 SmearedMET(const V2VFN& metSmearFn, const Cut& cut) 00034 : _metSmearFn(metSmearFn) 00035 { 00036 setName("SmearedMET"); 00037 addProjection(MissingMomentum(cut), "TruthMET"); 00038 } 00039 00040 00041 /// Clone on the heap. 00042 DEFAULT_RIVET_PROJ_CLONE(SmearedMET); 00043 00044 //@} 00045 00046 00047 /// Compare to another SmearedMET 00048 int compare(const Projection& p) const { 00049 const SmearedMET& other = dynamic_cast<const SmearedMET&>(p); 00050 if (get_address(_metSmearFn) == 0) return UNDEFINED; 00051 MSG_TRACE("Smear hashes = " << get_address(_metSmearFn) << "," << get_address(other._metSmearFn)); 00052 return mkPCmp(other, "TruthMET") || cmp(get_address(_metSmearFn), get_address(other._metSmearFn)); 00053 } 00054 00055 00056 /// Perform the MET finding & smearing calculation 00057 void project(const Event& e) { 00058 const auto& mm = apply<MissingMomentum>(e, "TruthMET"); 00059 _vet = mm.vectorEt(); 00060 if (_metSmearFn) _vet = _metSmearFn(_vet, mm.scalarEt()); //< smearing 00061 } 00062 00063 00064 /// The vector-summed visible transverse energy in the event, as a 3-vector with z=0 00065 /// @note Reverse this vector with operator- to get the missing ET vector. 00066 const Vector3& vectorEt() const { return _vet; } 00067 00068 /// The vector-summed missing transverse energy in the event. 00069 double missingEt() const { return vectorEt().mod(); } 00070 /// Alias for missingEt 00071 double met() const { return missingEt(); } 00072 00073 00074 /// Reset the projection. Smearing functions will be unchanged. 00075 void reset() { } 00076 00077 00078 private: 00079 00080 Vector3 _vet; 00081 00082 /// Stored smearing function 00083 std::function<Vector3(const Vector3&, double)> _metSmearFn; 00084 00085 }; 00086 00087 00088 } 00089 00090 #endif Generated on Tue Dec 13 2016 16:32:40 for The Rivet MC analysis system by ![]() |