CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Attributes
BeamSpotProducer Class Reference

#include <BeamSpotProducer.h>

Inheritance diagram for BeamSpotProducer:
edm::stream::EDProducer<>

Public Types

typedef std::vector
< edm::ParameterSet
Parameters
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 BeamSpotProducer (const edm::ParameterSet &iConf)
 constructor More...
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 produce a beam spot class More...
 
 ~BeamSpotProducer () override
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

edm::ESGetToken
< BeamSpotObjects,
BeamSpotObjectsRcd
m_beamToken
 

Detailed Description


class: BeamSpotProducer.h package: RecoVertex/BeamSpotProducer

author: Francisco Yumiceva, Fermilab (yumic.nosp@m.eva@.nosp@m.fnal..nosp@m.gov)


Definition at line 25 of file BeamSpotProducer.h.

Member Typedef Documentation

Definition at line 27 of file BeamSpotProducer.h.

Constructor & Destructor Documentation

BeamSpotProducer::BeamSpotProducer ( const edm::ParameterSet iConf)
explicit

constructor

Definition at line 17 of file BeamSpotProducer.cc.

References m_beamToken.

17  {
18  edm::LogInfo("RecoVertex/BeamSpotProducer") << "Initializing Beam Spot producer "
19  << "\n";
20 
21  //fVerbose=conf.getUntrackedParameter<bool>("verbose", false);
22  m_beamToken = esConsumes<BeamSpotObjects, BeamSpotObjectsRcd>();
23 
24  produces<reco::BeamSpot>();
25 }
edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > m_beamToken
Log< level::Info, false > LogInfo
BeamSpotProducer::~BeamSpotProducer ( )
override

destructor

Definition at line 27 of file BeamSpotProducer.cc.

27 {}

Member Function Documentation

void BeamSpotProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

produce a beam spot class

Definition at line 34 of file BeamSpotProducer.cc.

References align::BeamSpot, edm::EventSetup::getHandle(), mps_fire::i, edm::EventBase::id(), dqmiolumiharvest::j, m_beamToken, makeMuonMisalignmentScenario::matrix, eostools::move(), edm::Event::put(), and mps_fire::result.

34  {
35  using namespace edm;
36 
37  auto result = std::make_unique<reco::BeamSpot>();
38 
39  reco::BeamSpot aSpot;
40 
41  //typedef math::XYZPoint Point;
42  //enum { dimension = 7 };
43  //typedef math::Error<dimension>::type CovarianceMatrix;
44 
45  //try {
46  edm::LogInfo("RecoVertex/BeamSpotProducer") << "Reconstructing event number: " << iEvent.id() << "\n";
47 
49  const BeamSpotObjects* spotDB = beamhandle.product();
50 
51  // translate from BeamSpotObjects to reco::BeamSpot
52  reco::BeamSpot::Point apoint(spotDB->x(), spotDB->y(), spotDB->z());
53 
55  for (int i = 0; i < 7; ++i) {
56  for (int j = 0; j < 7; ++j) {
57  matrix(i, j) = spotDB->covariance(i, j);
58  }
59  }
60 
61  // this assume beam width same in x and y
62  aSpot = reco::BeamSpot(apoint, spotDB->sigmaZ(), spotDB->dxdz(), spotDB->dydz(), spotDB->beamWidthX(), matrix);
63  aSpot.setBeamWidthY(spotDB->beamWidthY());
64  aSpot.setEmittanceX(spotDB->emittanceX());
65  aSpot.setEmittanceY(spotDB->emittanceY());
66  aSpot.setbetaStar(spotDB->betaStar());
67 
68  //}
69  //
70  //catch (std::exception & err) {
71  // edm::LogInfo("RecoVertex/BeamSpotProducer")
72  // << "Exception during event number: " << iEvent.id()
73  // << "\n" << err.what() << "\n";
74  //}
75 
76  *result = aSpot;
77 
78  iEvent.put(std::move(result));
79 }
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
tuple result
Definition: mps_fire.py:311
edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > m_beamToken
def move
Definition: eostools.py:511
Log< level::Info, false > LogInfo
edm::EventID id() const
Definition: EventBase.h:59
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151

Member Data Documentation

edm::ESGetToken<BeamSpotObjects, BeamSpotObjectsRcd> BeamSpotProducer::m_beamToken
private

Definition at line 38 of file BeamSpotProducer.h.

Referenced by BeamSpotProducer(), and produce().