CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MFProducer Class Reference

Inheritance diagram for MFProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 MFProducer (const edm::ParameterSet &)
 ~MFProducer (void)

Private Member Functions

virtual void beginJob (void)
virtual void endJob (void)
void evaluate (const double point[3], double field[3]) const
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

unsigned m_mapDensityX
unsigned m_mapDensityY
unsigned m_mapDensityZ
double m_maxX
double m_maxY
double m_maxZ
edm::ESHandle< MagneticFieldm_mf
double m_minX
double m_minY
double m_minZ
bool m_valid
double m_xBaseDir
double m_yBaseDir
double m_zBaseDir

Detailed Description

Definition at line 12 of file MFProducer.cc.


Constructor & Destructor Documentation

MFProducer::MFProducer ( const edm::ParameterSet iPset) [explicit]

Definition at line 39 of file MFProducer.cc.

References edm::ParameterSet::getUntrackedParameter(), m_mapDensityX, m_mapDensityY, m_mapDensityZ, m_maxX, m_maxY, m_maxZ, m_minX, m_minY, m_minZ, m_xBaseDir, m_yBaseDir, and m_zBaseDir.

  : m_valid( false )
{
  m_mapDensityX = iPset.getUntrackedParameter<unsigned>( "mapDensityX", 10 );
  m_mapDensityY = iPset.getUntrackedParameter<unsigned>( "mapDensityY", 10 );
  m_mapDensityZ = iPset.getUntrackedParameter<unsigned>( "mapDensityY", 10 );
  m_minX = iPset.getUntrackedParameter<double>( "minX", -18.0 );
  m_maxX = iPset.getUntrackedParameter<double>( "maxX", 18.0 );
  m_minY = iPset.getUntrackedParameter<double>( "minY", -18.0 );
  m_maxY = iPset.getUntrackedParameter<double>( "maxY", 18.0 );
  m_minZ = iPset.getUntrackedParameter<double>( "minZ", -18.0 );
  m_maxZ = iPset.getUntrackedParameter<double>( "maxZ", 18.0 );

  m_xBaseDir = ( m_maxX - m_minX ) / m_mapDensityX;
  m_yBaseDir = ( m_maxY - m_minY ) / m_mapDensityY;
  m_zBaseDir = ( m_maxZ - m_minZ ) / m_mapDensityZ;
}
MFProducer::~MFProducer ( void  )

Definition at line 57 of file MFProducer.cc.

{}

Member Function Documentation

void MFProducer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 94 of file MFProducer.cc.

{}
void MFProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 98 of file MFProducer.cc.

{}
void MFProducer::evaluate ( const double  point[3],
double  field[3] 
) const [private]

Definition at line 84 of file MFProducer.cc.

References b, m_mf, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

{
  GlobalVector b = m_mf->inTesla( GlobalPoint( point[0], point[1], point[2] ));
  
  field [0] = b.x();
  field [1] = b.y();
  field [2] = b.z();
}
void MFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 61 of file MFProducer.cc.

References gather_cfg::cout, evaluate(), edm::EventSetup::get(), i, edm::ESHandleBase::isValid(), j, m_mapDensityX, m_mapDensityY, m_mf, m_minX, m_minY, m_valid, m_xBaseDir, m_yBaseDir, x, detailsBasic3DVector::y, and z.

{
  iSetup.get<IdealMagneticFieldRecord>().get( m_mf );
  m_mf.isValid() ? m_valid = true : m_valid = false;
   
  for( unsigned i = 0; i <= m_mapDensityX; ++i )
  {
    for( unsigned j = 0; j <= m_mapDensityY; ++j )
    {                       
        // Prepare field position and get value.
        double x =  m_minX + m_xBaseDir * i;
        double y = m_minY + m_yBaseDir * j;
        double z = 0.;
        double  pt[3] = { x, y, z };
        double  val[3];
        evaluate( pt, val );
        std::cout << "(" << x << ", " << y << ", " << z << ") " << val[0] << ":" << val[1] << ":" << val[2] << "; ";
    }
    std::cout << std::endl;
  }
}

Member Data Documentation

unsigned MFProducer::m_mapDensityX [private]

Definition at line 23 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

unsigned MFProducer::m_mapDensityY [private]

Definition at line 24 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

unsigned MFProducer::m_mapDensityZ [private]

Definition at line 25 of file MFProducer.cc.

Referenced by MFProducer().

double MFProducer::m_maxX [private]

Definition at line 27 of file MFProducer.cc.

Referenced by MFProducer().

double MFProducer::m_maxY [private]

Definition at line 29 of file MFProducer.cc.

Referenced by MFProducer().

double MFProducer::m_maxZ [private]

Definition at line 31 of file MFProducer.cc.

Referenced by MFProducer().

Definition at line 36 of file MFProducer.cc.

Referenced by evaluate(), and produce().

double MFProducer::m_minX [private]

Definition at line 26 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

double MFProducer::m_minY [private]

Definition at line 28 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

double MFProducer::m_minZ [private]

Definition at line 30 of file MFProducer.cc.

Referenced by MFProducer().

bool MFProducer::m_valid [private]

Definition at line 35 of file MFProducer.cc.

Referenced by produce().

double MFProducer::m_xBaseDir [private]

Definition at line 32 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

double MFProducer::m_yBaseDir [private]

Definition at line 33 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

double MFProducer::m_zBaseDir [private]

Definition at line 34 of file MFProducer.cc.

Referenced by MFProducer().