#include <Alignment/LaserAlignmentSimulation/interface/LaserBeamsTEC2.h>
Public Member Functions | |
void | GeneratePrimaries (G4Event *myEvent) |
shoot optical photons into the detector at the beginning of an event | |
LaserBeamsTEC2 (G4int nPhotonsInGun, G4int nPhotonsInBeam, G4double PhotonEnergy) | |
constructor | |
LaserBeamsTEC2 () | |
default constructor | |
void | setOptPhotonPolar (G4double Angle) |
set the polarisation of the photons | |
~LaserBeamsTEC2 () | |
destructor | |
Private Attributes | |
DRand48Engine * | theDRand48Engine |
G4int | thenParticle |
G4int | thenParticleInGun |
G4ParticleGun * | theParticleGun |
G4double | thePhotonEnergy |
Definition at line 21 of file LaserBeamsTEC2.h.
LaserBeamsTEC2::LaserBeamsTEC2 | ( | ) |
default constructor
Definition at line 20 of file LaserBeamsTEC2.cc.
00021 { 00022 G4int nPhotonsGun = 1; 00023 G4int nPhotonsBeam = 1; 00024 G4double Energy = 1.15 * eV; 00025 // call constructor with options 00026 LaserBeamsTEC2(nPhotonsGun, nPhotonsBeam, Energy); 00027 }
LaserBeamsTEC2::LaserBeamsTEC2 | ( | G4int | nPhotonsInGun, | |
G4int | nPhotonsInBeam, | |||
G4double | PhotonEnergy | |||
) |
constructor
Definition at line 29 of file LaserBeamsTEC2.cc.
References setOptPhotonPolar(), theDRand48Engine, thenParticle, thenParticleInGun, theParticleGun, and thePhotonEnergy.
00029 : thenParticleInGun(0), 00030 thenParticle(0), 00031 thePhotonEnergy(0), 00032 theParticleGun(), 00033 theDRand48Engine() 00034 { 00035 /* *********************************************************************** */ 00036 /* initialize and configure the particle gun */ 00037 /* *********************************************************************** */ 00038 00039 // the Photon energy 00040 thePhotonEnergy = PhotonEnergy; 00041 00042 // number of particles in the Laser beam 00043 thenParticleInGun = nPhotonsInGun; 00044 00045 // number of particles in one beam. ATTENTION: each beam contains nParticleInGun with the same 00046 // startpoint and direction. nParticle gives the number of particles in the beam with a different 00047 // startpoint. They are used to simulate the gaussian beamprofile of the Laser Beams. 00048 thenParticle = nPhotonsInBeam; 00049 00050 // create the particle gun 00051 theParticleGun = new G4ParticleGun(thenParticleInGun); 00052 00053 // default kinematics 00054 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable(); 00055 G4ParticleDefinition * theOpticalPhoton = theParticleTable->FindParticle("opticalphoton"); 00056 00057 theParticleGun->SetParticleDefinition(theOpticalPhoton); 00058 theParticleGun->SetParticleTime(0.0 * ns); 00059 theParticleGun->SetParticlePosition(G4ThreeVector(-500.0 * cm, 0.0 * cm, 0.0 * cm)); 00060 theParticleGun->SetParticleMomentumDirection(G4ThreeVector(5.0, 3.0, 0.0)); 00061 theParticleGun->SetParticleEnergy(10.0 * keV); 00062 setOptPhotonPolar(90.0); 00063 00064 // initialize the random number engine 00065 theDRand48Engine = new DRand48Engine(); 00066 }
LaserBeamsTEC2::~LaserBeamsTEC2 | ( | ) |
destructor
Definition at line 68 of file LaserBeamsTEC2.cc.
References theDRand48Engine, and theParticleGun.
00069 { 00070 if ( theParticleGun != 0 ) { delete theParticleGun; } 00071 if ( theDRand48Engine != 0 ) { delete theDRand48Engine; } 00072 }
void LaserBeamsTEC2::GeneratePrimaries | ( | G4Event * | myEvent | ) |
shoot optical photons into the detector at the beginning of an event
Definition at line 74 of file LaserBeamsTEC2.cc.
References funct::cos(), setOptPhotonPolar(), funct::sin(), theDRand48Engine, thenParticle, theParticleGun, and thePhotonEnergy.
Referenced by LaserPrimaryGeneratorAction::GeneratePrimaries().
00075 { 00076 // this function is called at the beginning of an Event in LaserAlignment::upDate(const BeginOfEvent * myEvent) 00077 00078 // use the random number generator service of the framework 00079 edm::Service<edm::RandomNumberGenerator> rng; 00080 uint seed = rng->mySeed(); 00081 00082 // set the seed 00083 theDRand48Engine->setSeed(seed); 00084 00085 00086 // number of LaserRings and Laserdiodes 00087 const G4int nLaserRings = 2; 00088 const G4int nLaserBeams = 8; 00089 00090 // z position of the sixth Tracker Endcap Disc, where the Laserdiodes are positioned 00091 G4double LaserPositionZ = -2057.5 * mm; 00092 00093 // Radius of the inner and outer Laser ring 00094 G4double LaserRingRadius[nLaserRings] = {564.0 * mm, 840.0 * mm}; 00095 00096 // phi position of the first Laserdiode 00097 G4double LaserPhi0 = 0.392699082; 00098 00099 // width of the LaserBeams 00100 G4double LaserRingSigmaX[nLaserRings] = {0.5 * mm, 0.5 * mm}; 00101 G4double LaserRingSigmaY[nLaserRings] = {0.5 * mm, 0.5 * mm}; 00102 00103 // get the definition of the optical photon 00104 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable(); 00105 G4ParticleDefinition * theOpticalPhoton= theParticleTable->FindParticle("opticalphoton"); 00106 00107 // loop over the LaserRings 00108 for (int theRing = 0; theRing < nLaserRings; theRing++) 00109 { 00110 // loop over the LaserBeams 00111 for (int theBeam = 0; theBeam < nLaserBeams; theBeam++) 00112 { 00113 // code for forward and backward beam 00114 // calculate the right phi for the current beam 00115 G4double LaserPositionPhi = LaserPhi0 + G4double(theBeam * G4double(G4double(2 * M_PI) / nLaserBeams)); 00116 00117 // calculate x and y position for the current beam 00118 G4double LaserPositionX = cos(LaserPositionPhi) * LaserRingRadius[theRing]; 00119 G4double LaserPositionY = sin(LaserPositionPhi) * LaserRingRadius[theRing]; 00120 00121 // loop over all the particles in one beam 00122 for (int theParticle = 0; theParticle < thenParticle; theParticle++) 00123 { 00124 // get randomnumbers and calculate the position 00125 RandGaussQ aGaussObjX( *theDRand48Engine, LaserPositionX, LaserRingSigmaX[theRing] ); 00126 RandGaussQ aGaussObjY( *theDRand48Engine, LaserPositionY, LaserRingSigmaY[theRing] ); 00127 00128 G4double theXPosition = aGaussObjX.fire(); 00129 G4double theYPosition = aGaussObjY.fire(); 00130 G4double theZPosition = LaserPositionZ; 00131 00132 // set the properties of the newly created particle 00133 theParticleGun->SetParticleDefinition(theOpticalPhoton); 00134 theParticleGun->SetParticleTime(0.0 * ns); 00135 theParticleGun->SetParticlePosition(G4ThreeVector(theXPosition, theYPosition, theZPosition)); 00136 theParticleGun->SetParticleEnergy(thePhotonEnergy); 00137 00138 // loop over both directions of the beam 00139 for (int theDirection = 0; theDirection < 2; theDirection++) 00140 { 00141 // shoot in both beam directions ... 00142 if (theDirection == 0) // shoot in forward direction (+z) 00143 { 00144 theParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, 1.0)); 00145 // set the polarization 00146 setOptPhotonPolar(90.0); 00147 // generate the particle 00148 theParticleGun->GeneratePrimaryVertex(myEvent); 00149 } 00150 00151 if (theDirection == 1) // shoot in backward direction (-z) 00152 { 00153 theParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, -1.0)); 00154 // set the polarization 00155 setOptPhotonPolar(90.0); 00156 // generate the particle 00157 theParticleGun->GeneratePrimaryVertex(myEvent); 00158 } 00159 } // end loop over both beam directions 00160 } // end loop over particles in beam 00161 } // end loop over beams 00162 } // end loop over rings 00163 }
void LaserBeamsTEC2::setOptPhotonPolar | ( | G4double | Angle | ) |
set the polarisation of the photons
Definition at line 165 of file LaserBeamsTEC2.cc.
References funct::cos(), funct::sin(), funct::sqrt(), and theParticleGun.
Referenced by GeneratePrimaries(), and LaserBeamsTEC2().
00166 { 00167 /* *********************************************************************** */ 00168 /* to get optical processes working properly, you have to make sure * 00169 * that the photon polarisation is defined. */ 00170 /* *********************************************************************** */ 00171 00172 // first check if we have an optical photon 00173 if ( theParticleGun->GetParticleDefinition()->GetParticleName() != "opticalphoton" ) 00174 { 00175 edm::LogWarning("SimLaserAlignment:LaserBeamsTEC2") << "<LaserBeamsTEC2::setOptPhotonPolar()>: WARNING! The ParticleGun is not an optical photon"; 00176 return; 00177 } 00178 00179 // G4cout << " AC1CMS: The ParticleGun is an " << theParticleGun->GetParticleDefinition()->GetParticleName(); 00180 G4ThreeVector normal(1.0, 0.0, 0.0); 00181 G4ThreeVector kphoton = theParticleGun->GetParticleMomentumDirection(); 00182 G4ThreeVector product = normal.cross(kphoton); 00183 G4double modul2 = product * product; 00184 00185 G4ThreeVector e_perpendicular(0.0, 0.0, 1.0); 00186 00187 if ( modul2 > 0.0 ) { e_perpendicular = (1.0 / sqrt(modul2)) * product; } 00188 00189 G4ThreeVector e_parallel = e_perpendicular.cross(kphoton); 00190 00191 G4ThreeVector polar = cos(Angle) * e_parallel + sin(Angle) * e_perpendicular; 00192 00193 // G4cout << ", the polarization = " << polar << G4endl; 00194 theParticleGun->SetParticlePolarization(polar); 00195 }
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] |
G4ParticleGun* LaserBeamsTEC2::theParticleGun [private] |
Definition at line 43 of file LaserBeamsTEC2.h.
Referenced by GeneratePrimaries(), LaserBeamsTEC2(), setOptPhotonPolar(), and ~LaserBeamsTEC2().
G4double LaserBeamsTEC2::thePhotonEnergy [private] |
Definition at line 40 of file LaserBeamsTEC2.h.
Referenced by GeneratePrimaries(), and LaserBeamsTEC2().