Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/composite_calorimeter/src/CCalPrimaryGeneratorAction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/composite_calorimeter/src/CCalPrimaryGeneratorAction.cc (Version 11.3.0) and /examples/advanced/composite_calorimeter/src/CCalPrimaryGeneratorAction.cc (Version 10.4.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //////////////////////////////////////////////     26 ///////////////////////////////////////////////////////////////////////////////
 27 // File: CCalPrimaryGeneratorAction.cc             27 // File: CCalPrimaryGeneratorAction.cc
 28 // Description: CCalPrimaryGeneratorAction Set     28 // Description: CCalPrimaryGeneratorAction Sets up particle beam
 29 //////////////////////////////////////////////     29 ///////////////////////////////////////////////////////////////////////////////
 30                                                    30 
 31 #include <CLHEP/Random/RandFlat.h>                 31 #include <CLHEP/Random/RandFlat.h>
 32                                                    32 
 33 #include "CCalPrimaryGeneratorAction.hh"           33 #include "CCalPrimaryGeneratorAction.hh"
 34 #include "CCalPrimaryGeneratorMessenger.hh"        34 #include "CCalPrimaryGeneratorMessenger.hh"
 35 #include "G4HEPEvtInterface.hh"                    35 #include "G4HEPEvtInterface.hh"
 36                                                    36 
 37 #include "G4Exp.hh"                                37 #include "G4Exp.hh"
 38 #include "G4PhysicalConstants.hh"                  38 #include "G4PhysicalConstants.hh"
 39 #include "G4SystemOfUnits.hh"                      39 #include "G4SystemOfUnits.hh"
 40 #include "G4Event.hh"                              40 #include "G4Event.hh"
 41 #include "G4ParticleGun.hh"                        41 #include "G4ParticleGun.hh"
 42 #include "G4ParticleTable.hh"                      42 #include "G4ParticleTable.hh"
 43 #include "G4ParticleDefinition.hh"                 43 #include "G4ParticleDefinition.hh"
 44 #include "G4HEPEvtInterface.hh"                    44 #include "G4HEPEvtInterface.hh"
 45 #include "G4RunManager.hh"                         45 #include "G4RunManager.hh"
 46                                                    46 
 47 //#define debug                                <<  47 #define debug
 48                                                    48 
 49 CCalPrimaryGeneratorAction::CCalPrimaryGenerat     49 CCalPrimaryGeneratorAction::CCalPrimaryGeneratorAction(): particleGun(0),
 50   generatorInput(singleFixed),  verboseLevel(0     50   generatorInput(singleFixed),  verboseLevel(0), n_particle(1), 
 51   particleName("pi-"), particleEnergy(100*GeV)     51   particleName("pi-"), particleEnergy(100*GeV), particlePosition(0.,0.,0.),
 52   particleDir(1.,1.,0.1), isInitialized(0), sc     52   particleDir(1.,1.,0.1), isInitialized(0), scanSteps(0) {
 53                                                    53   
 54   //Initialise the messenger                       54   //Initialise the messenger
 55   gunMessenger = new CCalPrimaryGeneratorMesse     55   gunMessenger = new CCalPrimaryGeneratorMessenger(this);
 56                                                    56     
 57   //Default settings:                              57   //Default settings:
 58   SetMinimumEnergy(1.*GeV);                        58   SetMinimumEnergy(1.*GeV);
 59   SetMaximumEnergy(1.*TeV);                        59   SetMaximumEnergy(1.*TeV);
 60   SetMinimumEta(0.);                               60   SetMinimumEta(0.);
 61   SetMaximumEta(3.5);                              61   SetMaximumEta(3.5);
 62   SetMinimumPhi(0.*degree);                        62   SetMinimumPhi(0.*degree);
 63   SetMaximumPhi(360.*degree);                      63   SetMaximumPhi(360.*degree);
 64   SetStepsPhi(1);                                  64   SetStepsPhi(1);
 65   SetStepsEta(1);                                  65   SetStepsEta(1);
 66                                                    66     
 67   // Number of particles per gun                   67   // Number of particles per gun
 68   particleGun = new G4ParticleGun(n_particle);     68   particleGun = new G4ParticleGun(n_particle);
 69                                                    69     
 70   // Getting particle definition                   70   // Getting particle definition
 71   G4ParticleTable* particleTable = G4ParticleT     71   G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
 72   G4ParticleDefinition* particle = particleTab     72   G4ParticleDefinition* particle = particleTable->FindParticle(particleName);
 73   particleGun->SetParticleDefinition(particle)     73   particleGun->SetParticleDefinition(particle);
 74                                                    74     
 75   // Setting particle properties                   75   // Setting particle properties
 76   particleGun->SetParticleEnergy(particleEnerg     76   particleGun->SetParticleEnergy(particleEnergy);
 77   particleGun->SetParticleMomentumDirection(pa     77   particleGun->SetParticleMomentumDirection(particleDir);
 78   particleGun->SetParticlePosition(particlePos     78   particleGun->SetParticlePosition(particlePosition);
 79   print(0);                                        79   print(0);
 80 }                                                  80 }
 81                                                    81 
 82 CCalPrimaryGeneratorAction::~CCalPrimaryGenera     82 CCalPrimaryGeneratorAction::~CCalPrimaryGeneratorAction() {
 83   if (gunMessenger)                                83   if (gunMessenger)
 84     delete gunMessenger;                           84     delete gunMessenger;
 85   if (particleGun)                                 85   if (particleGun)
 86     delete particleGun;                            86     delete particleGun;
 87 }                                                  87 }
 88                                                    88 
 89 void CCalPrimaryGeneratorAction::GeneratePrima     89 void CCalPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) {
 90                                                    90 
 91   if (isInitialized == 0) initialize();            91   if (isInitialized == 0) initialize();
 92                                                    92 
 93   if (generatorInput == singleRandom) {            93   if (generatorInput == singleRandom) {
 94     particleEnergy = CLHEP::RandFlat::shoot(en     94     particleEnergy = CLHEP::RandFlat::shoot(energyMin,energyMax);
 95     particleGun->SetParticleEnergy(particleEne     95     particleGun->SetParticleEnergy(particleEnergy);
 96                                                    96 
 97     G4double eta = CLHEP::RandFlat::shoot(etaM     97     G4double eta = CLHEP::RandFlat::shoot(etaMin,etaMax);
 98     G4double phi = CLHEP::RandFlat::shoot(phiM     98     G4double phi = CLHEP::RandFlat::shoot(phiMin,phiMax);
 99     G4double theta = std::atan(G4Exp(-eta))*2.     99     G4double theta = std::atan(G4Exp(-eta))*2.;
100     G4double randomX = std::sin(theta)*std::co    100     G4double randomX = std::sin(theta)*std::cos(phi);
101     G4double randomY = std::sin(theta)*std::si    101     G4double randomY = std::sin(theta)*std::sin(phi);
102     G4double randomZ = std::cos(theta);           102     G4double randomZ = std::cos(theta);
103                                                   103   
104     particleDir = G4ThreeVector(randomX,random    104     particleDir = G4ThreeVector(randomX,randomY,randomZ);
105     particleGun->SetParticleMomentumDirection(    105     particleGun->SetParticleMomentumDirection(particleDir);
                                                   >> 106 #ifdef debug
106     if (verboseLevel >= 2 ) {                     107     if (verboseLevel >= 2 ) {
107       G4cout << "Energy " << particleEnergy/Ge    108       G4cout << "Energy " << particleEnergy/GeV << " GeV; Theta " 
108              << theta/deg << " degree; Phi " < << 109        << theta/deg << " degree; Phi " << phi/deg << " degree" << G4endl;
109       G4cout << "Shooting in " << particleDir     110       G4cout << "Shooting in " << particleDir << " direction "<< G4endl;
110     }                                             111     }
                                                   >> 112 #endif
111   } else if (generatorInput == singleScan) {      113   } else if (generatorInput == singleScan) {
112     G4double scanEtaStep, scanPhiStep;            114     G4double scanEtaStep, scanPhiStep;
113     if (scanSteps == 0) {                         115     if (scanSteps == 0) { 
114       scanPhiStep = (phiMax - phiMin) / phiSte    116       scanPhiStep = (phiMax - phiMin) / phiSteps;
115       phiValue = phiMin - scanPhiStep; //first    117       phiValue = phiMin - scanPhiStep; //first step is going to change scanCurrentPhiValue
116       etaValue = etaMin;                          118       etaValue = etaMin;
117     }                                             119     }
118                                                   120 
119     scanEtaStep = (etaMax - etaMin) / etaSteps    121     scanEtaStep = (etaMax - etaMin) / etaSteps;
120     scanPhiStep = (phiMax - phiMin) / phiSteps    122     scanPhiStep = (phiMax - phiMin) / phiSteps;
121 #ifdef debug                                      123 #ifdef debug
122     if (verboseLevel > 2 ) {                      124     if (verboseLevel > 2 ) {
123       G4cout << " scanEtaStep " << scanEtaStep    125       G4cout << " scanEtaStep " << scanEtaStep << " # of Steps " << etaSteps 
124              << G4endl;                        << 126        << G4endl;
125       G4cout << " scanPhiStep " << scanPhiStep    127       G4cout << " scanPhiStep " << scanPhiStep << " # of Steps " << phiSteps 
126              << G4endl;                        << 128        << G4endl;
127     }                                             129     }
128 #endif                                            130 #endif
129                                                   131 
130     //----- First scan in phi, then in eta        132     //----- First scan in phi, then in eta
131     if (phiMax - phiValue < 1.E-6 * scanPhiSte    133     if (phiMax - phiValue < 1.E-6 * scanPhiStep) { // !only <= 1.E6 steps allowed
132       if (etaMax - etaValue < 1.E-6 * scanEtaS    134       if (etaMax - etaValue < 1.E-6 * scanEtaStep) { // !only <= 1.E6 steps allowed
133         G4cout << " Scan completed!" << G4endl << 135   G4cout << " Scan completed!" << G4endl;
134         return;                                << 136   return;
135       } else {                                    137       } else {
136         etaValue += scanEtaStep;               << 138   etaValue += scanEtaStep; 
137         phiValue  = phiMin;                    << 139   phiValue  = phiMin;
138       }                                           140       }
139     } else {                                      141     } else {
140       phiValue += scanPhiStep;                    142       phiValue += scanPhiStep;
141     }                                             143     }    
142     G4double theta = std::atan(G4Exp(-etaValue    144     G4double theta = std::atan(G4Exp(-etaValue))*2.;
143                                                   145 
144     G4double scanX = std::sin(theta)*std::cos(    146     G4double scanX = std::sin(theta)*std::cos(phiValue);
145     G4double scanY = std::sin(theta)*std::sin(    147     G4double scanY = std::sin(theta)*std::sin(phiValue);
146     G4double scanZ = std::cos(theta);             148     G4double scanZ = std::cos(theta);
147     if (verboseLevel >= 2 ) {                     149     if (verboseLevel >= 2 ) {
148       G4cout << "Scan eta " << etaValue << " P    150       G4cout << "Scan eta " << etaValue << " Phi " << phiValue/deg
149              << " theta " << theta/deg << G4en << 151        << " theta " << theta/deg << G4endl;
150     }                                             152     }
151     particleDir = G4ThreeVector(scanX,scanY,sc    153     particleDir = G4ThreeVector(scanX,scanY,scanZ);
152     particleGun->SetParticleMomentumDirection(    154     particleGun->SetParticleMomentumDirection(particleDir);
153 #ifdef debug                                      155 #ifdef debug
154     if (verboseLevel > 2 ) {                      156     if (verboseLevel > 2 ) {
155       G4cout  << "Shooting in " << particleDir    157       G4cout  << "Shooting in " << particleDir << " direction "<< G4endl;
156     }                                             158     }
157 #endif                                            159 #endif
158     scanSteps++;                                  160     scanSteps++;
159   }                                               161   }
160                                                   162   
161   // Generate GEANT4 primary vertex               163   // Generate GEANT4 primary vertex
162   particleGun->GeneratePrimaryVertex(anEvent);    164   particleGun->GeneratePrimaryVertex(anEvent);
163 }                                                 165 } 
164                                                   166 
165                                                   167 
166 void CCalPrimaryGeneratorAction::SetVerboseLev    168 void CCalPrimaryGeneratorAction::SetVerboseLevel(G4int val){
167   verboseLevel = val;                             169   verboseLevel = val;
168 }                                                 170 }
169                                                   171 
170                                                   172 
171 void CCalPrimaryGeneratorAction::SetRandom(G4S    173 void CCalPrimaryGeneratorAction::SetRandom(G4String val) { 
172                                                   174 
173   if (val=="on") {                                175   if (val=="on") {
174     generatorInput = singleRandom;                176     generatorInput = singleRandom;
175     print (1);                                    177     print (1);
176   } else {                                        178   } else {
177     generatorInput = singleFixed;                 179     generatorInput = singleFixed;
178     print (1);                                    180     print (1);
179   }                                               181   }
180 }                                                 182 }
181                                                   183 
182                                                   184 
183 void CCalPrimaryGeneratorAction::SetScan(G4Str    185 void CCalPrimaryGeneratorAction::SetScan(G4String val) { 
184                                                   186 
185   if (val=="on") {                                187   if (val=="on") {
186     generatorInput = singleScan;                  188     generatorInput = singleScan;
187     scanSteps = 0;                                189     scanSteps = 0;
188     print (1);                                    190     print (1);
189   } else {                                        191   } else {
190     generatorInput = singleFixed;                 192     generatorInput = singleFixed;
191     print (1);                                    193     print (1);
192   }                                               194   }  
193 }                                                 195 }
194                                                   196 
195                                                   197 
196 void CCalPrimaryGeneratorAction::SetMinimumEne    198 void CCalPrimaryGeneratorAction::SetMinimumEnergy(G4double p){
197                                                   199 
198   if (p <= 0.) {                                  200   if (p <= 0.) {
199     G4cerr << "CCalPrimaryGeneratorAction::Set    201     G4cerr << "CCalPrimaryGeneratorAction::SetMinimumEnergy: value " << p/GeV 
200            << "GeV is out of bounds, it will n << 202      << "GeV is out of bounds, it will not be used" << G4endl;
201     G4cerr << " Should be  >0.  Please check"     203     G4cerr << " Should be  >0.  Please check" << G4endl; 
202   } else {                                        204   } else {
203     energyMin = p;                                205     energyMin = p;
204 #ifdef debug                                      206 #ifdef debug
205     if (verboseLevel >= 1 ) {                     207     if (verboseLevel >= 1 ) {
206       G4cout << " CCalPrimaryGeneratorAction:     208       G4cout << " CCalPrimaryGeneratorAction: setting min. value of energy to "
207              << energyMin/GeV << " GeV " << G4 << 209        << energyMin/GeV << " GeV " << G4endl;
208     }                                             210     }
209 #endif                                            211 #endif
210   }                                               212   }
211 }                                                 213 }
212                                                   214 
213                                                   215 
214 void CCalPrimaryGeneratorAction::SetMaximumEne    216 void CCalPrimaryGeneratorAction::SetMaximumEnergy(G4double p){
215                                                   217 
216   if (p <= 0.) {                                  218   if (p <= 0.) {
217     G4cerr << "CCalPrimaryGeneratorAction::Set    219     G4cerr << "CCalPrimaryGeneratorAction::SetMaximumEnergy: value " << p/GeV 
218            << "GeV is out of bounds, it will n << 220      << "GeV is out of bounds, it will not be used" << G4endl;
219     G4cerr << " Should be  >0.  Please check"     221     G4cerr << " Should be  >0.  Please check" << G4endl; 
220   } else {                                        222   } else {
221     energyMax = p;                                223     energyMax = p;
222 #ifdef debug                                      224 #ifdef debug
223     if (verboseLevel >= 1 ) {                     225     if (verboseLevel >= 1 ) {
224       G4cout << " CCalPrimaryGeneratorAction:     226       G4cout << " CCalPrimaryGeneratorAction: setting max. value of energy to "
225              << energyMax/GeV << " GeV " << G4 << 227        << energyMax/GeV << " GeV " << G4endl;
226     }                                             228     }
227 #endif                                            229 #endif
228   }                                               230   }
229 }                                                 231 }
230                                                   232 
231                                                   233 
232 void CCalPrimaryGeneratorAction::SetMinimumPhi    234 void CCalPrimaryGeneratorAction::SetMinimumPhi(G4double p){
233                                                   235 
234   if (std::fabs(p)>2.*pi) {                       236   if (std::fabs(p)>2.*pi) {
235     G4cerr << "CCalPrimaryGeneratorAction::Set    237     G4cerr << "CCalPrimaryGeneratorAction::SetMinimumPhi: setting value quite "
236            << "large" << G4endl;               << 238      << "large" << G4endl;
237     G4cerr << " Should be given in radians - P    239     G4cerr << " Should be given in radians - Please check" << G4endl;
238   } else {                                        240   } else {
239     phiMin = std::fabs(p);                        241     phiMin = std::fabs(p);
240 #ifdef debug                                      242 #ifdef debug
241     if (verboseLevel >= 1 ) {                     243     if (verboseLevel >= 1 ) {
242       G4cout << " CCalPrimaryGeneratorAction:     244       G4cout << " CCalPrimaryGeneratorAction: setting min. value of phi to "
243              << phiMin << G4endl;              << 245        << phiMin << G4endl;
244     }                                             246     }
245 #endif                                            247 #endif
246   }                                               248   }
247 }                                                 249 }
248                                                   250 
249                                                   251 
250 void CCalPrimaryGeneratorAction::SetMaximumPhi    252 void CCalPrimaryGeneratorAction::SetMaximumPhi(G4double p){
251                                                   253 
252   if (std::fabs(p)>2.*pi) {                       254   if (std::fabs(p)>2.*pi) {
253     G4cerr << "CCalPrimaryGeneratorAction::Set    255     G4cerr << "CCalPrimaryGeneratorAction::SetMaximumPhi: setting value quite "
254            << "large" << G4endl;               << 256      << "large" << G4endl;
255     G4cerr << " Should be given in radians - P    257     G4cerr << " Should be given in radians - Please check" << G4endl;
256   } else {                                        258   } else {
257     phiMax = std::fabs(p);                        259     phiMax = std::fabs(p);
258 #ifdef debug                                      260 #ifdef debug
259     if (verboseLevel >= 1 ) {                     261     if (verboseLevel >= 1 ) {
260       G4cout << " CCalPrimaryGeneratorAction:     262       G4cout << " CCalPrimaryGeneratorAction: setting max. value of phi to "
261              << phiMax << G4endl;              << 263        << phiMax << G4endl;
262     }                                             264     }
263 #endif                                            265 #endif
264   }                                               266   }
265 }                                                 267 }
266                                                   268 
267                                                   269 
268 void CCalPrimaryGeneratorAction::SetStepsPhi(G    270 void CCalPrimaryGeneratorAction::SetStepsPhi(G4int val){
269                                                   271 
270   if (val <= 0) {                                 272   if (val <= 0) {
271     G4cerr << "CCalPrimaryGeneratorAction::Set    273     G4cerr << "CCalPrimaryGeneratorAction::SetStepsPhi: value " << val 
272            << " is out of bounds, it will not  << 274      << " is out of bounds, it will not be used" << G4endl;
273     G4cerr << " Should be  > 0  Please check"     275     G4cerr << " Should be  > 0  Please check" << G4endl; 
274   } else {                                        276   } else {
275     phiSteps = val;                               277     phiSteps = val;
276 #ifdef debug                                      278 #ifdef debug
277     if (verboseLevel >= 1 ) {                     279     if (verboseLevel >= 1 ) {
278       G4cout << " CCalPrimaryGeneratorAction:     280       G4cout << " CCalPrimaryGeneratorAction: setting no. of steps in phi to "
279              << phiSteps << G4endl;            << 281        << phiSteps << G4endl;
280     }                                             282     }
281 #endif                                            283 #endif
282   }                                               284   }
283 }                                                 285 }
284                                                   286 
285                                                   287 
286 void CCalPrimaryGeneratorAction::SetMinimumEta    288 void CCalPrimaryGeneratorAction::SetMinimumEta(G4double p){
287                                                   289 
288   etaMin = p;                                     290   etaMin = p;
289 #ifdef debug                                      291 #ifdef debug
290   if (verboseLevel >= 1 ) {                       292   if (verboseLevel >= 1 ) {
291     G4cout << " CCalPrimaryGeneratorAction: se    293     G4cout << " CCalPrimaryGeneratorAction: setting min. value of eta to "
292            << etaMin << G4endl;                << 294      << etaMin << G4endl;
293   }                                               295   }
294 #endif                                            296 #endif
295 }                                                 297 }
296                                                   298 
297                                                   299 
298 void CCalPrimaryGeneratorAction::SetMaximumEta    300 void CCalPrimaryGeneratorAction::SetMaximumEta(G4double p){
299                                                   301 
300   etaMax = p;                                     302   etaMax = p;
301 #ifdef debug                                      303 #ifdef debug
302   if (verboseLevel >= 1 ) {                       304   if (verboseLevel >= 1 ) {
303     G4cout << " CCalPrimaryGeneratorAction: se    305     G4cout << " CCalPrimaryGeneratorAction: setting max. value of eta to "
304            << etaMax << G4endl;                << 306      << etaMax << G4endl;
305   }                                               307   }
306 #endif                                            308 #endif
307 }                                                 309 }
308                                                   310 
309                                                   311 
310 void CCalPrimaryGeneratorAction::SetStepsEta(G    312 void CCalPrimaryGeneratorAction::SetStepsEta(G4int val){
311                                                   313 
312   if (val <= 0) {                                 314   if (val <= 0) {
313     G4cerr<<"CCalPrimaryGeneratorAction::SetSt    315     G4cerr<<"CCalPrimaryGeneratorAction::SetStepsEta: value " << val << " is out of bounds, it will not be used"<<G4endl;
314     G4cerr<<" Should be  > 0  Please check"<<G    316     G4cerr<<" Should be  > 0  Please check"<<G4endl; 
315   } else {                                        317   } else {
316     etaSteps = val;                               318     etaSteps = val;
317 #ifdef debug                                      319 #ifdef debug
318     if (verboseLevel >= 1 ) {                     320     if (verboseLevel >= 1 ) {
319       G4cout << " CCalPrimaryGeneratorAction:     321       G4cout << " CCalPrimaryGeneratorAction: setting no. of steps in eta to "
320              << etaSteps << G4endl;            << 322        << etaSteps << G4endl;
321     }                                             323     }
322 #endif                                            324 #endif
323   }                                               325   }
324 }                                                 326 }
325                                                   327 
326 void CCalPrimaryGeneratorAction::SetGunPositio    328 void CCalPrimaryGeneratorAction::SetGunPosition(const G4ThreeVector & pos) const {
327                                                   329 
328   particleGun->SetParticlePosition(pos);          330   particleGun->SetParticlePosition(pos);
329 }                                                 331 }
330                                                   332 
331 void CCalPrimaryGeneratorAction::SetRunNo(G4in    333 void CCalPrimaryGeneratorAction::SetRunNo(G4int val){
332   G4RunManager::GetRunManager()->SetRunIDCount    334   G4RunManager::GetRunManager()->SetRunIDCounter( val );
333 }                                                 335 }
334                                                   336 
335 void CCalPrimaryGeneratorAction::initialize(){    337 void CCalPrimaryGeneratorAction::initialize(){
336                                                   338 
337   isInitialized = 1;                              339   isInitialized = 1;
338                                                   340 
339   print (1);                                      341   print (1);
340 }                                                 342 }
341                                                   343 
342                                                   344 
343 void CCalPrimaryGeneratorAction::print(G4int v    345 void CCalPrimaryGeneratorAction::print(G4int val){
344                                                   346 
                                                   >> 347 #ifdef debug
345   if (verboseLevel >= val) {                      348   if (verboseLevel >= val) {
346                                                   349 
347     if (generatorInput == singleRandom) {         350     if (generatorInput == singleRandom) {
348       G4cout << G4endl                            351       G4cout << G4endl
349              << "***************************** << 352              << "**********************************************************************" << G4endl
350              << "*                             << 353        << "*                                                                    *" << G4endl  
351              << "* CCalPrimaryGeneratorAction  << 354              << "* CCalPrimaryGeneratorAction DEFAULT Random Energy/Direction setting:*" << G4endl
352              << "*                             << 355        << "*                                                                    *" << G4endl  
353              << "*                             << 356        << "*                                                                    *" << G4endl  
354              << "*   Energy in    [ "<< energy << 357        << "*   Energy in    [ "<< energyMin/GeV   << " - " << energyMax/GeV   << "] (GeV) "<< G4endl
355              << "*   Phi angle in [ "<< phiMin << 358        << "*   Phi angle in [ "<< phiMin          << " - " << phiMax          << "] (rad) "<< G4endl
356              << "*                [ "<< phiMin << 359        << "*                [ "<< phiMin/degree   << " - " << phiMax/degree   << "] (deg) "<< G4endl 
357              << "*   Eta in       [ "<< etaMin << 360        << "*   Eta in       [ "<< etaMin          << " - " << etaMax          << "]       "<< G4endl
358              << "*                             << 361        << "*                                                                    *" << G4endl  
359              << "*                             << 362        << "*                                                                    *" << G4endl  
360                    << "*********************** << 363              << "**********************************************************************" << G4endl;
361     } else if (generatorInput == singleScan) {    364     } else if (generatorInput == singleScan) {
362       G4cout << G4endl                            365       G4cout << G4endl
363              << "***************************** << 366        << "**********************************************************************" << G4endl
364              << "*                             << 367        << "*                                                                    *" << G4endl  
365              << "* CCalPrimaryGeneratorAction  << 368              << "* CCalPrimaryGeneratorAction DEFAULT Scan Direction settings :       *" << G4endl
366              << "*                             << 369        << "*                                                                    *" << G4endl  
367              << "*                             << 370        << "*                                                                    *" << G4endl  
368              << "*   Phi angle in [ " << phiMi << 371        << "*   Phi angle in [ " << phiMin/degree   << " - " << phiMax/degree << "] (deg) " << G4endl
369              << "*   Eta in       [ " << etaMi << 372        << "*   Eta in       [ " << etaMin          << " - " << etaMax        << "]       " << G4endl
370              << "*   Steps along eta " << etaS << 373        << "*   Steps along eta " << etaSteps << " and along phi " << phiSteps << G4endl
371              << "*                             << 374        << "*                                                                    *" << G4endl  
372              << "*                             << 375        << "*                                                                    *" << G4endl  
373                    << "*********************** << 376              << "**********************************************************************" << G4endl;
374     } else  if (generatorInput == singleFixed)    377     } else  if (generatorInput == singleFixed) {
375       G4cout << G4endl                            378       G4cout << G4endl
376              << "***************************** << 379        << "*******************************************************************" << G4endl
377              << "*                             << 380        << "*                                                                 *" << G4endl  
378              << "* CCalPrimaryGeneratorAction: << 381        << "* CCalPrimaryGeneratorAction: Current settings :                  *" << G4endl
379              << "*                             << 382        << "*                                                                 *" << G4endl  
380              << "* " << particleGun->GetNumber << 383        << "* " << particleGun->GetNumberOfParticles() 
381              << "  " << particleGun->GetPartic << 384        << "  " << particleGun->GetParticleDefinition()->GetParticleName() 
382              << " of " << particleGun->GetPart << 385        << " of " << particleGun->GetParticleEnergy()/GeV << " GeV" << G4endl
383              << "* will be shot from " << part << 386        << "* will be shot from " << particleGun->GetParticlePosition() << G4endl;
384       G4cout << "* in direction " << particleG    387       G4cout << "* in direction " << particleGun->GetParticleMomentumDirection() << G4endl;
385       G4cout << "*                             << 388       G4cout  << "*                                                                 *" << G4endl  
386              << "*                             << 389         << "*                                                                 *" << G4endl  
387              << "***************************** << 390         << "*******************************************************************" << G4endl;
388     }                                             391     }
389   }                                            << 392   }
                                                   >> 393 #endif
                                                   >> 394  
390 }                                                 395 }
                                                   >> 396 
391                                                   397