CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 initializeSpecificCaloMETData (SpecificCaloMETData &specific)
 
void remove_HF_from_MET (CommonMETData &met, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
 
void update_EmEtInEB_EmEtInEE (double &EmEtInEB, double &EmEtInEE, const CaloTower *calotower)
 
void update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF (double &HadEtInHB, double &HadEtInHE, double &HadEtInHO, double &HadEtInHF, double &EmEtInHF, const CaloTower *calotower, bool noHF)
 
void update_MaxTowerEm_MaxTowerHad (double &MaxTowerEm, double &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

Definition at line 44 of file CaloSpecificAlgo.h.

Definition at line 45 of file CaloSpecificAlgo.h.

Member Function Documentation

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

Definition at line 206 of file CaloSpecificAlgo.cc.

References SpecificCaloMETData::CaloMETInmHF, SpecificCaloMETData::CaloMETInpHF, SpecificCaloMETData::CaloMETPhiInmHF, SpecificCaloMETData::CaloMETPhiInpHF, SpecificCaloMETData::CaloSETInmHF, SpecificCaloMETData::CaloSETInpHF, and mathSSE::sqrt().

207 {
208  LorentzVector METpHF(MExInpHF, MEyInpHF, 0, sqrt(MExInpHF*MExInpHF + MEyInpHF*MEyInpHF));
209  LorentzVector METmHF(MExInmHF, MEyInmHF, 0, sqrt(MExInmHF*MExInmHF + MEyInmHF*MEyInmHF));
210  specific.CaloMETInpHF = METpHF.pt();
211  specific.CaloMETInmHF = METmHF.pt();
212  specific.CaloMETPhiInpHF = METpHF.Phi();
213  specific.CaloMETPhiInmHF = METmHF.Phi();
214  specific.CaloSETInpHF = sumEtInpHF;
215  specific.CaloSETInmHF = sumEtInmHF;
216 }
math::XYZTLorentzVector LorentzVector
T sqrt(T t)
Definition: SSEVec.h:48
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 SpecificCaloMETData::EmEtInEB, SpecificCaloMETData::EmEtInEE, SpecificCaloMETData::EmEtInHF, CaloTower::et(), SpecificCaloMETData::EtFractionEm, SpecificCaloMETData::EtFractionHadronic, SpecificCaloMETData::HadEtInHB, SpecificCaloMETData::HadEtInHE, SpecificCaloMETData::HadEtInHF, SpecificCaloMETData::HadEtInHO, SpecificCaloMETData::MaxEtInEmTowers, SpecificCaloMETData::MaxEtInHadTowers, CaloMET_cfi::met, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, p4, timingPdfMaker::specific, and CommonMETData::sumet.

Referenced by cms::CaloMETProducer::produce(), and cms::METProducer::produce_CaloMET().

27 {
30  CommonMETData met = umet;
31  double totalEt = 0.0;
32  double totalEm = 0.0;
33 
34  double sumEtInpHF = 0.0;
35  double sumEtInmHF = 0.0;
36  double MExInpHF = 0.0;
37  double MEyInpHF = 0.0;
38  double MExInmHF = 0.0;
39  double MEyInmHF = 0.0;
40 
41  for(edm::View<Candidate>::const_iterator towerCand = towers->begin(); towerCand != towers->end(); ++towerCand )
42  {
43  const CaloTower* calotower = dynamic_cast<const CaloTower*> (&(*towerCand));
44  if (!calotower) continue;
45  if(calotower->et() < globalThreshold) continue;
46  update_totalEt_totalEm(totalEt, totalEm, calotower, noHF);
47  update_MaxTowerEm_MaxTowerHad(specific.MaxEtInEmTowers, specific.MaxEtInHadTowers, calotower, noHF);
48  update_EmEtInEB_EmEtInEE(specific.EmEtInEB, specific.EmEtInEE, calotower);
49  update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF(specific.HadEtInHB, specific.HadEtInHE, specific.HadEtInHO, specific.HadEtInHF, specific.EmEtInHF, calotower, noHF);
50  update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF(sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF, calotower);
51  }
52 
53  double totalHad = totalEt - totalEm;
54 
55  if(noHF) remove_HF_from_MET(met, sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF);
56 
57  if(!noHF) add_MET_in_HF(specific, sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF);
58 
59  specific.EtFractionHadronic = (totalEt == 0.0)? 0.0 : totalHad/totalEt;
60  specific.EtFractionEm = (totalEt == 0.0)? 0.0 : totalEm/totalEt;
61 
62  const LorentzVector p4( met.mex, met.mey, 0.0, met.met);
63  const Point vtx(0.0, 0.0, 0.0);
64  CaloMET caloMET(specific, met.sumet, p4, vtx);
65  return caloMET;
66 }
void initializeSpecificCaloMETData(SpecificCaloMETData &specific)
dictionary specific
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
void remove_HF_from_MET(CommonMETData &met, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
void update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF(double &HadEtInHB, double &HadEtInHE, double &HadEtInHO, double &HadEtInHF, double &EmEtInHF, const CaloTower *calotower, bool noHF)
void add_MET_in_HF(SpecificCaloMETData &specific, double sumEtInpHF, double MExInpHF, double MEyInpHF, double sumEtInmHF, double MExInmHF, double MEyInmHF)
void update_EmEtInEB_EmEtInEE(double &EmEtInEB, double &EmEtInEE, const CaloTower *calotower)
math::XYZTLorentzVector LorentzVector
void update_MaxTowerEm_MaxTowerHad(double &MaxTowerEm, double &MaxTowerHad, const CaloTower *calotower, bool noHF)
MET made from CaloTowers.
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)
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
const_iterator begin() const
double et(double vtxZ) const
Definition: CaloTower.h:99
const_iterator end() const
DetId CaloSpecificAlgo::find_DetId_of_ECAL_cell_in_constituent_of ( const CaloTower calotower)
private

Definition at line 235 of file CaloSpecificAlgo.cc.

References CaloTower::constituent(), CaloTower::constituentsSize(), DetId::Ecal, and run_regression::ret.

236 {
237  DetId ret;
238  for (int cell = calotower->constituentsSize() - 1; cell >= 0; --cell)
239  {
240  DetId id = calotower->constituent( cell );
241  if( id.det() == DetId::Ecal )
242  {
243  ret = id;
244  break;
245  }
246  }
247  return ret;
248 }
size_t constituentsSize() const
Definition: CaloTower.h:72
DetId constituent(size_t i) const
Definition: CaloTower.h:73
Definition: DetId.h:18
DetId CaloSpecificAlgo::find_DetId_of_HCAL_cell_in_constituent_of ( const CaloTower calotower)
private

Definition at line 219 of file CaloSpecificAlgo.cc.

References CaloTower::constituent(), CaloTower::constituentsSize(), DetId::Hcal, and run_regression::ret.

220 {
221  DetId ret;
222  for (int cell = calotower->constituentsSize() - 1; cell >= 0; --cell)
223  {
224  DetId id = calotower->constituent( cell );
225  if( id.det() == DetId::Hcal )
226  {
227  ret = id;
228  break;
229  }
230  }
231  return ret;
232 }
size_t constituentsSize() const
Definition: CaloTower.h:72
DetId constituent(size_t i) const
Definition: CaloTower.h:73
Definition: DetId.h:18
void CaloSpecificAlgo::initializeSpecificCaloMETData ( SpecificCaloMETData specific)
private

Definition at line 69 of file CaloSpecificAlgo.cc.

References SpecificCaloMETData::CaloMETInmHF, SpecificCaloMETData::CaloMETInpHF, SpecificCaloMETData::CaloMETPhiInmHF, SpecificCaloMETData::CaloMETPhiInpHF, SpecificCaloMETData::CaloSETInmHF, SpecificCaloMETData::CaloSETInpHF, SpecificCaloMETData::EmEtInEB, SpecificCaloMETData::EmEtInEE, SpecificCaloMETData::EmEtInHF, SpecificCaloMETData::EtFractionEm, SpecificCaloMETData::EtFractionHadronic, SpecificCaloMETData::HadEtInHB, SpecificCaloMETData::HadEtInHE, SpecificCaloMETData::HadEtInHF, SpecificCaloMETData::HadEtInHO, SpecificCaloMETData::MaxEtInEmTowers, SpecificCaloMETData::MaxEtInHadTowers, and SpecificCaloMETData::METSignificance.

70 {
71  specific.MaxEtInEmTowers = 0.0; // Maximum energy in EM towers
72  specific.MaxEtInHadTowers = 0.0; // Maximum energy in HCAL towers
73  specific.HadEtInHO = 0.0; // Hadronic energy fraction in HO
74  specific.HadEtInHB = 0.0; // Hadronic energy in HB
75  specific.HadEtInHF = 0.0; // Hadronic energy in HF
76  specific.HadEtInHE = 0.0; // Hadronic energy in HE
77  specific.EmEtInEB = 0.0; // Em energy in EB
78  specific.EmEtInEE = 0.0; // Em energy in EE
79  specific.EmEtInHF = 0.0; // Em energy in HF
80  specific.EtFractionHadronic = 0.0; // Hadronic energy fraction
81  specific.EtFractionEm = 0.0; // Em energy fraction
82  specific.METSignificance = 0.0;
83  specific.CaloMETInpHF = 0.0; // CaloMET in HF+
84  specific.CaloMETInmHF = 0.0; // CaloMET in HF-
85  specific.CaloSETInpHF = 0.0; // CaloSET in HF+
86  specific.CaloSETInmHF = 0.0; // CaloSET in HF-
87  specific.CaloMETPhiInpHF = 0.0; // CaloMET-phi in HF+
88  specific.CaloMETPhiInmHF = 0.0; // CaloMET-phi in HF-
89 }
void CaloSpecificAlgo::remove_HF_from_MET ( CommonMETData met,
double  sumEtInpHF,
double  MExInpHF,
double  MEyInpHF,
double  sumEtInmHF,
double  MExInmHF,
double  MEyInmHF 
)
private

Definition at line 197 of file CaloSpecificAlgo.cc.

References CommonMETData::met, CommonMETData::mex, CommonMETData::mey, mathSSE::sqrt(), and CommonMETData::sumet.

198 {
199  met.mex -= (MExInmHF + MExInpHF);
200  met.mey -= (MEyInmHF + MEyInpHF);
201  met.sumet -= (sumEtInpHF + sumEtInmHF);
202  met.met = sqrt(met.mex*met.mex + met.mey*met.mey);
203 }
T sqrt(T t)
Definition: SSEVec.h:48
void CaloSpecificAlgo::update_EmEtInEB_EmEtInEE ( double &  EmEtInEB,
double &  EmEtInEE,
const CaloTower calotower 
)
private

Definition at line 132 of file CaloSpecificAlgo.cc.

References EcalBarrel, EcalEndcap, CaloTower::emEt(), DetId::null(), and DetId::subdetId().

133 {
134  DetId detIdEcal = find_DetId_of_ECAL_cell_in_constituent_of(calotower);
135  if(detIdEcal.null()) return;
136 
137  EcalSubdetector subdet = EcalSubdetector( detIdEcal.subdetId() );
138  if( subdet == EcalBarrel )
139  {
140  EmEtInEB += calotower->emEt();
141  }
142  else if( subdet == EcalEndcap )
143  {
144  EmEtInEE += calotower->emEt();
145  }
146 }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
bool null() const
is this a null id ?
Definition: DetId.h:45
EcalSubdetector
double emEt() const
Definition: CaloTower.h:82
DetId find_DetId_of_ECAL_cell_in_constituent_of(const CaloTower *calotower)
void CaloSpecificAlgo::update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF ( double &  HadEtInHB,
double &  HadEtInHE,
double &  HadEtInHO,
double &  HadEtInHF,
double &  EmEtInHF,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 149 of file CaloSpecificAlgo.cc.

References CaloTower::emEt(), CaloTower::hadEt(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, DetId::null(), CaloTower::outerEt(), and HcalDetId::subdet().

150 {
151  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
152  if(detIdHcal.null()) return;
153 
154  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
155  if( subdet == HcalBarrel || subdet == HcalOuter )
156  {
157  HadEtInHB += calotower->hadEt();
158  HadEtInHO += calotower->outerEt();
159  }
160 
161  if( subdet == HcalEndcap )
162  {
163  HadEtInHE += calotower->hadEt();
164  }
165 
166  if( subdet == HcalForward && !noHF)
167  {
168  HadEtInHF += calotower->hadEt();
169  EmEtInHF += calotower->emEt();
170  }
171 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:30
double hadEt() const
Definition: CaloTower.h:83
double outerEt() const
Definition: CaloTower.h:84
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:18
bool null() const
is this a null id ?
Definition: DetId.h:45
double emEt() const
Definition: CaloTower.h:82
void CaloSpecificAlgo::update_MaxTowerEm_MaxTowerHad ( double &  MaxTowerEm,
double &  MaxTowerHad,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 109 of file CaloSpecificAlgo.cc.

References CaloTower::emEt(), CaloTower::hadEt(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, DetId::null(), and HcalDetId::subdet().

110 {
111  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
112  DetId detIdEcal = find_DetId_of_ECAL_cell_in_constituent_of(calotower);
113 
114  if( !detIdHcal.null() )
115  {
116  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
117  if( subdet == HcalBarrel || subdet == HcalOuter || subdet == HcalEndcap || (!noHF && subdet == HcalForward))
118  {
119  if( calotower->hadEt() > MaxTowerHad ) MaxTowerHad = calotower->hadEt();
120  if( calotower->emEt() > MaxTowerEm ) MaxTowerEm = calotower->emEt();
121  }
122 
123  }
124 
125  if( !detIdEcal.null() )
126  {
127  if( calotower->emEt() > MaxTowerEm ) MaxTowerEm = calotower->emEt();
128  }
129 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:30
double hadEt() const
Definition: CaloTower.h:83
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:18
bool null() const
is this a null id ?
Definition: DetId.h:45
double emEt() const
Definition: CaloTower.h:82
DetId find_DetId_of_ECAL_cell_in_constituent_of(const CaloTower *calotower)
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 174 of file CaloSpecificAlgo.cc.

References funct::cos(), CaloTower::et(), reco::LeafCandidate::eta(), HcalForward, DetId::null(), reco::LeafCandidate::phi(), funct::sin(), and HcalDetId::subdet().

175 {
176  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
177  if(detIdHcal.null()) return;
178 
179  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
180  if( !(subdet == HcalForward) ) return;
181 
182  if (calotower->eta() >= 0)
183  {
184  sumEtInpHF += calotower->et();
185  MExInpHF -= (calotower->et() * cos(calotower->phi()));
186  MEyInpHF -= (calotower->et() * sin(calotower->phi()));
187  }
188  else
189  {
190  sumEtInmHF += calotower->et();
191  MExInmHF -= (calotower->et() * cos(calotower->phi()));
192  MEyInmHF -= (calotower->et() * sin(calotower->phi()));
193  }
194 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:30
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HcalSubdetector
Definition: HcalAssistant.h:31
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
Definition: DetId.h:18
bool null() const
is this a null id ?
Definition: DetId.h:45
double et(double vtxZ) const
Definition: CaloTower.h:99
void CaloSpecificAlgo::update_totalEt_totalEm ( double &  totalEt,
double &  totalEm,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 92 of file CaloSpecificAlgo.cc.

References CaloTower::emEt(), CaloTower::et(), HcalForward, DetId::null(), and HcalDetId::subdet().

93 {
94  if( noHF )
95  {
96  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
97  if(!detIdHcal.null())
98  {
99  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
100  if( subdet == HcalForward ) return;
101  }
102  }
103 
104  totalEt += calotower->et();
105  totalEm += calotower->emEt();
106 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:30
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:18
bool null() const
is this a null id ?
Definition: DetId.h:45
double et(double vtxZ) const
Definition: CaloTower.h:99
double emEt() const
Definition: CaloTower.h:82