CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DiLeptonHelp::PlotsVsDiLeptonRegion Class Reference

#include <DiLeptonVertexHelpers.h>

Public Member Functions

void bookSet (const TFileDirectory &fs, const TH1 *histo)
 
void fillTH1Plots (const float val, const std::pair< TLorentzVector, TLorentzVector > &momenta)
 
void fillTH2Plots (const float valX, const float valY, const std::pair< TLorentzVector, TLorentzVector > &momenta)
 
etaRegion getEtaRegion (const double eta1, const double eta2)
 
 PlotsVsDiLeptonRegion (const float etaBoundary)
 
 ~PlotsVsDiLeptonRegion ()=default
 

Private Attributes

const float m_etaBoundary
 
const std::vector< std::string > m_etaRegionNames
 
const std::vector< etaRegionm_etaRegions
 
std::map< etaRegion, TH1F * > m_h1_map
 
std::map< etaRegion, TH2F * > m_h2_map
 
bool m_isBooked
 

Detailed Description

Definition at line 54 of file DiLeptonVertexHelpers.h.

Constructor & Destructor Documentation

◆ PlotsVsDiLeptonRegion()

DiLeptonHelp::PlotsVsDiLeptonRegion::PlotsVsDiLeptonRegion ( const float  etaBoundary)
inline

Definition at line 56 of file DiLeptonVertexHelpers.h.

56 : m_etaBoundary(etaBoundary) {}

◆ ~PlotsVsDiLeptonRegion()

DiLeptonHelp::PlotsVsDiLeptonRegion::~PlotsVsDiLeptonRegion ( )
default

Member Function Documentation

◆ bookSet()

void DiLeptonHelp::PlotsVsDiLeptonRegion::bookSet ( const TFileDirectory fs,
const TH1 *  histo 
)
inline

Definition at line 60 of file DiLeptonVertexHelpers.h.

References DiLeptonHelp::END, compareTotals::fs, timingPdfMaker::histo, m_etaRegionNames, m_etaRegions, m_h1_map, m_h2_map, m_isBooked, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

Referenced by DiMuonVertexValidation::beginJob().

60  {
61  const std::string name = histo->GetName();
62  const std::string title = histo->GetTitle();
63  const std::string xTitle = histo->GetXaxis()->GetTitle();
64  const std::string yTitle = histo->GetYaxis()->GetTitle();
65  std::string zTitle = "";
66  if (((TObject*)histo)->InheritsFrom("TH2")) {
67  zTitle = histo->GetZaxis()->GetTitle();
68  }
69 
70  for (const auto& etaReg : m_etaRegions) {
71  if (etaReg == etaRegion::END)
72  continue;
73 
74  if (((TObject*)histo)->InheritsFrom("TH2")) {
75  m_h2_map[etaReg] =
76  fs.make<TH2F>((name + "_" + m_etaRegionNames[etaReg]).c_str(),
77  (title + m_etaRegionNames[etaReg] + ";" + xTitle + ";" + yTitle + ";" + zTitle).c_str(),
78  histo->GetNbinsX(),
79  histo->GetXaxis()->GetXmin(),
80  histo->GetXaxis()->GetXmax(),
81  histo->GetNbinsY(),
82  histo->GetYaxis()->GetXmin(),
83  histo->GetYaxis()->GetXmax());
84  } else {
85  m_h1_map[etaReg] = fs.make<TH1F>((name + "_" + m_etaRegionNames[etaReg]).c_str(),
86  (title + m_etaRegionNames[etaReg] + ";" + xTitle + ";" + yTitle).c_str(),
87  histo->GetNbinsX(),
88  histo->GetXaxis()->GetXmin(),
89  histo->GetXaxis()->GetXmax());
90  }
91  }
92 
93  // flip the is booked bit
94  m_isBooked = true;
95  }
std::map< etaRegion, TH2F * > m_h2_map
const std::vector< std::string > m_etaRegionNames
const std::vector< etaRegion > m_etaRegions
std::map< etaRegion, TH1F * > m_h1_map

◆ fillTH1Plots()

void DiLeptonHelp::PlotsVsDiLeptonRegion::fillTH1Plots ( const float  val,
const std::pair< TLorentzVector, TLorentzVector > &  momenta 
)
inline

Definition at line 122 of file DiLeptonVertexHelpers.h.

References DiLeptonHelp::END, getEtaRegion(), m_h1_map, m_isBooked, nano_mu_digi_cff::region, and heppy_batch::val.

Referenced by DiMuonVertexValidation::analyze().

122  {
123  if (!m_isBooked) {
124  edm::LogError("PlotsVsDiLeptonRegion")
125  << "In" << __FUNCTION__ << "," << __LINE__ << "trying to fill a plot not booked!" << std::endl;
126  return;
127  }
128 
129  etaRegion region = getEtaRegion(momenta.first.Eta(), momenta.second.Eta());
130  if (region == etaRegion::END) {
131  edm::LogError("PlotsVsDiLeptonRegion") << "undefined di-muon kinematics" << std::endl;
132  }
133  m_h1_map[region]->Fill(val);
134  }
Log< level::Error, false > LogError
std::map< etaRegion, TH1F * > m_h1_map
etaRegion getEtaRegion(const double eta1, const double eta2)

◆ fillTH2Plots()

void DiLeptonHelp::PlotsVsDiLeptonRegion::fillTH2Plots ( const float  valX,
const float  valY,
const std::pair< TLorentzVector, TLorentzVector > &  momenta 
)
inline

Definition at line 137 of file DiLeptonVertexHelpers.h.

References DiLeptonHelp::END, getEtaRegion(), m_h2_map, m_isBooked, and nano_mu_digi_cff::region.

139  {
140  if (!m_isBooked) {
141  edm::LogError("PlotsVsDiLeptonRegion")
142  << "In" << __FUNCTION__ << "," << __LINE__ << "trying to fill a plot not booked!" << std::endl;
143  return;
144  }
145 
146  etaRegion region = getEtaRegion(momenta.first.Eta(), momenta.second.Eta());
147  if (region == etaRegion::END) {
148  edm::LogError("PlotsVsDiLeptonRegion") << "undefined di-muon kinematics" << std::endl;
149  }
150  m_h2_map[region]->Fill(valX, valY);
151  }
Log< level::Error, false > LogError
std::map< etaRegion, TH2F * > m_h2_map
etaRegion getEtaRegion(const double eta1, const double eta2)

◆ getEtaRegion()

etaRegion DiLeptonHelp::PlotsVsDiLeptonRegion::getEtaRegion ( const double  eta1,
const double  eta2 
)
inline

Definition at line 99 of file DiLeptonVertexHelpers.h.

References funct::abs(), DiLeptonHelp::BARBAR, DiLeptonHelp::BARBWD, DiLeptonHelp::BARFWD, DiLeptonHelp::BWDBWD, DiLeptonHelp::END, HLT_2024v10_cff::eta1, HLT_2024v10_cff::eta2, DiLeptonHelp::FWDBWD, DiLeptonHelp::FWDFWD, and m_etaBoundary.

Referenced by fillTH1Plots(), and fillTH2Plots().

99  {
100  bool isEta1Barrel = std::abs(eta1) <= m_etaBoundary;
101  bool isEta2Barrel = std::abs(eta2) <= m_etaBoundary;
102 
103  if (isEta1Barrel && isEta2Barrel) {
104  return etaRegion::BARBAR;
105  } else if ((isEta1Barrel && eta2 > m_etaBoundary) || (isEta2Barrel && eta1 > m_etaBoundary)) {
106  return etaRegion::BARFWD;
107  } else if ((isEta1Barrel && eta2 < -m_etaBoundary) || (isEta2Barrel && eta1 < -m_etaBoundary)) {
108  return etaRegion::BARBWD;
109  } else if (eta1 > m_etaBoundary && eta2 > m_etaBoundary) {
110  return etaRegion::FWDFWD;
111  } else if (eta1 < -m_etaBoundary && eta2 < -m_etaBoundary) {
112  return etaRegion::BWDBWD;
113  } else if ((eta1 > m_etaBoundary && eta2 < -m_etaBoundary) || (eta2 > m_etaBoundary && eta1 < -m_etaBoundary)) {
114  return etaRegion::FWDBWD;
115  }
116 
117  // Default case if none of the conditions match
118  return etaRegion::END; // Adjust the default based on your logic
119  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

◆ m_etaBoundary

const float DiLeptonHelp::PlotsVsDiLeptonRegion::m_etaBoundary
private

Definition at line 167 of file DiLeptonVertexHelpers.h.

Referenced by getEtaRegion().

◆ m_etaRegionNames

const std::vector<std::string> DiLeptonHelp::PlotsVsDiLeptonRegion::m_etaRegionNames
private
Initial value:
= {"barrel-barrel",
"barrel-forward",
"barrel-backward",
"forward-forward",
"backward-backward",
"forward-backward"}

Definition at line 161 of file DiLeptonVertexHelpers.h.

Referenced by bookSet().

◆ m_etaRegions

const std::vector<etaRegion> DiLeptonHelp::PlotsVsDiLeptonRegion::m_etaRegions
private

◆ m_h1_map

std::map<etaRegion, TH1F*> DiLeptonHelp::PlotsVsDiLeptonRegion::m_h1_map
private

Definition at line 169 of file DiLeptonVertexHelpers.h.

Referenced by bookSet(), and fillTH1Plots().

◆ m_h2_map

std::map<etaRegion, TH2F*> DiLeptonHelp::PlotsVsDiLeptonRegion::m_h2_map
private

Definition at line 170 of file DiLeptonVertexHelpers.h.

Referenced by bookSet(), and fillTH2Plots().

◆ m_isBooked

bool DiLeptonHelp::PlotsVsDiLeptonRegion::m_isBooked
private

Definition at line 168 of file DiLeptonVertexHelpers.h.

Referenced by bookSet(), fillTH1Plots(), and fillTH2Plots().