1 #ifndef Alignment_OfflineValidation_DiLeptonVertexHelpers_h 2 #define Alignment_OfflineValidation_DiLeptonVertexHelpers_h 6 #include <fmt/printf.h> 8 #include "TLorentzVector.h" 29 edm::LogError(
"PlotsVsKinematics") <<
"The initialization flavour is not correct!" << std::endl;
48 namePostfix =
m_flav ?
"EEPhi" :
"MuMuPhi";
49 titlePostfix = fmt::sprintf(
"%s%s pair #phi;%s^{+}%s^{-} #phi", sed, sed, sed, sed);
54 namePostfix =
m_flav ?
"EEEta" :
"MuMuEta";
55 titlePostfix = fmt::sprintf(
"%s%s pair #eta;%s^{+}%s^{-} #eta", sed, sed, sed, sed);
60 namePostfix =
m_flav ?
"EPlusPhi" :
"MuPlusPhi";
61 titlePostfix = fmt::sprintf(
"%s^{+} #phi;%s^{+} #phi [rad]", sed, sed);
66 namePostfix =
m_flav ?
"EPlusEta" :
"MuPlusEta";
67 titlePostfix = fmt::sprintf(
"%s^{+} #eta;%s^{+} #eta", sed, sed);
72 namePostfix =
m_flav ?
"EMinusPhi" :
"MuMinusPhi";
73 titlePostfix = fmt::sprintf(
"%s^{-} #phi;%s^{-} #phi [rad]", sed, sed);
78 namePostfix =
m_flav ?
"EMinusEta" :
"MuMinusEta";
79 titlePostfix = fmt::sprintf(
"%s^{-} #eta;%s^{+} #eta", sed, sed);
81 case xAxis::DELTA_ETA:
84 namePostfix =
m_flav ?
"EEDeltEta" :
"MuMuDeltaEta";
85 titlePostfix = fmt::sprintf(
"%s^{-}%s^{+} #Delta#eta;%s^{+}%s^{-} #Delta#eta", sed, sed, sed, sed);
87 case xAxis::COSTHETACS:
90 namePostfix =
"CosThetaCS";
92 fmt::sprintf(
"%s^{+}%s^{-} cos(#theta_{CS});%s^{+}%s^{-} cos(#theta_{CS})", sed, sed, sed, sed);
95 throw cms::Exception(
"LogicalError") <<
" there is not such Axis choice as " << xAx;
99 const auto& h2title = fmt::sprintf(
"%s vs %s;%s% s",
127 <<
"In" << __FUNCTION__ <<
"," << __LINE__
128 <<
"trying to book plots without the right constructor being called!" << std::endl;
136 static constexpr
float maxMuEta = 2.4;
137 static constexpr
float maxMuMuEta = 3.5;
138 TH1F::SetDefaultSumw2(kTRUE);
142 fmt::sprintf(
"%s vs %s pair #eta;%s #eta;%s",
m_title, dilep, dilep,
m_ytitle).c_str(),
144 nybins, valmin, valmax);
147 fmt::sprintf(
"%s vs %s pair #phi;%s #phi [rad];%s",
m_title, dilep, dilep,
m_ytitle).c_str(),
148 nxbins, -maxMuMuEta, maxMuMuEta,
149 nybins, valmin, valmax);
152 fmt::sprintf(
"%s vs %s #eta;%s #eta;%s",
m_title, lep, lep,
m_ytitle).c_str(),
153 nxbins, -maxMuEta, maxMuEta,
154 nybins, valmin, valmax);
157 fmt::sprintf(
"%s vs %s #phi;%s #phi [rad];%s",
m_title, lep, lep,
m_ytitle).c_str(),
159 nybins, valmin, valmax);
162 fmt::sprintf(
"%s vs %s #eta;%s #eta;%s",
m_title, lem, lem,
m_ytitle).c_str(),
163 nxbins, -maxMuEta, maxMuEta,
164 nybins, valmin, valmax);
167 fmt::sprintf(
"%s vs %s #phi;%s #phi [rad];%s",
m_title, lem, lem,
m_ytitle).c_str(),
169 nybins, valmin, valmax);
172 fmt::sprintf(
"%s vs %s #Delta#eta;%s #Delta#eta;%s",
m_title, dilep, dilep,
m_ytitle).c_str(),
174 nybins, valmin, valmax);
177 fmt::sprintf(
"%s vs %s cos(#theta_{CS});%s cos(#theta_{CS});%s",
m_title, dilep, dilep,
m_ytitle).c_str(),
179 nybins, valmin, valmax);
187 inline void fillPlots(
const float val,
const std::pair<TLorentzVector, TLorentzVector>& momenta) {
190 <<
"In" << __FUNCTION__ <<
"," << __LINE__ <<
"trying to fill a plot not booked!" << std::endl;
194 m_h2_map[xAxis::Z_ETA]->Fill((momenta.first + momenta.second).Eta(),
val);
195 m_h2_map[xAxis::Z_PHI]->Fill((momenta.first + momenta.second).Phi(),
val);
196 m_h2_map[xAxis::LP_ETA]->Fill((momenta.first).Eta(),
val);
197 m_h2_map[xAxis::LP_PHI]->Fill((momenta.first).Phi(),
val);
198 m_h2_map[xAxis::LM_ETA]->Fill((momenta.second).Eta(),
val);
199 m_h2_map[xAxis::LM_PHI]->Fill((momenta.second).Phi(),
val);
202 double deltaEta = (momenta.first).Eta() - (momenta.second).Eta();
204 double muplus = 1. /
sqrt(2.) * (momenta.first.E() + momenta.first.Z());
205 double muminus = 1. /
sqrt(2.) * (momenta.first.E() - momenta.first.Z());
206 double mubarplus = 1. /
sqrt(2.) * (momenta.second.E() + momenta.second.Z());
207 double mubarminus = 1. /
sqrt(2.) * (momenta.second.E() - momenta.second.Z());
209 const auto& mother = momenta.first + momenta.second;
210 double cosThetaCS = 2. / mother.Mag() /
sqrt(
pow(mother.Mag(), 2) +
pow(mother.Pt(), 2)) *
214 m_h2_map[xAxis::COSTHETACS]->Fill(cosThetaCS,
val);
235 std::map<xAxis, dqm::reco::MonitorElement*>
m_h2_map;
PlotsVsKinematics(flavour FLAV)
T getParameter(std::string const &) const
std::map< xAxis, dqm::reco::MonitorElement * > m_h2_map
const std::vector< xAxis > axisChoices
const std::string m_ytitle
Log< level::Error, false > LogError
static const double deltaEta
~PlotsVsKinematics()=default
void fillPlots(const float val, const std::pair< TLorentzVector, TLorentzVector > &momenta)
void bookPlots(dqm::reco::DQMStore::IBooker &iBooker, const float valmin, const float valmax, const int nxbins, const int nybins)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
const std::string m_title
void bookFromPSet(dqm::reco::DQMStore::IBooker &iBooker, const edm::ParameterSet &hpar)
PlotsVsKinematics(flavour FLAV, const std::string &name, const std::string &tt, const std::string &ytt)