3 from genericValidation
import GenericValidationData
4 from helperFunctions
import replaceByMap
5 from TkAlExceptions
import AllInOneError
9 def __init__(self, valName, alignment, config,
10 configBaseName =
"TkAlTrackSplitting", scriptBaseName =
"TkAlTrackSplitting", crabCfgBaseName =
"TkAlTrackSplitting",
11 resultBaseName =
"TrackSplitting", outputBaseName =
"TrackSplitting"):
12 mandatories = [
"trackcollection"]
13 defaults = {
"subdetector":
"BPIX"}
20 GenericValidationData.__init__(self, valName, alignment, config,
21 "split", addMandatories = mandatories, addDefaults = defaults)
23 if self.
general[
"subdetector"]
not in validsubdets:
24 raise AllInOneError(
"'%s' is not a valid subdetector!\n" % self.
general[
"subdetector"] +
"The options are: " +
", ".
join(validsubdets))
28 self.alignmentToValidate.name)
30 cfgs = {cfgName: configTemplates.TrackSplittingTemplate}
31 self.
filesToCompare[GenericValidationData.defaultReferenceName] = \
32 repMap[
"finalResultFile"]
33 GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
36 return GenericValidationData.createScript(self, path)
39 return GenericValidationData.createCrabCfg(self, path, self.
crabCfgBaseName)
42 repMap = GenericValidationData.getRepMap(self)
43 if self.
general[
"subdetector"] ==
"none":
46 subdetselection =
"process.AlignmentTrackSelector.minHitsPerSubDet.in.oO[subdetector]Oo. = 2"
48 "nEvents": self.
general[
"maxevents"],
49 "TrackCollection": self.
general[
"trackcollection"],
50 "subdetselection": subdetselection,
51 "subdetector": self.
general[
"subdetector"],
61 if no argument or "" is passed a string with an instantiation is
62 returned, else the validation is appended to the list
66 if validationsSoFar !=
"":
67 validationsSoFar +=
',"\n "'
68 validationsSoFar += comparestring
69 return validationsSoFar
73 if no argument or "" is passed a string with an instantiation is returned,
74 else the validation is appended to the list
78 parameters =
" ".
join(os.path.join(
"root://eoscms//eos/cms", file.lstrip(
"/"))
for file
in repMap[
"resultFiles"])
80 mergedoutputfile = os.path.join(
"root://eoscms//eos/cms", repMap[
"finalResultFile"].lstrip(
"/"))
81 validationsSoFar +=
"hadd -f %s %s\n" % (mergedoutputfile, parameters)
82 return validationsSoFar
85 filename = os.path.join(self.
cmssw,
"src/Alignment/CommonAlignmentProducer/python/AlignmentTrackSelector_cfi.py")
86 if not os.path.isfile(filename):
87 filename = os.path.join(self.
cmsswreleasebase,
"src/Alignment/CommonAlignmentProducer/python/AlignmentTrackSelector_cfi.py")
88 with open(filename)
as f:
89 trackselector = f.read()
91 minhitspersubdet = trackselector.split(
"minHitsPerSubDet")[1].
split(
"(",1)[1]
95 for character
in minhitspersubdet:
100 if parenthesesdepth < 0:
103 minhitspersubdet = minhitspersubdet[0:i]
105 results = minhitspersubdet.split(
",")
107 for i
in range(len(results)):
108 results[i] = results[i].
split(
"=")[0].strip().
replace(
"in",
"", 1)
110 results.append(
"none")
112 return [a
for a
in results
if a]
static std::string join(char **cmd)
def appendToExtendedValidation