CMS 3D CMS Logo

MuonGeometryDBConverter Class Reference

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

#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 &)
virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()

Private Attributes

double m_angleErr
std::string m_cscLabel
bool m_done
std::string m_dtLabel
std::string m_fileName
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 76 of file MuonGeometryDBConverter.cc.

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

00077    : m_done(false)
00078    , m_input(iConfig.getParameter<std::string>("input"))
00079    , m_output(iConfig.getParameter<std::string>("output"))
00080 {
00082    // Version V02-03-02 and earlier of this module had support for   //
00083    // "cfg" as an input/output format.  It turns out that reading    //
00084    // thousands of parameters from a configuration file takes a very //
00085    // long time, so "cfg" wasn't very practical.  When I reorganized //
00086    // the code, I didn't bother to port it.                          //
00088 
00089    if (m_input == std::string("ideal")) {}
00090 
00091    else if (m_input == std::string("db")) {
00092       m_dtLabel = iConfig.getParameter<std::string>("dtLabel");
00093       m_cscLabel = iConfig.getParameter<std::string>("cscLabel");
00094       m_shiftErr = iConfig.getParameter<double>("shiftErr");
00095       m_angleErr = iConfig.getParameter<double>("angleErr");
00096    }
00097 
00098    else if (m_input == std::string("surveydb")) {
00099       m_dtLabel = iConfig.getParameter<std::string>("dtLabel");
00100       m_cscLabel = iConfig.getParameter<std::string>("cscLabel");
00101    }
00102 
00103    else if (m_input == std::string("scenario")) {
00104       m_misalignmentScenario = iConfig.getParameter<edm::ParameterSet>("MisalignmentScenario");
00105       m_shiftErr = iConfig.getParameter<double>("shiftErr");
00106       m_angleErr = iConfig.getParameter<double>("angleErr");
00107    }
00108 
00109    else if (m_input == std::string("xml")) {
00110       m_fileName = iConfig.getParameter<std::string>("fileName");
00111       m_shiftErr = iConfig.getParameter<double>("shiftErr");
00112       m_angleErr = iConfig.getParameter<double>("angleErr");
00113    }
00114 
00115    else {
00116       throw cms::Exception("BadConfig") << "input must be \"ideal\", \"db\", \"surveydb\", or \"xml\"." << std::endl;
00117    }
00118 
00119    if (m_output == std::string("none")) {}
00120 
00121    else if (m_output == std::string("db")) {}
00122 
00123    else if (m_output == std::string("surveydb")) {}
00124 
00125    else if (m_output == std::string("xml")) {
00126       m_outputXML = iConfig.getParameter<edm::ParameterSet>("outputXML");
00127    }
00128 
00129    else {
00130       throw cms::Exception("BadConfig") << "output must be \"none\", \"db\", or \"surveydb\"." << std::endl;
00131    }
00132 }

MuonGeometryDBConverter::~MuonGeometryDBConverter (  ) 

Definition at line 134 of file MuonGeometryDBConverter.cc.

00134 { }


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 MuonAlignment::copyAlignmentToSurvey(), MuonAlignment::copySurveyToAlignment(), lat::endl(), Exception, MuonAlignment::fillGapsInSurvey(), MuonAlignment::getAlignableMuon(), m_angleErr, m_cscLabel, m_done, m_dtLabel, m_fileName, m_input, m_misalignmentScenario, m_output, m_outputXML, m_shiftErr, Muon_FrontierAlignment_cfi::muonAlignment, NULL, MuonAlignment::saveSurveyToDB(), MuonAlignment::saveToDB(), and MuonAlignment::writeXML().

00138                                                                                     {
00139    if (!m_done) {
00140       MuonAlignment *muonAlignment = NULL;
00141 
00142       if (m_input == std::string("ideal")) {
00143          MuonAlignmentInputMethod inputMethod;
00144          muonAlignment = new MuonAlignment(iSetup, inputMethod);
00145          muonAlignment->fillGapsInSurvey(0., 0.);
00146       }
00147 
00148       else if (m_input == std::string("db")) {
00149          MuonAlignmentInputDB inputMethod(m_dtLabel, m_cscLabel);
00150          muonAlignment = new MuonAlignment(iSetup, inputMethod);
00151          muonAlignment->copyAlignmentToSurvey(m_shiftErr, m_angleErr);
00152       }
00153 
00154       else if (m_input == std::string("surveydb")) {
00155          MuonAlignmentInputSurveyDB inputMethod(m_dtLabel, m_cscLabel);
00156          muonAlignment = new MuonAlignment(iSetup, inputMethod);
00157          muonAlignment->copySurveyToAlignment();
00158       }
00159    
00160       else if (m_input == std::string("scenario")) {
00161          MuonAlignmentInputMethod inputMethod;
00162          muonAlignment = new MuonAlignment(iSetup, inputMethod);
00163 
00164          MuonScenarioBuilder muonScenarioBuilder(muonAlignment->getAlignableMuon());
00165          muonScenarioBuilder.applyScenario(m_misalignmentScenario);
00166          muonAlignment->copyAlignmentToSurvey(m_shiftErr, m_angleErr);
00167       }
00168 
00169       else if (m_input == std::string("xml")) {
00170          MuonAlignmentInputXML inputMethod(m_fileName);
00171          muonAlignment = new MuonAlignment(iSetup, inputMethod);
00172          muonAlignment->fillGapsInSurvey(m_shiftErr, m_angleErr);
00173       }
00174 
00176 
00177       if (m_output == std::string("none")) {}
00178 
00179       else if (m_output == std::string("db")) {
00180          muonAlignment->saveToDB();
00181       }
00182 
00183       else if (m_output == std::string("surveydb")) {
00184          muonAlignment->saveSurveyToDB();
00185       }
00186 
00187       else if (m_output == std::string("xml")) {
00188          muonAlignment->writeXML(m_outputXML, iSetup);
00189       }
00190 
00191       delete muonAlignment;
00192 
00193       m_done = true;
00194    } // end if not done
00195    else {
00196       throw cms::Exception("BadConfig") << "Set maxEvents.input to 1.  (Your output is okay.)" << std::endl;
00197    }
00198 }

void MuonGeometryDBConverter::beginJob ( const edm::EventSetup iSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 202 of file MuonGeometryDBConverter.cc.

00202 {}

void MuonGeometryDBConverter::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 206 of file MuonGeometryDBConverter.cc.

00206 { }


Member Data Documentation

double MuonGeometryDBConverter::m_angleErr [private]

Definition at line 58 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

std::string MuonGeometryDBConverter::m_cscLabel [private]

Definition at line 57 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

bool MuonGeometryDBConverter::m_done [private]

Definition at line 54 of file MuonGeometryDBConverter.cc.

Referenced by analyze().

std::string MuonGeometryDBConverter::m_dtLabel [private]

Definition at line 57 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

std::string MuonGeometryDBConverter::m_fileName [private]

Definition at line 59 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

std::string MuonGeometryDBConverter::m_input [private]

Definition at line 55 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

edm::ParameterSet MuonGeometryDBConverter::m_misalignmentScenario [private]

Definition at line 61 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

std::string MuonGeometryDBConverter::m_output [private]

Definition at line 55 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

edm::ParameterSet MuonGeometryDBConverter::m_outputXML [private]

Definition at line 62 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

double MuonGeometryDBConverter::m_shiftErr [private]

Definition at line 58 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:28:43 2009 for CMSSW by  doxygen 1.5.4