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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void beginJob ()
 
void endJob ()
 
void produce (edm::Event &, const edm::EventSetup &)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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
 
typedef WorkerT< EDProducerWorkerType
 
- 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 46 of file FFTJetVertexAdder.cc.

Constructor & Destructor Documentation

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

Definition at line 92 of file FFTJetVertexAdder.cc.

References outputLabel.

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  rGauss_(0)
111 {
112  produces<reco::VertexCollection>(outputLabel);
113 }
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 116 of file FFTJetVertexAdder.cc.

References rGauss_.

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

Member Function Documentation

void FFTJetVertexAdder::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 195 of file FFTJetVertexAdder.cc.

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

196 {
197  if (!rGauss_)
198  {
200  if ( !rng.isAvailable() )
201  throw cms::Exception("FFTJetBadConfig")
202  << "ERROR in FFTJetVertexAdder:"
203  " failed to initialize the random number generator"
204  << std::endl;
205  rGauss_ = new CLHEP::RandGauss(rng->getEngine());
206  }
207 }
bool isAvailable() const
Definition: Service.h:47
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  )
protectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 211 of file FFTJetVertexAdder.cc.

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

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.

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

Member Data Documentation

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(), and BeamSpotObj.BeamSpot::Reset().

const bool FFTJetVertexAdder::useBeamSpot
private

Definition at line 67 of file FFTJetVertexAdder.cc.

Referenced by produce().