CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
genericValidation.GenericValidationData Class Reference
Inheritance diagram for genericValidation.GenericValidationData:
genericValidation.GenericValidation monteCarloValidation.MonteCarloValidation offlineValidation.OfflineValidation trackSplittingValidation.TrackSplittingValidation zMuMuValidation.ZMuMuValidation offlineValidation.OfflineValidationDQM offlineValidation.OfflineValidationParallel

Public Member Functions

def __init__
 
def createCrabCfg
 
- Public Member Functions inherited from genericValidation.GenericValidation
def __init__
 
def createConfiguration
 
def createCrabCfg
 
def createFiles
 
def createScript
 
def getCompareStrings
 
def getRepMap
 

Public Attributes

 crabWorkingDir
 
 dataset
 
 jobmode
 
- Public Attributes inherited from genericValidation.GenericValidation
 alignmentToValidate
 
 config
 
 configFiles
 
 crabConfigFiles
 
 filesToCompare
 
 general
 
 jobmode
 
 name
 
 randomWorkdirPart
 
 scriptFiles
 

Additional Inherited Members

- Static Public Attributes inherited from genericValidation.GenericValidation
string defaultReferenceName = "DEFAULT"
 

Detailed Description

Subclass of `GenericValidation` which is the base for validations using
datasets.

Definition at line 107 of file genericValidation.py.

Constructor & Destructor Documentation

def genericValidation.GenericValidationData.__init__ (   self,
  valName,
  alignment,
  config,
  valType,
  addDefaults = {},
  addMandatories = [] 
)
This method adds additional items to the `self.general` dictionary
which are only needed for validations using datasets.

Arguments:
- `valName`: String which identifies individual validation instances
- `alignment`: `Alignment` instance to validate
- `config`: `BetterConfigParser` instance which includes the
    configuration of the validations
- `valType`: String which specifies the type of validation
- `addDefaults`: Dictionary which contains default values for individual
         validations in addition to the general default values
- `addMandatories`: List which contains mandatory parameters for
            individual validations in addition to the general
            mandatory parameters
            (currently there are no general mandatories)

Definition at line 114 of file genericValidation.py.

References genericValidation.GenericValidation.jobmode, genericValidation.GenericValidation.name, alignment.Alignment.name, MuonGeometrySanityCheckPoint.name, and plotscripts.SawTeethFunction.name.

115  addDefaults = {}, addMandatories=[]):
116  """
117  This method adds additional items to the `self.general` dictionary
118  which are only needed for validations using datasets.
119 
120  Arguments:
121  - `valName`: String which identifies individual validation instances
122  - `alignment`: `Alignment` instance to validate
123  - `config`: `BetterConfigParser` instance which includes the
124  configuration of the validations
125  - `valType`: String which specifies the type of validation
126  - `addDefaults`: Dictionary which contains default values for individual
127  validations in addition to the general default values
128  - `addMandatories`: List which contains mandatory parameters for
129  individual validations in addition to the general
130  mandatory parameters
131  (currently there are no general mandatories)
132  """
133 
134  GenericValidation.__init__(self, valName, alignment, config)
135  defaults = {"jobmode": self.jobmode,
136  "runRange": "",
137  "firstRun": "",
138  "lastRun": "",
139  "begin": "",
140  "end": "",
141  "JSON": ""
142  }
143  defaults.update(addDefaults)
144  mandatories = []
145  mandatories += addMandatories
146  theUpdate = config.getResultingSection(valType+":"+self.name,
147  defaultDict = defaults,
148  demandPars = mandatories)
149  self.general.update(theUpdate)
150  self.jobmode = self.general["jobmode"]
151 
152  knownOpts = defaults.keys()+mandatories
153  ignoreOpts = []
154  if self.jobmode.split(",")[0] == "crab" \
155  or self.__class__.__name__=="OfflineValidationParallel":
156  knownOpts.append("parallelJobs")
157  else:
158  ignoreOpts.append("parallelJobs")
159  config.checkInput(valType+":"+self.name,
160  knownSimpleOptions = knownOpts,
161  ignoreOptions = ignoreOpts)
162 
163  if self.general["dataset"] not in globalDictionaries.usedDatasets:
164  globalDictionaries.usedDatasets[self.general["dataset"]] = Dataset(
165  self.general["dataset"] )
166  self.dataset = globalDictionaries.usedDatasets[self.general["dataset"]]
167 
168  if not self.jobmode.split( ',' )[0] == "crab":
169  try:
170  self.general["datasetDefinition"] = self.dataset.datasetSnippet(
171  jsonPath = self.general["JSON"],
172  nEvents = self.general["maxevents"],
173  firstRun = self.general["firstRun"],
174  lastRun = self.general["lastRun"],
175  begin = self.general["begin"],
176  end = self.general["end"] )
177  except AllInOneError, e:
178  msg = "In section [%s:%s]: "%(valType, self.name)
179  msg += str(e)
180  raise AllInOneError(msg)
181  else:
182  if self.dataset.predefined():
183  msg = ("For jobmode 'crab' you cannot use predefined datasets "
184  "(in your case: '%s')."%( self.dataset.name() ))
185  raise AllInOneError( msg )
186  try:
187  theUpdate = config.getResultingSection(valType+":"+self.name,
188  demandPars = ["parallelJobs"])
189  except AllInOneError, e:
190  msg = str(e)[:-1]+" when using 'jobmode: crab'."
191  raise AllInOneError(msg)
192  self.general.update(theUpdate)
193  if self.general["begin"] or self.general["end"]:
194  ( self.general["begin"],
195  self.general["end"],
196  self.general["firstRun"],
197  self.general["lastRun"] ) = self.dataset.convertTimeToRun(
198  firstRun = self.general["firstRun"],
199  lastRun = self.general["lastRun"],
200  begin = self.general["begin"],
201  end = self.general["end"],
202  shortTuple = False)
203  if self.general["begin"] == None:
204  self.general["begin"] = ""
205  if self.general["end"] == None:
206  self.general["end"] = ""
207  self.general["firstRun"] = str( self.general["firstRun"] )
208  self.general["lastRun"] = str( self.general["lastRun"] )
209  if ( not self.general["firstRun"] ) and \
210  ( self.general["end"] or self.general["lastRun"] ):
211  self.general["firstRun"] = str(
212  self.dataset.runList()[0]["run_number"])
213  if ( not self.general["lastRun"] ) and \
214  ( self.general["begin"] or self.general["firstRun"] ):
215  self.general["lastRun"] = str(
216  self.dataset.runList()[-1]["run_number"])
217  if self.general["firstRun"] and self.general["lastRun"]:
218  if int(self.general["firstRun"]) > int(self.general["lastRun"]):
219  msg = ( "The lower time/runrange limit ('begin'/'firstRun') "
220  "chosen is greater than the upper time/runrange limit "
221  "('end'/'lastRun').")
222  raise AllInOneError( msg )
223  self.general["runRange"] = (self.general["firstRun"]
224  + '-' + self.general["lastRun"])
225  try:
226  self.general["datasetDefinition"] = self.dataset.datasetSnippet(
227  jsonPath = self.general["JSON"],
228  nEvents = self.general["maxevents"],
229  firstRun = self.general["firstRun"],
230  lastRun = self.general["lastRun"],
231  begin = self.general["begin"],
232  end = self.general["end"],
233  crab = True )
234  except AllInOneError, e:
235  msg = "In section [%s:%s]: "%(valType, self.name)
236  msg += str( e )
237  raise AllInOneError( msg )

Member Function Documentation

def genericValidation.GenericValidationData.createCrabCfg (   self,
  path,
  crabCfgBaseName 
)
Method which creates a `crab.cfg` for a validation on datasets.

Arguments:
- `path`: Path at which the file will be stored.
- `crabCfgBaseName`: String which depends on the actual type of
             validation calling this method.

Definition at line 238 of file genericValidation.py.

References genericValidation.GenericValidation.getRepMap(), alignment.Alignment.getRepMap(), genericValidation.GenericValidation.name, alignment.Alignment.name, MuonGeometrySanityCheckPoint.name, and plotscripts.SawTeethFunction.name.

239  def createCrabCfg(self, path, crabCfgBaseName):
240  """
241  Method which creates a `crab.cfg` for a validation on datasets.
242 
243  Arguments:
244  - `path`: Path at which the file will be stored.
245  - `crabCfgBaseName`: String which depends on the actual type of
246  validation calling this method.
247  """
248  crabCfgName = "crab.%s.%s.%s.cfg"%( crabCfgBaseName, self.name,
249  self.alignmentToValidate.name )
250  repMap = self.getRepMap()
251  repMap["script"] = "dummy_script.sh"
252  # repMap["crabOutputDir"] = os.path.basename( path )
253  repMap["crabWorkingDir"] = crabCfgName.split( '.cfg' )[0]
254  self.crabWorkingDir = repMap["crabWorkingDir"]
255  repMap["numberOfJobs"] = self.general["parallelJobs"]
256  repMap["cfgFile"] = self.configFiles[0]
257  repMap["queue"] = self.jobmode.split( ',' )[1].split( '-q' )[1]
258  if self.dataset.dataType() == "mc":
259  repMap["McOrData"] = "events = .oO[nEvents]Oo."
260  elif self.dataset.dataType() == "data":
261  repMap["McOrData"] = "lumis = -1"
262  if self.jobmode.split( ',' )[0] == "crab":
263  print ("For jobmode 'crab' the parameter 'maxevents' will be "
264  "ignored and all events will be processed.")
265  crabCfg = {crabCfgName: replaceByMap( configTemplates.crabCfgTemplate,
266  repMap ) }
267  return GenericValidation.createCrabCfg( self, crabCfg, path )
def replaceByMap
— Helpers —############################
double split
Definition: MVATrainer.cc:139

Member Data Documentation

genericValidation.GenericValidationData.crabWorkingDir

Definition at line 253 of file genericValidation.py.

genericValidation.GenericValidationData.dataset

Definition at line 165 of file genericValidation.py.

genericValidation.GenericValidationData.jobmode

Definition at line 149 of file genericValidation.py.