ATLAS Offline Software
Classes | Functions | Variables
python.BeamSpotUpdate Namespace Reference

Classes

class  BeamSpotWriteAlg
 
class  Config
 

Functions

def setBeamSpot (run, lb, x, y, z, status=7, dbname='sqlite://;schema=beampos.db;dbname=CONDBR2', tag='IndetBeamposOnl-HLT-UPD1-001-00')
 
def addFolderUpdate (event)
 
def modify (event)
 
def setup ()
 
def run (flags)
 

Variables

 folderList
 
 log
 
 parser
 
 description
 
 metavar
 
 nargs
 
 help
 
 type
 
 int
 
 default
 
 str
 
 args
 
 dr
 
 output
 
 core_name
 
 run_number
 
 trigger_type
 
 detector_mask
 
 beam_type
 
 beam_energy
 
 meta_data_strings
 
 compression
 
 i
 
 newevt
 

Function Documentation

◆ addFolderUpdate()

def python.BeamSpotUpdate.addFolderUpdate (   event)
Add COOL folder update to event

Definition at line 78 of file BeamSpotUpdate.py.

78 def addFolderUpdate(event):
79  """Add COOL folder update to event"""
80 
81  ctp_robs = [rob for rob in event if rob.source_id().subdetector_id()==eformat.helper.SubDetector.TDAQ_CTP]
82 
83  if len(ctp_robs)==0:
84  log.error("Cannot find CTP ROB in event")
85  return event
86 
87  # Copy event except CTP ROBs
88  new_event = eformat.write.FullEventFragment()
89  new_event.copy_header(event)
90  for r in event:
91  if r.source_id().subdetector_id() != eformat.helper.SubDetector.TDAQ_CTP:
92  new_event.append(eformat.write.ROBFragment(r))
93 
94  # Set the CTP extra payload
95  for rob in ctp_robs:
96  x = CTPfragment.ExtraPayload() # start from empty payload object
97  for f in folderList: x.updateFolder(f)
98  new_ctp_rob = CTPfragment.setHltExtraPayloadWords(rob, [d for d in x.serialize()])
99  new_event.append(eformat.write.ROBFragment(new_ctp_rob))
100 
101  return new_event
102 
103 

◆ modify()

def python.BeamSpotUpdate.modify (   event)

Definition at line 104 of file BeamSpotUpdate.py.

104 def modify(event):
105  event = eformat.write.FullEventFragment(event)
106 
107  # Modify LB and HLT counter in CTP fragment
108  newevt = trigbs_modifyEvent.modify(event)
109  lb = newevt.lumi_block()
110 
111  # Write conditions update into CTP fragment
112  if lb in Config.lb_updateBeamspot:
113  lb_for_update,status = Config.lb_updateBeamspot.pop(lb)
114 
115  fe = CTPfragment.FolderEntry()
116  fe.folderIndex = 0 # /Indet/Onl/Beampos
117  fe.lumiBlock = lb_for_update
118  folderList.append(fe)
119  log.info('Added COOL folder update to event: folderIndex=%d, LB=%d', fe.folderIndex,fe.lumiBlock)
120 
121  return addFolderUpdate(newevt).readonly()
122 
123 

◆ run()

def python.BeamSpotUpdate.run (   flags)
CA cfg function to be used from athenaHLT

Definition at line 139 of file BeamSpotUpdate.py.

139 def run(flags):
140  """CA cfg function to be used from athenaHLT"""
141 
142  from AthenaCommon.Constants import DEBUG
143  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
144  from AthenaConfiguration.ComponentFactory import CompFactory
145  from IOVDbSvc.IOVDbSvcConfig import addFolders
146 
147  from pathlib import Path
148 
149  flags.lock()
150  cfg = ComponentAccumulator()
151 
152  # addFolders requires at least an empty sqlite file
153  Path('beampos.db').touch()
154 
155  # These folders are filled in Testing/condStopStart.trans
156  cfg.merge( addFolders(flags, '/Indet/Onl/Beampos <key>/Indet/Beampos</key>',
157  detDb='beampos.db',
158  tag='IndetBeamposOnl-HLT-UPD1-001-00',
159  className='AthenaAttributeList',
160  extensible=True) )
161 
162  cfg.addEventAlgo( BeamSpotWriteAlg() )
163  cfg.addEventAlgo( CompFactory.InDet.InDetBeamSpotReader(VxContainer = "") )
164  cfg.addCondAlgo( CompFactory.BeamSpotCondAlg(OutputLevel = DEBUG) )
165 
166  return cfg
167 
168 
169 # For standalone running and writing a new output file

◆ setBeamSpot()

def python.BeamSpotUpdate.setBeamSpot (   run,
  lb,
  x,
  y,
  z,
  status = 7,
  dbname = 'sqlite://;schema=beampos.db;dbname=CONDBR2',
  tag = 'IndetBeamposOnl-HLT-UPD1-001-00' 
)

Definition at line 62 of file BeamSpotUpdate.py.

62 def setBeamSpot(run,lb,x,y,z,
63  status=7,
64  dbname='sqlite://;schema=beampos.db;dbname=CONDBR2', tag='IndetBeamposOnl-HLT-UPD1-001-00'):
65 
66  log.info('============================= Creating new beamspot in COOL ===================================')
67  log.info('run=%d, lb=%d, x=%f, y=%f, z=%f', run, lb, x, y, z)
68  sys.stdout.flush()
69  os.system("beamSpotOnl_set.py --output=sqlite:beampos.db --run=%d --lbn=%d %d %f %f %f" % (run,lb,status,x,y,z))
70  if log.level<=logging.DEBUG:
71  log.info('Current content of beampos.db sqlite file:')
72  os.system("AtlCoolConsole.py 'sqlite://;schema=beampos.db;dbname=CONDBR2' <<< 'more Indet/Onl/Beampos'")
73  log.info('===============================================================================================')
74  sys.stdout.flush()
75 
76 
77 

◆ setup()

def python.BeamSpotUpdate.setup ( )
Initial setup

Definition at line 124 of file BeamSpotUpdate.py.

124 def setup():
125  """Initial setup"""
126 
127  log.info('Will perform beamspot udpate on these LBs (LB,status): %s', sorted(Config.lb_updateBeamspot.values()))
128 
129  # Delete any previous sqlite file
130  try:
131  os.remove('beampos.db')
132  except OSError:
133  pass
134 
135  # Create an open-ended IOV with a default beamspot
136  setBeamSpot(1,0,0.06,1.06,-4.6,4)
137 
138 

Variable Documentation

◆ args

python.BeamSpotUpdate.args

Definition at line 179 of file BeamSpotUpdate.py.

◆ beam_energy

python.BeamSpotUpdate.beam_energy

Definition at line 186 of file BeamSpotUpdate.py.

◆ beam_type

python.BeamSpotUpdate.beam_type

Definition at line 185 of file BeamSpotUpdate.py.

◆ compression

python.BeamSpotUpdate.compression

Definition at line 188 of file BeamSpotUpdate.py.

◆ core_name

python.BeamSpotUpdate.core_name

Definition at line 181 of file BeamSpotUpdate.py.

◆ default

python.BeamSpotUpdate.default

Definition at line 176 of file BeamSpotUpdate.py.

◆ description

python.BeamSpotUpdate.description

Definition at line 174 of file BeamSpotUpdate.py.

◆ detector_mask

python.BeamSpotUpdate.detector_mask

Definition at line 184 of file BeamSpotUpdate.py.

◆ dr

python.BeamSpotUpdate.dr

Definition at line 180 of file BeamSpotUpdate.py.

◆ folderList

python.BeamSpotUpdate.folderList

Definition at line 35 of file BeamSpotUpdate.py.

◆ help

python.BeamSpotUpdate.help

Definition at line 175 of file BeamSpotUpdate.py.

◆ i

python.BeamSpotUpdate.i

Definition at line 190 of file BeamSpotUpdate.py.

◆ int

python.BeamSpotUpdate.int

Definition at line 176 of file BeamSpotUpdate.py.

◆ log

python.BeamSpotUpdate.log

Definition at line 36 of file BeamSpotUpdate.py.

◆ meta_data_strings

python.BeamSpotUpdate.meta_data_strings

Definition at line 187 of file BeamSpotUpdate.py.

◆ metavar

python.BeamSpotUpdate.metavar

Definition at line 175 of file BeamSpotUpdate.py.

◆ nargs

python.BeamSpotUpdate.nargs

Definition at line 175 of file BeamSpotUpdate.py.

◆ newevt

python.BeamSpotUpdate.newevt

Definition at line 195 of file BeamSpotUpdate.py.

◆ output

python.BeamSpotUpdate.output

Definition at line 181 of file BeamSpotUpdate.py.

◆ parser

python.BeamSpotUpdate.parser

Definition at line 174 of file BeamSpotUpdate.py.

◆ run_number

python.BeamSpotUpdate.run_number

Definition at line 182 of file BeamSpotUpdate.py.

◆ str

python.BeamSpotUpdate.str

Definition at line 177 of file BeamSpotUpdate.py.

◆ trigger_type

python.BeamSpotUpdate.trigger_type

Definition at line 183 of file BeamSpotUpdate.py.

◆ type

python.BeamSpotUpdate.type

Definition at line 176 of file BeamSpotUpdate.py.

python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
python.BeamSpotUpdate.modify
def modify(event)
Definition: BeamSpotUpdate.py:104
python.BeamSpotUpdate.setBeamSpot
def setBeamSpot(run, lb, x, y, z, status=7, dbname='sqlite://;schema=beampos.db;dbname=CONDBR2', tag='IndetBeamposOnl-HLT-UPD1-001-00')
Definition: BeamSpotUpdate.py:62
Constants
some useful constants -------------------------------------------------—
python.BeamSpotUpdate.addFolderUpdate
def addFolderUpdate(event)
Definition: BeamSpotUpdate.py:78
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
python.setup
def setup()
Definition: Control/Hephaestus/python/__init__.py:9