#!/usr/bin/env python """ Usage event_display -f input_file [options] Produces aa3d web-based event displays out of a data file. The selection cut is passed to ROOT and applied to the TTree. Examples of useful seleciton cuts are id==42 selects event with a specific id Sum$(hits.trig)>42 selects all events with more than 42 trigger hits options: -f : input file default=/sps/km3net/users/coniglio/antares_seawiet/ARCA6/prod/data/KM3NeT_00000075/v1.0/reco/datav1.0.jchain.aanet.00009339.root -d : detector file default=from_header -m : directory name default=evtdisp -w : output html direcotry default=t61@login.nikhef.nl:~/public_html/ -c : selection-cut (root-TCut format) default=(1) -n : produce at most this many event-displays default=10 """ import sys, itertools, collections, glob, ROOT import aa, aa3d from ROOT import EventFile, Det, c_light options = aa.Options( __doc__, sys.argv[1:] ) page = aa3d.EventDisplayPage( options.m, options.w ) # open an event file and detector. (the detector files is hardcoded as # it is not correct in the header for this particular file). f= EventFile( glob.glob( options.f )); print ( options.f ) det = Det("/pbs/throng/km3net/detectors/KM3NeT_00000075_20210420.detx") print (det ) # remove the base-modules, that would be drawn as doms in the display det.remove_dom_if( lambda dom : dom.pmts.size() == 0 ) n = 0 for evt in f : print(evt) if evt.hits.size() < 40 : continue # set the hit positions det.apply(evt) print (evt) if evt.trks.size() > 0 : for t in evt.trks: print (t) t.len = 2000 trk = evt.trks[0] # assume first one is the best print (trk.len) trk.len = 2000 trk.type = 13 # muon so it is displayed correctly evt.mc_trks.push_back(trk) else : continue # add and event display to page page.add( evt, det ) n+=1 if n >= int(options.n) : print ("requested number of events reached") break page.close()