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 118 of file validateAlignments.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 125 of file validateAlignments.py.

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

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 207 of file validateAlignments.py.

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

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 135 of file validateAlignments.py.

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

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

◆ __iter__()

def validateAlignments.ValidationJob.__iter__ (   self)

Definition at line 283 of file validateAlignments.py.

283  def __iter__(self):
284  yield self
285 

◆ __next__()

def validateAlignments.ValidationJob.__next__ (   self)

Definition at line 286 of file validateAlignments.py.

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

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 216 of file validateAlignments.py.

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

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

◆ getValidation()

def validateAlignments.ValidationJob.getValidation (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 277 of file validateAlignments.py.

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

References validateAlignments.ValidationJob.validation.

◆ needsproxy()

def validateAlignments.ValidationJob.needsproxy (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 280 of file validateAlignments.py.

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

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

◆ runJob()

def validateAlignments.ValidationJob.runJob (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 221 of file validateAlignments.py.

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

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 123 of file validateAlignments.py.

◆ end

validateAlignments.ValidationJob.end

◆ interactCount

int validateAlignments.ValidationJob.interactCount = 0
static

Definition at line 121 of file validateAlignments.py.

◆ jobCount

int validateAlignments.ValidationJob.jobCount = 0
static

Definition at line 122 of file validateAlignments.py.

◆ JobId

validateAlignments.ValidationJob.JobId

Definition at line 129 of file validateAlignments.py.

◆ scripts

validateAlignments.ValidationJob.scripts

Definition at line 213 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:51
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:93
PrimaryVertexResolution
Definition: PrimaryVertexResolution.cc:47