-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8994 from namapane/MFConfigDB_740
Make the fast parabolic MF parametrization dynamic
- Loading branch information
Showing
16 changed files
with
172 additions
and
75 deletions.
There are no files selected for viewing
6 changes: 4 additions & 2 deletions
6
Configuration/StandardSequences/python/MagneticField_0T_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Load the 0T field map, with the geometry specified in the GT | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
from MagneticField.Engine.autoMagneticFieldProducer_cfi import * | ||
AutoMagneticFieldESProducer.valueOverride = 0 | ||
from MagneticField.Engine.volumeBasedMagneticFieldFromDB_cfi import * | ||
VolumeBasedMagneticFieldESProducer.valueOverride = 0 |
13 changes: 4 additions & 9 deletions
13
Configuration/StandardSequences/python/MagneticField_20T_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# This cfi contains everything needed to use the VolumeBased magnetic | ||
# field engine. | ||
#Default is version 85l | ||
from MagneticField.Engine.volumeBasedMagneticField_1103l_cfi import * | ||
VolumeBasedMagneticFieldESProducer.version = 'grid_1103l_071212_2t' | ||
ParametrizedMagneticFieldProducer.parameters.BValue = '2_0T' | ||
|
||
# Load the 2T field map, with the geometry and configuration specified in the GT | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
from MagneticField.Engine.volumeBasedMagneticFieldFromDB_cfi import * | ||
VolumeBasedMagneticFieldESProducer.valueOverride = 9558 |
13 changes: 4 additions & 9 deletions
13
Configuration/StandardSequences/python/MagneticField_30T_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# This cfi contains everything needed to use the VolumeBased magnetic | ||
# field engine. | ||
#Default is version 85l | ||
from MagneticField.Engine.volumeBasedMagneticField_1103l_cfi import * | ||
VolumeBasedMagneticFieldESProducer.version = 'grid_1103l_071212_3t' | ||
ParametrizedMagneticFieldProducer.parameters.BValue = '3_0T' | ||
|
||
# Load the 3 T field map, with the geometry and configuration specified in the GT | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
from MagneticField.Engine.volumeBasedMagneticFieldFromDB_cfi import * | ||
VolumeBasedMagneticFieldESProducer.valueOverride = 14416 |
13 changes: 4 additions & 9 deletions
13
Configuration/StandardSequences/python/MagneticField_35T_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# This cfi contains everything needed to use the VolumeBased magnetic | ||
# field engine. | ||
#Default is version 85l | ||
from MagneticField.Engine.volumeBasedMagneticField_1103l_cfi import * | ||
VolumeBasedMagneticFieldESProducer.version = 'grid_1103l_071212_3_5t' | ||
ParametrizedMagneticFieldProducer.parameters.BValue = '3_5T' | ||
|
||
# Load the 3.5 T field map, with the geometry and configuration specified in the GT | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
from MagneticField.Engine.volumeBasedMagneticFieldFromDB_cfi import * | ||
VolumeBasedMagneticFieldESProducer.valueOverride = 16819 |
6 changes: 2 additions & 4 deletions
6
Configuration/StandardSequences/python/MagneticField_38T_PostLS1_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
Configuration/StandardSequences/python/MagneticField_38T_ToscaMap090322_cff.py
This file was deleted.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
Configuration/StandardSequences/python/MagneticField_38T_UpdatedMap_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
# This cfi is DEPRECATED - to be removed once dependencies are cleared up | ||
|
||
print 'Using Configuration.StandardSequences.MagneticField_UpdatedMap_cff is DEPRECATED. Please change this to Configuration.StandardSequences.MagneticField_38T_cff' | ||
|
||
# This cfi contains everything needed to use the VolumeBased magnetic | ||
# field engine. | ||
#version coming from updated TOSCA simulation after CRAFT08 analysis | ||
from MagneticField.Engine.volumeBasedMagneticField_1103l_090216_cfi import * | ||
import FWCore.ParameterSet.Config as cms | ||
from Configuration.StandardSequences.MagneticField_38T_cff import * | ||
|
||
|
11 changes: 5 additions & 6 deletions
11
Configuration/StandardSequences/python/MagneticField_38T_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
# Load the 3.8 T field map, with the geometry and configuration specified in the GT | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
from MagneticField.Engine.volumeBasedMagneticFieldFromDB_cfi import * | ||
VolumeBasedMagneticFieldESProducer.valueOverride = 18268 | ||
|
||
# This cfi contains everything needed to use the VolumeBased magnetic | ||
# field engine. | ||
#Default is version 85l | ||
from MagneticField.Engine.volumeBasedMagneticField_090322_2pi_scaled_cfi import * | ||
|
||
# Parabolic parametrized magnetic field used for track building | ||
# Parabolic parametrized magnetic field used for track building (at 3.8T) | ||
from MagneticField.ParametrizedEngine.ParabolicParametrizedField_cfi import ParametrizedMagneticFieldProducer as ParabolicParametrizedMagneticFieldProducer | ||
ParabolicParametrizedMagneticFieldProducer.label = "ParabolicMf" | ||
|
||
|
5 changes: 2 additions & 3 deletions
5
Configuration/StandardSequences/python/MagneticField_38T_polyFit2D_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
Configuration/StandardSequences/python/MagneticField_40T_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# This cfi contains everything needed to use the VolumeBased magnetic | ||
# field engine. | ||
#Default is version 85l | ||
from MagneticField.Engine.volumeBasedMagneticField_1103l_cfi import * | ||
VolumeBasedMagneticFieldESProducer.version = 'grid_1103l_071212_4t' | ||
ParametrizedMagneticFieldProducer.parameters.BValue = '4_0T' | ||
|
||
# Load the 4 T field map, with the geometry and configuration specified in the GT | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
from MagneticField.Engine.volumeBasedMagneticFieldFromDB_cfi import * | ||
VolumeBasedMagneticFieldESProducer.valueOverride = 19262 |
12 changes: 6 additions & 6 deletions
12
Configuration/StandardSequences/python/MagneticField_AutoFromDBCurrent_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
# Load the field map corresponding to the current stored in the runInfo, | ||
# with the geometry and configuration specified in the GT | ||
|
||
#this will load the auto magnetic field producer reading the current from the DB | ||
# and loading the best map available for that current as specified in the file | ||
from MagneticField.Engine.autoMagneticFieldProducer_cfi import * | ||
import FWCore.ParameterSet.Config as cms | ||
from MagneticField.Engine.volumeBasedMagneticFieldFromDB_cfi import * | ||
|
||
# Parabolic parametrized magnetic field used for track building | ||
from MagneticField.ParametrizedEngine.ParabolicParametrizedField_cfi import ParametrizedMagneticFieldProducer as ParabolicParametrizedMagneticFieldProducer | ||
# Parabolic parametrized magnetic field used for track building (scaled to nominal map closest to current from runInfo) | ||
from MagneticField.ParametrizedEngine.autoParabolicParametrizedField_cfi import ParametrizedMagneticFieldProducer as ParabolicParametrizedMagneticFieldProducer | ||
ParabolicParametrizedMagneticFieldProducer.label = "ParabolicMf" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# Load the default 3.8 T field map with the geometry and configuration specified in the GT. | ||
# Note that this does NOT depend on the actual solenoid current: | ||
# MagneticField_AutoFromDBCurrent_cff should be used if a current-dependent map is needed. | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# | ||
# Master configuration for the magnetic field | ||
# old mapping with 4T | ||
from Configuration.StandardSequences.MagneticField_38T_cff import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
MagneticField/ParametrizedEngine/plugins/AutoParametrizedMagneticFieldProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/** \class AutoParametrizedMagneticFieldProducer | ||
* | ||
* Description: Producer for parametrized Magnetics Fields, with value scaled depending on current. | ||
* | ||
*/ | ||
|
||
#include "FWCore/Framework/interface/ESProducer.h" | ||
|
||
#include "MagneticField/Engine/interface/MagneticField.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "MagneticField/ParametrizedEngine/interface/ParametrizedMagneticFieldFactory.h" | ||
|
||
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" | ||
#include "CondFormats/RunInfo/interface/RunInfo.h" | ||
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h" | ||
|
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include <FWCore/MessageLogger/interface/MessageLogger.h> | ||
|
||
#include <string> | ||
#include <iostream> | ||
|
||
using namespace std; | ||
using namespace edm; | ||
|
||
namespace magneticfield{ | ||
class AutoParametrizedMagneticFieldProducer : public edm::ESProducer | ||
{ | ||
public: | ||
AutoParametrizedMagneticFieldProducer(const edm::ParameterSet&); | ||
~AutoParametrizedMagneticFieldProducer(){} | ||
|
||
std::auto_ptr<MagneticField> produce(const IdealMagneticFieldRecord&); | ||
|
||
int closerNominaCurrent(float current); | ||
edm::ParameterSet pset; | ||
std::vector<int> nominalCurrents; | ||
// std::vector<std::string> nominalLabels; | ||
}; | ||
} | ||
|
||
using namespace magneticfield; | ||
|
||
AutoParametrizedMagneticFieldProducer::AutoParametrizedMagneticFieldProducer(const edm::ParameterSet& iConfig) : pset(iConfig) { | ||
setWhatProduced(this, pset.getUntrackedParameter<std::string>("label","")); | ||
nominalCurrents={-1, 0,9558,14416,16819,18268,19262}; | ||
// nominalLabels ={"3.8T","0T","2T", "3T", "3.5T", "3.8T", "4T"}; | ||
} | ||
|
||
std::auto_ptr<MagneticField> | ||
AutoParametrizedMagneticFieldProducer::produce(const IdealMagneticFieldRecord& iRecord) | ||
{ | ||
string version = pset.getParameter<string>("version"); | ||
|
||
// Get value of the current from condition DB | ||
float current = pset.getParameter<int>("valueOverride"); | ||
string message; | ||
if (current < 0) { | ||
ESHandle<RunInfo> rInfo; | ||
iRecord.getRecord<RunInfoRcd>().get(rInfo); | ||
current = rInfo->m_avg_current; | ||
message = " (from RunInfo DB)"; | ||
} else { | ||
message = " (from valueOverride card)"; | ||
} | ||
float cnc= closerNominaCurrent(current); | ||
|
||
edm::LogInfo("MagneticField|AutoParametrizedMagneticField") << "Current: " << current << message << "; using map for: " << cnc; | ||
|
||
vector<double> parameters; | ||
|
||
if (cnc==0) { | ||
version = "Uniform"; | ||
parameters.push_back(0); | ||
} | ||
|
||
else if (version=="Parabolic"){ | ||
parameters.push_back(3.8114); //c1 | ||
parameters.push_back(-3.94991e-06); //b0 | ||
parameters.push_back(7.53701e-06); //b1 | ||
parameters.push_back(2.43878e-11); //a | ||
if (cnc!=18268){ // Linear scaling for B!= 3.8T; note that just c1, b0 and b1 have to be scaled to get linear scaling | ||
double scale=double(cnc)/double(18268); | ||
parameters[0]*=scale; | ||
parameters[1]*=scale; | ||
parameters[2]*=scale; | ||
} | ||
} else { | ||
//Other parametrizations are not relevant here and not supported | ||
throw cms::Exception("InvalidParameter") << "version " << version << " is not supported"; | ||
} | ||
|
||
return ParametrizedMagneticFieldFactory::get(version, parameters); | ||
} | ||
|
||
int AutoParametrizedMagneticFieldProducer::closerNominaCurrent(float current) { | ||
int i=0; | ||
for(;i<(int)nominalCurrents.size()-1;i++) { | ||
if(2*current < nominalCurrents[i]+nominalCurrents[i+1] ) | ||
return nominalCurrents[i]; | ||
} | ||
return nominalCurrents[i]; | ||
} | ||
|
||
|
||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
DEFINE_FWK_EVENTSETUP_MODULE(AutoParametrizedMagneticFieldProducer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
MagneticField/ParametrizedEngine/python/autoParabolicParametrizedField_cfi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# This cfi contains everything needed to use the parabolic magnetic | ||
# field engine (tracker region only) scaled to the nominal value closest to the current read from RunInfo. | ||
|
||
idealMagneticFieldRecordSource = cms.ESSource("EmptyESSource", | ||
recordName = cms.string('IdealMagneticFieldRecord'), | ||
iovIsRunNotTime = cms.bool(True), | ||
firstValid = cms.vuint32(1) | ||
) | ||
|
||
ParametrizedMagneticFieldProducer = cms.ESProducer("AutoParametrizedMagneticFieldProducer", | ||
version = cms.string('Parabolic'), | ||
label = cms.untracked.string(''), | ||
valueOverride = cms.int32(-1) | ||
) | ||
|