CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 HLTRHemisphere (const edm::ParameterSet &)
 
 ~HLTRHemisphere ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

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

Private Member Functions

void ComputeHemispheres (std::auto_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::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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_, and muonTag_.

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:164
edm::InputTag muonTag_
edm::InputTag inputTag_
HLTRHemisphere::~HLTRHemisphere ( )

Definition at line 52 of file HLTRHemisphere.cc.

53 {
54 }

Member Function Documentation

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

Definition at line 159 of file HLTRHemisphere.cc.

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

Referenced by filter().

160  {
161  using namespace math;
162  using namespace reco;
163  XYZTLorentzVector j1R(0.1, 0., 0., 0.1);
164  XYZTLorentzVector j2R(0.1, 0., 0., 0.1);
165  int nJets = JETS.size();
166  if(extraJets) nJets+=extraJets->size();
167 
168  if(nJets<2){ // put empty hemispheres if not enough jets
169  hlist->push_back(j1R);
170  hlist->push_back(j2R);
171  return;
172  }
173  unsigned int N_comb = pow(2,nJets); // compute the number of combinations of jets possible
174  //Make the hemispheres
175  double M_minR = 9999999999.0;
176  unsigned int j_count;
177  for (unsigned int i = 0; i < N_comb; i++) {
178  XYZTLorentzVector j_temp1, j_temp2;
179  unsigned int itemp = i;
180  j_count = N_comb/2;
181  unsigned int count = 0;
182  while (j_count > 0) {
183  if (itemp/j_count == 1){
184  if(count<JETS.size()) j_temp1 += JETS.at(count);
185  else j_temp1 +=extraJets->at(count-JETS.size());
186  } else {
187  if(count<JETS.size()) j_temp2 += JETS.at(count);
188  else j_temp2 +=extraJets->at(count-JETS.size());
189  }
190  itemp -= j_count * (itemp/j_count);
191  j_count /= 2;
192  count++;
193  }
194  double M_temp = j_temp1.M2() + j_temp2.M2();
195  if (M_temp < M_minR) {
196  M_minR = M_temp;
197  j1R = j_temp1;
198  j2R = j_temp2;
199  }
200  }
201 
202  hlist->push_back(j1R);
203  hlist->push_back(j2R);
204  return;
205 }
int i
Definition: DBlmapReader.cc:9
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
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 57 of file HLTRHemisphere.cc.

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

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

Implements edm::EDFilter.

Definition at line 76 of file HLTRHemisphere.cc.

References funct::abs(), accNJJets_, ComputeHemispheres(), doMuonCorrection_, edm::Event::getByToken(), i, cmsHarvester::index, fwrapper::jets, m_theJetToken, m_theMuonToken, max_Eta_, max_NJ_, min_Jet_Pt_, muonEta_, patZpeak::muons, n, reco::LeafCandidate::p4(), edm::Event::put(), and dt_dqm_sourceclient_common_cff::reco.

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