InDetAlignFolders.py 7.7 KB
Newer Older
1
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3

from IOVDbSvc.CondDB import conddb
Peter Hansen's avatar
Peter Hansen committed
4

Peter Hansen's avatar
Peter Hansen committed
5
from AthenaCommon.DetFlags          import DetFlags
6
from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags
7
from OverlayCommonAlgs.OverlayFlags import overlayFlags
Peter Hansen's avatar
Peter Hansen committed
8
9
10
11
12

# Top sequence
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

13
if DetFlags.TRT_on():
Peter Hansen's avatar
Peter Hansen committed
14
# Dead/Noisy Straw Lists
15
16
17
18
    if hasattr(topSequence,"OutputConditionsAlg"): # revert to old style CondHandle in case streaming to POOL
        conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/Status","/TRT/Cond/Status")
    else:
        conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/Status","/TRT/Cond/Status",className='TRTCond::StrawStatusMultChanContainer')
Peter Hansen's avatar
Peter Hansen committed
19

20
21
22
23
    if hasattr(topSequence,"OutputConditionsAlg"):
        conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/StatusPermanent","/TRT/Cond/StatusPermanent")
    else:
        conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/StatusPermanent","/TRT/Cond/StatusPermanent",className='TRTCond::StrawStatusMultChanContainer')
Peter Hansen's avatar
Peter Hansen committed
24
25

# Argon straw list
26
27
28
29
30
31
32
33
    if DetFlags.simulate.any_on() or hasattr(topSequence,"OutputConditionsAlg"):
        conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/StatusHT","/TRT/Cond/StatusHT")
    else:
        conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/StatusHT","/TRT/Cond/StatusHT",className='TRTCond::StrawStatusMultChanContainer')

# TRT Lvl 3 alignment
if DetFlags.TRT_on() :
    conddb.addFolderSplitOnline("TRT","/TRT/Onl/Calib/DX","/TRT/Calib/DX")
34
# Pixel/IBL module distortions
35
if DetFlags.pixel_on() :
36
37
38
    if not conddb.folderRequested("/Indet/PixelDist"):
        conddb.addFolderSplitOnline("INDET","/Indet/Onl/PixelDist","/Indet/PixelDist", className="DetCondCFloat")
        conddb.addFolderSplitOnline("INDET","/Indet/Onl/IBLDist","/Indet/IBLDist",className="CondAttrListCollection")
39

Peter Hansen's avatar
Peter Hansen committed
40
41
# TRT Condition Algorithm
from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTAlignCondAlg
42
43
TRTAlignCondAlg = TRTAlignCondAlg(name = "TRTAlignCondAlg",
                                  UseDynamicFolders = InDetGeometryFlags.useDynamicAlignFolders())
Peter Hansen's avatar
Peter Hansen committed
44

45
# Control loading of the dynamic folder scheme;
46
# In future we might want to add also to MC DB
47
48
49
# related to JIRA ATLASSIM-2746

if InDetGeometryFlags.useDynamicAlignFolders():
50
    conddb.addFolderSplitOnline("INDET","/Indet/Onl/AlignL1/ID","/Indet/AlignL1/ID",className="CondAttrListCollection")
Peter Hansen's avatar
Peter Hansen committed
51
52
53



54
    conddb.addFolderSplitOnline("INDET","/Indet/Onl/AlignL2/PIX","/Indet/AlignL2/PIX",className="CondAttrListCollection")
55
56
    conddb.addFolderSplitOnline("INDET","/Indet/Onl/AlignL2/SCT","/Indet/AlignL2/SCT",className="CondAttrListCollection")
    conddb.addFolderSplitOnline("INDET","/Indet/Onl/AlignL3","/Indet/AlignL3",className="AlignableTransformContainer")
Peter Hansen's avatar
Peter Hansen committed
57
58
59
60
61
    conddb.addFolderSplitOnline("TRT","/TRT/Onl/AlignL1/TRT","/TRT/AlignL1/TRT",className="CondAttrListCollection")
    conddb.addFolderSplitOnline("TRT","/TRT/Onl/AlignL2","/TRT/AlignL2",className="AlignableTransformContainer")
    TRTAlignCondAlg.ReadKeyDynamicGlobal="/TRT/AlignL1/TRT"
    TRTAlignCondAlg.ReadKeyDynamicRegular="/TRT/AlignL2"

62
else:
Susumu Oda's avatar
Susumu Oda committed
63
    if ((not DetFlags.simulate.SCT_on()) or (not DetFlags.simulate.pixel_on())) or (DetFlags.overlay.SCT_on() or DetFlags.overlay.pixel_on()):
Susumu Oda's avatar
Susumu Oda committed
64
        conddb.addFolderSplitOnline("INDET","/Indet/Onl/Align","/Indet/Align",className="AlignableTransformContainer")
Peter Hansen's avatar
Peter Hansen committed
65

Susumu Oda's avatar
Susumu Oda committed
66
67
    else:
        conddb.addFolderSplitOnline("INDET","/Indet/Onl/Align","/Indet/Align")
Peter Hansen's avatar
Peter Hansen committed
68

69
    if (not DetFlags.simulate.TRT_on()) or DetFlags.overlay.TRT_on():
Peter Hansen's avatar
Peter Hansen committed
70
        conddb.addFolderSplitOnline("TRT","/TRT/Onl/Align","/TRT/Align",className="AlignableTransformContainer")
71
72
    else:
        conddb.addFolderSplitOnline("TRT","/TRT/Onl/Align","/TRT/Align")
Peter Hansen's avatar
Peter Hansen committed
73
74
75

from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
76

77
# Condition algorithms for ID alignment
Peter Hansen's avatar
Peter Hansen committed
78
79
80
81
82
83
if DetFlags.TRT_on() and ((not DetFlags.simulate.TRT_on()) or DetFlags.overlay.TRT_on()):
    if not hasattr(condSeq, "TRTAlignCondAlg"):
        import os
        if "AthSimulation_DIR" not in os.environ: # Protection for AthSimulation builds
            condSeq += TRTAlignCondAlg

84
if DetFlags.SCT_on() and ((not DetFlags.simulate.SCT_on()) or DetFlags.overlay.SCT_on()):
Susumu Oda's avatar
Susumu Oda committed
85
    if not hasattr(condSeq, "SCT_AlignCondAlg"):
86
87
88
89
90
91
        import os
        if "AthSimulation_DIR" not in os.environ: # Protection for AthSimulation builds
            from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_AlignCondAlg
            condSeq += SCT_AlignCondAlg(name = "SCT_AlignCondAlg",
                                        UseDynamicAlignFolders =  InDetGeometryFlags.useDynamicAlignFolders())
            if not hasattr(condSeq, "SCT_DetectorElementCondAlg"):
92
93
94
95
96
97
98
                # set up dependencies to limit IOV Range for athena MT
                MuonMgrKey = ""
                TRT_DetEltKey = ""
                PixelAlignStore = ""
                # To avoid setting up conditions algorithms in the right order, only set up for athena MT
                from AthenaCommon.ConcurrencyFlags import jobproperties as jp
                if jp.ConcurrencyFlags.NumThreads() > 0:
99
                    if (DetFlags.Muon_on() and not conddb.isMC and not overlayFlags.isDataOverlay()):
100
101
102
103
104
105
                        MuonMgrKey = "MuonDetectorManager"
                    if DetFlags.TRT_on():
                        TRT_DetEltKey = "TRT_DetElementContainer"
                    if DetFlags.pixel_on():
                        PixelAlignStore = "PixelAlignmentStore"

106
                from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_DetectorElementCondAlg
107
108
109
110
                condSeq += SCT_DetectorElementCondAlg(name = "SCT_DetectorElementCondAlg",
                                                      MuonManagerKey = MuonMgrKey,
                                                      TRT_DetEltContKey = TRT_DetEltKey,
                                                      PixelAlignmentStore = PixelAlignStore)
Peter Hansen's avatar
Peter Hansen committed
111

112
113
114
115
116
117
118
if DetFlags.pixel_on() and ((not DetFlags.simulate.pixel_on()) or DetFlags.overlay.pixel_on()):
    if not hasattr(condSeq, "PixelAlignCondAlg"):
        import os
        if "AthSimulation_DIR" not in os.environ: # Protection for AthSimulation builds
            from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelAlignCondAlg
            condSeq += PixelAlignCondAlg(name = "PixelAlignCondAlg",
                                         UseDynamicAlignFolders =  InDetGeometryFlags.useDynamicAlignFolders())
119
            if not hasattr(condSeq, "PixelDetectorElementCondAlg"):
120
121
122
123
124
125
126
                # set up dependencies to limit IOV Range for athena MT
                MuonMgrKey = ""
                TRT_DetEltKey = ""
                SCTAlignStore = ""
                # To avoid setting up conditions algorithms in the right order, only set up for athena MT
                from AthenaCommon.ConcurrencyFlags import jobproperties as jp
                if jp.ConcurrencyFlags.NumThreads() > 0:
127
                    if (DetFlags.Muon_on() and not conddb.isMC and not overlayFlags.isDataOverlay()):
128
129
130
131
132
133
                        MuonMgrKey = "MuonDetectorManager"
                    if DetFlags.TRT_on():
                        TRT_DetEltKey = "TRT_DetElementContainer"
                    if DetFlags.SCT_on():
                        SCTAlignStore = "SCTAlignmentStore"

134
                from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDetectorElementCondAlg
135
136
137
                condSeq += PixelDetectorElementCondAlg(name = "PixelDetectorElementCondAlg",
                                                    MuonManagerKey = MuonMgrKey,
                                                    TRT_DetEltContKey = TRT_DetEltKey,
138
                                                    SCTAlignmentStore = SCTAlignStore)