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, 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 38 of file CaloSpecificAlgo.h.

Member Typedef Documentation

Definition at line 45 of file CaloSpecificAlgo.h.

Definition at line 46 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 207 of file CaloSpecificAlgo.cc.

References SpecificCaloMETData::CaloMETInmHF, SpecificCaloMETData::CaloMETInpHF, SpecificCaloMETData::CaloMETPhiInmHF, SpecificCaloMETData::CaloMETPhiInpHF, SpecificCaloMETData::CaloSETInmHF, SpecificCaloMETData::CaloSETInpHF, 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 }
math::XYZTLorentzVector LorentzVector
T sqrt(T t)
Definition: SSEVec.h:48
reco::CaloMET CaloSpecificAlgo::addInfo ( edm::Handle< edm::View< reco::Candidate > >  towers,
CommonMETData  met,
bool  noHF,
double  globalThreshold 
)

Definition at line 27 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, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, p4, timingPdfMaker::specific, and CommonMETData::sumet.

Referenced by cms::METProducer::produce_CaloMET().

28 {
31 
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  {
44  const CaloTower* calotower = dynamic_cast<const CaloTower*> (&(*towerCand));
45  if (!calotower) continue;
46  if(calotower->et() < globalThreshold) continue;
47  update_totalEt_totalEm(totalEt, totalEm, calotower, noHF);
48  update_MaxTowerEm_MaxTowerHad(specific.MaxEtInEmTowers, specific.MaxEtInHadTowers, calotower, noHF);
49  update_EmEtInEB_EmEtInEE(specific.EmEtInEB, specific.EmEtInEE, calotower);
50  update_HadEtInHB_HadEtInHE_HadEtInHO_HadEtInHF_EmEtInHF(specific.HadEtInHB, specific.HadEtInHE, specific.HadEtInHO, specific.HadEtInHF, specific.EmEtInHF, calotower, noHF);
51  update_sumEtInpHF_MExInpHF_MEyInpHF_sumEtInmHF_MExInmHF_MEyInmHF(sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF, calotower);
52  }
53 
54  double totalHad = totalEt - totalEm;
55 
56  if(noHF) remove_HF_from_MET(met, sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF);
57 
58  if(!noHF) add_MET_in_HF(specific, sumEtInpHF, MExInpHF, MEyInpHF, sumEtInmHF, MExInmHF, MEyInmHF);
59 
60  specific.EtFractionHadronic = (totalEt == 0.0)? 0.0 : totalHad/totalEt;
61  specific.EtFractionEm = (totalEt == 0.0)? 0.0 : totalEm/totalEt;
62 
63  const LorentzVector p4( met.mex, met.mey, 0.0, met.met);
64  const Point vtx(0.0, 0.0, 0.0);
65  CaloMET caloMET(specific, met.sumet, p4, vtx);
66  return caloMET;
67 }
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
double et(double vtxZ) const
Definition: CaloTower.h:101
DetId CaloSpecificAlgo::find_DetId_of_ECAL_cell_in_constituent_of ( const CaloTower calotower)
private

Definition at line 236 of file CaloSpecificAlgo.cc.

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

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

Definition at line 220 of file CaloSpecificAlgo.cc.

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

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

Definition at line 70 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.

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

Definition at line 198 of file CaloSpecificAlgo.cc.

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

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

Definition at line 133 of file CaloSpecificAlgo.cc.

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

134 {
135  DetId detIdEcal = find_DetId_of_ECAL_cell_in_constituent_of(calotower);
136  if(detIdEcal.null()) return;
137 
138  EcalSubdetector subdet = EcalSubdetector( detIdEcal.subdetId() );
139  if( subdet == EcalBarrel )
140  {
141  EmEtInEB += calotower->emEt();
142  }
143  else if( subdet == EcalEndcap )
144  {
145  EmEtInEE += calotower->emEt();
146  }
147 }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
bool null() const
is this a null id ?
Definition: DetId.h:47
EcalSubdetector
double emEt() const
Definition: CaloTower.h:84
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 150 of file CaloSpecificAlgo.cc.

References CaloTower::emEt(), CaloTower::hadEt(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, DetId::null(), CaloTower::outerEt(), 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 == HcalBarrel || subdet == HcalOuter )
157  {
158  HadEtInHB += calotower->hadEt();
159  HadEtInHO += calotower->outerEt();
160  }
161 
162  if( subdet == HcalEndcap )
163  {
164  HadEtInHE += calotower->hadEt();
165  }
166 
167  if( subdet == HcalForward && !noHF)
168  {
169  HadEtInHF += calotower->hadEt();
170  EmEtInHF += calotower->emEt();
171  }
172 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
double hadEt() const
Definition: CaloTower.h:85
double outerEt() const
Definition: CaloTower.h:86
HcalSubdetector
Definition: HcalAssistant.h:32
Definition: DetId.h:20
bool null() const
is this a null id ?
Definition: DetId.h:47
double emEt() const
Definition: CaloTower.h:84
void CaloSpecificAlgo::update_MaxTowerEm_MaxTowerHad ( double &  MaxTowerEm,
double &  MaxTowerHad,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 110 of file CaloSpecificAlgo.cc.

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

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

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

176 {
177  DetId detIdHcal = find_DetId_of_HCAL_cell_in_constituent_of(calotower);
178  if(detIdHcal.null()) return;
179 
180  HcalSubdetector subdet = HcalDetId(detIdHcal).subdet();
181  if( !(subdet == HcalForward) ) return;
182 
183  if (calotower->eta() >= 0)
184  {
185  sumEtInpHF += calotower->et();
186  MExInpHF -= (calotower->et() * cos(calotower->phi()));
187  MEyInpHF -= (calotower->et() * sin(calotower->phi()));
188  }
189  else
190  {
191  sumEtInmHF += calotower->et();
192  MExInmHF -= (calotower->et() * cos(calotower->phi()));
193  MEyInmHF -= (calotower->et() * sin(calotower->phi()));
194  }
195 }
DetId find_DetId_of_HCAL_cell_in_constituent_of(const CaloTower *calotower)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
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:32
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
Definition: DetId.h:20
bool null() const
is this a null id ?
Definition: DetId.h:47
double et(double vtxZ) const
Definition: CaloTower.h:101
void CaloSpecificAlgo::update_totalEt_totalEm ( double &  totalEt,
double &  totalEm,
const CaloTower calotower,
bool  noHF 
)
private

Definition at line 93 of file CaloSpecificAlgo.cc.

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

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