001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017 include.block("RecExCond/RecExCommon_flags.py")
018
019
020 from AthenaCommon.Logging import logging
021 from RecExConfig.RecFlags import rec
022 from RecExConfig.Resilience import treatException,protectedInclude
023
024 logRecExCommon_flags = logging.getLogger( 'RecExCommon_flags' )
025 logRecExCommon_flags.info("Executing RecExCommon_flags.py")
026
027
028 if not 'oldFlagDefault' in dir():
029 oldFlagDefault=True
030 if not oldFlagDefault:
031 logRecExCommon_flags.info("old flags default will be IGNORED !. Also switching oldFlagCompatibility to False" )
032 oldFlagCompatibility=False
033
034
035
036
037 from AthenaCommon.JobProperties import jobproperties
038
039
040 from AthenaCommon.AthenaCommonFlags import jobproperties,athenaCommonFlags
041
042
043
044
045
046
047 from AthenaCommon.Constants import *
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062 varInit=dir()
063
064
065
066
067
068
069
070
071
072
073
074
075 AthenaCommonFlags = {
076 'EvtMax' : 5,
077 'SkipEvents' : 0,
078 'PoolEvgenInput' : ["Evgen.pool.root"],
079 'PoolHitsInput' : ["Hits.pool.root"],
080 'PoolRDOInput' : ["RDO.pool.root"],
081 'PoolESDInput' : [ "ESD.pool.root" ],
082 'PoolAODInput' : [ "AOD.pool.root" ],
083 'PoolEvgenOutput' : "Event.pool.root",
084 'PoolHitsOutput' : "Hits.pool.root",
085 'PoolRDOOutput' : "RDO.pool.root",
086 'PoolESDOutput' : "ESD.pool.root",
087 'PoolAODOutput' : "AOD.pool.root",
088 'PoolTAGOutput' : "TAG.pool.root"
089 }
090
091
092
093
094
095
096
097
098
099
100
101
102
103 athenaCommonFlags.PoolRDOInput=["LFN:top_GEO-02-01-00_RDO_extract.pool"]
104
105
106 RecExCommonFlags = {
107 'BSRDOInput' : ["./dc2_mixing_all_phys_0003621_file100002.data"],
108 'PoolRDOInput' : ["LFN:top_GEO-02-01-00_RDO_extract.pool"],
109 'BSRDOOutput' : "",
110
111
112
113 'readTAG' : False,
114
115 'RootNtupleOutput' : "ntuple.root",
116 'RootHistoOutput' : "histo.root",
117 'readESD' : False,
118 'readAOD' : False,
119 'readRDO' : True,
120 'doWriteBS' : False,
121 'doWriteRDO' : False,
122 'doWriteESD' : True,
123 'doWriteAOD' : True,
124 'doWriteTAG' : True,
125 'doDPD' : False,
126 'doAOD' : True,
127 'doESD' : True,
128 'doRestrictedESD' : False,
129 'doAODall' : True,
130 'doAODCaloCells' : True,
131 'OutputLevel': INFO,
132 'doDetStatus' : True,
133 'doTimeLimit': False,
134 'doTruth' : True,
135 'doDumpMC' : False,
136 'doNameAuditor' : False,
137 'doShowSizeStatistics' : False,
138 'noESDTrigger' : False,
139 'doFileMetaData' : True,
140 'doBackNavigation' : False,
141 'doEdmMonitor' : False,
142 'doDumpTES' : False,
143 'doDumpTDS' : False,
144 'doFloatingPointException' : False,
145 'doCheckJOT' : False,
146 'doDumpPoolInputContent' : False,
147 'doDumpProperties' : False,
148 'doDetailedAuditor' : False,
149 'doSGAuditor' : False,
150 'doPerfMon' : False,
151 'doDetailedPerfMon' : False,
152 'doCheckDictionary' : False,
153 'doMonitoring': False,
154 'doCBNT' : True,
155 'CBNTAthenaAware' : True,
156 'doHeavyIon' : False,
157 'doLowPt' : False,
158 'doMinimalRec' : False,
159 'doHist' : True,
160 'doJiveXML' : False,
161 'doPersint' : False,
162 'LoadGeometry' : True,
163 'UserAlgs' : [],
164 'DPDMakerScripts' : [],
165 'AMITag' : ""
166 }
167
168
169
170
171
172
173
174
175
176
177 RecExCommonAlgs = {
178 'doTrackRecordFilter' : True,
179 'donewTracking' : True,
180 'doxKalman' : False,
181 'doiPatRec' : True,
182 'doBackTracking' : True,
183 'doEmCluster' : True,
184 'doCaloCluster' : False,
185 'doCaloTopoCluster' : True,
186 'doMoore' : True,
187 'doMuonboy' : True,
188 'doEgamma' : True,
189 'doJetRec' : True,
190 'doTauRec' : True,
191 'doMuonIDStandAlone' : True,
192 'doMuonIDCombined' : True,
193 'doMuidLowPt' : False,
194 'doMuGirl' : True,
195 'doStaco' : True,
196 'doMuTag' : True,
197 'doTileMuID' : True,
198 'doCaloTrkMuId' : True,
199 'doMuonSpShower' : True,
200 'doMissingET' : True,
201 'doObjMissingET' : True,
202 'doMissingETSig' : True,
203 'doEFlow' : False,
204 'doEFlowJet' : False,
205 'doTrigger' : True,
206 'doAtlfast' : False
207 }
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227 RecExCommonFlags.update (AthenaCommonFlags)
228 RecExCommonFlags.update (RecExCommonAlgs)
229
230
231
232
233 varInit=dir()
234
235
236 logRecExCommon_flags.info('starting the migration to JobProperties')
237
238
239 for i in RecExCommonFlags.keys():
240 if i in varInit:
241 i_value=eval(str(i))
242 if not i_value == RecExCommonFlags[i]:
243 logRecExCommon_flags.info( 'updating %s to value %s ' ,i,i_value)
244 RecExCommonFlags[i]=i_value
245
246
247
248 if rec.OutputLevel() <= DEBUG:
249 print "RecExCommon Flags values:"
250 print RecExCommonFlags
251
252
253
254
255
256
257 from RecExConfig.RecFlags import jobproperties, rec
258
259
260 from RecExConfig.RecAlgsFlags import recAlgs
261
262 from AthenaCommon.GlobalFlags import globalflags
263
264
265 try:
266 from CaloRec.CaloRecFlags import jobproperties
267 CaloRecFlagsOK=True
268 except Exception:
269 treatException("Could not instantiate CaloRecFlags ")
270 CaloRecFlagsOK=False
271
272 try:
273
274
275
276
277
278
279
280
281 from InDetRecExample.InDetJobProperties import InDetFlags
282
283 InDetFlags.doxKalman=False
284 except Exception:
285 treatException("Could not instantiate InDetFlags ")
286
287
288 try:
289 from MuonRecExample.MuonRecFlags import muonRecFlags
290 except Exception:
291 treatException("Could not instantiate muonRecFlags ")
292
293 try:
294 from MuonRecExample.MuonCBNTFlags import muonCBNT
295 except Exception:
296 treatException("Could not instantiate muonCBNT ")
297
298 try:
299 from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
300 except Exception:
301 treatException("Could not instantiate muonCombinedRecFlags ")
302
303
304 try:
305 from tauRec.tauRecFlags import jobproperties
306 tauRecFlagsOK=True
307 except Exception:
308 treatException("Could not instantiate tauRecFlags ")
309 tauRecFlagsOK=False
310
311 try:
312 from JetRec.JetRecFlags import jobproperties
313 JetRecFlagsOK=True
314 except Exception:
315 JetRecFlagsOK=False
316 pass
317
318 try:
319 from egammaRec.egammaRecFlags import jobproperties
320 egammaRecFlagsOK=True
321 except Exception:
322 treatException("Could not instantiate egammaRecFlags ")
323 egammaRecFlagsOK=False
324
325
326
327 varInit=dir()
328
329
330 if not rec.oldFlagTopSteering() :
331 logRecExCommon_flags.info( 'Steering from old flags disabled!')
332 else:
333 logRecExCommon_flags.info( 'Synchronising old flags to new flags')
334 for i in RecExCommonFlags.keys():
335 inew=i
336
337 if i=="donewTracking":
338 inew="doNewTracking"
339
340 if jobproperties.Rec.__dict__.keys().__contains__(i) and i != "doTrigger" :
341 if i in varInit:
342 exec 'i_value=%s' % (i)
343 data={'JobProperties.Rec':{i:i_value}}
344 jobproperties._log.info('RecExCommon_flags:: migration data %s',data)
345 jobproperties.set_JobProperties(data)
346 else:
347 exec 'jpvalue=jobproperties.Rec.%s()' % (i)
348 i_value=RecExCommonFlags.get(i)
349 if i_value!=jpvalue:
350 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
351
352 if(jobproperties.MuonCombinedRec.__dict__.keys().__contains__(inew)):
353 if i in varInit:
354
355 exec 'i_value=%s' % (i)
356 data={'JobProperties.MuonCombinedRec':{inew:i_value}}
357 jobproperties._log.info('RecExCommon_flags:: migration LOCKED data %s',data)
358 jobproperties.set_JobProperties(data)
359
360 exec 'jobproperties.MuonCombinedRec.%s._locked=True' % (inew)
361 else:
362 exec 'jpvalue=jobproperties.MuonCombinedRec.%s()' % (inew)
363 i_value=RecExCommonFlags.get(i)
364 if i_value!=jpvalue:
365 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
366 if(jobproperties.Rec.RecAlgs.__dict__.keys().__contains__(i)):
367 if i in varInit:
368
369 exec 'i_value=%s' % (i)
370 data={'JobProperties.Rec.RecAlgs':{i:i_value}}
371 jobproperties._log.info('RecExCommon_flags:: migration LOCKED data %s',data)
372 jobproperties.set_JobProperties(data)
373
374 exec 'recAlgs.%s._locked=True' % (i)
375 else:
376 exec 'jpvalue=jobproperties.Rec.RecAlgs.%s()' % (i)
377 i_value=RecExCommonFlags.get(i)
378 if i_value!=jpvalue:
379 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
380 if(CaloRecFlagsOK and jobproperties.CaloRecFlags.__dict__.keys().__contains__(i)):
381 if i in varInit:
382
383 exec 'i_value=%s' % (i)
384 data={'JobProperties.CaloRecFlags':{i:i_value}}
385 jobproperties._log.info('RecExCommon_flags:: migration LOCKED data %s',data)
386 jobproperties.set_JobProperties(data)
387
388 exec 'jobproperties.CaloRecFlags.%s._locked=True' % (i)
389 else:
390 exec 'jpvalue=jobproperties.CaloRecFlags.%s()' % (i)
391 i_value=RecExCommonFlags.get(i)
392 if i_value!=jpvalue:
393 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
394 elif(tauRecFlagsOK and jobproperties.tauRecFlags.__dict__.keys().__contains__(i)):
395 if i in varInit:
396
397 exec 'i_value=%s' % (i)
398 data={'JobProperties.tauRecFlags':{i:i_value}}
399 jobproperties._log.info('RecExCommon_flags:: migration LOCKED data %s',data)
400 jobproperties.set_JobProperties(data)
401
402 exec 'jobproperties.tauRecFlags.%s._locked=True' % (i)
403 else:
404 exec 'jpvalue=jobproperties.tauRecFlags.%s()' % (i)
405 i_value=RecExCommonFlags.get(i)
406 if i_value!=jpvalue:
407 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
408 if(jobproperties.InDetJobProperties.__dict__.keys().__contains__(inew)):
409 if i in varInit:
410
411 exec 'i_value=%s' % (i)
412 data={'JobProperties.InDetJobProperties':{inew:i_value}}
413 jobproperties._log.info('RecExCommon_flags:: migration LOCKED data %s',data)
414 jobproperties.set_JobProperties(data)
415
416 exec 'jobproperties.InDetJobProperties.%s._locked=True' % (inew)
417 else:
418 exec 'jpvalue=jobproperties.InDetJobProperties.%s()' % (inew)
419 i_value=RecExCommonFlags.get(i)
420 if i_value!=jpvalue:
421 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
422 if(jobproperties.MuonRec.__dict__.keys().__contains__(inew)):
423 if i in varInit:
424
425 exec 'i_value=%s' % (i)
426 data={'JobProperties.MuonRec':{inew:i_value}}
427 jobproperties._log.info('RecExCommon_flags:: migration LOCKED data %s',data)
428 jobproperties.set_JobProperties(data)
429
430 exec 'jobproperties.MuonRec.%s._locked=True' % (inew)
431 else:
432 exec 'jpvalue=jobproperties.MuonRec.%s()' % (inew)
433 i_value=RecExCommonFlags.get(i)
434 if i_value!=jpvalue:
435 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
436 if(jobproperties.Global.__dict__.keys().__contains__(i)):
437 if i in varInit:
438 exec 'i_value=%s' % (i)
439 data={'JobProperties.Global':{i:i_value}}
440 jobproperties._log.info('RecExCommon_flags:: migration data %s',data)
441 jobproperties.set_JobProperties(data)
442
443 else:
444 i_value=RecExCommonFlags.get(i)
445 exec 'jpvalue=jobproperties.Global.%s()' % (i)
446 if i_value!=jpvalue:
447 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
448
449 if(jobproperties.AthenaCommonFlags.__dict__.keys().__contains__(i)):
450 if i in varInit:
451 exec 'i_value=%s' % (i)
452 data={'JobProperties.AthenaCommonFlags':{i:i_value}}
453 jobproperties._log.info('RecExCommon_flags:: migration data %s',data)
454 jobproperties.set_JobProperties(data)
455 else:
456 i_value=RecExCommonFlags.get(i)
457 exec 'jpvalue=jobproperties.AthenaCommonFlags.%s()' % (i)
458 if i!="PoolRDOInput":
459 if i_value!=jpvalue:
460 logRecExCommon_flags.warning ('inconsistency: for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
461 else:
462 if i_value!=jpvalue:
463 logRecExCommon_flags.info ('Modified value for flag %s new flag: %s old flag:%s',i,jpvalue,i_value)
464
465
466
467
468
469
470
471
472
473 if rec.oldFlagTopSteering() and 'doBackNavigation' in varInit:
474 from RecExConfig.RecConfFlags import recConfFlags
475 recConfFlags.AllowBackNavigation=doBackNavigation
476
477
478
479
480 try:
481 import os
482
483 _env=os.environ
484 NICOS_NIGHTLY_NAME=''
485 NICOS_PROJECT_RELNAME_COPY=''
486 try:
487 NICOS_NIGHTLY_NAME=_env['NICOS_NIGHTLY_NAME']
488 NICOS_PROJECT_RELNAME_COPY=_env['NICOS_PROJECT_RELNAME_COPY']
489 logRecExCommon_flags.info('Detected NICOS name %s and copy %s'%(NICOS_NIGHTLY_NAME,NICOS_PROJECT_RELNAME_COPY) )
490 except Exception:
491 pass
492
493 if NICOS_NIGHTLY_NAME!='':
494
495 if NICOS_PROJECT_RELNAME_COPY=='rel_0' and (NICOS_NIGHTLY_NAME=='15.X.0' or NICOS_NIGHTLY_NAME=='15.X.0-VAL'):
496 logRecExCommon_flags.warning('Detected a dev or devval rel_0 nightly running NICOS. Enabling floating point exception ')
497 rec.doFloatingPointException=True
498 else:
499
500 _path=_env['PATH']
501 if _path.find('/afs/cern.ch/atlas/software/builds/nightlies/dev/AtlasCore/rel_0/')>=0 or _path.find('/afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasCore/rel_0/')>=0:
502 logRecExCommon_flags.warning('Detected a dev or devval rel_0 nightly. Enabling floating point exception ')
503 rec.doFloatingPointException=True
504 del _path
505 del _env
506 except Exception:
507 treatException ("Trouble detecting doFloatingPointException condition")
508
509
510
511
512
513 if rec.doFloatingPointException() and not athenaCommonFlags.isOnline():
514 from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
515 athenaCommonFlags.RuntimeStrictness='abort'
516 else:
517 from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
518 athenaCommonFlags.RuntimeStrictness='none'
519
520
521
522
523
524
525
526
527
528
529 if 'doJetRec' in varInit:
530 try:
531 from JetRec.JetRecFlags import jobproperties
532 jobproperties.JetRecFlags.Enabled.set_Value(doJetRec)
533 except Exception:
534 treatException("Could not set JetRecFlags.Enabled")
535
536
537
538
539 varInit=dir()
540
541 if not rec.oldFlagCompatibility():
542 print "oldFlagCompatibility==True : Deleting all standalone flags!"
543 for i in RecExCommonFlags.keys():
544
545 if i in varInit:
546 print "now deleting:",i
547 exec 'del %s' % i
548
549
550
551
552
553 if rec.doWriteRDO():
554 logRecExCommon_flags.info( "write RDO " )
555
556 rec.doESD=False
557
558
559 rec.doCBNT=False
560
561 if rec.readRDO() and globalflags.InputFormat()!='bytestream':
562
563 rec.doDetStatus=False
564
565 if rec.readAOD() and rec.readESD():
566 raise RuntimeError," readAOD and readESD cannot be on together"
567
568 if rec.readAOD():
569 logRecExCommon_flags.info( "read AOD : all algs switched off " )
570
571 rec.doESD=False
572 rec.doWriteESD=False
573 if rec.readRDO:
574 logRecExCommon_flags.info( "readAOD : switch readRDO off " )
575 rec.readRDO=False
576
577
578 if rec.readESD() :
579 logRecExCommon_flags.info( "read ESD : all algs switched off " )
580
581 rec.doESD=False
582
583
584 if rec.readRDO():
585 logRecExCommon_flags.info( "readESD : switch readRDO off " )
586 rec.readRDO=False
587
588
589 if not (rec.readRDO() or rec.readESD() or rec.readAOD()):
590 raise RuntimeError," at least one of readRDO readESD readAOD should be on !!!"
591
592
593
594 if athenaCommonFlags.FilesInput()!=[]:
595 logRecExCommon_flags.info("athenaCommonFlags.FilesInput override input file specification")
596
597
598 firstValid=-1
599 import PyUtils.AthFile as athFile
600 iFi=0
601 for fi in athenaCommonFlags.FilesInput():
602 if athFile.exists(fi):
603 if firstValid==-1:
604 firstValid=iFi
605 firstValidFi=fi
606 else:
607 logRecExCommon_flags.warning("File %s does not exist. Continue" % fi)
608 ++iFi
609 if firstValid==-1:
610 raise RunTimeError," no existing input file detected. Stop here."
611 else:
612 logRecExCommon_flags.info("Now configuring flags according to input file %s " % athenaCommonFlags.FilesInput()[iFi])
613 if len(athenaCommonFlags.FilesInput())>1:
614 logRecExCommon_flags.info("Be careful that all the input files should be consistent")
615
616
617
618 fileType=athFile.ftype(firstValidFi)
619 if fileType=="bs":
620 if not rec.readRDO():
621 raise RuntimeError, "athenaCommonFlags.FilesInput are bytestream files but rec.readRDO is False !"
622 try:
623 GlobalFlags.InputFormat.set_bytestream()
624 except Exception:
625 logRecExCommon_flags.warning("GlobalFlags.InputFormat already set")
626 athenaCommonFlags.BSRDOInput=athenaCommonFlags.FilesInput()
627 else:
628
629 import PyUtils.PoolFile as poolFile
630 try:
631 streams = poolFile.extract_stream_names (firstValidFi)
632 except Exception:
633 logRecExCommon_flags.warning("Exception extracting streams from input file %s " % firstValidFi )
634
635
636 logRecExCommon_flags.info("Extracted streams %s from input file " % streams )
637 if len(streams)==0:
638 logRecExCommon_flags.warning("No stream in input file. Default action.")
639 elif len(streams)>1:
640 logRecExCommon_flags.warning("More than one stream: %s in input file. Default action.")
641
642 if len(streams)==1:
643 if streams[0]=='Stream1':
644 logRecExCommon_flags.info("Input RDO detected")
645 elif streams[0]=='StreamESD':
646 logRecExCommon_flags.info("Input ESD detected. Do not remake ESD")
647 rec.readRDO=False
648 rec.readESD=True
649 rec.doESD=False
650 elif streams[0]=='StreamAOD':
651 logRecExCommon_flags.info("Input AOD detected. Do not remake ESD nor AOD.")
652 rec.readRDO=False
653 rec.readAOD=True
654 rec.doESD=False
655 rec.doAOD=False
656 elif streams[0]=='TAG':
657 logRecExCommon_flags.info("Input TAG detected. Default is to navigate to AOD. Do not remake ESD nor AOD")
658 rec.readRDO=False
659 rec.readTAG=True
660
661 rec.readAOD=True
662 rec.doESD=False
663 rec.doAOD=False
664 rec.doWriteTAG=False
665 else:
666 logRecExCommon_flags.info ("unknown stream detected %s keep default ",streams[0])
667
668
669 if rec.readTAG():
670 athenaCommonFlags.PoolTAGInput=athenaCommonFlags.FilesInput()
671 else:
672 if rec.readRDO():
673 athenaCommonFlags.PoolRDOInput=athenaCommonFlags.FilesInput()
674 elif rec.readESD():
675 athenaCommonFlags.PoolESDInput=athenaCommonFlags.FilesInput()
676 elif rec.readAOD():
677 athenaCommonFlags.PoolAODInput=athenaCommonFlags.FilesInput()
678 elif rec.readAOD():
679 athenaCommonFlags.PoolAODInput=athenaCommonFlags.FilesInput()
680
681
682
683
684
685
686 from AthenaCommon.Include import excludeTracePattern
687 excludeTracePattern.append("*/PyUtils/*")
688
689
690
691
692 rec.readRDO.lock()
693 rec.readESD.lock()
694 rec.readAOD.lock()
695 rec.readTAG.lock()
696 athenaCommonFlags.FilesInput.lock()
697 athenaCommonFlags.PoolRDOInput.lock()
698 athenaCommonFlags.PoolESDInput.lock()
699 athenaCommonFlags.PoolAODInput.lock()
700 athenaCommonFlags.PoolTAGInput.lock()
701 globalflags.InputFormat.lock()
702
703 oksInputFileOriginal=None
704
705 from RecExCond.RecFlagFunctions import inputFileNames
706
707 if globalflags.InputFormat()=='pool':
708 try:
709 from AthenaCommon.KeyStore import loadKeyStoreFromPoolFile
710 _inputFile=inputFileNames()[0]
711 logRecExCommon_flags.info("Determined first input file %s",_inputFile)
712 oksInputFileOriginal = loadKeyStoreFromPoolFile(keyStore="inputFileOriginal",pool_file=_inputFile,label='inputFile')
713 del _inputFile
714 except Exception:
715 logRecExCommon_flags.warning("could not load oks from input file %s . Either file does not exist either a LFN." % _inputFile )
716
717
718
719
720 if rec.doTruth() and oksInputFileOriginal!=None and not oksInputFileOriginal.inputFile.dict().has_key("McEventCollection"):
721 logRecExCommon_flags.info("No McEventCollection in input file. Switching doTruth=False")
722 rec.doTruth=False
723
724 if rec.doTruth():
725 logRecExCommon_flags.warning("No McEventCollection in input file. Could not switch doTruth=False. Continue at your own risk.")
726
727
728
729
730
731
732
733
734 if rec.Commissioning():
735
736
737
738
739
740
741
742
743
744
745
746
747 from AthenaCommon.JobProperties import jobproperties
748
749
750 from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
751
752
753
754
755 from RecExConfig.RecFlags import jobproperties, rec
756
757 athenaCommonFlags.PoolInputQuery = "TRT_Cosmic_Tracks"
758
759 from AthenaCommon.GlobalFlags import globalflags
760
761 rec.RootHistoOutput = "monitoring.root"
762 rec.RootNtupleOutput = "ntuple.root"
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782 from RecExConfig.RecAlgsFlags import recAlgs
783
784
785
786
787
788
789 from RecExConfig.RecFlags import rec
790 if not 'InDetKeys' in dir():
791
792
793
794 print "InDetRec_jobOptions: InDetKeys not set before - I import them now"
795 from InDetRecExample.InDetKeys import InDetKeys
796
797
798
799
800
801
802 include( "RecExCommission/RecExCommissionFlags_jobOptions.py" )
803 if rec.readESD() or rec.readAOD():
804 ATLASCosmicFlags.doFilteredESD=False
805 ATLASCosmicFlags.doCalibFillNt = False
806
807
808
809
810 theApp.EvtMax = athenaCommonFlags.EvtMax()
811
812
813 if rec.readESD():
814 rec.doHist = False
815 ATLASCosmicFlags.doLVL1Calo = False
816 ATLASCosmicFlags.doCTPMon=False
817
818
819 if athenaCommonFlags.isOnline:
820 rec.doWriteTAG = False
821 rec.doWriteTAGCOM = False
822 rec.doWriteESD = False
823 rec.doDetStatus=False
824 rec.doHist=False
825
826
827
828
829
830
831
832 if rec.doMuon() and rec.doESD():
833
834 from MuonRecExample.MuonRecFlags import muonRecFlags
835 from MuonCalibAlgs.MuonCalibFlags import muonCalibFlags
836
837 muonRecFlags.doCalib = ATLASCosmicFlags.doCalibFillNt
838
839
840
841 if globalflags.DataSource()=='geant4' and ATLASCosmicFlags.doMasking:
842
843 muonRecFlags.doPrdSelect = True
844
845
846
847
848 from AthenaCommon.BFieldFlags import jobproperties
849
850 from MuonDQAMonFlags.MuonDQAFlags import MuonDQAFlags as MuonDQAFlags
851 MuonDQAFlags.doMuonMon = ATLASCosmicFlags.doMuonMon
852 MuonDQAFlags.doMuonEvtMon = ATLASCosmicFlags.doMuonEvtMon
853 MuonDQAFlags.doMuonHitMon = ATLASCosmicFlags.doMuonHitMon
854 MuonDQAFlags.doMDTMon = ATLASCosmicFlags.doMDTMon
855 MuonDQAFlags.doRPCMon = ATLASCosmicFlags.doRPCMon
856 MuonDQAFlags.doRPCL1Mon = ATLASCosmicFlags.doRPCL1Mon
857 MuonDQAFlags.doMDTRPCMon = ATLASCosmicFlags.doMDTRPCMon
858 MuonDQAFlags.doMDTTGCL1Mon = ATLASCosmicFlags.doMDTTGCL1Mon
859 MuonDQAFlags.doCSCMon = ATLASCosmicFlags.doCSCMon
860 MuonDQAFlags.doTGCMon = ATLASCosmicFlags.doTGCMon
861 MuonDQAFlags.doTGCL1Mon = ATLASCosmicFlags.doTGCL1Mon
862 MuonDQAFlags.doMuonSegmMon = ATLASCosmicFlags.doMuonSegmMon
863 MuonDQAFlags.doMuonTrackMon = ATLASCosmicFlags.doMuonTrackMon
864 MuonDQAFlags.doMuonPhysMon = ATLASCosmicFlags.doMuonPhysMon
865 MuonDQAFlags.MuonTrkMonDoTrigger = False
866
867
868
869
870 from LArConditionsCommon.LArCondFlags import larCondFlags
871 if rec.doESD() and rec.doLArg():
872 if larCondFlags.OFCShapeFolder=='5samples3bins17phases':
873 doLAr3nsOFCs = True
874 else:
875 doLAr3nsOFCs = False
876 include( "CaloCosEx/LArCosmicFlags_jobOptions.py" )
877 if globalflags.DataSource()=='geant4':
878 LArCosmicFlags.doSim = True
879 else:
880 LArCosmicFlags.doSim = False
881
882 if larCondFlags.LArCoolChannelSelection=='':
883 if ATLASCosmicFlags.CosmicSetup == 'M6':
884 larCondFlags.LArCoolChannelSelection="0,92:116,206:230,232,234,236,238,1003,1007,1009,1011"
885 if ATLASCosmicFlags.CosmicSetup == 'M7':
886
887 larCondFlags.LArCoolChannelSelection="35:66,92:116,149:180,206:230,232,234,236,238,331,338,344,350,1001,1003,1005,1007,1011,1021"
888
889 if globalflags.DataSource()=='geant4' and ATLASCosmicFlags.doMasking:
890 if ATLASCosmicFlags.CosmicSetup == 'M6':
891 MaskedLArCells=["0 0","0 1","1 0"]
892
893 if rec.doESD() and rec.doTile():
894 include( "CaloCosEx/TileCosmicFlags_jobOptions.py" )
895 if globalflags.DataSource()=='geant4':
896 TileCosmicFlags.doSim = True
897 else:
898 TileCosmicFlags.doSim = False
899 TileCosmicFlags.doMasking = ATLASCosmicFlags.doMasking
900 TileCosmicFlags.CosmicSetup = ATLASCosmicFlags.CosmicSetup
901 TileCosmicFlags.storeTileCellDetails = True
902
903 if rec.doESD() and ATLASCosmicFlags.doCTPMon:
904 include("TrigT1CTMonitoring/CTPFlags.py")
905
906
907
908
909
910
911
912
913 rec.Commissioning=True
914 rec.ScopingLevel=4
915
916 from AthenaCommon.GlobalFlags import GlobalFlags
917
918 if jobproperties.Beam.beamType()=='cosmics':
919 GlobalFlags.DetGeo.set_commis()
920 else:
921 GlobalFlags.DetGeo.set_atlas()
922
923 if globalflags.DataSource()=='geant4':
924 GlobalFlags.DataSource.set_geant4()
925 if globalflags.InputFormat() == 'pool':
926 GlobalFlags.InputFormat.set_pool()
927
928 if globalflags.DataSource()=='data':
929 GlobalFlags.DataSource.set_data()
930 if globalflags.InputFormat() == 'bytestream':
931 GlobalFlags.InputFormat.set_bytestream()
932
933
934
935 from AthenaCommon.GlobalFlags import jobproperties
936 if globalflags.DataSource()=='geant4':
937 if ATLASCosmicFlags.IOVDbSvcGlobalTagSimOverride:
938 jobproperties.Global.ConditionsTag.set_Value_and_Lock(ATLASCosmicFlags.IOVDbSvcGlobalTagSim)
939 else:
940 jobproperties.Global.ConditionsTag.set_Value_and_Lock('')
941 else:
942 jobproperties.Global.ConditionsTag.set_Value_and_Lock(ATLASCosmicFlags.IOVDbSvcGlobalTagData)
943
944
945 from IOVDbSvc.CondDB import conddb
946 conddb.setGlobalTag(globalflags.ConditionsTag())
947
948
949
950
951
952
953 athenaCommonFlags.SkipEvents.set_On()
954
955 logRecExCommon_flags.info('done the mapping in between the old flags and JobProperties')
956
957
958
959
960
961 if rec.Production():
962 athenaCommonFlags.AllowIgnoreConfigError=False
963 from RecExConfig.RecConfFlags import recConfFlags
964 recConfFlags.AllowIgnoreConfigError=False
965
966
967
968
969
970
971
972
973 if not rec.oldFlagTopSteering and rec.oldFlagCompatibility:
974 raise RuntimeError,"rec.oldFlagTopSteering false inconsistent with rec.oldFlagCompatibility true"
975
976
977
978
979
980
981
982
983
984
985 include ("RecExCond/RecExCommon_DetFlags.py")
986
987
988
989
990 if globalflags.InputFormat.is_bytestream():
991 logRecExCommon_flags.info("No truth in bytestream, setting doTruth=False")
992 rec.doTruth=False
993
994 import os
995
996 if os.environ['CMTCONFIG'].endswith('-dbg'):
997 rec.doEdmMonitor=True
998 else:
999 rec.doEdmMonitor=False
1000
1001
1002 if not rec.doESD():
1003
1004 for algflag in jobproperties.Rec.RecAlgs.__dict__.keys():
1005
1006 if not algflag in ["__name__","_context_name"]:
1007 data={'JobProperties.Rec.RecAlgs':{algflag:False}}
1008 jobproperties._log.info('RecExCommon_flags:: migration data %s',data)
1009 jobproperties.set_JobProperties(data)
1010
1011 try:
1012 from CaloRec.CaloRecFlags import jobproperties
1013 jobproperties.CaloRecFlags.Enabled=False
1014 except Exception:
1015 treatException("Could not instantiate CaloRecFlags")
1016
1017 try:
1018 from InDetRecExample.InDetJobProperties import InDetFlags
1019 jobproperties.InDetJobProperties.Enabled=False
1020 except Exception:
1021 treatException("Could not instantiate InDetFlags")
1022
1023 try:
1024 from MuonRecExample.MuonRecFlags import muonRecFlags
1025 jobproperties.MuonRec.Enabled=False
1026 except Exception:
1027 treatException("Could not instantiate muonRecFlags")
1028
1029 try:
1030 from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
1031 jobproperties.MuonCombinedRec.Enabled=False
1032 except Exception:
1033 treatException("Could not instantiate muonCombinedRecFlags")
1034
1035 try:
1036 from egammaRec.egammaRecFlags import jobproperties
1037 jobproperties.egammaRecFlags.Enabled=False
1038 except Exception:
1039 treatException("Could not instantiate egammaRecFlags")
1040
1041 try:
1042 from JetRec.JetRecFlags import jobproperties
1043 jobproperties.JetRecFlags.Enabled=False
1044 except Exception:
1045 treatException("Could not instantiate JetRecFlags")
1046
1047
1048 try:
1049 from tauRec.tauRecFlags import jobproperties
1050 jobproperties.tauRecFlags.Enabled=False
1051 except Exception:
1052 treatException("Could not instantiate tauRecFlags")
1053
1054
1055 if rec.doESD() and rec.doHeavyIon():
1056 include ("HIRecExample/heavyion_flagsESD.py")
1057 if rec.doAOD() and rec.doHeavyIon():
1058 include ("HIRecExample/heavyion_flagsAOD.py")
1059
1060
1061
1062
1063
1064 if rec.doMinimalRec():
1065 include ("RecExCond/MinimalRec_flagsESD.py")
1066
1067
1068
1069
1070
1071 _AODFlagsAvailable=True
1072 try:
1073 from ParticleBuilderOptions.AODFlags import AODFlags
1074 except Exception:
1075 _AODFlagsAvailable=False
1076 logRecExCommon_flags.info("AODFlags not available. Ok if AtlasReconstruction")
1077
1078 if not rec.doInDet:
1079 DetFlags.ID_setOff()
1080 from InDetRecExample.InDetJobProperties import InDetFlags
1081 InDetFlags.Enabled=False
1082 if _AODFlagsAvailable:
1083 AODFlags.FastTrackParticle=False
1084 else:
1085 if rec.Production:
1086 from InDetRecExample.InDetJobProperties import InDetFlags
1087 InDetFlags.doiPatRec=False
1088
1089 if not rec.doLArg:
1090 DetFlags.LAr_setOff()
1091
1092 if not rec.doTile:
1093 DetFlags.Tile_setOff()
1094 try:
1095 from CaloRec.CaloRecFlags import jobproperties
1096 jobproperties.CaloRecFlags.doTileMuId=False
1097 except Exception:
1098
1099 pass
1100
1101 if not rec.doCalo:
1102 DetFlags.Calo_setOff()
1103 try:
1104 from CaloRec.CaloRecFlags import jobproperties
1105 jobproperties.CaloRecFlags.Enabled=False
1106 except Exception:
1107 pass
1108
1109
1110 if not rec.doMuon:
1111 DetFlags.Muon_setOff()
1112
1113 recAlgs.doTrackRecordFilter=False
1114 from MuonRecExample.MuonRecFlags import muonRecFlags
1115 jobproperties.MuonRec.Enabled=False
1116 if _AODFlagsAvailable:
1117 AODFlags.MuonTrackSlimmer=False
1118
1119 if not rec.doJetMissingETTag:
1120 recAlgs.doMissingET=False
1121 recAlgs.doObjMissingET=False
1122 recAlgs.doMissingETSig=False
1123 recAlgs.doEFlow=False
1124 recAlgs.doEFlowJet=False
1125 from JetRec.JetRecFlags import jobproperties
1126 jobproperties.JetRecFlags.Enabled.set_Value(False)
1127
1128 if _AODFlagsAvailable:
1129 AODFlags.ParticleJet=False
1130 AODFlags.JetTag=False
1131 AODFlags.MissingEtTruth=False
1132 AODFlags.TruthParticleJet=False
1133
1134 if not rec.doEgamma:
1135 try:
1136 jobproperties.egammaRecFlags.Enabled=False
1137 except Exception:
1138 pass
1139
1140 if _AODFlagsAvailable:
1141 AODFlags.egammaTrackSlimmer=False
1142
1143 if not rec.doMuonCombined:
1144
1145 from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
1146 muonCombinedRecFlags.Enabled=False
1147 recAlgs.doMuonSpShower=False
1148 recAlgs.doMuidLowPt=False
1149
1150
1151 if not rec.doTau:
1152 try:
1153 jobproperties.tauRecFlags.Enabled=False
1154 except Exception:
1155 pass
1156
1157 if not rec.doTrigger:
1158
1159 recAlgs.doTrigger=False
1160 if _AODFlagsAvailable:
1161 AODFlags.Trigger=False
1162
1163
1164
1165
1166 readMuonDigit=False
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186 try:
1187 from InDetRecExample.InDetJobProperties import InDetFlags
1188 if not rec.doTruth():
1189 InDetFlags.doTruth = False
1190 except Exception:
1191 treatException("Could not instantiate InDetFlags=>switch off ID ")
1192 DetFlags.ID_setOff()
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203 if not rec.doTruth() or ( globalflags.DetDescrVersion()[0:3]=="DC1" or globalflags.DetDescrVersion()[0:3]=="DC2" ) :
1204 logRecExCommon_flags.info("TrackRecordFilter alg switched off ")
1205 recAlgs.doTrackRecordFilter=False
1206
1207
1208
1209
1210
1211 if rec.doWriteAOD() and not rec.doAOD() and not rec.readAOD():
1212 logRecExCommon_flags.warning("doAOD False and doWriteAOD True and readAOD False. Most likely meaninglesss !! ")
1213
1214
1215 if rec.doWriteTAGCOM() and not rec.Commissioning():
1216 logRecExCommon_flags.info("Not commissioning, switching of doWriteTAGCOM ")
1217 rec.doWriteTAGCOM=False
1218
1219
1220 if not rec.doAOD() and not rec.readAOD() and rec.doWriteTAG():
1221 logRecExCommon_flags.warning("no AOD objects available, cannot write out tag, switching rec.doWriteTAG=False")
1222 rec.doWriteTAG=False
1223
1224
1225
1226
1227 doTriggerConfigOnly=False
1228 if rec.doWriteTAG() and not recAlgs.doTrigger() and not ('EventTagFlags' in dir() and not EventTagFlags.doTrigger()) :
1229 try:
1230 from TriggerJobOpts.TriggerFlags import TriggerFlags
1231 doTriggerConfigOnly=True
1232 jobproperties.Trigger.doTriggerConfigOnly=True
1233 except:
1234 logRecExCommon_flags.info("TriggerJobOpts.TriggerFlags not available.")
1235
1236 if not recAlgs.doTrigger() and not rec.readAOD() and not rec.readESD() and rec.doWriteTAG():
1237 logRecExCommon_flags.warning("no trigger and running from RDO: cannot write out tag, switching of trigger part of tag")
1238 include ('EventTagAlgs/EventTagFlags.py')
1239 EventTagFlags.set_TriggerOff()
1240
1241
1242 if rec.doAOD() and _AODFlagsAvailable:
1243 from ParticleBuilderOptions.AODFlags import AODFlags
1244
1245
1246 if not rec.doTruth():
1247 AODFlags.SpclMC=False
1248 AODFlags.TruthParticleJet=False
1249 AODFlags.FastSimulation=False
1250
1251
1252 AODFlags.FastTrackParticle=rec.doTruth()
1253
1254
1255 AODFlags.Print()
1256
1257
1258
1259 try:
1260 if rec.doTrigger():
1261 from TriggerJobOpts.TriggerFlags import TriggerFlags, sync_Trigger2Reco
1262 sync_Trigger2Reco()
1263 except Exception:
1264 logRecExCommon_flags.info("Could not load TriggerFlags. OK only if AtlasReconstruction")
1265
1266
1267 class landmine:
1268 def __nonzero__(self):
1269 raise RuntimeError,"usage of this flag is forbidden!"
1270
1271
1272 varInit=dir()
1273 if not rec.oldFlagCompatibility():
1274 print "oldFlagCompatibility==True : Deleting all standalone flags! and forbidding use of old flags"
1275 for i in RecExCommonFlags.keys():
1276 if i in varInit:
1277 print "deleting again:",i
1278 exec 'del %s' % i
1279
1280 if rec.oldFlagLandMine():
1281 exec '%s=landmine()' % i
1282
1283 del _AODFlagsAvailable
Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
This page was automatically generated by the
LXR engine.
|
|