general-settings.py

Source

#####################################
# File for running TT alignment on 2010 data 
#####################################

from Configurables import ( Escher, TrackSys, RecSysConf )
from Gaudi.Configuration import *                                                                                                                                   
from GaudiConf.Configuration import * 

from GaudiKernel.ProcessJobOptions import importOptions
importOptions('$STDOPTS/PreloadUnits.opts')

### select alignment algorithm
Escher().Kalman = True
#Escher().Millepede = False  # default anyway

### Output verbosity
Escher().OutputLevel = 4 

### name used for output 
Escher().DatasetName = 'my2010'

### not needed for Kalman
# Escher().Detectors = ["TT"] 


#### 
# Remove stuff not needed for alignment from sequences
####

### possible simplifications for Tracking (speed improvements)
### noMaterialCorrections, noDrifttimes, simplifiedGeometry, [fastSequence]
TrackSys().ExpertTracking += [ "simplifiedGeometry"]

### Algorithms to use when finding tracks
### "Velo","VeloTT","TsaSeed","Match","Downstream","Forward"
TrackSys().TrackPatRecAlgorithms = ["Velo","VeloTT","TsaSeed","Match","Downstream","Forward"]

### Additional sequence to fill properties
TrackSys().TrackExtraInfoAlgorithms = ['']

### Setup Reconstruction Sequence
### "VELO","TT","IT","OT","Tr","Vertex","CALO","Decoding"
RecSysConf().RecoSequence = ["Decoding","VELO","TT","IT","OT","Tr"]

### What do you want to Monitor
### "VELO","Tr","OT","ST"
Escher().MoniSequence = ["Tr", "OT","ST"]



####
# CONFIGURE ALIGNMENT
####

from Configurables import TAlignment
from TAlignment.Alignables import *
from TAlignment.SurveyConstraints import *
from Configurables import  Al__AlignChisqConstraintTool

elements = Alignables()


### Detector elements and degrees of freedom to align
elements.TT("TxTyTz")
elements.TTLayers("TxTz")
#elements.TTModules("Tx")
#elements.TTHalfModules("Tx")
#elements.TTHalfLayers("Ry")
#elements.TTBoxes("Ry")

#elements.VeloRight("Ry")
#elements.VeloLeft("Ry")
print "aligning elements ", elements


### Survey Constraints to usea
### All this will be changed soon, wait for new version
surveyconstraints = SurveyConstraints()
surveyconstraints.All()
#surveyconstraints.TT()

#surveyconstraints += ["TTaXLayer : 0 0 0 0 0 0 : 0.5 0.5 0.5 0.0002 0.0002 0.0002"]
#surveyconstraints += ["TTaULayer : 0 0 0 0 0 0 : 0.5 0.5 0.5 0.0002 0.0002 0.0002"]
#surveyconstraints += ["TTbVLayer : 0 0 0 0 0 0 : 0.5 0.5 0.5 0.0002 0.0002 0.0002"]
#surveyconstraints += ["TTbXLayer : 0 0 0 0 0 0 : 0.5 0.5 0.5 0.0002 0.0002 0.0002"]


### Additional Constaints
constraints = []
#constraints += [".*?/TT/TT(a|b) : Tz : 0.01"]
#constraints += [" TT Layers : TT/TT(a|b)/TT..Layer : Tz : total"]#,
#constraints += [" TT Layers : TT/TT(a|b)/TT..Layer : Tz "]
#constraints += [" TTaX Layer : TT/TTa/TTaXLayer : Tz "]

#small errors
# AlignChisqConstraintTool().XmlUncertainties += [
#     "TTSystem             : 0.5 0.5 0.5 0.001 0.001 0.001",
#     "TTaXLayer            : 0.2 0.2 0.2 0.001 0.001 0.001",
#     "TTaULayer            : 0.2 0.2 0.2 0.001 0.001 0.001",
#     "TTbVLayer            : 0.2 0.2 0.2 0.001 0.001 0.001",
#     "TTbXLayer            : 0.2 0.2 0.2 0.001 0.001 0.001",
#     ]


### add config to alignment tool
TAlignment().ElementsToAlign      = list(elements)
#TAlignment().SurveyConstraints    = list(surveyconstraints) # not needed anymore since Alignment v4r2
TAlignment().Constraints          = constraints

### Tracks used for Alignment
### this container is created by alignSelectorA (see below)
TAlignment().TrackLocation        = "Rec/Track/myAlignTracks"

### Write CondDB for the following subdetectors
TAlignment().WriteCondSubDetList  = ['TT']

### Don't use them
TAlignment().MinNumberOfHits = 30     # number of hits needed before starting to align an element (still constrains tracks)

### Output verbosity
TAlignment().OutputLevel = 6 #FATAL


### Conditions Database
### Mostly configured together with input and on command line using -d option
### useful if a layer needs to be reaplied in every iteration
#from Configurables import (CondDB, CondDBAccessSvc)
#conddb = CondDB()
# conddb.addLayer(
#     CondDBAccessSvc("TTnominal",
#                     ConnectionString = "sqlite_file:/afs/cern.ch/user/c/csalzman/database/myAlign/LHCBCOND.db/LHCBCOND",
#                     DefaultTAG = ""))
#ttPitchFix = CondDBAccessSvc( "TTPitchFix" )
#ttPitchFix.ConnectionString = "sqlite_file:/afs/cern.ch/user/w/wouter/public/AlignDB/TTPitchFix.db/DDDB"
#conddb.addLayer( ttPitchFix )


####
# Selecting and preparing  tracks for alignment
####
from Configurables import GaudiSequencer
from Configurables import TrackListRefiner
from Configurables import (TrackListMerger,
                           TrackSelector,TrackMonitor,TTTrackMonitor) 
trackFilterSeq = GaudiSequencer("TrackFilterSeq")

### Try to add additional hits to tracks if it finds around track 
### look at number TT hits (histogram)
#from Configurables import TrackHitAdder
#trackHitAdder = TrackHitAdder( "TrackHitAdder",TrackLocation = "Rec/Track/Best" )
#GaudiSequencer("TrackAddExtraInfoSeq").Members += [ trackHitAdder ]

### Step 1 - select tracks ###
### create selector, choose input and output location
alignSelectorA = TrackListRefiner("AlignSelectorA",
                                  inputLocation = "Rec/Track/Best",
                                  outputLocation = "Rec/Track/AlignTracksA",
                                  Selector = TrackSelector())

### specify TrackType
### "Long","Downstream","Upstream"
alignSelectorA.Selector.TrackTypes = ["Long", "Upstream"]

### only select reasonable good agreement to hits
alignSelectorA.Selector.MaxChi2Cut = 15

### only select tracks with a reasonable P
alignSelectorA.Selector.MinPCut = 5000

trackFilterSeq.Members += [ alignSelectorA ]


### Step 2 - copy selected tracks to writable location ###
from Configurables import TrackContainerCopy
trackCopy = TrackContainerCopy("ContainerCopy",
                               inputLocation = "Rec/Track/AlignTracksA",
                               outputLocation = "Rec/Track/myAlignTracks")
trackFilterSeq.Members.append(trackCopy)


### Step 3 - refit selected tracks ###
### turn Long into Up-/Downstream tracks
from TrackFitter.ConfiguredFitters import *
refitter = ConfiguredEventFitter( "AlignRefitter",
                                  TracksInContainer = "Rec/Track/myAlignTracks")
### add nodes and measurements to refitted track
refitter.Fitter.MakeNodes        = True
refitter.Fitter.MakeMeasurements = True
refitter.Fitter.addTool( MeasurementProvider(), name = "MeasProvider")

### turn into Downstream
#refitter.Fitter.MeasProvider.IgnoreVelo = True 
### turn into Upstream
refitter.Fitter.MeasProvider.IgnoreIT = True 
refitter.Fitter.MeasProvider.IgnoreOT = True 
### remove bias from TT
#refitter.Fitter.MeasProvider.IgnoreTT = True 

trackFilterSeq.Members += [ refitter ] 

### Step 4 - add track monitors ###
myTrackMonitor = TrackMonitor("myTrackMonitor",
                              TracksInContainer = "Rec/Track/myAlignTracks",
                              FullDetail = True)
trackFilterSeq.Members += [ myTrackMonitor ]

ttTrackMonitor = TTTrackMonitor("myTTTrackMonitor",
                                FullDetail = True,
                                TracksInContainer =  "Rec/Track/myAlignTracks")
trackFilterSeq.Members += [ ttTrackMonitor ]


#from Configurables import NTupleSvc
#ntupleOutputFile = "tuples.root"
#NTupleSvc().Output=["FILE1 DATAFILE='"+ntupleOutputFile+"' TYP='ROOT' OPT='NEW'"]


####
# do additional changes to existing services
####

def doMyAlignChanges():

    ### check if containers are available in DSTs
    ### We don't want that check, as we do our own 
    ### reconstruction anyway
    #from Configurables import TESCheck
    #TESCheck().Stop = False
    #TESCheck().Enable = False
    
    ### after track fit converged, run outlier removal for n-times 
    from Configurables import TrackEventFitter
    from TrackFitter.ConfiguredFitters import ConfiguredStraightLineFitter
    TrackEventFitter('FitMatch').Fitter.MaxNumberOutliers = 0
    TrackEventFitter('FitSeed').Fitter.MaxNumberOutliers = 0
    TrackEventFitter('RefitSeed').Fitter.MaxNumberOutliers = 0
    TrackEventFitter('FitForward').Fitter.MaxNumberOutliers = 0
    TrackEventFitter('FitVelo').Fitter.MaxNumberOutliers = 0
    TrackEventFitter('FitVeloTT').Fitter.MaxNumberOutliers = 0


    # add a filter on Velo tracks
    #from Configurables import TrackListFilter
    #GaudiSequencer("RecoVELOSeq").Members += [TrackListFilter("VeloFilter",
    #                                                          inputLocation = "Rec/Track/Velo")]
    
    from Configurables import TrackMonitor
    TrackMonitor().FullDetail = True

    #from Configurables import TrackHitMapMonitor
    #GaudiSequencer("MoniTrSeq").Members.append( TrackHitMapMonitor() )

appendPostConfigAction(doMyAlignChanges)

Comments

You can download this source as text file.

-- NicolaChiapolini - 23-Jul-2010

Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt general-settings.py.txt r1 manage 8.9 K 2010-07-26 - 14:05 NicolaChiapolini The python file described here.
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2010-11-22 - NicolaChiapolini
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback