CMS 3D CMS Logo

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

#include <PATHemisphereProducer.h>

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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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 () 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
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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::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 40 of file PATHemisphereProducer.h.

Member Typedef Documentation

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

Definition at line 72 of file PATHemisphereProducer.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file PATHemisphereProducer.cc.

55  :
56  _patJetsToken ( consumes<reco::CandidateView> ( iConfig.getParameter<edm::InputTag>( "patJets" ) ) ),
57  _patMuonsToken ( consumes<reco::CandidateView> ( iConfig.getParameter<edm::InputTag>( "patMuons" ) ) ),
58  _patElectronsToken ( consumes<reco::CandidateView> ( iConfig.getParameter<edm::InputTag>( "patElectrons" ) ) ),
59  _patPhotonsToken ( consumes<reco::CandidateView> ( iConfig.getParameter<edm::InputTag>( "patPhotons" ) ) ),
60  _patTausToken ( consumes<reco::CandidateView> ( iConfig.getParameter<edm::InputTag>( "patTaus" ) ) ),
61 
62  _minJetEt ( iConfig.getParameter<double>("minJetEt") ),
63  _minMuonEt ( iConfig.getParameter<double>("minMuonEt") ),
64  _minElectronEt ( iConfig.getParameter<double>("minElectronEt") ),
65  _minTauEt ( iConfig.getParameter<double>("minTauEt") ),
66  _minPhotonEt ( iConfig.getParameter<double>("minPhotonEt") ),
67 
68  _maxJetEta ( iConfig.getParameter<double>("maxJetEta") ),
69  _maxMuonEta ( iConfig.getParameter<double>("maxMuonEta") ),
70  _maxElectronEta ( iConfig.getParameter<double>("maxElectronEta") ),
71  _maxTauEta ( iConfig.getParameter<double>("maxTauEta") ),
72  _maxPhotonEta ( iConfig.getParameter<double>("maxPhotonEta") ),
73 
74  _seedMethod ( iConfig.getParameter<int>("seedMethod") ),
75  _combinationMethod ( iConfig.getParameter<int>("combinationMethod") )
76 
77 {
78 
79 
80  produces< std::vector<pat::Hemisphere> >();
81 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< reco::CandidateView > _patElectronsToken
const edm::EDGetTokenT< reco::CandidateView > _patTausToken
const edm::EDGetTokenT< reco::CandidateView > _patJetsToken
Input: All PAT objects that are to cross-clean or needed for that.
const edm::EDGetTokenT< reco::CandidateView > _patPhotonsToken
const edm::EDGetTokenT< reco::CandidateView > _patMuonsToken
PATHemisphereProducer::~PATHemisphereProducer ( )
override

Definition at line 84 of file PATHemisphereProducer.cc.

85 {
86 
87  // do anything here that needs to be done at desctruction time
88  // (e.g. close files, deallocate resources etc.)
89 
90 }

Member Function Documentation

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

Definition at line 99 of file PATHemisphereProducer.cc.

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

99  {
100  using namespace edm;
101  using namespace std;
102 
103  std::vector<float> vPx, vPy, vPz, vE;
104  std::vector<float> vA1, vA2;
105  std::vector<int> vgroups;
106  std::vector<reco::CandidatePtr> componentPtrs;
107 
108  //Jets
110  iEvent.getByToken(_patJetsToken,pJets);
111 
112  //Muons
114  iEvent.getByToken(_patMuonsToken,pMuons);
115 
116  //Electrons
117  Handle<reco::CandidateView> pElectrons;
118  iEvent.getByToken(_patElectronsToken,pElectrons);
119 
120  //Photons
122  iEvent.getByToken(_patPhotonsToken,pPhotons);
123 
124  //Taus
126  iEvent.getByToken(_patTausToken,pTaus);
127 
128 
129  //fill e,p vector with information from all objects (hopefully cleaned before)
130  for(int i = 0; i < (int) (*pJets).size() ; i++){
131  if((*pJets)[i].pt() < _minJetEt || fabs((*pJets)[i].eta()) > _maxJetEta) continue;
132 
133  componentPtrs.push_back(pJets->ptrAt(i));
134  }
135 
136  for(int i = 0; i < (int) (*pMuons).size() ; i++){
137  if((*pMuons)[i].pt() < _minMuonEt || fabs((*pMuons)[i].eta()) > _maxMuonEta) continue;
138 
139  componentPtrs.push_back(pMuons->ptrAt(i));
140  }
141 
142  for(int i = 0; i < (int) (*pElectrons).size() ; i++){
143  if((*pElectrons)[i].pt() < _minElectronEt || fabs((*pElectrons)[i].eta()) > _maxElectronEta) continue;
144 
145  componentPtrs.push_back(pElectrons->ptrAt(i));
146  }
147 
148  for(int i = 0; i < (int) (*pPhotons).size() ; i++){
149  if((*pPhotons)[i].pt() < _minPhotonEt || fabs((*pPhotons)[i].eta()) > _maxPhotonEta) continue;
150 
151  componentPtrs.push_back(pPhotons->ptrAt(i));
152  }
153 
154  //aren't taus included in jets?
155  for(int i = 0; i < (int) (*pTaus).size() ; i++){
156  if((*pTaus)[i].pt() < _minTauEt || fabs((*pTaus)[i].eta()) > _maxTauEta) continue;
157 
158  componentPtrs.push_back(pTaus->ptrAt(i));
159  }
160 
161  // create product
162  auto hemispheres = std::make_unique<std::vector<Hemisphere>>();
163  hemispheres->reserve(2);
164 
165  //calls HemiAlgorithm for seed method 3 (transv. inv. Mass) and association method 3 (Lund algo)
166  HemisphereAlgo myHemi(componentPtrs,_seedMethod,_combinationMethod);
167 
168  //get Hemisphere Axis
169  vA1 = myHemi.getAxis1();
170  vA2 = myHemi.getAxis2();
171 
172  reco::Particle::LorentzVector p1(vA1[0]*vA1[3],vA1[1]*vA1[3],vA1[2]*vA1[3],vA1[4]);
173  hemispheres->push_back(Hemisphere(p1));
174 
175  reco::Particle::LorentzVector p2(vA2[0]*vA2[3],vA2[1]*vA2[3],vA2[2]*vA2[3],vA2[4]);
176  hemispheres->push_back(Hemisphere(p2));
177 
178  //get information to which Hemisphere each object belongs
179  vgroups = myHemi.getGrouping();
180 
181  for ( unsigned int i=0; i<vgroups.size(); ++i ) {
182  if ( vgroups[i]==1 ) {
183  (*hemispheres)[0].addDaughter(componentPtrs[i]);
184  }
185  else {
186  (*hemispheres)[1].addDaughter(componentPtrs[i]);
187  }
188  }
189 
190 
191  iEvent.put(std::move(hemispheres));
192 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
Ptr< value_type > ptrAt(size_type i) const
const edm::EDGetTokenT< reco::CandidateView > _patElectronsToken
const edm::EDGetTokenT< reco::CandidateView > _patTausToken
double p2[4]
Definition: TauolaWrapper.h:90
const edm::EDGetTokenT< reco::CandidateView > _patJetsToken
Input: All PAT objects that are to cross-clean or needed for that.
HLT enums.
double p1[4]
Definition: TauolaWrapper.h:89
const edm::EDGetTokenT< reco::CandidateView > _patPhotonsToken
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
const edm::EDGetTokenT< reco::CandidateView > _patMuonsToken
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

const int PATHemisphereProducer::_combinationMethod
private

Definition at line 70 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_maxElectronEta
private

Definition at line 65 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_maxJetEta
private

Definition at line 63 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_maxMuonEta
private

Definition at line 64 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_maxPhotonEta
private

Definition at line 67 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_maxTauEta
private

Definition at line 66 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_minElectronEt
private

Definition at line 59 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_minJetEt
private

Definition at line 57 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_minMuonEt
private

Definition at line 58 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_minPhotonEt
private

Definition at line 61 of file PATHemisphereProducer.h.

Referenced by produce().

const float PATHemisphereProducer::_minTauEt
private

Definition at line 60 of file PATHemisphereProducer.h.

Referenced by produce().

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

Definition at line 53 of file PATHemisphereProducer.h.

Referenced by produce().

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

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

Definition at line 50 of file PATHemisphereProducer.h.

Referenced by produce().

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

Definition at line 52 of file PATHemisphereProducer.h.

Referenced by produce().

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

Definition at line 54 of file PATHemisphereProducer.h.

Referenced by produce().

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

Definition at line 55 of file PATHemisphereProducer.h.

Referenced by produce().

const int PATHemisphereProducer::_seedMethod
private

Definition at line 69 of file PATHemisphereProducer.h.

Referenced by produce().