Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:45:59

0001 from __future__ import absolute_import
0002 
0003 import os
0004 
0005 from . import configTemplates
0006 from .genericValidation import GenericValidationData_CTSR, ParallelValidation, ValidationWithPlots
0007 from .helperFunctions import replaceByMap
0008 from .presentation import SubsectionFromList, SubsectionOnePage
0009 from .TkAlExceptions import AllInOneError
0010 
0011 
0012 class OverlapValidation(GenericValidationData_CTSR, ParallelValidation, ValidationWithPlots):
0013     configBaseName = "TkAlOverlapValidation"
0014     scriptBaseName = "TkAlOverlapValidation"
0015     crabCfgBaseName = "TkAlOverlapValidation"
0016     resultBaseName = "OverlapValidation"
0017     outputBaseName = "OverlapValidation"
0018     mandatories = {"trackcollection"}
0019     valType = "overlap"
0020 
0021     @property
0022     def ValidationTemplate(self):
0023         return configTemplates.overlapTemplate
0024 
0025     @property
0026     def ValidationSequence(self):
0027         return configTemplates.overlapValidationSequence
0028 
0029     @property
0030     def ProcessName(self):
0031         return "overlap"
0032 
0033     def getRepMap( self, alignment = None ):
0034         repMap = super(OverlapValidation, self).getRepMap(alignment)
0035         repMap.update({ 
0036             "nEvents": self.general["maxevents"],
0037             "TrackCollection": self.general["trackcollection"],
0038         })
0039         return repMap
0040 
0041     def appendToPlots(self):
0042         """
0043         if no argument or "" is passed a string with an instantiation is
0044         returned, else the validation is appended to the list
0045         """
0046         return '("{file}", "{title}", {color}, {style}),'.format(file=self.getCompareStrings(plain=True)["DEFAULT"], **self.getRepMap())
0047 
0048     def appendToMerge(self):
0049         repMap = self.getRepMap()
0050 
0051         parameters = " ".join(os.path.join("root://eoscms//eos/cms", file.lstrip("/")) for file in repMap["resultFiles"])
0052 
0053         mergedoutputfile = os.path.join("root://eoscms//eos/cms", repMap["finalResultFile"].lstrip("/"))
0054         return "hadd -f %s %s" % (mergedoutputfile, parameters)
0055 
0056     @classmethod
0057     def plottingscriptname(cls):
0058         return "TkAlOverlapValidation.py"
0059 
0060     @classmethod
0061     def plottingscripttemplate(cls):
0062         return configTemplates.overlapPlottingTemplate
0063 
0064     @classmethod
0065     def plotsdirname(cls):
0066         return "OverlapValidationPlots"
0067 
0068     @classmethod
0069     def runPlots(cls, validations):
0070         return ("rfcp .oO[plottingscriptpath]Oo. .\n"
0071                 "python .oO[plottingscriptname]Oo.")
0072