test
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 Member Functions | Private Attributes
SignCaloSpecificAlgo Class Reference

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

Public Member Functions

void calculateBaseCaloMET (edm::Handle< edm::View< reco::Candidate > > towers, const CommonMETData &met, const metsig::SignAlgoResolutions &resolutions, bool noHF, double globalthreshold)
 
double getSignificance ()
 
reco::METCovMatrix getSignificanceMatrix () const
 
 SignCaloSpecificAlgo ()
 
void usePreviousSignif (const std::vector< double > &values)
 
void usePreviousSignif (const reco::METCovMatrix &matrix)
 
 ~SignCaloSpecificAlgo ()
 

Private Member Functions

std::vector< metsig::SigInputObjmakeVectorOutOfCaloTowers (edm::Handle< edm::View< reco::Candidate > > towers, const metsig::SignAlgoResolutions &resolutions, bool noHF, double globalthreshold)
 

Private Attributes

reco::METCovMatrix matrix_
 
double significance_
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 34 of file SignCaloSpecificAlgo.h.

Constructor & Destructor Documentation

SignCaloSpecificAlgo::SignCaloSpecificAlgo ( )

Definition at line 25 of file SignCaloSpecificAlgo.cc.

References matrix_.

25  :
26  significance_(0.)
27 {
28  matrix_(0,0)=matrix_(1,0)=matrix_(0,1)=matrix_(1,1)=0.;
29 }
reco::METCovMatrix matrix_
SignCaloSpecificAlgo::~SignCaloSpecificAlgo ( )

Definition at line 30 of file SignCaloSpecificAlgo.cc.

31 {
32 }

Member Function Documentation

void SignCaloSpecificAlgo::calculateBaseCaloMET ( edm::Handle< edm::View< reco::Candidate > >  towers,
const CommonMETData met,
const metsig::SignAlgoResolutions resolutions,
bool  noHF,
double  globalthreshold 
)

Definition at line 150 of file SignCaloSpecificAlgo.cc.

References metsig::significanceAlgo::addObjects(), metsig::significanceAlgo::addSignifMatrix(), metsig::significanceAlgo::getSignifMatrix(), makeVectorOutOfCaloTowers(), matrix_, metsig::significanceAlgo::significance(), significance_, and HLT_25ns10e33_v2_cff::towers.

151 {
152 
153  //retreive calo tower information from candidates
154  //start with the first element of the candidate list
155 
156 
157 
158  // use this container to calculate the significance. SigInputObj are objects that contain both directional and uncertainty information and are used as input to the significance calculation
159 
160  std::vector<metsig::SigInputObj> signInputVec = makeVectorOutOfCaloTowers(towers, resolutions, noHF, globalThreshold);
161 
162  // now run the significance algorithm.
163 
164  double sign_calo_met_total=0;
165  double sign_calo_met_phi=0;
166  double sign_calo_met_set=0;
167  metsig::significanceAlgo signifalgo;
168  // check the caloMET, if significance was already run continue with the matrix that is stored..
169  signifalgo.addSignifMatrix(matrix_);
170  signifalgo.addObjects(signInputVec);
171  matrix_=signifalgo.getSignifMatrix();
172  significance_ = signifalgo.significance( sign_calo_met_total, sign_calo_met_phi, sign_calo_met_set);
173  // cleanup everything:
174  signInputVec.clear();
175  // and return
176 }
const void addObjects(const std::vector< metsig::SigInputObj > &EventVec)
std::vector< metsig::SigInputObj > makeVectorOutOfCaloTowers(edm::Handle< edm::View< reco::Candidate > > towers, const metsig::SignAlgoResolutions &resolutions, bool noHF, double globalthreshold)
const double significance(double &met_r, double &met_phi, double &met_set)
reco::METCovMatrix matrix_
const void addSignifMatrix(const reco::METCovMatrix &input)
reco::METCovMatrix getSignifMatrix() const
double SignCaloSpecificAlgo::getSignificance ( )
inline

Definition at line 43 of file SignCaloSpecificAlgo.h.

References significance_.

43 {return significance_;}
reco::METCovMatrix SignCaloSpecificAlgo::getSignificanceMatrix ( void  ) const
inline

Definition at line 44 of file SignCaloSpecificAlgo.h.

References matrix_.

44 {return matrix_;}
reco::METCovMatrix matrix_
std::vector< metsig::SigInputObj > SignCaloSpecificAlgo::makeVectorOutOfCaloTowers ( edm::Handle< edm::View< reco::Candidate > >  towers,
const metsig::SignAlgoResolutions resolutions,
bool  noHF,
double  globalthreshold 
)
private

Definition at line 49 of file SignCaloSpecificAlgo.cc.

References metsig::caloEB, metsig::caloEE, metsig::caloHB, metsig::caloHE, metsig::caloHF, metsig::caloHO, CaloTower::constituent(), CaloTower::constituentsSize(), DetId::Ecal, EcalBarrel, EcalEndcap, CaloTower::emEt(), metsig::ET, CaloTower::et(), reco::LeafCandidate::eta(), CaloTower::hadEt(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, CaloTower::outerEt(), metsig::PHI, reco::LeafCandidate::phi(), AlCaHLTBitMon_QueryRunRegistry::string, HcalDetId::subdet(), groupFilesInBlocks::temp, and HLT_25ns10e33_v2_cff::towers.

Referenced by calculateBaseCaloMET().

50 {
51 
52  edm::View<Candidate>::const_iterator towerCand = towers->begin();
53  std::vector<metsig::SigInputObj> signInputVec;
54  //iterate over all CaloTowers and record information
55  for( ; towerCand != towers->end(); towerCand++ ) {
56  const Candidate *candidate = &(*towerCand);
57  if(candidate){
58  const CaloTower * calotower = dynamic_cast<const CaloTower*> (candidate);
59  if(calotower){
60  double sign_tower_et = calotower->et();
61  if(sign_tower_et<globalThreshold)
62  continue;
63  bool wasused=false;
64  double sign_tower_phi = calotower->phi();
65  double sign_tower_sigma_et = 0;
66  double sign_tower_sigma_phi = 0;
67  std::string sign_tower_type = "";
68 
69  bool hadIsDone = false;
70  bool emIsDone = false;
71  int cell = calotower->constituentsSize();
72 
73  while ( --cell >= 0 && (!hadIsDone || !emIsDone) )
74  {
75  DetId id = calotower->constituent( cell );
76  if( !hadIsDone && id.det() == DetId::Hcal )
77  {
78  HcalSubdetector subdet = HcalDetId(id).subdet();
79  if(subdet == HcalBarrel){
80  sign_tower_type = "hadcalotower";
81  sign_tower_et = calotower->hadEt();
82  sign_tower_sigma_et = resolutions.eval(metsig::caloHB,metsig::ET,sign_tower_et,calotower->phi(),calotower->eta());
83  sign_tower_sigma_phi = resolutions.eval(metsig::caloHB,metsig::PHI,sign_tower_et,calotower->phi(),calotower->eta());
84  }
85  else if(subdet==HcalOuter){
86  sign_tower_type = "hadcalotower";
87  sign_tower_et = calotower->outerEt();
88  sign_tower_sigma_et = resolutions.eval(metsig::caloHO,metsig::ET,sign_tower_et,calotower->phi(),calotower->eta());
89  sign_tower_sigma_phi = resolutions.eval(metsig::caloHO,metsig::PHI,sign_tower_et,calotower->phi(),calotower->eta());
90  }
91  else if(subdet==HcalEndcap){
92  sign_tower_type = "hadcalotower";
93  sign_tower_et = calotower->hadEt();
94  sign_tower_sigma_et = resolutions.eval(metsig::caloHE,metsig::ET,sign_tower_et,calotower->phi(),calotower->eta());
95  sign_tower_sigma_phi = resolutions.eval(metsig::caloHE,metsig::PHI,sign_tower_et,calotower->phi(),calotower->eta());
96  }
97  else if(subdet == HcalForward){
98  sign_tower_type = "hadcalotower";
99  sign_tower_et = calotower->et();
100  sign_tower_sigma_et = resolutions.eval(metsig::caloHF,metsig::ET,sign_tower_et,calotower->phi(),calotower->eta());
101  sign_tower_sigma_phi = resolutions.eval(metsig::caloHF,metsig::PHI,sign_tower_et,calotower->phi(),calotower->eta());
102  }
103  else{
104  edm::LogWarning("SignCaloSpecificAlgo") << " HCAL tower cell not assigned to an HCAL subdetector!!!" << std::endl;
105  }
106  // and book!
107  metsig::SigInputObj temp(sign_tower_type,sign_tower_et,sign_tower_phi,sign_tower_sigma_et,sign_tower_sigma_phi);
108  if(!noHF || subdet !=HcalForward)
109  signInputVec.push_back(temp);
110 
111  wasused=1;
112  hadIsDone = true;
113  }
114  else if( !emIsDone && id.det() == DetId::Ecal )
115  {
116  EcalSubdetector subdet = EcalSubdetector( id.subdetId() );
117 
118  if(subdet == EcalBarrel){
119  sign_tower_type = "emcalotower";
120  sign_tower_et = calotower->emEt();
121  sign_tower_sigma_et = resolutions.eval(metsig::caloEB,metsig::ET,sign_tower_et,calotower->phi(),calotower->eta());
122  sign_tower_sigma_phi = resolutions.eval(metsig::caloEB,metsig::PHI,sign_tower_et,calotower->phi(),calotower->eta());
123  }
124  else if(subdet == EcalEndcap ){
125  sign_tower_type = "emcalotower";
126  sign_tower_et = calotower->emEt();
127  sign_tower_sigma_et = resolutions.eval(metsig::caloEE,metsig::ET,sign_tower_et,calotower->phi(),calotower->eta());
128  sign_tower_sigma_phi = resolutions.eval(metsig::caloEE,metsig::PHI,sign_tower_et,calotower->phi(),calotower->eta());
129 
130  }
131  else{
132  edm::LogWarning("SignCaloSpecificAlgo") << " ECAL tower cell not assigned to an ECAL subdetector!!!" << std::endl;
133  }
134  metsig::SigInputObj temp(sign_tower_type,sign_tower_et,sign_tower_phi,sign_tower_sigma_et,sign_tower_sigma_phi);
135  signInputVec.push_back(temp);
136  wasused=1;
137  emIsDone = true;
138  }
139  }
140  if(wasused==0)
141  edm::LogWarning("SignCaloSpecificAlgo") << "found non-assigned cell, " << std::endl;
142  }
143  }
144  }
145  return signInputVec;
146 }
size_t constituentsSize() const
Definition: CaloTower.h:102
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
DetId constituent(size_t i) const
Definition: CaloTower.h:103
double hadEt() const
Definition: CaloTower.h:113
double outerEt() const
Definition: CaloTower.h:114
virtual double phi() const final
momentum azimuthal angle
double eval(const resolutionType &type, const resolutionFunc &func, const double &et, const double &phi, const double &eta, const double &p) const
const_iterator begin() const
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:18
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
double et(double vtxZ) const
Definition: CaloTower.h:129
const_iterator end() const
virtual double eta() const final
momentum pseudorapidity
EcalSubdetector
double emEt() const
Definition: CaloTower.h:112
void SignCaloSpecificAlgo::usePreviousSignif ( const std::vector< double > &  values)

Definition at line 34 of file SignCaloSpecificAlgo.cc.

References matrix_.

35 {
36  if(values.size()!=4)
37  return;
38  matrix_(0,0)=values[0];
39  matrix_(0,1)=values[1];
40  matrix_(1,0)=values[2];
41  matrix_(1,1)=values[3];
42  return;
43 }
reco::METCovMatrix matrix_
void SignCaloSpecificAlgo::usePreviousSignif ( const reco::METCovMatrix matrix)
inline

Member Data Documentation

reco::METCovMatrix SignCaloSpecificAlgo::matrix_
private
double SignCaloSpecificAlgo::significance_
private

Definition at line 52 of file SignCaloSpecificAlgo.h.

Referenced by calculateBaseCaloMET(), and getSignificance().