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 104 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 111 of file genericValidation.py.

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

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

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

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

Member Data Documentation

genericValidation.GenericValidationData.crabWorkingDir

Definition at line 250 of file genericValidation.py.

genericValidation.GenericValidationData.dataset

Definition at line 162 of file genericValidation.py.

genericValidation.GenericValidationData.jobmode

Definition at line 146 of file genericValidation.py.