ATLAS Offline Software
Classes | Functions | Variables
sct_calib_tf Namespace Reference

Classes

class  SCTCalibExecutor
 

Functions

def getDsFileName (file, input=False)
 
def checkFileList (filelist)
 
def updateLastRun (RunNumber)
 
def main ()
 
def getTransform ()
 
def addSCTCalibArgs (parser)
 
def addOutputArgs (parser, dict)
 

Variables

dictionary dsDict = {'input': [] , 'output' : []}
 
int RunNumber = -1
 
int EventNumber = -1
 
string SvcClass = ''
 
string Stream = ''
 
int NumberOfEvents = 0
 

Function Documentation

◆ addOutputArgs()

def sct_calib_tf.addOutputArgs (   parser,
  dict 
)

Definition at line 161 of file sct_calib_tf.py.

161 def addOutputArgs(parser,dict):
162 
163  if 'part' not in dict:
164  checkPart = ['doNoisyStrip']
165  else:
166  checkPart = dict['part']._value
167 
168  if 'splitHitMap' not in dict:
169  checkSplit= 0
170  else:
171  checkSplit = dict['splitHitMap']._value
172 
173  if 'prefix' not in dict:
174  checkPrefix=''
175  else:
176  checkPrefix=dict['prefix']._value
177 
178  # # # add outputfiles
179  if checkPrefix != '':
180  checkPrefix += '.'
181 
182 
183  if 'doHV' not in checkPart and checkSplit != 1:
184  parser.add_argument('--outputCOOL', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
185  help = 'COOL DB',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'mycool.db'],runarg=True))
186 
187  #NOISY STRIPS OUTPUT FILES
188  if 'doNoisyStrip' in checkPart and checkSplit == 1:
189 
190  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
191  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
192  parser.add_argument('--outputLBFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
193  help = 'LB output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTLB.root'],runarg=True))
194 
195  if 'doNoisyStrip' in checkPart and checkSplit != 1:
196 
197  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
198  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
199  parser.add_argument('--outputLBFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
200  help = 'LB output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTLB.root'],runarg=True))
201  parser.add_argument('--outputBSSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
202  help = 'Bad Strips summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'BadStripsSummaryFile.xml'],runarg=True))
203  parser.add_argument('--outputBSAllFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
204  help = 'Bad Strips All file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'BadStripsAllFile.xml'],runarg=True))
205  parser.add_argument('--outputBSNewFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
206  help = 'Bad Strips New file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'BadStripsNewFile.xml'],runarg=True))
207 
208  if 'doHV' in checkPart:
209  parser.add_argument('--outputBadModulesFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
210  help = 'Bad Modules file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'BadModulesFile.xml'],runarg=True))
211 
212  #DEAD CHIP OUTPUT FILES
213  if 'doDeadChip' in checkPart and checkSplit == 1:
214  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
215  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
216  parser.add_argument('--outputBSErrorsFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
217  help = 'BS Errors file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTBSErrors.root'],runarg=True))
218 
219  if 'doDeadChip' in checkPart and checkSplit != 1:
220  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
221  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
222  parser.add_argument('--outputBSErrorsFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
223  help = 'BS Errors file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTBSErrors.root'],runarg=True))
224  parser.add_argument('--outputDeadChipFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
225  help = 'Dead Chip file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'DeadChipsFile.xml'],runarg=True))
226  parser.add_argument('--outputDeadSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
227  help = 'Dead Chip Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'DeadSummaryFile.xml'],runarg=True))
228 
229  #DEAD STRIP OUTPUT FILES
230  if 'doDeadStrip' in checkPart and checkSplit == 1:
231  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
232  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
233  parser.add_argument('--outputBSErrorsFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
234  help = 'BS Errors file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTBSErrors.root'],runarg=True))
235 
236  if 'doDeadStrip' in checkPart and checkSplit != 1:
237  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
238  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
239  parser.add_argument('--outputBSErrorsFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
240  help = 'BS Errors file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTBSErrors.root'],runarg=True))
241  parser.add_argument('--outputDeadStripFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
242  help = 'Dead Strip file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'DeadStripsFile.xml'],runarg=True))
243  parser.add_argument('--outputDeadSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
244  help = 'Dead Strip Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'DeadSummaryFile.xml'],runarg=True))
245 
246  #QUIET CHIP OUTPUT FILES
247  if 'doQuietChip' in checkPart and checkSplit == 1:
248  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
249  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
250  parser.add_argument('--outputBSErrorsFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
251  help = 'BS Errors file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTBSErrors.root'],runarg=True))
252 
253  if 'doQuietChip' in checkPart and checkSplit != 1:
254  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
255  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
256  parser.add_argument('--outputBSErrorsFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
257  help = 'BS Errors file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTBSErrors.root'],runarg=True))
258  parser.add_argument('--outputDeadChipFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
259  help = 'Dead Chip file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'QuietChipsFile.xml'],runarg=True))
260  parser.add_argument('--outputDeadSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
261  help = 'Dead Chip Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'QuietSummaryFile.xml'],runarg=True))
262 
263  #QUIET STRIP OUTPUT FILES
264  if 'doQuietStrip' in checkPart and checkSplit == 1:
265  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
266  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
267  parser.add_argument('--outputBSErrorsFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
268  help = 'BS Errors file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTBSErrors.root'],runarg=True))
269 
270  if 'doQuietStrip' in checkPart and checkSplit != 1:
271  parser.add_argument('--outputHITMapFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
272  help = 'HitMap output file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTHitMaps.root'],runarg=True))
273  parser.add_argument('--outputBSErrorsFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True,io='output'),
274  help = 'BS Errors file',group='Calibration',default=trfArgClasses.argNTUPFile([checkPrefix+'SCTBSErrors.root'],runarg=True))
275  parser.add_argument('--outputDeadStripFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
276  help = 'Dead Strip file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'QuietStripsFile.xml'],runarg=True))
277  parser.add_argument('--outputDeadSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
278  help = 'Dead Strip Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'QuietSummaryFile.xml'],runarg=True))
279 
280  #NOISE OCCUPANCY OUTPUT FILES
281  if 'doNoiseOccupancy' in checkPart:
282  parser.add_argument('--outputNOFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
283  help = 'Noise Occupancy file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'NoiseOccupancyFile.xml'],runarg=True))
284  parser.add_argument('--outputNOSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
285  help = 'Noise Occupancy Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'NoiseOccupancySummaryFile.xml'],runarg=True))
286 
287  #LORENTZ ANGLE OUTPUT FILES
288  if 'doLorentzAngle' in checkPart:
289  parser.add_argument('--outputLAFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
290  help = 'Lorentz Angle file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'LorentzAngleFile.xml'],runarg=True))
291  parser.add_argument('--outputLASummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
292  help = 'Lorentz Angle Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'LorentzAngleSummaryFile.xml'],runarg=True))
293 
294  #RAW OCCUPANCY OUTPUT FILES
295  if 'doRawOccupancy' in checkPart:
296  parser.add_argument('--outputROSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
297  help = 'Raw Occupancy Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'RawOccupancySummaryFile.xml'],runarg=True))
298 
299  #EFFICIENCY OUTPUT FILES
300  if 'doEfficiency' in checkPart:
301  parser.add_argument('--outputEffModuleFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
302  help = 'Efficiency file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'EfficiencyModuleSummary.xml'],runarg=True))
303  parser.add_argument('--outputEffSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
304  help = 'Efficiency Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'EfficiencySummaryFile.xml'],runarg=True))
305 
306  #BS ERRORS OUTPUT FILES
307  if 'doBSErrorDB' in checkPart:
308  parser.add_argument('--outputBSModuleFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
309  help = 'BS Errors Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'BSErrorModuleSummary.xml'],runarg=True))
310  parser.add_argument('--outputBSSummaryFile', type=trfArgClasses.argFactory(trfArgClasses.argFile, runarg=True,io='output'),
311  help = 'BS Errors Summary file',group='Calibration',default=trfArgClasses.argFile([checkPrefix+'BSErrorSummaryFile.xml'],runarg=True))
312 

◆ addSCTCalibArgs()

def sct_calib_tf.addSCTCalibArgs (   parser)

Definition at line 142 of file sct_calib_tf.py.

142 def addSCTCalibArgs(parser):
143 
144  parser.defineArgGroup('Calibration', 'Specific options related to the calibration configuration')
145 
146  parser.add_argument('--input',
147  help = 'List of CSV input files',group='Calibration')
148  parser.add_argument('--prefix', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
149  help = 'Prefix for output files',group='Calibration')
150  parser.add_argument('--part', type=trfArgClasses.argFactory(trfArgClasses.argList, runarg=True),
151  help = 'List of calibration algorithms to be run',group='Calibration')
152  parser.add_argument('--doRunSelector', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
153  help = 'Specifies if runSelector.py is executed',group='Calibration')
154  parser.add_argument('--doRunInfo', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
155  help = 'Specifies if runInfo.py is executed',group='Calibration')
156  parser.add_argument('--splitHitMap', type=trfArgClasses.argFactory(trfArgClasses.argInt,runarg=True),
157  help = 'Split task or not',group='Calibration')
158  parser.add_argument('--forceRefRunNumber', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
159  help = 'Force reference run to current run number when checking information uploaded to COOL for previous runs',group='Calibration')
160 

◆ checkFileList()

def sct_calib_tf.checkFileList (   filelist)
Converts list of files of type ds#filename into a list of filenames, meanwhile
setting ds value. If check is true it also checks the existence of the files.

Definition at line 78 of file sct_calib_tf.py.

78 def checkFileList(filelist):
79  """Converts list of files of type ds#filename into a list of filenames, meanwhile
80  setting ds value. If check is true it also checks the existence of the files."""
81  # First check if type is list
82 
83  if not isinstance(filelist,list):
84  filelist=[filelist]
85 
86  for i,ifile in enumerate(filelist):
87  # extract ds,runnumber and svcclass
88  filename=getDsFileName(ifile)
89  # pass file check if file is on castor
90  if filename.find('/castor',0,8) != -1:
91  pass
92  elif not fileutil.exists(filename):
93  found = fileutil.exists_suffix_number(filename + '.')
94  if not found:
95 
96  errMsg = filename+' not found'
97  raise trfExceptions.TransformValidationException(trfExit.nameToCode('TRF_INPUT_FILE_VALIDATION_FAIL'), errMsg)
98 
99  if found != filename:
100 
101  filename = found
102  # correct filename in list
103  filelist[i]=filename
104  return filelist
105 

◆ getDsFileName()

def sct_calib_tf.getDsFileName (   file,
  input = False 
)
Returns dataset and logical file name for files of type ds##file or ds#dsfile.

Definition at line 35 of file sct_calib_tf.py.

35 def getDsFileName(file,input=False):
36  """Returns dataset and logical file name for files of type ds##file or ds#dsfile."""
37  global RunNumber
38  global SvcClass
39  global Stream
40  global NumberOfEvents
41  if isinstance(file,dict):
42 # name=file['pfn']
43  name=file['lfn']
44  ds=file['dsn']
45 # SvcClass=file['svcclass']
46  SvcClass=file.get('svcclass','')
47  if 'events' in file:
48  NumberOfEvents+=file['events']
49  else:
50  if file.find('##')!=-1:
51  ds=file.split('##')[0]
52  name=file.replace('##','')
53  elif file.find('#')!=-1:
54  ds=file.split('#')[0]
55  name=file.split('#')[1]
56  else:
57  if file.find('/')!=-1:
58  fileparts=file.split('/')
59  ds=fileparts[len(fileparts)-1]
60  else:
61  ds=file
62  name=file
63 
64  if '/eos/atlas/' in name:
65  name='root://eosatlas.cern.ch/'+name
66 
67  dsDict['input'].append({'file' : name, 'dataset' : ds})
68  if RunNumber == -1:
69  nb = ds.count('.')
70  if nb >= 4:
71  RunNumber=int(ds.split('.')[1])
72  longStream=ds.split('.')[0]
73  #Stream is either cos or xxxeV energy
74  Stream=longStream.split('_')[1]
75 
76  return name
77 

◆ getTransform()

def sct_calib_tf.getTransform ( )

Definition at line 130 of file sct_calib_tf.py.

130 def getTransform():
131 
132  exeSet = set()
133  exeSet.add(SCTCalibExecutor('SCT_CalibAlgs.SCTCalib_Skeleton'))
134 
135  trf = transform(executor=exeSet)
136 
137  addAthenaArguments(trf.parser)
138  addSCTCalibArgs(trf.parser)
139 
140  return trf
141 

◆ main()

def sct_calib_tf.main ( )

Definition at line 115 of file sct_calib_tf.py.

115 def main():
116 
117  msg.info("This is %s", sys.argv[0])
118  trf = getTransform()
119  trf.parseCmdLineArgs(sys.argv[1:])
120 
121  addOutputArgs(trf.parser, trf._argdict)
122  trf.parseCmdLineArgs(sys.argv[1:])
123 
124  trf.execute()
125  trf.generateReport()
126 
127  msg.info("%s stopped at %s, trf exit code %d", sys.argv[0], time.asctime(), trf.exitCode)
128  sys.exit(trf.exitCode)
129 

◆ updateLastRun()

def sct_calib_tf.updateLastRun (   RunNumber)

Definition at line 106 of file sct_calib_tf.py.

106 def updateLastRun(RunNumber):
107 
108  if os.path.exists('/afs/cern.ch/work/s/sctcalib/lastRun'):
109  f = open('/afs/cern.ch/work/s/sctcalib/lastRun','w')
110  f.write(str(RunNumber)+' ')
111  f.close()
112 
113 @stdTrfExceptionHandler
114 @sigUsrStackTrace

Variable Documentation

◆ dsDict

dictionary sct_calib_tf.dsDict = {'input': [] , 'output' : []}

Definition at line 27 of file sct_calib_tf.py.

◆ EventNumber

int sct_calib_tf.EventNumber = -1

Definition at line 29 of file sct_calib_tf.py.

◆ NumberOfEvents

int sct_calib_tf.NumberOfEvents = 0

Definition at line 32 of file sct_calib_tf.py.

◆ RunNumber

int sct_calib_tf.RunNumber = -1

Definition at line 28 of file sct_calib_tf.py.

◆ Stream

string sct_calib_tf.Stream = ''

Definition at line 31 of file sct_calib_tf.py.

◆ SvcClass

string sct_calib_tf.SvcClass = ''

Definition at line 30 of file sct_calib_tf.py.

sct_calib_tf.checkFileList
def checkFileList(filelist)
Definition: sct_calib_tf.py:78
sct_calib_tf.addSCTCalibArgs
def addSCTCalibArgs(parser)
Definition: sct_calib_tf.py:142
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
sct_calib_tf.addOutputArgs
def addOutputArgs(parser, dict)
Definition: sct_calib_tf.py:161
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
sct_calib_tf.getTransform
def getTransform()
Definition: sct_calib_tf.py:130
python.trfArgs.addAthenaArguments
def addAthenaArguments(parser, maxEventsDefaultSubstep='first', addValgrind=True, addPerfMon=True, addVTune=True)
Options related to running athena in general TODO: Some way to mask certain options (perExec,...
Definition: trfArgs.py:59
sct_calib_tf.updateLastRun
def updateLastRun(RunNumber)
Definition: sct_calib_tf.py:106
sct_calib_tf.main
def main()
Definition: sct_calib_tf.py:115
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
Trk::open
@ open
Definition: BinningType.h:40
str
Definition: BTagTrackIpAccessor.cxx:11
sct_calib_tf.getDsFileName
def getDsFileName(file, input=False)
Definition: sct_calib_tf.py:35