64 static std::string_view closerNominalLabel(
float current);
78 VolumeBasedMagneticFieldESProducerFromDB::VolumeBasedMagneticFieldESProducerFromDB(
const edm::ParameterSet& iConfig)
79 : debug_(iConfig.getUntrackedParameter<
bool>(
"debugBuilder")) {
84 const int current = iConfig.
getParameter<
int>(
"valueOverride");
94 <<
" (from RunInfo DB); using map configuration with label: " <<
label;
95 return iGet(
"",
label);
103 <<
" (from valueOverride card); using map configuration with label: " <<
label;
117 if (iConfig->
version ==
"parametrizedMagneticField") {
118 return iGet.nothing();
131 return std::shared_ptr<MagFieldConfig const>(
config.product(), [](
auto*) {});
139 return std::shared_ptr<MagFieldConfig const>(
config.product(), [](
auto*) {});
147 std::unique_ptr<MagneticField> paramField =
150 edm::LogInfo(
"MagneticField") <<
"Version: " << conf->version <<
" geometryVersion: " << conf->geometryVersion
151 <<
" slaveFieldVersion: " << conf->slaveFieldVersion;
153 if (conf->version ==
"parametrizedMagneticField") {
162 if (!conf->keys.empty()) {
167 if (!conf->gridFiles.empty()) {
178 parser.getDDLSAX2FileHandler()->setUserNS(
true);
180 std::unique_ptr<std::vector<unsigned char> > tb = blob->getUncompressedBlob();
181 parser.parse(*tb, tb->size());
187 return std::make_unique<VolumeBasedMagneticField>(conf->geometryVersion,
194 paramField.release(),
199 constexpr std::array<int, 7>
nominalCurrents = {{-1, 0, 9558, 14416, 16819, 18268, 19262}};
200 constexpr std::array<std::string_view, 7> nominalLabels = {{
"3.8T",
"0T",
"2T",
"3T",
"3.5T",
"3.8T",
"4T"}};
203 for (;
i < (
int)nominalLabels.size() - 1;
i++) {
205 return nominalLabels[
i];
207 return nominalLabels[
i];
212 desc.addUntracked<
bool>(
"debugBuilder",
false);
213 desc.add<
int>(
"valueOverride", -1)->setComment(
"Force value of current (in A); take the value from DB if < 0.");
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::vector< MagVolume6Faces * > barrelVolumes() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
std::vector< MagESector * > endcapSectors() const
Get endcap layers.
T getParameter(std::string const &) const
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
uint32_t cc[maxCellsPerHit]
DDName is used to identify DDD entities uniquely.
std::string to_string(const V &value)
Compact representation of the geometrical detector hierarchy.
T getUntrackedParameter(std::string const &, T const &) const
void usesResources(std::vector< std::string > const &)
static std::unique_ptr< MagneticField > get(std::string version, const edm::ParameterSet ¶meters)
virtual void build(const DDCompactView &cpv)
void addDefault(ParameterSetDescription const &psetDescription)
static const std::string kDDGeometry
std::shared_ptr< MagFieldConfig const > chooseConfigAtRuntime(const IdealMagneticFieldRecord &iRecord)
edm::ESGetToken< MagFieldConfig, MagFieldConfigRcd > mayGetConfigToken_
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Log< level::Info, false > LogInfo
DDLParser is the main class of Detector Description Language Parser.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< MagVolume6Faces * > endcapVolumes() const
edm::ESGetToken< MagFieldConfig, IdealMagneticFieldRecord > chosenConfigToken_
static std::string_view closerNominalLabel(float current)
std::string version
Version of the data tables to be used.
void setScaling(const std::vector< int > &keys, const std::vector< double > &values)
std::shared_ptr< MagFieldConfig const > chooseConfigViaParameter(const IdealMagneticFieldRecord &iRecord)
int geometryVersion
Version of the geometry to be used.
edm::ESGetToken< MagFieldConfig, MagFieldConfigRcd > knownFromParamConfigToken_
std::unique_ptr< MagneticField > produce(const IdealMagneticFieldRecord &iRecord)
constexpr std::array< int, 7 > nominalCurrents
void setGridFiles(const magneticfield::TableFileMap &gridFiles)
edm::ESGetToken< FileBlob, MFGeometryFileRcd > mayConsumeBlobToken_