CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonGeometryDBConverter Class Reference

#include <Alignment/MuonAlignment/plugins/MuonGeometryDBConverter.cc>

Inheritance diagram for MuonGeometryDBConverter:
edm::EDAnalyzer

List of all members.

Public Member Functions

 MuonGeometryDBConverter (const edm::ParameterSet &)
 ~MuonGeometryDBConverter ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)

Private Attributes

double m_angleErr
std::string m_cscLabel
bool m_done
std::string m_dtLabel
std::string m_fileName
bool m_getAPEs
std::string m_input
edm::ParameterSet m_misalignmentScenario
std::string m_output
edm::ParameterSet m_outputXML
double m_shiftErr

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 43 of file MuonGeometryDBConverter.cc.


Constructor & Destructor Documentation

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

Definition at line 75 of file MuonGeometryDBConverter.cc.

References Exception, edm::ParameterSet::getParameter(), m_angleErr, m_cscLabel, m_dtLabel, m_fileName, m_getAPEs, m_input, m_misalignmentScenario, m_output, m_outputXML, and m_shiftErr.

   : m_done(false)
   , m_input(iConfig.getParameter<std::string>("input"))
   , m_output(iConfig.getParameter<std::string>("output"))
{
   // Version V02-03-02 and earlier of this module had support for   //
   // "cfg" as an input/output format.  It turns out that reading    //
   // thousands of parameters from a configuration file takes a very //
   // long time, so "cfg" wasn't very practical.  When I reorganized //
   // the code, I didn't bother to port it.                          //

   if (m_input == std::string("ideal")) {}

   else if (m_input == std::string("db")) {
      m_dtLabel = iConfig.getParameter<std::string>("dtLabel");
      m_cscLabel = iConfig.getParameter<std::string>("cscLabel");
      m_shiftErr = iConfig.getParameter<double>("shiftErr");
      m_angleErr = iConfig.getParameter<double>("angleErr");
      m_getAPEs = iConfig.getParameter<bool>("getAPEs");
   }

   else if (m_input == std::string("surveydb")) {
      m_dtLabel = iConfig.getParameter<std::string>("dtLabel");
      m_cscLabel = iConfig.getParameter<std::string>("cscLabel");
   }

   else if (m_input == std::string("scenario")) {
      m_misalignmentScenario = iConfig.getParameter<edm::ParameterSet>("MisalignmentScenario");
      m_shiftErr = iConfig.getParameter<double>("shiftErr");
      m_angleErr = iConfig.getParameter<double>("angleErr");
   }

   else if (m_input == std::string("xml")) {
      m_fileName = iConfig.getParameter<std::string>("fileName");
      m_shiftErr = iConfig.getParameter<double>("shiftErr");
      m_angleErr = iConfig.getParameter<double>("angleErr");
   }

   else {
      throw cms::Exception("BadConfig") << "input must be \"ideal\", \"db\", \"surveydb\", or \"xml\"." << std::endl;
   }

   if (m_output == std::string("none")) {}

   else if (m_output == std::string("db")) {}

   else if (m_output == std::string("surveydb")) {}

   else if (m_output == std::string("xml")) {
      m_outputXML = iConfig.getParameter<edm::ParameterSet>("outputXML");
   }

   else {
      throw cms::Exception("BadConfig") << "output must be \"none\", \"db\", or \"surveydb\"." << std::endl;
   }
}
MuonGeometryDBConverter::~MuonGeometryDBConverter ( )

Definition at line 134 of file MuonGeometryDBConverter.cc.

{ }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 138 of file MuonGeometryDBConverter.cc.

References MuonScenarioBuilder::applyScenario(), MuonAlignment::copyAlignmentToSurvey(), MuonAlignment::copySurveyToAlignment(), Exception, MuonAlignment::fillGapsInSurvey(), MuonAlignment::getAlignableMuon(), m_angleErr, m_cscLabel, m_done, m_dtLabel, m_fileName, m_getAPEs, m_input, m_misalignmentScenario, m_output, m_outputXML, m_shiftErr, CSCOverlapsAlignmentAlgorithm_cff::muonAlignment, NULL, MuonAlignment::saveSurveyToDB(), MuonAlignment::saveToDB(), and MuonAlignment::writeXML().

                                                                                    {
   if (!m_done) {
      MuonAlignment *muonAlignment = NULL;

      if (m_input == std::string("ideal")) {
         MuonAlignmentInputMethod inputMethod;
         muonAlignment = new MuonAlignment(iSetup, inputMethod);
         muonAlignment->fillGapsInSurvey(0., 0.);
      }

      else if (m_input == std::string("db")) {
         MuonAlignmentInputDB inputMethod(m_dtLabel, m_cscLabel, m_getAPEs);
         muonAlignment = new MuonAlignment(iSetup, inputMethod);
         if (m_getAPEs) {
            muonAlignment->copyAlignmentToSurvey(m_shiftErr, m_angleErr);
         }
      }

      else if (m_input == std::string("surveydb")) {
         MuonAlignmentInputSurveyDB inputMethod(m_dtLabel, m_cscLabel);
         muonAlignment = new MuonAlignment(iSetup, inputMethod);
         muonAlignment->copySurveyToAlignment();
      }
   
      else if (m_input == std::string("scenario")) {
         MuonAlignmentInputMethod inputMethod;
         muonAlignment = new MuonAlignment(iSetup, inputMethod);

         MuonScenarioBuilder muonScenarioBuilder(muonAlignment->getAlignableMuon());
         muonScenarioBuilder.applyScenario(m_misalignmentScenario);
         muonAlignment->copyAlignmentToSurvey(m_shiftErr, m_angleErr);
      }

      else if (m_input == std::string("xml")) {
         MuonAlignmentInputXML inputMethod(m_fileName);
         muonAlignment = new MuonAlignment(iSetup, inputMethod);
         muonAlignment->fillGapsInSurvey(m_shiftErr, m_angleErr);
      }


      if (m_output == std::string("none")) {}

      else if (m_output == std::string("db")) {
         muonAlignment->saveToDB();
      }

      else if (m_output == std::string("surveydb")) {
         muonAlignment->saveSurveyToDB();
      }

      else if (m_output == std::string("xml")) {
         muonAlignment->writeXML(m_outputXML, iSetup);
      }

      delete muonAlignment;

      m_done = true;
   } // end if not done
   else {
      throw cms::Exception("BadConfig") << "Set maxEvents.input to 1.  (Your output is okay.)" << std::endl;
   }
}

Member Data Documentation

Definition at line 56 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

std::string MuonGeometryDBConverter::m_cscLabel [private]

Definition at line 55 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

Definition at line 52 of file MuonGeometryDBConverter.cc.

Referenced by analyze().

std::string MuonGeometryDBConverter::m_dtLabel [private]

Definition at line 55 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

std::string MuonGeometryDBConverter::m_fileName [private]

Definition at line 57 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

Definition at line 58 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

std::string MuonGeometryDBConverter::m_input [private]

Definition at line 53 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

Definition at line 60 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

std::string MuonGeometryDBConverter::m_output [private]

Definition at line 53 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

Definition at line 61 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

Definition at line 56 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().