ATLAS Offline Software
exampleDriverScript.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 #Import the configution-method we want to use (here: Delay and Cali-OFCs)
4 from LArCalibProcessing.LArCalib_Delay_OFCCaliConfig import LArDelay_OFCCaliCfg
5 
6 #Import the MainServices (boilerplate)
7 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
8 
9 #Import the flag-container that is the arguemnt to the configuration methods
10 from AthenaConfiguration.AllConfigFlags import initConfigFlags
11 flags = initConfigFlags()
12 from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags
13 addLArCalibFlags(flags)
14 
15 #This allows set flags from the command-line (not strictly required for the AP)
16 flags.fillFromArgs()
17 
18 #Now we set the flags as required for this particular job:
19 #The following flags help finding the input bytestream files:
20 flags.LArCalib.Input.Dir = "/scratch/wlampl/calib21/HECFCAL_Oct20"
21 flags.LArCalib.Input.Type="calibration_LArElec-Delay"
22 flags.LArCalib.Input.RunNumbers=[404512,]
23 flags.Input.Files=flags.LArCalib.Input.Files
24 
25 #Set the database (sqlite-file) containing the input conditions that
26 #come typcially from the same calibration campaign
27 #(in this case, Pedestal and AutoCorr)
28 flags.LArCalib.Input.Database="db.sqlite"
29 
30 #Some configs depend on the sub-calo in question, here HEC
31 #(sets also the preselection of LArRawCalibDataReadingAlg)
32 flags.LArCalib.Input.SubDet="HEC"
33 
34 #Configure the Bad-Channel database we are reading
35 #(the AP typically uses a snapshot in an sqlite file
36 flags.LArCalib.BadChannelDB="BadChannelSnapshot.db"
37 flags.LArCalib.BadChannelTag="-RUN2-UPD3-00"
38 
39 #Set a Geometry version (not really needed, but the job complains otherwise)
40 from AthenaConfiguration.TestDefaults import defaultGeometryTags
41 flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
42 
43 #Output of this job:
44 #ROOT file:
45 flags.LArCalib.Output.ROOTFile="ofccali.root"
46 
47 #POOL file:
48 flags.LArCalib.Output.POOLFile="ofccali.pool.root"
49 
50 #sqlite file (can be the same as the input-sqlite, but slightly different syntax
51 flags.IOVDb.DBConnection="sqlite://;schema=db.sqlite;dbname=CONDBR2"
52 
53 #The global tag we are working with
54 flags.IOVDb.GlobalTag="LARCALIB-RUN2-00"
55 
56 
57 #Other potentially useful flags-settings:
58 
59 #Define the global output Level:
60 #from AthenaCommon.Constants import *
61 #flags.Exec.OutputLevel=VERBOSE
62 
63 #Feed-though preselection for bytestream input:
64 #flags.LArCalib.Preselection.BEC=[1]
65 #flags.LArCalib.Preselection.Side=[0]
66 
67 #Print the input files we found
68 print ("Input files to be processed:")
69 for f in flags.Input.Files:
70  print (f)
71 
72 
73 #Lock the flag-container (required)
74 flags.lock()
75 
76 #Get the Main services (EventLoopMgr, StoreGate, ... )
77 cfg=MainServicesCfg(flags)
78 
79 #Merge our own config into it
80 cfg.merge(LArDelay_OFCCaliCfg(flags))
81 
82 
83 #At this point we can alter the configuration
84 #(should not be necessary!!!)
85 #cfg.getEventAlgo("LArCaliWaveBuilder").OutputLevel=VERBOSE
86 
87 #from AthenaConfiguration.ComponentFactory import CompFactory
88 #cfg.addEventAlgo(CompFactory.LArPedestals2Ntuple(ContainerKey = "Pedestal",
89 # AddFEBTempInfo = False
90 # ))
91 
92 import sys
93 #run the application
94 print("Start running...")
95 sys.exit(cfg.run().isFailure())
96 #For jobs with no bytestream-input the last line is
97 #cfg.run(1)
98 #to process exactly one 'fake' event as the job does all it's work in stop()
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.LArCalib_Delay_OFCCaliConfig.LArDelay_OFCCaliCfg
def LArDelay_OFCCaliCfg(flags)
Definition: LArCalib_Delay_OFCCaliConfig.py:6
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
python.LArCalibConfigFlags.addLArCalibFlags
def addLArCalibFlags(flags, isSC=False)
Definition: LArCalibConfigFlags.py:3