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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::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
 
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
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)
 

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 93 of file FFTJetVertexAdder.cc.

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

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

Definition at line 120 of file FFTJetVertexAdder.cc.

121 {
122 }
FFTJetVertexAdder::FFTJetVertexAdder ( )
private
FFTJetVertexAdder::FFTJetVertexAdder ( const FFTJetVertexAdder )
private

Member Function Documentation

void FFTJetVertexAdder::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 201 of file FFTJetVertexAdder.cc.

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

202 {
204  if ( !rng.isAvailable() ) {
205  throw cms::Exception("FFTJetBadConfig")
206  << "ERROR in FFTJetVertexAdder:"
207  " failed to initialize the random number generator"
208  << std::endl;
209  }
210 }
bool isAvailable() const
Definition: Service.h:46
void FFTJetVertexAdder::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 214 of file FFTJetVertexAdder.cc.

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

Implements edm::EDProducer.

Definition at line 126 of file FFTJetVertexAdder.cc.

References addExistingVertices, beamSpotToken, chi2, errX, errY, errZ, existingVerticesToken, fixedX, fixedY, fixedZ, edm::Event::getByToken(), edm::RandomNumberGenerator::getEngine(), i, edm::HandleBase::isValid(), j, nDof, nVerticesToMake, outputLabel, position, edm::Event::put(), sigmaX, sigmaY, sigmaZ, edm::Event::streamID(), useBeamSpot, and HLT_25ns14e33_v1_cff::vertices.

128 {
130  CLHEP::RandGauss rGauss(rng->getEngine(iEvent.streamID()));
131 
132  // get PFCandidates
133  std::auto_ptr<reco::VertexCollection> pOutput(new reco::VertexCollection);
134 
135  double xmean = fixedX;
136  double ymean = fixedY;
137  double zmean = fixedZ;
138 
139  double xwidth = sigmaX;
140  double ywidth = sigmaY;
141  double zwidth = sigmaZ;
142 
143  if (useBeamSpot)
144  {
145  edm::Handle<reco::BeamSpot> beamSpotHandle;
146  iEvent.getByToken(beamSpotToken, beamSpotHandle);
147  if (!beamSpotHandle.isValid())
148  throw cms::Exception("FFTJetBadConfig")
149  << "ERROR in FFTJetVertexAdder:"
150  " could not find beam spot information"
151  << std::endl;
152 
153  xmean = beamSpotHandle->x0();
154  ymean = beamSpotHandle->y0();
155  zmean = beamSpotHandle->z0();
156 
157  xwidth = beamSpotHandle->BeamWidthX();
158  ywidth = beamSpotHandle->BeamWidthY();
159  zwidth = beamSpotHandle->sigmaZ();
160  }
161 
163  for (unsigned i=0; i<3; ++i)
164  for (unsigned j=0; j<3; ++j)
165  err[i][j] = 0.0;
166  err[0][0] = errX*errX;
167  err[1][1] = errY*errY;
168  err[2][2] = errZ*errZ;
169 
170  for (unsigned iv=0; iv<nVerticesToMake; ++iv)
171  {
172  const double x0 = rGauss(xmean, xwidth);
173  const double y0 = rGauss(ymean, ywidth);
174  const double z0 = rGauss(zmean, zwidth);
175  const reco::Vertex::Point position(x0, y0, z0);
176  pOutput->push_back(reco::Vertex(position, err, chi2, nDof, 0));
177  }
178 
180  {
181  typedef reco::VertexCollection::const_iterator IV;
182 
184  iEvent.getByToken(existingVerticesToken, vertices);
185  if (!vertices.isValid())
186  throw cms::Exception("FFTJetBadConfig")
187  << "ERROR in FFTJetVertexAdder:"
188  " could not find existing collection of vertices"
189  << std::endl;
190 
191  const IV vertend(vertices->end());
192  for (IV iv=vertices->begin(); iv!=vertend; ++iv)
193  pOutput->push_back(*iv);
194  }
195 
196  iEvent.put(pOutput, outputLabel);
197 }
int i
Definition: DBlmapReader.cc:9
const std::string outputLabel
const bool addExistingVertices
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
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
edm::EDGetTokenT< reco::VertexCollection > existingVerticesToken
const unsigned nVerticesToMake
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
int j
Definition: DBlmapReader.cc:9
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
bool isValid() const
Definition: HandleBase.h:75
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
static int position[264][3]
Definition: ReadPGInfo.cc:509
StreamID streamID() const
Definition: Event.h:79
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken

Member Data Documentation

const bool FFTJetVertexAdder::addExistingVertices
private

Definition at line 71 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

const edm::InputTag FFTJetVertexAdder::beamSpotLabel
private

Definition at line 62 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder().

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

Definition at line 65 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

const double FFTJetVertexAdder::chi2
private

Definition at line 82 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errX
private

Definition at line 83 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errY
private

Definition at line 84 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::errZ
private

Definition at line 85 of file FFTJetVertexAdder.cc.

Referenced by produce().

const edm::InputTag FFTJetVertexAdder::existingVerticesLabel
private

Definition at line 63 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder().

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

Definition at line 66 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

const double FFTJetVertexAdder::fixedX
private

Definition at line 73 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::fixedY
private

Definition at line 74 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::fixedZ
private

Definition at line 75 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::nDof
private

Definition at line 81 of file FFTJetVertexAdder.cc.

Referenced by produce().

const unsigned FFTJetVertexAdder::nVerticesToMake
private

Definition at line 87 of file FFTJetVertexAdder.cc.

Referenced by produce().

const std::string FFTJetVertexAdder::outputLabel
private

Definition at line 68 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().

const double FFTJetVertexAdder::sigmaX
private

Definition at line 77 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::sigmaY
private

Definition at line 78 of file FFTJetVertexAdder.cc.

Referenced by produce().

const double FFTJetVertexAdder::sigmaZ
private

Definition at line 79 of file FFTJetVertexAdder.cc.

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

const bool FFTJetVertexAdder::useBeamSpot
private

Definition at line 70 of file FFTJetVertexAdder.cc.

Referenced by FFTJetVertexAdder(), and produce().