CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
FFTJetVertexAdder Class Reference

#include <RecoJets/FFTJetProducers/plugins/FFTJetVertexAdder.cc>

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

Public Member Functions

 FFTJetVertexAdder (const edm::ParameterSet &)
 
 ~FFTJetVertexAdder () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 

Private Member Functions

 FFTJetVertexAdder ()=delete
 
 FFTJetVertexAdder (const FFTJetVertexAdder &)=delete
 
FFTJetVertexAdderoperator= (const FFTJetVertexAdder &)=delete
 

Private Attributes

const bool addExistingVertices
 
const edm::InputTag beamSpotLabel
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken
 
const double chi2
 
const double errX
 
const double errY
 
const double errZ
 
const edm::InputTag existingVerticesLabel
 
edm::EDGetTokenT< reco::VertexCollectionexistingVerticesToken
 
const double fixedX
 
const double fixedY
 
const double fixedZ
 
const double nDof
 
const unsigned nVerticesToMake
 
const std::string outputLabel
 
const double sigmaX
 
const double sigmaY
 
const double sigmaZ
 
const bool useBeamSpot
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Description: adds a collection of fake vertices to the event record

Implementation: [Notes on implementation]

Definition at line 45 of file FFTJetVertexAdder.cc.

Constructor & Destructor Documentation

◆ FFTJetVertexAdder() [1/3]

FFTJetVertexAdder::FFTJetVertexAdder ( const edm::ParameterSet ps)
explicit

Definition at line 92 of file FFTJetVertexAdder.cc.

96  init_param(bool, useBeamSpot),
98  init_param(double, fixedX),
99  init_param(double, fixedY),
100  init_param(double, fixedZ),
101  init_param(double, sigmaX),
102  init_param(double, sigmaY),
103  init_param(double, sigmaZ),
104  init_param(double, nDof),
105  init_param(double, chi2),
106  init_param(double, errX),
107  init_param(double, errY),
108  init_param(double, errZ),
109  init_param(unsigned, nVerticesToMake) {
110  if (useBeamSpot)
111  beamSpotToken = consumes<reco::BeamSpot>(beamSpotLabel);
113  existingVerticesToken = consumes<reco::VertexCollection>(existingVerticesLabel);
114  produces<reco::VertexCollection>(outputLabel);
115 }

References addExistingVertices, beamSpotLabel, beamSpotToken, existingVerticesLabel, existingVerticesToken, outputLabel, and useBeamSpot.

◆ ~FFTJetVertexAdder()

FFTJetVertexAdder::~FFTJetVertexAdder ( )
override

Definition at line 117 of file FFTJetVertexAdder.cc.

117 {}

◆ FFTJetVertexAdder() [2/3]

FFTJetVertexAdder::FFTJetVertexAdder ( )
privatedelete

◆ FFTJetVertexAdder() [3/3]

FFTJetVertexAdder::FFTJetVertexAdder ( const FFTJetVertexAdder )
privatedelete

Member Function Documentation

◆ beginJob()

void FFTJetVertexAdder::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 187 of file FFTJetVertexAdder.cc.

187  {
189  if (!rng.isAvailable()) {
190  throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:"
191  " failed to initialize the random number generator"
192  << std::endl;
193  }
194 }

References Exception, and edm::Service< T >::isAvailable().

◆ endJob()

void FFTJetVertexAdder::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 197 of file FFTJetVertexAdder.cc.

197 {}

◆ operator=()

FFTJetVertexAdder& FFTJetVertexAdder::operator= ( const FFTJetVertexAdder )
privatedelete

◆ produce()

void FFTJetVertexAdder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements edm::EDProducer.

Definition at line 120 of file FFTJetVertexAdder.cc.

120  {
122  CLHEP::RandGauss rGauss(rng->getEngine(iEvent.streamID()));
123 
124  // get PFCandidates
125  auto pOutput = std::make_unique<reco::VertexCollection>();
126 
127  double xmean = fixedX;
128  double ymean = fixedY;
129  double zmean = fixedZ;
130 
131  double xwidth = sigmaX;
132  double ywidth = sigmaY;
133  double zwidth = sigmaZ;
134 
135  if (useBeamSpot) {
136  edm::Handle<reco::BeamSpot> beamSpotHandle;
137  iEvent.getByToken(beamSpotToken, beamSpotHandle);
138  if (!beamSpotHandle.isValid())
139  throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:"
140  " could not find beam spot information"
141  << std::endl;
142 
143  xmean = beamSpotHandle->x0();
144  ymean = beamSpotHandle->y0();
145  zmean = beamSpotHandle->z0();
146 
147  xwidth = beamSpotHandle->BeamWidthX();
148  ywidth = beamSpotHandle->BeamWidthY();
149  zwidth = beamSpotHandle->sigmaZ();
150  }
151 
153  for (unsigned i = 0; i < 3; ++i)
154  for (unsigned j = 0; j < 3; ++j)
155  err[i][j] = 0.0;
156  err[0][0] = errX * errX;
157  err[1][1] = errY * errY;
158  err[2][2] = errZ * errZ;
159 
160  for (unsigned iv = 0; iv < nVerticesToMake; ++iv) {
161  const double x0 = rGauss(xmean, xwidth);
162  const double y0 = rGauss(ymean, ywidth);
163  const double z0 = rGauss(zmean, zwidth);
164  const reco::Vertex::Point position(x0, y0, z0);
165  pOutput->push_back(reco::Vertex(position, err, chi2, nDof, 0));
166  }
167 
168  if (addExistingVertices) {
169  typedef reco::VertexCollection::const_iterator IV;
170 
173  if (!vertices.isValid())
174  throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:"
175  " could not find existing collection of vertices"
176  << std::endl;
177 
178  const IV vertend(vertices->end());
179  for (IV iv = vertices->begin(); iv != vertend; ++iv)
180  pOutput->push_back(*iv);
181  }
182 
183  iEvent.put(std::move(pOutput), outputLabel);
184 }

References addExistingVertices, beamSpotToken, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthY(), chi2, runTheMatrix::err, errX, errY, errZ, existingVerticesToken, fixedX, fixedY, fixedZ, edm::RandomNumberGenerator::getEngine(), mps_fire::i, iEvent, edm::HandleBase::isValid(), dqmiolumiharvest::j, eostools::move(), nDof, nVerticesToMake, outputLabel, position, sigmaX, sigmaY, reco::BeamSpot::sigmaZ(), sigmaZ, useBeamSpot, pwdgSkimBPark_cfi::vertices, reco::BeamSpot::x0(), reco::BeamSpot::y0(), reco::BeamSpot::z0(), and HLTMuonOfflineAnalyzer_cfi::z0.

Member Data Documentation

◆ addExistingVertices

const bool FFTJetVertexAdder::addExistingVertices
private

Definition at line 70 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

◆ beamSpotLabel

const edm::InputTag FFTJetVertexAdder::beamSpotLabel
private

Definition at line 61 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder().

◆ beamSpotToken

edm::EDGetTokenT<reco::BeamSpot> FFTJetVertexAdder::beamSpotToken
private

Definition at line 64 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

◆ chi2

const double FFTJetVertexAdder::chi2
private

Definition at line 81 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ errX

const double FFTJetVertexAdder::errX
private

Definition at line 82 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ errY

const double FFTJetVertexAdder::errY
private

Definition at line 83 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ errZ

const double FFTJetVertexAdder::errZ
private

Definition at line 84 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ existingVerticesLabel

const edm::InputTag FFTJetVertexAdder::existingVerticesLabel
private

Definition at line 62 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder().

◆ existingVerticesToken

edm::EDGetTokenT<reco::VertexCollection> FFTJetVertexAdder::existingVerticesToken
private

Definition at line 65 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

◆ fixedX

const double FFTJetVertexAdder::fixedX
private

Definition at line 72 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ fixedY

const double FFTJetVertexAdder::fixedY
private

Definition at line 73 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ fixedZ

const double FFTJetVertexAdder::fixedZ
private

Definition at line 74 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ nDof

const double FFTJetVertexAdder::nDof
private

Definition at line 80 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ nVerticesToMake

const unsigned FFTJetVertexAdder::nVerticesToMake
private

Definition at line 86 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ outputLabel

const std::string FFTJetVertexAdder::outputLabel
private

Definition at line 67 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

◆ sigmaX

const double FFTJetVertexAdder::sigmaX
private

Definition at line 76 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ sigmaY

const double FFTJetVertexAdder::sigmaY
private

Definition at line 77 of file FFTJetVertexAdder.cc.

Referenced by produce().

◆ sigmaZ

const double FFTJetVertexAdder::sigmaZ
private

Definition at line 78 of file FFTJetVertexAdder.cc.

Referenced by produce(), and BeamSpotObj.BeamSpot::Reset().

◆ useBeamSpot

const bool FFTJetVertexAdder::useBeamSpot
private

Definition at line 69 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
mps_fire.i
i
Definition: mps_fire.py:355
FFTJetVertexAdder::sigmaX
const double sigmaX
Definition: FFTJetVertexAdder.cc:76
FFTJetVertexAdder::outputLabel
const std::string outputLabel
Definition: FFTJetVertexAdder.cc:67
reco::BeamSpot::z0
double z0() const
z coordinate
Definition: BeamSpot.h:65
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
FFTJetVertexAdder::errX
const double errX
Definition: FFTJetVertexAdder.cc:82
FFTJetVertexAdder::sigmaZ
const double sigmaZ
Definition: FFTJetVertexAdder.cc:78
FFTJetVertexAdder::fixedY
const double fixedY
Definition: FFTJetVertexAdder.cc:73
edm::Handle< reco::BeamSpot >
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
FFTJetVertexAdder::nVerticesToMake
const unsigned nVerticesToMake
Definition: FFTJetVertexAdder.cc:86
FFTJetVertexAdder::fixedX
const double fixedX
Definition: FFTJetVertexAdder.cc:72
reco::BeamSpot::sigmaZ
double sigmaZ() const
sigma z
Definition: BeamSpot.h:76
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
FFTJetVertexAdder::existingVerticesToken
edm::EDGetTokenT< reco::VertexCollection > existingVerticesToken
Definition: FFTJetVertexAdder.cc:65
FFTJetVertexAdder::nDof
const double nDof
Definition: FFTJetVertexAdder.cc:80
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FFTJetVertexAdder::beamSpotLabel
const edm::InputTag beamSpotLabel
Definition: FFTJetVertexAdder.cc:61
FFTJetVertexAdder::errZ
const double errZ
Definition: FFTJetVertexAdder.cc:84
runTheMatrix.err
err
Definition: runTheMatrix.py:288
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
FFTJetVertexAdder::existingVerticesLabel
const edm::InputTag existingVerticesLabel
Definition: FFTJetVertexAdder.cc:62
edm::Service< edm::RandomNumberGenerator >
iEvent
int iEvent
Definition: GenABIO.cc:224
init_param
#define init_param(type, varname)
Definition: FFTJetVertexAdder.cc:40
reco::BeamSpot::BeamWidthX
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:82
FFTJetVertexAdder::fixedZ
const double fixedZ
Definition: FFTJetVertexAdder.cc:74
FFTJetVertexAdder::sigmaY
const double sigmaY
Definition: FFTJetVertexAdder.cc:77
reco::BeamSpot::x0
double x0() const
x coordinate
Definition: BeamSpot.h:61
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
eostools.move
def move(src, dest)
Definition: eostools.py:511
FFTJetVertexAdder::chi2
const double chi2
Definition: FFTJetVertexAdder.cc:81
Exception
Definition: hltDiff.cc:246
FFTJetVertexAdder::useBeamSpot
const bool useBeamSpot
Definition: FFTJetVertexAdder.cc:69
cms::Exception
Definition: Exception.h:70
FFTJetVertexAdder::errY
const double errY
Definition: FFTJetVertexAdder.cc:83
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
reco::BeamSpot::y0
double y0() const
y coordinate
Definition: BeamSpot.h:63
edm::InputTag
Definition: InputTag.h:15
reco::Vertex
Definition: Vertex.h:35
FFTJetVertexAdder::addExistingVertices
const bool addExistingVertices
Definition: FFTJetVertexAdder.cc:70
FFTJetVertexAdder::beamSpotToken
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
Definition: FFTJetVertexAdder.cc:64
reco::BeamSpot::BeamWidthY
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:84
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7