Esempio n. 1
0
 def createConfiguration(self, path, configBaseName = "TkAlZMuMuValidation" ):
     cfgName = "%s.%s.%s_cfg.py"%( configBaseName, self.name,
                                   self.alignmentToValidate.name )
     repMap = self.getRepMap()
     cfgs = {cfgName:replaceByMap(configTemplates.ZMuMuValidationTemplate,
                                  repMap)}
     GenericValidationData.createConfiguration(self, cfgs, path)
Esempio n. 2
0
 def createConfiguration(self, path):
     cfgName = "%s.%s.%s_cfg.py"%( self.configBaseName, self.name,
                                   self.alignmentToValidate.name )
     repMap = self.getRepMap()
     cfgs = {cfgName: configTemplates.PrimaryVertexValidationTemplate}
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         repMap["finalResultFile"]
     GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
Esempio n. 3
0
 def createConfiguration(self, path):
     cfgName = "%s.%s.%s_cfg.py"%( self.configBaseName, self.name,
                                   self.alignmentToValidate.name )
     repMap = self.getRepMap()
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", repMap)
     cfgs = {cfgName: configTemplates.ZMuMuValidationTemplate}
     GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
 def createConfiguration(self, path ):
     cfgName = "TkAlMcValidate.%s.%s_cfg.py"%(self.name,
                                              self.alignmentToValidate.name)
     repMap = self.getRepMap()
     cfgs = {cfgName:replaceByMap(configTemplates.mcValidateTemplate,
                                  repMap)}
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         repMap["resultFile"]
     GenericValidationData.createConfiguration(self, cfgs, path)
Esempio n. 5
0
 def createConfiguration(self, path,
                         configBaseName = "TkAlOfflineValidation" ):
     cfgName = "%s.%s.%s_cfg.py"%( configBaseName, self.name,
                                   self.alignmentToValidate.name )
     repMap = self.getRepMap()
       
     cfgs = {cfgName:replaceByMap( configTemplates.offlineTemplate, repMap)}
     self.filesToCompare[
         GenericValidationData.defaultReferenceName ] = repMap["resultFile"]
     GenericValidationData.createConfiguration(self, cfgs, path)
Esempio n. 6
0
 def createConfiguration(self, path):
     cfgName = "TkAlMcValidate.%s.%s_cfg.py" % (
         self.name, self.alignmentToValidate.name)
     repMap = self.getRepMap()
     cfgs = {
         cfgName: replaceByMap(configTemplates.mcValidateTemplate, repMap)
     }
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         repMap["outputFile"]
     GenericValidationData.createConfiguration(self, cfgs, path)
 def createConfiguration(self, path):
     cfgName = "%s.%s.%s_cfg.py" % (self.configBaseName, self.name,
                                    self.alignmentToValidate.name)
     repMap = self.getRepMap()
     cfgs = {cfgName: configTemplates.PrimaryVertexValidationTemplate}
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         repMap["finalResultFile"]
     GenericValidationData.createConfiguration(self,
                                               cfgs,
                                               path,
                                               repMap=repMap)
Esempio n. 8
0
 def createConfiguration(self, path):
     cfgName = "%s.%s.%s_cfg.py" % (self.configBaseName, self.name,
                                    self.alignmentToValidate.name)
     repMap = self.getRepMap()
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", repMap)
     cfgs = {cfgName: configTemplates.ZMuMuValidationTemplate}
     GenericValidationData.createConfiguration(self,
                                               cfgs,
                                               path,
                                               repMap=repMap)
Esempio n. 9
0
    def createConfiguration(self,
                            path,
                            configBaseName="TkAlOfflineValidation"):
        # if offline validation uses N parallel jobs, we create here N cfg files
        numberParallelJobs = int(self.general["parallelJobs"])
        # limit maximum number of parallel jobs to 40
        # (each output file is approximately 20MB)
        maximumNumberJobs = 40
        if numberParallelJobs > maximumNumberJobs:
            msg = ("Maximum allowed number of parallel jobs " +
                   str(maximumNumberJobs) + " exceeded!!!")
            raise AllInOneError(msg)
        # if maxevents is not specified, cannot calculate number of events for
        # each parallel job, and therefore running only a single job
        if int(self.general["maxevents"]) == -1:
            msg = ("Maximum number of events (maxevents) not specified: "
                   "cannot use parallel jobs in offline validation")
            raise AllInOneError(msg)
        if numberParallelJobs > 1:
            if self.general["offlineModuleLevelHistsTransient"] == "True":
                msg = (
                    "To be able to merge results when running parallel jobs,"
                    " set offlineModuleLevelHistsTransient to false.")
                raise AllInOneError(msg)
        for index in range(numberParallelJobs):
            cfgName = "%s.%s.%s_%s_cfg.py" % (configBaseName, self.name,
                                              self.alignmentToValidate.name,
                                              str(index))
            repMap = self.getRepMap()
            # in this parallel job, skip index*(maxEvents/nJobs) events from
            # the beginning
            # (first index is zero, so no skipping for a single job)
            # and use _index_ in the name of the output file
            repMap.update({"nIndex": str(index)})
            # Create the result file directly to datadir since should not use /tmp/
            # see https://cern.service-now.com/service-portal/article.do?n=KB0000484
            repMap.update({
                "outputFile":
                replaceByMap(
                    ".oO[datadir]Oo./AlignmentValidation_" + self.name +
                    "_.oO[name]Oo._.oO[nIndex]Oo..root", repMap)
            })
            repMap["outputFile"] = os.path.expandvars(repMap["outputFile"])
            repMap["outputFile"] = os.path.abspath(repMap["outputFile"])

            cfgs = {
                cfgName:
                replaceByMap(configTemplates.offlineParallelTemplate, repMap)
            }
            self.filesToCompare[GenericValidationData.
                                defaultReferenceName] = repMap["resultFile"]
            GenericValidationData.createConfiguration(self, cfgs, path)
Esempio n. 10
0
    def createConfiguration(self, path, configBaseName = "TkAlOfflineValidation"):
        # if offline validation uses N parallel jobs, we create here N cfg files
        numberParallelJobs = int( self.general["parallelJobs"] )
        # limit maximum number of parallel jobs to 40
        # (each output file is approximately 20MB)
        maximumNumberJobs = 40
        if numberParallelJobs > maximumNumberJobs:
            msg = ("Maximum allowed number of parallel jobs "
                   +str(maximumNumberJobs)+" exceeded!!!")
            raise AllInOneError(msg)
        # if maxevents is not specified, cannot calculate number of events for
        # each parallel job, and therefore running only a single job
        if int( self.general["maxevents"] ) == -1:
            msg = ("Maximum number of events (maxevents) not specified: "
                   "cannot use parallel jobs in offline validation")
            raise AllInOneError(msg)
        if numberParallelJobs > 1:    
            if self.general["offlineModuleLevelHistsTransient"] == "True":
                msg = ("To be able to merge results when running parallel jobs,"
                       " set offlineModuleLevelHistsTransient to false.")
                raise AllInOneError(msg)
        for index in range(numberParallelJobs):
            cfgName = "%s.%s.%s_%s_cfg.py"%(configBaseName, self.name,
                                            self.alignmentToValidate.name,
                                            str(index))
            repMap = self.getRepMap()
            # in this parallel job, skip index*(maxEvents/nJobs) events from
            # the beginning
            # (first index is zero, so no skipping for a single job)
            # and use _index_ in the name of the output file
            repMap.update({"nIndex": str(index)})
            # Create the result file directly to datadir since should not use /tmp/
            # see https://cern.service-now.com/service-portal/article.do?n=KB0000484
            repMap.update({
                "outputFile": replaceByMap(".oO[datadir]Oo./AlignmentValidation_"
                                           + self.name +
                                           "_.oO[name]Oo._.oO[nIndex]Oo..root",
                                           repMap )
                })
            repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
            repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )

            cfgs = {cfgName:replaceByMap(configTemplates.offlineParallelTemplate,
                                         repMap)}
            self.filesToCompare[GenericValidationData.defaultReferenceName] = repMap["resultFile"] 
            GenericValidationData.createConfiguration(self, cfgs, path)
Esempio n. 11
0
    def createConfiguration(self, path):
        cfgName = "%s.%s.%s_cfg.py" % (self.configBaseName, self.name,
                                       self.alignmentToValidate.name)
        repMap = self.getRepMap()
        if self.NJobs > 1 and self.general[
                "offlineModuleLevelHistsTransient"] == "True":
            msg = ("To be able to merge results when running parallel jobs,"
                   " set offlineModuleLevelHistsTransient to false.")
            raise AllInOneError(msg)

        templateToUse = configTemplates.offlineTemplate
        if self.AutoAlternates:
            if "Cosmics" in self.general["trackcollection"]:
                Bfield = self.dataset.magneticFieldForRun()
                if Bfield > 3.3 and Bfield < 4.3:  #Should never be 4.3, but this covers strings, which always compare bigger than ints
                    templateToUse = configTemplates.CosmicsOfflineValidation
                    print(
                        "B field for %s = %sT.  Using the template for cosmics at 3.8T.\n"
                        "To override this behavior, specify AutoAlternates = false in the [alternateTemplates] section"
                    ) % (self.dataset.name(), Bfield)
                elif Bfield < 0.5:
                    templateToUse = configTemplates.CosmicsAt0TOfflineValidation
                    print(
                        "B field for %s = %sT.  Using the template for cosmics at 0T.\n"
                        "To override this behavior, specify AutoAlternates = false in the [alternateTemplates] section"
                    ) % (self.dataset.name(), Bfield)
                else:
                    try:
                        if "unknown " in Bfield:
                            msg = Bfield.replace("unknown ", "", 1)
                        elif "Bfield" is "unknown":
                            msg = "Can't get the B field for %s." % self.dataset.name(
                            )
                    except TypeError:
                        msg = "B field for %s = %sT.  This is not that close to 0T or 3.8T." % (
                            self.dataset.name(), Bfield)
                    raise AllInOneError(
                        msg + "\n"
                        "To use this data, turn off the automatic alternates using AutoAlternates = false\n"
                        "in the [alternateTemplates] section, and choose the alternate template yourself."
                    )

        cfgs = {cfgName: templateToUse}
        self.filesToCompare[GenericValidationData.
                            defaultReferenceName] = repMap["finalResultFile"]
        return GenericValidationData.createConfiguration(self,
                                                         cfgs,
                                                         path,
                                                         repMap=repMap)
Esempio n. 12
0
    def createConfiguration(self, path):
        cfgName = "%s.%s.%s_cfg.py"%( self.configBaseName, self.name,
                                      self.alignmentToValidate.name )
        repMap = self.getRepMap()
        if self.NJobs > 1 and self.general["offlineModuleLevelHistsTransient"] == "True":
            msg = ("To be able to merge results when running parallel jobs,"
                   " set offlineModuleLevelHistsTransient to false.")
            raise AllInOneError(msg)

        templateToUse = configTemplates.offlineTemplate
        if self.AutoAlternates:
            if "Cosmics" in self.general["trackcollection"]:
                Bfield = self.dataset.magneticFieldForRun()
                if Bfield > 3.3 and Bfield < 4.3:                 #Should never be 4.3, but this covers strings, which always compare bigger than ints
                    templateToUse = configTemplates.CosmicsOfflineValidation
                    print ("B field for %s = %sT.  Using the template for cosmics at 3.8T.\n"
                           "To override this behavior, specify AutoAlternates = false in the [alternateTemplates] section") % (self.dataset.name(), Bfield)
                elif Bfield < 0.5:
                    templateToUse = configTemplates.CosmicsAt0TOfflineValidation
                    print ("B field for %s = %sT.  Using the template for cosmics at 0T.\n"
                           "To override this behavior, specify AutoAlternates = false in the [alternateTemplates] section") % (self.dataset.name(), Bfield)
                else:
                    try:
                        if "unknown " in Bfield:
                            msg = Bfield.replace("unknown ","",1)
                        elif "Bfield" is "unknown":
                            msg = "Can't get the B field for %s." % self.dataset.name()
                    except TypeError:
                        msg = "B field for %s = %sT.  This is not that close to 0T or 3.8T." % (self.dataset.name(), Bfield)
                    raise AllInOneError(msg + "\n"
                                        "To use this data, turn off the automatic alternates using AutoAlternates = false\n"
                                        "in the [alternateTemplates] section, and choose the alternate template yourself.")

        cfgs = {cfgName: templateToUse}
        self.filesToCompare[
            GenericValidationData.defaultReferenceName ] = repMap["finalResultFile"]
        return GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)