CMS 3D CMS Logo

Public Types | Public Member Functions

BeamSpotProducer Class Reference

#include <BeamSpotProducer.h>

Inheritance diagram for BeamSpotProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef std::vector
< edm::ParameterSet
Parameters

Public Member Functions

 BeamSpotProducer (const edm::ParameterSet &iConf)
 constructor
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 produce a beam spot class
 ~BeamSpotProducer ()
 destructor

Detailed Description

_________________________________________________________________ class: BeamSpotProducer.h package: RecoVertex/BeamSpotProducer

author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)

version

Id:
BeamSpotProducer.h,v 1.1 2007/05/09 20:35:49 yumiceva Exp

________________________________________________________________

Definition at line 23 of file BeamSpotProducer.h.


Member Typedef Documentation

Definition at line 26 of file BeamSpotProducer.h.


Constructor & Destructor Documentation

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

constructor

Definition at line 19 of file BeamSpotProducer.cc.

                                                               {
        
        edm::LogInfo("RecoVertex/BeamSpotProducer") 
                << "Initializing Beam Spot producer " << "\n";
  
        //fVerbose=conf.getUntrackedParameter<bool>("verbose", false);
        
        produces<reco::BeamSpot>();

}
BeamSpotProducer::~BeamSpotProducer ( )

destructor

Definition at line 31 of file BeamSpotProducer.cc.

{}

Member Function Documentation

void BeamSpotProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

produce a beam spot class

Implements edm::EDProducer.

Definition at line 39 of file BeamSpotProducer.cc.

References align::BeamSpot, edm::EventSetup::get(), i, edm::EventBase::id(), j, makeMuonMisalignmentScenario::matrix, edm::Event::put(), and query::result.

                                                                       {
        
        using namespace edm;

        std::auto_ptr<reco::BeamSpot> result(new reco::BeamSpot);

        reco::BeamSpot aSpot;

        
        //typedef math::XYZPoint Point;
    //enum { dimension = 7 };
    //typedef math::Error<dimension>::type CovarianceMatrix;

        
        //try {
        edm::LogInfo("RecoVertex/BeamSpotProducer") 
          << "Reconstructing event number: " << iEvent.id() << "\n";

        edm::ESHandle< BeamSpotObjects > beamhandle;
        iSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
        const BeamSpotObjects *spotDB = beamhandle.product();

        // translate from BeamSpotObjects to reco::BeamSpot
        reco::BeamSpot::Point apoint( spotDB->GetX(), spotDB->GetY(), spotDB->GetZ() );
                
        reco::BeamSpot::CovarianceMatrix matrix;
        for ( int i=0; i<7; ++i ) {
          for ( int j=0; j<7; ++j ) {
            matrix(i,j) = spotDB->GetCovariance(i,j);
          }
        }
        
        // this assume beam width same in x and y
        aSpot = reco::BeamSpot( apoint,
                                spotDB->GetSigmaZ(),
                                spotDB->Getdxdz(),
                                spotDB->Getdydz(),
                                spotDB->GetBeamWidthX(),
                                matrix );
        aSpot.setBeamWidthY( spotDB->GetBeamWidthY() );
        aSpot.setEmittanceX( spotDB->GetEmittanceX() );
        aSpot.setEmittanceY( spotDB->GetEmittanceY() );
        aSpot.setbetaStar( spotDB->GetBetaStar() );
                
        //}
        //
        //catch (std::exception & err) {
        //      edm::LogInfo("RecoVertex/BeamSpotProducer") 
        //              << "Exception during event number: " << iEvent.id() 
        //              << "\n" << err.what() << "\n";
        //}

        *result = aSpot;
        
        iEvent.put(result);
        
}