CMS 3D CMS Logo

Public Member Functions | Private Attributes

LaserPrimaryGeneratorAction Class Reference

#include <LaserPrimaryGeneratorAction.h>

List of all members.

Public Member Functions

void GeneratePrimaries (G4Event *myEvent)
 call the corresponding GeneratePrimaries routines for both TEC's and the Barrel
 LaserPrimaryGeneratorAction (edm::ParameterSet const &theConf)
 constructor
void setGeneratorId (G4PrimaryParticle *aParticle, int ID) const
 set Id of the optical photons
 ~LaserPrimaryGeneratorAction ()
 destructor

Private Attributes

LaserBeamsTEC1theLaserBeamsInTEC1
LaserBeamsTEC2theLaserBeamsInTEC2
LaserBeamsBarreltheLaserBeamsInTECTIBTOBTEC
G4int thenParticle
G4int thenParticleInGun
G4double thePhotonEnergy

Detailed Description

Primary Generator Action for the Laser Events

Date:
2007/06/11 14:44:28
Revision:
1.3
Author:
Maarten Thomas

Definition at line 26 of file LaserPrimaryGeneratorAction.h.


Constructor & Destructor Documentation

LaserPrimaryGeneratorAction::LaserPrimaryGeneratorAction ( edm::ParameterSet const &  theConf)

constructor

Definition at line 14 of file LaserPrimaryGeneratorAction.cc.

References edm::ParameterSet::getUntrackedParameter(), theLaserBeamsInTEC1, theLaserBeamsInTEC2, theLaserBeamsInTECTIBTOBTEC, thenParticle, thenParticleInGun, and thePhotonEnergy.

  : thePhotonEnergy(0),
    thenParticleInGun(0),
    thenParticle(0),
    theLaserBeamsInTEC1(),
    theLaserBeamsInTEC2(),
    theLaserBeamsInTECTIBTOBTEC()
{
  // {{{ LaserPrimaryGeneratorAction constructor

  // get the PhotonEnergy from the parameter set
  thePhotonEnergy = theConf.getUntrackedParameter<double>("PhotonEnergy",1.15) * eV;

  // number of particles in the Laser beam
  thenParticleInGun = theConf.getUntrackedParameter<int>("NumberOfPhotonsInParticleGun",1);

  // number of particles in one beam. ATTENTION: each beam contains nParticleInGun with the same
  // startpoint and direction. nParticle gives the number of particles in the beam with a different
  // startpoint. They are used to simulate the gaussian beamprofile of the Laser Beams.
  thenParticle = theConf.getUntrackedParameter<int>("NumberOfPhotonsInEachBeam",1);

  // create a messenger for this class
//   theGunMessenger = new LaserPrimaryGeneratorMessenger(this);
  
  // create the beams in the right endcap
  theLaserBeamsInTEC1 = new LaserBeamsTEC1(thenParticleInGun, thenParticle, thePhotonEnergy);

  // create the beams in the left endcap
  theLaserBeamsInTEC2 = new LaserBeamsTEC2(thenParticleInGun, thenParticle, thePhotonEnergy);

  // create the beams to connect the TECs with TOB and TIB
  theLaserBeamsInTECTIBTOBTEC = new LaserBeamsBarrel(thenParticleInGun, thenParticle, thePhotonEnergy);
  // }}}
}
LaserPrimaryGeneratorAction::~LaserPrimaryGeneratorAction ( )

destructor

Definition at line 49 of file LaserPrimaryGeneratorAction.cc.

References theLaserBeamsInTEC1, theLaserBeamsInTEC2, and theLaserBeamsInTECTIBTOBTEC.

{
  // {{{ LaserPrimaryGeneratorAction destructor

  if ( theLaserBeamsInTEC1 != 0 ) { delete theLaserBeamsInTEC1; }
  if ( theLaserBeamsInTEC2 != 0 ) { delete theLaserBeamsInTEC2; }
  if ( theLaserBeamsInTECTIBTOBTEC != 0 ) { delete theLaserBeamsInTECTIBTOBTEC; }
  // }}}
}

Member Function Documentation

void LaserPrimaryGeneratorAction::GeneratePrimaries ( G4Event *  myEvent)

call the corresponding GeneratePrimaries routines for both TEC's and the Barrel

Definition at line 59 of file LaserPrimaryGeneratorAction.cc.

References LaserBeamsBarrel::GeneratePrimaries(), LaserBeamsTEC1::GeneratePrimaries(), LaserBeamsTEC2::GeneratePrimaries(), i, j, LogDebug, setGeneratorId(), theLaserBeamsInTEC1, theLaserBeamsInTEC2, and theLaserBeamsInTECTIBTOBTEC.

Referenced by LaserAlignmentSimulation::update().

{
  // {{{ GeneratePrimaries (G4Event * myEvent)

  // this function is called at the beginning of an Event in LaserAlignment::upDate(const BeginOfEvent * myEvent)
  LogDebug("LaserPrimaryGeneratorAction") << "<LaserPrimaryGeneratorAction::GeneratePrimaries(G4Event*)>: create a new Laser Event";

  // shoot in the right endcap
  theLaserBeamsInTEC1->GeneratePrimaries(myEvent);

  // shoot in the left endcap
  theLaserBeamsInTEC2->GeneratePrimaries(myEvent);

  // shoot in the barrel
  theLaserBeamsInTECTIBTOBTEC->GeneratePrimaries(myEvent);

  // loop over all the generated vertices, get the primaries and set the user information
  int theID = 0;

  for (int i = 1; i < myEvent->GetNumberOfPrimaryVertex(); i++)
    {
      G4PrimaryVertex * theVertex = myEvent->GetPrimaryVertex(i);

      for (int j = 0; j < theVertex->GetNumberOfParticle(); j++)
        {
          G4PrimaryParticle * thePrimary = theVertex->GetPrimary(j);
          
          setGeneratorId(thePrimary, theID);
          theID++;
        }
    }
  // }}}
}
void LaserPrimaryGeneratorAction::setGeneratorId ( G4PrimaryParticle *  aParticle,
int  ID 
) const

set Id of the optical photons

Definition at line 93 of file LaserPrimaryGeneratorAction.cc.

Referenced by GeneratePrimaries().

{
  // {{{ SetGeneratorId(G4PrimaryParticle * aParticle, int ID) const

  /* *********************************************************************** */
  /*   OSCAR expacts each G4PrimaryParticle to have some User Information    *
   *   therefore this function have been implemented                         */
  /* *********************************************************************** */

  aParticle->SetUserInformation(new GenParticleInfo(ID));
  // }}}
}

Member Data Documentation

Definition at line 43 of file LaserPrimaryGeneratorAction.h.

Referenced by LaserPrimaryGeneratorAction().

Definition at line 42 of file LaserPrimaryGeneratorAction.h.

Referenced by LaserPrimaryGeneratorAction().

Definition at line 41 of file LaserPrimaryGeneratorAction.h.

Referenced by LaserPrimaryGeneratorAction().