/AnaEvent [ Modules ]

This module includes several subroutines to print out cross sections
when given an array of events.

The routines given in this module belong to two categories:
The first category are the more low-level routines, which act on building
up an single tAnaEvent or dumping a list of tAnaEvent types, as e.g.:

AnaEvent/diff_XXX_dSigma_dTheta_hadron_charge_q.dat [ Output files ]

The file shows the angular distributions after
final state interactions for various mesons and baryons with charge q
The cross sections are given for events with 1 meson of a given kind, but there
can be other mesons or baryons around

real, dimension(1:dimSigma,1:2),intent(inout),optional :: sigma --
List of Xsection which is being updated in this routine
First index: : channel
Second index : 1=sum over runs( Xsection of each run),
2=sum over runs(( Xsection of each run)**2)

logical,intent(inout),optional :: newInit

integer,intent(inout),optional :: runNumber

real, optional :: identifier --
Plotted in column 1 of the output file,
if not present than we plot runNumber there

If newInit=.true., then the input sigma is initialized again (=0).
If newInit=.false., then the input is used as a result of earlier runs and
the results of the present run are just added.

If .true. then we assume that runNumber is the number to use as a
normalization for the histogram results;
We assume that the Xsection contain the results of "runNumber" runs.

NOTES

If there are more than one particle of the same species produced,
then the event is not considered for the "single particlecross section".
e.g. a pi^+ pi^0 event does not contribute to any of those cross
sections.

If there are more than two particles of the same species produced,
then the event is not considered for the "double particlecross section".

If there are more than three particles of the same species produced,
then the event is not considered for the "three particlecross section".

If there are more than four particles of the same species produced,
then the event is not considered for the "four particlecross section".

Note that e.g. 2pi/3pi means that two/three pions, no matter which
charge, where found.

Note also that, e.g., "pi+ X" means that one piPlus was found. And if
there is another particle of the same species, but with another charge,
then we still count the event.
E.g. for pi^+ pi^0 the event contributes both to "pi+ + X" and "pi0 + X"

These optional input variables return the evaluated histograms.
In hists_theta you will find the dsigma_dtheta histograms,
in hists_phi you will find the dsigma_dphi histograms and
in hists2D dsigma_dOmega.
They must be given all together, to make an effect on the program.

If initHists=.true., then the input histograms "hists_theta","hists_phi"
and "hists2D" are initialized again. If inithists=.false. then the input
histograms are used as results of earlier runs and the results of the
present run are just added. If .true. then we assume that runNumber is
the number to use as a normalization for the histogram results = We
assume that the histograms contain the results of "runNumber" runs.

The fourth column in the histogram defines the error of the 2nd column
(only if optional input is given!)

NOTES

If there are more than one particle of the same species produced, then the
event is not considered for this "single particlecross section".

OUTPUT

filenames 'STRING_dsigma_dTheta...*.#.dat',
'STRING_dsigma_dTheta_Phi...*.#.dat'
where #=1,2,3,... is given by runNumber and "STRING" by the input string.

These optional input variables return the evaluated histograms.
In hists you will find the dsigma_dE.

If initHists=.true., then the input histograms "hists" and "histsMulti" are
initialized again.
If inithists=.false., then the input histograms are used as results of
earlier runs and the results of the present run are just added. If .true.
then we assume that runNumber is the number to use as a normalization for
the histogram results = We assume that the histograms contain the results
of "runNumber" runs.

NOTES

If there are more than one particle of the same species produced, then the
event is not considered for the "single particlecross section", but for the
"multi particlecross section".

OUTPUT

filenames 'STRING_dsigma_dEkin...*.#.dat'
where #=1,2,3,... is given by runNumber
and "STRING" by the input string.

Output for single particle production dsigma/d(E(1-cosTheta))
for all particle-IDs includede in "particleIDs" (see above) and all
charge states.
Theta is the angle of the outgoing particle
with respect to the neutrino beam direction

If initHists=.true., then the input histograms are initialized again.
If inithists=.false. then the input histograms are used as results of
earlier runs and the results of the present run are just added. If .true.
then we assume that runNumber is the number to use as a normalization
for the histogram results = We assume that the histograms
contain the results of "runNumber" runs.

The fourth column in the histogram defines the error of the 2nd column
(only if optional input is given!)

NOTES

If there are more than one particle of the same species produced,
then the event is not considered for
this "single particlecross section".

OUTPUT

filenames 'STRING_dsigma_dEcostheta...*.#.dat',
where #=1,2,3,... is given by runNumber
and "STRING" by the input string.

These optional input variables return the evaluated histograms.
In hists you will find the dsigma_dInvMass.

If initHists=.true., then the input histograms "hists" is initialized again.
If inithists=.false., then the input histograms are used as results of
earlier runs and the results of the present run are just added. If .true.
then we assume that runNumber is the number to use as a normalization for
the histogram results = We assume that the histograms contain the results
of "runNumber" runs.

OUTPUT

filenames 'STRING_dsigma_W...*.#.dat'
where #=1,2,3,... is given by runNumber
and "STRING" by the input string.

These optional input variables return the evaluated histograms.
In hist_E you will find the dsigma_dE(kinetic energy of the outgoing lepton).
In hist_cos you will find the dsigma_dcostheta(angle of the outgoing lepton
relative to incoming neutrino).
In hist_Q2 you will find the dsigma_dQ^2.
In hist_Q2p you will find the dsigma_dQ_p^2, Q_p^2 is calculated from kinetic
energy of leading proton
The Q_p^2 distribution can thus also be used to get the 0pi kinetic energy
distribution of outgoing protons
In hist_dEdcost you will find the double-differential
d2sigma/(dE dcostheta) for outgoing lepton in a 0-pion event

If initHists=.true., then the input histograms "hists" and "histsMulti" are
initialized again.
If inithists=.false., then the input histograms are used as results of
earlier runs and the results of the present run are just added. If .true.
then we assume that runNumber is the number to use as a normalization for
the histogram results = We assume that the histograms contain the results
of "runNumber" runs.

OUTPUT

filenames 'STRING_dsigma_dEkin_lepton.#.dat'

filenames 'STRING_dsigma_dcos_lepton.#.dat'

filenames 'STRING_dsigma_dQ2_lepton.#.dat'

filenames 'STRING_dsigma_dQ2p_lepton.#.dat'
where #=1,2,3,... is given by runNumber
and "STRING" by the input string.

AnaEvent/setError_hist [ Subroutines ]

Assume that a%yval(:,1) contains the following : sum over all
runs(xSection of run).
And assume that a%yval(:,3) contains the following : sum over all
runs(xSection of run**2). The number of runs is given by numRuns.

Sets a%yval(:,3) to the statistical error of a%yval(:,1) times the
number of runs (This is done because a%yval(:,1) is the mean value times
the number of runs, too.

AnaEvent/event_pairPhotons [ Subroutines ]

Outputs number of photons in one event and ahistogram
which gives the mass of all possible pairs of photons versus the mass
of all possible triples.
Additionally across section dsigma/dm_{3\gammas} is generated.