def __getValidation(self, valType, name, alignments, config, options):
        if valType == "compare":
            alignmentsList = alignments.split(",")
            firstAlignList = alignmentsList[0].split()
            firstAlignName = firstAlignList[0].strip()
            if firstAlignName == "IDEAL":
                raise AllInOneError("'IDEAL' has to be the second (reference)"
                                    " alignment in 'compare <val_name>: "
                                    "<alignment> <reference>'.")
            if len(firstAlignList) > 1:
                firstRun = firstAlignList[1]
            else:
                firstRun = "1"
            firstAlign = Alignment(firstAlignName, self.__config, firstRun)
            firstAlignName = firstAlign.name
            secondAlignList = alignmentsList[1].split()
            secondAlignName = secondAlignList[0].strip()
            if len(secondAlignList) > 1:
                secondRun = secondAlignList[1]
            else:
                secondRun = "1"
            if secondAlignName == "IDEAL":
                secondAlign = secondAlignName
            else:
                secondAlign = Alignment(secondAlignName, self.__config,
                                        secondRun)
                secondAlignName = secondAlign.name

            validation = GeometryComparison(
                name, firstAlign, secondAlign, self.__config,
                self.__commandLineOptions.getImages)
        elif valType == "offline":
            validation = OfflineValidation(
                name, Alignment(alignments.strip(), self.__config),
                self.__config)
        elif valType == "preexistingoffline":
            validation = PreexistingOfflineValidation(name, self.__config)
        elif valType == "offlineDQM":
            validation = OfflineValidationDQM(
                name, Alignment(alignments.strip(), self.__config),
                self.__config)
        elif valType == "mcValidate":
            validation = MonteCarloValidation(
                name, Alignment(alignments.strip(), self.__config),
                self.__config)
        elif valType == "preexistingmcValidate":
            validation = PreexistingMonteCarloValidation(name, self.__config)
        elif valType == "split":
            validation = TrackSplittingValidation(
                name, Alignment(alignments.strip(), self.__config),
                self.__config)
        elif valType == "preexistingsplit":
            validation = PreexistingTrackSplittingValidation(
                name, self.__config)
        elif valType == "zmumu":
            validation = ZMuMuValidation(
                name, Alignment(alignments.strip(), self.__config),
                self.__config)
        elif valType == "primaryvertex":
            validation = PrimaryVertexValidation(
                name, Alignment(alignments.strip(), self.__config),
                self.__config)
        else:
            raise AllInOneError("Unknown validation mode '%s'" % valType)

        return validation