CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected 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 ()=delete
 
 FFTJetVertexAdder (const FFTJetVertexAdder &)=delete
 
FFTJetVertexAdderoperator= (const FFTJetVertexAdder &)=delete
 
 ~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
 
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 () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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)
 

Protected Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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::VertexCollection
existingVerticesToken
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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::FFTJetVertexAdder ( const edm::ParameterSet ps)
explicit

Definition at line 91 of file FFTJetVertexAdder.cc.

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

95  init_param(bool, useBeamSpot),
97  init_param(double, fixedX),
98  init_param(double, fixedY),
99  init_param(double, fixedZ),
100  init_param(double, sigmaX),
101  init_param(double, sigmaY),
102  init_param(double, sigmaZ),
103  init_param(double, nDof),
104  init_param(double, chi2),
105  init_param(double, errX),
106  init_param(double, errY),
107  init_param(double, errZ),
108  init_param(unsigned, nVerticesToMake) {
109  if (useBeamSpot)
110  beamSpotToken = consumes<reco::BeamSpot>(beamSpotLabel);
112  existingVerticesToken = consumes<reco::VertexCollection>(existingVerticesLabel);
113  produces<reco::VertexCollection>(outputLabel);
114 }
const std::string outputLabel
const bool addExistingVertices
#define init_param(type, varname)
edm::EDGetTokenT< reco::VertexCollection > existingVerticesToken
const unsigned nVerticesToMake
const edm::InputTag beamSpotLabel
const edm::InputTag existingVerticesLabel
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
FFTJetVertexAdder::FFTJetVertexAdder ( )
delete
FFTJetVertexAdder::FFTJetVertexAdder ( const FFTJetVertexAdder )
delete
FFTJetVertexAdder::~FFTJetVertexAdder ( )
override

Definition at line 116 of file FFTJetVertexAdder.cc.

116 {}

Member Function Documentation

void FFTJetVertexAdder::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 186 of file FFTJetVertexAdder.cc.

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

186  {
188  if (!rng.isAvailable()) {
189  throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:"
190  " failed to initialize the random number generator"
191  << std::endl;
192  }
193 }
bool isAvailable() const
Definition: Service.h:40
void FFTJetVertexAdder::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 196 of file FFTJetVertexAdder.cc.

196 {}
FFTJetVertexAdder& FFTJetVertexAdder::operator= ( const FFTJetVertexAdder )
delete
void FFTJetVertexAdder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements edm::EDProducer.

Definition at line 119 of file FFTJetVertexAdder.cc.

References addExistingVertices, beamSpotToken, chi2, submitPVValidationJobs::err, errX, errY, errZ, existingVerticesToken, fixedX, fixedY, fixedZ, edm::Event::getByToken(), edm::RandomNumberGenerator::getEngine(), mps_fire::i, edm::HandleBase::isValid(), gpuVertexFinder::iv, dqmiolumiharvest::j, eostools::move(), nDof, nVerticesToMake, outputLabel, position, edm::Event::put(), sigmaX, sigmaY, sigmaZ, edm::Event::streamID(), useBeamSpot, and beam_dqm_sourceclient-live_cfg::vertices.

119  {
121  CLHEP::RandGauss rGauss(rng->getEngine(iEvent.streamID()));
122 
123  // get PFCandidates
124  auto pOutput = std::make_unique<reco::VertexCollection>();
125 
126  double xmean = fixedX;
127  double ymean = fixedY;
128  double zmean = fixedZ;
129 
130  double xwidth = sigmaX;
131  double ywidth = sigmaY;
132  double zwidth = sigmaZ;
133 
134  if (useBeamSpot) {
135  edm::Handle<reco::BeamSpot> beamSpotHandle;
136  iEvent.getByToken(beamSpotToken, beamSpotHandle);
137  if (!beamSpotHandle.isValid())
138  throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:"
139  " could not find beam spot information"
140  << std::endl;
141 
142  xmean = beamSpotHandle->x0();
143  ymean = beamSpotHandle->y0();
144  zmean = beamSpotHandle->z0();
145 
146  xwidth = beamSpotHandle->BeamWidthX();
147  ywidth = beamSpotHandle->BeamWidthY();
148  zwidth = beamSpotHandle->sigmaZ();
149  }
150 
152  for (unsigned i = 0; i < 3; ++i)
153  for (unsigned j = 0; j < 3; ++j)
154  err[i][j] = 0.0;
155  err[0][0] = errX * errX;
156  err[1][1] = errY * errY;
157  err[2][2] = errZ * errZ;
158 
159  for (unsigned iv = 0; iv < nVerticesToMake; ++iv) {
160  const double x0 = rGauss(xmean, xwidth);
161  const double y0 = rGauss(ymean, ywidth);
162  const double z0 = rGauss(zmean, zwidth);
163  const reco::Vertex::Point position(x0, y0, z0);
164  pOutput->push_back(reco::Vertex(position, err, chi2, nDof, 0));
165  }
166 
167  if (addExistingVertices) {
168  typedef reco::VertexCollection::const_iterator IV;
169 
171  iEvent.getByToken(existingVerticesToken, vertices);
172  if (!vertices.isValid())
173  throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:"
174  " could not find existing collection of vertices"
175  << std::endl;
176 
177  const IV vertend(vertices->end());
178  for (IV iv = vertices->begin(); iv != vertend; ++iv)
179  pOutput->push_back(*iv);
180  }
181 
182  iEvent.put(std::move(pOutput), outputLabel);
183 }
const std::string outputLabel
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
int32_t *__restrict__ iv
const bool addExistingVertices
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::EDGetTokenT< reco::VertexCollection > existingVerticesToken
const unsigned nVerticesToMake
def move
Definition: eostools.py:511
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
bool isValid() const
Definition: HandleBase.h:70
static int position[264][3]
Definition: ReadPGInfo.cc:289
StreamID streamID() const
Definition: Event.h:98
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken

Member Data Documentation

const bool FFTJetVertexAdder::addExistingVertices
private

Definition at line 69 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

const edm::InputTag FFTJetVertexAdder::beamSpotLabel
private

Definition at line 60 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder().

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

Definition at line 63 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

const double FFTJetVertexAdder::chi2
private

Definition at line 80 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errX
private

Definition at line 81 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errY
private

Definition at line 82 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errZ
private

Definition at line 83 of file FFTJetVertexAdder.cc.

Referenced by produce().

const edm::InputTag FFTJetVertexAdder::existingVerticesLabel
private

Definition at line 61 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder().

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

Definition at line 64 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

const double FFTJetVertexAdder::fixedX
private

Definition at line 71 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::fixedY
private

Definition at line 72 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::fixedZ
private

Definition at line 73 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::nDof
private

Definition at line 79 of file FFTJetVertexAdder.cc.

Referenced by produce().

const unsigned FFTJetVertexAdder::nVerticesToMake
private

Definition at line 85 of file FFTJetVertexAdder.cc.

Referenced by produce().

const std::string FFTJetVertexAdder::outputLabel
private

Definition at line 66 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

const double FFTJetVertexAdder::sigmaX
private

Definition at line 75 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::sigmaY
private

Definition at line 76 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::sigmaZ
private

Definition at line 77 of file FFTJetVertexAdder.cc.

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

const bool FFTJetVertexAdder::useBeamSpot
private

Definition at line 68 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().