CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions
CaloSpecificAlgo Class Reference

#include <RecoMET/METAlgorithms/interface/CaloSpecificAlgo.h>

Public Member Functions

reco::CaloMET addInfo (edm::Handle< edm::View< reco::Candidate > > towers, const CommonMETData &met, bool noHF, double globalThreshold)
 

Private Types

typedef math::XYZTLorentzVector LorentzVector
 
typedef math::XYZPoint Point
 

Private Member Functions

void add_MET_in_HF (SpecificCaloMETData &specific, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
 
DetId find_DetId_of_ECAL_cell_in_constituent_of (const CaloTower *calotower)
 
DetId find_DetId_of_HCAL_cell_in_constituent_of (const CaloTower *calotower)
 
void remove_HF_from_MET (CommonMETData &met, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
 
void update_EmEtInEB_EmEtInEE (float &EmEtInEB, float &EmEtInEE, const CaloTower *calotower)
 
void update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF (float &HadEtInHB, float &HadEtInHE, float &HadEtInHO, float &HadEtInHF, float &EmEtInHF, const CaloTower *calotower, bool noHF)
 
void update_MaxTowerEm_MaxTowerHad (float &MaxTowerEm, float &MaxTowerHad, const CaloTower *calotower, bool noHF)
 
void update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF (double &sumEtInpHF, double &MExInpHF, double &MEyInpHF, double &sumEtInmHF, double &MExInmHF, double &MEyInmHF, const CaloTower *calotower)
 
void update_totalEt_totalEm (double &totalEt, double &totalEm, const CaloTower *calotower, bool noHF)
 

Detailed Description

Description: Adds Calorimeter specific information to MET base class

Implementation: [Notes on implementation]

Definition at line 37 of file CaloSpecificAlgo.h.

Member Typedef Documentation

◆ LorentzVector

Definition at line 45 of file CaloSpecificAlgo.h.

◆ Point

Definition at line 46 of file CaloSpecificAlgo.h.

Member Function Documentation

◆ add_MET_in_HF()

void CaloSpecificAlgo::add_MET_in_HF ( SpecificCaloMETData specific,
double  sumEtInpHF,
double  MExInpHF,
double  MEyInpHF,
double  sumEtInmHF,
double  MExInmHF,
double  MEyInmHF 
)
private

Definition at line 202 of file CaloSpecificAlgo.cc.

References timingPdfMaker::specific, and mathSSE::sqrt().

208  {
209  LorentzVector METpHF(MExInpHF, MEyInpHF, 0, sqrt(MExInpHF * MExInpHF + MEyInpHF * MEyInpHF));
210  LorentzVector METmHF(MExInmHF, MEyInmHF, 0, sqrt(MExInmHF * MExInmHF + MEyInmHF * MEyInmHF));
211  specific.CaloMETInpHF = METpHF.pt();
212  specific.CaloMETInmHF = METmHF.pt();
213  specific.CaloMETPhiInpHF = METpHF.Phi();
214  specific.CaloMETPhiInmHF = METmHF.Phi();
215  specific.CaloSETInpHF = sumEtInpHF;
216  specific.CaloSETInmHF = sumEtInmHF;
217 }
T sqrt(T t)
Definition: SSEVec.h:19
math::XYZTLorentzVector LorentzVector

◆ addInfo()

reco::CaloMET CaloSpecificAlgo::addInfo ( edm::Handle< edm::View< reco::Candidate > >  towers,
const CommonMETData met,
bool  noHF,
double  globalThreshold 
)

Definition at line 26 of file CaloSpecificAlgo.cc.

References slimmedMETs_cfi::caloMET, ewkMuLumiMonitorDQM_cfi::calotower, HLT_2024v11_cff::globalThreshold, BTaggingMonitor_cfi::met, HLT_2024v11_cff::noHF, timingPdfMaker::specific, HLT_2024v11_cff::towers, and L1BJetProducer_cff::vtx.

Referenced by cms::CaloMETProducer::produce().

29  {
31  CommonMETData met = umet;
32  double totalEt = 0.0;
33  double totalEm = 0.0;
34 
35  double sumEtInpHF = 0.0;
36  double sumEtInmHF = 0.0;
37  double MExInpHF = 0.0;
38  double MEyInpHF = 0.0;
39  double MExInmHF = 0.0;
40  double MEyInmHF = 0.0;
41 
42  for (edm::View<Candidate>::const_iterator towerCand = towers->begin(); towerCand != towers->end(); ++towerCand) {
43  const CaloTower *calotower = dynamic_cast<const CaloTower *>(&(*towerCand));
44  if (!calotower)
45  continue;
46  if (calotower->et() < globalThreshold)
47  continue;
48  update_totalEt_totalEm(totalEt, totalEm, calotower, noHF);
49  update_MaxTowerEm_MaxTowerHad(specific.MaxEtInEmTowers, specific.MaxEtInHadTowers, calotower, noHF);
52  specific.HadEtInHE,
53  specific.HadEtInHO,
54  specific.HadEtInHF,
55  specific.EmEtInHF,
56  calotower,
57  noHF);
59  sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF, calotower);
60  }
61 
62  double totalHad = totalEt - totalEm;
63 
64  if (noHF)
65  remove_HF_from_MET(met, sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF);
66 
67  if (!noHF)
68  add_MET_in_HF(specific, sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF);
69 
70  specific.EtFractionHadronic = (totalEt == 0.0) ? 0.0 : totalHad / totalEt;
71  specific.EtFractionEm = (totalEt == 0.0) ? 0.0 : totalEm / totalEt;
72 
73  const LorentzVector p4(met.mex, met.mey, 0.0, met.met);
74  const Point vtx(0.0, 0.0, 0.0);
75  CaloMET caloMET(specific, met.sumet, p4, vtx);
76  return caloMET;
77 }
void update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF(float &HadEtInHB, float &HadEtInHE, float &HadEtInHO, float &HadEtInHF, float &EmEtInHF, const CaloTower *calotower, bool noHF)
void remove_HF_from_MET(CommonMETData &met, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
void add_MET_in_HF(SpecificCaloMETData &specific, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
void update_EmEtInEB_EmEtInEE(float &EmEtInEB, float &EmEtInEE, const CaloTower *calotower)
void update_totalEt_totalEm(double &totalEt, double &totalEm, const CaloTower *calotower, bool noHF)
void update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF(double &sumEtInpHF, double &MExInpHF, double &MEyInpHF, double &sumEtInmHF, double &MExInmHF, double &MEyInmHF, const CaloTower *calotower)
math::XYZTLorentzVector LorentzVector
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
void update_MaxTowerEm_MaxTowerHad(float &MaxTowerEm, float &MaxTowerHad, const CaloTower *calotower, bool noHF)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
Structure Point Contains parameters of Gaussian fits to DMRs.

◆ find_DetId_of_ECAL_cell_in_constituent_of()

DetId CaloSpecificAlgo::find_DetId_of_ECAL_cell_in_constituent_of ( const CaloTower calotower)
private

Definition at line 233 of file CaloSpecificAlgo.cc.

References ewkMuLumiMonitorDQM_cfi::calotower, DetId::Ecal, l1ctLayer2EG_cff::id, and runTheMatrix::ret.

233  {
234  DetId ret;
235  for (int cell = calotower->constituentsSize() - 1; cell >= 0; --cell) {
236  DetId id = calotower->constituent(cell);
237  if (id.det() == DetId::Ecal) {
238  ret = id;
239  break;
240  }
241  }
242  return ret;
243 }
ret
prodAgent to be discontinued
Definition: DetId.h:17

◆ find_DetId_of_HCAL_cell_in_constituent_of()

DetId CaloSpecificAlgo::find_DetId_of_HCAL_cell_in_constituent_of ( const CaloTower calotower)
private

Definition at line 220 of file CaloSpecificAlgo.cc.

References ewkMuLumiMonitorDQM_cfi::calotower, DetId::Hcal, l1ctLayer2EG_cff::id, and runTheMatrix::ret.

220  {
221  DetId ret;
222  for (int cell = calotower->constituentsSize() - 1; cell >= 0; --cell) {
223  DetId id = calotower->constituent(cell);
224  if (id.det() == DetId::Hcal) {
225  ret = id;
226  break;
227  }
228  }
229  return ret;
230 }
ret
prodAgent to be discontinued
Definition: DetId.h:17

◆ remove_HF_from_MET()

void CaloSpecificAlgo::remove_HF_from_MET ( CommonMETData met,
double  sumEtInpHF,
double  MExInpHF,
double  MEyInpHF,
double  sumEtInmHF,
double  MExInmHF,
double  MEyInmHF 
)
private

Definition at line 188 of file CaloSpecificAlgo.cc.

References BTaggingMonitor_cfi::met, and mathSSE::sqrt().

194  {
195  met.mex -= (MExInmHF + MExInpHF);
196  met.mey -= (MEyInmHF + MEyInpHF);
197  met.sumet -= (sumEtInpHF + sumEtInmHF);
198  met.met = sqrt(met.mex * met.mex + met.mey * met.mey);
199 }
T sqrt(T t)
Definition: SSEVec.h:19

◆ update_EmEtInEB_EmEtInEE()

void CaloSpecificAlgo::update_EmEtInEB_EmEtInEE ( float &  EmEtInEB,
float &  EmEtInEE,
const CaloTower calotower 
)
private

Definition at line 119 of file CaloSpecificAlgo.cc.

References ewkMuLumiMonitorDQM_cfi::calotower, EcalBarrel, EcalEndcap, DetId::null(), and DetId::subdetId().

119  {
121  if (detIdEcal.null())
122  return;
123 
124  EcalSubdetector subdet = EcalSubdetector(detIdEcal.subdetId());
125  if (subdet == EcalBarrel) {
126  EmEtInEB += calotower->emEt();
127  } else if (subdet == EcalEndcap) {
128  EmEtInEE += calotower->emEt();
129  }
130 }
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
EcalSubdetector
DetId find_DetId_of_ECAL_cell_in_constituent_of(const CaloTower *calotower)

◆ update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF()

void CaloSpecificAlgo::update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF ( float &  HadEtInHB,
float &  HadEtInHE,
float &  HadEtInHO,
float &  HadEtInHF,
float &  EmEtInHF,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 133 of file CaloSpecificAlgo.cc.

References ewkMuLumiMonitorDQM_cfi::calotower, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HLT_2024v11_cff::noHF, DetId::null(), and HcalDetId::subdet().

139  {
141  if (detIdHcal.null())
142  return;
143 
144  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
145  if (subdet == HcalBarrel || subdet == HcalOuter) {
146  HadEtInHB += calotower->hadEt();
147  HadEtInHO += calotower->outerEt();
148  }
149 
150  if (subdet == HcalEndcap) {
151  HadEtInHE += calotower->hadEt();
152  }
153 
154  if (subdet == HcalForward && !noHF) {
155  HadEtInHF += calotower->hadEt();
156  EmEtInHF += calotower->emEt();
157  }
158 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:17

◆ update_MaxTowerEm_MaxTowerHad()

void CaloSpecificAlgo::update_MaxTowerEm_MaxTowerHad ( float &  MaxTowerEm,
float &  MaxTowerHad,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 95 of file CaloSpecificAlgo.cc.

References ewkMuLumiMonitorDQM_cfi::calotower, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HLT_2024v11_cff::noHF, DetId::null(), and HcalDetId::subdet().

98  {
101 
102  if (!detIdHcal.null()) {
103  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
104  if (subdet == HcalBarrel || subdet == HcalOuter || subdet == HcalEndcap || (!noHF && subdet == HcalForward)) {
105  if (calotower->hadEt() > MaxTowerHad)
106  MaxTowerHad = calotower->hadEt();
107  if (calotower->emEt() > MaxTowerEm)
108  MaxTowerEm = calotower->emEt();
109  }
110  }
111 
112  if (!detIdEcal.null()) {
113  if (calotower->emEt() > MaxTowerEm)
114  MaxTowerEm = calotower->emEt();
115  }
116 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:17
DetId find_DetId_of_ECAL_cell_in_constituent_of(const CaloTower *calotower)

◆ update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF()

void CaloSpecificAlgo::update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF ( double &  sumEtInpHF,
double &  MExInpHF,
double &  MEyInpHF,
double &  sumEtInmHF,
double &  MExInmHF,
double &  MEyInmHF,
const CaloTower calotower 
)
private

Definition at line 161 of file CaloSpecificAlgo.cc.

References ewkMuLumiMonitorDQM_cfi::calotower, funct::cos(), HcalForward, DetId::null(), funct::sin(), and HcalDetId::subdet().

167  {
169  if (detIdHcal.null())
170  return;
171 
172  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
173  if (!(subdet == HcalForward))
174  return;
175 
176  if (calotower->eta() >= 0) {
177  sumEtInpHF += calotower->et();
178  MExInpHF -= (calotower->et() * cos(calotower->phi()));
179  MEyInpHF -= (calotower->et() * sin(calotower->phi()));
180  } else {
181  sumEtInmHF += calotower->et();
182  MExInmHF -= (calotower->et() * cos(calotower->phi()));
183  MEyInmHF -= (calotower->et() * sin(calotower->phi()));
184  }
185 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:17

◆ update_totalEt_totalEm()

void CaloSpecificAlgo::update_totalEt_totalEm ( double &  totalEt,
double &  totalEm,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 80 of file CaloSpecificAlgo.cc.

References ewkMuLumiMonitorDQM_cfi::calotower, HcalForward, HLT_2024v11_cff::noHF, DetId::null(), and HcalDetId::subdet().

80  {
81  if (noHF) {
83  if (!detIdHcal.null()) {
84  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
85  if (subdet == HcalForward)
86  return;
87  }
88  }
89 
90  totalEt += calotower->et();
91  totalEm += calotower->emEt();
92 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:17