CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MFAnalyzer Class Reference

Inheritance diagram for MFAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 MFAnalyzer (const edm::ParameterSet &)
bool valid (void)
 ~MFAnalyzer (void)

Private Member Functions

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

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 18 of file MFAnalyzer.cc.


Constructor & Destructor Documentation

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

Definition at line 45 of file MFAnalyzer.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;
}
MFAnalyzer::~MFAnalyzer ( void  )

Definition at line 63 of file MFAnalyzer.cc.

{}

Member Function Documentation

void MFAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 67 of file MFAnalyzer.cc.

References gather_cfg::cout, evaluate(), edm::EventSetup::get(), i, edm::ESHandleBase::isValid(), j, gen::k, m_mapDensityX, m_mapDensityY, m_mapDensityZ, m_mf, m_minX, m_minY, m_minZ, m_valid, m_xBaseDir, m_yBaseDir, m_zBaseDir, ExpressReco_HICollisions_FallBack::pt, ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::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 )
    {                       
      for( unsigned k = 0; k <= m_mapDensityZ; ++k )
      {                       
        // Prepare field position and get value.
        double x =  m_minX + m_xBaseDir * i;
        double y = m_minY + m_yBaseDir * j;
        double z = m_minZ + m_zBaseDir * k;
        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;
    }
    std::cout << std::endl;
  }
}
void MFAnalyzer::evaluate ( const double  point[3],
double  field[3] 
) const [private]

Definition at line 94 of file MFAnalyzer.cc.

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

Referenced by analyze().

{
  GlobalVector b = m_mf->inTesla( GlobalPoint( point[0], point[1], point[2] ));
  
  field [0] = b.x();
  field [1] = b.y();
  field [2] = b.z();
}
bool MFAnalyzer::valid ( void  ) [inline]

Definition at line 24 of file MFAnalyzer.cc.

References m_valid.

{ return m_valid; }

Member Data Documentation

unsigned MFAnalyzer::m_mapDensityX [private]

Definition at line 29 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().

unsigned MFAnalyzer::m_mapDensityY [private]

Definition at line 30 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().

unsigned MFAnalyzer::m_mapDensityZ [private]

Definition at line 31 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().

double MFAnalyzer::m_maxX [private]

Definition at line 33 of file MFAnalyzer.cc.

Referenced by MFAnalyzer().

double MFAnalyzer::m_maxY [private]

Definition at line 35 of file MFAnalyzer.cc.

Referenced by MFAnalyzer().

double MFAnalyzer::m_maxZ [private]

Definition at line 37 of file MFAnalyzer.cc.

Referenced by MFAnalyzer().

Definition at line 42 of file MFAnalyzer.cc.

Referenced by analyze(), and evaluate().

double MFAnalyzer::m_minX [private]

Definition at line 32 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().

double MFAnalyzer::m_minY [private]

Definition at line 34 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().

double MFAnalyzer::m_minZ [private]

Definition at line 36 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().

bool MFAnalyzer::m_valid [private]

Definition at line 41 of file MFAnalyzer.cc.

Referenced by analyze(), and valid().

double MFAnalyzer::m_xBaseDir [private]

Definition at line 38 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().

double MFAnalyzer::m_yBaseDir [private]

Definition at line 39 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().

double MFAnalyzer::m_zBaseDir [private]

Definition at line 40 of file MFAnalyzer.cc.

Referenced by analyze(), and MFAnalyzer().