CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
PATHemisphereProducer Class Reference

#include <PATHemisphereProducer.h>

Inheritance diagram for PATHemisphereProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATHemisphereProducer (const edm::ParameterSet &)
 
 ~PATHemisphereProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 

Private Types

typedef std::vector< float > HemiAxis
 

Private Member Functions

virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

int _combinationMethod
 
float _maxElectronEta
 
float _maxJetEta
 
float _maxMuonEta
 
float _maxPhotonEta
 
float _maxTauEta
 
float _minElectronEt
 
float _minJetEt
 
float _minMuonEt
 
float _minPhotonEt
 
float _minTauEt
 
edm::EDGetTokenT
< reco::CandidateView
_patElectronsToken
 
edm::EDGetTokenT
< reco::CandidateView
_patJetsToken
 Input: All PAT objects that are to cross-clean or needed for that. More...
 
edm::EDGetTokenT
< reco::CandidateView
_patMuonsToken
 
edm::EDGetTokenT
< reco::CandidateView
_patPhotonsToken
 
edm::EDGetTokenT
< reco::CandidateView
_patTausToken
 
int _seedMethod
 
std::vector< reco::CandidatePtrcomponentPtrs_
 
HemisphereAlgomyHemi
 
std::vector< float > vA1
 
std::vector< float > vA2
 
std::vector< float > vE
 
std::vector< int > vgroups
 
std::vector< float > vPx
 
std::vector< float > vPy
 
std::vector< float > vPz
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 40 of file PATHemisphereProducer.h.

Member Typedef Documentation

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

Definition at line 81 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
edm::EDGetTokenT< reco::CandidateView > _patElectronsToken
edm::EDGetTokenT< reco::CandidateView > _patPhotonsToken
edm::EDGetTokenT< reco::CandidateView > _patJetsToken
Input: All PAT objects that are to cross-clean or needed for that.
edm::EDGetTokenT< reco::CandidateView > _patMuonsToken
edm::EDGetTokenT< reco::CandidateView > _patTausToken
PATHemisphereProducer::~PATHemisphereProducer ( )

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::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 203 of file PATHemisphereProducer.cc.

203  {
204 
205 }
void PATHemisphereProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

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, componentPtrs_, eta(), HemisphereAlgo::getAxis1(), HemisphereAlgo::getAxis2(), edm::Event::getByToken(), HemisphereAlgo::getGrouping(), i, myHemi, p1, p2, edm::Event::put(), vA1, vA2, vE, vgroups, vPx, vPy, and vPz.

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

Member Data Documentation

int PATHemisphereProducer::_combinationMethod
private

Definition at line 71 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_maxElectronEta
private

Definition at line 66 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_maxJetEta
private

Definition at line 64 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_maxMuonEta
private

Definition at line 65 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_maxPhotonEta
private

Definition at line 68 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_maxTauEta
private

Definition at line 67 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_minElectronEt
private

Definition at line 60 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_minJetEt
private

Definition at line 58 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_minMuonEt
private

Definition at line 59 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_minPhotonEt
private

Definition at line 62 of file PATHemisphereProducer.h.

Referenced by produce().

float PATHemisphereProducer::_minTauEt
private

Definition at line 61 of file PATHemisphereProducer.h.

Referenced by produce().

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

Definition at line 54 of file PATHemisphereProducer.h.

Referenced by produce().

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

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

Definition at line 51 of file PATHemisphereProducer.h.

Referenced by produce().

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

Definition at line 53 of file PATHemisphereProducer.h.

Referenced by produce().

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

Definition at line 55 of file PATHemisphereProducer.h.

Referenced by produce().

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

Definition at line 56 of file PATHemisphereProducer.h.

Referenced by produce().

int PATHemisphereProducer::_seedMethod
private

Definition at line 70 of file PATHemisphereProducer.h.

Referenced by produce().

std::vector<reco::CandidatePtr> PATHemisphereProducer::componentPtrs_
private

Definition at line 78 of file PATHemisphereProducer.h.

Referenced by produce().

HemisphereAlgo* PATHemisphereProducer::myHemi
private

Definition at line 73 of file PATHemisphereProducer.h.

Referenced by produce().

std::vector<float> PATHemisphereProducer::vA1
private

Definition at line 76 of file PATHemisphereProducer.h.

Referenced by produce().

std::vector<float> PATHemisphereProducer::vA2
private

Definition at line 76 of file PATHemisphereProducer.h.

Referenced by produce().

std::vector<float> PATHemisphereProducer::vE
private

Definition at line 75 of file PATHemisphereProducer.h.

Referenced by produce().

std::vector<int> PATHemisphereProducer::vgroups
private

Definition at line 77 of file PATHemisphereProducer.h.

Referenced by produce().

std::vector<float> PATHemisphereProducer::vPx
private

Definition at line 75 of file PATHemisphereProducer.h.

Referenced by produce().

std::vector<float> PATHemisphereProducer::vPy
private

Definition at line 75 of file PATHemisphereProducer.h.

Referenced by produce().

std::vector<float> PATHemisphereProducer::vPz
private

Definition at line 75 of file PATHemisphereProducer.h.

Referenced by produce().