def configureEarlyDataAlignment(fixQOverPBias=True):
    TAlignment().WriteCondSubDetList += ['Velo', 'TT', 'IT', 'OT', 'Muon']

    # define the alignment elements
    elements = Alignables()
    elements.Velo("None")
    elements.VeloRight("Tx")
    elements.VeloLeft("Tx")
    elements.IT("None")
    elements.ITBoxes("TxTzRz")
    elements.ITLayers("TxTz")
    elements.OT("None")
    elements.OTCFrames("Tx")
    elements.OTCFrameLayers("Tz")
    elements.TT("None")
    elements.TTLayers("None")
    elements.TTModules("TxRz")
    elements.Tracker("None")
    TAlignment().ElementsToAlign = list(elements)

    # make sure that the velo stays where it was
    TAlignment().Constraints = constraints = []
    constraints.append("VeloHalfAverage : Velo/Velo(Left|Right) : Tx ")
    # fix the q/p scale by not moving T in X. note that you do not
    # want to do this if you use D0 in the alignment
    if fixQOverPBias:
        constraints.append("OT3X : OT/T3X1U.Side : Tx")

    # tweak the survey a little bit to fix the z-scale to survey
    surveyconstraints = SurveyConstraints()
    surveyconstraints.All()
    # make sure we fix the z-scale
    surveyconstraints.XmlUncertainties += [
        "OT/T3X1U : 0.5 0.5 0.00001 0.0001 0.0001 0.0001"
    ]
Esempio n. 2
0
def myconfigureVeloSensorAlignment():
    TAlignment().WriteCondSubDetList  += ['Velo']

    elements = Alignables()
    elements.Velo("None")
    #elements.VeloRight("Tx") # Se aggiungo o tolgo alignables cambiarlo anche ai constrains
    #elements.VeloLeft("Tx")  # Se aggiungo o tolgo alignables cambiarlo anche ai constrains
    elements.VeloRight("TxTyTzRxRyRz") # Se aggiungo o tolgo alignables cambiarlo anche ai constrains
    elements.VeloLeft("TxTyTzRxRyRz")  # Se aggiungo o tolgo alignables cambiarlo anche ai constrains
    # elements.VeloRight("None") # Se aggiungo o tolgo alignables cambiarlo anche ai constrains
    # elements.VeloLeft("None")  # Se aggiungo o tolgo alignables cambiarlo anche ai constrains
    #elements.VeloModules("TxRy")
    #elements.VeloModules("TxTyTzRxRyRz")#('None')#
    elements.VeloModules("TxTyRz")#('None')#
    elements.VeloPhiSensors('None')#("TxTy")
    elements.VeloRSensors("None")
    TAlignment().ElementsToAlign += list(elements)

    surveyconstraints = SurveyConstraints()

    surveyconstraints.All()

    # For MC I have to use different Constraints because Tz is different!
    surveyconstraints.XmlFiles[:2] = ['../../Modules.xml', '../../Detectors.xml']
    
    print surveyconstraints
    constraints = []
    # surveyconstraints.XmlUncertainties += ["Velo/VeloLeft/Module10 : 0.000002 0.000002 0.000002 0.00000002 0.00000002 0.00000002"]
    # surveyconstraints.XmlUncertainties += ["Velo/VeloLeft/Module10/RPhiPair10/Detector-00 : 0.0000002 0.0000002 0.0000002 0.00000002 0.00000002 0.00000002"]
    # surveyconstraints.XmlUncertainties += ["Velo/VeloLeft/Module10/RPhiPair10/Detector-01 : 0.0000002 0.0000002 0.0000002 0.00000002 0.00000002 0.00000002"]

   
    # Global 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" ]
    
    # fix average mean and modules inside each half
    constraints.append( "VeloHalfAverage  : Velo/Velo(Left|Right) :  Tx Ty Tz Rx Ry Rz: total" )
   

    constraints.append("VeloAInternal : Velo/VeloRight/Module..: Tx Ty Rz Szx Szy")
    constraints.append("VeloCInternal : Velo/VeloLeft/Module..: Tx Ty Rz  Szx Szy")


    
    # constraints.append("VeloFixModule10 : Velo/VeloLeft/Module10: Tx Ty Tz Rx Ry Rz")
    # constraints.append("VeloFixModule11 : Velo/VeloRight/Module11: Tx Ty Tz Rx Ry Rz")
    # constraints.append("VeloFixModule32 : Velo/VeloLeft/Module32: Tx Ty Tz Rx Ry Rz")
    # constraints.append("VeloFixModule33 : Velo/VeloRight/Module33: Tx Ty Tz Rx Ry Rz")
    
    # constraints.append("VeloFixSensors10 : Velo/VeloLeft/Module10/RPhiPair10/.*: Tx Ty Tz Rx Ry Rz")
    # constraints.append("VeloFixSensors11 : Velo/VeloRight/Module11/RPhiPair11/.*: Tx Ty Tz Rx Ry Rz")
    # constraints.append("VeloFixSensors32 : Velo/VeloLeft/Module32/RPhiPair32/.*: Tx Ty Tz Rx Ry Rz")
    # constraints.append("VeloFixSensors33 : Velo/VeloRight/Module33/RPhiPair33/.*: Tx Ty Tz Rx Ry Rz")

    
    print TAlignment().Constraints
    TAlignment().Constraints      = constraints
    print TAlignment().Constraints
def configureVeloHalfAlignment():
    TAlignment().WriteCondSubDetList += ['Velo']

    # define the alignment elements
    elements = Alignables()
    elements.Velo("None")
    elements.VeloRight("TxTyTzRxRyRz")
    elements.VeloLeft("TxTyTzRxRyRz")
    TAlignment().ElementsToAlign = list(elements)

    # make sure that the velo stays where it was
    TAlignment().Constraints = constraints = []
    constraints.append(
        "VeloHalfAverage : Velo/Velo(Left|Right) : Tx Ty Tz Rx Ry Rz")

    # tweak the survey a little bit to fix the z-scale to survey
    surveyconstraints = SurveyConstraints()
    surveyconstraints.All()
def configureVeloModuleAlignment():
    '''
    Align Modues only for only the main degrees of freedom Tx Ty Rz
    Constrain two modules in each half
    '''
    TAlignment().WriteCondSubDetList += ['Velo']

    elements = Alignables()
    elements.Velo("None")
    elements.VeloRight("None")
    elements.VeloLeft("None")
    elements.VeloModules("TxTyRz")
    elements.VeloPhiSensors("None")
    elements.VeloRSensors("None")
    TAlignment().ElementsToAlign += list(elements)

    # Constraints
    surveyconstraints = SurveyConstraints()
    surveyconstraints.All()
    constraints = []

    # 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")

    # Constrain average
    # constraints.append("VeloAInternal : Velo/VeloRight/Module..: Tx Ty Rz Szx Szy")
    # constraints.append("VeloCInternal : Velo/VeloLeft/Module..: Tx Ty Rz  Szx Szy")

    TAlignment().Constraints = constraints
def configureVeloSensorAlignment():
    TAlignment().WriteCondSubDetList += ['Velo']

    # To align at the sensor level, we align 'modules' and
    #'phi-sensors'. The R-sensor is always equal to the modules. (We
    #keep its 'deltas' equal to zero.) However, because of a feature
    #in the way we keep track of mother-daughter relations, it is
    #important to create alignables for the R-sensors as well: use
    #"None" to specify an alignable without active degrees of
    #freedom.

    # Note also that it doesn't make sense to align R modules for
    # rotations around the z-axis. Rather than aligning the phi sensor
    # for this rotation, we put the rotation at the module level.

    elements = Alignables()
    elements.Velo("None")
    elements.VeloRight("TxTyTzRxRyRz")
    elements.VeloLeft("TxTyTzRxRyRz")
    elements.VeloModules("TxTyTzRxRyRz")
    elements.VeloPhiSensors("TxTy")
    elements.VeloRSensors("None")
    TAlignment().ElementsToAlign += list(elements)

    # 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.
    TAlignment().Constraints.append(
        "VeloHalfAverage : Velo/Velo(Left|Right) : Tx Ty Tz Rx Ry Rz")

    # now constrain the total shearing and z-scale in each Velo half
    # to get the z-axis nominal. we'll do this by tightening the
    # survey errors.

    # we need to align the relative twist of the two halves. the
    # C-side (minus X, Right) is known to have a corkscrew ('twist')
    # in the base plate. so, for the right half we don't fix the Rz rotation:
    surveyconstraints = SurveyConstraints()
    surveyconstraints.All()
def configureMuonAlignment(surveyVer='latest'):
    TAlignment().WriteCondSubDetList += ['Muon']

    # change convergence criteria
    updatetool = Al__AlignUpdateTool("Al::AlignUpdateTool")
    updatetool.MaxDeltaChi2PDofForConvergence = 2
    updatetool.MaxModeDeltaChi2ForConvergence = 10

    # define the alignment elements
    elements = Alignables()

    elements.MuonHalfStations("TxTy")
    TAlignment().ElementsToAlign = list(elements)

    # make sure that the velo stays where it was
    constraints = []
    TAlignment().Constraints = constraints

    if surveyVer == None: return
    # tweak the survey a little bit to fix the z-scale to survey
    surveyconstraints = SurveyConstraints()
    surveyconstraints.All(surveyVer)
    """
def configureTrackerAlignment(fixQOverPBias=False, surveyVer='latest'):
    TAlignment().WriteCondSubDetList += ['TT', 'IT', 'OT']

    # define the alignment elements
    elements = Alignables()
    elements.Velo("None")
    elements.VeloRight("None")
    elements.VeloLeft("None")
    elements.IT("None")
    elements.ITBoxes("TxTzRz")
    elements.ITLayers("None")
    elements.OT("None")
    elements.OTCFrames("TxRz")
    elements.OTCFrameLayers("Tz")
    elements.OTModules("TxRz")
    elements.TT("None")
    elements.TTLayers("Tz")
    elements.TTModules("TxRz")
    elements.Tracker("None")
    TAlignment().ElementsToAlign = list(elements)

    # make sure that the velo stays where it was
    constraints = []
    # fix the q/p scale by not moving T in X. note that you do not
    # want to do this if you use D0 in the alignment
    if fixQOverPBias:
        constraints.append("OT3X : OT/T3X1U.Side : Tx")
    TAlignment().Constraints = constraints

    if surveyVer == None: return
    # tweak the survey a little bit to fix the z-scale to survey
    surveyconstraints = SurveyConstraints()
    surveyconstraints.All(surveyVer)
    # make sure we fix the z-scale
    surveyconstraints.XmlUncertainties += [
        "OT/T3X1U : 0.5 0.5 0.00001 0.0001 0.0001 0.0001"
    ]
#elements.TTBoxes("Ry")
#elements.TTHalfLayers("Tx")
#elements.TTHalfModules("TxRz")
elements.TTModules("TxRz")

elements.Tracker("None")
# let's try this:
# elements.Tracker("TxTzRxRz") This doesn't solve anything ... we need to look somewhere else

# to get Fred's y alignment from survey
elements.OTStations("Ty")
elements.TT("Ty")
elements.ITBoxes("Ty")
elements.ITLayers("Ty")

surveyconstraints = SurveyConstraints()
surveyconstraints.All()
constraints = []

# make sure that the velo stays where it was
constraints.append(
    "VeloHalfAverage : Velo/Velo(Left|Right) : Tx Ty Tz Rx Ry : total")

# we fix the OT x, until we have seen magnet-off data
# fix the X-position of OT in T3 two C-frames:
# release the constraint now that we have J/psi
# constraints.append("OT3X : OT/T3X1U.Side : Tx")
# now fix OT2 because this was the only one that wasn't moved
constraints.append("OT2X : OT/T2X1U.Side : Tx")

# fix two C-frame layers in Z
outputlevel = ERROR  # INFO
outputlevel2 = ERROR  # INFO

nameCond = 'RunBdownVeloClosed'
OTMuonMatching = True  # Matches the OT tracks to the Muon tracks
OTMuon_ntuple = False  # if True writes an Ntuple for debugging purposes
filterMuonTracks = True  # filters the Muon track sample

from TAlignment.Alignables import *
from TAlignment.SurveyConstraints import *

elements = Alignables()
elements.MuonHalfStations(dof)
# configure for Muon half-Stations

surveyconstraints = SurveyConstraints()
surveyconstraints.MUON()
#surveyconstraints.append("Muon/M1/M1ASide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M1/M1CSide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M2/M2ASide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M2/M2CSide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M3/M3ASide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M3/M3CSide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M4/M4ASide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M4/M4CSide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M5/M5ASide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")
#surveyconstraints.append("Muon/M5/M5CSide : 0 0 0 0 0 0 : 10 10 30 0.001 0.005 0.001")

#constraints.append("Muon/M2ASide : Muon/M2/M2ASide : Tx Ty")
#constraints.append("Muon/M2CSide : Muon/M2/M2CSide : Tx Ty")
print ' List of elements '
Escher().SpecialData = [ "earlyData" ]
Escher().DatasetName = "Collisions2010"
TrackSys().ExpertTracking += [ "simplifiedGeometry"]
TrackSys().TrackExtraInfoAlgorithms = ['']
RecSysConf().RecoSequence = ["Decoding","VELO","TT","IT","OT","Tr","Vertex"]
Escher().MoniSequence = ["Tr","OT","ST"]

from Configurables import MagneticFieldSvc
MagneticFieldSvc().OutputLevel = 1

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

constraints = []
surveyconstraints = SurveyConstraints()
surveyconstraints.All()
elements = Alignables()

elements.Velo("None")
elements.VeloRight("TxTyTzRxRyRz")
elements.VeloLeft("TxTyTzRxRyRz")
elements.VeloModules("TxTyTzRz")
elements.VeloPhiSensors("TxTy")
elements.VeloRSensors("None")

elements.ITBoxes("TxTyTzRzRyRx")
elements.ITLayers("TxTzRx")
elements.ITLadders("TxRz")
elements.OTCFrames("TxTy")
elements.OTCFrameLayers("Tz")
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
Esempio n. 12
0
def myconfigureTTAlignment():
#    TAlignment().WriteCondSubDetList  += ['TT']
#
#    elements = Alignables()
#    elements.TT("None")
#    elements.TTLayers("None")
#    elements.TTHalfLayers("None")
#    elements.TTSplitLayers("None")
#    elements.TTBoxes("None")
#    elements.TTHalfModules("None")
#    elements.TTModules("None")
#    TAlignment().ElementsToAlign += list(elements)
    TAlignment().WriteCondSubDetList += ['TT','IT','OT']
 
    # define the alignment elements
    elements = Alignables()
    elements.Velo("None")
    elements.VeloRight("None")
    elements.VeloLeft("None")
    elements.IT("None")
    elements.ITBoxes("TxTzRz")
    elements.ITLayers("None")
    elements.OT("None")
    elements.OTCFrames("TxRz")
    elements.OTCFrameLayers("Tz")
    elements.OTModules("TxRz")
    elements.TT("None")
    elements.TTLayers("Tz")
    elements.TTModules("TxRz")
    elements.Tracker("None")
    TAlignment().ElementsToAlign = list(elements)

    surveyconstraints = SurveyConstraints()

    #    surveyconstraints.All()

    # For MC I have to use different Constraints because Tz is different!
    # surveyconstraints.XmlFiles[:2] = ['../../Modules.xml', '../../Detectors.xml']

    # MC constraints (all zeros)
    # Muon
    #surveyconstraints.Muon()
    # OT
    surveyconstraints.Constraints  = [ "OT/.*?M. : 0 0 0 0 0 0 : 0.05 0.05 0.05 0.00001 0.001 0.00001",
                                       "OTSystem : 0 0 0 0 0 0 : 1 1 1 0.001 0.001 0.001" ]
    # TT
    surveyconstraints.Constraints += [ "TTSystem             : 0 0 0 0 0 0 : 0.5 0.5 0.5 0.001 0.001 0.001",
                                       "TT.                  : 0 0 0 0 0 0 : 0.1 0.1 0.1 0.0005 0.0005 0.0005",
                                       "TT..Layer            : 0 0 0 0 0 0 : 0.1 0.1 0.1 0.0005 0.0005 0.0005",
                                       "TT..Layer.Side       : 0 0 0 0 0 0 : 0.1 0.1 0.1 0.0005 0.0005 0.0005",
                                       "TT..LayerR.Module.*? : 0 0 0 0 0 0 : 0.1 0.1 0.1 0.0005 0.0005 0.0005",
                                       "TT.*?(Low|High)Z     : 0 0 0 0 0 0 : 0.1 0.1 1.0 0.0005 0.0005 0.0005",
                                       "TTASide : 0 0 0 0 0 0 : 0.2 0.2 0.2 0.001 0.001 0.001",
                                       "TTCSide : 0 0 0 0 0 0 : 0.2 0.2 0.2 0.001 0.001 0.001"  ]
    # IT
    surveyconstraints.Constraints += [ "ITSystem                   : 0 0 0 0 0 0 : 1 1 1 0.01 0.01 0.01",
                                       "ITT.                       : 0 0 0 0 0 0 : 0.5 0.5 0.5 0.001 0.001 0.001",
                                       "ITT.*?Box                  : 0 0 0 0 0 0 : 0.5 0.5 0.5 0.001 0.001 0.001",
                                       "ITT.*?Layer.{1,2}          : 0 0 0 0 0 0 : 0.2 0.05 0.05 0.0001 0.0001 0.001",
                                       "ITT.*?Layer(X1U|VX2)       : 0 0 0 0 0 0 : 0.2 0.05 0.05 0.0001 0.0001 0.001",
                                       "ITT.*?Layer.{1,2}Ladder.*? : 0 0 0 0 0 0 : 0.1 0.02 0.02 0.0001 0.0001 0.001" ]
    # Other
    surveyconstraints.Constraints += [ "Tracker : 0 0 0 0 0 0 : 10 10 10 0.1 0.1 0.1",
                                       "TStations : 0 0 0 0 0 0 : 10 10 10 0.1 0.1 0.1" ]

    
    print surveyconstraints
Esempio n. 13
0
        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
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",
                                     MaxChi2Cut = 10,
)
                       ) 
trackFilterSeq.Members.append( alignSelector )

GaudiSequencer("RecoDecodingSeq").Members = [ "UnpackMCVertex",