CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
LaserBeamsTEC2 Class Reference

#include <LaserBeamsTEC2.h>

Inheritance diagram for LaserBeamsTEC2:

Public Member Functions

void GeneratePrimaries (G4Event *myEvent)
 shoot optical photons into the detector at the beginning of an event More...
 
 LaserBeamsTEC2 ()
 default constructor More...
 
 LaserBeamsTEC2 (G4int nPhotonsInGun, G4int nPhotonsInBeam, G4double PhotonEnergy)
 constructor More...
 
void setOptPhotonPolar (G4double Angle)
 set the polarisation of the photons More...
 
 ~LaserBeamsTEC2 ()
 destructor More...
 

Private Attributes

CLHEP::DRand48Engine * theDRand48Engine
 
G4int thenParticle
 
G4int thenParticleInGun
 
G4ParticleGun * theParticleGun
 
G4double thePhotonEnergy
 

Detailed Description

Laser Beams in the left Endcap

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

Definition at line 21 of file LaserBeamsTEC2.h.

Constructor & Destructor Documentation

LaserBeamsTEC2::LaserBeamsTEC2 ( )

default constructor

Definition at line 21 of file LaserBeamsTEC2.cc.

21  :
22  theParticleGun(0),
24 {
25  G4int nPhotonsGun = 1;
26  G4int nPhotonsBeam = 1;
27  G4double Energy = 1.15 * eV;
28  // call constructor with options
29  LaserBeamsTEC2(nPhotonsGun, nPhotonsBeam, Energy);
30 }
G4ParticleGun * theParticleGun
LaserBeamsTEC2()
default constructor
CLHEP::DRand48Engine * theDRand48Engine
LaserBeamsTEC2::LaserBeamsTEC2 ( G4int  nPhotonsInGun,
G4int  nPhotonsInBeam,
G4double  PhotonEnergy 
)

constructor

Definition at line 32 of file LaserBeamsTEC2.cc.

References setOptPhotonPolar(), theDRand48Engine, thenParticle, thenParticleInGun, theParticleGun, and thePhotonEnergy.

32  : thenParticleInGun(0),
33  thenParticle(0),
34  thePhotonEnergy(0),
37 {
38  /* *********************************************************************** */
39  /* initialize and configure the particle gun */
40  /* *********************************************************************** */
41 
42  // the Photon energy
43  thePhotonEnergy = PhotonEnergy;
44 
45  // number of particles in the Laser beam
46  thenParticleInGun = nPhotonsInGun;
47 
48  // number of particles in one beam. ATTENTION: each beam contains nParticleInGun with the same
49  // startpoint and direction. nParticle gives the number of particles in the beam with a different
50  // startpoint. They are used to simulate the gaussian beamprofile of the Laser Beams.
51  thenParticle = nPhotonsInBeam;
52 
53  // create the particle gun
54  theParticleGun = new G4ParticleGun(thenParticleInGun);
55 
56  // default kinematics
57  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
58  G4ParticleDefinition * theOpticalPhoton = theParticleTable->FindParticle("opticalphoton");
59 
60  theParticleGun->SetParticleDefinition(theOpticalPhoton);
61  theParticleGun->SetParticleTime(0.0 * ns);
62  theParticleGun->SetParticlePosition(G4ThreeVector(-500.0 * cm, 0.0 * cm, 0.0 * cm));
63  theParticleGun->SetParticleMomentumDirection(G4ThreeVector(5.0, 3.0, 0.0));
64  theParticleGun->SetParticleEnergy(10.0 * keV);
65  setOptPhotonPolar(90.0);
66 
67  // initialize the random number engine
68  theDRand48Engine = new CLHEP::DRand48Engine();
69 }
void setOptPhotonPolar(G4double Angle)
set the polarisation of the photons
G4ParticleGun * theParticleGun
G4int thenParticleInGun
CLHEP::DRand48Engine * theDRand48Engine
G4double thePhotonEnergy
LaserBeamsTEC2::~LaserBeamsTEC2 ( )

destructor

Definition at line 71 of file LaserBeamsTEC2.cc.

References theDRand48Engine, and theParticleGun.

72 {
73  if ( theParticleGun != 0 ) { delete theParticleGun; }
74  if ( theDRand48Engine != 0 ) { delete theDRand48Engine; }
75 }
G4ParticleGun * theParticleGun
CLHEP::DRand48Engine * theDRand48Engine

Member Function Documentation

void LaserBeamsTEC2::GeneratePrimaries ( G4Event *  myEvent)

shoot optical photons into the detector at the beginning of an event

Definition at line 77 of file LaserBeamsTEC2.cc.

References funct::cos(), M_PI, edm::RandomNumberGenerator::mySeed(), SurveyInfoScenario_cff::seed, setOptPhotonPolar(), funct::sin(), theDRand48Engine, thenParticle, theParticleGun, and thePhotonEnergy.

Referenced by LaserPrimaryGeneratorAction::GeneratePrimaries().

78 {
79  // this function is called at the beginning of an Event in LaserAlignment::upDate(const BeginOfEvent * myEvent)
80 
81  // use the random number generator service of the framework
83  unsigned int seed = rng->mySeed();
84 
85  // set the seed
86  theDRand48Engine->setSeed(seed);
87 
88 
89  // number of LaserRings and Laserdiodes
90  const G4int nLaserRings = 2;
91  const G4int nLaserBeams = 8;
92 
93  // z position of the sixth Tracker Endcap Disc, where the Laserdiodes are positioned
94  G4double LaserPositionZ = -2057.5 * mm;
95 
96  // Radius of the inner and outer Laser ring
97  G4double LaserRingRadius[nLaserRings] = {564.0 * mm, 840.0 * mm};
98 
99  // phi position of the first Laserdiode
100  G4double LaserPhi0 = 0.392699082;
101 
102  // width of the LaserBeams
103  G4double LaserRingSigmaX[nLaserRings] = {0.5 * mm, 0.5 * mm};
104  G4double LaserRingSigmaY[nLaserRings] = {0.5 * mm, 0.5 * mm};
105 
106  // get the definition of the optical photon
107  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
108  G4ParticleDefinition * theOpticalPhoton= theParticleTable->FindParticle("opticalphoton");
109 
110  // loop over the LaserRings
111  for (int theRing = 0; theRing < nLaserRings; theRing++)
112  {
113  // loop over the LaserBeams
114  for (int theBeam = 0; theBeam < nLaserBeams; theBeam++)
115  {
116  // code for forward and backward beam
117  // calculate the right phi for the current beam
118  G4double LaserPositionPhi = LaserPhi0 + G4double(theBeam * G4double(G4double(2 * M_PI) / nLaserBeams));
119 
120  // calculate x and y position for the current beam
121  G4double LaserPositionX = cos(LaserPositionPhi) * LaserRingRadius[theRing];
122  G4double LaserPositionY = sin(LaserPositionPhi) * LaserRingRadius[theRing];
123 
124  // loop over all the particles in one beam
125  for (int theParticle = 0; theParticle < thenParticle; theParticle++)
126  {
127  // get randomnumbers and calculate the position
128  CLHEP::RandGaussQ aGaussObjX( *theDRand48Engine, LaserPositionX, LaserRingSigmaX[theRing] );
129  CLHEP::RandGaussQ aGaussObjY( *theDRand48Engine, LaserPositionY, LaserRingSigmaY[theRing] );
130 
131  G4double theXPosition = aGaussObjX.fire();
132  G4double theYPosition = aGaussObjY.fire();
133  G4double theZPosition = LaserPositionZ;
134 
135  // set the properties of the newly created particle
136  theParticleGun->SetParticleDefinition(theOpticalPhoton);
137  theParticleGun->SetParticleTime(0.0 * ns);
138  theParticleGun->SetParticlePosition(G4ThreeVector(theXPosition, theYPosition, theZPosition));
139  theParticleGun->SetParticleEnergy(thePhotonEnergy);
140 
141  // loop over both directions of the beam
142  for (int theDirection = 0; theDirection < 2; theDirection++)
143  {
144  // shoot in both beam directions ...
145  if (theDirection == 0) // shoot in forward direction (+z)
146  {
147  theParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, 1.0));
148  // set the polarization
149  setOptPhotonPolar(90.0);
150  // generate the particle
151  theParticleGun->GeneratePrimaryVertex(myEvent);
152  }
153 
154  if (theDirection == 1) // shoot in backward direction (-z)
155  {
156  theParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, -1.0));
157  // set the polarization
158  setOptPhotonPolar(90.0);
159  // generate the particle
160  theParticleGun->GeneratePrimaryVertex(myEvent);
161  }
162  } // end loop over both beam directions
163  } // end loop over particles in beam
164  } // end loop over beams
165  } // end loop over rings
166 }
void setOptPhotonPolar(G4double Angle)
set the polarisation of the photons
G4ParticleGun * theParticleGun
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
CLHEP::DRand48Engine * theDRand48Engine
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual std::uint32_t mySeed() const =0
#define M_PI
G4double thePhotonEnergy
void LaserBeamsTEC2::setOptPhotonPolar ( G4double  Angle)

set the polarisation of the photons

Definition at line 168 of file LaserBeamsTEC2.cc.

References funct::cos(), funct::sin(), mathSSE::sqrt(), and theParticleGun.

Referenced by GeneratePrimaries(), and LaserBeamsTEC2().

169 {
170  /* *********************************************************************** */
171  /* to get optical processes working properly, you have to make sure *
172  * that the photon polarisation is defined. */
173  /* *********************************************************************** */
174 
175  // first check if we have an optical photon
176  if ( theParticleGun->GetParticleDefinition()->GetParticleName() != "opticalphoton" )
177  {
178  edm::LogWarning("SimLaserAlignment:LaserBeamsTEC2") << "<LaserBeamsTEC2::setOptPhotonPolar()>: WARNING! The ParticleGun is not an optical photon";
179  return;
180  }
181 
182 // G4cout << " AC1CMS: The ParticleGun is an " << theParticleGun->GetParticleDefinition()->GetParticleName();
183  G4ThreeVector normal(1.0, 0.0, 0.0);
184  G4ThreeVector kphoton = theParticleGun->GetParticleMomentumDirection();
185  G4ThreeVector product = normal.cross(kphoton);
186  G4double modul2 = product * product;
187 
188  G4ThreeVector e_perpendicular(0.0, 0.0, 1.0);
189 
190  if ( modul2 > 0.0 ) { e_perpendicular = (1.0 / sqrt(modul2)) * product; }
191 
192  G4ThreeVector e_parallel = e_perpendicular.cross(kphoton);
193 
194  G4ThreeVector polar = cos(Angle) * e_parallel + sin(Angle) * e_perpendicular;
195 
196 // G4cout << ", the polarization = " << polar << G4endl;
197  theParticleGun->SetParticlePolarization(polar);
198 }
G4ParticleGun * theParticleGun
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Definition: Angle.h:17

Member Data Documentation

CLHEP::DRand48Engine* LaserBeamsTEC2::theDRand48Engine
private

Definition at line 46 of file LaserBeamsTEC2.h.

Referenced by GeneratePrimaries(), LaserBeamsTEC2(), and ~LaserBeamsTEC2().

G4int LaserBeamsTEC2::thenParticle
private

Definition at line 39 of file LaserBeamsTEC2.h.

Referenced by GeneratePrimaries(), and LaserBeamsTEC2().

G4int LaserBeamsTEC2::thenParticleInGun
private

Definition at line 38 of file LaserBeamsTEC2.h.

Referenced by LaserBeamsTEC2().

G4ParticleGun* LaserBeamsTEC2::theParticleGun
private
G4double LaserBeamsTEC2::thePhotonEnergy
private

Definition at line 40 of file LaserBeamsTEC2.h.

Referenced by GeneratePrimaries(), and LaserBeamsTEC2().