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)
44 "nEvents": self.
general[
"maxevents"],
45 "TrackCollection": self.
general[
"trackcollection"],
46 "subdetector": self.
general[
"subdetector"],
56 if no argument or "" is passed a string with an instantiation is
57 returned, else the validation is appended to the list
61 if validationsSoFar !=
"":
62 validationsSoFar +=
',"\n "'
63 validationsSoFar += comparestring
64 return validationsSoFar
68 if no argument or "" is passed a string with an instantiation is returned,
69 else the validation is appended to the list
73 parameters =
" ".
join(os.path.join(
"root://eoscms//eos/cms", file.lstrip(
"/"))
for file
in repMap[
"resultFiles"])
75 mergedoutputfile = os.path.join(
"root://eoscms//eos/cms", repMap[
"finalResultFile"].lstrip(
"/"))
76 validationsSoFar +=
"hadd -f %s %s\n" % (mergedoutputfile, parameters)
77 return validationsSoFar
80 filename = os.path.join(self.
cmssw,
"src/Alignment/CommonAlignmentProducer/python/AlignmentTrackSelector_cfi.py")
81 if not os.path.isfile(filename):
82 filename = os.path.join(self.
cmsswreleasebase,
"src/Alignment/CommonAlignmentProducer/python/AlignmentTrackSelector_cfi.py")
83 with open(filename)
as f:
84 trackselector = f.read()
86 minhitspersubdet = trackselector.split(
"minHitsPerSubDet")[1].
split(
"(",1)[1]
90 for character
in minhitspersubdet:
95 if parenthesesdepth < 0:
98 minhitspersubdet = minhitspersubdet[0:i]
100 results = minhitspersubdet.split(
",")
102 for i
in range(len(results)):
103 results[i] = results[i].
split(
"=")[0].strip().
replace(
"in",
"", 1)
105 return [a
for a
in results
if a]
static std::string join(char **cmd)
def appendToExtendedValidation