3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
10 if flags.Detector.GeometryBpipe:
11 from BeamPipeGeoModel.BeamPipeGMConfig
import BeamPipeGeometryCfg
15 if flags.Detector.GeometryPixel:
16 from PixelGeoModel.PixelGeoModelConfig
import PixelReadoutGeometryCfg
20 if flags.Detector.GeometrySCT:
21 from SCT_GeoModel.SCT_GeoModelConfig
import SCT_ReadoutGeometryCfg
25 if flags.Detector.GeometryTRT:
26 from TRT_GeoModel.TRT_GeoModelConfig
import TRT_ReadoutGeometryCfg
30 if flags.Detector.GeometryITkPixel:
31 from PixelGeoModelXml.ITkPixelGeoModelConfig
import ITkPixelReadoutGeometryCfg
35 if flags.Detector.GeometryITkStrip:
36 from StripGeoModelXml.ITkStripGeoModelConfig
import ITkStripReadoutGeometryCfg
40 if flags.Detector.GeometryHGTD:
41 from HGTD_GeoModelXml.HGTD_GeoModelConfig
import HGTD_ReadoutGeometryCfg
45 if flags.Detector.GeometryLAr:
46 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
50 if flags.Detector.GeometryTile:
51 from TileGeoModel.TileGMConfig
import TileGMCfg
55 if flags.Detector.GeometryMuon:
56 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
62 if flags.Detector.GeometryID:
63 from InDetServMatGeoModel.InDetServMatGeoModelConfig
import (
64 InDetServiceMaterialCfg)
72 if "AtlasVersion" in os.environ:
73 return os.environ[
"AtlasVersion"]
74 if "AtlasBaseVersion" in os.environ:
75 return os.environ[
"AtlasBaseVersion"]
86 the_alg = CompFactory.VP1Alg(name=
"VP1EventDisplayAlg", **kwargs)
87 result.addEventAlgo(the_alg, primary=
True)
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
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.",
150 help=
"Run VP1 in 'batch' mode with a given configuration file.",
153 "--batch-all-events",
155 help=
"Process all events in the input data file in '-batch' mode. Use this together with '-batch'.",
160 help=
"Process 'N' events in the input data file in '-batch' mode. Use this together with '-batch'.",
163 "--batch-output-folder",
164 help=
"Specify an output folder to store the event displays produced with the '-batch' option.",
167 "--batch-random-config",
169 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'.",
173 "--live", action=
"store_true", help=
"Run on live events from point 1."
178 help=
"Run on live events from point 1 in local directory.",
182 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).",
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 keep local copies of processed event files. If --eventsrc is set, then -eventcpy will default to /tmp/emoyse/vp1events/6897 .",
195 args = flags.fillFromArgs(parser=parser)
204 if args.Filename
and (
205 flags.Input.Files == []
206 or flags.Input.Files == [
"_ATHENA_GENERIC_INPUTFILE_NAME_"]
208 flags.Input.Files = [args.Filename]
210 _logger.verbose(
"+ About to set flags related to the input")
214 vp1_empty_input =
False
217 if flags.Input.Files == []
or flags.Input.Files == [
218 "_ATHENA_GENERIC_INPUTFILE_NAME_"
220 from Campaigns.Utils
import Campaign
221 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
223 vp1_empty_input =
True
231 flags.Input.ProjectName =
"mc20_13TeV"
232 flags.Input.RunNumbers = [330000]
233 flags.Input.TimeStamps = [1]
234 flags.Input.TypedCollections = []
237 flags.IOVDb.GlobalTag =
"OFLCOND-MC23-SDR-RUN3-02"
238 flags.Input.isMC =
True
239 flags.Input.MCCampaign = Campaign.Unknown
240 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
245 for file
in flags.Input.Files:
246 if not path.exists(flags.Input.Files[0]):
247 _logger.warning(
"Input file", file,
"does not exist")
253 flags.Common.isOnline = args.online
254 elif "HLTP" in flags.IOVDb.GlobalTag:
256 "HLTP detected in the global tag, but --online mode is not enabled. Enabling it now."
258 flags.Common.isOnline =
True
260 _logger.verbose(
"+ ... Input flags done")
262 _logger.verbose(
"+ About to set the detector flags")
264 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
269 use_metadata=
not vp1_empty_input,
270 toggle_geometry=
True,
273 _logger.verbose(
"+ ... Detector flags done")
289 _logger.verbose(
"+ Setup main services, and input file reading")
291 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
295 if not vp1_empty_input:
298 if flags.Input.Format
is Format.POOL:
299 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
303 if "EventInfo" not in flags.Input.Collections:
304 from xAODEventInfoCnv.xAODEventInfoCnvConfig
import EventInfoCnvAlgCfg
307 from TrkConfig.TrackCollectionReadConfig
import TrackCollectionReadCfg
310 from TrkConfig.AtlasExtrapolationEngineConfig
import AtlasExtrapolationEngineCfg
312 cfg.addPublicTool(AtlasExtrapolationEngine)
314 from TrkEventCnvTools.TrkEventCnvToolsConfig
import TrkEventCnvSuperToolCfg
318 if flags.Input.isMC
and "xAOD::TruthEventContainer#TruthEvents" not in flags.Input.TypedCollections:
320 from xAODTruthCnv.xAODTruthCnvConfig
import GEN_AOD2xAODCfg
323 _logger.verbose(
"+ ... Main services done")
325 _logger.verbose(
"+ About to setup geometry")
327 _logger.verbose(
"+ ... Geometry done")
331 if not args.verboseAthena:
333 print(
"Suppressing most messages from Athena.")
334 print(
"To see more, set the --verboseAthena flag to true.")
335 msgService = cfg.getService(
"MessageSvc")
336 msgService.OutputLevel = 4
339 vp1config.setdefault(
"InitialCruiseMode",
"EVENT")
340 vp1config.setdefault(
"InitialCruiseModePeriod", args.cruise)
343 print(
"Using config file", args.config)
344 vp1config.setdefault(
"InitialInputVP1Files", args.config)
352 vp1config.setdefault(
"MultipleFilesON",
True)
354 if args.live
or args.livelocal:
363 vp1config.setdefault(
"MultipleFilesON",
True)
365 vp1config.setdefault(
"vp1Alg.MFLocalCopyDir", args.eventcpy)
366 if args.extraevtsrcdir:
367 vp1config.setdefault(
"MFAvailableLocalInputDirectories", args.extraevtsrcdir)
369 vp1config.setdefault(
371 "https://atlas-live.cern.ch/event_files/L1MinBias/vp1fileinfo.txt",
374 vp1config.setdefault(
"MFSourceDir",
"/VP1_events/")
385 os.putenv(
"VP1_BATCHMODE",
"1")
386 if args.batch_all_events:
387 os.putenv(
"VP1_BATCHMODE_ALLEVENTS",
"1")
388 if args.batch_n_events:
389 os.putenv(
"VP1_BATCHMODE_NEVENTS",
str(args.batch_n_events))
390 if args.batch_output_folder:
391 os.putenv(
"VP1_BATCHMODE_OUT_FOLDER", args.batch_output_folder)
392 if args.batch_random_config:
393 os.putenv(
"VP1_BATCHMODE_RANDOMCONFIG",
"1")
396 if __name__ ==
"__main__":