ATLAS Offline Software
Classes | Functions
AFPToFMCDBCreate Namespace Reference

Classes

class  AFPDBDict
 
class  folderBulk
 

Functions

def runLBtoDB (run, lb)
 
def makeFolderAndSpec (db, folderName, tag)
 
def main ()
 

Function Documentation

◆ main()

def AFPToFMCDBCreate.main ( )

Definition at line 131 of file AFPToFMCDBCreate.py.

131 def main():
132  dbFile = "ExampleMC.db"
133  dbName = "OFLP200"
134 
135  # remove the old db file so that we can write the new one
136  try:
137  import os
138  os.remove(dbFile)
139  except IOError:
140  pass
141 
142  # get database service and open database
143  dbSvc = cool.DatabaseSvcFactory.databaseService()
144 
145  # database accessed via physical name
146  dbString = "sqlite://;schema=%s;dbname=%s" % (dbFile, dbName)
147  try:
148  db = dbSvc.createDatabase(dbString)
149  except Exception as e:
150  print ('Problem creating database', e)
151  sys.exit(-1)
152  print ("Created database", dbString)
153 
154  # define the folder in the database, its specification and its tag
155  folderBlkLoc_ideal_01=makeFolderAndSpec(db,folderName="/FWD/AFP/ToFParameters/Local", tag="AFPMCToFLoc-ideal-01")
156  folderBlkVtx_ideal_01=makeFolderAndSpec(db,folderName="/FWD/AFP/ToFParameters/Vertex", tag="AFPMCToFVtx-ideal-01")
157 
158 
159  myDict = AFPDBDict(folderBlkLoc_ideal_01)
160  myDict.append(stationID=0, trainID=0, barID=0, barWeight=1.0, barTimeOffset=1494.0)
161  myDict.append(stationID=0, trainID=0, barID=1, barWeight=1.0, barTimeOffset=1500.0)
162  myDict.append(stationID=0, trainID=0, barID=2, barWeight=1.0, barTimeOffset=1500.0)
163  myDict.append(stationID=0, trainID=0, barID=3, barWeight=1.0, barTimeOffset=1500.0)
164  myDict.append(stationID=0, trainID=1, barID=0, barWeight=1.0, barTimeOffset=1500.0)
165  myDict.append(stationID=0, trainID=1, barID=1, barWeight=1.0, barTimeOffset=1500.0)
166  myDict.append(stationID=0, trainID=1, barID=2, barWeight=1.0, barTimeOffset=1500.0)
167  myDict.append(stationID=0, trainID=1, barID=3, barWeight=1.0, barTimeOffset=1500.0)
168  myDict.append(stationID=0, trainID=2, barID=0, barWeight=1.0, barTimeOffset=1500.0)
169  myDict.append(stationID=0, trainID=2, barID=1, barWeight=1.0, barTimeOffset=1500.0)
170  myDict.append(stationID=0, trainID=2, barID=2, barWeight=1.0, barTimeOffset=1500.0)
171  myDict.append(stationID=0, trainID=2, barID=3, barWeight=1.0, barTimeOffset=1500.0)
172  myDict.append(stationID=0, trainID=3, barID=0, barWeight=1.0, barTimeOffset=1500.0)
173  myDict.append(stationID=0, trainID=3, barID=1, barWeight=1.0, barTimeOffset=1500.0)
174  myDict.append(stationID=0, trainID=3, barID=2, barWeight=1.0, barTimeOffset=1500.0)
175  myDict.append(stationID=0, trainID=3, barID=3, barWeight=1.0, barTimeOffset=1500.0)
176  myDict.append(stationID=3, trainID=0, barID=0, barWeight=1.0, barTimeOffset=1500.0)
177  myDict.append(stationID=3, trainID=0, barID=1, barWeight=1.0, barTimeOffset=1500.0)
178  myDict.append(stationID=3, trainID=0, barID=2, barWeight=1.0, barTimeOffset=1500.0)
179  myDict.append(stationID=3, trainID=0, barID=3, barWeight=1.0, barTimeOffset=1500.0)
180  myDict.append(stationID=3, trainID=1, barID=0, barWeight=1.0, barTimeOffset=1500.0)
181  myDict.append(stationID=3, trainID=1, barID=1, barWeight=1.0, barTimeOffset=1500.0)
182  myDict.append(stationID=3, trainID=1, barID=2, barWeight=1.0, barTimeOffset=1500.0)
183  myDict.append(stationID=3, trainID=1, barID=3, barWeight=1.0, barTimeOffset=1500.0)
184  myDict.append(stationID=3, trainID=2, barID=0, barWeight=1.0, barTimeOffset=1500.0)
185  myDict.append(stationID=3, trainID=2, barID=1, barWeight=1.0, barTimeOffset=1500.0)
186  myDict.append(stationID=3, trainID=2, barID=2, barWeight=1.0, barTimeOffset=1500.0)
187  myDict.append(stationID=3, trainID=2, barID=3, barWeight=1.0, barTimeOffset=1500.0)
188  myDict.append(stationID=3, trainID=3, barID=0, barWeight=1.0, barTimeOffset=1500.0)
189  myDict.append(stationID=3, trainID=3, barID=1, barWeight=1.0, barTimeOffset=1500.0)
190  myDict.append(stationID=3, trainID=3, barID=2, barWeight=1.0, barTimeOffset=1500.0)
191  myDict.append(stationID=3, trainID=3, barID=3, barWeight=1.0, barTimeOffset=1500.0)
192  myDict.savePayload(folderBlk=folderBlkLoc_ideal_01)
193 
194 
195  myDict = AFPDBDict(folderBlk=folderBlkVtx_ideal_01)
196  myDict.append(stationID=0, timeGlobalOffset=0.0, timeOffset=(64.,45.,25.,11.), timeSlope=(-7.3,-5.0,-4.0,-4.0), trainEdge=(-18.7,-13.2,-8.1,-4.0,-2.5))
197  myDict.append(stationID=3, timeGlobalOffset=5.0, timeOffset=( 2., 9.,14.,12.), timeSlope=( 4.0, 5.0, 3.0, 6.0), trainEdge=(-18.7,-13.2,-8.1,-4.0,-2.5))
198  myDict.savePayload(folderBlk=folderBlkVtx_ideal_01)
199 
200 
201  print ("\nClose database")
202  db.closeDatabase()
203 
204 

◆ makeFolderAndSpec()

def AFPToFMCDBCreate.makeFolderAndSpec (   db,
  folderName,
  tag 
)
A function that will ensure a folder is in the database, it creates it if necessary. Also defines content of the folders. It contains only a single entry of a long string

Definition at line 34 of file AFPToFMCDBCreate.py.

34 def makeFolderAndSpec(db,folderName,tag):
35  """A function that will ensure a folder is in the database, it creates it if necessary. Also defines content of the folders. It contains only a single entry of a long string"""
36 
37  spec=cool.RecordSpecification()
38 
39  # each folder contain just a single entry, this string will be JSON entry
40  spec.extend("data",cool.StorageType.String64k)
41 
42  # if there are more channels, use "CondAttrListCollection"; if there is only one channel, use "AthenaAttributeList"
43  # it's also possible to use "CondAttrListCollection" if there's only one channel
44  folder=AtlCoolLib.ensureFolder(db,folderName,spec,AtlCoolLib.athenaDesc(True,'CondAttrListCollection'),cool.FolderVersioning.MULTI_VERSION)
45 
46  if(folder is None):
47  sys.exit(1)
48 
49  return folderBulk(folder, folderName, spec, tag)
50 

◆ runLBtoDB()

def AFPToFMCDBCreate.runLBtoDB (   run,
  lb 
)
Turns run number and lumibock into integrer needed by the database

Definition at line 30 of file AFPToFMCDBCreate.py.

30 def runLBtoDB(run,lb):
31  """Turns run number and lumibock into integrer needed by the database"""
32  return (run<<32) + lb
33 
AFPToFMCDBCreate.runLBtoDB
def runLBtoDB(run, lb)
Definition: AFPToFMCDBCreate.py:30
AFPToFMCDBCreate.makeFolderAndSpec
def makeFolderAndSpec(db, folderName, tag)
Definition: AFPToFMCDBCreate.py:34
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
AFPToFMCDBCreate.main
def main()
Definition: AFPToFMCDBCreate.py:131