Exemplo n.º 1
0
def doMyAlignChanges():
    #veloAlign=AlignSensors("AlignSensors")
    veloAlign = VAlign("VAlign")
    GaudiSequencer("AlignSequence").Members = [
        veloAlign,
        #WriteAlignmentConditions("WriteDetectors"),
        WriteAlignmentConditions("WriteGlobal"),
        WriteAlignmentConditions("WriteModules"),
        TrackVertexMonitor("TrackVertexMonitor")
    ]
    importOptions("$VELOALIGNMENTOPTS/VeloAlign.py")
    veloAlign.OutputLevel = 3
    PatPVOffline("PatPVOffline").OutputLevel = 3
    VAlign("VAlign").Box_DOF = [1, 1, 1, 1, 1, 1]
    VAlign("VAlign").Box_EQs = [0, 0, 0, 0, 0, 0]
    TrackVertexMonitor(
        "TrackVertexMonitor").TrackContainer = "LHCb::TrackLocation::Velo"
    ###VAlign("VAlign").TrackContainer= "Rec/Track/Best"

    eventfitter = TrackEventFitter('FitVelo')
    eventfitter.Fitter.ZPositions = []
    eventfitter.Fitter.ApplyMaterialCorrections = False
    eventfitter.Fitter.Extrapolator.ApplyMultScattCorr = False
    eventfitter.Fitter.Extrapolator.ApplyEnergyLossCorr = False
    eventfitter.Fitter.Extrapolator.ApplyElectronEnergyLossCorr = False
    eventfitter.Fitter.StateAtBeamLine = False
    eventfitter.Fitter.MaxNumberOutliers = 0
    eventfitter.Fitter.NumberFitIterations = 10
    eventfitter.Fitter.UpdateTransport = True
Exemplo n.º 2
0
    def patSeq(self, outputLevel=INFO):
        if not allConfigurables.get("PatSeq"):
            if outputLevel == VERBOSE:
                print "VERBOSE: Pat Sequencer not defined! Defining!"

            patSequencer = GaudiSequencer("PatSeq")
            patSequencer.MeasureTime = True

            from Configurables import (TESCheck, EventNodeKiller)

            patSequencer.Members.append(
                TESCheck(Inputs=["Link/Rec/Track/Best"], Stop=False))
            patSequencer.Members.append(
                EventNodeKiller(Nodes=["Rec", "Raw", "Link/Rec"]))

            patSequencer.Members.append(
                GaudiSequencer("RecoVELOSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoTTSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoITSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoOTSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoTrSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoVertexSeq", MeasureTime=True))

            #importOptions("$TRACKSYSROOT/options/RecoTracking.py")
            #importOptions("$TALIGNMENTROOT/options/PatRecognition.opts")

            from Configurables import TrackRemoveDoubleHits
            if allConfigurables.get("TrackForwardPatSeq"):
                trackFwdPatSeq = GaudiSequencer("TrackForwardPatSeq")
                trackRemoveDoubleHitsFwd = TrackRemoveDoubleHits(
                    "FwdRemoveDoubleHits")
                trackRemoveDoubleHitsFwd.TracksLocation = "Rec/Track/Forward"
                trackFwdPatSeq.Members.append(trackRemoveDoubleHitsFwd)

            if allConfigurables.get("TrackMatchPatSeq"):
                trackMatchPatSeq = GaudiSequencer("TrackMatchPatSeq")
                trackRemoveDoubleHitsMatch = TrackRemoveDoubleHits(
                    "MatchRemoveDoubleHits")
                trackRemoveDoubleHitsMatch.TracksLocation = "Rec/Track/Match"
                trackMatchPatSeq.Members.append(trackRemoveDoubleHitsMatch)

            from Configurables import (PatPVOffline)
            allConfigurables["RecoVertexSeq"].Members.append(PatPVOffline())

            return patSequencer
        else:
            if outputLevel == VERBOSE:
                print "VERBOSE: Pat Sequencer already defined!"
            return allConfigurables.get("PatSeq")
Exemplo n.º 3
0
    def applyConf(self):

        # Check the special data options
        for option in self.getProp("SpecialData"):
            if option not in self.KnownSpecialData:
                raise RuntimeError("Unknown SpecialData option '%s'"%option)
        
        # Phases
        if not self.isPropertySet("RecoSequence"):
            self.setProp("RecoSequence",self.DefaultSubDetsFieldOn)
            if self.getProp("DataType") in self.Run2DataTypes:
                self.setProp("RecoSequence",self.DefaultSubDetsFieldOnRun2)
        
        recoSeq = self.getProp("RecoSequence")
        if self.getProp("SkipTracking"):
            for det in self.DefaultTrackingSubdets:
                if det in recoSeq:
                    recoSeq.remove(det)
        from Configurables import ProcessPhase
        ProcessPhase("Reco").DetectorList += recoSeq

        # Primary Vertex and V0 finding
        if "Vertex" in recoSeq  and self.getProp("DataType") not in self.Run2DataTypes:
            from Configurables import PatPVOffline, TrackV0Finder
            pvAlg = PatPVOffline()
            if "2009" == self.getProp("DataType"):
                from PatPV import PVConf 
                PVConf.VLoosePV().configureAlg()
            elif ( "veloOpen" in self.getProp("SpecialData") or
                    "microBiasTrigger" in self.getProp("SpecialData") ):
                from PatPV import PVConf
                PVConf.LoosePV().configureAlg()
            elif ( not ( self.getProp("Simulation") and
                         self.getProp("DataType") in ["2008","2009","2010","MC09"] ) ):
                # Default setting uses beam spot constraint from DB, available from 2011. Prior to 2011 stability of beam spot is not certain
                from PatPV import PVConf
                PVConf.StandardPV().configureAlg()
                
            # MC with particle gun cannot reconstruct PV, hence need to introduce one by hand
            if "pGun" in self.getProp("SpecialData"):
                from Configurables import PGPrimaryVertex
                pgPV = PGPrimaryVertex()
                GaudiSequencer("RecoVertexSeq").Members += [ pgPV ]
            else:
                GaudiSequencer("RecoVertexSeq").Members += [ pvAlg ];
                
            trackV0Finder = TrackV0Finder()
            GaudiSequencer("RecoVertexSeq").Members += [ trackV0Finder ]

        # for Run 2, we run a different algorithm and don't want to have
        # the V0 finder in the vertex sequence (which is now after HLT1)
        if "Vertex" in recoSeq and self.getProp("DataType") in self.Run2DataTypes:
            from Configurables import PatPV3D, PVOfflineTool, LSAdaptPV3DFitter
            pvAlg = PatPV3D("PatPV3D")
            ## this should go in a configuration file when we know what to use
            pvAlg.addTool(PVOfflineTool,"PVOfflineTool")
            pvAlg.PVOfflineTool.addTool(LSAdaptPV3DFitter, "LSAdaptPV3DFitter")
            pvAlg.PVOfflineTool.PVFitterName = "LSAdaptPV3DFitter"
            pvAlg.PVOfflineTool.LSAdaptPV3DFitter.UseFittedTracks = True
            pvAlg.PVOfflineTool.LSAdaptPV3DFitter.AddMultipleScattering = False
            pvAlg.PVOfflineTool.LSAdaptPV3DFitter.TrackErrorScaleFactor = 1.0
            pvAlg.PVOfflineTool.LSAdaptPV3DFitter.MinTracks = 4
            pvAlg.PVOfflineTool.LSAdaptPV3DFitter.trackMaxChi2 = 12.0
            pvAlg.PVOfflineTool.UseBeamSpotRCut = True
            pvAlg.PVOfflineTool.BeamSpotRCut = 0.2
            pvAlg.PVOfflineTool.BeamSpotRHighMultiplicityCut = 0.4
            pvAlg.PVOfflineTool.BeamSpotRMultiplicityTreshold = 10
            pvAlg.PVOfflineTool.InputTracks = [ "Rec/Track/FittedHLT1VeloTracks" ]
            pvAlg.OutputVerticesName = "Rec/Vertex/Primary"
            pvAlg.PrimaryVertexLocation = "Rec/Vertex/PrimaryVertices"

            # Remove all tracks that don't belong to a PV (to save space on a DST)
            from Configurables import TrackContainerCleaner, SelectTrackInVertex
            pvVeloTracksCleaner = TrackContainerCleaner("PVVeloTracksCleaner")
            pvVeloTracksCleaner.inputLocation = "Rec/Track/FittedHLT1VeloTracks" 
            pvVeloTracksCleaner.selectorName = "SelectTrackInVertex"

            GaudiSequencer("RecoVertexSeq").Members += [ pvAlg, pvVeloTracksCleaner ];
            GaudiSequencer("RecoVertexSeq").IgnoreFilterPassed = True

        ## Upgrade type?
        if self.getProp("DataType") == 'Upgrade' :
             specialDataList = self.getProp("SpecialData")
             specialDataList.append("upgrade")
             self.setProp("SpecialData",specialDataList)


        # Tracking (Should make it more fine grained ??)
        DoTracking = False
        for seq in self.DefaultTrackingSubdets :
            if seq in recoSeq: DoTracking = True
        if DoTracking:
            trackConf = TrackSys()
            self.setOtherProps(trackConf,["SpecialData","OutputType"])
            trackConf.ExpertHistos = self.expertHistos()

        # RICH
        if "RICH" in recoSeq:

            # The main sequence
            seq = GaudiSequencer("RecoRICHSeq")
            
            # Create the top level Conf object 
            richConf = RichRecSysConf(self.richRecConfName)
            
            # set some general options
            self.setOtherProps(richConf,["SpecialData","Context","OutputLevel",
                                         "Simulation","DataType","OnlineMode"])
            
            # Set the sequencer the RICH reco algs should be added to
            richConf.RecoSequencer = seq

            # Input Tracks (would be better to not hard code this. Get from TrackSys() or DstConf())
            # Only set if not previously set, to allow for custom studies using non standard locations
            # set at the top level options file level
            if not richConf.trackConfig().isPropertySet("InputTracksLocation") :
                richConf.trackConfig().setProp("InputTracksLocation","Rec/Track/Best")
                
            # Output PID Location. Again allow for pre-defined custom locations.
            if not richConf.isPropertySet("RichPIDLocation") :
                richConf.setProp("RichPIDLocation","Rec/Rich/PIDs")
            
            # Printout
            import GaudiKernel.ProcessJobOptions
            GaudiKernel.ProcessJobOptions.PrintOn()
            log.debug(richConf)
            GaudiKernel.ProcessJobOptions.PrintOff()
            
        # CALO
        if "CALO" in recoSeq:
            import GaudiKernel.ProcessJobOptions            
            seq  = GaudiSequencer ( 'RecoCALOSeq' )
            caloConf=CaloProcessor(
                Context            = self.getProp('Context')       ,
                OutputLevel        = self.getProp('OutputLevel')    ,
                UseTracks          = True                           ,
                EnableOnDemand     = False                          ,
                DataType           = self.getProp ('DataType')      
                )
            GaudiKernel.ProcessJobOptions.PrintOn()
            seq.Members = [caloConf.caloSequence()]
            GaudiKernel.ProcessJobOptions.PrintOff()
            


        # MUON
        if "MUON" in recoSeq:
            from MuonID import ConfiguredMuonIDs
            from Configurables import RawBankReadoutStatusConverter,RawBankReadoutStatusFilter
            cm=ConfiguredMuonIDs.ConfiguredMuonIDs(data=self.getProp("DataType"),
                                                   specialData=self.getProp("SpecialData"))
            MuonIDSeq=cm.getMuonIDSeq()
            RawBankReadoutStatusConverter("MuonProcStatus").System="Muon"
            RawBankReadoutStatusConverter("MuonProcStatus").BankTypes=["Muon"]
            RawBankReadoutStatusFilter("MuonROFilter").BankType=13
            RawBankReadoutStatusFilter("MuonROFilter").RejectionMask=2067            
            GaudiSequencer("RecoMUONSeq").Members += [ "MuonRec",
                                                       "RawBankReadoutStatusConverter/MuonProcStatus", 
                                                       "RawBankReadoutStatusFilter/MuonROFilter",  MuonIDSeq ]
           
      
        # PROTO
        if "PROTO" in recoSeq:
            self.setOtherProps(GlobalRecoConf(),["DataType","SpecialData",
                                                 "Context","OutputLevel"])
            GlobalRecoConf().RecoSequencer = GaudiSequencer("RecoPROTOSeq")
            

        # SUMMARY
        if "SUMMARY" in recoSeq:
            from Configurables import RecSummaryAlg
            summary = RecSummaryAlg("RecSummary")
            # make a new list of uppered detectors
            dets = []
            for det in self.getProp("Detectors"):
                dets.append(det.upper())
            summary.Detectors = dets 
            GaudiSequencer("RecoSUMMARYSeq").Members += [summary]
Exemplo n.º 4
0
RV.OutputVerticesName = "Rec/Vertices/RV"
RV.OutputLevel = 3
RV.addTool(PVOfflineTool)
RV.PVOfflineTool.InputTracks = ["Rec/Track/Best"]
RV.PVOfflineTool.PVSeedingName = "PVSeed3DTool"
RV.PVOfflineTool.addTool(PVSeed3DTool())
RV.PVOfflineTool.PVSeed3DTool.TrackPairMaxDistance = 0.2 * mm
RV.PVOfflineTool.PVSeed3DTool.zMaxSpread = 1 * mm
RV.PVOfflineTool.addTool(LSAdaptPV3DFitter())
RV.PVOfflineTool.LSAdaptPV3DFitter.maxIP2PV = 2 * mm
RV.PVOfflineTool.LSAdaptPV3DFitter.MinTracks = 4

#Default PV reconstruction
from Configurables import PatPVOffline
myPVLocation = "/Event/Rec/Vertex/myPVOffline"
myPVOffl = PatPVOffline("myPVOffl")
myPVOffl.OutputVertices = myPVLocation
#DVSeq.Members += [ myPVOffl ]
########################################################################

########################################################################
# Preselection of candidates
from Configurables import RecVertices2Particles
RV2P = RecVertices2Particles("RV2P")
DVSeq.Members += [RV2P]

RV2P.RecVerticesLocation = ["Rec/Vertices/RV"]
#RV2P.RecVerticesLocation = [myPVLocation]
RV2P.OutputLevel = 3

#Selection Cuts
Exemplo n.º 5
0
 def configureAlg(self, PVAlg = PatPVOffline("PatPVOffline")):
     '''pass in an alg to configure'''
     
     PVAlg.addTool(PVOfflineTool, "PVOfflineTool")
     
     self.configureTool(PVAlg.PVOfflineTool)