#otCond.ConnectionString = 'sqlite_file:/afs/cern.ch/user/j/janos/dbase/LHCBCOND_changes.db/LHCBCOND' #CondDB().addLayer( otCond ) # configure the alignment from Configurables import TAlignment from TAlignment.Alignables import * elements = Alignables() elements.OTCFramesASide("TxTzRz") elements.OTCFramesCSide("TxTzRz") constraints = [ "OT/T1X1C : OT/T1X1UCSide : Tx Ty Tz Rz", "OT/T1X1A : OT/T1X1UASide : Tx Ty Tz Rz", "OT/T3X2C : OT/T3X1UCSide : Tx Ty Tz Rz", "OT/T3X2A : OT/T3X1UASide : Tx Ty Tz Rz" ] TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/AlignTracks" TAlignment().Constraints = constraints TAlignment().WriteCondSubDetList = ['OT'] from Configurables import (PatSeeding, PatSeedingTool) PatSeeding = PatSeeding("PatSeeding") PatSeeding.addTool(PatSeedingTool("PatSeedingTool")) PatSeeding.PatSeedingTool.MaxOTOccupancy = 0.02 PatSeeding.PatSeedingTool.MaxITOccupancy = 0.02 #PatSeeding.PatSeedingTool.CommonXFraction = 0. #PatSeeding.PatSeedingTool.MaxUsedFractPerRegion = 0. #PatSeeding.PatSeedingTool.MaxUsedFractITOT = 0. #PatSeeding.PatSeedingTool.MaxUsedFractLowQual = 0. # set up a track selection
#constraints.append("OT/T3X2A : OT/T3VX2ASide : Tx Ty Tz Rz") #constraints.append("OT/T3X2C : OT/T3VX2CSide : Tx Ty Tz Rz") #constraints.append("IT1Bot : T/IT/Station1/BottomBox : Tx Ty Tz Rz") #constraints.append("IT2Bot : T/IT/Station2/BottomBox : Tx Ty Tz Rz") #constraints.append("IT3Bot : T/IT/Station3/BottomBox : Tx Ty Tz Rz") #constraints.append("IT1A : T/IT/Station1/ASideBox : Tx Ty Tz Rz") #constraints.append("IT2A : T/IT/Station2/ASideBox : Tx Ty Tz Rz") #constraints.append("IT3A : T/IT/Station3/ASideBox : Tx Ty Tz Rz") #constraints.append("OT/T3X2 : OT/T3X1U.Side : Tx Ty Tz Rz") #constraints.append("OT/T3X2A : OT/T3X2VASide : Tx Ty Tz Rz") print "aligning elements ", elements TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/AlignTracks" # comment following line if one does not want vertex #TAlignment().VertexLocation = "Rec/Vertex/Primary" TAlignment().Constraints = constraints TAlignment().SurveyConstraints = list(surveyconstraints) TAlignment().WriteCondSubDetList = ['Velo', 'TT', 'IT', 'OT'] TAlignment().EigenValueThreshold = -1 TAlignment().MinNumberOfHits = 5 # still set up a track selection from Configurables import (GaudiSequencer, TrackContainerCopy, TrackSelector, ITTrackSelector, TrackMonitor, TrackListRefiner, TrackListMerger, TrackHitAdder) from TrackFitter.ConfiguredFitters import * trackFilterSeq = GaudiSequencer("TrackFilterSeq")
from Configurables import Escher # Just instantiate the configurable... theApp = Escher() theApp.DataType = "2012" #theApp.InputType = "MDF" theApp.InputType = "DST" theApp.PrintFreq = 10 theApp.EvtMax = 10000 theApp.DatasetName = 'AlignHlt1JpsiMUON' # COND DB theApp.DDDBtag = 'dddb-20130111' theApp.CondDBtag = 'cond-20130114' # trigger requirements theApp.HltFilterCode = "HLT_PASS_RE( 'Hlt2ExpressJPsiDecision' )" # specify the input to the alignment from Configurables import TAlignment #from TAlignment.ParticleSelections import muonTracksFORmuonAlignment # Stefania #TAlignment().ParticleSelections = [ muonTracksFORmuonAlignment() ] # Stefania from TAlignment.TrackSelections import BestMuonTracks TAlignment().TrackSelections = [BestMuonTracks("OfflineMuonAlignment")] # specify what we actually align for from TAlignment.AlignmentScenarios import * configureMuonAlignment() # Stefania
#constraints.append("OT3 : OT/T3VX2 : Tx Ty Tz") constraints.append("IT3Top : IT/Station3/TopBox : Rx Ry Rz") constraints.append("IT3Bottom : IT/Station3/BottomBox : Rx Ry Rz") constraints.append("IT3A : IT/Station3/ASideBox : Rx Ry Rz") constraints.append("IT3C : IT/Station3/CSideBox : Rx Ry Rz") from Configurables import Al__AlignChisqConstraintTool as AlignChisqConstraintTool # fix the z-position of OT in T3 surveyconstraints.append("OT/T3X1U : -1.52 -1.25 0.0 0.0 0.0 0.0 : 0.5 0.5 0.0001 0.0001 0.0001 0.0001") # fix the Tz and Rz of the last and first velo modules AlignChisqConstraintTool().XmlUncertainties += ["Module(00|01|40|41) : 0.02 0.02 0.00001 0.0002 0.0002 0.0000001"] print "aligning elements ", elements TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/AlignTracks" # comment following line if one does not want vertex TAlignment().VertexLocation = "Rec/Vertex/AlignPrimaryVertices" TAlignment().Constraints = constraints TAlignment().SurveyConstraints = list(surveyconstraints) TAlignment().WriteCondSubDetList = ['Velo','TT','IT','OT'] TAlignment().MinNumberOfHits = 6 #TAlignment().SolvTool = "gslSVDsolver" # still set up a track selection from Configurables import (GaudiSequencer,TrackListRefiner,TrackListMerger, TrackSelector,TrackMonitor,ITTrackSelector, TrackHitAdder,TrackDoubleHitPruner ) from TrackFitter.ConfiguredFitters import *
############################################################################### # Syntax is: # gaudiiter.py Escher-AlignHltJpsi.py <someDataFiles>.py ############################################################################### from Configurables import Escher # Just instantiate the configurable... theApp = Escher() theApp.DataType = "2012" theApp.InputType = "MDF" theApp.PrintFreq = 10 theApp.EvtMax = 100 theApp.DatasetName = 'AlignHltJpsi' # COND DB theApp.DDDBtag = 'dddb-20130111' theApp.CondDBtag = 'cond-20130114' # specify the input to the alignment from Configurables import TAlignment from TAlignment.ParticleSelections import defaultHLTJPsiSelection TAlignment().ParticleSelections = [defaultHLTJPsiSelection()] from TAlignment.TrackSelections import NoPIDTracksFromHlt TAlignment().TrackSelections = [NoPIDTracksFromHlt(RerunVeloTracking=True)] # specify what we actually align for from TAlignment.AlignmentScenarios import * configure2012DataAlignment(True)
def __init__(self, Name="VPOverlapTracks", InputLocation="Rec/Track/Best", Fitted=True): TrackRefiner.__init__(self, Name=Name, InputLocation=InputLocation, Fitted=Fitted) def configureSelector(self, a): a.Selector = VPTrackSelector() a.Selector.TrackTypes = ["Velo", "Long"] TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/Best" TAlignment().VertexLocation = "" #Rec/Vertex/Primary" TAlignment().Constraints = constraints TAlignment().TrackSelections = [myVPTracks()] TAlignment().WriteCondSubDetList = ['VP'] TAlignment().EigenValueThreshold = 100 TAlignment().UsePreconditioning = True TAlignment().UseLocalFrame = True #include survey constraints from TAlignment.SurveyConstraints import * surveyconstraints = SurveyConstraints() surveyconstraints.VP() """ # still set up a track selection
print 'optionfiles: ', optionfiles options = ["importOptions(%r)" % f for f in optionfiles] # "execute" the configuration script generated (if any) from Gaudi.Configuration import logging if options: g = {} l = {} exec "from Gaudi.Configuration import *" in g, l for o in options: logging.debug(o) exec o in g, l # let the algorithm update in finalize and set the input file from Configurables import TAlignment, AlignAlgorithm TAlignment().UpdateInFinalize = True AlignAlgorithm('Alignment').InputDataFiles = derivativefiles AlignAlgorithm('Alignment').OutputDataFile = '' # set the database layer if opts.aligndb: counter = 1 for db in opts.aligndb: from Configurables import (CondDB, CondDBAccessSvc) alignCond = CondDBAccessSvc('AlignCond' + str(counter)) alignCond.ConnectionString = 'sqlite_file:' + db + '/LHCBCOND' CondDB().addLayer(alignCond) counter += 1 print 'added databases: ', opts.aligndb from GaudiPython.Bindings import AppMgr
def algorithm(self): from Configurables import TrackSys TrackSys().GlobalCuts = { 'Velo': 4000, 'OT': 8000 } #### to remove busy events Name = self._name inputTrackLocation = self._inputLocation from Configurables import GaudiSequencer, HltTrackConverter, TrackContainerCopy, Escher from TAlignment.Utils import configuredFitAndHitAdderSequence seq = GaudiSequencer(self.name() + "Seq") ## Here starts Stefania's code ======================== from Configurables import MuonNNetRec, MuonPadRec, MuonClusterRec muonTrackTool = MuonNNetRec( name="MuonNNetRec", AssumeCosmics=False, PhysicsTiming=False, AssumePhysics= True, ## assume that tracks come from IP (only forward) AddXTalk=True, XtalkRadius=1.5, SkipStation=0, #DecodingTool = "MuonMonHitDecode", # default is "MuonHitDecode" ClusterTool="MuonClusterRec" # default is "MuonFakeClustering" #OutputLevel = 2 ) clusterTool = MuonClusterRec(name="MuonClusterRec", OutputLevel=5, MaxPadsPerStation=500) #default 1500 padRecTool = MuonPadRec(name="PadRecTool", OutputLevel=5) from Configurables import MakeMuonTracks copy = MakeMuonTracks(name='MakeMuonTracks', OutputLevel=5, SkipBigClusters=True) copy.addTool(muonTrackTool, name='MuonRecTool') # ------------------------------------------------------------------ seq.Members += [copy] # Copy MuonTracks to LHCb tracks # ------------------------------------------------------------------ from TrackFitter.ConfiguredFitters import ConfiguredForwardStraightLineEventFitter #, ConfiguredStraightLineFitter from Configurables import MeasurementProvider, TrackKalmanFilter muonTrackFit = ConfiguredForwardStraightLineEventFitter( "MuonTrackFit", TracksInContainer="Rec/Track/Muon") #muonTrackFit = ConfiguredStraightLineFitter( 'MuonTrackFit' , TracksInContainer = 'Rec/Track/Muon' ) muonTrackFit.Fitter.OutputLevel = 5 muonTrackFit.Fitter.addTool(TrackKalmanFilter, 'NodeFitter') muonTrackFit.Fitter.addTool(MeasurementProvider, name='MeasProvider') muonTrackFit.Fitter.MeasProvider.MuonProvider.clusterize = True #default False muonTrackFit.Fitter.MeasProvider.MuonProvider.OutputLevel = 5 muonTrackFit.Fitter.ErrorX = 1000 muonTrackFit.Fitter.ErrorY = 10000 muonTrackFit.Fitter.MaxNumberOutliers = 0 # ------------------------------------------------------------------ seq.Members += [muonTrackFit] # ------------------------------------------------------------------ from Configurables import TAlignment, GetElementsToBeAligned from Configurables import TrackFilterAlg trackFilterAlg = TrackFilterAlg( name="FilterTracks", OutputLevel=5, TracksInputContainer="Rec/Track/Muon", # MuonTrackRec TracksOutputContainer="Rec/Track/SelectedMuon", # Filtered tracks MuonFilter=True, ###------------------------------ MUONTRACKSELECTOR MuonPcut=6000., ## 6 GeV MuonChisquareCut=5, inCaloAcceptance=True, noOverlap=False, #TheRegion = 10 minHitStation=3) # >3 ####??????? trackFilterAlg.addTool(GetElementsToBeAligned( OutputLevel=5, Elements=TAlignment().ElementsToAlign), name="GetElementsToBeAligned") # ------------------------------------------------------------------ seq.Members += [trackFilterAlg] # ------------------------------------------------------------------ from Configurables import TrackMuonMatching, TrackMasterExtrapolator, TrackChi2Calculator #, TrajOTCosmicsProjector, TrajOTProjector, TrackProjectorSelector matching = TrackMuonMatching( name="TrackMuonMatching", AllCombinations=False, # default true MatchAtFirstMuonHit=True, # default false FullDetail=True, #???? OutputLevel=5, TTracksLocation=inputTrackLocation, # Best container + chisquare < 5 MuonTracksLocation='Rec/Track/SelectedMuon', # MuonNNet TracksOutputLocation='Rec/Track/Best/TMuon', MatchChi2Cut=20.0, WriteNtuple=False) matching.addTool(TrackMasterExtrapolator, name='Extrapolator') matching.Extrapolator.ApplyMultScattCorr = True matching.Extrapolator.ApplyEnergyLossCorr = False matching.Extrapolator.ApplyElectronEnergyLossCorr = False matching.addTool(TrackChi2Calculator, name='Chi2Calculator') # ------------------------------------------------------------------ seq.Members += [matching] # Track-Muon Matching # ------------------------------------------------------------------ from TrackFitter.ConfiguredFitters import ConfiguredEventFitter #tmuonfit = ConfiguredFastEventFitter( 'TMuonFit', TracksInContainer = 'Rec/Track/Best/TMuon') # contains Best+Muon tmuonfit = ConfiguredEventFitter( "TMuonFit", TracksInContainer='Rec/Track/Best/TMuon') # contains Best+Muon tmuonfit.Fitter.MakeNodes = True tmuonfit.Fitter.MakeMeasurements = True tmuonfit.Fitter.addTool(TrackKalmanFilter, 'NodeFitter') tmuonfit.Fitter.ErrorX = 1000 tmuonfit.Fitter.ErrorY = 10000 tmuonfit.Fitter.NumberFitIterations = 5 tmuonfit.Fitter.MaxDeltaChiSqConverged = 0.1 tmuonfit.Fitter.MaxNumberOutliers = 0 tmuonfit.Fitter.addTool(MeasurementProvider(), name='MeasProvider') tmuonfit.Fitter.MeasProvider.MuonProvider.clusterize = True #tmuonfit.Fitter.MeasProvider.MuonProvider.OutputLevel = 2 tmuonfit.Fitter.MeasProvider.IgnoreMuon = False # ------------------------------------------------------------------ seq.Members += [tmuonfit] # Fit TMuon tracks # ------------------------------------------------------------------ from Configurables import TrackSelector, TrackContainerCopy tmuonselectoralg = TrackContainerCopy( name="TmuonSelection", inputLocations=['Rec/Track/Best/TMuon'], outputLocation=self.location()) tmuonselectoralg.addTool(TrackSelector, name="Selector") tmuonselectoralg.Selector.MaxChi2Cut = 10 #tmuonselectoralg.Selector.OutputLevel = 2 # ------------------------------------------------------------------ seq.Members += [tmuonselectoralg] # selects good TMuon tracks # ------------------------------------------------------------------ return seq
def configureDBSnapshot(self): """ Configure the database to use the online snapshot """ tag = { "DDDB": self.getProp('DDDBtag'), "LHCBCOND": self.getProp('CondDBtag'), "SIMCOND": self.getProp('CondDBtag'), "ONLINE": 'fake' } # https://savannah.cern.ch/bugs/?94454#comment12 from Configurables import MagneticFieldSvc MagneticFieldSvc().UseSetCurrent = True from Configurables import CondDB cdb = CondDB() cdb.Tags = tag cdb.setProp('IgnoreHeartBeat', True) self.setOtherProps( cdb, ['UseDBSnapshot', 'DBSnapshotDirectory', 'PartitionName']) # So, here is the problem: we don't want to run the risk that # the CondDB() configurable (which configures /after/ us) # overwrites our conditions. Yet, we don't want to miss the # default conditions (e.g. velo stepper motor, magnetic field) # either. if we add our conditions to its # RunChangeHandlerConditions list, then we a) need to fix the # path and b) don't know what happens for conditions that # appear twice, because we don't control the ordering of the # list. So, the hack is: # - don't set 'EnableRunChangeHandler' # - copy what is hidden behind that flag in CondDB()._configureDBSnapshot # - do the test of the RunChangeHandler configuration ourselves: cdb.setProp('EnableRunChangeHandler', False) from Configurables import RunChangeHandlerSvc rch = RunChangeHandlerSvc() ApplicationMgr().ExtSvc.append(rch) baseloc = self.getProp("DBSnapshotDirectory") rch.Conditions = dict( (c, '/'.join([baseloc, f])) for f, cs in cdb.getProp("RunChangeHandlerConditions").iteritems() for c in cs) #path = self.getProp('DBSnapshotDirectory') + "/.."*4 + "/group/online/AligWork/current/" allconds = { 'Velo': [ 'Conditions/Alignment/Velo/VeloSystem', 'Conditions/Alignment/Velo/VeloRight', 'Conditions/Alignment/Velo/VeloLeft' ] + ['Conditions/Alignment/Velo/Module%02d' % i for i in range(0, 42)] + [ 'Conditions/Alignment/Velo/Detector%02d-%02d' % (i, (1 + i / 2) % 2) for i in range(0, 42) ], 'IT': [] + ['Conditions/Alignment/IT/ITSystem'] + ['Conditions/Alignment/IT/ITT%d' % i for i in range(1, 4)] + [ 'Conditions/Alignment/IT/ITT%d%sBox' % (i, b) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] ] + [ 'Conditions/Alignment/IT/ITT%d%sLayer%s' % (i, b, l) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] for l in ['X1', 'U', 'V', 'X2'] ] + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%d' % (i, b, l, a) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] for l in ['X1', 'U', 'V', 'X2'] for a in range(1, 8) ], # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector' % (i,b,l,a) for i in range(1,4) for b in ['Top','Bottom','ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector_Sensor1' % (i,b,l,a) for i in range(1,4) for b in ['Top','Bottom','ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector_Sensor2' % (i,b,l,a) for i in range(1,4) for b in ['ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] , 'OT': [] + ['Conditions/Alignment/OT/OTSystem'] + ['Conditions/Alignment/OT/T%d' % i for i in range(1, 4)] + [ 'Conditions/Alignment/OT/T%d%s' % (i, l) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] ] + [ 'Conditions/Alignment/OT/T%d%sQ%d' % (i, l, q) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] for q in range(0, 4) ] + [ 'Conditions/Alignment/OT/T%d%sQ%dM%d' % (i, l, q, m) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] for q in range(0, 4) for m in range(1, 10) ], 'TT': [] + ['Conditions/Alignment/TT/TTSystem'] + ['Conditions/Alignment/TT/TT%s' % i for i in ['a', 'b']] + [ 'Conditions/Alignment/TT/TT%sLayer' % (l) for l in ['aX', 'aU', 'bV', 'bX'] ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU', 'bV', 'bX'] for r in range(1, 4) for m in range(1, 4) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['bV', 'bX'] for r in range(1, 4) for m in range(4, 6) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU', 'bV', 'bX'] for r in [1, 3] for m in range(6, 7) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU'] for r in [1, 3] for m in range(4, 6) ], 'Muon': [] + ['Conditions/Alignment/Muon/MuonSystem'] + ['Conditions/Alignment/Muon/M%sStation' % i for i in range(1, 6)] + ['Conditions/Alignment/Muon/M%sASide' % i for i in range(1, 6)] + ['Conditions/Alignment/Muon/M%sCSide' % i for i in range(1, 6)] } ## This is a bit dirty, since we're supposed to control TAlignment. We ## know that this is set from top level, so let's give it a try anyway ta = TAlignment() sdToWrite = set(ta.getProp("WriteCondSubDetList")) pat = self.getProp("OnlineAligWorkDir") + "/xml/%s.xml" conditionmap = dict((pat % sd, f) for (sd, f) in allconds.iteritems() if sd in sdToWrite) # add to the existing map rch.Conditions = dict(rch.Conditions.items() + dict( (c, f) for f, cs in conditionmap.iteritems() for c in cs).items()) from Configurables import MagneticFieldSvc MagneticFieldSvc().UseSetCurrent = True
# File for running alignment with D* reconstructed from HLT sel reports ############################################################################### # Syntax is: # gaudiiter.py Escher-AlignHltJpsi.py <someDataFiles>.py ############################################################################### from Configurables import Escher # Just instantiate the configurable... theApp = Escher() theApp.DataType = "2011" theApp.InputType = "MDF" theApp.PrintFreq = 10 theApp.EvtMax = 200 theApp.DatasetName = 'AlignHltDstarWithD0' # COND DB theApp.DDDBtag = 'dddb-20130111' theApp.CondDBtag = 'cond-20130114' # specify the input to the alignment from Configurables import TAlignment from TAlignment.ParticleSelections import defaultHLTDstarSelection TAlignment().ParticleSelections = [defaultHLTDstarSelection()] from TAlignment.TrackSelections import NoPIDTracksFromHlt TAlignment().TrackSelections = [NoPIDTracksFromHlt()] # specify what we actually align for from TAlignment.AlignmentScenarios import * configure2012DataAlignment()
def configureSequences(self): # Check for special data options for option in self.getProp('SpecialData'): if option not in self.KnownSpecialData: raise RunTimeError("Unknown SpecialData option '%s'" % option) escherSeq = GaudiSequencer("EscherSequencer") #escherSeq.Context = self.getProp("Context") ApplicationMgr().TopAlg = [escherSeq] mainSeq = self.getProp("MainSequence") if len(mainSeq) == 0: self.MainSequence = self.DefaultSequence mainSeq = self.MainSequence escherSeq.Members += mainSeq ProcessPhase("Init").DetectorList += self.getProp("InitSequence") ProcessPhase("Init").Context = self.getProp("Context") from Configurables import RecInit, TrackSys log.info("Setting up alignment sequence") recInit = RecInit(name="EscherInit", PrintFreq=self.getProp("PrintFreq")) GaudiSequencer("InitEscherSeq").Members += [recInit] # set up the HltFilterSeq from Configurables import HltCompositionMonitor from Configurables import LoKi__HDRFilter as HDRFilter hltFilterSeq = GaudiSequencer("HltFilterSeq") from DAQSys.Decoders import DecoderDB from DAQSys.DecoderClass import decodersForBank from itertools import chain hltdecs = [DecoderDB.get("HltDecReportsDecoder/Hlt1DecReportsDecoder")] if not self.getProp("OnlineMode"): ## HLT2 decreports are only used offline. hltdecs += [ DecoderDB.get("HltDecReportsDecoder/Hlt2DecReportsDecoder") ] hltFilterSeq.Members = [d.setup() for d in hltdecs] ## FIXME: These lines should go back in as soon as an easy to use filter ## FIXME: is available that works for HLT1 and HLT2 decreports at the same time. ## identifies events that are not of type Hlt1ErrorEvent or Hlt2ErrorEvent ## hltErrCode = "HLT_PASS_RE('Hlt1(?!ErrorEvent).*Decision') & HLT_PASS_RE('Hlt2(?!ErrorEvent).*Decision')" ## hltErrorFilter = HDRFilter('HltErrorFilter', Code = hltErrCode ) # the filter ## hltFilterSeq.Members += [ HltCompositionMonitor(), hltErrorFilter ] ## add more hlt filters, if requested ## if hasattr(self,"HltFilterCode") and len(self.getProp("HltFilterCode"))>0: ## hltfilter = HDRFilter ( 'HLTFilter', ## Code = self.getProp("HltFilterCode")) ## hltfilter.Preambulo += [ "from LoKiCore.functions import *" ] ## hltFilterSeq.Members += [ hltfilter ] # in Escher we'll always use the DOD ApplicationMgr().ExtSvc += ["DataOnDemandSvc"] alignSeq = GaudiSequencer("AlignSequence") # if the patter reco is not run, we need the DataOnDemand svc # so that e.g. the track container(s) is unpacked: if not GaudiSequencer("RecoTrSeq").getProp("Enable"): DstConf(EnableUnpack=True) # Setup tracking sequence trackConf = TrackSys() self.setOtherProps(trackConf, [ "SpecialData", "OutputType", "DataType", "Simulation", "GlobalCuts" ]) trackConf.ExpertTracking = self.getProp("ExpertTracking") ta = TAlignment() ta.Upgrade = self.getProp("Upgrade") self.setOtherProps(ta, ["DatasetName", "OnlineMode", "OnlineAligWorkDir"]) ta.Sequencer = alignSeq if self.getProp("Millepede"): log.info("Using Millepede type alignment!") self.setProp("Incident", "GlobalMPedeFit") ta.Method = "Millepede" ta.Sequencer = GaudiSequencer("MpedeAlignSeq")
from Configurables import (Escher, TAlignment, ApplicationMgr, NTupleSvc) TAlignment().CondFilePrefix = "" myfile = 'MC09-it3-evts5100-skpCl-uniTr-dc__lhcbID.root' Escher().DatasetName = myfile ApplicationMgr().ExtSvc += ["NTupleSvc"] tupleFile = "$ESCHERROOT/job/" + myfile tuple = "FILE1 DATAFILE='" + tupleFile + "' TYP='ROOT' OPT='NEW'" NTupleSvc().Output = [tuple]
TrackSys().ExpertTracking += ["kalmanSmoother"] TrackSys().TrackExtraInfoAlgorithms = [''] RecSysConf().RecoSequence = ["VELO", "TT", "IT", "OT", "Tr", "Vertex"] from Configurables import TAlignment from TAlignment.Alignables import * elements = Alignables() elements.VeloLeft("TxTyTzRzRxRy") constraints = [] #elements.VeloRight("TxTyTzRz") #constraints = ["Tz","Tx","Ty","Rz"] print "aligning elements ", elements TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/AlignTracks" TAlignment().VertexLocation = "Rec/Vertex/Primary" TAlignment().Constraints = constraints TAlignment().WriteCondSubDetList = ['Velo'] #TAlignment().UpdateInFinalize = False # still set up a track selection from Configurables import (GaudiSequencer, TrackContainerCopy, TrackSelector, TrackMonitor) trackFilterSeq = GaudiSequencer("TrackFilterSeq") alignSelector = TrackContainerCopy("AlignSelector", inputLocation="Rec/Track/Best", outputLocation="Rec/Track/AlignTracks") alignSelector.addTool( TrackSelector("Selector",
# gaudiiter.py -e NUMEVENTS Escher-AlignCollisions.py <someDataFiles>.py # ############################################################################### from Configurables import Escher theApp = Escher() theApp.DataType = "2011" theApp.InputType = "MDF" theApp.PrintFreq = 1 theApp.EvtMax = 100 theApp.DatasetName = 'AlignCollisions' # specify the input to the alignment from Configurables import TAlignment from TAlignment.TrackSelections import * TAlignment().TrackSelections = [ GoodLongTracks(), VeloOverlapTracks(), VeloBackwardTracks(), ITBoxOverlapTracks() ] # add the default PV selection from TAlignment.VertexSelections import configuredPVSelection TAlignment().PVSelection = configuredPVSelection() # specify what we actually align for from TAlignment.AlignmentScenarios import * configurePromptAlignment() #configureVeloSensorAlignment()
def configureVeloAlignment(fixMeanInHalf=True): ''' This should be the default alignment for the Automatic alignment procedure Align 2-halves for all degree of freedom and Modues only for only the main degrees of freedom Tx Ty Rz Constrain the global Velo position and two modules in each half ''' TAlignment().WriteCondSubDetList += ['Velo'] elements = Alignables() elements.Velo("None") elements.VeloRight("TxTyTzRxRyRz") elements.VeloLeft("TxTyTzRxRyRz") elements.VeloModules("TxTyRz") elements.VeloPhiSensors("None") elements.VeloRSensors("None") TAlignment().ElementsToAlign += list(elements) # Constraints surveyconstraints = SurveyConstraints() surveyconstraints.All() constraints = [] surveyconstraints.Constraints += [ "Velo : 0 0 0 -0.0001 0 -0.0001 : 0.2 0.2 0.2 0.0001 0.0001 0.001", "Velo/Velo(Right|Left) : 0 0 0 0 0 0 : 10 1 0.4 0.01 0.01 0.001" ] # make sure that the velo stays where it was. Important note: the # dofs here must match the ones that we actually align for. If you # specify too many, things will go rather wrong. constraints.append( "VeloHalfAverage : Velo/Velo(Left|Right) : Tx Ty Tz Rx Ry Rz") if fixMeanInHalf: # Constrain average constraints.append( "VeloAInternal : Velo/VeloRight/Module..: Tx Ty Rz Szx Szy") constraints.append( "VeloCInternal : Velo/VeloLeft/Module..: Tx Ty Rz Szx Szy") else: # Fix 2 modules constraints.append( "VeloFixModule10 : Velo/VeloLeft/Module10: Tx Ty Rz") constraints.append( "VeloFixModule11 : Velo/VeloRight/Module11: Tx Ty Rz") constraints.append( "VeloFixModule32 : Velo/VeloLeft/Module32: Tx Ty Rz") constraints.append( "VeloFixModule33 : Velo/VeloRight/Module33: Tx Ty Rz") constraints.append( "VeloFixSensors10 : Velo/VeloLeft/Module10/RPhiPair10/.*: Tx Ty Rz" ) constraints.append( "VeloFixSensors11 : Velo/VeloRight/Module11/RPhiPair11/.*: Tx Ty Rz" ) constraints.append( "VeloFixSensors32 : Velo/VeloLeft/Module32/RPhiPair32/.*: Tx Ty Rz" ) constraints.append( "VeloFixSensors33 : Velo/VeloRight/Module33/RPhiPair33/.*: Tx Ty Rz" ) TAlignment().Constraints = constraints
#from Configurables import ( CondDB, CondDBAccessSvc ) #alignCond = CondDBAccessSvc( 'AlignCond' ) #alignCond.ConnectionString = 'sqlite_file:' + aligndb + '/LHCBCOND' #CondDB().addLayer( alignCond ) from Configurables import (TrackSys, GaudiSequencer, Escher, TAlignment, TStation, ATrackSelector, TrackMonitor, OTTrackMonitor, TAConfig, AlignTrTools) TrackSys().TrackPatRecAlgorithms = ["PatSeed"] GaudiSequencer("RecoRICHSeq").Enable = False GaudiSequencer("RecoVELOSeq").Enable = False GaudiSequencer("RecoTTSeq").Enable = False GaudiSequencer("RecoITSeq").Enable = False TAlignment().WriteCondSubDetList = ["OT"] TAlignment().OutputLevel = 2 Escher().Detectors = ["OT"] Escher().EvtMax = 5000 Escher().PrintFreq = 1000 Escher().AlignmentLevel = "layers" Escher().Millepede = True Escher().Kalman = False Escher().Incident = "GlobalMPedeFit" Escher().TrackContainer = "Rec/Track/Best" Escher().skipBigCluster = True Escher().OutputLevel = 3 AlignTrTools().nTrackModelParameters = 4 AlignTrTools().Chi2Scale = 10
from Gaudi.Configuration import * from Configurables import ( TAlignment, AlignTrTools ) AlignTrTools().Degrees_of_Freedom[0] = 1 TAlignment().Constraints += [ "X_S1_L1_Q0_M0", "X_S1_L2_Q0_M0", "X_S3_L1_Q0_M0", "X_S3_L2_Q0_M0" ]
splittedline = line.split(' ') filestring = splittedline[len(splittedline) - 1].strip(' ') filestring = filestring.replace('\n', '') print 'adding file: ', path + runnr + "/" + filestring2 + "/" + filestring + " ==== " data.append(path + runnr + '/' + filestring2 + '/' + filestring) else: data.append(path + runnr + ".dst") print data # Go past this line only when you know what you are doing ############################################################################################################################ ## File to setup Alignment from Configurables import TAlignment, GetElementsToBeAligned TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/AlignTracks" TAlignment().Constraints = constraints TAlignment().SurveyConstraints = list(surveyconstraints) TAlignment().WriteCondSubDetList = ['Muon'] TAlignment().CondFilePrefix = 'xml/' TAlignment().OutputLevel = outputlevel TAlignment().UseLocalFrame = uselocalframe elementtool = GetElementsToBeAligned("GetElementsToBeAligned") elementtool.UseLocalFrame = False # ================================================================================================ # add all 'private' reconstruction to this sequence which is automatically added to the alignment sequence. # ================================================================================================ from Configurables import GaudiSequencer
useDrift = False trackThrough = "OT" trajOTProjector = TrajOTProjector(OutputLevel=DEBUG, UseDrift=useDrift) trackFilterAlg = TrackFilterAlg( "FilterTracks1", OutputLevel=outputLevel, TracksInputContainer="Rec/Track/Best", #"Rec/Track/Tsa", TracksOutputContainer="Alignment/FilterTracks1", TrackType="Long", #"Ttrack", #"Long", StripUnwantedDetectorHits=False, KeepDetectorHits="OT", MinNHits=0) elements = TAlignment().getProp("ElementsToAlign") trackFilterAlg.addTool(GetElementsToBeAligned(OutputLevel=outputLevel, Elements=elements), name="GetElementsToBeAligned") trackFilterAlg.addTool( AlignSelTool( OutputLevel=outputLevel, BFieldStatus=True, TrackType=trackThrough, IsolatedTrackNStripsTolerance=2, IsolatedTrackNStrawsTolerance=1, #MattCuts = False , MomentumMinCut=-999999, PtMinCut=-999999,
"ITT.*?Layer.{1,2} : 0.5 0.0001 0.0001 0.000001 0.000001 0.000001" ] # need to increase the TT module survey because of temperature expansion # move TT back to survey in Z, Rx, Ry, Y #surveyconstraints.XmlUncertainties += [ "TT..LayerR.Module.*? : 1.0 0.1 0.1 0.0005 0.0005 0.0005"] surveyconstraints.XmlUncertainties += [ "TTSystem : 0.5 0.00001 0.0001 0.000001 0.0000001 0.001" ] surveyconstraints.XmlUncertainties += [ "TT..LayerR.Module.*? : 1.0 0.1 0.00001 0.0000001 0.0000001 0.0005" ] print "aligning elements ", elements TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/AlignTracks" # comment following line if one does not want vertex #TAlignment().VertexLocation = "Rec/Vertex/AlignPrimaryVertices" #TAlignment().VertexLocation = "Rec/Vertex/Primary" TAlignment().Constraints = constraints TAlignment().WriteCondSubDetList = ['Velo', 'TT', 'IT', 'OT', 'MUON'] TAlignment().MinNumberOfHits = 6 #TAlignment().SolvTool = "gslSVDsolver" TAlignment().DimuonLocation = "Rec/Vertex/DiMuon" # still set up a track selection from Configurables import (GaudiSequencer, TrackListRefiner, TrackListMerger, TrackSelector, TrackMonitor, ITTrackSelector, ITTrackMonitor, TrackHitAdder, TrackDoubleHitPruner, TrackOTClusterPruner)
# configure for half-Stations from TAlignment.Alignables import * elements = Alignables() #elements.Muon('Tx') ; #elements.MuonHalfStations(dof) ; elements.MuonHalfStationsCside(dof) elements.MuonHalfStationsAside(dof) # Go past this line only when you know what you are doing ############################################################################################################################ ## File to setup Alignment from Configurables import TAlignment, GetElementsToBeAligned TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/AlignTracks" TAlignment().Constraints = constraints TAlignment().SurveyConstraints = chisqconstraints TAlignment().WriteCondSubDetList = ['Muon', 'OT'] TAlignment().CondFilePrefix = 'MyXml/' TAlignment().OutputLevel = outputlevel # ok TAlignment().UseLocalFrame = uselocalframe elementtool = GetElementsToBeAligned( "GetElementsToBeAligned") # aggiunta di Silvia ?? elementtool.UseLocalFrame = False # aggiunta di Silvia ?? # add all 'private' reconstruction to this sequence which is automatically added to the alignment sequence. from Configurables import GaudiSequencer trackFilterSeq = GaudiSequencer("TrackFilterSeq")