Other docs/test

Table Of Contents

Previous topic

Publishing Documentation on Separate Webserver

Next topic

Dayabay Sphinx Extensions

This Page

Daya Bay Links

Content Skeleton

Sandbox Testing reST/Sphinx

Examine the source with the Show Source links in the html sidebar to see the reST markup used to create this.

Matplotlib extensions


matplotlib dependency removal

In order to simplify documentation building, the dependency on matplotlib has been removed requiring all live ipython blocks to be converted to dead code blocks

live ipython session with ipython directive

See ipython_directive

In [136]: x = 2

In [137]: x**3

The session remembers its scope values x and numbers its In Out

In [4]: x

dead ipython

See ipython-highlighting

In [69]: lines = plot([1,2,3])

In [70]: setp(lines)
  alpha: float
  animated: [True | False]
  antialiased or aa: [True | False]

inline plots

See pyplots

Before removal of matplotlib dependency plots could be included inline with:

.. plot::

   import matplotlib.pyplot as plt
   import numpy as np
   x = np.random.randn(1000)
   plt.hist( x, 20)
   plt.title(r'Normal: $\mu=%.2f, \sigma=%.2f$'%(x.mean(), x.std()))

Syntax Highlighting

Pygments emits Lexer name not known for C++ or Python or C , instead use cpp, python, or c

    static const CLID& classID() {
        return DayaBay::CLID_GenHeader;

    GenHeaderCnv(ISvcLocator* svc);
    virtual ~GenHeaderCnv();
def __init__(self):
int main(int argc, char argv[])


Latex math markup used by the math directive.

math equation

\displaystyle V(t) = VoltageScale \cdot \frac{(e^{-t/t_0} -e^{-t/t_1})}{(t_1 -t_0)}\\
\displaystyle t_0 = 3.6 ns\\
\displaystyle t_1 =  5.4 ns

equation (1) is propagated from label

math eqnarray

   y    & = & ax^2 + bx + c \\
   f(x) & = & x^2 + 2xy + y^2

labels are not ferreted out of the math (2) ... just passed to latex to create a png presumably

raw html css usage via reST custom roles

Section contains invisble content that create custom roles r, v and g that are used to style cells of the below tables.

table styled with custom role

Frozen Delights!
Treat Quantity Description
Albatross 2.99 On a stick!
Crunchy Frog 1.49 If we took the bones out, it wouldn’t be crunchy, now would it?
Gannet Ripple 1.99 On a stick!

The role results in the html:

    <td><span class="custom">Gannet Ripple</span></td>
    <td>On a stick!</td>


Name & Synonyms Type Track Vertex Stats Description
timet double X X X Time of the vertex/track start
x global_x double X X X Global X position of the vertex/track start/step
yglobal_y d X X X Global Y position of the vertex/track start/step
zglobal\_z double X X X Global Z position of the vertex/track start/step
EnergyLostSinceLastVertex double   X   Energy difference sine the last created SimVertex
AngleFromLastVertex double   X   Change in direction since the last created SimVertex (degrees)


A code block can be placed in the legend of a figure.



SimTrack Accessors. A list of accessible data from the SimTrack object.

class SimTrack {
    /// Geant4 track ID
    int trackId() const;

    /// PDG code of this track
    int particle() const;

    /// PDG code of the immediate parent to this track
    int parentParticle() const;

    /// Reference to the parent or ancestor of this track.
    const DayaBay::SimTrackReference& ancestorTrack() const;

    /// Reference to the parent or ancestor of this track.
    const DayaBay::SimVertexReference& ancestorVertex() const;

    /// Pointer to the ancestor primary kinematics particle
    const HepMC::GenParticle* primaryParticle() const;

    /// Pointers to the vertices along this track. Not owned.
    const vertex_list& vertices() const;

    /// Get number of unrecordeds for given pdg type
    unsigned int unrecordedDescendants(int pdg) const;

The ref role is used to refer to the fig by its label f:test_simtrack_accessors


Generate the below list of tabledoc directives with somthing like

echo show tables | mysql dcs | perl -p -e 's,(\S*),.. tabledoc:: dcs $1, ' -