00001
00002
00003
00004
00006 #ifndef METUTILITIES_METSYSTEMATICSTOOL_H
00007 #define METUTILITIES_METSYSTEMATICSTOOL_H
00008
00009 class TH3D;
00010 class TH2D;
00011 class TH1D;
00012
00013 #include "METInterface/IMETSystematicsTool.h"
00014 #include "AsgTools/AsgTool.h"
00015
00016 #include "PATInterfaces/SystematicsTool.h"
00017
00018 #include "TRandom3.h"
00019
00020 #include "xAODMissingET/MissingETContainer.h"
00021 #include "xAODMissingET/MissingETAssociationMap.h"
00022
00023 namespace met {
00024
00025 typedef ElementLink<xAOD::IParticleContainer> obj_link_t;
00026
00027
00028
00029
00030 struct missingEt {
00031 missingEt() : mpx(0), mpy(0), sumet(0), name(""), source(MissingETBase::Source::UnknownType){}
00032 missingEt(double mpx_in, double mpy_in, double sumet_in) :
00033 mpx(mpx_in),
00034 mpy(mpy_in),
00035 sumet(sumet_in),
00036 name(""),
00037 source(MissingETBase::Source::UnknownType)
00038 {}
00039 missingEt(double mpx_in, double mpy_in, double sumet_in, std::string const & iname, MissingETBase::Types::bitmask_t const & isource ) :
00040 mpx(mpx_in),
00041 mpy(mpy_in),
00042 sumet(sumet_in),
00043 name(iname),
00044 source(isource)
00045 {}
00046
00047 double mpx;
00048 double mpy;
00049 double sumet;
00050 std::string name;
00051 MissingETBase::Types::bitmask_t source;
00052 };
00053
00054
00055
00056 enum SystApplied {
00057 NONE ,
00058 MET_SOFTTRK_SCALEUP ,
00059 MET_SOFTTRK_SCALEDOWN ,
00060 MET_SOFTTRK_RESOPARA ,
00061 MET_SOFTTRK_RESOPERP ,
00062 MET_SOFTTRK_RESOCORR ,
00063 MET_SOFTCALO_SCALEUP ,
00064 MET_SOFTCALO_SCALEDOWN,
00065 MET_SOFTCALO_RESO ,
00066 MET_JETTRK_SCALEUP ,
00067 MET_JETTRK_SCALEDOWN
00068 };
00069
00070 class METSystematicsTool : public virtual IMETSystematicsTool,
00071 public asg::AsgTool,
00072 public CP::SystematicsTool
00073 {
00074
00075 ASG_TOOL_CLASS(METSystematicsTool, IMETSystematicsTool)
00076
00077 public:
00078
00079
00080 METSystematicsTool(const std::string& name);
00081
00082
00083
00084
00085 StatusCode softTrkSystInitialize();
00086 StatusCode softCaloSystInitialize();
00087 StatusCode jetTrkSystInitialize();
00088
00089
00090 StatusCode initialize();
00091 StatusCode finalize();
00092
00093
00094
00095 CP::CorrectionCode applyCorrection(xAOD::MissingET& inputMet,
00096 const xAOD::MissingETAssociationMap * map = nullptr ) const;
00097 CP::CorrectionCode correctedCopy(const xAOD::MissingET& met, xAOD::MissingET*& outputmet,
00098 const xAOD::MissingETAssociationMap * map = nullptr) const;
00099
00100
00101
00102
00103
00104 bool isAffectedBySystematic (const CP::SystematicVariation& var) const{return CP::SystematicsTool::isAffectedBySystematic(var) ;}
00105 CP::SystematicSet affectingSystematics () const{ return CP::SystematicsTool::affectingSystematics () ;}
00106 CP::SystematicSet recommendedSystematics () const{ return CP::SystematicsTool::recommendedSystematics() ;}
00107 CP::SystematicCode applySystematicVariation(const CP::SystematicSet& set){ return CP::SystematicsTool::applySystematicVariation(set) ;}
00108 CP::SystematicCode sysApplySystematicVariation(const CP::SystematicSet&);
00109
00110 void setRandomSeed(int seed) const;
00111
00112 private:
00113
00114
00115 METSystematicsTool();
00116
00117
00118 SystApplied m_appliedSystEnum;
00119
00120
00121 CP::CorrectionCode internalSoftTermApplyCorrection(xAOD::MissingET& softMet,
00122 xAOD::MissingETContainer const * METcont,
00123 xAOD::EventInfo const & eInfo
00124 ) const;
00125 CP::CorrectionCode calcJetTrackMETWithSyst(xAOD::MissingET& jettrkmet, const xAOD::MissingETAssociationMap* map) const;
00126 CP::CorrectionCode calcJetTrackMETWithSyst(xAOD::MissingET& jettrkmet, const xAOD::MissingETAssociationMap* map, const xAOD::Jet* jet) const;
00127 CP::CorrectionCode getCorrectedJetTrackMET(xAOD::MissingET& jettrkmet, const xAOD::MissingETAssociationMap* map) const;
00128
00129
00130 std::string m_configPrefix;
00131 std::string m_configSoftTrkFile;
00132 std::string m_configJetTrkFile;
00133 std::string m_configSoftCaloFile;
00134 std::string m_truthCont;
00135 std::string m_truthObj;
00136 std::string m_vertexCont;
00137 std::string m_eventInfo;
00138 int m_randSeed;
00139 bool m_useDevArea;
00140
00141 TH3D* m_shiftpara_pthard_njet_mu;
00142 TH3D* m_resopara_pthard_njet_mu;
00143 TH3D* m_resoperp_pthard_njet_mu;
00144 TH2D* m_jet_systRpt_pt_eta;
00145 TH1D* m_h_calosyst_scale;
00146 TH1D* m_h_calosyst_reso;
00147
00148 mutable TRandom3 m_rand;
00149
00150
00151 int m_units;
00152
00153 int getNPV() const;
00154 xAOD::EventInfo const * getDefaultEventInfo() const;
00155
00156 StatusCode addMETAffectingSystematics();
00157 StatusCode extractHistoPath(std::string & histfile, std::string & systpath, std::string & configdir, std::string & suffix, SystType const & type);
00158
00159 missingEt calcPtHard(xAOD::MissingETContainer const * const cont) const;
00160 missingEt caloSyst_scale(missingEt const &softTerms , double const scale) const;
00161 missingEt caloSyst_reso (missingEt const &softTerms) const;
00162 missingEt softTrkSyst_scale (missingEt const & softTerms, missingEt const & ptHard, double const shift) const;
00163 missingEt softTrkSyst_reso (missingEt const & softTerms, missingEt const & ptHard, double const shift, double const smearpara,
00164 double const smearperp) const;
00165 missingEt projectST (missingEt const & softTerms, missingEt const & ptHard) const;
00166
00167
00168
00169 };
00170
00171 }
00172
00173 #endif //METUTILIES_METSYSTEMATICSTOOL_H
00174
00175