ATLAS Offline Software
JetTagCalibration/share/defineDB.py
Go to the documentation of this file.
1 # python script to define the DB for b-tagging calibration
2 # This assumes:
3 # - the same calibration files for all the channels (jet algorithms)
4 # - similar tag names: tagname_TAGGER for each folder
5 # - overall tag: tagname
6 # All root files containing the calibrations should be present, with a name like: BTaggingMyCalibV1_JetFitter.root
7 # and they must have a GUID defined by the command: 'coolHist_setFileIdentifier.sh filename'.
8 # To run: python defineDB.py
9 # Results: a local file called mycool.db
10 # NB: the creation of the complete DB takes about 10mn. If only a specific tagger is run,
11 # change the folders list accordingly to save time. Ditto for the jet collections.
12 # LV 2007/12/18
13 
14 import os,commands,sys
15 
16 os.system('rm -f consolecmds')
17 f=open('consolecmds', 'w')
18 
19 tagname = 'MyCalibV1'
20 hfileprefix='BTagging'+tagname+'_'
21 froot = '/BTAG/CALIB/'
22 db = 'OFLP200'
23 
24 jets = [ 'Cone4H1Topo','Cone4H1Tower','Cone7H1Topo','Cone7H1Tower','Kt4H1Topo','Kt4H1Tower','Kt6H1Topo','Kt6H1Tower','Cone4Truth','Cone7Truth','Kt4Truth','Kt6Truth' ]
25 
26 folders = [ 'IP1D','IP2D','IP3D','SV1','SV2','SoftMu','SoftEl','JetFitter','JetProb' ]
27 
28 ichan=1
29 
30 for jet in jets:
31 
32  print 'Channel',ichan,':',jet
33 
34  for folder in folders:
35  longfolder=froot+folder
36  if (folder!='JetFitter'):
37  hfile=hfileprefix+folder+'.root'
38  else:
39  hfile=hfileprefix+folder+'_'+jet+'ParticleJets.root'
40  longtag=tagname+'_'+folder
41  cmd=db+' '+longfolder+' '+str(ichan)+' '+longtag+' '+hfile
42  print 'Setting ref for',jet,':',cmd
43  os.system('coolHist_setReference.py '+cmd)
44  smd='setchan '+longfolder+' '+str(ichan)+' '+jet
45  print smd
46  f.write(smd+'\n')
47  if ichan == 1:
48  smd='settag '+longfolder+' '+longtag+' '+tagname
49  print smd
50  f.write(smd+'\n')
51 
52  ichan = ichan + 1
53 
54 f.write('exit\n')
55 f.close()
56 
57 #os.system('AtlCoolConsole.py "sqlite://;schema=mycool.db;dbname=OFLP200" < consolecmds')
Trk::open
@ open
Definition: BinningType.h:40
str
Definition: BTagTrackIpAccessor.cxx:11