Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration from EDProducer to stream::EDProducer (BeamSpotOnlineProducer) #6671

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 10 additions & 7 deletions RecoVertex/BeamSpotProducer/interface/BeamSpotOnlineProducer.h
Expand Up @@ -12,7 +12,7 @@

________________________________________________________________**/

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
Expand All @@ -21,7 +21,7 @@ ________________________________________________________________**/
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"


class BeamSpotOnlineProducer: public edm::EDProducer {
class BeamSpotOnlineProducer: public edm::stream::EDProducer<> {

public:
typedef std::vector<edm::ParameterSet> Parameters;
Expand All @@ -32,14 +32,17 @@ class BeamSpotOnlineProducer: public edm::EDProducer {
~BeamSpotOnlineProducer();

/// produce a beam spot class
virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;

private:

bool changeFrame_;
double theMaxZ,theMaxR2,theSetSigmaZ;
edm::EDGetTokenT<BeamSpotOnlineCollection> scalerToken_;
edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> l1GtEvmReadoutRecordToken_;
const bool changeFrame_;
const double theMaxZ,theSetSigmaZ;
double theMaxR2;
const edm::EDGetTokenT<BeamSpotOnlineCollection> scalerToken_;
const edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> l1GtEvmReadoutRecordToken_;

const unsigned int theBeamShoutMode;
};

#endif
22 changes: 8 additions & 14 deletions RecoVertex/BeamSpotProducer/plugins/BeamSpotOnlineProducer.cc
Expand Up @@ -15,21 +15,16 @@ using namespace edm;


BeamSpotOnlineProducer::BeamSpotOnlineProducer(const ParameterSet& iconf)
: changeFrame_ ( iconf.getParameter<bool> ("changeToCMSCoordinates") )
, theMaxZ ( iconf.getParameter<double>("maxZ") )
, theSetSigmaZ ( iconf.getParameter<double>("setSigmaZ") )
, scalerToken_ ( consumes<BeamSpotOnlineCollection> ( iconf.getParameter<InputTag>("src") ) )
, l1GtEvmReadoutRecordToken_ ( consumes<L1GlobalTriggerEvmReadoutRecord>( iconf.getParameter<InputTag>("gtEvmLabel")) )
, theBeamShoutMode ( iconf.getUntrackedParameter<unsigned int> ("beamMode",11) )
{

scalerToken_ = consumes<BeamSpotOnlineCollection>(
iconf.getParameter<InputTag>("src"));

changeFrame_ = iconf.getParameter<bool>("changeToCMSCoordinates");

theMaxR2 = iconf.getParameter<double>("maxRadius");
theMaxR2*=theMaxR2;
theMaxZ = iconf.getParameter<double>("maxZ");

theSetSigmaZ = iconf.getParameter<double>("setSigmaZ");

l1GtEvmReadoutRecordToken_ = consumes<L1GlobalTriggerEvmReadoutRecord>(
iconf.getParameter<InputTag>("gtEvmLabel"));

produces<reco::BeamSpot>();

Expand All @@ -44,8 +39,7 @@ BeamSpotOnlineProducer::produce(Event& iEvent, const EventSetup& iSetup)
bool shoutMODE=false;
edm::Handle<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord;
if (iEvent.getByToken(l1GtEvmReadoutRecordToken_, gtEvmReadoutRecord)){
const boost::uint16_t beamModeValue = (gtEvmReadoutRecord->gtfeWord()).beamMode();
if (beamModeValue == 11) shoutMODE=true;
if (gtEvmReadoutRecord->gtfeWord().beamMode() == theBeamShoutMode) shoutMODE=true;
}
else{
shoutMODE=true;
Expand Down Expand Up @@ -87,7 +81,7 @@ BeamSpotOnlineProducer::produce(Event& iEvent, const EventSetup& iSetup)

aSpot = reco::BeamSpot( apoint,
sigmaZ,
spotOnline.dxdz(),
spotOnline.dxdz(),
f* spotOnline.dydz(),
spotOnline.width_x(),
matrix);
Expand Down