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

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 182 of file CaloSpecificAlgo.cc.

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

183 {
184  LorentzVector METpHF(MExInpHF, MEyInpHF, 0, sqrt(MExInpHF*MExInpHF + MEyInpHF*MEyInpHF));
185  LorentzVector METmHF(MExInmHF, MEyInmHF, 0, sqrt(MExInmHF*MExInmHF + MEyInmHF*MEyInmHF));
186  specific.CaloMETInpHF = METpHF.pt();
187  specific.CaloMETInmHF = METmHF.pt();
188  specific.CaloMETPhiInpHF = METpHF.Phi();
189  specific.CaloMETPhiInmHF = METmHF.Phi();
190  specific.CaloSETInpHF = sumEtInpHF;
191  specific.CaloSETInmHF = sumEtInmHF;
192 }
T sqrt(T t)
Definition: SSEVec.h:48
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > LorentzVector
Definition: analysisEnums.h:9
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, HLT_25ns14e33_v1_cff::globalThreshold, SpecificCaloMETData::HadEtInHB, SpecificCaloMETData::HadEtInHE, SpecificCaloMETData::HadEtInHF, SpecificCaloMETData::HadEtInHO, SpecificCaloMETData::MaxEtInEmTowers, SpecificCaloMETData::MaxEtInHadTowers, caloMETBenchmarkGeneric_cfi::met, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, p4, timingPdfMaker::specific, CommonMETData::sumet, and HLT_25ns14e33_v1_cff::towers.

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

27 {
29  CommonMETData met = umet;
30  double totalEt = 0.0;
31  double totalEm = 0.0;
32 
33  double sumEtInpHF = 0.0;
34  double sumEtInmHF = 0.0;
35  double MExInpHF = 0.0;
36  double MEyInpHF = 0.0;
37  double MExInmHF = 0.0;
38  double MEyInmHF = 0.0;
39 
40  for(edm::View<Candidate>::const_iterator towerCand = towers->begin(); towerCand != towers->end(); ++towerCand )
41  {
42  const CaloTower* calotower = dynamic_cast<const CaloTower*> (&(*towerCand));
43  if (!calotower) continue;
44  if(calotower->et() < globalThreshold) continue;
45  update_totalEt_totalEm(totalEt, totalEm, calotower, noHF);
47  update_EmEtInEB_EmEtInEE(specific.EmEtInEB, specific.EmEtInEE, calotower);
48  update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF(specific.HadEtInHB, specific.HadEtInHE, specific.HadEtInHO, specific.HadEtInHF, specific.EmEtInHF, calotower, noHF);
49  update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF(sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF, calotower);
50  }
51 
52  double totalHad = totalEt - totalEm;
53 
54  if(noHF) remove_HF_from_MET(met, sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF);
55 
56  if(!noHF) add_MET_in_HF(specific, sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF);
57 
58  specific.EtFractionHadronic = (totalEt == 0.0)? 0.0 : totalHad/totalEt;
59  specific.EtFractionEm = (totalEt == 0.0)? 0.0 : totalEm/totalEt;
60 
61  const LorentzVector p4( met.mex, met.mey, 0.0, met.met);
62  const Point vtx(0.0, 0.0, 0.0);
63  CaloMET caloMET(specific, met.sumet, p4, vtx);
64  return caloMET;
65 }
dictionary specific
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)
const_iterator begin() const
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
void update_MaxTowerEm_MaxTowerHad(float &MaxTowerEm, float &MaxTowerHad, const CaloTower *calotower, bool noHF)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > LorentzVector
Definition: analysisEnums.h:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
double et(double vtxZ) const
Definition: CaloTower.h:116
const_iterator end() const
DetId CaloSpecificAlgo::find_DetId_of_ECAL_cell_in_constituent_of ( const CaloTower calotower)
private

Definition at line 211 of file CaloSpecificAlgo.cc.

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

212 {
213  DetId ret;
214  for (int cell = calotower->constituentsSize() - 1; cell >= 0; --cell)
215  {
216  DetId id = calotower->constituent( cell );
217  if( id.det() == DetId::Ecal )
218  {
219  ret = id;
220  break;
221  }
222  }
223  return ret;
224 }
size_t constituentsSize() const
Definition: CaloTower.h:89
DetId constituent(size_t i) const
Definition: CaloTower.h:90
Definition: DetId.h:18
DetId CaloSpecificAlgo::find_DetId_of_HCAL_cell_in_constituent_of ( const CaloTower calotower)
private

Definition at line 195 of file CaloSpecificAlgo.cc.

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

196 {
197  DetId ret;
198  for (int cell = calotower->constituentsSize() - 1; cell >= 0; --cell)
199  {
200  DetId id = calotower->constituent( cell );
201  if( id.det() == DetId::Hcal )
202  {
203  ret = id;
204  break;
205  }
206  }
207  return ret;
208 }
size_t constituentsSize() const
Definition: CaloTower.h:89
DetId constituent(size_t i) const
Definition: CaloTower.h:90
Definition: DetId.h:18
void CaloSpecificAlgo::remove_HF_from_MET ( CommonMETData met,
double  sumEtInpHF,
double  MExInpHF,
double  MEyInpHF,
double  sumEtInmHF,
double  MExInmHF,
double  MEyInmHF 
)
private

Definition at line 173 of file CaloSpecificAlgo.cc.

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

174 {
175  met.mex -= (MExInmHF + MExInpHF);
176  met.mey -= (MEyInmHF + MEyInpHF);
177  met.sumet -= (sumEtInpHF + sumEtInmHF);
178  met.met = sqrt(met.mex*met.mex + met.mey*met.mey);
179 }
T sqrt(T t)
Definition: SSEVec.h:48
void CaloSpecificAlgo::update_EmEtInEB_EmEtInEE ( float &  EmEtInEB,
float &  EmEtInEE,
const CaloTower calotower 
)
private

Definition at line 108 of file CaloSpecificAlgo.cc.

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

109 {
110  DetId detIdEcal = find_DetId_of_ECAL_cell_in_constituent_of(calotower);
111  if(detIdEcal.null()) return;
112 
113  EcalSubdetector subdet = EcalSubdetector( detIdEcal.subdetId() );
114  if( subdet == EcalBarrel )
115  {
116  EmEtInEB += calotower->emEt();
117  }
118  else if( subdet == EcalEndcap )
119  {
120  EmEtInEE += calotower->emEt();
121  }
122 }
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:99
DetId find_DetId_of_ECAL_cell_in_constituent_of(const CaloTower *calotower)
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 125 of file CaloSpecificAlgo.cc.

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

126 {
127  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
128  if(detIdHcal.null()) return;
129 
130  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
131  if( subdet == HcalBarrel || subdet == HcalOuter )
132  {
133  HadEtInHB += calotower->hadEt();
134  HadEtInHO += calotower->outerEt();
135  }
136 
137  if( subdet == HcalEndcap )
138  {
139  HadEtInHE += calotower->hadEt();
140  }
141 
142  if( subdet == HcalForward && !noHF)
143  {
144  HadEtInHF += calotower->hadEt();
145  EmEtInHF += calotower->emEt();
146  }
147 }
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:100
double outerEt() const
Definition: CaloTower.h:101
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:99
void CaloSpecificAlgo::update_MaxTowerEm_MaxTowerHad ( float &  MaxTowerEm,
float &  MaxTowerHad,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 85 of file CaloSpecificAlgo.cc.

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

86 {
87  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
88  DetId detIdEcal = find_DetId_of_ECAL_cell_in_constituent_of(calotower);
89 
90  if( !detIdHcal.null() )
91  {
92  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
93  if( subdet == HcalBarrel || subdet == HcalOuter || subdet == HcalEndcap || (!noHF && subdet == HcalForward))
94  {
95  if( calotower->hadEt() > MaxTowerHad ) MaxTowerHad = calotower->hadEt();
96  if( calotower->emEt() > MaxTowerEm ) MaxTowerEm = calotower->emEt();
97  }
98 
99  }
100 
101  if( !detIdEcal.null() )
102  {
103  if( calotower->emEt() > MaxTowerEm ) MaxTowerEm = calotower->emEt();
104  }
105 }
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:100
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:99
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 150 of file CaloSpecificAlgo.cc.

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

151 {
152  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
153  if(detIdHcal.null()) return;
154 
155  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
156  if( !(subdet == HcalForward) ) return;
157 
158  if (calotower->eta() >= 0)
159  {
160  sumEtInpHF += calotower->et();
161  MExInpHF -= (calotower->et() * cos(calotower->phi()));
162  MEyInpHF -= (calotower->et() * sin(calotower->phi()));
163  }
164  else
165  {
166  sumEtInmHF += calotower->et();
167  MExInmHF -= (calotower->et() * cos(calotower->phi()));
168  MEyInmHF -= (calotower->et() * sin(calotower->phi()));
169  }
170 }
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 double eta() const
momentum pseudorapidity
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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:116
virtual double phi() const
momentum azimuthal angle
void CaloSpecificAlgo::update_totalEt_totalEm ( double &  totalEt,
double &  totalEm,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 68 of file CaloSpecificAlgo.cc.

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

69 {
70  if( noHF )
71  {
72  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
73  if(!detIdHcal.null())
74  {
75  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
76  if( subdet == HcalForward ) return;
77  }
78  }
79 
80  totalEt += calotower->et();
81  totalEm += calotower->emEt();
82 }
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:116
double emEt() const
Definition: CaloTower.h:99