#!/usr/bin/env python """ Aa3d is the name of a web-based 3d event display for km3net. The event display can be viewed in any modern web-browser, which makes it trival to install and run. This script shows how to create a web-page which shows an event that you pick and may pre-process with aanet. The event is stored in json format, which can be read by the event display running in your browser. Details of how this works are explained below. options: -f : input file default=/sps/km3net/users/tayalati/aa3d/mcv5.0.monopole.geamon.jte.jchain.aanet.2.root -d : det file default=/pbs/throng/km3net/detectors/orca_115strings_av23min20mhorizontal_18OMs_alt9mvertical_v1.det -w : directory where to write the html and javascript for the event display default=mpwww -h : this help message and exit default=False -i : Python interative mode (prompt when done) default=False """ import os, sys, itertools, collections, aa from ROOT import EventFile, Det, write_aa3d, vector, Hit options = aa.Options( __doc__, sys.argv[1:] ) wwwdir = options.w; os.system("mkdir -p "+wwwdir ) f , det = EventFile( options.f ), Det( options.d ) coord_origin = f.header.coord_origin() # need to move tracks to right place for evt in f : # find the next event with more than 20k mc photons #if evt.hits.size() < 20000 : continue # set the hit positions det.apply(evt) print (evt) # remove nan's from trakcks for t in evt.trks : t.lik = 0; # move the tracks :( for t in evt.mc_trks : t.pos += coord_origin # Write the event display (in this case to directory that # can be accessed via the internet). filnam = "mp_"+str(evt.id)+".js.gz" evt.mc_hits.clear() write_aa3d(evt, det, wwwdir, filnam ) if f.index > 100 : break # one event is enough