#include <RecoJets/FFTJetProducers/plugins/FFTJetVertexAdder.cc>
Public Member Functions | |
FFTJetVertexAdder (const edm::ParameterSet &) | |
~FFTJetVertexAdder () | |
Protected Member Functions | |
void | beginJob () |
void | endJob () |
void | produce (edm::Event &, const edm::EventSetup &) |
Private Member Functions | |
FFTJetVertexAdder () | |
FFTJetVertexAdder (const FFTJetVertexAdder &) | |
FFTJetVertexAdder & | operator= (const FFTJetVertexAdder &) |
Private Attributes | |
const bool | addExistingVertices |
const edm::InputTag | beamSpotLabel |
const double | chi2 |
const double | errX |
const double | errY |
const double | errZ |
const edm::InputTag | existingVerticesLabel |
const double | fixedX |
const double | fixedY |
const double | fixedZ |
const double | nDof |
const unsigned | nVerticesToMake |
const std::string | outputLabel |
CLHEP::RandGauss * | rGauss_ |
const double | sigmaX |
const double | sigmaY |
const double | sigmaZ |
const bool | useBeamSpot |
Description: adds a collection of fake vertices to the event record
Implementation: [Notes on implementation]
Definition at line 46 of file FFTJetVertexAdder.cc.
FFTJetVertexAdder::FFTJetVertexAdder | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 92 of file FFTJetVertexAdder.cc.
References outputLabel.
: init_param(edm::InputTag, beamSpotLabel), init_param(edm::InputTag, existingVerticesLabel), init_param(std::string, outputLabel), init_param(bool, useBeamSpot), init_param(bool, addExistingVertices), init_param(double, fixedX), init_param(double, fixedY), init_param(double, fixedZ), init_param(double, sigmaX), init_param(double, sigmaY), init_param(double, sigmaZ), init_param(double, nDof), init_param(double, chi2), init_param(double, errX), init_param(double, errY), init_param(double, errZ), init_param(unsigned, nVerticesToMake), rGauss_(0) { produces<reco::VertexCollection>(outputLabel); }
FFTJetVertexAdder::~FFTJetVertexAdder | ( | ) |
FFTJetVertexAdder::FFTJetVertexAdder | ( | ) | [private] |
FFTJetVertexAdder::FFTJetVertexAdder | ( | const FFTJetVertexAdder & | ) | [private] |
void FFTJetVertexAdder::beginJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 195 of file FFTJetVertexAdder.cc.
References edm::Service< T >::isAvailable(), and rGauss_.
{ if (!rGauss_) { edm::Service<edm::RandomNumberGenerator> rng; if ( !rng.isAvailable() ) throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:" " failed to initialize the random number generator" << std::endl; rGauss_ = new CLHEP::RandGauss(rng->getEngine()); } }
void FFTJetVertexAdder::endJob | ( | void | ) | [protected, virtual] |
FFTJetVertexAdder& FFTJetVertexAdder::operator= | ( | const FFTJetVertexAdder & | ) | [private] |
void FFTJetVertexAdder::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
Implements edm::EDProducer.
Definition at line 123 of file FFTJetVertexAdder.cc.
References addExistingVertices, beamSpotLabel, chi2, errX, errY, errZ, existingVerticesLabel, fixedX, fixedY, fixedZ, edm::Event::getByLabel(), i, edm::HandleBase::isValid(), j, nDof, nVerticesToMake, outputLabel, position, edm::Event::put(), sigmaX, sigmaY, sigmaZ, and useBeamSpot.
{ // get PFCandidates std::auto_ptr<reco::VertexCollection> pOutput(new reco::VertexCollection); double xmean = fixedX; double ymean = fixedY; double zmean = fixedZ; double xwidth = sigmaX; double ywidth = sigmaY; double zwidth = sigmaZ; if (useBeamSpot) { edm::Handle<reco::BeamSpot> beamSpotHandle; iEvent.getByLabel(beamSpotLabel, beamSpotHandle); if (!beamSpotHandle.isValid()) throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:" " could not find beam spot information" << std::endl; xmean = beamSpotHandle->x0(); ymean = beamSpotHandle->y0(); zmean = beamSpotHandle->z0(); xwidth = beamSpotHandle->BeamWidthX(); ywidth = beamSpotHandle->BeamWidthY(); zwidth = beamSpotHandle->sigmaZ(); } reco::Vertex::Error err; for (unsigned i=0; i<3; ++i) for (unsigned j=0; j<3; ++j) err[i][j] = 0.0; err[0][0] = errX*errX; err[1][1] = errY*errY; err[2][2] = errZ*errZ; for (unsigned iv=0; iv<nVerticesToMake; ++iv) { const double x0 = (*rGauss_)(xmean, xwidth); const double y0 = (*rGauss_)(ymean, ywidth); const double z0 = (*rGauss_)(zmean, zwidth); const reco::Vertex::Point position(x0, y0, z0); pOutput->push_back(reco::Vertex(position, err, chi2, nDof, 0)); } if (addExistingVertices) { typedef reco::VertexCollection::const_iterator IV; edm::Handle<reco::VertexCollection> vertices; iEvent.getByLabel(existingVerticesLabel, vertices); if (!vertices.isValid()) throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetVertexAdder:" " could not find existing collection of vertices" << std::endl; const IV vertend(vertices->end()); for (IV iv=vertices->begin(); iv!=vertend; ++iv) pOutput->push_back(*iv); } iEvent.put(pOutput, outputLabel); }
const bool FFTJetVertexAdder::addExistingVertices [private] |
Definition at line 68 of file FFTJetVertexAdder.cc.
Referenced by produce().
const edm::InputTag FFTJetVertexAdder::beamSpotLabel [private] |
Definition at line 63 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::chi2 [private] |
Definition at line 79 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::errX [private] |
Definition at line 80 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::errY [private] |
Definition at line 81 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::errZ [private] |
Definition at line 82 of file FFTJetVertexAdder.cc.
Referenced by produce().
const edm::InputTag FFTJetVertexAdder::existingVerticesLabel [private] |
Definition at line 64 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::fixedX [private] |
Definition at line 70 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::fixedY [private] |
Definition at line 71 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::fixedZ [private] |
Definition at line 72 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::nDof [private] |
Definition at line 78 of file FFTJetVertexAdder.cc.
Referenced by produce().
const unsigned FFTJetVertexAdder::nVerticesToMake [private] |
Definition at line 84 of file FFTJetVertexAdder.cc.
Referenced by produce().
const std::string FFTJetVertexAdder::outputLabel [private] |
Definition at line 65 of file FFTJetVertexAdder.cc.
Referenced by FFTJetVertexAdder(), and produce().
CLHEP::RandGauss* FFTJetVertexAdder::rGauss_ [private] |
Definition at line 86 of file FFTJetVertexAdder.cc.
Referenced by beginJob(), and ~FFTJetVertexAdder().
const double FFTJetVertexAdder::sigmaX [private] |
Definition at line 74 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::sigmaY [private] |
Definition at line 75 of file FFTJetVertexAdder.cc.
Referenced by produce().
const double FFTJetVertexAdder::sigmaZ [private] |
Definition at line 76 of file FFTJetVertexAdder.cc.
Referenced by produce().
const bool FFTJetVertexAdder::useBeamSpot [private] |
Definition at line 67 of file FFTJetVertexAdder.cc.
Referenced by produce().