CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
 EDFilter (const EDFilter &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
- 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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 28 of file HLTRHemisphere.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file HLTRHemisphere.cc.

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

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 }
edm::EDGetTokenT< std::vector< reco::RecoChargedCandidate > > m_theMuonToken
edm::EDGetTokenT< edm::View< reco::Jet > > m_theJetToken
std::string encode() const
Definition: InputTag.cc:159
edm::InputTag muonTag_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::InputTag inputTag_
#define LogDebug(id)
HLTRHemisphere::~HLTRHemisphere ( )
overridedefault

Member Function Documentation

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.

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

Referenced by filter().

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 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
void HLTRHemisphere::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 49 of file HLTRHemisphere.cc.

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

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 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool HLTRHemisphere::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 67 of file HLTRHemisphere.cc.

References funct::abs(), accNJJets_, ComputeHemispheres(), doMuonCorrection_, edm::Event::getByToken(), mps_fire::i, fwrapper::jets, m_theJetToken, m_theMuonToken, max_Eta_, max_NJ_, min_Jet_Pt_, eostools::move(), muonEta_, patZpeak::muons, dqmiodumpmetadata::n, reco::RecoCandidate::p4, edm::Event::put(), and dt_dqm_sourceclient_common_cff::reco.

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
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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< std::vector< reco::RecoChargedCandidate > > m_theMuonToken
edm::EDGetTokenT< edm::View< reco::Jet > > m_theJetToken
void ComputeHemispheres(std::unique_ptr< std::vector< math::XYZTLorentzVector >> &hlist, const std::vector< math::XYZTLorentzVector > &JETS, std::vector< math::XYZTLorentzVector > *extraJets=nullptr)
vector< PseudoJet > jets
def move
Definition: eostools.py:511
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple muons
Definition: patZpeak.py:39
math::PtEtaPhiELorentzVectorF LorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25

Member Data Documentation

bool HLTRHemisphere::accNJJets_
private

Definition at line 45 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

bool HLTRHemisphere::doMuonCorrection_
private

Definition at line 40 of file HLTRHemisphere.h.

Referenced by filter().

edm::InputTag HLTRHemisphere::inputTag_
private

Definition at line 38 of file HLTRHemisphere.h.

Referenced by HLTRHemisphere().

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

Definition at line 36 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

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

Definition at line 37 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

double HLTRHemisphere::max_Eta_
private

Definition at line 43 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

int HLTRHemisphere::max_NJ_
private

Definition at line 44 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

double HLTRHemisphere::min_Jet_Pt_
private

Definition at line 42 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

double HLTRHemisphere::muonEta_
private

Definition at line 41 of file HLTRHemisphere.h.

Referenced by filter().

edm::InputTag HLTRHemisphere::muonTag_
private

Definition at line 39 of file HLTRHemisphere.h.

Referenced by HLTRHemisphere().