45 using namespace magneticfield;
48 namespace magneticfield {
64 static std::string_view closerNominalLabel(
float current);
79 :
debug_(iConfig.getUntrackedParameter<bool>(
"debugBuilder")) {
84 const int current = iConfig.
getParameter<
int>(
"valueOverride");
93 edm::LogInfo(
"MagneticField") <<
"Current :" << iHandle->m_avg_current
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();
120 return iGet(
"", std::to_string(iConfig->geometryVersion));
123 chosenConfigToken_ = cc.consumes(myConfigTag);
126 std::shared_ptr<MagFieldConfig const> VolumeBasedMagneticFieldESProducerFromDB::chooseConfigAtRuntime(
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()) {
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++) {
204 if (2 * current < nominalCurrents[i] + nominalCurrents[i + 1])
205 return nominalLabels[
i];
207 return nominalLabels[
i];
213 desc.
add<
int>(
"valueOverride", -1)->setComment(
"Force value of current (in A); take the value from DB if < 0.");
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
T getUntrackedParameter(std::string const &, T const &) const
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
DDName is used to identify DDD entities uniquely.
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Compact representation of the geometrical detector hierarchy.
std::vector< MagVolume6Faces * > barrelVolumes() 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)
virtual void setUserNS(bool userns)
static const std::string kDDGeometry
std::shared_ptr< MagFieldConfig const > chooseConfigAtRuntime(const IdealMagneticFieldRecord &iRecord)
edm::ESGetToken< MagFieldConfig, MagFieldConfigRcd > mayGetConfigToken_
std::vector< MagESector * > endcapSectors() const
Get endcap layers.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void clearFiles()
Clear the file list - see Warning!
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Log< level::Info, false > LogInfo
DDLParser is the main class of Detector Description Language Parser.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESGetToken< MagFieldConfig, IdealMagneticFieldRecord > chosenConfigToken_
static std::string_view closerNominalLabel(float current)
T const * product() const
T getParameter(std::string const &) const
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
void setScaling(const std::vector< int > &keys, const std::vector< double > &values)
std::shared_ptr< MagFieldConfig const > chooseConfigViaParameter(const IdealMagneticFieldRecord &iRecord)
tuple config
parse the configuration file
std::vector< MagVolume6Faces * > endcapVolumes() const
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_