Open fiedl opened 2 years ago
[2022-08-12 00:26:32] fiedl@fiedl-mbp ~/icecube/hole-ice-scripts master :zap: 12fc7b5
▶ source ~/py3/bin/activate && ~/icecube/icetray-build/env-shell.sh
▶ steamshovel data/propagated_photons.i3
ERROR (Scenario): PhotonPaths: for key PhotonSeriesMap got incompatible type I3Map<ModuleKey, I3Vector<I3CompressedPhoton> > (Scenario.cpp:423 in bool Scenario::canCreate(ArtistPtr))
ERROR (Scenario): PhotonPaths: for key PhotonSeriesMap got incompatible type I3Map<ModuleKey, I3Vector<I3CompressedPhoton> > (Scenario.cpp:423 in bool Scenario::canCreate(ArtistPtr))
Tianlu has found a workaround.
https://icecube-spno.slack.com/archives/D02ST977K6F/p1660611760493949
I was able to get steamshovel to display by putting a dummy I3MCTree in
#!/usr/bin/env python
import os
from I3Tray import I3Tray
from icecube import icetray, clsim, phys_services, simclasses, photonics_service, dataclasses
DETECTOR_GEOMETRY_FILE = os.path.expandvars(
'$I3_TESTDATA/GCD/GeoCalibDetectorStatus_2020.Run134142.Pass2_V0.i3.gz')
icetray.set_log_level(icetray.I3LogLevel.LOG_TRACE)
def main():
random_number_generator = phys_services.I3SPRNGRandomService(
seed = 1234,
nstreams = 100000000,
streamnum = 1
)
tray = I3Tray()
tray.context['I3RandomService'] = random_number_generator
tray.Add(
'I3Reader',
Filenamelist = [DETECTOR_GEOMETRY_FILE, 'data/generated_photons.i3']
)
tray.Add(
clsim.I3CLSimMakePhotons,
GCDFile = DETECTOR_GEOMETRY_FILE,
UseCPUs = True,
UseGPUs = False,
UseI3PropagatorService = False,
OutputMCTreeName = None,
PhotonSeriesName = 'PhotonSeriesMap',
FlasherPulseSeriesName = 'PhotonFlasherPulseSeries',
MCPESeriesName = None,
RandomService = tray.context['I3RandomService'],
IceModelLocation = os.path.expandvars('$I3_SRC/ice-models/resources/models/ICEMODEL/spice_bfr-v2'),
UseCascadeExtension = False,
DisableTilt = False,
DoNotParallelize = True,
DOMOversizeFactor = 1.0,
DOMEfficiency = 1.0,
HoleIceParameterization = os.path.expandvars('$I3_SRC/ice-models/resources/models/ANGSENS/angsens/as.nominal'), # no hole-ice approximation
UnWeightedPhotons = True,
UnWeightedPhotonsScalingFactor = 1.0,
StopDetectedPhotons = False,
SaveAllPhotons = True,
SaveAllPhotonsPrescale = 1.0,
PhotonHistoryEntries = 100
)
tray.Add(
put_mctree,
Streams = [icetray.I3Frame.DAQ]
)
tray.Add(
'I3Writer',
filename = "data/propagated_photons.i3"
)
tray.Add(
count_propagated_photons,
Streams = [icetray.I3Frame.DAQ]
)
tray.Execute()
def put_mctree(frame):
frame['I3MCTree'] = dataclasses.I3MCTree()
part = dataclasses.I3Particle()
part.pos = dataclasses.I3Position(-255.023,-521.282,500)
part.dir = dataclasses.I3Direction(3.14/2, 0)
part.time= 0
part.type = dataclasses.I3Particle.ParticleType.Hadrons
frame['I3MCTree'].add_primary(part)
def count_propagated_photons(frame):
print(f"number of PhotonSeriesMap entries: {len(frame['PhotonSeriesMap'])}")
if __name__=='__main__':
main()
If no photon history is going to be created, this module https://github.com/icecube/icetray/blob/main/sim-services/private/sim-services/I3PhotonPropagationClientModule.cxx adds the photons as I3CompressedPhoton
. This leads to steamshovel's error:
ERROR (Scenario): PhotonPaths: for key PhotonSeriesMap got incompatible type I3Map<ModuleKey, I3Vector<I3CompressedPhoton> > (Scenario.cpp:423 in bool Scenario::canCreate(ArtistPtr))
Only if there are photon histories to be created, the result is stored as I3PhotonSeriesMap
, which is required by the steamshovel artist. Also, the compressed photons don't save their history. So it's not a matter of data conversion.
If I configure I3CLSimMakePhotons
to PhotonHistoryEntries = 0
, I have suspected this to be an "auto" setting where it saves all history entries. But, apparently, this saves no history entries, which makes the photons to be stored as compressed photons.
If I configure I3CLSimMakePhotons
to PhotonHistoryEntries = 100
, however, as Tianlu did in the above example, I'm getting RuntimeError: clCreateBuffer
, again (https://github.com/fiedl/hole-ice-scripts/issues/4#issuecomment-1212141557). Setting PhotonHistoryEntries = 100
works for now.
Also, the steamshovel artist expects a reference particle to gauge the timing information. Therefore, one needs to add a fake monte-carlo-particle tree.
[2022-09-07 23:20:27] fiedl@fiedl-mbp ~/icecube/hole-ice-scripts master ⚡ 75cd293
▶ docker-compose run icetray scripts/generate_photons.py
▶ docker-compose run icetray scripts/propagate_photons.py
[2022-09-07 23:30:27] fiedl@fiedl-mbp ~/icecube/hole-ice-scripts master ⚡ 75cd293
▶ source ~/py3/bin/activate && ~/icecube/icetray-build/env-shell.sh
▶ steamshovel data/propagated_photons.i3
In order to visualize the photon paths, I'm trying to display them in steamshovel.