-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepare for taking MF configurations from DB #6514
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/python | ||
|
||
import os | ||
import sys | ||
|
||
SETUPS = ('71212', '', ('0T','2T','3T','3_5T','4T')), \ | ||
('90322', '2pi_scaled', (['3_8T'])), \ | ||
('120812', 'Run1', (['3_8T'])), \ | ||
('120812', 'Run2', (['3_8T'])), \ | ||
('130503', 'Run1', ('3_5T','3_8T')), \ | ||
('130503', 'Run2', ('3_5T','3_8T')), | ||
|
||
|
||
for SETUP in SETUPS : | ||
SET = SETUP[0] | ||
SUBSET = SETUP[1] | ||
for B_NOM in SETUP[2] : | ||
print SET, SUBSET, B_NOM | ||
sys.stdout.flush() | ||
namespace = {'SET':SET, 'SUBSET':SUBSET, 'B_NOM':B_NOM} | ||
execfile("writeMagFieldConfigDB.py",namespace) | ||
process = namespace.get('process') | ||
cfgFile = open('run.py','w') | ||
cfgFile.write( process.dumpPython() ) | ||
cfgFile.write( '\n' ) | ||
cfgFile.close() | ||
os.system("cmsRun run.py") | ||
del namespace | ||
del process | ||
print "" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("MAGNETICFIELDTEST") | ||
|
||
process.source = cms.Source("EmptySource") | ||
process.maxEvents = cms.untracked.PSet( | ||
input = cms.untracked.int32(1) | ||
) | ||
|
||
process.load("MagneticField.Engine.volumeBasedMagneticFieldFromDB_cfi") | ||
|
||
process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") | ||
from Configuration.AlCa.GlobalTag import GlobalTag | ||
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:mc', '') | ||
|
||
|
||
|
||
process.GlobalTag.toGet = cms.VPSet( | ||
# Geometries | ||
cms.PSet(record = cms.string("MFGeometryFileRcd"), | ||
# tag = cms.string("MagneticFieldGeometry_90322"), | ||
# connect = cms.untracked.string("sqlite_file:DB_Geom/mfGeometry_90322.db"), | ||
tag = cms.string("MFGeometry_90322"), | ||
connect = cms.untracked.string("frontier://FrontierPrep/CMS_COND_GEOMETRY"), | ||
label = cms.untracked.string("90322") | ||
), | ||
cms.PSet(record = cms.string("MFGeometryFileRcd"), | ||
# tag = cms.string("MagneticFieldGeometry_120812"), | ||
# connect = cms.untracked.string("sqlite_file:DB_Geom/mfGeometry_120812.db"), | ||
tag = cms.string("MFGeometry_120812"), | ||
connect = cms.untracked.string("frontier://FrontierPrep/CMS_COND_GEOMETRY"), | ||
label = cms.untracked.string("120812") | ||
), | ||
cms.PSet(record = cms.string("MFGeometryFileRcd"), | ||
# tag = cms.string("MagneticFieldGeometry_130503"), | ||
# connect = cms.untracked.string("sqlite_file:DB_Geom/mfGeometry_130503.db"), | ||
tag = cms.string("MFGeometry_130503"), | ||
connect = cms.untracked.string("frontier://FrontierPrep/CMS_COND_GEOMETRY"), | ||
label = cms.untracked.string("130503") | ||
), | ||
|
||
# Configurations | ||
cms.PSet(record = cms.string("MagFieldConfigRcd"), | ||
tag = cms.string("MagFieldConfig"), | ||
connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_71212_0T.db"), | ||
label = cms.untracked.string("0T") | ||
), | ||
cms.PSet(record = cms.string("MagFieldConfigRcd"), | ||
tag = cms.string("MagFieldConfig"), | ||
connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_71212_2T.db"), | ||
label = cms.untracked.string("2T") | ||
), | ||
cms.PSet(record = cms.string("MagFieldConfigRcd"), | ||
tag = cms.string("MagFieldConfig"), | ||
connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_71212_3T.db"), | ||
label = cms.untracked.string("3T") | ||
), | ||
cms.PSet(record = cms.string("MagFieldConfigRcd"), | ||
tag = cms.string("MagFieldConfig"), | ||
connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_71212_3_5T.db"), | ||
label = cms.untracked.string("3.5T") | ||
), | ||
# cms.PSet(record = cms.string("MagFieldConfigRcd"), # Run 2, new version (130503) | ||
# tag = cms.string("MagFieldConfig"), | ||
# connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_130503_Run2_3_5T.db"), | ||
# label = cms.untracked.string("3.5T") | ||
# ), | ||
cms.PSet(record = cms.string("MagFieldConfigRcd"), #Run 1 default | ||
tag = cms.string("MagFieldConfig"), | ||
connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_90322_2pi_scaled_3_8T.db"), | ||
label = cms.untracked.string("3.8T") | ||
), | ||
# cms.PSet(record = cms.string("MagFieldConfigRcd"), #Run 2 default | ||
# tag = cms.string("MagFieldConfig"), | ||
# connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_120812_Run2_3_8T.db"), | ||
# label = cms.untracked.string("3.8T") | ||
# ), | ||
# cms.PSet(record = cms.string("MagFieldConfigRcd"), #Run 1, version 120812 | ||
# tag = cms.string("MagFieldConfig"), | ||
# connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_120812_Run1_3_8T.db"), | ||
# label = cms.untracked.string("3.8T") | ||
# ), | ||
# cms.PSet(record = cms.string("MagFieldConfigRcd"), #Run 1, version 130503 | ||
# tag = cms.string("MagFieldConfig"), | ||
# connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_130503_Run1_3_8T.db"), | ||
# label = cms.untracked.string("3.8T") | ||
# ), | ||
# cms.PSet(record = cms.string("MagFieldConfigRcd"), #Run 2, new version (130503) | ||
# tag = cms.string("MagFieldConfig"), | ||
# connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_130503_Run2_3_8T.db"), | ||
# label = cms.untracked.string("3.8T") | ||
# ), | ||
cms.PSet(record = cms.string("MagFieldConfigRcd"), | ||
tag = cms.string("MagFieldConfig"), | ||
connect = cms.untracked.string("sqlite_file:DB_Conf/MFConfig_71212_4T.db"), | ||
label = cms.untracked.string("4T") | ||
), | ||
|
||
|
||
) | ||
|
||
# process.VolumeBasedMagneticFieldESProducer.valueOverride = 17000 | ||
|
||
process.MessageLogger = cms.Service("MessageLogger", | ||
categories = cms.untracked.vstring("MagneticField"), | ||
destinations = cms.untracked.vstring("cout"), | ||
cout = cms.untracked.PSet( | ||
noLineBreaks = cms.untracked.bool(True), | ||
threshold = cms.untracked.string("WARNING"), | ||
WARNING = cms.untracked.PSet( | ||
limit = cms.untracked.int32(0) | ||
), | ||
MagneticField = cms.untracked.PSet( | ||
limit = cms.untracked.int32(10000000) | ||
) | ||
) | ||
) | ||
|
||
process.testField = cms.EDAnalyzer("testMagneticField") | ||
process.p1 = cms.Path(process.testField) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,17 +95,16 @@ std::auto_ptr<MagneticField> VolumeBasedMagneticFieldESProducerFromDB::produce(c | |
message = " (from valueOverride card)"; | ||
} | ||
string configLabel = closerNominalLabel(current); | ||
edm::LogInfo("MagneticField|AutoMagneticField") << "Current: " << current << message << "; using map configuration with label: " << configLabel; | ||
|
||
// Get configuration | ||
ESHandle<MagFieldConfig> confESH; | ||
iRecord.getRecord<MagFieldConfigRcd>().get(configLabel, confESH); | ||
const MagFieldConfig* conf = &*confESH; | ||
|
||
if (debug) { | ||
cout << "VolumeBasedMagneticFieldESProducerFromDB::produce() " << conf->version << endl; | ||
} | ||
|
||
edm::LogInfo("MagneticField|AutoMagneticField") << "Current: " << current << message << "; using map configuration with label: " << configLabel << endl | ||
<< "Version: " << conf->version | ||
<< " geometryVersion: " << conf->geometryVersion | ||
<< " slaveFieldVersion: " << conf->slaveFieldVersion; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very good (I assume you think LogInfo is the right level though you had "debug" initially)! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a part of the debug code mentioned above, so MessageLogger is appropriate in this specific case. Info is more appropriate IMO. |
||
|
||
// Get the parametrized field | ||
std::auto_ptr<MagneticField> paramField = ParametrizedMagneticFieldFactory::get(conf->slaveFieldVersion, conf->slaveFieldParameters); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -346,13 +346,34 @@ void MagGeoBuilderFromDDD::build(const DDCompactView & cpva) | |
|
||
//Sort in phi | ||
precomputed_value_sort(eVolumes.begin(), eVolumes.end(), ExtractPhi()); | ||
|
||
// Handle the -pi/pi boundary: volumes crossing it could be half at the begin and half at end of the sorted list. | ||
// So, check if any of the volumes that should belong to the first bin (at -phi) are at the end of the list: | ||
float lastBinPhi = phiClust.back(); | ||
handles::reverse_iterator ri = eVolumes.rbegin(); | ||
while ((*ri)->center().phi()>lastBinPhi) {++ri;} | ||
if (ri!=eVolumes.rbegin()) { | ||
// ri points to the first element that is within the last bin. | ||
// We need to move the following element (ie ri.base()) to the beginning of the list, | ||
handles::iterator newbeg = ri.base(); | ||
rotate(eVolumes.begin(),newbeg, eVolumes.end()); | ||
} | ||
|
||
//Group volumes in sectors | ||
int offset = eVolumes.size()/nESectors; | ||
for (int i = 0; i<nESectors; ++i) { | ||
int offset = eVolumes.size()/nESectors; | ||
if (debug) cout << " Sector at phi = " | ||
<< (*(eVolumes.begin()+((i)*offset)))->center().phi() | ||
<< endl; | ||
if (debug) { | ||
cout << " Sector at phi = " | ||
<< (*(eVolumes.begin()+((i)*offset)))->center().phi() | ||
<< endl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not new but cout is not good. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I wrote, this is also something that activates much more checks than just printing a message (elsewhere in this class). There is no point in changing messages here because messages are issued only when running in debugging mode, and logDebug does not help here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Nicola, If we were to test this in multi-threaded mode, cout may give garbage On 11/21/14, 6:46 AM, Nicola Amapane wrote:
Vyacheslav (Slava) Krutelyov There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dear Slava, In the 10 year lifetime of this code, nobody has been running it in When I'll need to test it in a multi-threaded mode, I will take care of Cheers, On 21-Nov-14 14:09, Slava Krutelyov wrote:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Nicola, We are moving towards running multithreaded by default On 11/21/14, 7:14 AM, Nicola Amapane wrote:
Vyacheslav (Slava) Krutelyov There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dear Slava, Thanks for the warning. My point is that this specific code won't ever Cheers On 21-Nov-14 14:17, Slava Krutelyov wrote:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dear Nicola, Thanks for the clarification. Cheers On 11/21/14, 8:15 AM, Nicola Amapane wrote:
Vyacheslav (Slava) Krutelyov |
||
// Additional x-check: sectors are expected to be made by volumes with the same copyno | ||
int secCopyNo = -1; | ||
for (handles::const_iterator iv=eVolumes.begin()+((i)*offset); iv!=eVolumes.begin()+((i+1)*offset); ++iv){ | ||
if (secCopyNo>=0&& (*iv)->copyno!=secCopyNo) cout << "ERROR: volume copyno" << (*iv)->name << ":" << (*iv)->copyno << " differs from others in same sectors " << secCopyNo << endl; | ||
secCopyNo = (*iv)->copyno; | ||
} | ||
} | ||
|
||
sectors.push_back(eSector(eVolumes.begin()+((i)*offset), | ||
eVolumes.begin()+((i+1)*offset))); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to keep all the commented out code? If not needed - should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I need all the commented code. This is a test .py, what's the problem here?