CMS 3D CMS Logo

Public Member Functions

RotationForOnline Class Reference

Inheritance diagram for RotationForOnline:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
virtual void endJob ()
 RotationForOnline (const edm::ParameterSet &)
 ~RotationForOnline ()

Detailed Description

Definition at line 36 of file RotationForOnline.cc.


Constructor & Destructor Documentation

RotationForOnline::RotationForOnline ( const edm::ParameterSet iConfig) [explicit]

Definition at line 61 of file RotationForOnline.cc.

{
   //now do what ever initialization is needed

}
RotationForOnline::~RotationForOnline ( )

Definition at line 68 of file RotationForOnline.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 83 of file RotationForOnline.cc.

References gather_cfg::cout.

{
  std::cout << "analyze does nothing" << std::endl;
}
void RotationForOnline::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file RotationForOnline.cc.

References DDBase< DDName, DDRotationMatrix * >::begin(), gather_cfg::cout, DDBase< DDName, DDRotationMatrix * >::end(), edm::EventSetup::get(), DDBase< N, C >::isDefined(), cmsRelvalreport::red(), x, detailsBasic3DVector::y, and z.

{
  // set tolerance for "near zero"
  double tolerance= 1.0e-3;
  std::string rotationFileName("ROTATIONS.dat");
  std::ofstream rotationOS(rotationFileName.c_str());
  std::cout << "RotationForOnline Analyzer..." << std::endl;


  edm::ESTransientHandle<DDCompactView> pDD;

  iSetup.get<IdealGeometryRecord>().get( "", pDD );
  DDRotationMatrix ident;

  DDRotation::iterator<DDRotation> rit(DDRotation::begin()), red(DDRotation::end());
  for (; rit != red; ++rit) {
    if (! rit->isDefined().second) continue;
    //    if ( rit->matrix()->isIdentity() ) continue;
    if ( *(rit->matrix()) == ident ) continue;
    const DDRotation& rota = *rit;
    bool reflection = false;

    DD3Vector x, y, z;
    rit->matrix()->GetComponents(x, y, z);
    if ( (1.0 + (x.Cross(y)).Dot(z)) <= tolerance ) {
      reflection = true;
    }
 
    rotationOS<< *(rota.isDefined().first); //rota name
    double thetaX, phiX, thetaY, phiY, thetaZ, phiZ;

    thetaX = std::acos(x.z());
    phiX = ( x.y() == 0 && x.x() == 0.0) ? 0.0 : std::atan2(x.y(), x.x());

    thetaY = std::acos(y.z());
    phiY = ( y.y() == 0 && y.x() == 0.0) ? 0.0 : std::atan2(y.y(), y.x());

    thetaZ = std::acos(z.z());
    phiZ = ( z.y() == 0 && z.x() == 0.0) ? 0.0 : std::atan2(z.y(), z.x());

    rotationOS<< "," << thetaX
              << "," << phiX
              << "," << thetaY
              << "," << phiY
              << "," << thetaZ
              << "," << phiZ
              << "," << (int)reflection
              <<std::endl;
  } 

  rotationOS.close();

}
void RotationForOnline::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file RotationForOnline.cc.

                          {
}