14 from array
import array
17 from ROOT
import HWIdentifier, Identifier, IdentifierHash, TFile
18 from 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")
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="])
140 except Exception
as e:
146 ifile=
'ESD.pool.root'
151 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
152 detdescrtag=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"):
167 sys.argv = sys.argv[:1] + [
'-b']
169 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
171 flags.Input.Files = ifile.split(
",")
173 flags.IOVDb.DatabaseInstance=
"CONDBR2"
174 flags.GeoModel.AtlasVersion = detdescrtag
175 flags.LAr.doAlign=
False
177 from AthenaConfiguration.DetectorConfigFlags
import disableDetectors, allDetectors
179 flags.Detector.EnableLAr =
True
180 flags.Detector.EnableTile =
True
181 flags.Detector.EnableCalo =
True
184 flags.Exec.OutputLevel=INFO
188 from RootUtils
import PyROOTFixes
189 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
192 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
195 from TileGeoModel.TileGMConfig
import TileGMCfg
197 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
200 from AthenaConfiguration.ComponentFactory
import CompFactory
201 cfg.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg())
203 cfg.addEventAlgo(
CellE(ofile,sc))