ATLAS Offline Software
Functions | Variables
CreateMisalignmentITk Namespace Reference

Functions

def blockFolder (ca, folder)
 
def getFlags (**kwargs)
 
def CreateMis (flags, name="CreateITkMisalignAlg", **kwargs)
 

Variables

 kwargs = dict(arg.split('=') for arg in sys.argv[1:])
 
def flags = getFlags(**kwargs)
 
def acc = CreateMis(flags,**kwargs)
 
def sc = acc.run(10)
 

Function Documentation

◆ blockFolder()

def CreateMisalignmentITk.blockFolder (   ca,
  folder 
)

Definition at line 18 of file CreateMisalignmentITk.py.

18 def blockFolder(ca,folder):
19  "Block use of specified conditions DB folder so data can be read from elsewhere"
20  from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg
21  ca.merge(IOVDbSvcCfg(flags))
22  iovdbsvc=ca.getService("IOVDbSvc")
23  # check existing list of folders and remove it if found
24  for i in range(0,len(iovdbsvc.Folders)):
25  if (iovdbsvc.Folders[i].find(folder)>=0):
26  del iovdbsvc.Folders[i]
27  break
28  condInputLoader=ca.getCondAlgo("CondInputLoader")
29  for i in range(0, len(condInputLoader.Load)):
30  if (folder in condInputLoader.Load[i][-1] ):
31  del condInputLoader.Load[i]
32  break
33 
34 

◆ CreateMis()

def CreateMisalignmentITk.CreateMis (   flags,
  name = "CreateITkMisalignAlg",
**  kwargs 
)

Definition at line 75 of file CreateMisalignmentITk.py.

75 def CreateMis(flags,name="CreateITkMisalignAlg",**kwargs):
76  #
77  #--------------------------------------------------------------
78  # Geometry section
79  #--------------------------------------------------------------
80  misalignmentOnTopOfExistingSet = False
81  readDBPoolFile = False
82 
83  createFreshDB = not(readDBPoolFile or misalignmentOnTopOfExistingSet)
84 
85  MisalignMode = kwargs.pop('MisalignMode',11)
86 
87  shiftInMicrons = 100
88 
89  if MisalignMode in [11, 12, 31]:
90  shiftInMicrons = 500
91  outFiles = 'MisalignmentSet%s' % (MisalignMode)
92  misalignModeMap = {0:'no Misalignment',
93  1: 'misalignment by 6 parameters',
94  2: 'random misalignment',
95  3: 'IBL-stave temperature dependent bowing',
96  11: 'R deltaR (radial expansion)', 12: 'Phi deltaR (ellipse)',13: 'Z deltaR (funnel)',
97  21: 'R deltaPhi (curl)', 22: 'Phi deltaPhi (clamshell) ',23:'Z deltaPhi (twist)',
98  31: 'R deltaZ (telescope)',32:'Phi deltaZ (skew)',33:'Z deltaZ (z-expansion)'}
99 
100 
101  acc=MainServicesCfg(flags)
102  print ("\n CreateMisalignAlg: Creation of misalignment mode %s: %s \n" % (int(MisalignMode),misalignModeMap.get(int(MisalignMode),'unknown')))
103  kwargs.setdefault("ASCIIFilenameBase",outFiles)
104  kwargs.setdefault("SQLiteTag",'MisalignmentMode_'+str(misalignModeMap.get(int(MisalignMode),'unknown')))
105  kwargs.setdefault("MisalignMode",int(MisalignMode))
106  kwargs.setdefault("MaxShift",shiftInMicrons)
107  kwargs.setdefault("CreateFreshDB",createFreshDB)
108  #Create and configure the AlignDB tool
109 
110  outputAlignFolder="/Indet/AlignITk" #The folder name from which initial misalignments should be read - currently may clash if this is the same is the input folder!
111 
112  writeDBPoolFile=True #Activate or deactivate writing to outFiles + '.pool.root'
113  kargsTool={}
114  kargsTool.setdefault("SCTTwoSide",True)
115  kargsTool.setdefault("DBRoot",outputAlignFolder)
116  kargsTool.setdefault("DBKey",outputAlignFolder)
117  kargsTool.setdefault("forceUserDBConfig",True)
118  if writeDBPoolFile:
119  print("Writing DB Pool File")
120  InDetCondStream=CompFactory.AthenaOutputStreamTool("CondStream_write",OutputFile = outFiles+'.pool.root')
121  InDetCondStream.PoolContainerPrefix="<type>"
122  InDetCondStream.TopLevelContainerName=""
123  InDetCondStream.SubLevelBranchName="<key>"
124  kargsTool.setdefault("CondStream",InDetCondStream)
125  dbTool = acc.popToolsAndMerge(ITkAlignDBTool(flags,**kargsTool))
126 
127  kwargs.setdefault("IDAlignDBTool",dbTool)
128 
129  cfg=CreateITkMisalignAlgCfg(flags,name=name,**kwargs)
130 
131  acc.merge(cfg)
132  if writeDBPoolFile:
133  print("To be writen DB pool File")
134 
135  return acc
136 

◆ getFlags()

def CreateMisalignmentITk.getFlags ( **  kwargs)

Definition at line 35 of file CreateMisalignmentITk.py.

35 def getFlags(**kwargs):
36  flags=initConfigFlags()
37 
38  flags.Input.isMC = True
39 
40  flags.Input.Files = []
41 
42  from AthenaConfiguration.TestDefaults import defaultGeometryTags,defaultConditionsTags
43  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
44  flags.GeoModel.Align.Dynamic = False
45 
46  flags.ITk.Geometry.isAlignable = True
47 
48  flags.ITk.Geometry.AllLocal = False
49  detectors = [
50  "ITkPixel",
51  "ITkStrip",
52  "Bpipe"
53  ]
54  setupDetectorFlags(flags, custom_list=detectors, toggle_geometry=True)
55  flags.TrackingGeometry.MaterialSource = "Input"
56 
57 
58  #Define the output database file name and add it to the flags
59  if 'MisalignMode' not in kwargs.keys():
60  MisalignMode = 11 # Radial
61  else:
62  MisalignMode=int(kwargs.get('MisalignMode',11))
63  databaseFilename = 'MisalignmentSet%s.db' % (MisalignMode)
64  flags.IOVDb.DBConnection="sqlite://;schema=%s;dbname=OFLCOND" % (databaseFilename)
65  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN4_MC
66 
67 
68  # This should run serially for the moment.
69  flags.Concurrency.NumThreads = 1
70  flags.Concurrency.NumConcurrentEvents = 1
71  flags.lock()
72 
73  return flags
74 

Variable Documentation

◆ acc

def CreateMisalignmentITk.acc = CreateMis(flags,**kwargs)

Definition at line 148 of file CreateMisalignmentITk.py.

◆ flags

def CreateMisalignmentITk.flags = getFlags(**kwargs)

Definition at line 145 of file CreateMisalignmentITk.py.

◆ kwargs

dictionary CreateMisalignmentITk.kwargs = dict(arg.split('=') for arg in sys.argv[1:])

Definition at line 139 of file CreateMisalignmentITk.py.

◆ sc

def CreateMisalignmentITk.sc = acc.run(10)

Definition at line 152 of file CreateMisalignmentITk.py.

CreateMisalignmentITk.CreateMis
def CreateMis(flags, name="CreateITkMisalignAlg", **kwargs)
Definition: CreateMisalignmentITk.py:75
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
InDetAlignAlgsConfig.CreateITkMisalignAlgCfg
def CreateITkMisalignAlgCfg(flags, name="CreateITkMisalignAlg", **kwargs)
Definition: InDetAlignAlgsConfig.py:6
CreateMisalignmentITk.getFlags
def getFlags(**kwargs)
Definition: CreateMisalignmentITk.py:35
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.IOVDbSvcConfig.IOVDbSvcCfg
def IOVDbSvcCfg(flags, **kwargs)
Definition: IOVDbSvcConfig.py:19
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
CreateMisalignmentITk.blockFolder
def blockFolder(ca, folder)
Definition: CreateMisalignmentITk.py:18
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:289
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
InDetAlignGenToolsConfig.ITkAlignDBTool
def ITkAlignDBTool(flags, name="ITkAlignDBTool", **kwargs)
Definition: InDetAlignGenToolsConfig.py:6
str
Definition: BTagTrackIpAccessor.cxx:11