CMS 3D CMS Logo

HGCalMulticluster.h
Go to the documentation of this file.
1 #ifndef DataFormats_L1Trigger_HGCalMulticluster_h
2 #define DataFormats_L1Trigger_HGCalMulticluster_h
3 
8 #include <boost/iterator/transform_iterator.hpp>
9 #include <functional>
10 
11 namespace l1t {
12 
13  class HGCalMulticluster : public HGCalClusterT<l1t::HGCalCluster> {
14  public:
16  HGCalMulticluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0);
17 
19 
20  ~HGCalMulticluster() override;
21 
22  float hOverE() const {
23  // --- this below would be faster when reading old objects, as HoE will only be computed once,
24  // --- but it may not be allowed by CMS rules because of the const_cast
25  // --- and could potentially cause a data race
26  // if (!hOverEValid_) (const_cast<HGCalMulticluster*>(this))->saveHOverE();
27  // --- this below is safe in any case
29  }
30 
31  void saveHOverE() {
33  hOverEValid_ = true;
34  }
35 
36  enum EnergyInterpretation { EM = 0 };
37 
39 
41  return energy() * interpretationFraction(eInt);
42  }
43 
44  double iPt(const HGCalMulticluster::EnergyInterpretation eInt) const { return pt() * interpretationFraction(eInt); }
45 
47  return p4() * interpretationFraction(eInt);
48  }
49 
51  return math::PtEtaPhiMLorentzVector(pt() * interpretationFraction(eInt), eta(), phi(), 0.);
52  }
53 
54  private:
55  template <typename Iter>
56  struct KeyGetter : std::unary_function<typename Iter::value_type, typename Iter::value_type::first_type> {
57  const typename Iter::value_type::first_type& operator()(const typename Iter::value_type& p) const {
58  return p.first;
59  }
60  };
61 
62  template <typename Iter>
63  boost::transform_iterator<KeyGetter<Iter>, Iter> key_iterator(Iter itr) const {
64  return boost::make_transform_iterator<KeyGetter<Iter>, Iter>(itr, KeyGetter<Iter>());
65  }
66 
67  public:
68  typedef boost::transform_iterator<KeyGetter<std::map<EnergyInterpretation, double>::const_iterator>,
69  std::map<EnergyInterpretation, double>::const_iterator>
71 
72  std::pair<EnergyInterpretation_const_iterator, EnergyInterpretation_const_iterator> energyInterpretations() const {
73  return std::make_pair(key_iterator(energyInterpretationFractions_.cbegin()),
75  }
76 
79  }
80 
83  }
84 
86 
87  private:
89 
90  float hOverE_;
92  std::map<EnergyInterpretation, double> energyInterpretationFractions_;
93  };
94 
96 
97 } // namespace l1t
98 
99 #endif
l1t::HGCalMulticluster::hOverE_
float hOverE_
Definition: HGCalMulticluster.h:90
l1t::HGCalMulticluster::saveHOverE
void saveHOverE()
Definition: HGCalMulticluster.h:31
funct::false
false
Definition: Factorize.h:29
BXVector.h
l1t::HGCalMulticluster::HGCalMulticluster
HGCalMulticluster()
Definition: HGCalMulticluster.h:15
l1t::HGCalMulticluster::hOverEValid_
bool hOverEValid_
Definition: HGCalMulticluster.h:91
l1t::HGCalMulticluster::interpretationFraction
double interpretationFraction(const HGCalMulticluster::EnergyInterpretation eInt) const
Definition: HGCalMulticluster.cc:17
l1t::HGCalMulticlusterBxCollection
BXVector< HGCalMulticluster > HGCalMulticlusterBxCollection
Definition: HGCalMulticluster.h:95
l1t::HGCalMulticluster::iP4
math::XYZTLorentzVector iP4(const HGCalMulticluster::EnergyInterpretation eInt) const
Definition: HGCalMulticluster.h:46
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
l1t::HGCalMulticluster::interpretations_size
size_type interpretations_size() const
Definition: HGCalMulticluster.h:85
HGCalClusterT.h
BXVector
Definition: BXVector.h:15
l1t::HGCalMulticluster
Definition: HGCalMulticluster.h:13
l1t::HGCalMulticluster::saveEnergyInterpretation
void saveEnergyInterpretation(const HGCalMulticluster::EnergyInterpretation eInt, double energy)
Definition: HGCalMulticluster.cc:13
HLT_FULL_cff.fraction
fraction
Definition: HLT_FULL_cff.py:52795
l1t::HGCalMulticluster::EnergyInterpretation_const_iterator
boost::transform_iterator< KeyGetter< std::map< EnergyInterpretation, double >::const_iterator >, std::map< EnergyInterpretation, double >::const_iterator > EnergyInterpretation_const_iterator
Definition: HGCalMulticluster.h:70
l1t::HGCalClusterT
Definition: HGCalClusterT.h:21
l1t::HGCalMulticluster::key_iterator
boost::transform_iterator< KeyGetter< Iter >, Iter > key_iterator(Iter itr) const
Definition: HGCalMulticluster.h:63
l1t::HGCalMulticluster::~HGCalMulticluster
~HGCalMulticluster() override
Definition: HGCalMulticluster.cc:11
l1t::HGCalMulticluster::interpretations_end
EnergyInterpretation_const_iterator interpretations_end() const
Definition: HGCalMulticluster.h:81
l1t::HGCalMulticluster::KeyGetter::operator()
const Iter::value_type::first_type & operator()(const typename Iter::value_type &p) const
Definition: HGCalMulticluster.h:57
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
l1t
delete x;
Definition: CaloConfig.h:22
l1t::HGCalMulticluster::iEnergy
double iEnergy(const HGCalMulticluster::EnergyInterpretation eInt) const
Definition: HGCalMulticluster.h:40
l1t::HGCalMulticluster::EnergyInterpretation
EnergyInterpretation
Definition: HGCalMulticluster.h:36
l1t::HGCalMulticluster::iPolarP4
math::PtEtaPhiMLorentzVector iPolarP4(const HGCalMulticluster::EnergyInterpretation eInt) const
Definition: HGCalMulticluster.h:50
l1t::HGCalMulticluster::hOverE
float hOverE() const
Definition: HGCalMulticluster.h:22
Ptr.h
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
HGCalCluster.h
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:29
l1t::HGCalClusterT::hOverE
double hOverE() const
Definition: HGCalClusterT.h:104
l1t::HGCalMulticluster::iPt
double iPt(const HGCalMulticluster::EnergyInterpretation eInt) const
Definition: HGCalMulticluster.h:44
edm::Ptr
Definition: AssociationVector.h:31
l1t::HGCalMulticluster::EM
Definition: HGCalMulticluster.h:36
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
LorentzVector
math::XYZTLorentzVector LorentzVector
Definition: HLTMuonMatchAndPlot.h:49
reco::LeafCandidate::p
double p() const final
magnitude of momentum vector
Definition: LeafCandidate.h:123
l1t::HGCalMulticluster::KeyGetter
Definition: HGCalMulticluster.h:56
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
l1t::HGCalMulticluster::energyInterpretationFractions_
std::map< EnergyInterpretation, double > energyInterpretationFractions_
Definition: HGCalMulticluster.h:92
l1t::HGCalMulticluster::energyInterpretations
std::pair< EnergyInterpretation_const_iterator, EnergyInterpretation_const_iterator > energyInterpretations() const
Definition: HGCalMulticluster.h:72
l1t::HGCalMulticluster::interpretations_begin
EnergyInterpretation_const_iterator interpretations_begin() const
Definition: HGCalMulticluster.h:77
reco::Candidate::size_type
size_t size_type
Definition: Candidate.h:29