ATLAS Offline Software
Functions | Variables
python.LArNewCalib_MergeDB Namespace Reference

Functions

def DBConnectionFile (sqlitefile)
 
def mergeDBCfg (flags, InputKeys=[], InputSQLiteFiles=[])
 
def 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()

def python.LArNewCalib_MergeDB.DBConnectionFile (   sqlitefile)

Definition at line 8 of file LArNewCalib_MergeDB.py.

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

◆ list_of_strings()

def python.LArNewCalib_MergeDB.list_of_strings (   arg)

Definition at line 199 of file LArNewCalib_MergeDB.py.

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

◆ mergeDBCfg()

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

Definition at line 11 of file LArNewCalib_MergeDB.py.

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

Variable Documentation

◆ action

python.LArNewCalib_MergeDB.action

Definition at line 211 of file LArNewCalib_MergeDB.py.

◆ args

python.LArNewCalib_MergeDB.args = parser.parse_args()

Definition at line 214 of file LArNewCalib_MergeDB.py.

◆ AtlasVersion

python.LArNewCalib_MergeDB.AtlasVersion

Definition at line 255 of file LArNewCalib_MergeDB.py.

◆ cfg

python.LArNewCalib_MergeDB.cfg = MainServicesCfg(flags)

Definition at line 264 of file LArNewCalib_MergeDB.py.

◆ Database

python.LArNewCalib_MergeDB.Database

Definition at line 236 of file LArNewCalib_MergeDB.py.

◆ Database2

python.LArNewCalib_MergeDB.Database2

Definition at line 237 of file LArNewCalib_MergeDB.py.

◆ DBConnection

python.LArNewCalib_MergeDB.DBConnection

Definition at line 241 of file LArNewCalib_MergeDB.py.

◆ DBInstance

python.LArNewCalib_MergeDB.DBInstance

Definition at line 276 of file LArNewCalib_MergeDB.py.

◆ default

python.LArNewCalib_MergeDB.default

Definition at line 204 of file LArNewCalib_MergeDB.py.

◆ dest

python.LArNewCalib_MergeDB.dest

Definition at line 204 of file LArNewCalib_MergeDB.py.

◆ doAlign

python.LArNewCalib_MergeDB.doAlign

Definition at line 251 of file LArNewCalib_MergeDB.py.

◆ DumpCondStore

python.LArNewCalib_MergeDB.DumpCondStore

Definition at line 258 of file LArNewCalib_MergeDB.py.

◆ DumpDetStore

python.LArNewCalib_MergeDB.DumpDetStore

Definition at line 257 of file LArNewCalib_MergeDB.py.

◆ False

python.LArNewCalib_MergeDB.False

Definition at line 211 of file LArNewCalib_MergeDB.py.

◆ Files

python.LArNewCalib_MergeDB.Files

Definition at line 246 of file LArNewCalib_MergeDB.py.

◆ flags

python.LArNewCalib_MergeDB.flags = initConfigFlags()

Definition at line 231 of file LArNewCalib_MergeDB.py.

◆ GlobalTag

python.LArNewCalib_MergeDB.GlobalTag

Definition at line 244 of file LArNewCalib_MergeDB.py.

◆ help

python.LArNewCalib_MergeDB.help

Definition at line 204 of file LArNewCalib_MergeDB.py.

◆ InputSQLiteFiles

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

Definition at line 220 of file LArNewCalib_MergeDB.py.

◆ IOVStart

python.LArNewCalib_MergeDB.IOVStart

Definition at line 249 of file LArNewCalib_MergeDB.py.

◆ Ncoll

python.LArNewCalib_MergeDB.Ncoll

Definition at line 248 of file LArNewCalib_MergeDB.py.

◆ parser

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

Definition at line 203 of file LArNewCalib_MergeDB.py.

◆ POOLFile

python.LArNewCalib_MergeDB.POOLFile

Definition at line 239 of file LArNewCalib_MergeDB.py.

◆ printDefaults

python.LArNewCalib_MergeDB.printDefaults

Definition at line 278 of file LArNewCalib_MergeDB.py.

◆ RunNumbers

python.LArNewCalib_MergeDB.RunNumbers

Definition at line 235 of file LArNewCalib_MergeDB.py.

◆ summariseProps

python.LArNewCalib_MergeDB.summariseProps

Definition at line 278 of file LArNewCalib_MergeDB.py.

◆ True

python.LArNewCalib_MergeDB.True

Definition at line 278 of file LArNewCalib_MergeDB.py.

◆ type

python.LArNewCalib_MergeDB.type

Definition at line 204 of file LArNewCalib_MergeDB.py.

◆ withDetails

python.LArNewCalib_MergeDB.withDetails

Definition at line 278 of file LArNewCalib_MergeDB.py.

◆ WriteCatalog

python.LArNewCalib_MergeDB.WriteCatalog

Definition at line 275 of file LArNewCalib_MergeDB.py.

python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.LArNewCalib_MergeDB.mergeDBCfg
def mergeDBCfg(flags, InputKeys=[], InputSQLiteFiles=[])
Definition: LArNewCalib_MergeDB.py:11
OutputConditionsAlgConfig.OutputConditionsAlgCfg
def OutputConditionsAlgCfg(flags, name="OutputConditionsAlg", outputFile='condobjs.root', **kwargs)
Definition: OutputConditionsAlgConfig.py:5
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
python.LArNewCalib_MergeDB.DBConnectionFile
def DBConnectionFile(sqlitefile)
Definition: LArNewCalib_MergeDB.py:8
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.LArCalibConfigFlags.LArCalibFolderTag
def LArCalibFolderTag(folder, tag)
Definition: LArCalibConfigFlags.py:99
str
Definition: BTagTrackIpAccessor.cxx:11
python.LArNewCalib_MergeDB.list_of_strings
def list_of_strings(arg)
Definition: LArNewCalib_MergeDB.py:199