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
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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=0)
 

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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

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_, muonTag_, and ~HLTRHemisphere().

29  :
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 {
39  LogDebug("") << "Input/minJetPt/maxEta/maxNJ/acceptNJ : "
40  << inputTag_.encode() << " "
41  << min_Jet_Pt_ << "/"
42  << max_Eta_ << "/"
43  << max_NJ_ << "/"
44  << accNJJets_ << ".";
45 
46  m_theJetToken = consumes<edm::View<reco::Jet>>(inputTag_);
47  m_theMuonToken = consumes<std::vector<reco::RecoChargedCandidate>>(muonTag_);
48  //register your products
49  produces<std::vector<math::XYZTLorentzVector> >();
50 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< reco::RecoChargedCandidate > > m_theMuonToken
edm::EDGetTokenT< edm::View< reco::Jet > > m_theJetToken
std::string encode() const
Definition: InputTag.cc:166
edm::InputTag muonTag_
edm::InputTag inputTag_
HLTRHemisphere::~HLTRHemisphere ( )
overridedefault

Referenced by HLTRHemisphere().

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 = 0 
)
private

Definition at line 157 of file HLTRHemisphere.cc.

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

Referenced by filter().

158  {
159  using namespace math;
160  using namespace reco;
161  XYZTLorentzVector j1R(0.1, 0., 0., 0.1);
162  XYZTLorentzVector j2R(0.1, 0., 0., 0.1);
163  int nJets = JETS.size();
164  if(extraJets) nJets+=extraJets->size();
165 
166  if(nJets<2){ // put empty hemispheres if not enough jets
167  hlist->push_back(j1R);
168  hlist->push_back(j2R);
169  return;
170  }
171  unsigned int N_comb = pow(2,nJets); // compute the number of combinations of jets possible
172  //Make the hemispheres
173  double M_minR = 9999999999.0;
174  unsigned int j_count;
175  for (unsigned int i = 0; i < N_comb; i++) {
176  XYZTLorentzVector j_temp1, j_temp2;
177  unsigned int itemp = i;
178  j_count = N_comb/2;
179  unsigned int count = 0;
180  while (j_count > 0) {
181  if (itemp/j_count == 1){
182  if(count<JETS.size()) j_temp1 += JETS.at(count);
183  else j_temp1 +=extraJets->at(count-JETS.size());
184  } else {
185  if(count<JETS.size()) j_temp2 += JETS.at(count);
186  else 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 }
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
Definition: Error.h:16
fixed size matrix
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void HLTRHemisphere::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 55 of file HLTRHemisphere.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

55  {
57  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltMCJetCorJetIcone5HF07"));
58  desc.add<edm::InputTag>("muonTag",edm::InputTag(""));
59  desc.add<bool>("doMuonCorrection",false);
60  desc.add<double>("maxMuonEta",2.1);
61  desc.add<double>("minJetPt",30.0);
62  desc.add<double>("maxEta",3.0);
63  desc.add<int>("maxNJ",7);
64  desc.add<bool>("acceptNJ",true);
65  descriptions.add("hltRHemisphere",desc);
66 }
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 
)
override

Definition at line 74 of file HLTRHemisphere.cc.

References funct::abs(), accNJJets_, ComputeHemispheres(), doMuonCorrection_, edm::Event::getByToken(), mps_fire::i, diffTreeTool::index, fwrapper::jets, m_theJetToken, m_theMuonToken, max_Eta_, max_NJ_, min_Jet_Pt_, eostools::move(), muonEta_, nano_cff::muons, gen::n, reco::LeafCandidate::p4(), and edm::Event::put().

75 {
76  using namespace std;
77  using namespace edm;
78  using namespace reco;
79  using namespace math;
80  using namespace trigger;
81 
83 
84  // get hold of collection of objects
85  // Handle<CaloJetCollection> jets;
87  iEvent.getByToken (m_theJetToken,jets);
88 
89  // get hold of the muons, if necessary
91  if(doMuonCorrection_) iEvent.getByToken( m_theMuonToken,muons );
92 
93  // The output Collection
94  std::unique_ptr<vector<math::XYZTLorentzVector> > Hemispheres(new vector<math::XYZTLorentzVector> );
95 
96  // look at all objects, check cuts and add to filter object
97  int n(0);
98  vector<math::XYZTLorentzVector> JETS;
99  for (auto const & i : *jets) {
100  if(std::abs(i.eta()) < max_Eta_ && i.pt() >= min_Jet_Pt_){
101  JETS.push_back(i.p4());
102  n++;
103  }
104  }
105 
106  if(n>max_NJ_ && max_NJ_!=-1){
107  iEvent.put(std::move(Hemispheres));
108  return accNJJets_; // too many jets, accept for timing
109  }
110 
111  if(doMuonCorrection_){
112  const int nMu = 2;
113  int muonIndex[nMu] = { -1, -1 };
114  std::vector<reco::RecoChargedCandidate>::const_iterator muonIt;
115  int index = 0;
116  int nPassMu = 0;
117  for(muonIt = muons->begin(); muonIt!=muons->end(); muonIt++,index++){
118  if(std::abs(muonIt->eta()) > muonEta_ || muonIt->pt() < min_Jet_Pt_) continue; // skip muons out of eta range or too low pT
119  if(nPassMu >= 2){ // if we have already accepted two muons, accept the event
120  iEvent.put(std::move(Hemispheres)); // too many muons, accept for timing
121  return true;
122  }
123  muonIndex[nPassMu++] = index;
124  }
125  //muons as MET
126  this->ComputeHemispheres(Hemispheres,JETS);
127  //lead muon as jet
128  if(nPassMu>0){
129  std::vector<math::XYZTLorentzVector> muonJets;
130  reco::RecoChargedCandidate leadMu = muons->at(muonIndex[0]);
131  muonJets.push_back(leadMu.p4());
132  Hemispheres->push_back(leadMu.p4());
133  this->ComputeHemispheres(Hemispheres,JETS,&muonJets); // lead muon as jet
134  if(nPassMu>1){ // two passing muons
135  muonJets.pop_back();
136  reco::RecoChargedCandidate secondMu = muons->at(muonIndex[1]);
137  muonJets.push_back(secondMu.p4());
138  Hemispheres->push_back(secondMu.p4());
139  this->ComputeHemispheres(Hemispheres,JETS,&muonJets); // lead muon as v, second muon as jet
140  muonJets.push_back(leadMu.p4());
141  this->ComputeHemispheres(Hemispheres,JETS,&muonJets); // both muon as jets
142  }
143  }
144  }else{ // do MuonCorrection==false
145  if(n<2) return false; // not enough jets and not adding in muons
146  this->ComputeHemispheres(Hemispheres,JETS); // don't do the muon isolation, just run once and done
147  }
148  //Format:
149  // 0 muon: 2 hemispheres (2)
150  // 1 muon: 2 hemisheress + leadMuP4 + 2 hemispheres (5)
151  // 2 muon: 2 hemispheres + leadMuP4 + 2 hemispheres + 2ndMuP4 + 4 Hemispheres (10)
152  iEvent.put(std::move(Hemispheres));
153  return true;
154 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::EDGetTokenT< std::vector< reco::RecoChargedCandidate > > m_theMuonToken
edm::EDGetTokenT< edm::View< reco::Jet > > m_theJetToken
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
vector< PseudoJet > jets
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
Definition: Error.h:16
void ComputeHemispheres(std::unique_ptr< std::vector< math::XYZTLorentzVector > > &hlist, const std::vector< math::XYZTLorentzVector > &JETS, std::vector< math::XYZTLorentzVector > *extraJets=0)
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:510
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

bool HLTRHemisphere::accNJJets_
private

Definition at line 48 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

bool HLTRHemisphere::doMuonCorrection_
private

Definition at line 43 of file HLTRHemisphere.h.

Referenced by filter().

edm::InputTag HLTRHemisphere::inputTag_
private

Definition at line 41 of file HLTRHemisphere.h.

Referenced by HLTRHemisphere().

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

Definition at line 39 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

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

Definition at line 40 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

double HLTRHemisphere::max_Eta_
private

Definition at line 46 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

int HLTRHemisphere::max_NJ_
private

Definition at line 47 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

double HLTRHemisphere::min_Jet_Pt_
private

Definition at line 45 of file HLTRHemisphere.h.

Referenced by filter(), and HLTRHemisphere().

double HLTRHemisphere::muonEta_
private

Definition at line 44 of file HLTRHemisphere.h.

Referenced by filter().

edm::InputTag HLTRHemisphere::muonTag_
private

Definition at line 42 of file HLTRHemisphere.h.

Referenced by HLTRHemisphere().