10 if flags.Detector.GeometryBpipe:
11 from BeamPipeGeoModel.BeamPipeGMConfig
import BeamPipeGeometryCfg
13 cfg.merge(BeamPipeGeometryCfg(flags))
15 if flags.Detector.GeometryPixel:
16 from PixelGeoModel.PixelGeoModelConfig
import PixelReadoutGeometryCfg
18 cfg.merge(PixelReadoutGeometryCfg(flags))
20 if flags.Detector.GeometrySCT:
21 from SCT_GeoModel.SCT_GeoModelConfig
import SCT_ReadoutGeometryCfg
23 cfg.merge(SCT_ReadoutGeometryCfg(flags))
25 if flags.Detector.GeometryTRT:
26 from TRT_GeoModel.TRT_GeoModelConfig
import TRT_ReadoutGeometryCfg
28 cfg.merge(TRT_ReadoutGeometryCfg(flags))
30 if flags.Detector.GeometryITkPixel:
31 from PixelGeoModelXml.ITkPixelGeoModelConfig
import ITkPixelReadoutGeometryCfg
33 cfg.merge(ITkPixelReadoutGeometryCfg(flags))
35 if flags.Detector.GeometryITkStrip:
36 from StripGeoModelXml.ITkStripGeoModelConfig
import ITkStripReadoutGeometryCfg
38 cfg.merge(ITkStripReadoutGeometryCfg(flags))
40 if flags.Detector.GeometryHGTD:
41 from HGTD_GeoModelXml.HGTD_GeoModelConfig
import HGTD_ReadoutGeometryCfg
43 cfg.merge(HGTD_ReadoutGeometryCfg(flags))
45 if flags.Detector.GeometryLAr:
46 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
48 cfg.merge(LArGMCfg(flags))
50 if flags.Detector.GeometryTile:
51 from TileGeoModel.TileGMConfig
import TileGMCfg
53 cfg.merge(TileGMCfg(flags))
55 if flags.Detector.GeometryMuon:
56 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
58 cfg.merge(MuonGeoModelCfg(flags))
62 if flags.Detector.GeometryID:
63 from InDetServMatGeoModel.InDetServMatGeoModelConfig
import (
64 InDetServiceMaterialCfg)
65 cfg.merge(InDetServiceMaterialCfg(flags))
92 from AthenaConfiguration.Enums
import Format
93 from AthenaCommon.Logging
import logging
97 _logger = logging.getLogger(
"VP1")
98 _logger.setLevel(VERBOSE)
100 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
102 flags = initConfigFlags()
103 flags.Concurrency.NumThreads = 0
111 parser = flags.getArgumentParser()
113 parser.description =
"""
114 VP1, or Virtual Point 1, is the interactive 3D event display for the ATLAS experiment at CERN.
115 Detailed documentation can be found at the webpage: https://atlas-vp1.web.cern.ch/atlas-vp1
116 but below are the flags that can be used to configure VP1 (most are standard Athena flags, but some are VP1-specific).
118 parser.description =
"""
119 So for example, to run VP1 on a file: vp1 [options] myESD.pool.root"""
121 group = parser.add_argument_group(
"VP1 specific")
125 help=
"Input file to pass to VP1 (i.e. vp1 myESD.pool.root as an alternative to vp1 --filesInput=[])",
131 help=
"Config file to use for VP1. If not specified, the default configuration will be used.",
136 help=
"If false, tell Athena to suppress INFO messages and below.",
139 "--online", action=
"store_true", help=
"Use this flag for running VP1 at P1."
144 help=
"Start in cruise mode, changing events after N seconds.",
148 "--phaseII", action=
"store_true", help=
"Launch VP1 with the current default Run4 geometry tag for Phase-II [that is, it sets 'flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4']. It cannot be used when running VP1 on a data file, otherwise it interferes with the auto-configuration from the metadata stored in the file."
154 help=
"Run VP1 in 'batch' mode with a given configuration file.",
157 "--batch-all-events",
159 help=
"Process all events in the input data file in '-batch' mode. Use this together with '-batch'.",
164 help=
"Process 'N' events in the input data file in '-batch' mode. Use this together with '-batch'.",
167 "--batch-output-folder",
168 help=
"Specify an output folder to store the event displays produced with the '-batch' option.",
171 "--batch-random-config",
173 help=
"Run VP1 in 'batch' mode; for each single event a configuration file will be randomly picked out of the configuration files provided by the user. Use this together with '-batch'.",
177 "--live", action=
"store_true", help=
"Run on live events from point 1."
182 help=
"Run on live events from point 1 in local directory.",
186 help=
"Directory to take single event files from (do not specify input files in this case). To get files from a web server (i.e. live events), put instead the url to the file residing in the same directory (most users should just use the --live option instead).",
190 help=
"Directory to take single event files from (do not specify input files in this case). To get files from a web server (i.e. live events), put instead the url to the file residing in the same directory (most users should just use the -live option instead).",
194 help=
"Directory to keep local copies of processed event files. If --eventsrc is set, then -eventcpy will default to /tmp/emoyse/vp1events/6897 .",
199 args = flags.fillFromArgs(parser=parser)
208 if args.Filename
and (
209 flags.Input.Files == []
210 or flags.Input.Files == [
"_ATHENA_GENERIC_INPUTFILE_NAME_"]
212 flags.Input.Files = [args.Filename]
214 _logger.verbose(
"+ About to set flags related to the input")
218 vp1_empty_input =
False
221 if (flags.Input.Files == []
or flags.Input.Files == [
"_ATHENA_GENERIC_INPUTFILE_NAME_"]):
223 from Campaigns.Utils
import Campaign
224 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
226 vp1_empty_input =
True
234 flags.Input.ProjectName =
"mc20_13TeV"
235 flags.Input.RunNumbers = [330000]
236 flags.Input.TimeStamps = [1]
237 flags.Input.TypedCollections = []
240 flags.IOVDb.GlobalTag =
"OFLCOND-MC23-SDR-RUN3-02"
241 flags.Input.isMC =
True
242 flags.Input.MCCampaign = Campaign.Unknown
243 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
245 _logger.verbose(
"Phase-II mode!")
246 from Campaigns.Utils
import Campaign
247 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
248 vp1_empty_input =
True
249 flags.Input.ProjectName =
"mc21_14TeV"
250 flags.Input.RunNumbers = [601229]
251 flags.Input.TimeStamps = [1]
252 flags.Input.TypedCollections = []
255 flags.IOVDb.GlobalTag =
"OFLCOND-MC16-SDR-15"
256 flags.Input.isMC =
True
257 flags.Input.MCCampaign = Campaign.Unknown
258 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
267 _logger.error(
"VP1: The use of the `--phaseII` flag with input data file is not supported. When you run VP1 on input data file, metadata are taken from the data file itself. Please remove `--phaseII` and relaunch. However, if needed, you can still steer Athena by using the standard Athena flags and options. Exiting...\n")
274 for file
in flags.Input.Files:
275 if not path.exists(flags.Input.Files[0]):
276 _logger.warning(
"Input file '%s' does not exist", file)
282 flags.Common.isOnline = args.online
283 elif "HLTP" in flags.IOVDb.GlobalTag:
285 "HLTP detected in the global tag, but --online mode is not enabled. Enabling it now."
287 flags.Common.isOnline =
True
289 _logger.verbose(
"+ ... Input flags done")
291 _logger.verbose(
"+ About to set the detector flags")
293 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
298 use_metadata=
not vp1_empty_input,
299 toggle_geometry=
True,
302 _logger.verbose(
"+ ... Detector flags done")
318 _logger.verbose(
"+ Setup main services, and input file reading")
320 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
322 cfg = MainServicesCfg(flags)
324 if not vp1_empty_input:
327 if flags.Input.Format
is Format.POOL:
328 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
330 cfg.merge(PoolReadCfg(flags))
332 if "EventInfo" not in flags.Input.Collections:
333 from xAODEventInfoCnv.xAODEventInfoCnvConfig
import EventInfoCnvAlgCfg
334 cfg.merge(EventInfoCnvAlgCfg(flags))
336 from TrkConfig.TrackCollectionReadConfig
import TrackCollectionReadCfg
337 cfg.merge(TrackCollectionReadCfg(flags,
"Tracks"))
339 from TrkConfig.AtlasExtrapolationEngineConfig
import AtlasExtrapolationEngineCfg
340 AtlasExtrapolationEngine = cfg.getPrimaryAndMerge(AtlasExtrapolationEngineCfg(flags))
341 cfg.addPublicTool(AtlasExtrapolationEngine)
343 from TrkEventCnvTools.TrkEventCnvToolsConfig
import TrkEventCnvSuperToolCfg
344 cfg.merge(TrkEventCnvSuperToolCfg(flags))
347 if flags.Input.isMC
and "xAOD::TruthEventContainer#TruthEvents" not in flags.Input.TypedCollections:
349 from xAODTruthCnv.xAODTruthCnvConfig
import GEN_AOD2xAODCfg
350 cfg.merge(GEN_AOD2xAODCfg(flags))
352 _logger.verbose(
"+ ... Main services done")
354 _logger.verbose(
"+ About to setup geometry")
356 _logger.verbose(
"+ ... Geometry done")
360 if not args.verboseAthena:
362 print(
"Suppressing most messages from Athena.")
363 print(
"To see more, set the --verboseAthena flag to true.")
364 msgService = cfg.getService(
"MessageSvc")
365 msgService.OutputLevel = 4
368 vp1config.setdefault(
"InitialCruiseMode",
"EVENT")
369 vp1config.setdefault(
"InitialCruiseModePeriod", args.cruise)
372 print(
"Using config file", args.config)
373 vp1config.setdefault(
"InitialInputVP1Files", args.config)
381 vp1config.setdefault(
"MultipleFilesON",
True)
383 if args.live
or args.livelocal: