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.

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 }

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

◆ 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.

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 }

References slimmedMETs_cfi::caloMET, ewkMuLumiMonitorDQM_cfi::calotower, distPFMET_cfi::globalThreshold, BTaggingMonitor_cfi::met, HLT_2018_cff::noHF, p4, timingPdfMaker::specific, HLT_2018_cff::towers, and badGlobalMuonTaggersAOD_cff::vtx.

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

◆ 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.

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 }

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

◆ 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.

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 }

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

◆ 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.

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 }

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

◆ update_EmEtInEB_EmEtInEE()

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

Definition at line 119 of file CaloSpecificAlgo.cc.

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 }

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

◆ 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.

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 }

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

◆ 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.

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 }

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

◆ 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.

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 }

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

◆ 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.

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 }

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

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
CaloSpecificAlgo::update_totalEt_totalEm
void update_totalEt_totalEm(double &totalEt, double &totalEm, const CaloTower *calotower, bool noHF)
Definition: CaloSpecificAlgo.cc:80
DetId::Hcal
Definition: DetId.h:28
ewkMuLumiMonitorDQM_cfi.calotower
calotower
Definition: ewkMuLumiMonitorDQM_cfi.py:36
DetId::null
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
EcalSubdetector
EcalSubdetector
Definition: EcalSubdetector.h:10
CommonMETData
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
HcalBarrel
Definition: HcalAssistant.h:33
EcalBarrel
Definition: EcalSubdetector.h:10
slimmedMETs_cfi.caloMET
caloMET
Definition: slimmedMETs_cfi.py:17
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::CaloMET
Definition: CaloMET.h:21
DetId
Definition: DetId.h:17
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CaloSpecificAlgo::update_MaxTowerEm_MaxTowerHad
void update_MaxTowerEm_MaxTowerHad(float &MaxTowerEm, float &MaxTowerHad, const CaloTower *calotower, bool noHF)
Definition: CaloSpecificAlgo.cc:95
timingPdfMaker.specific
specific
Definition: timingPdfMaker.py:78
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HcalOuter
Definition: HcalAssistant.h:35
HLT_2018_cff.noHF
noHF
Definition: HLT_2018_cff.py:48522
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
CaloSpecificAlgo::add_MET_in_HF
void add_MET_in_HF(SpecificCaloMETData &specific, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
Definition: CaloSpecificAlgo.cc:202
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
EcalEndcap
Definition: EcalSubdetector.h:10
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
CaloSpecificAlgo::find_DetId_of_ECAL_cell_in_constituent_of
DetId find_DetId_of_ECAL_cell_in_constituent_of(const CaloTower *calotower)
Definition: CaloSpecificAlgo.cc:233
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
distPFMET_cfi.globalThreshold
globalThreshold
Definition: distPFMET_cfi.py:16
HcalDetId
Definition: HcalDetId.h:12
CaloTower
Definition: CaloTower.h:26
p4
double p4[4]
Definition: TauolaWrapper.h:92
SpecificCaloMETData
Definition: SpecificCaloMETData.h:22
DetId::Ecal
Definition: DetId.h:27
CaloSpecificAlgo::remove_HF_from_MET
void remove_HF_from_MET(CommonMETData &met, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
Definition: CaloSpecificAlgo.cc:188
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalForward
Definition: HcalAssistant.h:36
HLT_2018_cff.towers
towers
Definition: HLT_2018_cff.py:35030
CaloSpecificAlgo::find_DetId_of_HCAL_cell_in_constituent_of
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
Definition: CaloSpecificAlgo.cc:220
HcalEndcap
Definition: HcalAssistant.h:34
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
LorentzVector
math::XYZTLorentzVector LorentzVector
Definition: HLTMuonMatchAndPlot.h:49
CaloSpecificAlgo::update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF
void update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF(double &sumEtInpHF, double &MExInpHF, double &MEyInpHF, double &sumEtInmHF, double &MExInmHF, double &MEyInmHF, const CaloTower *calotower)
Definition: CaloSpecificAlgo.cc:161
CaloSpecificAlgo::update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF
void update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF(float &HadEtInHB, float &HadEtInHE, float &HadEtInHO, float &HadEtInHF, float &EmEtInHF, const CaloTower *calotower, bool noHF)
Definition: CaloSpecificAlgo.cc:133
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
CaloSpecificAlgo::update_EmEtInEB_EmEtInEE
void update_EmEtInEB_EmEtInEE(float &EmEtInEB, float &EmEtInEE, const CaloTower *calotower)
Definition: CaloSpecificAlgo.cc:119