CMS 3D CMS Logo

LaserPrimaryGeneratorAction.cc
Go to the documentation of this file.
1 
11 
13 
14 #include "G4SystemOfUnits.hh"
15 
17  : thePhotonEnergy(0),
18  thenParticleInGun(0),
19  thenParticle(0),
20  theLaserBeamsInTEC1(),
21  theLaserBeamsInTEC2(),
22  theLaserBeamsInTECTIBTOBTEC() {
23  // {{{ LaserPrimaryGeneratorAction constructor
24 
25  // get the PhotonEnergy from the parameter set
26  thePhotonEnergy = theConf.getUntrackedParameter<double>("PhotonEnergy", 1.15) * eV;
27 
28  // number of particles in the Laser beam
29  thenParticleInGun = theConf.getUntrackedParameter<int>("NumberOfPhotonsInParticleGun", 1);
30 
31  // number of particles in one beam. ATTENTION: each beam contains
32  // nParticleInGun with the same startpoint and direction. nParticle gives the
33  // number of particles in the beam with a different startpoint. They are used
34  // to simulate the gaussian beamprofile of the Laser Beams.
35  thenParticle = theConf.getUntrackedParameter<int>("NumberOfPhotonsInEachBeam", 1);
36 
37  // create a messenger for this class
38  // theGunMessenger = new LaserPrimaryGeneratorMessenger(this);
39 
40  // create the beams in the right endcap
42 
43  // create the beams in the left endcap
45 
46  // create the beams to connect the TECs with TOB and TIB
48  // }}}
49 }
50 
52  // {{{ LaserPrimaryGeneratorAction destructor
53 
54  if (theLaserBeamsInTEC1 != nullptr) {
55  delete theLaserBeamsInTEC1;
56  }
57  if (theLaserBeamsInTEC2 != nullptr) {
58  delete theLaserBeamsInTEC2;
59  }
60  if (theLaserBeamsInTECTIBTOBTEC != nullptr) {
62  }
63  // }}}
64 }
65 
67  // {{{ GeneratePrimaries (G4Event * myEvent)
68 
69  // this function is called at the beginning of an Event in
70  // LaserAlignment::upDate(const BeginOfEvent * myEvent)
71  LogDebug("LaserPrimaryGeneratorAction") << "<LaserPrimaryGeneratorAction::GeneratePrimaries(G4Event*)>: create a "
72  "new Laser Event";
73 
74  // shoot in the right endcap
76 
77  // shoot in the left endcap
79 
80  // shoot in the barrel
82 
83  // loop over all the generated vertices, get the primaries and set the user
84  // information
85  int theID = 0;
86 
87  for (int i = 1; i < myEvent->GetNumberOfPrimaryVertex(); i++) {
88  G4PrimaryVertex *theVertex = myEvent->GetPrimaryVertex(i);
89 
90  for (int j = 0; j < theVertex->GetNumberOfParticle(); j++) {
91  G4PrimaryParticle *thePrimary = theVertex->GetPrimary(j);
92 
93  setGeneratorId(thePrimary, theID);
94  theID++;
95  }
96  }
97  // }}}
98 }
99 
100 void LaserPrimaryGeneratorAction::setGeneratorId(G4PrimaryParticle *aParticle, int ID) const {
101  // {{{ SetGeneratorId(G4PrimaryParticle * aParticle, int ID) const
102 
103  /* *********************************************************************** */
104  /* OSCAR expacts each G4PrimaryParticle to have some User Information *
105  * therefore this function have been implemented */
106  /* *********************************************************************** */
107 
108  aParticle->SetUserInformation(new GenParticleInfo(ID));
109  // }}}
110 }
mps_fire.i
i
Definition: mps_fire.py:428
LaserBeamsTEC2
Definition: LaserBeamsTEC2.h:21
MessageLogger.h
LaserPrimaryGeneratorAction::~LaserPrimaryGeneratorAction
~LaserPrimaryGeneratorAction() override
destructor
Definition: LaserPrimaryGeneratorAction.cc:51
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
LaserPrimaryGeneratorAction.h
LaserBeamsBarrel::GeneratePrimaries
void GeneratePrimaries(G4Event *myEvent) override
shoot optical photons into the detector at the beginning of an event
Definition: LaserBeamsBarrel.cc:74
LaserBeamsTEC2::GeneratePrimaries
void GeneratePrimaries(G4Event *myEvent) override
shoot optical photons into the detector at the beginning of an event
Definition: LaserBeamsTEC2.cc:74
LaserBeamsTEC1
Definition: LaserBeamsTEC1.h:21
LaserBeamsBarrel
Definition: LaserBeamsBarrel.h:21
GenParticleInfo.h
LaserPrimaryGeneratorAction::thenParticle
G4int thenParticle
Definition: LaserPrimaryGeneratorAction.h:43
ecalTB2006H4_GenSimDigiReco_cfg.myEvent
myEvent
Definition: ecalTB2006H4_GenSimDigiReco_cfg.py:7
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
align::ID
uint32_t ID
Definition: Definitions.h:24
LaserPrimaryGeneratorAction::setGeneratorId
void setGeneratorId(G4PrimaryParticle *aParticle, int ID) const
set Id of the optical photons
Definition: LaserPrimaryGeneratorAction.cc:100
GenParticleInfo
Definition: GenParticleInfo.h:6
LaserPrimaryGeneratorAction::LaserPrimaryGeneratorAction
LaserPrimaryGeneratorAction(edm::ParameterSet const &theConf)
constructor
Definition: LaserPrimaryGeneratorAction.cc:16
LaserPrimaryGeneratorAction::theLaserBeamsInTEC1
LaserBeamsTEC1 * theLaserBeamsInTEC1
Definition: LaserPrimaryGeneratorAction.h:46
LaserPrimaryGeneratorAction::theLaserBeamsInTECTIBTOBTEC
LaserBeamsBarrel * theLaserBeamsInTECTIBTOBTEC
Definition: LaserPrimaryGeneratorAction.h:48
LaserPrimaryGeneratorAction::thePhotonEnergy
G4double thePhotonEnergy
Definition: LaserPrimaryGeneratorAction.h:41
LaserPrimaryGeneratorAction::thenParticleInGun
G4int thenParticleInGun
Definition: LaserPrimaryGeneratorAction.h:42
LaserBeamsTEC1::GeneratePrimaries
void GeneratePrimaries(G4Event *myEvent) override
shoot optical photons into the detector at the beginning of an event
Definition: LaserBeamsTEC1.cc:74
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
LaserPrimaryGeneratorAction::theLaserBeamsInTEC2
LaserBeamsTEC2 * theLaserBeamsInTEC2
Definition: LaserPrimaryGeneratorAction.h:47
LaserPrimaryGeneratorAction::GeneratePrimaries
void GeneratePrimaries(G4Event *myEvent) override
Definition: LaserPrimaryGeneratorAction.cc:66