CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
PATHemisphereProducer Class Reference

#include "PhysicsTools/PatAlgos/plugins/PATHemisphereProducer.cc"

Inheritance diagram for PATHemisphereProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATHemisphereProducer (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 ~PATHemisphereProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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::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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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)
 

Private Types

typedef std::vector< float > HemiAxis
 

Private Attributes

const int _combinationMethod
 
const float _maxElectronEta
 
const float _maxJetEta
 
const float _maxMuonEta
 
const float _maxPhotonEta
 
const float _maxTauEta
 
const float _minElectronEt
 
const float _minJetEt
 
const float _minMuonEt
 
const float _minPhotonEt
 
const float _minTauEt
 
const edm::EDGetTokenT< reco::CandidateView_patElectronsToken
 
const edm::EDGetTokenT< reco::CandidateView_patJetsToken
 Input: All PAT objects that are to cross-clean or needed for that. More...
 
const edm::EDGetTokenT< reco::CandidateView_patMuonsToken
 
const edm::EDGetTokenT< reco::CandidateView_patPhotonsToken
 
const edm::EDGetTokenT< reco::CandidateView_patTausToken
 
const int _seedMethod
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 42 of file PATHemisphereProducer.cc.

Member Typedef Documentation

◆ HemiAxis

typedef std::vector<float> PATHemisphereProducer::HemiAxis
private

Definition at line 74 of file PATHemisphereProducer.cc.

Constructor & Destructor Documentation

◆ PATHemisphereProducer()

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

Definition at line 90 of file PATHemisphereProducer.cc.

91  : _patJetsToken(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("patJets"))),
92  _patMuonsToken(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("patMuons"))),
93  _patElectronsToken(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("patElectrons"))),
94  _patPhotonsToken(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("patPhotons"))),
95  _patTausToken(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("patTaus"))),
96 
97  _minJetEt(iConfig.getParameter<double>("minJetEt")),
98  _minMuonEt(iConfig.getParameter<double>("minMuonEt")),
99  _minElectronEt(iConfig.getParameter<double>("minElectronEt")),
100  _minTauEt(iConfig.getParameter<double>("minTauEt")),
101  _minPhotonEt(iConfig.getParameter<double>("minPhotonEt")),
102 
103  _maxJetEta(iConfig.getParameter<double>("maxJetEta")),
104  _maxMuonEta(iConfig.getParameter<double>("maxMuonEta")),
105  _maxElectronEta(iConfig.getParameter<double>("maxElectronEta")),
106  _maxTauEta(iConfig.getParameter<double>("maxTauEta")),
107  _maxPhotonEta(iConfig.getParameter<double>("maxPhotonEta")),
108 
109  _seedMethod(iConfig.getParameter<int>("seedMethod")),
110  _combinationMethod(iConfig.getParameter<int>("combinationMethod"))
111 
112 {
113  produces<std::vector<pat::Hemisphere>>();
114 }

◆ ~PATHemisphereProducer()

PATHemisphereProducer::~PATHemisphereProducer ( )
override

Definition at line 116 of file PATHemisphereProducer.cc.

116  {
117  // do anything here that needs to be done at desctruction time
118  // (e.g. close files, deallocate resources etc.)
119 }

Member Function Documentation

◆ produce()

void PATHemisphereProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 126 of file PATHemisphereProducer.cc.

126  {
127  using namespace edm;
128  using namespace std;
129 
130  std::vector<float> vPx, vPy, vPz, vE;
131  std::vector<float> vA1, vA2;
132  std::vector<int> vgroups;
133  std::vector<reco::CandidatePtr> componentPtrs;
134 
135  //Jets
137  iEvent.getByToken(_patJetsToken, pJets);
138 
139  //Muons
141  iEvent.getByToken(_patMuonsToken, pMuons);
142 
143  //Electrons
144  Handle<reco::CandidateView> pElectrons;
145  iEvent.getByToken(_patElectronsToken, pElectrons);
146 
147  //Photons
149  iEvent.getByToken(_patPhotonsToken, pPhotons);
150 
151  //Taus
153  iEvent.getByToken(_patTausToken, pTaus);
154 
155  //fill e,p vector with information from all objects (hopefully cleaned before)
156  for (int i = 0; i < (int)(*pJets).size(); i++) {
157  if ((*pJets)[i].pt() < _minJetEt || fabs((*pJets)[i].eta()) > _maxJetEta)
158  continue;
159 
160  componentPtrs.push_back(pJets->ptrAt(i));
161  }
162 
163  for (int i = 0; i < (int)(*pMuons).size(); i++) {
164  if ((*pMuons)[i].pt() < _minMuonEt || fabs((*pMuons)[i].eta()) > _maxMuonEta)
165  continue;
166 
167  componentPtrs.push_back(pMuons->ptrAt(i));
168  }
169 
170  for (int i = 0; i < (int)(*pElectrons).size(); i++) {
171  if ((*pElectrons)[i].pt() < _minElectronEt || fabs((*pElectrons)[i].eta()) > _maxElectronEta)
172  continue;
173 
174  componentPtrs.push_back(pElectrons->ptrAt(i));
175  }
176 
177  for (int i = 0; i < (int)(*pPhotons).size(); i++) {
178  if ((*pPhotons)[i].pt() < _minPhotonEt || fabs((*pPhotons)[i].eta()) > _maxPhotonEta)
179  continue;
180 
181  componentPtrs.push_back(pPhotons->ptrAt(i));
182  }
183 
184  //aren't taus included in jets?
185  for (int i = 0; i < (int)(*pTaus).size(); i++) {
186  if ((*pTaus)[i].pt() < _minTauEt || fabs((*pTaus)[i].eta()) > _maxTauEta)
187  continue;
188 
189  componentPtrs.push_back(pTaus->ptrAt(i));
190  }
191 
192  // create product
193  auto hemispheres = std::make_unique<std::vector<Hemisphere>>();
194  hemispheres->reserve(2);
195 
196  //calls HemiAlgorithm for seed method 3 (transv. inv. Mass) and association method 3 (Lund algo)
197  HemisphereAlgo myHemi(componentPtrs, _seedMethod, _combinationMethod);
198 
199  //get Hemisphere Axis
200  vA1 = myHemi.getAxis1();
201  vA2 = myHemi.getAxis2();
202 
203  reco::Particle::LorentzVector p1(vA1[0] * vA1[3], vA1[1] * vA1[3], vA1[2] * vA1[3], vA1[4]);
204  hemispheres->push_back(Hemisphere(p1));
205 
206  reco::Particle::LorentzVector p2(vA2[0] * vA2[3], vA2[1] * vA2[3], vA2[2] * vA2[3], vA2[4]);
207  hemispheres->push_back(Hemisphere(p2));
208 
209  //get information to which Hemisphere each object belongs
210  vgroups = myHemi.getGrouping();
211 
212  for (unsigned int i = 0; i < vgroups.size(); ++i) {
213  if (vgroups[i] == 1) {
214  (*hemispheres)[0].addDaughter(componentPtrs[i]);
215  } else {
216  (*hemispheres)[1].addDaughter(componentPtrs[i]);
217  }
218  }
219 
221 }

References _combinationMethod, _maxElectronEta, _maxJetEta, _maxMuonEta, _maxPhotonEta, _maxTauEta, _minElectronEt, _minJetEt, _minMuonEt, _minPhotonEt, _minTauEt, _patElectronsToken, _patJetsToken, _patMuonsToken, _patPhotonsToken, _patTausToken, _seedMethod, PVValHelper::eta, HemisphereAlgo::getAxis1(), HemisphereAlgo::getAxis2(), HemisphereAlgo::getGrouping(), razorHemispheres_cff::hemispheres, mps_fire::i, iEvent, createfilelist::int, eostools::move(), p1, p2, and edm::View< T >::ptrAt().

Member Data Documentation

◆ _combinationMethod

const int PATHemisphereProducer::_combinationMethod
private

Definition at line 72 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _maxElectronEta

const float PATHemisphereProducer::_maxElectronEta
private

Definition at line 67 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _maxJetEta

const float PATHemisphereProducer::_maxJetEta
private

Definition at line 65 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _maxMuonEta

const float PATHemisphereProducer::_maxMuonEta
private

Definition at line 66 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _maxPhotonEta

const float PATHemisphereProducer::_maxPhotonEta
private

Definition at line 69 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _maxTauEta

const float PATHemisphereProducer::_maxTauEta
private

Definition at line 68 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _minElectronEt

const float PATHemisphereProducer::_minElectronEt
private

Definition at line 61 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _minJetEt

const float PATHemisphereProducer::_minJetEt
private

Definition at line 59 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _minMuonEt

const float PATHemisphereProducer::_minMuonEt
private

Definition at line 60 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _minPhotonEt

const float PATHemisphereProducer::_minPhotonEt
private

Definition at line 63 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _minTauEt

const float PATHemisphereProducer::_minTauEt
private

Definition at line 62 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _patElectronsToken

const edm::EDGetTokenT<reco::CandidateView> PATHemisphereProducer::_patElectronsToken
private

Definition at line 55 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _patJetsToken

const edm::EDGetTokenT<reco::CandidateView> PATHemisphereProducer::_patJetsToken
private

Input: All PAT objects that are to cross-clean or needed for that.

Definition at line 52 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _patMuonsToken

const edm::EDGetTokenT<reco::CandidateView> PATHemisphereProducer::_patMuonsToken
private

Definition at line 54 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _patPhotonsToken

const edm::EDGetTokenT<reco::CandidateView> PATHemisphereProducer::_patPhotonsToken
private

Definition at line 56 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _patTausToken

const edm::EDGetTokenT<reco::CandidateView> PATHemisphereProducer::_patTausToken
private

Definition at line 57 of file PATHemisphereProducer.cc.

Referenced by produce().

◆ _seedMethod

const int PATHemisphereProducer::_seedMethod
private

Definition at line 71 of file PATHemisphereProducer.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
PATHemisphereProducer::_minElectronEt
const float _minElectronEt
Definition: PATHemisphereProducer.cc:61
PATHemisphereProducer::_maxPhotonEta
const float _maxPhotonEta
Definition: PATHemisphereProducer.cc:69
edm
HLT enums.
Definition: AlignableModifier.h:19
PATHemisphereProducer::_seedMethod
const int _seedMethod
Definition: PATHemisphereProducer.cc:71
PATHemisphereProducer::_combinationMethod
const int _combinationMethod
Definition: PATHemisphereProducer.cc:72
edm::Handle
Definition: AssociativeIterator.h:50
PATHemisphereProducer::_minMuonEt
const float _minMuonEt
Definition: PATHemisphereProducer.cc:60
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
PATHemisphereProducer::_patMuonsToken
const edm::EDGetTokenT< reco::CandidateView > _patMuonsToken
Definition: PATHemisphereProducer.cc:54
PVValHelper::eta
Definition: PVValidationHelpers.h:70
p2
double p2[4]
Definition: TauolaWrapper.h:90
PATHemisphereProducer::_minJetEt
const float _minJetEt
Definition: PATHemisphereProducer.cc:59
pat::Hemisphere
Definition: Hemisphere.h:17
PATHemisphereProducer::_maxJetEta
const float _maxJetEta
Definition: PATHemisphereProducer.cc:65
razorHemispheres_cff.hemispheres
hemispheres
Definition: razorHemispheres_cff.py:3
PATHemisphereProducer::_patJetsToken
const edm::EDGetTokenT< reco::CandidateView > _patJetsToken
Input: All PAT objects that are to cross-clean or needed for that.
Definition: PATHemisphereProducer.cc:52
PATHemisphereProducer::_maxElectronEta
const float _maxElectronEta
Definition: PATHemisphereProducer.cc:67
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
p1
double p1[4]
Definition: TauolaWrapper.h:89
PATHemisphereProducer::_minPhotonEt
const float _minPhotonEt
Definition: PATHemisphereProducer.cc:63
HemisphereAlgo
Definition: HemisphereAlgo.h:23
PATHemisphereProducer::_patElectronsToken
const edm::EDGetTokenT< reco::CandidateView > _patElectronsToken
Definition: PATHemisphereProducer.cc:55
PATHemisphereProducer::_maxTauEta
const float _maxTauEta
Definition: PATHemisphereProducer.cc:68
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
PATHemisphereProducer::_patTausToken
const edm::EDGetTokenT< reco::CandidateView > _patTausToken
Definition: PATHemisphereProducer.cc:57
PATHemisphereProducer::_maxMuonEta
const float _maxMuonEta
Definition: PATHemisphereProducer.cc:66
PATHemisphereProducer::_patPhotonsToken
const edm::EDGetTokenT< reco::CandidateView > _patPhotonsToken
Definition: PATHemisphereProducer.cc:56
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::View::ptrAt
Ptr< value_type > ptrAt(size_type i) const
edm::InputTag
Definition: InputTag.h:15
PATHemisphereProducer::_minTauEt
const float _minTauEt
Definition: PATHemisphereProducer.cc:62