CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HLTRHemisphere Class Reference

#include <HLTRHemisphere.h>

Inheritance diagram for HLTRHemisphere:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 
 HLTRHemisphere (const edm::ParameterSet &)
 
 ~HLTRHemisphere () override
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void ComputeHemispheres (std::unique_ptr< std::vector< math::XYZTLorentzVector >> &hlist, const std::vector< math::XYZTLorentzVector > &JETS, std::vector< math::XYZTLorentzVector > *extraJets=nullptr)
 

Private Attributes

bool accNJJets_
 
bool doMuonCorrection_
 
edm::InputTag inputTag_
 
edm::EDGetTokenT< edm::View< reco::Jet > > m_theJetToken
 
edm::EDGetTokenT< std::vector< reco::RecoChargedCandidate > > m_theMuonToken
 
double max_Eta_
 
int max_NJ_
 
double min_Jet_Pt_
 
double muonEta_
 
edm::InputTag muonTag_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 28 of file HLTRHemisphere.h.

Constructor & Destructor Documentation

◆ HLTRHemisphere()

HLTRHemisphere::HLTRHemisphere ( const edm::ParameterSet iConfig)
explicit

Definition at line 29 of file HLTRHemisphere.cc.

30  : inputTag_(iConfig.getParameter<edm::InputTag>("inputTag")),
31  muonTag_(iConfig.getParameter<edm::InputTag>("muonTag")),
32  doMuonCorrection_(iConfig.getParameter<bool>("doMuonCorrection")),
33  muonEta_(iConfig.getParameter<double>("maxMuonEta")),
34  min_Jet_Pt_(iConfig.getParameter<double>("minJetPt")),
35  max_Eta_(iConfig.getParameter<double>("maxEta")),
36  max_NJ_(iConfig.getParameter<int>("maxNJ")),
37  accNJJets_(iConfig.getParameter<bool>("acceptNJ")) {
38  LogDebug("") << "Input/minJetPt/maxEta/maxNJ/acceptNJ : " << inputTag_.encode() << " " << min_Jet_Pt_ << "/"
39  << max_Eta_ << "/" << max_NJ_ << "/" << accNJJets_ << ".";
40 
41  m_theJetToken = consumes<edm::View<reco::Jet>>(inputTag_);
42  m_theMuonToken = consumes<std::vector<reco::RecoChargedCandidate>>(muonTag_);
43  //register your products
44  produces<std::vector<math::XYZTLorentzVector>>();
45 }

References accNJJets_, edm::InputTag::encode(), inputTag_, LogDebug, m_theJetToken, m_theMuonToken, max_Eta_, max_NJ_, min_Jet_Pt_, and muonTag_.

◆ ~HLTRHemisphere()

HLTRHemisphere::~HLTRHemisphere ( )
overridedefault

Member Function Documentation

◆ ComputeHemispheres()

void HLTRHemisphere::ComputeHemispheres ( std::unique_ptr< std::vector< math::XYZTLorentzVector >> &  hlist,
const std::vector< math::XYZTLorentzVector > &  JETS,
std::vector< math::XYZTLorentzVector > *  extraJets = nullptr 
)
private

Definition at line 151 of file HLTRHemisphere.cc.

153  {
154  using namespace math;
155  using namespace reco;
156  XYZTLorentzVector j1R(0.1, 0., 0., 0.1);
157  XYZTLorentzVector j2R(0.1, 0., 0., 0.1);
158  int nJets = JETS.size();
159  if (extraJets)
160  nJets += extraJets->size();
161 
162  if (nJets < 2) { // put empty hemispheres if not enough jets
163  hlist->push_back(j1R);
164  hlist->push_back(j2R);
165  return;
166  }
167  unsigned int N_comb = pow(2, nJets); // compute the number of combinations of jets possible
168  //Make the hemispheres
169  double M_minR = 9999999999.0;
170  unsigned int j_count;
171  for (unsigned int i = 0; i < N_comb; i++) {
172  XYZTLorentzVector j_temp1, j_temp2;
173  unsigned int itemp = i;
174  j_count = N_comb / 2;
175  unsigned int count = 0;
176  while (j_count > 0) {
177  if (itemp / j_count == 1) {
178  if (count < JETS.size())
179  j_temp1 += JETS.at(count);
180  else
181  j_temp1 += extraJets->at(count - JETS.size());
182  } else {
183  if (count < JETS.size())
184  j_temp2 += JETS.at(count);
185  else
186  j_temp2 += extraJets->at(count - JETS.size());
187  }
188  itemp -= j_count * (itemp / j_count);
189  j_count /= 2;
190  count++;
191  }
192  double M_temp = j_temp1.M2() + j_temp2.M2();
193  if (M_temp < M_minR) {
194  M_minR = M_temp;
195  j1R = j_temp1;
196  j2R = j_temp2;
197  }
198  }
199 
200  hlist->push_back(j1R);
201  hlist->push_back(j2R);
202  return;
203 }

References submitPVResolutionJobs::count, mps_fire::i, and funct::pow().

Referenced by filter().

◆ fillDescriptions()

void HLTRHemisphere::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 49 of file HLTRHemisphere.cc.

49  {
51  desc.add<edm::InputTag>("inputTag", edm::InputTag("hltMCJetCorJetIcone5HF07"));
52  desc.add<edm::InputTag>("muonTag", edm::InputTag(""));
53  desc.add<bool>("doMuonCorrection", false);
54  desc.add<double>("maxMuonEta", 2.1);
55  desc.add<double>("minJetPt", 30.0);
56  desc.add<double>("maxEta", 3.0);
57  desc.add<int>("maxNJ", 7);
58  desc.add<bool>("acceptNJ", true);
59  descriptions.add("hltRHemisphere", desc);
60 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ filter()

bool HLTRHemisphere::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 67 of file HLTRHemisphere.cc.

67  {
68  using namespace std;
69  using namespace edm;
70  using namespace reco;
71  using namespace math;
72  using namespace trigger;
73 
75 
76  // get hold of collection of objects
77  // Handle<CaloJetCollection> jets;
79  iEvent.getByToken(m_theJetToken, jets);
80 
81  // get hold of the muons, if necessary
84  iEvent.getByToken(m_theMuonToken, muons);
85 
86  // The output Collection
87  std::unique_ptr<vector<math::XYZTLorentzVector>> Hemispheres(new vector<math::XYZTLorentzVector>);
88 
89  // look at all objects, check cuts and add to filter object
90  int n(0);
91  vector<math::XYZTLorentzVector> JETS;
92  for (auto const& i : *jets) {
93  if (std::abs(i.eta()) < max_Eta_ && i.pt() >= min_Jet_Pt_) {
94  JETS.push_back(i.p4());
95  n++;
96  }
97  }
98 
99  if (n > max_NJ_ && max_NJ_ != -1) {
100  iEvent.put(std::move(Hemispheres));
101  return accNJJets_; // too many jets, accept for timing
102  }
103 
104  if (doMuonCorrection_) {
105  const int nMu = 2;
106  int muonIndex[nMu] = {-1, -1};
107  std::vector<reco::RecoChargedCandidate>::const_iterator muonIt;
108  int index = 0;
109  int nPassMu = 0;
110  for (muonIt = muons->begin(); muonIt != muons->end(); muonIt++, index++) {
111  if (std::abs(muonIt->eta()) > muonEta_ || muonIt->pt() < min_Jet_Pt_)
112  continue; // skip muons out of eta range or too low pT
113  if (nPassMu >= 2) { // if we have already accepted two muons, accept the event
114  iEvent.put(std::move(Hemispheres)); // too many muons, accept for timing
115  return true;
116  }
117  muonIndex[nPassMu++] = index;
118  }
119  //muons as MET
120  this->ComputeHemispheres(Hemispheres, JETS);
121  //lead muon as jet
122  if (nPassMu > 0) {
123  std::vector<math::XYZTLorentzVector> muonJets;
124  reco::RecoChargedCandidate leadMu = muons->at(muonIndex[0]);
125  muonJets.push_back(leadMu.p4());
126  Hemispheres->push_back(leadMu.p4());
127  this->ComputeHemispheres(Hemispheres, JETS, &muonJets); // lead muon as jet
128  if (nPassMu > 1) { // two passing muons
129  muonJets.pop_back();
130  reco::RecoChargedCandidate secondMu = muons->at(muonIndex[1]);
131  muonJets.push_back(secondMu.p4());
132  Hemispheres->push_back(secondMu.p4());
133  this->ComputeHemispheres(Hemispheres, JETS, &muonJets); // lead muon as v, second muon as jet
134  muonJets.push_back(leadMu.p4());
135  this->ComputeHemispheres(Hemispheres, JETS, &muonJets); // both muon as jets
136  }
137  }
138  } else { // do MuonCorrection==false
139  if (n < 2)
140  return false; // not enough jets and not adding in muons
141  this->ComputeHemispheres(Hemispheres, JETS); // don't do the muon isolation, just run once and done
142  }
143  //Format:
144  // 0 muon: 2 hemispheres (2)
145  // 1 muon: 2 hemisheress + leadMuP4 + 2 hemispheres (5)
146  // 2 muon: 2 hemispheres + leadMuP4 + 2 hemispheres + 2ndMuP4 + 4 Hemispheres (10)
147  iEvent.put(std::move(Hemispheres));
148  return true;
149 }

References funct::abs(), accNJJets_, ComputeHemispheres(), doMuonCorrection_, mps_fire::i, iEvent, singleTopDQM_cfi::jets, m_theJetToken, m_theMuonToken, max_Eta_, max_NJ_, min_Jet_Pt_, eostools::move(), muonEta_, PDWG_BPHSkim_cff::muons, dqmiodumpmetadata::n, and reco::LeafCandidate::p4().

Member Data Documentation

◆ accNJJets_

bool HLTRHemisphere::accNJJets_
private

Definition at line 45 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

◆ doMuonCorrection_

bool HLTRHemisphere::doMuonCorrection_
private

Definition at line 40 of file HLTRHemisphere.h.

Referenced by filter().

◆ inputTag_

edm::InputTag HLTRHemisphere::inputTag_
private

Definition at line 38 of file HLTRHemisphere.h.

Referenced by HLTRHemisphere().

◆ m_theJetToken

edm::EDGetTokenT<edm::View<reco::Jet> > HLTRHemisphere::m_theJetToken
private

Definition at line 36 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

◆ m_theMuonToken

edm::EDGetTokenT<std::vector<reco::RecoChargedCandidate> > HLTRHemisphere::m_theMuonToken
private

Definition at line 37 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

◆ max_Eta_

double HLTRHemisphere::max_Eta_
private

Definition at line 43 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

◆ max_NJ_

int HLTRHemisphere::max_NJ_
private

Definition at line 44 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

◆ min_Jet_Pt_

double HLTRHemisphere::min_Jet_Pt_
private

Definition at line 42 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

◆ muonEta_

double HLTRHemisphere::muonEta_
private

Definition at line 41 of file HLTRHemisphere.h.

Referenced by filter().

◆ muonTag_

edm::InputTag HLTRHemisphere::muonTag_
private

Definition at line 39 of file HLTRHemisphere.h.

Referenced by HLTRHemisphere().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
HLTRHemisphere::doMuonCorrection_
bool doMuonCorrection_
Definition: HLTRHemisphere.h:40
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HLTRHemisphere::accNJJets_
bool accNJJets_
Definition: HLTRHemisphere.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLTRHemisphere::m_theJetToken
edm::EDGetTokenT< edm::View< reco::Jet > > m_theJetToken
Definition: HLTRHemisphere.h:36
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
HLTRHemisphere::min_Jet_Pt_
double min_Jet_Pt_
Definition: HLTRHemisphere.h:42
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
HLTRHemisphere::max_Eta_
double max_Eta_
Definition: HLTRHemisphere.h:43
HLTRHemisphere::inputTag_
edm::InputTag inputTag_
Definition: HLTRHemisphere.h:38
HLTRHemisphere::muonEta_
double muonEta_
Definition: HLTRHemisphere.h:41
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
HLTRHemisphere::muonTag_
edm::InputTag muonTag_
Definition: HLTRHemisphere.h:39
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
HLTRHemisphere::max_NJ_
int max_NJ_
Definition: HLTRHemisphere.h:44
reco::RecoChargedCandidate
Definition: RecoChargedCandidate.h:15
HLTRHemisphere::m_theMuonToken
edm::EDGetTokenT< std::vector< reco::RecoChargedCandidate > > m_theMuonToken
Definition: HLTRHemisphere.h:37
reco::JetExtendedAssociation::LorentzVector
math::PtEtaPhiELorentzVectorF LorentzVector
Definition: JetExtendedAssociation.h:25
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
math
Definition: choleskyInversion.h:19
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HLTRHemisphere::ComputeHemispheres
void ComputeHemispheres(std::unique_ptr< std::vector< math::XYZTLorentzVector >> &hlist, const std::vector< math::XYZTLorentzVector > &JETS, std::vector< math::XYZTLorentzVector > *extraJets=nullptr)
Definition: HLTRHemisphere.cc:151
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trigger
Definition: HLTPrescaleTableCond.h:8
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::InputTag
Definition: InputTag.h:15