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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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

std::string idealGeometryLabelForInputDB
 
std::string idealGeometryLabelForInputMethod
 
std::string idealGeometryLabelForInputSurveyDB
 
std::string idealGeometryLabelForInputXML
 
double m_angleErr
 
std::string m_cscLabel
 
bool m_done
 
std::string m_dtLabel
 
std::string m_fileName
 
std::string m_gemLabel
 
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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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::MuonGeometryDBConverter ( const edm::ParameterSet iConfig)
explicit

Definition at line 79 of file MuonGeometryDBConverter.cc.

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

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

◆ ~MuonGeometryDBConverter()

MuonGeometryDBConverter::~MuonGeometryDBConverter ( )
override

Definition at line 150 of file MuonGeometryDBConverter.cc.

150 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 153 of file MuonGeometryDBConverter.cc.

153  {
154  if (!m_done) {
155  MuonAlignment *muonAlignment = nullptr;
156 
157  if (m_input == std::string("ideal")) {
158  MuonAlignmentInputMethod inputMethod;
159  muonAlignment = new MuonAlignment(iSetup, inputMethod);
160  muonAlignment->fillGapsInSurvey(0., 0.);
161  }
162 
163  else if (m_input == std::string("db")) {
165  muonAlignment = new MuonAlignment(iSetup, inputMethod);
166  if (m_getAPEs) {
167  muonAlignment->copyAlignmentToSurvey(m_shiftErr, m_angleErr);
168  }
169  }
170 
171  else if (m_input == std::string("surveydb")) {
173  muonAlignment = new MuonAlignment(iSetup, inputMethod);
174  muonAlignment->copySurveyToAlignment();
175  }
176 
177  else if (m_input == std::string("scenario")) {
178  MuonAlignmentInputMethod inputMethod;
179  muonAlignment = new MuonAlignment(iSetup, inputMethod);
180 
181  MuonScenarioBuilder muonScenarioBuilder(muonAlignment->getAlignableMuon());
182  muonScenarioBuilder.applyScenario(m_misalignmentScenario);
183  muonAlignment->copyAlignmentToSurvey(m_shiftErr, m_angleErr);
184  }
185 
186  else if (m_input == std::string("xml")) {
188  muonAlignment = new MuonAlignment(iSetup, inputMethod);
189  muonAlignment->fillGapsInSurvey(m_shiftErr, m_angleErr);
190  }
191 
193 
194  if (muonAlignment) {
195  if (m_output == std::string("none")) {
196  }
197 
198  else if (m_output == std::string("db")) {
199  muonAlignment->saveToDB();
200  }
201 
202  else if (m_output == std::string("surveydb")) {
203  muonAlignment->saveSurveyToDB();
204  }
205 
206  else if (m_output == std::string("xml")) {
207  muonAlignment->writeXML(m_outputXML, iSetup);
208  }
209 
210  delete muonAlignment;
211  }
212 
213  m_done = true;
214  } // end if not done
215  else {
216  throw cms::Exception("BadConfig") << "Set maxEvents.input to 1. (Your output is okay.)" << std::endl;
217  }
218 }

References MuonScenarioBuilder::applyScenario(), Exception, idealGeometryLabelForInputDB, idealGeometryLabelForInputSurveyDB, idealGeometryLabelForInputXML, m_angleErr, m_cscLabel, m_done, m_dtLabel, m_fileName, m_gemLabel, m_getAPEs, m_input, m_misalignmentScenario, m_output, m_outputXML, m_shiftErr, CSCOverlapsAlignmentAlgorithm_cff::muonAlignment, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ beginJob()

void MuonGeometryDBConverter::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 48 of file MuonGeometryDBConverter.cc.

48 {};

◆ endJob()

void MuonGeometryDBConverter::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 49 of file MuonGeometryDBConverter.cc.

49 {};

Referenced by o2olib.O2ORunMgr::executeJob().

◆ fillDescriptions()

void MuonGeometryDBConverter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 221 of file MuonGeometryDBConverter.cc.

221  {
223  desc.setComment("Converts muon geometry between various formats.");
224  desc.add<std::string>("input", "ideal");
225  desc.add<std::string>("dtLabel", "");
226  desc.add<std::string>("cscLabel", "");
227  desc.add<std::string>("gemLabel", "");
228  desc.add<double>("shiftErr", 1000.0);
229  desc.add<double>("angleErr", 6.28);
230  desc.add<bool>("getAPEs", true);
231  desc.add<std::string>("output", "xml");
232  desc.add<std::string>("fileName", "REPLACEME.xml");
234  outputXML.add<std::string>("fileName", "REPLACEME.xml");
235  outputXML.add<std::string>("relativeto", "ideal");
236  outputXML.add<bool>("survey", false);
237  outputXML.add<bool>("rawIds", false);
238  outputXML.add<bool>("eulerAngles", false);
239  outputXML.add<int>("precision", 10);
240  outputXML.addUntracked<bool>("suppressDTBarrel", true);
241  outputXML.addUntracked<bool>("suppressDTWheels", true);
242  outputXML.addUntracked<bool>("suppressDTStations", true);
243  outputXML.addUntracked<bool>("suppressDTChambers", false);
244  outputXML.addUntracked<bool>("suppressDTSuperLayers", false);
245  outputXML.addUntracked<bool>("suppressDTLayers", false);
246  outputXML.addUntracked<bool>("suppressCSCEndcaps", true);
247  outputXML.addUntracked<bool>("suppressCSCStations", true);
248  outputXML.addUntracked<bool>("suppressCSCRings", true);
249  outputXML.addUntracked<bool>("suppressCSCChambers", false);
250  outputXML.addUntracked<bool>("suppressCSCLayers", false);
251  desc.add("outputXML", outputXML);
252  descriptions.add("muonGeometryDBConverter", desc);
253 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, convertSQLitetoXML_cfg::outputXML, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ idealGeometryLabelForInputDB

std::string MuonGeometryDBConverter::idealGeometryLabelForInputDB
private

Definition at line 64 of file MuonGeometryDBConverter.cc.

Referenced by analyze().

◆ idealGeometryLabelForInputMethod

std::string MuonGeometryDBConverter::idealGeometryLabelForInputMethod
private

Definition at line 64 of file MuonGeometryDBConverter.cc.

◆ idealGeometryLabelForInputSurveyDB

std::string MuonGeometryDBConverter::idealGeometryLabelForInputSurveyDB
private

Definition at line 64 of file MuonGeometryDBConverter.cc.

Referenced by analyze().

◆ idealGeometryLabelForInputXML

std::string MuonGeometryDBConverter::idealGeometryLabelForInputXML
private

Definition at line 64 of file MuonGeometryDBConverter.cc.

Referenced by analyze().

◆ m_angleErr

double MuonGeometryDBConverter::m_angleErr
private

Definition at line 58 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_cscLabel

std::string MuonGeometryDBConverter::m_cscLabel
private

Definition at line 57 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_done

bool MuonGeometryDBConverter::m_done
private

Definition at line 54 of file MuonGeometryDBConverter.cc.

Referenced by analyze().

◆ m_dtLabel

std::string MuonGeometryDBConverter::m_dtLabel
private

Definition at line 57 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_fileName

std::string MuonGeometryDBConverter::m_fileName
private

Definition at line 59 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_gemLabel

std::string MuonGeometryDBConverter::m_gemLabel
private

Definition at line 57 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_getAPEs

bool MuonGeometryDBConverter::m_getAPEs
private

Definition at line 60 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_input

std::string MuonGeometryDBConverter::m_input
private

Definition at line 55 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_misalignmentScenario

edm::ParameterSet MuonGeometryDBConverter::m_misalignmentScenario
private

Definition at line 62 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_output

std::string MuonGeometryDBConverter::m_output
private

Definition at line 55 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_outputXML

edm::ParameterSet MuonGeometryDBConverter::m_outputXML
private

Definition at line 63 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

◆ m_shiftErr

double MuonGeometryDBConverter::m_shiftErr
private

Definition at line 58 of file MuonGeometryDBConverter.cc.

Referenced by analyze(), and MuonGeometryDBConverter().

MuonGeometryDBConverter::m_angleErr
double m_angleErr
Definition: MuonGeometryDBConverter.cc:58
MuonGeometryDBConverter::m_getAPEs
bool m_getAPEs
Definition: MuonGeometryDBConverter.cc:60
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
MuonGeometryDBConverter::m_input
std::string m_input
Definition: MuonGeometryDBConverter.cc:55
MuonAlignmentInputXML
Definition: MuonAlignmentInputXML.h:33
MuonGeometryDBConverter::m_output
std::string m_output
Definition: MuonGeometryDBConverter.cc:55
MuonGeometryDBConverter::m_cscLabel
std::string m_cscLabel
Definition: MuonGeometryDBConverter.cc:57
MuonGeometryDBConverter::idealGeometryLabelForInputMethod
std::string idealGeometryLabelForInputMethod
Definition: MuonGeometryDBConverter.cc:64
MuonAlignment
Definition: MuonAlignment.h:21
MuonScenarioBuilder::applyScenario
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the Muon.
Definition: MuonScenarioBuilder.cc:37
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MuonGeometryDBConverter::m_dtLabel
std::string m_dtLabel
Definition: MuonGeometryDBConverter.cc:57
MuonAlignmentInputSurveyDB
Definition: MuonAlignmentInputSurveyDB.h:31
MuonGeometryDBConverter::m_outputXML
edm::ParameterSet m_outputXML
Definition: MuonGeometryDBConverter.cc:63
edm::ParameterSet
Definition: ParameterSet.h:47
MuonAlignmentInputDB
Definition: MuonAlignmentInputDB.h:29
MuonGeometryDBConverter::idealGeometryLabelForInputDB
std::string idealGeometryLabelForInputDB
Definition: MuonGeometryDBConverter.cc:64
convertSQLitetoXML_cfg.outputXML
outputXML
Definition: convertSQLitetoXML_cfg.py:73
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonGeometryDBConverter::idealGeometryLabelForInputXML
std::string idealGeometryLabelForInputXML
Definition: MuonGeometryDBConverter.cc:64
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Exception
Definition: hltDiff.cc:245
MuonGeometryDBConverter::m_shiftErr
double m_shiftErr
Definition: MuonGeometryDBConverter.cc:58
MuonGeometryDBConverter::m_done
bool m_done
Definition: MuonGeometryDBConverter.cc:54
MuonGeometryDBConverter::m_misalignmentScenario
edm::ParameterSet m_misalignmentScenario
Definition: MuonGeometryDBConverter.cc:62
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MuonGeometryDBConverter::idealGeometryLabelForInputSurveyDB
std::string idealGeometryLabelForInputSurveyDB
Definition: MuonGeometryDBConverter.cc:64
MuonGeometryDBConverter::m_fileName
std::string m_fileName
Definition: MuonGeometryDBConverter.cc:59
CSCOverlapsAlignmentAlgorithm_cff.muonAlignment
muonAlignment
Definition: CSCOverlapsAlignmentAlgorithm_cff.py:33
MuonAlignmentInputMethod
Definition: MuonAlignmentInputMethod.h:34
MuonScenarioBuilder
Builds a scenario from configuration and applies it to the alignable Muon.
Definition: MuonScenarioBuilder.h:19
MuonGeometryDBConverter::m_gemLabel
std::string m_gemLabel
Definition: MuonGeometryDBConverter.cc:57