Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page holds a few example code-snippets for use in pyana analysis. Compare with myana user examples to see how the same things can be done using the myana analysis framework.

Beamline data (Bld)

To read out energy, charge and position of the beam from the beamline data, use getEBeam(). It returns a class/structure that has the following members/fields:

Code Block

       ebeam = evt.getEBeam()
        if ebeam :
            beamChrg = ebeam.fEbeamCharge
            beamEnrg = ebeam.fEbeamL3Energy
            beamPosX = ebeam.fEbeamLTUPosX
            beamPosY = ebeam.fEbeamLTUPosY
            beamAngX = ebeam.fEbeamLTUAngX
            beamAngY = ebeam.fEbeamLTUAngY
            beamPkCr = ebeam.fEbeamPkCurrBC2
            print "ebeam: ", beamChrg, beamEnrg, beamPosX, beamPosY, beamAngX, beamAngY, beamPkCr
        else :
            print "No EBeam object found"

To read out the energy from the front end enclosure (FEE) gas detector, use getFeeGasDet(). This returns and array of 4 numbers:

Code Block

       fee_energy_array = evt.getFeeGasDet()
        gdENRC11 = fee_energy_array[0]
        gdENRC12 = fee_energy_array[1]
        gdENRC21 = fee_energy_array[2]
        gdENRC22 = fee_energy_array[3]
        print "GasDet energy ", gdENRC11, gdENRC12, gdENRC21, gdENRC22

To read out fit time and charge of the phase cavity, use getPhaseCavity() which returns a structure with the following fields:

Code Block

        pc = evt.getPhaseCavity()
        if pc :
            pcFitTime1 = pc.fFitTime1
            pcFitTime2 = pc.fFitTime2
            pcCharge1 = pc.fCharge1
            pcCharge2 = pc.fCharge2
            print "PhaseCavity: ", pcFitTime1,  pcFitTime2, pcCharge1, pcCharge2
        else :
            print "No Phase Cavity object found"

Display images from princeton camera

...