///§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§//*
//             LOW ENERGY MUON SPIN RELAXATION, ROTATION, RADIATION 
//
//  ID    : LEMuSRPrimaryGeneratorAction.hh , v 1.3
//  AUTHOR: Taofiq PARAISO
//  DATE  : 2004-09-16 09:12
//§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§//
//
//  &           &&&&&&&&&&                            &&&&&&&         &&&&&&&&
//  &           &                                   &&      &&       &       &&
//  &           &                   &      &       &                &       &&
//  &           &&&&&&&            &      &         &&&&&&         &&&&&&&&  
//  &           &                 &      &&                &      &      &&
//  &           &                &&     &  &     &&      &&      &        &
//  &&&&&&&&&&  &&&&&&&&&&      &  &&&&&    &&    &&&&&&&       &        &&   
//                             &
//                            &
//                           &
//                         &  
//                          PRIMARY GENERATOR ACTION
//§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§//


 

#ifndef LEMuSRPrimaryGeneratorAction_h
#define LEMuSRPrimaryGeneratorAction_h 1

// G4 LIBRARIES
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "LEMuSRParticleGun.hh"
#include "G4Event.hh"
#include "Randomize.hh"
#include "G4ParticleGun.hh"
#include "LEMuSRPgaMessenger.hh"



#include <iomanip>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <ios>

// G4 CLASSES
//class G4RandGauss;
class G4ParticleGun;
class LEMuSRParticleGun;
class G4Event;


// LEMuSRPrimaryGeneratorAction CLASS DEFINITION
class LEMuSRPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
  // Constructor & Destructor
  public:
  LEMuSRPrimaryGeneratorAction();
  ~LEMuSRPrimaryGeneratorAction();



static  LEMuSRPrimaryGeneratorAction* thePGA;
  static LEMuSRPrimaryGeneratorAction*  GetPGA();
  // Event generation method
  void GeneratePrimaries(G4Event* anEvent);
  void GetScanningMode(G4int scan_mode);

private:
  LEMuSRParticleGun* lemuParticleGun;
public:
  double   rndenergy;
  G4double  decaytime,  energy;
  HepRandomEngine * theEngine;
  
  G4double X, Y, Z,momX, momY, momZ, m_xrange, m_yrange;
  G4int m_counterx, m_nbxsteps, m_countery, m_nbysteps, scan, gauss;
  G4double radius, angle, mean, stddev, sc_mean, sc_stddev;
  G4double circ;
  G4bool rnd;
  LEMuSRPgaMessenger* messenger;

  G4double charge, ke_offset;

  G4String pname;

  //===============================
  std::ofstream Yprint;  
  double table[1000];
  int i,j;
};

#endif



