CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
validateAlignments.ValidationJob Class Reference
Inheritance diagram for validateAlignments.ValidationJob:
validateAlignments.ValidationBase

Public Member Functions

def __init__ (self, validation, config, options, *args, **kwargs)
 
def __iter__ (self)
 
def __next__ (self)
 
def createJob (self)
 
def getValidation (self)
 
def needsproxy (self)
 
def runJob (self)
 
- Public Member Functions inherited from validateAlignments.ValidationBase
def __init__ (self, validation, config, options)
 

Public Attributes

 end
 
 JobId
 
 scripts
 
 start
 
 validation
 
- Public Attributes inherited from validateAlignments.ValidationBase
 alignments
 
 commandLineOptions
 
 config
 
 preexisting
 
 valName
 
 valSection
 
 valType
 

Static Public Attributes

dictionary condorConf = {}
 
int interactCount = 0
 
int jobCount = 0
 

Private Member Functions

def __createJob (self, jobMode, outpath)
 
def __getValidation (self, valType, name, alignments, config, options)
 

Detailed Description

Definition at line 119 of file validateAlignments.py.

Constructor & Destructor Documentation

◆ __init__()

def validateAlignments.ValidationJob.__init__ (   self,
  validation,
  config,
  options,
args,
**  kwargs 
)

Definition at line 126 of file validateAlignments.py.

126  def __init__( self, validation, config, options, *args, **kwargs ):
127 
128  self.start = 0
129  self.end = args
130  self.JobId=[]
131  super(ValidationJob, self).__init__( validation, config, options )
132  self.validation = self.__getValidation( self.valType, self.valName,
133  self.alignments, config,
134  options )
135 

Member Function Documentation

◆ __createJob()

def validateAlignments.ValidationJob.__createJob (   self,
  jobMode,
  outpath 
)
private
This private method creates the needed files for the validation job.

Definition at line 208 of file validateAlignments.py.

208  def __createJob( self, jobMode, outpath ):
209  """This private method creates the needed files for the validation job.
210  """
211  self.validation.createConfiguration( outpath )
212  if self.preexisting:
213  return
214  self.scripts = sum([addIndex(script, self.validation.NJobs) for script in self.validation.createScript( outpath )], [])
215  return None
216 

References validateAlignments.ValidationBase.preexisting, and validateAlignments.ValidationJob.validation.

Referenced by validateAlignments.ValidationJob.createJob().

◆ __getValidation()

def validateAlignments.ValidationJob.__getValidation (   self,
  valType,
  name,
  alignments,
  config,
  options 
)
private

Definition at line 136 of file validateAlignments.py.

136  def __getValidation( self, valType, name, alignments, config, options ):
137  if valType == "compare":
138  alignmentsList = alignments.split( "," )
139  firstAlignList = alignmentsList[0].split()
140  firstAlignName = firstAlignList[0].strip()
141  if firstAlignName == "IDEAL":
142  raise AllInOneError("'IDEAL' has to be the second (reference)"
143  " alignment in 'compare <val_name>: "
144  "<alignment> <reference>'.")
145  if len( firstAlignList ) > 1:
146  firstRun = firstAlignList[1]
147  elif config.has_section("IOV"):
148  firstRun = config.get("IOV", "iov")
149  else:
150  raise AllInOneError("Have to provide a run number for geometry comparison")
151  firstAlign = Alignment( firstAlignName, config, firstRun )
152  firstAlignName = firstAlign.name
153  secondAlignList = alignmentsList[1].split()
154  secondAlignName = secondAlignList[0].strip()
155  if secondAlignName == "IDEAL":
156  secondAlign = secondAlignName
157  else:
158  if len( secondAlignList ) > 1:
159  secondRun = secondAlignList[1]
160  elif config.has_section("IOV"):
161  secondRun = config.get("IOV", "iov")
162  else:
163  raise AllInOneError("Have to provide a run number for geometry comparison")
164  secondAlign = Alignment( secondAlignName, config,
165  secondRun )
166  secondAlignName = secondAlign.name
167 
168  validation = GeometryComparison( name, firstAlign, secondAlign,
169  config,
170  self.commandLineOptions.getImages)
171  elif valType == "offline":
172  validation = OfflineValidation( name,
173  Alignment( alignments.strip(), config ), config )
174  elif valType == "preexistingoffline":
175  validation = PreexistingOfflineValidation(name, config)
176  elif valType == "offlineDQM":
177  validation = OfflineValidationDQM( name,
178  Alignment( alignments.strip(), config ), config )
179  elif valType == "mcValidate":
180  validation = MonteCarloValidation( name,
181  Alignment( alignments.strip(), config ), config )
182  elif valType == "preexistingmcValidate":
183  validation = PreexistingMonteCarloValidation(name, config)
184  elif valType == "split":
185  validation = TrackSplittingValidation( name,
186  Alignment( alignments.strip(), config ), config )
187  elif valType == "preexistingsplit":
188  validation = PreexistingTrackSplittingValidation(name, config)
189  elif valType == "zmumu":
190  validation = ZMuMuValidation( name,
191  Alignment( alignments.strip(), config ), config )
192  elif valType == "primaryvertex":
193  validation = PrimaryVertexValidation( name,
194  Alignment( alignments.strip(), config ), config )
195  elif valType == "pvresolution":
196  validation = PrimaryVertexResolution( name,
197  Alignment( alignments.strip(), config ), config )
198  elif valType == "preexistingprimaryvertex":
199  validation = PreexistingPrimaryVertexValidation(name, self.__config)
200  elif valType == "overlap":
201  validation = OverlapValidation( name,
202  Alignment( alignments.strip(), self.__config ), self.__config )
203  else:
204  raise AllInOneError("Unknown validation mode '%s'"%valType)
205 
206  return validation
207 

References validateAlignments.ValidationBase.commandLineOptions, submitPVValidationJobs.split(), and digitizers_cfi.strip.

◆ __iter__()

def validateAlignments.ValidationJob.__iter__ (   self)

Definition at line 284 of file validateAlignments.py.

284  def __iter__(self):
285  yield self
286 

◆ __next__()

def validateAlignments.ValidationJob.__next__ (   self)

Definition at line 287 of file validateAlignments.py.

287  def __next__(self):
288  if self.start >= len(self.end):
289  raise StopIteration
290  else:
291  self.start += 1
292  return self.end[self.start-1]
293 
294 

References validateAlignments.ValidationJob.end, svgfig.LineAxis.end, validateAlignments.ValidationJob.start, and svgfig.LineAxis.start.

◆ createJob()

def validateAlignments.ValidationJob.createJob (   self)
This is the method called to create the job files.

Reimplemented from validateAlignments.ValidationBase.

Definition at line 217 of file validateAlignments.py.

217  def createJob(self):
218  """This is the method called to create the job files."""
219  self.__createJob( self.validation.jobmode,
220  os.path.abspath( self.commandLineOptions.Name) )
221 

References validateAlignments.ValidationJob.__createJob(), validateAlignments.ValidationBase.commandLineOptions, and validateAlignments.ValidationJob.validation.

◆ getValidation()

def validateAlignments.ValidationJob.getValidation (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 278 of file validateAlignments.py.

278  def getValidation( self ):
279  return self.validation
280 

References validateAlignments.ValidationJob.validation.

◆ needsproxy()

def validateAlignments.ValidationJob.needsproxy (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 281 of file validateAlignments.py.

281  def needsproxy(self):
282  return self.validation.needsproxy and not self.preexisting and not self.commandLineOptions.dryRun
283 

References validateAlignments.ValidationBase.commandLineOptions, validateAlignments.ValidationBase.preexisting, and validateAlignments.ValidationJob.validation.

◆ runJob()

def validateAlignments.ValidationJob.runJob (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 222 of file validateAlignments.py.

222  def runJob( self ):
223 
224  general = self.config.getGeneral()
225  log = ""
226 
227  if self.preexisting:
228  if self.validation.config.has_section("IOV"):
229  iov = self.validation.config.get("IOV", "iov")
230  else:
231  iov = "singleIOV"
232  preexistingValType = self.valType
233  originalValType = preexistingValType.replace('preexisting', '')
234  key = (originalValType, self.validation.originalValName, iov)
235  if key in ValidationJob.condorConf:
236  ValidationJob.condorConf[key].append(("preexisting", "", general["logdir"]))
237  else:
238  ValidationJob.condorConf[key] = [("preexisting", "", general["logdir"])]
239  log = "> " + self.validation.name + " is already validated."
240  return log
241 
242  for script in self.scripts:
243  name = os.path.splitext( os.path.basename( script) )[0]
244  ValidationJob.jobCount += 1
245  if self.commandLineOptions.dryRun:
246  print("%s would run: %s"%( name, os.path.basename( script) ))
247  continue
248  log = "> Validating "+name
249  print("> Validating "+name)
250  if self.validation.jobmode == "interactive":
251  log += getCommandOutput2( script )
252  ValidationJob.interactCount += 1
253  elif self.validation.jobmode.split( "," )[0] == "condor":
254  if self.validation.config.has_section("IOV"):
255  iov = self.validation.config.get("IOV", "iov")
256  else:
257  iov = "singleIOV"
258  scriptPaths = script.split("/")
259  scriptName = scriptPaths[-1]
260  scriptName = scriptName.split(".")
261  jobName = "%s"%scriptName[0] + "_%s"%scriptName[1]+"_%s"%scriptName[2]
262  key = (self.valType, self.valName, iov)
263  if key in ValidationJob.condorConf:
264  ValidationJob.condorConf[key].append((jobName, script, general["logdir"]))
265  else:
266  ValidationJob.condorConf[key] = [(jobName, script, general["logdir"])]
267  else:
268  raise AllInOneError("Unknown 'jobmode'!\n"
269  "Please change this parameter either in "
270  "the [general] or in the ["
271  + self.valType + ":" + self.valName
272  + "] section to one of the following "
273  "values:\n"
274  "\tinteractive\n\tcondor, -q <queue>\n")
275 
276  return log
277 

References mps_setup.append, validateAlignments.ValidationBase.commandLineOptions, geometry.Alignables.config, preexistingValidation.PreexistingValidation.config, plottingOptions.BasePlottingOptions.config, genericValidation.GenericValidation.config, validateAlignments.ValidationBase.config, helperFunctions.getCommandOutput2(), validateAlignments.ValidationBase.preexisting, print(), validateAlignments.ValidationJob.scripts, validateAlignments.ValidationJob.validation, validateAlignments.ValidationBase.valName, monteCarloValidation.MonteCarloValidation.valType, trackSplittingValidation.TrackSplittingValidation.valType, overlapValidation.OverlapValidation.valType, primaryVertexResolution.PrimaryVertexResolution.valType, primaryVertexValidation.PrimaryVertexValidation.valType, offlineValidation.OfflineValidation.valType, zMuMuValidation.ZMuMuValidation.valType, geometryComparison.GeometryComparison.valType, and validateAlignments.ValidationBase.valType.

Member Data Documentation

◆ condorConf

dictionary validateAlignments.ValidationJob.condorConf = {}
static

Definition at line 124 of file validateAlignments.py.

◆ end

validateAlignments.ValidationJob.end

◆ interactCount

int validateAlignments.ValidationJob.interactCount = 0
static

Definition at line 122 of file validateAlignments.py.

◆ jobCount

int validateAlignments.ValidationJob.jobCount = 0
static

Definition at line 123 of file validateAlignments.py.

◆ JobId

validateAlignments.ValidationJob.JobId

Definition at line 130 of file validateAlignments.py.

◆ scripts

validateAlignments.ValidationJob.scripts

Definition at line 214 of file validateAlignments.py.

Referenced by validateAlignments.ValidationJob.runJob().

◆ start

validateAlignments.ValidationJob.start

◆ validation

validateAlignments.ValidationJob.validation
OverlapValidation
Definition: OverlapValidation.cc:88
PrimaryVertexValidation
Definition: PrimaryVertexValidation.h:73
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
Alignment
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
helperFunctions.getCommandOutput2
def getCommandOutput2(command)
Definition: helperFunctions.py:52
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
mps_setup.append
append
Definition: mps_setup.py:85
helperFunctions.addIndex
def addIndex(filename, njobs, index=None)
Definition: helperFunctions.py:94
PrimaryVertexResolution
Definition: PrimaryVertexResolution.cc:48