ATLAS Offline Software
createMdtFolders.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2 
3 # *************************************************
4 # Author monica.verducci@cern.ch
5 # python script to create the MDT DQ folders in sqlite files and fill in it
6 # during the postprocessing algorithm
7 # ************************************************
8 from __future__ import print_function
9 
11  import os
12  from PyCool import cool
13 
14  # get database service and open database
15  dbSvc = cool.DatabaseSvcFactory.databaseService()
16  # database accessed via physical name
17 
18  dbstring = 'sqlite://;schema=MDTDQMFOFFLINE_DEAD.db;dbname=MDT_DQA'
19 
20  if os.access('MDTDQMFOFFLINE_DEAD.db', os.R_OK):
21  try:
22  os.unlink('MDTDQMFOFFLINE_DEAD.db')
23  #print 'Trying to Delete'
24  except Exception as e:
25  print('Unable to remove existing db file, reason', e)
26  try:
27  db = dbSvc.createDatabase(dbstring)
28  except Exception as e:
29  print('Problem creating database', e)
30  return
31  #print "Created database",dbstring
32 
33  spec2 = cool.RecordSpecification()
34  spec2.extend("Chamber_Name", cool.StorageType.String255)
35  spec2.extend("Dead_multilayer", cool.StorageType.String255)
36  spec2.extend("Dead_layer", cool.StorageType.String255)
37  spec2.extend("Dead_mezz", cool.StorageType.String255)
38  spec2.extend("Dead_asd", cool.StorageType.String255)
39  spec2.extend("Dead_tube", cool.StorageType.String4k)
40 
41  desc = "<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" /></addrHeader><typeName>CondAttrListCollection</typeName>"
42 
43  # create the folder - single version
44  # last argument is createParents - if true, automatically creates parent
45  # folders if needed
46  # note this will not work if the database already exists - delete mycool.db first
47  # Deprecated/dropped: myfolder=db.createFolder("/OFFLINE/DQMFOFFLINE/DQMFOFFLINE_DEAD",spec2,desc,cool.FolderVersioning.MULTI_VERSION,True)
48  folderSpec = cool.FolderSpecification(
49  cool.FolderVersioning.MULTI_VERSION, spec2)
50  db.createFolder(
51  "/OFFLINE/DQMFOFFLINE/DQMFOFFLINE_DEAD", folderSpec, desc, True)
52  db.closeDatabase()
53 
54 
56  import os
57  from PyCool import cool
58 
59  # get database service and open database
60  dbSvc = cool.DatabaseSvcFactory.databaseService()
61  # database accessed via physical name
62 
63  dbstring = 'sqlite://;schema=MDTDQMFOFFLINE_NOISY.db;dbname=MDT_DQA'
64 
65  if os.access('MDTDQMFOFFLINE_NOISY.db', os.R_OK):
66  try:
67  os.unlink('MDTDQMFOFFLINE_NOISY.db')
68  except Exception as e:
69  print('Unable to remove existing db file, reason', e)
70  try:
71  db = dbSvc.createDatabase(dbstring)
72  except Exception as e:
73  print('Problem creating database', e)
74  return
75  #print "Created database",dbstring
76 
77  spec2 = cool.RecordSpecification()
78  spec2.extend("Chamber_Name", cool.StorageType.String255)
79  spec2.extend("Noisy_multilayer", cool.StorageType.String255)
80  spec2.extend("Noisy_layer", cool.StorageType.String255)
81  spec2.extend("Noisy_mezz", cool.StorageType.String255)
82  spec2.extend("Noisy_asd", cool.StorageType.String255)
83  spec2.extend("Noisy_tube", cool.StorageType.String4k)
84 
85  desc = "<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" /></addrHeader><typeName>CondAttrListCollection</typeName>"
86 
87  # create the folder - single version
88  # last argument is createParents - if true, automatically creates parent
89  # folders if needed
90  # note this will not work if the database already exists - delete mycool.db first
91  # Deprecated/dropped: myfolder=db.createFolder("/OFFLINE/DQMFOFFLINE/DQMFOFFLINE_NOISY",spec2,desc,cool.FolderVersioning.MULTI_VERSION,True)
92  folderSpec = cool.FolderSpecification(
93  cool.FolderVersioning.MULTI_VERSION, spec2)
94  db.createFolder(
95  "/OFFLINE/DQMFOFFLINE/DQMFOFFLINE_NOISY", folderSpec, desc, True)
96  db.closeDatabase()
python.createMdtFolders.createMDTConditionDBDead
def createMDTConditionDBDead()
Definition: createMdtFolders.py:10
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.createMdtFolders.createMDTConditionDBNoisy
def createMDTConditionDBNoisy()
Definition: createMdtFolders.py:55