Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:40:25

0001 from __future__ import absolute_import
0002 import os
0003 from . import configTemplates
0004 from .genericValidation import GenericValidationData_CTSR, ParallelValidation, ValidationForPresentation, ValidationWithPlotsSummary
0005 from .helperFunctions import replaceByMap
0006 from .presentation import SubsectionFromList, SubsectionOnePage
0007 from .TkAlExceptions import AllInOneError
0008 
0009 
0010 class TrackSplittingValidation(GenericValidationData_CTSR, ParallelValidation, ValidationWithPlotsSummary, ValidationForPresentation):
0011     configBaseName = "TkAlTrackSplitting"
0012     scriptBaseName = "TkAlTrackSplitting"
0013     crabCfgBaseName = "TkAlTrackSplitting"
0014     resultBaseName = "TrackSplitting"
0015     outputBaseName = "TrackSplitting"
0016     defaults = {"multiIOV":"False"}
0017     mandatories = {"trackcollection"}
0018     valType = "split"
0019 
0020     @property
0021     def ValidationTemplate(self):
0022         return configTemplates.TrackSplittingTemplate
0023 
0024     @property
0025     def ValidationSequence(self):
0026         return configTemplates.TrackSplittingSequence
0027 
0028     @property
0029     def ProcessName(self):
0030         return "splitter"
0031 
0032     def createScript(self, path):
0033         return super(TrackSplittingValidation, self).createScript(path)
0034 
0035     def createCrabCfg(self, path):
0036         return super(TrackSplittingValidation, self).createCrabCfg(path, self.crabCfgBaseName)
0037 
0038     def getRepMap( self, alignment = None ):
0039         repMap = super(TrackSplittingValidation, self).getRepMap(alignment)
0040         if repMap["subdetector"] == "none":
0041             subdetselection = ""
0042         else:
0043             subdetselection = "process.AlignmentTrackSelector.minHitsPerSubDet.in.oO[subdetector]Oo. = 2"
0044         repMap.update({ 
0045             "nEvents": self.general["maxevents"],
0046             "TrackCollection": self.general["trackcollection"],
0047             "subdetselection": subdetselection,
0048         })
0049         # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
0050         # if self.jobmode.split( ',' )[0] == "crab":
0051         #     repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
0052         return repMap
0053 
0054     def appendToPlots(self):
0055         """
0056         if no argument or "" is passed a string with an instantiation is
0057         returned, else the validation is appended to the list
0058         """
0059         repMap = self.getRepMap()
0060         comparestring = self.getCompareStrings("TrackSplittingValidation")
0061         return '              "{},"'.format(comparestring)
0062 
0063     def appendToMerge(self):
0064         repMap = self.getRepMap()
0065 
0066         parameters = " ".join(os.path.join("root://eoscms//eos/cms", file.lstrip("/")) for file in repMap["resultFiles"])
0067 
0068         mergedoutputfile = os.path.join("root://eoscms//eos/cms", repMap["finalResultFile"].lstrip("/"))
0069         return "hadd -f %s %s" % (mergedoutputfile, parameters)
0070 
0071     @classmethod
0072     def plottingscriptname(cls):
0073         return "TkAlTrackSplitPlot.C"
0074 
0075     @classmethod
0076     def plottingscripttemplate(cls):
0077         return configTemplates.trackSplitPlotTemplate
0078 
0079     @classmethod
0080     def plotsdirname(cls):
0081         return "TrackSplittingPlots"
0082 
0083     @classmethod
0084     def presentationsubsections(cls):
0085         return [
0086             SubsectionTrackSplitting('hist.*eps$', 'Track splitting'),
0087 #           Uncomment and edit to highlight one or more profiles
0088 #            SubsectionOnePage("profile.phi_org.Delta_phi.*.eps", "modulation"),
0089         ]
0090 
0091 class SubsectionTrackSplitting(SubsectionFromList):
0092     pageidentifiers = (
0093                        ("hist[.]Delta_pt", "$p_T$"),
0094                        ("hist[.]Delta_(eta|phi)", "Angles"),
0095                        ("hist[.]Delta_d(xy|z)", "Vertex"),
0096                       )
0097