Example #1
0
    def inputSeq(self, outputLevel=INFO):
        if not allConfigurables.get("AlignInputSeq"):
            if outputLevel == VERBOSE:
                print "VERBOSE: Filter Sequencer not defined! Defining!"

            inputSequencer = GaudiSequencer("AlignInputSeq")
            inputSequencer.MeasureTime = True
            trackselections = self.getProp("TrackSelections")
            if len(trackselections) > 0:
                trackInputSeq = GaudiSequencer("AlignTrackSelSeq",
                                               IgnoreFilterPassed=True)
                inputSequencer.Members.append(trackInputSeq)
                # add the algorithms for the track selections to the sequence.
                # also merge the tracks lists into one list
                from Configurables import TrackListMerger
                trackmerger = TrackListMerger(
                    "AlignTracks", outputLocation="Rec/Track/AlignTracks")
                self.setProp("TrackLocation", trackmerger.outputLocation)
                for i in trackselections:
                    alg = i.algorithm()
                    if alg: trackInputSeq.Members.append(alg)
                    trackmerger.inputLocations.append(i.location())
                trackInputSeq.Members.append(trackmerger)

            # add all particle selections
            if len(self.getProp("ParticleSelections")) > 0:
                particleInputSeq = GaudiSequencer("AlignParticleSelSeq",
                                                  IgnoreFilterPassed=True)
                inputSequencer.Members.append(particleInputSeq)
                from Configurables import FilterDesktop
                particlemerger = FilterDesktop("AlignParticles", Code="ALL")
                particlemerger.Code = "ALL"
                particlemerger.CloneFilteredParticles = False
                for i in self.getProp("ParticleSelections"):
                    alg = i.algorithm()
                    if alg:
                        particleInputSeq.Members.append(alg)
                        print "adding particleinputsel to sequence: ", i.name(
                        ), i.algorithm(), i.location()
                    particlemerger.Inputs.append(i.location())
                particleInputSeq.Members.append(particlemerger)
                self.setProp("ParticleLocation",
                             '/Event/Phys/AlignParticles/Particles')

            # add the PV selection
            if hasattr(self, "PVSelection"):
                inputSequencer.Members.append(
                    self.getProp("PVSelection").algorithm())
                self.setProp("VertexLocation",
                             self.getProp("PVSelection").location())

            return inputSequencer
        else:
            if outputLevel == VERBOSE:
                print "VERBOSE: AlignInputSeq already defined!"
            return allConfigurables.get("AlignInputSeq")
Example #2
0
    def __apply_configuration__(self):
        print "******* calling ", self.name()
        mainseq = self.getProp("Sequencer")
        mainseq.getProperties()
        if mainseq.name() == "":
            mainseq = GaudiSequencer("AlignSeq")
        mainseq.MeasureTime = True

        print "****** setting up Kalman type alignment!"
        self.setProp("Incident", 'UpdateConstants')
        self.sequencers()
def MinimalRichSequence():
    # Tweak a little bit RICH
    from Configurables import Escher, GaudiSequencer, RichRecSysConf, RecSysConf
    richSeqName = Escher()._instanceName(RichRecSysConf)
    richSeq = GaudiSequencer(richSeqName + "Seq")
    richSeq.MeasureTime = True
    richConf = RichRecSysConf("RichOfflineRec")
    richConf.DataType = Escher().getProp("DataType")
    #    richConf.Context    = "HLT"
    #enable 'fast' PID settings
    richConf.PidConfig = "FastGlobal"
    # only consider the Pion and Kaon hypos (instead of the full list. This means you will
    # only have DLL(K-pi) available, but if that is all you need its OK).
    richConf.Particles = ["pion", "kaon"]
    #turn off trackless ring finding
    richConf.TracklessRingAlgs = []
    #richConf.trackConfig().InputTracksLocation = '/Rec/Track/PidTracks'
    # Set the sequence to run the RICH PID in
    richConf.setProp("RecoSequencer", richSeq)
    return
from PhysSelPython.Wrappers import Selection, SelectionSequence, AutomaticData
from Configurables import FilterDesktop

myInputParticlesList = []
myParticlesFilterList = []
myParticlesList = []
myParticlesSeqList = []
myParticlesLocationList = []

from Configurables import GaudiSequencer

filterSeq = GaudiSequencer( 'FilterSeq' )
filterSeq.ModeOR = True

mainSeq = GaudiSequencer( 'MainSeq' )
mainSeq.MeasureTime = True
mainSeq.IgnoreFilterPassed = False

codeIN = ""

for particles, cuts in particlesAndCuts.iteritems():
    codeIN = codeIN.replace("||","|")
    codeIN += "(CONTAINS( '"+str(particles)+"' )>0) || "
    
    myParticlesName = particles.split("/")[-2]

    myInputParticlesList += [ AutomaticData( Location = particles ) ]
    
    myParticlesFilterList += [ FilterDesktop( myParticlesName+"Filter",
                                              Code = cuts ) ]
    myParticlesList += [ Selection( myParticlesName,
Example #5
0
 def newSeq(self, sequence, name):
     from Configurables import GaudiSequencer
     seq = GaudiSequencer(name)
     seq.MeasureTime = True
     sequence.Members += [seq]
     return seq
Example #6
0
    def alignmentSeq(self, outputLevel=INFO):
        if not allConfigurables.get("AlignmentSeq"):
            if outputLevel == VERBOSE:
                print "VERBOSE: Alignment Sequencer not defined! Defining!"

            alignSequencer = GaudiSequencer("AlignmentAlgSeq")
            alignSequencer.MeasureTime = True

            from Configurables import (AlignAlgorithm, GetElementsToBeAligned,
                                       gslSVDsolver, CLHEPSolver, SparseSolver,
                                       DiagSolvTool, Al__AlignConstraintTool,
                                       Al__AlignUpdateTool,
                                       Al__TrackResidualTool,
                                       WriteMultiAlignmentConditionsTool)

            alignAlg = AlignAlgorithm("Alignment")
            alignAlg.OutputLevel = outputLevel
            alignAlg.NumberOfIterations = self.getProp("NumIterations")
            alignAlg.TracksLocation = self.getProp("TrackLocation")
            alignAlg.VertexLocation = self.getProp("VertexLocation")
            alignAlg.ParticleLocation = self.getProp("ParticleLocation")
            alignAlg.DimuonLocation = self.getProp("DimuonLocation")
            alignAlg.UseCorrelations = self.getProp("UseCorrelations")
            alignAlg.Chi2Outlier = self.getProp("Chi2Outlier")
            alignAlg.HistoPrint = False
            alignAlg.UpdateInFinalize = self.getProp("UpdateInFinalize")
            alignAlg.OutputDataFile = self.getProp("OutputDataFile")
            alignAlg.OnlineMode = self.getProp("OnlineMode")
            alignAlg.RunList = self.getProp("RunList")
            #            self.addXmlWriters(alignAlg)

            #print "Error",alignAlg
            # and also the update tool is in the toolsvc
            updatetool = Al__AlignUpdateTool("Al::AlignUpdateTool")
            updatetool.MinNumberOfHits = self.getProp("MinNumberOfHits")
            updatetool.UsePreconditioning = self.getProp("UsePreconditioning")
            updatetool.LogFile = self.getProp("LogFile")
            updatetool.addTool(gslSVDsolver)
            updatetool.MatrixSolverTool = self.getProp("SolvTool")
            # for now we do it like this
            SurveyConstraints().configureTool(updatetool.SurveyConstraintTool)

            updatetool.LagrangeConstraintTool.Constraints = self.getProp(
                "Constraints")
            updatetool.LagrangeConstraintTool.UseWeightedAverage = self.getProp(
                "UseWeightedAverageConstraint")

            # configure in the tool service
            elementtool = GetElementsToBeAligned("GetElementsToBeAligned")
            elementtool.OutputLevel = outputLevel
            #print "(1)I will try to aling ", self.getProp( "ElementsToAlign" ), " elements!"
            elementtool.Elements = self.getProp("ElementsToAlign")
            elementtool.UseLocalFrame = self.getProp("UseLocalFrame")
            elementtool.Upgrade = self.getProp("Upgrade")
            #alignAlg.addTool( elementtool )

            # Setup XML writer, also a public tool
            xmlwriter = WriteMultiAlignmentConditionsTool(
                "WriteMultiAlignmentConditionsTool")
            if self.getProp("OnlineMode"):
                self.addOnlineXmlWriters(xmlwriter)
                updatetool.LogFile = self.getProp(
                    'OnlineAligWorkDir') + '/' + self.getProp('LogFile')
            elif self.getProp("DataCondType") == "Run2":
                self.addXmlWriters(xmlwriter)
            else:
                self.addXmlRun1Writers(xmlwriter)
            print '=================== OnlineMode = ', self.getProp(
                "OnlineMode")

            # and these too
            gslSVDsolver().EigenValueThreshold = self.getProp(
                "EigenValueThreshold")
            DiagSolvTool().EigenValueThreshold = self.getProp(
                "EigenValueThreshold")

            alignSequencer.Members.append(alignAlg)

            return alignSequencer
        else:
            if outputLevel == VERBOSE:
                print "VERBOSE: Alignment Sequencer already defined!"
            return allConfigurables.get("AlignmentSeq")