1 #ifndef Alignment_OfflineValidation_DiLeptonVertexHelpers_h 2 #define Alignment_OfflineValidation_DiLeptonVertexHelpers_h 6 #include <fmt/printf.h> 8 #include "TLorentzVector.h" 66 if (((TObject*)
histo)->InheritsFrom(
"TH2")) {
67 zTitle =
histo->GetZaxis()->GetTitle();
76 if (((TObject*)
histo)->InheritsFrom(
"TH2")) {
78 (
name +
"_" + toSub).c_str(),
79 (
title +
" (" + toSub +
");" + xTitle +
" (" + toSub +
") ;" + yTitle +
" (" + toSub +
");" + zTitle)
82 histo->GetXaxis()->GetXmin(),
83 histo->GetXaxis()->GetXmax(),
85 histo->GetYaxis()->GetXmin(),
86 histo->GetYaxis()->GetXmax());
89 (
name +
"_" + toSub).c_str(),
90 (
title +
" (" + toSub +
");" + xTitle +
" (" + toSub +
") ;" + yTitle +
" (" + toSub +
")").c_str(),
92 histo->GetXaxis()->GetXmin(),
93 histo->GetXaxis()->GetXmax());
107 if (isEta1Barrel && isEta2Barrel) {
126 inline void fillTH1Plots(
const float val,
const std::pair<TLorentzVector, TLorentzVector>& momenta) {
129 <<
"In" << __FUNCTION__ <<
"," << __LINE__ <<
"trying to fill a plot not booked!" << std::endl;
135 edm::LogError(
"PlotsVsDiLeptonRegion") <<
"undefined di-muon kinematics" << std::endl;
143 const std::pair<TLorentzVector, TLorentzVector>& momenta) {
146 <<
"In" << __FUNCTION__ <<
"," << __LINE__ <<
"trying to fill a plot not booked!" << std::endl;
152 edm::LogError(
"PlotsVsDiLeptonRegion") <<
"undefined di-muon kinematics" << std::endl;
189 edm::LogError(
"PlotsVsKinematics") <<
"The initialization flavour is not correct!" << std::endl;
208 namePostfix =
m_flav ?
"EEPhi" :
"MMPhi";
209 titlePostfix = fmt::sprintf(
"%s%s pair #phi;%s^{+}%s^{-} #phi", sed, sed, sed, sed);
214 namePostfix =
m_flav ?
"EEEta" :
"MuMuEta";
215 titlePostfix = fmt::sprintf(
"%s%s pair #eta;%s^{+}%s^{-} #eta", sed, sed, sed, sed);
220 namePostfix =
m_flav ?
"EPlusPhi" :
"MuPlusPhi";
221 titlePostfix = fmt::sprintf(
"%s^{+} #phi;%s^{+} #phi [rad]", sed, sed);
226 namePostfix =
m_flav ?
"EPlusEta" :
"MuPlusEta";
227 titlePostfix = fmt::sprintf(
"%s^{+} #eta;%s^{+} #eta", sed, sed);
232 namePostfix =
m_flav ?
"EMinusPhi" :
"MuMinusPhi";
233 titlePostfix = fmt::sprintf(
"%s^{-} #phi;%s^{-} #phi [rad]", sed, sed);
238 namePostfix =
m_flav ?
"EMinusEta" :
"MuMinusEta";
239 titlePostfix = fmt::sprintf(
"%s^{-} #eta;%s^{+} #eta", sed, sed);
242 throw cms::Exception(
"LogicalError") <<
" there is not such Axis choice as " << xAx;
246 const auto& h2title = fmt::sprintf(
"%s vs %s;%s% s",
268 TFileDirectory&
fs,
const float valmin,
const float valmax,
const int nxbins,
const int nybins) {
271 <<
"In" << __FUNCTION__ <<
"," << __LINE__
272 <<
"trying to book plots without the right constructor being called!" << std::endl;
282 TH1F::SetDefaultSumw2(kTRUE);
285 m_h2_map[xAxis::Z_ETA] =
fs.make<TH2F>(fmt::sprintf(
"%sVsMuMuEta",
m_name).c_str(),
286 fmt::sprintf(
"%s vs %s pair #eta;%s #eta;%s",
m_title, dilep, dilep,
m_ytitle).c_str(),
288 nybins, valmin, valmax);
290 m_h2_map[xAxis::Z_PHI] =
fs.make<TH2F>(fmt::sprintf(
"%sVsMuMuPhi",
m_name).c_str(),
291 fmt::sprintf(
"%s vs %s pair #phi;%s #phi [rad];%s",
m_title, dilep, dilep,
m_ytitle).c_str(),
292 nxbins, -maxMuMuEta, maxMuMuEta,
293 nybins, valmin, valmax);
295 m_h2_map[xAxis::LP_ETA] =
fs.make<TH2F>(fmt::sprintf(
"%sVsMuPlusEta",
m_name).c_str(),
296 fmt::sprintf(
"%s vs %s #eta;%s #eta;%s",
m_title, lep, lep,
m_ytitle).c_str(),
297 nxbins, -maxMuEta, maxMuEta,
298 nybins, valmin, valmax);
300 m_h2_map[xAxis::LP_PHI] =
fs.make<TH2F>(fmt::sprintf(
"%sVsMuPlusPhi",
m_name).c_str(),
301 fmt::sprintf(
"%s vs %s #phi;%s #phi [rad];%s",
m_title, lep, lep,
m_ytitle).c_str(),
303 nybins, valmin, valmax);
305 m_h2_map[xAxis::LM_ETA] =
fs.make<TH2F>(fmt::sprintf(
"%sVsMuMinusEta",
m_name).c_str(),
306 fmt::sprintf(
"%s vs %s #eta;%s #eta;%s",
m_title, lem, lem,
m_ytitle).c_str(),
307 nxbins, -maxMuEta, maxMuEta,
308 nybins, valmin, valmax);
310 m_h2_map[xAxis::LM_PHI] =
fs.make<TH2F>(fmt::sprintf(
"%sVsMuMinusPhi",
m_name).c_str(),
311 fmt::sprintf(
"%s vs %s #phi;%s #phi [rad];%s",
m_title, lem, lem,
m_ytitle).c_str(),
313 nybins, valmin, valmax);
321 inline void fillPlots(
const float val,
const std::pair<TLorentzVector, TLorentzVector>& momenta) {
324 <<
"In" << __FUNCTION__ <<
"," << __LINE__ <<
"trying to fill a plot not booked!" << std::endl;
328 m_h2_map[xAxis::Z_ETA]->Fill((momenta.first + momenta.second).Eta(),
val);
329 m_h2_map[xAxis::Z_PHI]->Fill((momenta.first + momenta.second).Phi(),
val);
330 m_h2_map[xAxis::LP_ETA]->Fill((momenta.first).Eta(),
val);
331 m_h2_map[xAxis::LP_PHI]->Fill((momenta.first).Phi(),
val);
332 m_h2_map[xAxis::LM_ETA]->Fill((momenta.second).Eta(),
val);
333 m_h2_map[xAxis::LM_PHI]->Fill((momenta.second).Phi(),
val);
339 xAxis::Z_PHI, xAxis::Z_ETA, xAxis::LP_PHI, xAxis::LP_ETA, xAxis::LM_PHI, xAxis::LM_ETA};
T getParameter(std::string const &) const
const std::string m_ytitle
unsigned int eventsAfterVtx
const float m_etaBoundary
void fillTH1Plots(const float val, const std::pair< TLorentzVector, TLorentzVector > &momenta)
unsigned int eventsAfterDist
~PlotsVsKinematics()=default
Log< level::Error, false > LogError
std::map< etaRegion, TH2F * > m_h2_map
unsigned int eventsAfterEta
std::map< xAxis, TH2F * > m_h2_map
const std::vector< xAxis > axisChoices
const std::vector< std::string > m_etaRegionNames
const std::vector< etaRegion > m_etaRegions
void bookSet(const TFileDirectory &fs, const TH1 *histo)
PlotsVsKinematics(flavour FLAV, const std::string &name, const std::string &tt, const std::string &ytt)
Abs< T >::type abs(const T &t)
PlotsVsKinematics(flavour FLAV)
Log< level::Info, false > LogInfo
~PlotsVsDiLeptonRegion()=default
void bookPlots(TFileDirectory &fs, const float valmin, const float valmax, const int nxbins, const int nybins)
std::map< etaRegion, TH1F * > m_h1_map
unsigned int eventsAfterPt
PlotsVsDiLeptonRegion(const float etaBoundary)
etaRegion getEtaRegion(const double eta1, const double eta2)
void fillPlots(const float val, const std::pair< TLorentzVector, TLorentzVector > &momenta)
void bookFromPSet(const TFileDirectory &fs, const edm::ParameterSet &hpar)
void fillTH2Plots(const float valX, const float valY, const std::pair< TLorentzVector, TLorentzVector > &momenta)
unsigned int eventsAfterMult
const std::string m_title