.. _I3GenieTracReader: I3GenieTracReader ================= This module reads GENIE Generator output, samples primary neutrino direction and interaction vertex position and then writes event information to I3File. Requires GENIE's native GHEP format root files to be converted to both GST and gRooTracker formats. Event geometry sampling ^^^^^^^^^^^^^^^^^^^^^^^^^ It is expected that input GENIE events are produced with GENIE's generic event generation app ``gevgen``, which uses point geometry (defined in :class:`genie::geometry::PointGeomAnalyzer`). .. caution:: Using GENIE simulation with non-point geometry as genie-reader input will cause incorrect results! The fact that GENIE event was simulated with point geometry means that it's interaction vertex is located in the center of coordinates and it has maximum density-weighted path length of :math:`1 kg/m^2` for the given composition of target materials. genie-reader samples event geometry by moving and rotating all particles in the event record and by rescaling interaction probability for the primary neutrino. More precisely, it is done in the following way: 1. Interaction vertex position is sampled uniformly inside the cylinder according to (in cylindrical coordinates): .. math:: \rho = R * \sqrt{Uniform(0, 1)} \theta = Uniform(0, 2\pi) h = Uniform(-L/2, +L/2) here :math:`R` is radius of the cylinder, :math:`L` is cylinder length (:math:`R` and :math:`L` are input parameters for the module). :math:`Uniform(x, y)` is a random number from a uniform distribution between :math:`x` and :math:`y`. Cylinder axis align with incoming neutrino direction. 2. Neutrino direction is sampled uniformly from the surface of the shere: .. math:: \theta_{zen} = \arccos(Uniform(\cos(\theta_{zen,min}), \cos(\theta_{zen,max}))) \phi_{az} = Uniform(\phi_{az,min}, \phi_{az,max}) where :math:`\theta_{zen}` and :math:`\phi_{az}` are zenith and azimuth angles respectively; :math:`\theta_{zen,min}`, :math:`\theta_{zen,max}`, :math:`\phi_{az,min}` and :math:`\phi_{az,max}` are limits on zenith and azimuth, which are taken as input parameters. After new neutrino direction is sampled, all simulated particles from GENIE event record are rotated according to it. 3. Neutrino interaction probability (and related event weight) is rescaled to account for larger generation volume. Interaction probablility in GENIE is defined as: .. math:: P = \frac{N_{A}\cdot \sigma\cdot p_{L}}{A} where :math:`N_{A}` is Avogadro number; :math:`\sigma` is total cross section; :math:`p_{L}` is density-weighted neutrino path length; :math:`A` is target material molar mass. Because in the point geometry from ``gevgen`` :math:`p_{L} = 1 g/cm^2` for a given mix of target materials, interaction probability can be rescaled to match different path length and density: .. math:: P_{new} = P_{old} * L[cm] * \rho_{ice}[g/cm^3] where :math:`L` is cylinder length and :math:`\rho_{ice}` is ice density. In total two parameters are rescaled: ``GlobalProbabilityScale`` (used in ``OneWeight`` calculation) and ``InteractionProbability``. Example usage ^^^^^^^^^^^^^ .. code-block:: python tray.AddModule(I3GenieTracReader, GenieFileGST = 'gntp.NuMu.A.1400002.gst.root', GenieFileGRooTracker = 'gntp.NuMu.A.1400002.gtrac.root', GenieInfo = info, IceDensity = 0.93*I3Units.g/I3Units.cm3, RandomService = RandomService, ResultDictName = "I3GenieResult", MCTreeName = "I3MCTree", MCWeightDictName = "I3MCWeightDict", OutputResultDict = True, GenVolCenter = I3Position(46.29,-34.88,-330.0)) Signature ^^^^^^^^^ .. autoclass:: icecube.genie_reader.I3GenieTracReader **Methods:** .. automethod:: icecube.genie_reader.I3GenieTracReader.Configure .. automethod:: icecube.genie_reader.I3GenieTracReader.calc_norm .. automethod:: icecube.genie_reader.I3GenieTracReader.rotate .. automethod:: icecube.genie_reader.I3GenieTracReader.set_i3direction .. automethod:: icecube.genie_reader.I3GenieTracReader.sample_primary .. automethod:: icecube.genie_reader.I3GenieTracReader.get_resultdict .. automethod:: icecube.genie_reader.I3GenieTracReader.get_mctree .. automethod:: icecube.genie_reader.I3GenieTracReader.get_weightdict .. automethod:: icecube.genie_reader.I3GenieTracReader.DAQ .. automethod:: icecube.genie_reader.I3GenieTracReader.Finish Output objects ^^^^^^^^^^^^^^ I3GenieTracReader produces four types of objects: 1. ``I3GenieInfo`` (S-Frame) Structure defined in simcalsses: :cpp:class:`icetray::simclasses::I3GenieInfo`. Contains file-wise information: input parameters (e.g. neutrino type, energy and directional limits, number of events in the file) and ``GlobalProbabilityScale``. Example: .. code-block:: none I3GenieInfo [I3GenieInfo]: [ I3GenieInfo run_id : 140000 n_events : 10 n_flux__events : 12 cylinder_height : 500 cylinder_radius : 250 min_zenith : 0 max_zenith : 3.14159 min_azimuth : 0 max_azimuth : 6.28319 min_energy : 1 max_energy : 5 power_law_index : 2 oxygen_fraction : 0.888102 ice_density : 5.8046e+30 global_probability_scale : 8.03895e-11 ] 2. ``I3MCTree`` (Q-Frame) :ref:`i3mctree`. Contains true primary neutrino, outgoing lepton and pariticles from hadronic shower (after intranuclear rescattering). .. caution:: Energy of I3Particles, saved in the I3MCTree is their **kinetic energy**. Example: .. code-block:: none I3MCTree [TreeBase::Tree >]: [I3MCTree: 5 NuMu (193.923m, -185.174m, -397.057m) (39.1559deg, 289.836deg) 0ns 1.04671GeV nanm 6 MuMinus (193.923m, -185.174m, -397.057m) (40.0252deg, 29.5117deg) 0ns 0.341934GeV nanm 7 PPlus (193.923m, -185.174m, -397.057m) (66.4657deg, 263.303deg) 0ns 1.32416GeV nanm 8 PiPlus (193.923m, -185.174m, -397.057m) (49.1233deg, 48.5163deg) 0ns 0.213221GeV nanm ] 3. ``I3MCWeightDict`` (Q-Frame) Dictionary (:cpp:type:`I3MapStringDouble`) which contains essential information about event (e.g. neutrino energy, interaction type, cross section, OneWeight and other weighting related variables). Format and variable names are the same as in genie-icetray. Example: .. code-block:: none I3MCWeightDict [I3Map]: [Crosssection => 5.1486e-12, EnergyLost => 0, GENIEWeight => 0.261366, GeneratorVolume => 9.81748e+07, GlobalProbabilityScale => 8.03895e-11, InjectionSurfaceR => 250, InteractionProbabilityWeight => 2.10832e-13, InteractionType => 1, LengthInVolume => 250.655, MaxAzimuth => 6.28319, MaxEnergyLog => 0.69897, MaxZenith => 3.14159, MinAzimuth => 0, MinEnergyLog => 0, MinZenith => 0, NEvents => 10, OneWeight => 4.5439e-05, PowerLawIndex => 2, PrimaryNeutrinoEnergy => 1.04671, TargetPDGCode => 2212, TotalDetectionLength => 500, TotalInteractionProbabilityWeight => 2.10111e-11] 4. ``I3GenieResult`` (Q-Frame) Structure defined in simcalsses: :cpp:class:`icetray::simclasses::I3GenieResult`. Contains combined information from GST and gRooTracker event records.