CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
mps_alisetup Namespace Reference

Functions

def create_input_db
 
def get_weight_configs
 

Variables

 aligmentConfig = args.alignmentConfig
 
tuple args = parser.parse_args()
 
tuple config = ConfigParser.ConfigParser()
 
tuple configTemplate = config.get('general','configTemplate')
 
tuple currentDir = os.getcwd()
 
string eos = '/afs/cern.ch/project/eos/installation/cms/bin/eos.select'
 
dictionary generalOptions = {}
 
tuple globalTag = config.get('general','globaltag')
 
string help = 'display detailed output of mps_setup'
 
string helpEpilog
 
tuple match = re.search(re.compile('mpproduction\/mp(.+?)$', re.M|re.I),currentDir)
 
tuple milleScript = os.path.join(mpsTemplates, "mps_runMille_template.sh")
 
string mpsdirname = ''
 
tuple mpsTemplates = os.path.join("src", "Alignment", "MillePedeAlignmentAlgorithm", "templates")
 
string mssDir = '/store/caf/user/'
 
tuple parser
 
tuple pedeScript = os.path.join(mpsTemplates, "mps_runPede_rfcp_template.sh")
 
tuple pedesettings
 
tuple tmpFile = f.read()
 
tuple weight_confs = get_weight_configs(config)
 

Function Documentation

def mps_alisetup.create_input_db (   cfg,
  run_number 
)
Create sqlite file with single-IOV tags and use it to override the GT. If
the GT is already customized by the user, the customization has higher
priority. Returns a snippet to be appended to the configuration file

Arguments:
- `cfg`: path to python configuration
- `run_number`: run from which to extract the alignment payloads

Definition at line 78 of file mps_alisetup.py.

78 
79 def create_input_db(cfg, run_number):
80  """
81  Create sqlite file with single-IOV tags and use it to override the GT. If
82  the GT is already customized by the user, the customization has higher
83  priority. Returns a snippet to be appended to the configuration file
84 
85  Arguments:
86  - `cfg`: path to python configuration
87  - `run_number`: run from which to extract the alignment payloads
88  """
89 
90  sys.path.append(os.path.dirname(cfg))
91  cache_stdout = sys.stdout
92  sys.stdout = open(os.devnull, "w") # suppress unwanted output
93  __configuration = \
94  importlib.import_module(os.path.splitext(os.path.basename(cfg))[0])
95  sys.stdout = cache_stdout
96 
97  run_number = int(run_number)
98  if not run_number > 0:
99  print "'FirstRunForStartGeometry' must be positive, but is", run_number
100  sys.exit(1)
101 
102  global_tag = __configuration.process.GlobalTag.globaltag.value()
103  input_db_name = os.path.abspath("alignment_input.db")
104  tags = mps_tools.create_single_iov_db(global_tag, run_number, input_db_name)
105 
106  for condition in __configuration.process.GlobalTag.toGet.value():
107  if condition.record.value() in tags: del tags[condition.record.value()]
108 
109  result = ""
110  for record,tag in tags.iteritems():
111  if result == "":
112  result += ("\nimport "
113  "Alignment.MillePedeAlignmentAlgorithm.alignmentsetup."
114  "SetCondition as tagwriter\n")
115  result += ("\ntagwriter.setCondition(process,\n"
116  " connect = \""+tag["connect"]+"\",\n"
117  " record = \""+record+"\",\n"
118  " tag = \""+tag["tag"]+"\")\n")
119 
120  os.remove(cfg+"c")
121  return result
122 
123 # ------------------------------------------------------------------------------
124 # set up argument parser and config parser
def create_input_db
Definition: mps_alisetup.py:78
def mps_alisetup.get_weight_configs (   config)
Extracts different weight configurations from `config`.

Arguments:
- `config`: ConfigParser object containing the alignment configuration

Definition at line 26 of file mps_alisetup.py.

References split.

26 
27 def get_weight_configs(config):
28  """Extracts different weight configurations from `config`.
29 
30  Arguments:
31  - `config`: ConfigParser object containing the alignment configuration
32  """
33 
34  weight_dict = collections.OrderedDict()
35  common_weights = {}
36 
37  # loop over datasets to reassign weights
38  for section in config.sections():
39  if 'general' in section:
40  continue
41  elif section == "weights":
42  for option in config.options(section):
43  common_weights[option] = [x.strip() for x in
44  config.get(section, option).split(",")]
45  elif section.startswith("dataset:"):
46  name = section[8:] # get name of dataset by stripping of "dataset:"
47  if config.has_option(section,'weight'):
48  weight_dict[name] = [x.strip() for x in
49  config.get(section, "weight").split(",")]
50  else:
51  weight_dict[name] = ['1.0']
52 
53  weights_list = [[(name, weight) for weight in weight_dict[name]]
54  for name in weight_dict]
55 
56  common_weights_list = [[(name, weight) for weight in common_weights[name]]
57  for name in common_weights]
58  common_weights_dicts = []
59  for item in itertools.product(*common_weights_list):
60  d = {}
61  for name,weight in item:
62  d[name] = weight
63  common_weights_dicts.append(d)
64 
65  configs = []
66  for weight_conf in itertools.product(*weights_list):
67  if len(common_weights) > 0:
68  for common_weight in common_weights_dicts:
69  configs.append([(dataset[0],
70  reduce(lambda x,y: x.replace(y, common_weight[y]),
71  common_weight, dataset[1]))
72  for dataset in weight_conf])
73  else:
74  configs.append(weight_conf)
75 
76  return configs
77 
def get_weight_configs
Definition: mps_alisetup.py:26
double split
Definition: MVATrainer.cc:139

Variable Documentation

mps_alisetup.aligmentConfig = args.alignmentConfig

Definition at line 142 of file mps_alisetup.py.

tuple mps_alisetup.args = parser.parse_args()

Definition at line 141 of file mps_alisetup.py.

tuple mps_alisetup.config = ConfigParser.ConfigParser()

Definition at line 145 of file mps_alisetup.py.

Referenced by DTBtiChip.acceptMask(), EcalBarrelMonitorDbModule.analyze(), DTBtiChip.computeEqs(), DTBtiChip.computeSums(), PhysicsTools::VarProcessor.configure(), TwoBodyDecayTrajectory.construct(), DualBzeroReferenceTrajectory.construct(), DualReferenceTrajectory.construct(), TwoBodyDecayTrajectoryFactory.constructTrajectories(), edm::ServiceRegistry.createContaining(), egPM::Param< reco::ElectronSeed >.createParamBin_(), DeepFlavourJetTagsProducer.DeepFlavourJetTagsProducer(), Mixing2DB.endJob(), edm::EventProcessor.EventProcessor(), DTBtiChip.findTrig(), getHLTConfigData(), edm::Event.getProcessParameterSet(), CSCTFSectorProcessor.initialize(), DTBtiChip.keepTrig(), DTBtiChip.keepTrigPatt(), pos::PixelConfigFile.makeKey(), edm::ProblemTracker.ProblemTracker(), CSCTFConfigProducer.produceL1MuCSCTFConfigurationRcd(), FWConfigurationManager.readFromOldFile(), edm::MixingModule.reload(), edm::PileUp.reload(), edm::MixingWorker< T >.reload(), CmsShowMainBase.reloadConfiguration(), cond::Utilities.run(), FWGenericParameter< T >.setFrom(), PhysicsTools::MVAComputer.setup(), FWConfigurationManager.to(), TrackingMaterialProducer.TrackingMaterialProducer(), BzeroReferenceTrajectoryFactory.trajectories(), DualBzeroTrajectoryFactory.trajectories(), DualTrajectoryFactory.trajectories(), and ReferenceTrajectoryFactory.trajectories().

tuple mps_alisetup.configTemplate = config.get('general','configTemplate')

Definition at line 234 of file mps_alisetup.py.

tuple mps_alisetup.currentDir = os.getcwd()

Definition at line 164 of file mps_alisetup.py.

string mps_alisetup.eos = '/afs/cern.ch/project/eos/installation/cms/bin/eos.select'

Definition at line 178 of file mps_alisetup.py.

dictionary mps_alisetup.generalOptions = {}

Definition at line 185 of file mps_alisetup.py.

tuple mps_alisetup.globalTag = config.get('general','globaltag')

Definition at line 242 of file mps_alisetup.py.

string mps_alisetup.help = 'display detailed output of mps_setup'

Definition at line 133 of file mps_alisetup.py.

Referenced by CmsShowMainFrame.CmsShowMainFrame().

string mps_alisetup.helpEpilog
Initial value:
1 = '''Builds the config-templates from a universal config-template for each
2 dataset specified in .ini-file that is passed to this script.
3 Then calls mps_setup.pl for all datasets.'''

Definition at line 125 of file mps_alisetup.py.

tuple mps_alisetup.match = re.search(re.compile('mpproduction\/mp(.+?)$', re.M|re.I),currentDir)

Definition at line 166 of file mps_alisetup.py.

tuple mps_alisetup.milleScript = os.path.join(mpsTemplates, "mps_runMille_template.sh")

Definition at line 160 of file mps_alisetup.py.

string mps_alisetup.mpsdirname = ''

Definition at line 165 of file mps_alisetup.py.

tuple mps_alisetup.mpsTemplates = os.path.join("src", "Alignment", "MillePedeAlignmentAlgorithm", "templates")

Definition at line 155 of file mps_alisetup.py.

string mps_alisetup.mssDir = '/store/caf/user/'

Definition at line 175 of file mps_alisetup.py.

tuple mps_alisetup.parser
Initial value:
2  description='Setup the alignment as configured in the alignment_config file.',
3  epilog=helpEpilog)

Definition at line 128 of file mps_alisetup.py.

tuple mps_alisetup.pedeScript = os.path.join(mpsTemplates, "mps_runPede_rfcp_template.sh")

Definition at line 161 of file mps_alisetup.py.

tuple mps_alisetup.pedesettings
Initial value:
1 = ([x.strip() for x in config.get("general", "pedesettings").split(",")]
2  if config.has_option("general", "pedesettings") else [None])
double split
Definition: MVATrainer.cc:139

Definition at line 214 of file mps_alisetup.py.

tuple mps_alisetup.tmpFile = f.read()

Definition at line 250 of file mps_alisetup.py.

tuple mps_alisetup.weight_confs = get_weight_configs(config)

Definition at line 217 of file mps_alisetup.py.