CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- 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)
 

Private Member Functions

 FFTJetVertexAdder ()
 
 FFTJetVertexAdder (const FFTJetVertexAdder &)
 
FFTJetVertexAdderoperator= (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
 

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)
 

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 outputLabel.

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  rGauss_(0)
110 {
111  produces<reco::VertexCollection>(outputLabel);
112 }
const std::string outputLabel
const bool addExistingVertices
#define init_param(type, varname)
const unsigned nVerticesToMake
const edm::InputTag beamSpotLabel
const edm::InputTag existingVerticesLabel
CLHEP::RandGauss * rGauss_
FFTJetVertexAdder::~FFTJetVertexAdder ( )

Definition at line 115 of file FFTJetVertexAdder.cc.

References rGauss_.

116 {
117  delete rGauss_;
118 }
CLHEP::RandGauss * rGauss_
FFTJetVertexAdder::FFTJetVertexAdder ( )
private
FFTJetVertexAdder::FFTJetVertexAdder ( const FFTJetVertexAdder )
private

Member Function Documentation

void FFTJetVertexAdder::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 194 of file FFTJetVertexAdder.cc.

References edm::RandomNumberGenerator::getEngine(), edm::Service< T >::isAvailable(), and rGauss_.

195 {
196  if (!rGauss_)
197  {
199  if ( !rng.isAvailable() )
200  throw cms::Exception("FFTJetBadConfig")
201  << "ERROR in FFTJetVertexAdder:"
202  " failed to initialize the random number generator"
203  << std::endl;
204  rGauss_ = new CLHEP::RandGauss(rng->getEngine());
205  }
206 }
bool isAvailable() const
Definition: Service.h:46
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
CLHEP::RandGauss * rGauss_
void FFTJetVertexAdder::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 210 of file FFTJetVertexAdder.cc.

211 {
212 }
FFTJetVertexAdder& FFTJetVertexAdder::operator= ( const FFTJetVertexAdder )
private
void FFTJetVertexAdder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements edm::EDProducer.

Definition at line 122 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.

124 {
125  // get PFCandidates
126  std::auto_ptr<reco::VertexCollection> pOutput(new reco::VertexCollection);
127 
128  double xmean = fixedX;
129  double ymean = fixedY;
130  double zmean = fixedZ;
131 
132  double xwidth = sigmaX;
133  double ywidth = sigmaY;
134  double zwidth = sigmaZ;
135 
136  if (useBeamSpot)
137  {
138  edm::Handle<reco::BeamSpot> beamSpotHandle;
139  iEvent.getByLabel(beamSpotLabel, beamSpotHandle);
140  if (!beamSpotHandle.isValid())
141  throw cms::Exception("FFTJetBadConfig")
142  << "ERROR in FFTJetVertexAdder:"
143  " could not find beam spot information"
144  << std::endl;
145 
146  xmean = beamSpotHandle->x0();
147  ymean = beamSpotHandle->y0();
148  zmean = beamSpotHandle->z0();
149 
150  xwidth = beamSpotHandle->BeamWidthX();
151  ywidth = beamSpotHandle->BeamWidthY();
152  zwidth = beamSpotHandle->sigmaZ();
153  }
154 
156  for (unsigned i=0; i<3; ++i)
157  for (unsigned j=0; j<3; ++j)
158  err[i][j] = 0.0;
159  err[0][0] = errX*errX;
160  err[1][1] = errY*errY;
161  err[2][2] = errZ*errZ;
162 
163  for (unsigned iv=0; iv<nVerticesToMake; ++iv)
164  {
165  const double x0 = (*rGauss_)(xmean, xwidth);
166  const double y0 = (*rGauss_)(ymean, ywidth);
167  const double z0 = (*rGauss_)(zmean, zwidth);
168  const reco::Vertex::Point position(x0, y0, z0);
169  pOutput->push_back(reco::Vertex(position, err, chi2, nDof, 0));
170  }
171 
173  {
174  typedef reco::VertexCollection::const_iterator IV;
175 
177  iEvent.getByLabel(existingVerticesLabel, vertices);
178  if (!vertices.isValid())
179  throw cms::Exception("FFTJetBadConfig")
180  << "ERROR in FFTJetVertexAdder:"
181  " could not find existing collection of vertices"
182  << std::endl;
183 
184  const IV vertend(vertices->end());
185  for (IV iv=vertices->begin(); iv!=vertend; ++iv)
186  pOutput->push_back(*iv);
187  }
188 
189  iEvent.put(pOutput, outputLabel);
190 }
int i
Definition: DBlmapReader.cc:9
const std::string outputLabel
const bool addExistingVertices
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
const unsigned nVerticesToMake
const edm::InputTag beamSpotLabel
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
int j
Definition: DBlmapReader.cc:9
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
const edm::InputTag existingVerticesLabel
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390

Member Data Documentation

const bool FFTJetVertexAdder::addExistingVertices
private

Definition at line 67 of file FFTJetVertexAdder.cc.

Referenced by produce().

const edm::InputTag FFTJetVertexAdder::beamSpotLabel
private

Definition at line 62 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::chi2
private

Definition at line 78 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errX
private

Definition at line 79 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errY
private

Definition at line 80 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errZ
private

Definition at line 81 of file FFTJetVertexAdder.cc.

Referenced by produce().

const edm::InputTag FFTJetVertexAdder::existingVerticesLabel
private

Definition at line 63 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::fixedX
private

Definition at line 69 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::fixedY
private

Definition at line 70 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::fixedZ
private

Definition at line 71 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::nDof
private

Definition at line 77 of file FFTJetVertexAdder.cc.

Referenced by produce().

const unsigned FFTJetVertexAdder::nVerticesToMake
private

Definition at line 83 of file FFTJetVertexAdder.cc.

Referenced by produce().

const std::string FFTJetVertexAdder::outputLabel
private

Definition at line 64 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

CLHEP::RandGauss* FFTJetVertexAdder::rGauss_
private

Definition at line 85 of file FFTJetVertexAdder.cc.

Referenced by beginJob(), and ~FFTJetVertexAdder().

const double FFTJetVertexAdder::sigmaX
private

Definition at line 73 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::sigmaY
private

Definition at line 74 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::sigmaZ
private

Definition at line 75 of file FFTJetVertexAdder.cc.

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

const bool FFTJetVertexAdder::useBeamSpot
private

Definition at line 66 of file FFTJetVertexAdder.cc.

Referenced by produce().