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")
 
   27         self.
sg = PyAthena.py_svc(
'StoreGateSvc')
 
   34            self.
detStore = PyAthena.py_svc(
'DetectorStore')
 
   36                print(
"Failed to get DetectorStore")
 
   41                print(
"Failed to get CaloCell_ID")
 
   43         EI = self.
sg[
'EventInfo']
 
   45                self.
msg.warning(
"Failed to get EventInfo")
 
   49                self.
evtid=EI.eventNumber()
 
   53            self.
msg.
debug(
"Doing CellE Ttree init")
 
   68            self.
nt = ROOT.TTree(
"mytree",
"mytree")
 
   71            self.
nt.Branch(
"Event",self.
aevtid,
"Event/l")
 
   72            self.
nt.Branch(
"BCID",self.
abcid,
"BCID/I")
 
   73            self.
nt.Branch(
"OffID",self.
idvec,
"OffID[ncell]/i")
 
   74            self.
nt.Branch(
"calosamp",self.
calosamp,
"calosamp[ncell]/I")
 
   75            self.
nt.Branch(
"region",self.
region,
"region[ncell]/I")
 
   76            self.
nt.Branch(
"eta",self.
etaidx,
"eta[ncell]/I")
 
   77            self.
nt.Branch(
"phi",self.
phiidx,
"phi[ncell]/I")
 
   78            self.
nt.Branch(
"energy",self.
encell,
"energy[ncell]/D")
 
   79            self.
nt.Branch(
"time",self.
timecell,
"time[ncell]/D")
 
   80            self.
nt.Branch(
"prov",self.
provcell,
"prov[ncell]/s")
 
   81            self.
nt.Branch(
"qual",self.
qcell,
"qual[ncell]/s")
 
   83            self.
msg.
debug(
"CellE Ttree init done")
 
   85         Cells = self.
sg[
'AllCalo']
 
   92             if cellitr >= self.
maxcells: 
continue 
   93             self.
idvec[cellitr]=id.get_identifier32().get_compact()
 
   98             self.
encell[cellitr]=c.energy()
 
  100             self.
provcell[cellitr]=c.provenance()
 
  101             self.
qcell[cellitr]=c.quality()
 
  116     print(sys.argv[0]+
": Dump cells from pool file to ntuple")
 
  118     print(
"-i input file (default ESD.pool.root)")
 
  119     print(
"-o output file (default cells.root)")
 
  120     print(
"-n number of events to dump (default -1)")
 
  121     print(
"-m MC pool file (default fals)")
 
  122     print(
"--detdescr <DetDescrVersion>")
 
  123     print(
"-h Print this help text and exit")
 
  126     opts,args=getopt.getopt(sys.argv[1:],
"i:o:n:mh",[
"help",
"detdescr="])
 
  127 except Exception 
as e:
 
  133 ifile=
'ESD.pool.root' 
  137 from AthenaConfiguration.TestDefaults 
import defaultGeometryTags
 
  138 detdescrtag=defaultGeometryTags.RUN2
 
  141     if (o==
"-i"): ifile=a
 
  142     if (o==
"-o"): ofile=a
 
  143     if (o==
"-n"): nev=
int(a)
 
  144     if (o==
"-m"): mc=
True 
  145     if (o==
"-h" or o==
"--help"):
 
  148     if (o==
"--detdescr"):
 
  152 sys.argv = sys.argv[:1] + [
'-b'] 
 
  154 from AthenaConfiguration.AllConfigFlags 
import initConfigFlags 
 
  156 flags.Input.Files = [ifile]
 
  158 flags.IOVDb.DatabaseInstance=
"CONDBR2"  
  159 flags.GeoModel.AtlasVersion = detdescrtag 
 
  160 flags.LAr.doAlign=
False 
  162 from AthenaConfiguration.DetectorConfigFlags 
import disableDetectors, allDetectors
 
  164 flags.Detector.EnableLAr = 
True 
  165 flags.Detector.EnableTile = 
True 
  166 flags.Detector.EnableCalo = 
True 
  169 flags.Exec.OutputLevel=INFO
 
  173 from RootUtils 
import PyROOTFixes  
 
  174 from AthenaConfiguration.MainServicesConfig 
import MainServicesCfg
 
  177 from AthenaPoolCnvSvc.PoolReadConfig 
import PoolReadCfg
 
  180 from TileGeoModel.TileGMConfig 
import TileGMCfg
 
  182 from LArGeoAlgsNV.LArGMConfig 
import LArGMCfg
 
  185 cfg.addEventAlgo(
CellE(ofile))