ATLAS Offline Software
Loading...
Searching...
No Matches
python.LArNewCalib_MergeDB Namespace Reference

Functions

 DBConnectionFile (sqlitefile)
 mergeDBCfg (flags, InputKeys=[], InputSQLiteFiles=[])
 list_of_strings (arg)

Variables

 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
 dest
 default
 help
 type
 False
 action
 args = parser.parse_args()
list InputSQLiteFiles = [ db for db in os.listdir(".") if db.endswith(".db") ]
 flags = initConfigFlags()
 RunNumbers
 Database
 Database2
 POOLFile
 DBConnection
 GlobalTag
 Files
 Ncoll
 IOVStart
 doAlign
 AtlasVersion
 DumpDetStore
 DumpCondStore
 cfg = MainServicesCfg(flags)
 WriteCatalog
 DBInstance
 withDetails
 True
 summariseProps
 printDefaults

Function Documentation

◆ DBConnectionFile()

python.LArNewCalib_MergeDB.DBConnectionFile ( sqlitefile)

Definition at line 9 of file LArNewCalib_MergeDB.py.

9def DBConnectionFile(sqlitefile):
10 return "sqlite://;schema="+sqlitefile+";dbname=CONDBR2"
11

◆ list_of_strings()

python.LArNewCalib_MergeDB.list_of_strings ( arg)

Definition at line 200 of file LArNewCalib_MergeDB.py.

200 def list_of_strings(arg):
201 return arg.split(',')
202

◆ mergeDBCfg()

python.LArNewCalib_MergeDB.mergeDBCfg ( flags,
InputKeys = [],
InputSQLiteFiles = [] )

Definition at line 12 of file LArNewCalib_MergeDB.py.

12def mergeDBCfg(flags, InputKeys=[], InputSQLiteFiles=[]):
13 result=ComponentAccumulator()
14
15 print("mergeDBCfg",len(InputSQLiteFiles)," SQLite files: ",InputSQLiteFiles)
16 print(len(InputKeys)," InputKeys: ",InputKeys)
17
18
19 if not flags.LArCalib.isSC: GroupingType = "ExtendedSubDetector"
20 else: GroupingType = "SuperCells"
21
22 if ( flags.LArCalib.Output.POOLFile ):
23 if os.path.exists(flags.LArCalib.Output.POOLFile):
24 os.remove(flags.LArCalib.Output.POOLFile)
25
26 for key in InputKeys:
27
28 print("Working for: ",key)
29 KeyOutput = key
30 FlagInput = key
31
32 if 'Pedestal' == key or 'PhysWave' == key or 'MphysOverMcal' == key or 'Ramp' == key or 'Params' in key:
33 KeyInput="LAr"+key
34 if 'Pedestal' == key or 'PhysWave' == key or 'CaliWave' or 'MphysOverMcal' == key or 'Ramp' == key or 'Params' in key:
35 KeyInput="LAr"+key
36 KeyOutput="LAr"+key
37
38 if 'AutoCorr' in key:
39 KeyInput='LArAutoCorr'
40
41 ofcphyskey=None
42 if "OFC" in key:
43 KeyInput = "LArOFC"
44 if "Cali" in key:
45 FlagInput = "OFCCali"
46
47 if "Phys" in key:
48 ofcphyskeytmp = key.split("OFCPhys")[1]
49 if 'Mu' in ofcphyskeytmp:
50 ofcphyskey=ofcphyskeytmp.replace("Mu","")
51 else:
52 ofcphyskey=ofcphyskeytmp
53 FlagInput = "OFCPhys"
54
55 shapekey=None
56 if "Shape" in key:
57 shapekey = key.split("Shape")[1]
58 FlagInput = "Shape"
59 KeyInput = "LArShape"
60
61
62 #if FlagInput in flags._flagdict.keys():
63 if [i for i in flags._flagdict.keys() if FlagInput in i]:
64 try:
65 Folder = flags._get('LArCalib.'+FlagInput+'.Folder')
66 except Exception as e:
67 print(e)
68 print(flags._flagdict)
69 sys.exit(-1)
70 else:
71 print('No folder in flags for '+FlagInput)
72 print(flags._flagdict.keys())
73 sys.exit(-2)
74
75 if shapekey is not None:
76 if Folder.endswith("/"):
77 Folder+=shapekey
78 else:
79 Folder+="/"+shapekey
80
81 if ofcphyskey is not None and ofcphyskey != "":
82 print("Folder: ",Folder," ofcphyskey: ",ofcphyskey)
83 if "4samples" in Folder:
84 Folder = Folder.replace("4samples", ofcphyskey)
85 elif Folder.endswith("/"):
86 Folder+=ofcphyskey
87 else:
88 Folder+="/"+ofcphyskey
89
90 if "OFCPhys" in FlagInput:
91 print("Folder: ",Folder)
92 # Get the available tags
93 from PyCool import cool
94 dbSvc=cool.DatabaseSvcFactory.databaseService()
95 db_string=DBConnectionFile(InputSQLiteFiles[0])
96 try:
97 db=dbSvc.openDatabase(db_string)
98 except Exception as e:
99 print ('Problem opening database',e)
100 print(db_string)
101 sys.exit(-3)
102 cool_folder=db.getFolder(Folder)
103 tags = [ x for x in cool_folder.listTags() ]
104 if len(tags) == 1:
105 TagSpec = str(tags[0])
106 else:
107 if flags.LArCalib.OFC.Ncoll > 0 or 'Mu' in key:
108 TagSpec = [ str(tag) for tag in tags if "-mu-" in str(tag)][0]
109 else:
110 TagSpec = [ str(tag) for tag in tags if "-mu-" not in str(tag)][0]
111 else:
112 from LArCalibProcessing.utils import FolderTagResolver as FolderTagResover
113 FolderTagResover._globalTag=flags.IOVDb.GlobalTag
114 #rs=FolderTagResover(flags.LArCalib.Input.Database2)
115 # until not all folders in COOL:
116 rs=FolderTagResover(DBConnectionFile(InputSQLiteFiles[0]))
117 FolderTag = rs.getFolderTagSuffix(Folder)
118 del rs
119
120 from LArCalibProcessing.LArCalibConfigFlags import LArCalibFolderTag
121 TagSpec = LArCalibFolderTag(Folder,FolderTag)
122
123
124 if 'Wave' in KeyInput:
125 OutputObjectSpec = KeyInput+"Container#"+KeyOutput+"#"+Folder
126 else:
127 OutputObjectSpec = KeyInput+"Complete#"+KeyOutput+"#"+Folder
128 OutputObjectSpecTag = TagSpec
129
130 print("**",KeyInput,FlagInput,"folder **",Folder)
131 print("** TagSpec: ",TagSpec)
132 print("** keyOutput: ",KeyOutput)
133
134
135 inkeys=[]
136 inobjs=[]
137
138 for sqf in InputSQLiteFiles:
139 thiskey = KeyInput+str(InputSQLiteFiles.index(sqf))
140
141 if 'PhysAutoCorr' in key: thiskey='Phys'+thiskey
142
143 if 'OFC' in key and 'Mu' in key:
144 thiskey+="Mu"
145 if 'OFC' in key and 'Cali' in key:
146 thiskey+="Cali"
147
148 inkeys.append(thiskey)
149 if 'Wave' in KeyInput:
150 inobjs.append(KeyInput+"Container#"+thiskey)
151 else:
152 inobjs.append(KeyInput+"Complete#"+thiskey)
153
154 if 'Wave' in KeyInput or 'Params' in KeyInput:
155 result.merge(addFolders(flags,Folder,tag=TagSpec,detDb=sqf,modifiers="<key>"+thiskey+"</key>"))
156 else:
157 result.merge(addFolders(flags,Folder,tag=TagSpec,detDb=sqf,modifiers="<key>"+thiskey+"</key>", className=KeyInput+"Complete"))
158 pass
159
160 pass
161
162 if 'Wave' in KeyInput:
163 result.addCondAlgo(CompFactory.getComp('ForceLoadCondObj')(KeyOutput,ObjectList=inobjs))
164 result.addCondAlgo(CompFactory.getComp('LArConditionsMergerAlg<LArDAC2uAComplete,'+KeyInput+'Container>')(key+"Merger",
165 GroupingType = GroupingType, WriteKey = KeyOutput, DetStoreReadKeys = inkeys))
166 elif 'Params' in KeyInput:
167 result.addCondAlgo(CompFactory.getComp('ForceLoadCondObj')(KeyOutput,ObjectList=inobjs))
168 result.addCondAlgo(CompFactory.getComp('LArConditionsMergerAlg<LArDAC2uAComplete,'+KeyInput+'Complete>')(key+"Merger",
169 GroupingType = GroupingType, WriteKey = KeyOutput, DetStoreReadKeys = inkeys))
170 else:
171 result.addCondAlgo(CompFactory.getComp('LArConditionsMergerAlg<'+KeyInput+'Complete, LArPhysWaveContainer>')(key+"Merger",
172 GroupingType = GroupingType, WriteKey = KeyOutput, ReadKeys = inkeys))
173
174 if ( flags.LArCalib.Output.POOLFile ):
175
176 from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
177 result.merge(OutputConditionsAlgCfg(flags,name="OutputConditionsAlg"+KeyInput, outputFile=flags.LArCalib.Output.POOLFile,
178 ObjectList=[OutputObjectSpec], IOVTagList=[OutputObjectSpecTag],
179 Run1 = flags.LArCalib.IOVStart, Run2= flags.LArCalib.IOVEnd, WriteIOV=True))
180 pass
181
182 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = False))
183
184 #MC Event selector since we have no input data file
185 from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
186 result.merge(McEventSelectorCfg(flags,
187 RunNumber = flags.LArCalib.Input.RunNumbers[0],
188 EventsPerRun = 1,
189 FirstEvent = 1,
190 InitialTimeStamp = 0,
191 TimeStampInterval = 1))
192
193 result.printConfig(withDetails=True, printDefaults=True)
194 return result
195
196
void print(char *figname, TCanvas *c1)

Variable Documentation

◆ action

python.LArNewCalib_MergeDB.action

Definition at line 212 of file LArNewCalib_MergeDB.py.

◆ args

python.LArNewCalib_MergeDB.args = parser.parse_args()

Definition at line 215 of file LArNewCalib_MergeDB.py.

◆ AtlasVersion

python.LArNewCalib_MergeDB.AtlasVersion

Definition at line 256 of file LArNewCalib_MergeDB.py.

◆ cfg

python.LArNewCalib_MergeDB.cfg = MainServicesCfg(flags)

Definition at line 265 of file LArNewCalib_MergeDB.py.

◆ Database

python.LArNewCalib_MergeDB.Database

Definition at line 237 of file LArNewCalib_MergeDB.py.

◆ Database2

python.LArNewCalib_MergeDB.Database2

Definition at line 238 of file LArNewCalib_MergeDB.py.

◆ DBConnection

python.LArNewCalib_MergeDB.DBConnection

Definition at line 242 of file LArNewCalib_MergeDB.py.

◆ DBInstance

python.LArNewCalib_MergeDB.DBInstance

Definition at line 277 of file LArNewCalib_MergeDB.py.

◆ default

python.LArNewCalib_MergeDB.default

Definition at line 205 of file LArNewCalib_MergeDB.py.

◆ dest

python.LArNewCalib_MergeDB.dest

Definition at line 205 of file LArNewCalib_MergeDB.py.

◆ doAlign

python.LArNewCalib_MergeDB.doAlign

Definition at line 252 of file LArNewCalib_MergeDB.py.

◆ DumpCondStore

python.LArNewCalib_MergeDB.DumpCondStore

Definition at line 259 of file LArNewCalib_MergeDB.py.

◆ DumpDetStore

python.LArNewCalib_MergeDB.DumpDetStore

Definition at line 258 of file LArNewCalib_MergeDB.py.

◆ False

python.LArNewCalib_MergeDB.False

Definition at line 212 of file LArNewCalib_MergeDB.py.

◆ Files

python.LArNewCalib_MergeDB.Files

Definition at line 247 of file LArNewCalib_MergeDB.py.

◆ flags

python.LArNewCalib_MergeDB.flags = initConfigFlags()

Definition at line 232 of file LArNewCalib_MergeDB.py.

◆ GlobalTag

python.LArNewCalib_MergeDB.GlobalTag

Definition at line 245 of file LArNewCalib_MergeDB.py.

◆ help

python.LArNewCalib_MergeDB.help

Definition at line 205 of file LArNewCalib_MergeDB.py.

◆ InputSQLiteFiles

python.LArNewCalib_MergeDB.InputSQLiteFiles = [ db for db in os.listdir(".") if db.endswith(".db") ]

Definition at line 221 of file LArNewCalib_MergeDB.py.

◆ IOVStart

python.LArNewCalib_MergeDB.IOVStart

Definition at line 250 of file LArNewCalib_MergeDB.py.

◆ Ncoll

python.LArNewCalib_MergeDB.Ncoll

Definition at line 249 of file LArNewCalib_MergeDB.py.

◆ parser

python.LArNewCalib_MergeDB.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)

Definition at line 204 of file LArNewCalib_MergeDB.py.

◆ POOLFile

python.LArNewCalib_MergeDB.POOLFile

Definition at line 240 of file LArNewCalib_MergeDB.py.

◆ printDefaults

python.LArNewCalib_MergeDB.printDefaults

Definition at line 279 of file LArNewCalib_MergeDB.py.

◆ RunNumbers

python.LArNewCalib_MergeDB.RunNumbers

Definition at line 236 of file LArNewCalib_MergeDB.py.

◆ summariseProps

python.LArNewCalib_MergeDB.summariseProps

Definition at line 279 of file LArNewCalib_MergeDB.py.

◆ True

python.LArNewCalib_MergeDB.True

Definition at line 279 of file LArNewCalib_MergeDB.py.

◆ type

python.LArNewCalib_MergeDB.type

Definition at line 205 of file LArNewCalib_MergeDB.py.

◆ withDetails

python.LArNewCalib_MergeDB.withDetails

Definition at line 279 of file LArNewCalib_MergeDB.py.

◆ WriteCatalog

python.LArNewCalib_MergeDB.WriteCatalog

Definition at line 276 of file LArNewCalib_MergeDB.py.