14from array
import array
17from ROOT
import HWIdentifier, Identifier, IdentifierHash, TFile
18from AthenaPython
import PyAthena
23 self.
fout = ROOT.TFile(ofile,
"RECREATE")
28 self.
sg = PyAthena.py_svc(
'StoreGateSvc')
35 self.
detStore = PyAthena.py_svc(
'DetectorStore')
37 print(
"Failed to get DetectorStore")
45 print(
"Failed to get CaloCell_ID")
47 EI = self.
sg[
'EventInfo']
49 self.
msg.warning(
"Failed to get EventInfo")
53 self.
evtid=EI.eventNumber()
57 self.
msg.
debug(
"Doing CellE Ttree init")
73 self.
nt = ROOT.TTree(
"mytree",
"mytree")
74 self.
nt.SetDirectory(self.
fout)
76 self.
nt.Branch(
"Event",self.
aevtid,
"Event/l")
77 self.
nt.Branch(
"BCID",self.
abcid,
"BCID/I")
78 self.
nt.Branch(
"OffID",self.
idvec,
"OffID[ncell]/i")
79 self.
nt.Branch(
"calosamp",self.
calosamp,
"calosamp[ncell]/I")
80 self.
nt.Branch(
"pos_neg",self.
posneg,
"pos_neg[ncell]/I")
81 self.
nt.Branch(
"region",self.
region,
"region[ncell]/I")
82 self.
nt.Branch(
"eta",self.
etaidx,
"eta[ncell]/I")
83 self.
nt.Branch(
"phi",self.
phiidx,
"phi[ncell]/I")
84 self.
nt.Branch(
"energy",self.
encell,
"energy[ncell]/D")
85 self.
nt.Branch(
"time",self.
timecell,
"time[ncell]/D")
86 self.
nt.Branch(
"prov",self.
provcell,
"prov[ncell]/s")
87 self.
nt.Branch(
"qual",self.
qcell,
"qual[ncell]/s")
89 self.
msg.
debug(
"CellE Ttree init done")
92 Cells = self.
sg[
'AllCalo']
94 Cells = self.
sg[
'SCell']
101 if cellitr >= self.
maxcells:
continue
102 self.
idvec[cellitr]=id.get_identifier32().get_compact()
108 self.
encell[cellitr]=c.energy()
110 self.
provcell[cellitr]=c.provenance()
111 self.
qcell[cellitr]=c.quality()
128 print(sys.argv[0]+
": Dump cells from pool file to ntuple")
130 print(
"-i input file (default ESD.pool.root)")
131 print(
"-o output file (default cells.root)")
132 print(
"-n number of events to dump (default -1)")
133 print(
"-m MC pool file (default false)")
134 print(
"-s is SC (default false)")
135 print(
"--detdescr <DetDescrVersion>")
136 print(
"-h Print this help text and exit")
139 opts,args=getopt.getopt(sys.argv[1:],
"i:o:n:msh",[
"help",
"detdescr="])
140except Exception
as e:
151from AthenaConfiguration.TestDefaults
import defaultGeometryTags
152detdescrtag=defaultGeometryTags.RUN2
155 if (o==
"-i"): ifile=a
156 if (o==
"-o"): ofile=a
157 if (o==
"-n"): nev=int(a)
158 if (o==
"-m"): mc=
True
159 if (o==
"-s"): sc=
True
160 if (o==
"-h" or o==
"--help"):
163 if (o==
"--detdescr"):
167sys.argv = sys.argv[:1] + [
'-b']
169from AthenaConfiguration.AllConfigFlags
import initConfigFlags
170flags=initConfigFlags()
171flags.Input.Files = ifile.split(
",")
173flags.IOVDb.DatabaseInstance=
"CONDBR2"
174flags.GeoModel.AtlasVersion = detdescrtag
175flags.LAr.doAlign=
False
177from AthenaConfiguration.DetectorConfigFlags
import disableDetectors, allDetectors
178disableDetectors(flags, allDetectors, toggle_geometry =
True)
179flags.Detector.EnableLAr =
True
180flags.Detector.EnableTile =
True
181flags.Detector.EnableCalo =
True
184flags.Exec.OutputLevel=INFO
188from RootUtils
import PyROOTFixes
189from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
190cfg=MainServicesCfg(flags)
192from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
193cfg.merge(PoolReadCfg(flags))
195from TileGeoModel.TileGMConfig
import TileGMCfg
196cfg.merge( TileGMCfg(flags) )
197from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
198cfg.merge(LArGMCfg(flags))
200 from AthenaConfiguration.ComponentFactory
import CompFactory
201 cfg.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg())
203cfg.addEventAlgo(
CellE(ofile,sc))
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
void print(char *figname, TCanvas *c1)
__init__(self, ofile, isSC)
virtual StatusCode execute() override
virtual StatusCode finalize() override
virtual StatusCode initialize() override