CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
MuonGeometryDBConverter Class Reference

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

Inheritance diagram for MuonGeometryDBConverter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void beginJob () override
 
void endJob () override
 
 MuonGeometryDBConverter (const edm::ParameterSet &)
 
 ~MuonGeometryDBConverter () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

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
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

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

Definition at line 42 of file MuonGeometryDBConverter.cc.

Constructor & Destructor Documentation

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

Definition at line 77 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, m_shiftErr, and AlCaHLTBitMon_QueryRunRegistry::string.

78  : m_done(false),
79  m_input(iConfig.getParameter<std::string>("input")),
80  m_output(iConfig.getParameter<std::string>("output")),
81  m_shiftErr(0.),
82  m_angleErr(0.),
83  m_getAPEs(false) {
85  // Version V02-03-02 and earlier of this module had support for //
86  // "cfg" as an input/output format. It turns out that reading //
87  // thousands of parameters from a configuration file takes a very //
88  // long time, so "cfg" wasn't very practical. When I reorganized //
89  // the code, I didn't bother to port it. //
91 
92  if (m_input == std::string("ideal")) {
93  }
94 
95  else if (m_input == std::string("db")) {
96  m_dtLabel = iConfig.getParameter<std::string>("dtLabel");
97  m_cscLabel = iConfig.getParameter<std::string>("cscLabel");
98  m_shiftErr = iConfig.getParameter<double>("shiftErr");
99  m_angleErr = iConfig.getParameter<double>("angleErr");
100  m_getAPEs = iConfig.getParameter<bool>("getAPEs");
101  }
102 
103  else if (m_input == std::string("surveydb")) {
104  m_dtLabel = iConfig.getParameter<std::string>("dtLabel");
105  m_cscLabel = iConfig.getParameter<std::string>("cscLabel");
106  }
107 
108  else if (m_input == std::string("scenario")) {
109  m_misalignmentScenario = iConfig.getParameter<edm::ParameterSet>("MisalignmentScenario");
110  m_shiftErr = iConfig.getParameter<double>("shiftErr");
111  m_angleErr = iConfig.getParameter<double>("angleErr");
112  }
113 
114  else if (m_input == std::string("xml")) {
115  m_fileName = iConfig.getParameter<std::string>("fileName");
116  m_shiftErr = iConfig.getParameter<double>("shiftErr");
117  m_angleErr = iConfig.getParameter<double>("angleErr");
118  }
119 
120  else {
121  throw cms::Exception("BadConfig") << "input must be \"ideal\", \"db\", \"surveydb\", or \"xml\"." << std::endl;
122  }
123 
124  if (m_output == std::string("none")) {
125  }
126 
127  else if (m_output == std::string("db")) {
128  }
129 
130  else if (m_output == std::string("surveydb")) {
131  }
132 
133  else if (m_output == std::string("xml")) {
134  m_outputXML = iConfig.getParameter<edm::ParameterSet>("outputXML");
135  }
136 
137  else {
138  throw cms::Exception("BadConfig") << "output must be \"none\", \"db\", or \"surveydb\"." << std::endl;
139  }
140 }
T getParameter(std::string const &) const
edm::ParameterSet m_misalignmentScenario
MuonGeometryDBConverter::~MuonGeometryDBConverter ( )
override

Definition at line 142 of file MuonGeometryDBConverter.cc.

142 {}

Member Function Documentation

void MuonGeometryDBConverter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 145 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, MuonAlignment::saveSurveyToDB(), MuonAlignment::saveToDB(), AlCaHLTBitMon_QueryRunRegistry::string, and MuonAlignment::writeXML().

Referenced by endJob().

145  {
146  if (!m_done) {
147  MuonAlignment *muonAlignment = nullptr;
148 
149  if (m_input == std::string("ideal")) {
150  MuonAlignmentInputMethod inputMethod;
151  muonAlignment = new MuonAlignment(iSetup, inputMethod);
152  muonAlignment->fillGapsInSurvey(0., 0.);
153  }
154 
155  else if (m_input == std::string("db")) {
157  muonAlignment = new MuonAlignment(iSetup, inputMethod);
158  if (m_getAPEs) {
160  }
161  }
162 
163  else if (m_input == std::string("surveydb")) {
165  muonAlignment = new MuonAlignment(iSetup, inputMethod);
166  muonAlignment->copySurveyToAlignment();
167  }
168 
169  else if (m_input == std::string("scenario")) {
170  MuonAlignmentInputMethod inputMethod;
171  muonAlignment = new MuonAlignment(iSetup, inputMethod);
172 
173  MuonScenarioBuilder muonScenarioBuilder(muonAlignment->getAlignableMuon());
174  muonScenarioBuilder.applyScenario(m_misalignmentScenario);
176  }
177 
178  else if (m_input == std::string("xml")) {
179  MuonAlignmentInputXML inputMethod(m_fileName);
180  muonAlignment = new MuonAlignment(iSetup, inputMethod);
181  muonAlignment->fillGapsInSurvey(m_shiftErr, m_angleErr);
182  }
183 
185 
186  if (muonAlignment) {
187  if (m_output == std::string("none")) {
188  }
189 
190  else if (m_output == std::string("db")) {
191  muonAlignment->saveToDB();
192  }
193 
194  else if (m_output == std::string("surveydb")) {
195  muonAlignment->saveSurveyToDB();
196  }
197 
198  else if (m_output == std::string("xml")) {
199  muonAlignment->writeXML(m_outputXML, iSetup);
200  }
201 
202  delete muonAlignment;
203  }
204 
205  m_done = true;
206  } // end if not done
207  else {
208  throw cms::Exception("BadConfig") << "Set maxEvents.input to 1. (Your output is okay.)" << std::endl;
209  }
210 }
Builds a scenario from configuration and applies it to the alignable Muon.
void copyAlignmentToSurvey(double shiftErr, double angleErr)
void copySurveyToAlignment()
void saveSurveyToDB()
AlignableMuon * getAlignableMuon()
Definition: MuonAlignment.h:31
void fillGapsInSurvey(double shiftErr, double angleErr)
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the Muon.
void writeXML(const edm::ParameterSet &iConfig, const edm::EventSetup &iSetup)
edm::ParameterSet m_misalignmentScenario
void MuonGeometryDBConverter::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 48 of file MuonGeometryDBConverter.cc.

48 {};
void MuonGeometryDBConverter::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 49 of file MuonGeometryDBConverter.cc.

References analyze().

Referenced by o2olib.O2ORunMgr::executeJob().

49 {};
void MuonGeometryDBConverter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 213 of file MuonGeometryDBConverter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, convertSQLitetoXML_cfg::outputXML, edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

213  {
215  desc.setComment("Converts muon geometry between various formats.");
216  desc.add<std::string>("input", "ideal");
217  desc.add<std::string>("dtLabel", "");
218  desc.add<std::string>("cscLabel", "");
219  desc.add<double>("shiftErr", 1000.0);
220  desc.add<double>("angleErr", 6.28);
221  desc.add<bool>("getAPEs", true);
222  desc.add<std::string>("output", "xml");
223  desc.add<std::string>("fileName", "REPLACEME.xml");
225  outputXML.add<std::string>("fileName", "REPLACEME.xml");
226  outputXML.add<std::string>("relativeto", "ideal");
227  outputXML.add<bool>("survey", false);
228  outputXML.add<bool>("rawIds", false);
229  outputXML.add<bool>("eulerAngles", false);
230  outputXML.add<int>("precision", 10);
231  outputXML.addUntracked<bool>("suppressDTBarrel", true);
232  outputXML.addUntracked<bool>("suppressDTWheels", true);
233  outputXML.addUntracked<bool>("suppressDTStations", true);
234  outputXML.addUntracked<bool>("suppressDTChambers", false);
235  outputXML.addUntracked<bool>("suppressDTSuperLayers", false);
236  outputXML.addUntracked<bool>("suppressDTLayers", false);
237  outputXML.addUntracked<bool>("suppressCSCEndcaps", true);
238  outputXML.addUntracked<bool>("suppressCSCStations", true);
239  outputXML.addUntracked<bool>("suppressCSCRings", true);
240  outputXML.addUntracked<bool>("suppressCSCChambers", false);
241  outputXML.addUntracked<bool>("suppressCSCLayers", false);
242  desc.add("outputXML", outputXML);
243  descriptions.add("muonGeometryDBConverter", desc);
244 }
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

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().

bool MuonGeometryDBConverter::m_getAPEs
private

Definition at line 60 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 62 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 63 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().