SND@LHC Software
Loading...
Searching...
No Matches
list_conDB.py
Go to the documentation of this file.
7from __future__ import print_function, division
8from factory import APIFactory
9import datetime, sys
10
11
12from builtins import range
13import operator
14from argparse import ArgumentParser
15from array import array
16import os,ROOT, getopt
17
18level=0
19try:
20 opts, args = getopt.getopt(sys.argv[1:], "l:",[])
21except getopt.GetoptError:
22 # print help information and exit:
23 print(' enter -l: level')
24 sys.exit()
25
26for o, a in opts:
27 if o in ("-l",):
28 level = int(a)
29
30# Instantiate an API factory
31api_factory = APIFactory()
32# Call construct_DB_API to get an CDB API instance, the path must lead to a valid config.yml file containing the database configuration
33
34conditionsDB = api_factory.construct_DB_API("/home/eric/snd-soft-23april-2021/sndsw/conditionsDatabase/config.yml")
35
36detector=""
37count=0
38
39def showdetectors(detector,count,level):
40 #print ("showdetectors called. count=",count," level=",level)
41 # Show all detector names in the database:
42 result = conditionsDB.list_detectors(detector)
43 if len(result) > 0:
44 if detector=="":
45 print ("snd subdetectors:",result)
46 else:
47 print ("subdetectors inside",detector," :",result)
48 if count < level:
49 count+=1
50 for j in range(len(result)):
51 showdetectors(result[j],count,level)
52 else:
53 print ("No more subdetectors below subdetector/channel:",detector)
54 #print ("count=",count,"All subdetectors listed up to level",level,".")
55 return
56
57showdetectors(detector,count,level)
58sys.exit()
This class creates an instance of the specified database API.
Definition factory.py:15
showdetectors(detector, count, level)
Definition list_conDB.py:39