def runtray(cls, fname): tray = I3Tray.I3Tray() tray.AddModule("I3InfiniteSource", "source", stream=icetray.I3Frame.DAQ) tray.AddModule(headerfaker, 'headers', Streams=[icetray.I3Frame.DAQ]) tray.AddModule("I3NullSplitter", "s1") tray.AddModule("I3NullSplitter", "s2") for i in range(10): tray.AddModule(emitter, 's1e%d' % i, label='s1e%d' % i, prob=0.1, If=streampick("s1")) for i in range(10): tray.AddModule(emitter, 's2e%d' % i, label='s2e%d' % i, prob=0.1, If=streampick("s2")) tabler = hdfwriter.I3HDFTableService(fname) tray.AddModule(tableio.I3TableWriter, 'scribe', tableservice=tabler, types=[dataclasses.I3Particle], SubEventStreams=['s1','s2'], ) tray.AddModule('TrashCan', 'YesWeCan') tray.Execute(100) tray.Finish()
def setUp(self): from icecube import icetray,tableio,dataclasses,hdfwriter from icecube.tableio import I3TableWriter import tempfile from I3Tray import I3Tray, load from icecube import phys_services tray = I3Tray() tray.AddModule("I3InfiniteSource","streams", Stream=icetray.I3Frame.Physics) self.tray = tray self.tempfile = tempfile.NamedTemporaryFile() self.hdf_service = hdfwriter.I3HDFTableService(self.tempfile.name,0) self.target = I3TableWriter self.bookie = DOMLaunchBookie()
else: outfile = options.OUTFILE from I3Tray import * from os.path import expandvars import os import sys from icecube import icetray, dataclasses, dataio, tableio, clsim if options.format == 'hdf5': try: from icecube import hdfwriter except ImportError: raise ImportError("Couldn't find the HDF writer service") tabler = hdfwriter.I3HDFTableService(outfile, options.compression) elif options.format == 'root': try: from icecube import rootwriter except ImportError: raise ImportError("Couldn't find the ROOT writer service") tabler = rootwriter.I3ROOTTableService(outfile, options.compression) elif options.format == 'csv': tabler = tableio.I3CSVTableService(outfile[:-4] + '_csv') else: raise ValueError("I don't have a writer service for format '%s'" % options.format) tray = I3Tray() tray.AddModule('I3Reader', 'reader', filename=infile)
("weighting_power", 0.5), # Default ("verbose", False) # Default #("ntanks", 4 ) # Default = -1 (use all tanks) ) # Reconstruct the shower plane # Code: ~/icerecdist/src.trunk/toprec/private/toprec/I3TopRecoPlane.cxx tray.AddModule("I3TopRecoPlane", "Plane")( ("EventHeaderName", "I3EventHeader"), # Default ("DataReadout", seededRTHLCPulse), # ! Use first IT event pulses ("ShowerPlane", "ShowerPlane"), # Default ("Trigger", 2), # Default ("Verbose", False) # Default ) hdf = hdfwriter.I3HDFTableService(hdfout) tray.AddModule( tableio.I3TableWriter, 'TableWriter', TableService=[hdf], SubEventStreams=['ice_top', 'ice_top2'], # 'IceTopSplit' for exp data. Keys=[ 'I3EventHeader', 'MCPrimary', "ShowerCOG", "ShowerPlane", 'IT_RT_180m_450ns', "rmThresholdPulses", "OfflineIceTopSLCVEMPulses", "SeededRTHLCPulses", "SeededRTSLCPulses", "IceTop_StandardFilter", 'IceTopSTA5_13', "IceTop_InFillFilter", "IceTop_TwoStationFilter", 'Nstation', 'Nslc', 'Ntanks', 'TotalChargeHLC', 'TotalChargeHillas', 'TotalChargeSum', 'Qmax', 'LoudestStation', 'WeightPolygonatoTG', 'Weight1ParticleAssumptionPolygonatoTG', 'WeightH4a', 'Weight1ParticleAssumptionH4a', 'WeightGST', 'Weight1ParticleAssumptionGST'
from update_weightdict import update_weightdict tray.AddModule(update_weightdict, "update", ProductionTag="IC86") from apply_propagation_weights import apply_propagation_weights tray.AddModule(apply_propagation_weights,"applypropweights", WeightFilePaths=["/data/user/hoshina/SIMULATION/trunk/src/neutrino-generator/resources/propagation_weights"], WeightFilePrefixes=["PREM_CSMS"], ParamSuffixes=["PREM_CSMS"], PrimaryGammaIndex=gengamma, EnergyLogMin = elogmin, EnergyLogMax = elogmax, ) from icecube import tableio, hdfwriter hdf_outputkeys = ["I3MCWeightDict"] hdftable2 = hdfwriter.I3HDFTableService(outfilename+".h5") tray.AddModule(tableio.I3TableWriter, "writerhdf")( ("tableservice",hdftable2), ("SubEventStreams",["in_ice"]), ("keys",hdf_outputkeys), ) tray.AddModule("I3Writer","writer")( ("filename", outfilename), ) tray.AddModule('TrashCan','can') tray.Execute() tray.Finish()