LBNEPrimaryMessenger.cc
Go to the documentation of this file.
2 
4 #include "G4UIdirectory.hh"
5 #include "G4UIcmdWithAnInteger.hh"
6 #include "G4UIcmdWithADoubleAndUnit.hh"
7 #include "G4UIcmdWith3VectorAndUnit.hh"
8 #include "G4UIcmdWithADouble.hh"
9 #include "G4UIcmdWithAString.hh"
10 #include "G4UIcmdWithABool.hh"
11 #include "G4UIcmdWithoutParameter.hh"
12 #include "G4ios.hh"
13 #include "globals.hh"
14 #include "Randomize.hh"
15 #include "LBNERunManager.hh"
16 
18  :fPrimaryAction (RA)
19 {
20  LBNERunManager* theRunManager = dynamic_cast<LBNERunManager*>(G4RunManager::GetRunManager());
21 
22  if(theRunManager->GetVerboseLevel() > 0)
23  {
24  G4cout << "LBNEPrimaryMessenger Constructor Called." << G4endl;
25  }
26  fDirectory = new G4UIdirectory("/LBNE/generator/");
27 
29  new G4UIcmdWithADoubleAndUnit("/LBNE/generator/beamOffsetX",this);
30  fBeamOffsetXCmd->SetGuidance("Set the X offset of the proton beam");
31  fBeamOffsetXCmd->SetParameterName("beamOffsetX", false);
32  fBeamOffsetXCmd->SetUnitCategory("Length");
33  fBeamOffsetXCmd->SetDefaultValue (0.);
34  fBeamOffsetXCmd->SetDefaultUnit ("mm");
35  fBeamOffsetXCmd->SetUnitCandidates ("mm cm");
36 
38  new G4UIcmdWithADoubleAndUnit("/LBNE/generator/beamOffsetY",this);
39  fBeamOffsetYCmd->SetGuidance("Set the Y offset of the proton beam");
40  fBeamOffsetYCmd->SetParameterName("beamOffsetY", false);
41  fBeamOffsetYCmd->SetUnitCategory("Length");
42  fBeamOffsetYCmd->SetDefaultValue (0.);
43  fBeamOffsetYCmd->SetDefaultUnit ("mm");
44  fBeamOffsetYCmd->SetUnitCandidates ("mm cm");
45 
47  new G4UIcmdWithADoubleAndUnit("/LBNE/generator/beamSigmaX",this);
48  fBeamSigmaXCmd->SetGuidance("Set the X Sigma of the proton beam");
49  fBeamSigmaXCmd->SetParameterName("beamSigmaX", false);
50  fBeamSigmaXCmd->SetUnitCategory("Length");
51  fBeamSigmaXCmd->SetDefaultValue (fPrimaryAction->GetBeamSigmaX());
52  fBeamSigmaXCmd->SetDefaultUnit ("mm");
53  fBeamSigmaXCmd->SetUnitCandidates ("mm cm");
54 
56  new G4UIcmdWithADoubleAndUnit("/LBNE/generator/beamSigmaY",this);
57  fBeamSigmaYCmd->SetGuidance("Set the Y Sigma of the proton beam");
58  fBeamSigmaYCmd->SetParameterName("beamSigmaY", false);
59  fBeamSigmaYCmd->SetUnitCategory("Length");
60  fBeamSigmaYCmd->SetDefaultValue (fPrimaryAction->GetBeamSigmaY());
61  fBeamSigmaYCmd->SetDefaultUnit ("mm");
62  fBeamSigmaYCmd->SetUnitCandidates ("mm cm");
63 
65  new G4UIcmdWithADoubleAndUnit("/LBNE/generator/beamMaxValX",this);
66  fBeamMaxValXCmd->SetGuidance("Set the maximum value in Y that a proton can have on target");
67  fBeamMaxValXCmd->SetParameterName("beamMaxValX", false);
68  fBeamMaxValXCmd->SetUnitCategory("Length");
69  fBeamMaxValXCmd->SetDefaultValue (fPrimaryAction->GetBeamMaxValX());
70  fBeamMaxValXCmd->SetDefaultUnit ("mm");
71  fBeamMaxValXCmd->SetUnitCandidates ("mm cm");
72 
74  new G4UIcmdWithADoubleAndUnit("/LBNE/generator/beamMaxValY",this);
75  fBeamMaxValYCmd->SetGuidance("Set the maximum value in Y that a proton can have on target");
76  fBeamMaxValYCmd->SetParameterName("beamMaxValY", false);
77  fBeamMaxValYCmd->SetUnitCategory("Length");
78  fBeamMaxValYCmd->SetDefaultValue (fPrimaryAction->GetBeamMaxValY());
79  fBeamMaxValYCmd->SetDefaultUnit ("mm");
80  fBeamMaxValYCmd->SetUnitCandidates ("mm cm");
81 
83  new G4UIcmdWithADoubleAndUnit("/LBNE/generator/beamTheta",this);
84  fBeamThetaCmd->SetGuidance("Set the angle (theta) of the proton beam");
85  fBeamThetaCmd->SetParameterName("beamTheta", false);
86  fBeamThetaCmd->SetUnitCategory("Angle");
87 
88  fBeamPhiCmd =
89  new G4UIcmdWithADoubleAndUnit("/LBNE/generator/beamPhi",this);
90  fBeamPhiCmd->SetGuidance("Set the angle (phi) of the proton beam.");
91  fBeamPhiCmd->SetParameterName("beamPhi", false);
92  fBeamPhiCmd->SetUnitCategory("Angle");
93 
95  new G4UIcmdWithABool("/LBNE/generator/correctForAngle", this);
96  fCorrectForAngleCmd->SetGuidance("If true, beam x/y position is corrected");
97  fCorrectForAngleCmd->SetGuidance("to hit center of target using angle of");
98  fCorrectForAngleCmd->SetGuidance("beam. Offsets in x and y specified via");
99  fCorrectForAngleCmd->SetGuidance("messenger are still respected.");
100 
101  fProtonMomentum = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/protonMomentum",this);
102  fProtonMomentum->SetGuidance("Primary proton momentum delivered by the Fermilab Main Injector ");
103  fProtonMomentum->SetParameterName("protonMomentum",true);
104  fProtonMomentum->SetDefaultValue (120.0*CLHEP::GeV);
105  fProtonMomentum->SetDefaultUnit ("GeV");
106  fProtonMomentum->SetUnitCandidates ("GeV");
107  fProtonMomentum->AvailableForStates(G4State_Idle);
108 
110  new G4UIcmdWithABool("/LBNE/generator/beamOnTarget", this);
111  fBeamOnTargetCmd->SetGuidance("If true, forces beam to hit the center");
112  fBeamOnTargetCmd->SetGuidance("of target. Any x or y offsets supplied");
113  fBeamOnTargetCmd->SetGuidance("via messenger are ignored");
114 
115  fBeamBetaFunctionX = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/beamBetaFunctionX", this);
116  fBeamBetaFunctionX->SetGuidance(
117  "LBNE beam line X beta function at the the target (MCZERO) delived by the Fermilab Main Injector ");
118  fBeamBetaFunctionX->SetParameterName("beamBetaFunctionX",true);
119  fBeamBetaFunctionX->SetDefaultValue (64.842); // ugly, but the primary geenrator class not yet instantiated.
120  fBeamBetaFunctionX->SetDefaultUnit ("m");
121  fBeamBetaFunctionX->SetUnitCandidates ("m");
122  fBeamBetaFunctionX->AvailableForStates(G4State_Idle);
123 
124  fBeamBetaFunctionY = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/beamBetaFunctionY", this);
125  fBeamBetaFunctionX->SetGuidance(
126  "LBNE beam line Y beta function at the the target (MCZERO) delived by the Fermilab Main Injector ");
127  fBeamBetaFunctionY->SetParameterName("beamBetaFunctionY",true);
128  fBeamBetaFunctionY->SetDefaultValue (64.842); // ugly, but the primary geenrator class not yet instantiated.
129  fBeamBetaFunctionY->SetDefaultUnit ("m");
130  fBeamBetaFunctionY->SetUnitCandidates ("m");
131  fBeamBetaFunctionY->AvailableForStates(G4State_Idle);
132 
133  fBeamEmittanceX = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/beamEmittanceX", this);
134  fBeamEmittanceX->SetGuidance(
135  "LBNE beam line X Emittance, in pi mm mRad, Fermilab units. ");
136  fBeamEmittanceX->SetParameterName("beamEmittanceX",true);
137  fBeamEmittanceX->SetDefaultValue (20.); // ugly, but the primary geenrator class not yet instantiated.
138  fBeamEmittanceX->SetDefaultUnit ("mm"); // a lie, but define a unit will only bring more confusion.
139  fBeamEmittanceX->SetUnitCandidates ("mm");
140  fBeamEmittanceX->AvailableForStates(G4State_Idle);
141 
142  fBeamEmittanceY = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/beamEmittanceY", this);
143  fBeamEmittanceY->SetGuidance(
144  "LBNE beam line Y Emittance, in pi mm mRad, Fermilab units. ");
145  fBeamEmittanceY->SetParameterName("beamEmittanceY",true);
146  fBeamEmittanceY->SetDefaultValue (20.); // ugly, but the primary geenrator class not yet instantiated.
147  fBeamEmittanceY->SetDefaultUnit ("mm"); // a lie, but define a unit will only bring more confusion.
148  fBeamEmittanceY->SetUnitCandidates ("mm");
149  fBeamEmittanceY->AvailableForStates(G4State_Idle);
150 
151  fRadiusAnnularBeam = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/annularBeamRadius", this);
152  fRadiusAnnularBeam->SetGuidance(
153  "LBNF Annular beam option. Setting the radius of the annulus. Width set by XY beam size. ");
154  fRadiusAnnularBeam->SetParameterName("Annular",true);
155  fRadiusAnnularBeam->SetDefaultValue (-1.); // Default is no annulus.
156  fRadiusAnnularBeam->SetDefaultUnit ("mm"); // a lie, but define a unit will only bring more confusion.
157  fRadiusAnnularBeam->SetUnitCandidates ("mm");
158  fRadiusAnnularBeam->AvailableForStates(G4State_Idle);
159 
160 
161  fUseGeantino = new G4UIcmdWithoutParameter("/LBNE/primary/useGeantino",this);
162  fUseGeantino->SetGuidance("Using a Geantino at the Primary, to study absorption");
163  fUseGeantino->AvailableForStates(G4State_Idle);
164 
165  fUseMuonGeantino = new G4UIcmdWithoutParameter("/LBNE/primary/useMuonGeantino",this);
166  fUseMuonGeantino->SetGuidance("Using a muon at the Primary, to study absorption, with magnetic field effect ");
167  fUseMuonGeantino->AvailableForStates(G4State_Idle);
168 
169  fUseChargedGeantino = new G4UIcmdWithoutParameter("/LBNE/primary/useChargedGeantino",this);
170  fUseChargedGeantino->SetGuidance("Using a particle with charge, but no other physics (I hope) magnetic field effect ");
171  fUseChargedGeantino->AvailableForStates(G4State_Idle);
172 
173  fGeantinoOpeningAngle = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/geantinoOpeningAngle",this);
174  fGeantinoOpeningAngle->SetGuidance("Polar angle generating the geantino (or mu geantino) ");
175  fGeantinoOpeningAngle->SetParameterName("GeantinoOpeningAngle",true);
176  fGeantinoOpeningAngle->SetDefaultValue (0.005*CLHEP::radian);
177  fGeantinoOpeningAngle->SetDefaultUnit("radian");
178  fGeantinoOpeningAngle->SetUnitCandidates("radian");
179  fGeantinoOpeningAngle->AvailableForStates(G4State_Idle);
180 
181  fGeantinoOpeningAngleMin = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/geantinoOpeningAngleMin",this);
182  fGeantinoOpeningAngleMin->SetGuidance("Minimum Polar angle generating the geantino (or mu geantino) ");
183  fGeantinoOpeningAngleMin->SetParameterName("GeantinoOpeningAngleMin",true);
184  fGeantinoOpeningAngleMin->SetDefaultValue (0.);
185  fGeantinoOpeningAngleMin->SetDefaultUnit("radian");
186  fGeantinoOpeningAngleMin->SetUnitCandidates("radian");
187  fGeantinoOpeningAngleMin->AvailableForStates(G4State_Idle);
188 
189  fGeantinoZOrigin = new G4UIcmdWithADoubleAndUnit("/LBNE/primary/geantinoZOrigin",this);
190  fGeantinoZOrigin->SetGuidance("Z origin generating the geantino (or mu geantino) (in mm) ");
191  fGeantinoZOrigin->SetParameterName("GeantinoOpeningAngle",true);
192  fGeantinoZOrigin->SetDefaultValue (-515.);
193  fGeantinoZOrigin->SetDefaultUnit ("mm");
194  fGeantinoZOrigin->SetUnitCandidates ("mm cm m");
195  fGeantinoZOrigin->AvailableForStates(G4State_Idle);
196 
198  new G4UIcmdWithADoubleAndUnit("/LBNE/primary/geantinoSigmaZOrigin",this);
199  fGeantinoZOriginSigma->SetGuidance("Z origin longitudinal spread generating the geantino (or mu geantino) (in mm) ");
200  fGeantinoZOriginSigma->SetParameterName("GeantinoSigmaZOrigin",true);
201  fGeantinoZOriginSigma->SetDefaultValue (100.);
202  fGeantinoZOriginSigma->SetDefaultUnit ("mm");
203  fGeantinoZOriginSigma->SetUnitCandidates ("mm cm m");
204  fGeantinoZOriginSigma->AvailableForStates(G4State_Idle);
205 
207  new G4UIcmdWith3VectorAndUnit("/LBNE/primary/mugeantinoScanZOrigin",this);
208  fMuGeantinoZOriginScan->SetGuidance("Z Scan on the origin of the neutrino ");
209  fMuGeantinoZOriginScan->SetParameterName("mugeantinoScanZOriginInit", "mugeantinoScanZOriginStep", "mugeantinoScanZOriginFlag", true);
210  fMuGeantinoZOriginScan->SetDefaultValue (G4ThreeVector(0., 0.000, 0.)); // Z start, z Step, flag (0 = no, 1 = scan )
211  fMuGeantinoZOriginScan->SetDefaultUnit ("mm");
212  fMuGeantinoZOriginScan->SetUnitCandidates ("mm cm m");
213  fMuGeantinoZOriginScan->AvailableForStates(G4State_Idle);
214 
216  new G4UIcmdWith3VectorAndUnit("/LBNE/primary/mugeantinoScanAngle",this);
217  fMuGeantinoAngleScan->SetGuidance("Angle Scan on the origin of the neutrino "); // in Y, actually..
218  fMuGeantinoAngleScan->SetParameterName("mugeantinoScanAlngleInit", "mugeantinoScanAlngleStep", "mugeantinoScanAlngleFlag", true);
219  fMuGeantinoAngleScan->SetDefaultValue (G4ThreeVector(0.01, 0.0001, 0.)); //
220  fMuGeantinoAngleScan->SetDefaultUnit ("radian");
221  fMuGeantinoAngleScan->SetUnitCandidates ("radian");
222  fMuGeantinoAngleScan->AvailableForStates(G4State_Idle);
223 
225  new G4UIcmdWith3VectorAndUnit("/LBNE/primary/mugeantinoScanMomentum",this);
226  fMuGeantinoMomentumScan->SetGuidance("Momentum Scan on the origin of the neutrino ");
227  fMuGeantinoMomentumScan->SetParameterName("mugeantinoScanMomentumInit", "mugeantinoScanMomentumStep","mugeantinoScanMomentumFlag", true);
228  fMuGeantinoMomentumScan->SetDefaultValue (G4ThreeVector(10., 0.000, 0.)); // Z start, z Step, flag (0 = no, 1 = scan )
229  fMuGeantinoMomentumScan->SetDefaultUnit ("GeV");
230  fMuGeantinoMomentumScan->SetUnitCandidates ("MeV GeV");
231  fMuGeantinoMomentumScan->AvailableForStates(G4State_Idle);
232 
234  new G4UIcmdWith3VectorAndUnit("/LBNE/primary/mugeantinoScanPt",this);
235  fMuGeantinoPtScan->SetGuidance("Pt Scan on the origin of the neutrino ");
236  fMuGeantinoPtScan->SetParameterName("mugeantinoScanPtInit", "mugeantinoScanPtStep","mugeantinoScanPtFlag", true);
237  fMuGeantinoPtScan->SetDefaultValue (G4ThreeVector(10., 0.000, 0.)); // Z start, z Step, flag (0 = no, 1 = scan )
238  fMuGeantinoPtScan->SetDefaultUnit ("GeV");
239  fMuGeantinoPtScan->SetUnitCandidates ("MeV GeV");
240  fMuGeantinoPtScan->AvailableForStates(G4State_Idle);
241 
243  new G4UIcmdWith3VectorAndUnit("/LBNE/primary/mugeantinoScanYOrigin",this);
244  fMuGeantinoYOriginScan->SetGuidance("Y Scan on the origin of the neutrino ");
245  fMuGeantinoYOriginScan->SetParameterName("mugeantinoScanZOriginInit", "mugeantinoScanZOriginStep","mugeantinoScanZOriginFlag", true);
246  fMuGeantinoYOriginScan->SetDefaultValue (G4ThreeVector(0., 0.000, 0.)); // Z start, z Step, flag (0 = no, 1 = scan )
247  fMuGeantinoYOriginScan->SetDefaultUnit ("mm");
248  fMuGeantinoYOriginScan->SetUnitCandidates ("mm cm m");
249  fMuGeantinoYOriginScan->AvailableForStates(G4State_Idle);
250 
251  fInputFlukaFileName = new G4UIcmdWithAString("/LBNE/run/InputFlukaFileName",this);
252  std::string aGuideFluka("Set the input fluka ntuple file name. \n");
253  aGuideFluka += std::string("Proton beam will be off, we will generate hadrons from Fluka file \n");
254  aGuideFluka += std::string("Note: No checks are done on the consistency of Fluka vs this Geant geometry \n");
255  fInputFlukaFileName->SetGuidance(aGuideFluka.c_str());
256  fInputFlukaFileName->SetParameterName("extNtupleFileName",true);
257  fInputFlukaFileName->SetDefaultValue (G4String("none"));
258  fInputFlukaFileName->AvailableForStates(G4State_PreInit,G4State_Idle);
259 
260 }
261 
263 {
264  delete fBeamOffsetXCmd;
265  delete fBeamOffsetYCmd;
266  delete fBeamSigmaXCmd;
267  delete fBeamSigmaYCmd;
268  delete fBeamMaxValXCmd;
269  delete fBeamMaxValYCmd;
270  delete fBeamPhiCmd;
271  delete fBeamThetaCmd;
272  delete fCorrectForAngleCmd;
273  delete fBeamOnTargetCmd;
274  delete fDirectory;
275  delete fUseGeantino;
276  delete fProtonMomentum;
277  delete fUseMuonGeantino;
278  delete fUseChargedGeantino;
279  delete fGeantinoOpeningAngle;
280  delete fGeantinoZOrigin;
281  delete fGeantinoZOriginSigma;
282  delete fMuGeantinoZOriginScan;
283  delete fMuGeantinoAngleScan;
284  delete fMuGeantinoMomentumScan;
285  delete fMuGeantinoPtScan;
286  delete fMuGeantinoYOriginScan;
287  delete fInputFlukaFileName;
288 
289 }
290 
291 void LBNEPrimaryMessenger::SetNewValue(G4UIcommand* cmd, G4String val)
292 {
293  LBNERunManager* theRunManager = dynamic_cast<LBNERunManager*>(G4RunManager::GetRunManager());
294 
295  if(theRunManager->GetVerboseLevel() > 1)
296  {
297  G4cout << "LBNEPrimaryMessenger::SetNewValue - Setting Parameter value from input macro." << G4endl;
298  }
299 
300 
301  if(theRunManager->GetVerboseLevel() > 1)
302  {
303  G4cout << "LBNEPrimaryMessenger::SetNewValue - Done Setting parameter value." << G4endl;
304  }
305 
306  if(cmd == fBeamOffsetXCmd){
307  fPrimaryAction->SetBeamOffsetX(fBeamOffsetXCmd->GetNewDoubleValue(val));
309  }
310  if(cmd == fBeamOffsetYCmd){
311  fPrimaryAction->SetBeamOffsetY(fBeamOffsetYCmd->GetNewDoubleValue(val));
313  }
314  if(cmd == fBeamSigmaXCmd){
315  fPrimaryAction->SetBeamSigmaX(fBeamSigmaXCmd->GetNewDoubleValue(val));
319  }
320  if(cmd == fBeamSigmaYCmd){
321  fPrimaryAction->SetBeamSigmaY(fBeamSigmaYCmd->GetNewDoubleValue(val));
325  }
326  if(cmd == fBeamMaxValXCmd){
327  fPrimaryAction->SetBeamMaxValX(fBeamMaxValXCmd->GetNewDoubleValue(val));
329  }
330  if(cmd == fBeamMaxValYCmd){
331  fPrimaryAction->SetBeamMaxValY(fBeamMaxValYCmd->GetNewDoubleValue(val));
333  }
334  if(cmd == fBeamThetaCmd){
335  fPrimaryAction->SetBeamTheta(fBeamThetaCmd->GetNewDoubleValue(val));
337  }
338  if(cmd == fBeamPhiCmd){
339  fPrimaryAction->SetBeamPhi(fBeamPhiCmd->GetNewDoubleValue(val));
341  }
342  if(cmd == fCorrectForAngleCmd){
343  fPrimaryAction->SetCorrectForAngle(fCorrectForAngleCmd->GetNewBoolValue(val));
345  }
346  if(cmd == fBeamOnTargetCmd){
347  fPrimaryAction->SetBeamOnTarget(fBeamOnTargetCmd->GetNewBoolValue(val));
349  }
350  if (cmd == fGeantinoOpeningAngle) {
351  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
352  fPrimaryAction->SetPolarAngleGeantino(cmdWD->GetNewDoubleValue(val));
353  } else if (cmd == fGeantinoZOrigin ) {
354  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
355  fPrimaryAction->SetZOriginGeantino( cmdWD->GetNewDoubleValue(val));
356  } else if (cmd == fGeantinoOpeningAngleMin ) {
357  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
358  fPrimaryAction->SetPolarAngleGeantinoMin(cmdWD->GetNewDoubleValue(val));
359  } else if (cmd == fGeantinoZOriginSigma ) {
360  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
361  fPrimaryAction->SetSigmaZOriginGeantino( cmdWD->GetNewDoubleValue(val));
362  } else if (cmd == fMuGeantinoZOriginScan ) {
363  G4UIcmdWith3VectorAndUnit* cmdWD = dynamic_cast<G4UIcmdWith3VectorAndUnit*> (cmd);
364  fPrimaryAction->SetZOriginForMuGeantinoScan( cmdWD->GetNew3VectorValue(val));
365  } else if (cmd == fMuGeantinoMomentumScan ) {
366  G4UIcmdWith3VectorAndUnit* cmdWD = dynamic_cast<G4UIcmdWith3VectorAndUnit*> (cmd);
367  fPrimaryAction->SetMomentumForMuGeantinoScan( cmdWD->GetNew3VectorValue(val));
368  } else if (cmd == fMuGeantinoPtScan ) {
369  G4UIcmdWith3VectorAndUnit* cmdWD = dynamic_cast<G4UIcmdWith3VectorAndUnit*> (cmd);
370  fPrimaryAction->SetPtForMuGeantinoScan( cmdWD->GetNew3VectorValue(val));
371  } else if (cmd == fMuGeantinoAngleScan ) {
372  G4UIcmdWith3VectorAndUnit* cmdWD = dynamic_cast<G4UIcmdWith3VectorAndUnit*> (cmd);
373  fPrimaryAction->SetAngleForMuGeantinoScan( cmdWD->GetNew3VectorValue(val));
374  } else if (cmd == fMuGeantinoYOriginScan ) {
375  G4UIcmdWith3VectorAndUnit* cmdWD = dynamic_cast<G4UIcmdWith3VectorAndUnit*> (cmd);
376  fPrimaryAction->SetYOriginForMuGeantinoScan( cmdWD->GetNew3VectorValue(val));
377  } else if (cmd == fUseGeantino ) {
379  G4Exception("LBNEPrimaryMessenger", "Inconsistency in particle choice ", FatalException,
380  "Can't use both a muon geantino, and a geantino ");
381  }
383  } else if (cmd == fUseMuonGeantino ) {
385  G4Exception("LBNEPrimaryMessenger", "Inconsistency in particle choice ", FatalException,
386  "Can't use both a muon (or charged) geantino, and a geantino ");
387  }
389  } else if (cmd == fUseChargedGeantino ) {
391  G4Exception("LBNEPrimaryMessenger", "Inconsistency in particle choice ", FatalException,
392  "Can't use both a geantino or a muon geantino, and a Charged geantino ");
393  }
395  } else if (cmd == fProtonMomentum ) {
396  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
397  const double pz = cmdWD->GetNewDoubleValue(val);
398  if (std::abs(pz - 120.0) > 0.1) {
399  std::string msg("With the current 1.2 MW option, and Proton Momentum != 120 GeV, \n");
400  msg += std::string("The calculation of the beam spot size is unreliable. \n");
401  msg += std::string("The user must set beam signa X and sigma Y explicitely via cmd /LBNE/generator/beamSigmaX (Y) ");
402  G4Exception("LBNEPrimaryMessenger", "", JustWarning, msg.c_str());
403  }
404  //
405  //Valid only for 1.2 MW option !!!
406  //
410 
411 // fPrimaryAction->SetProtonBeam();
412 // double bf = (std::abs(pz - 120.0) < 0.1) ?
413 // 110.9 :
414 // fPrimaryAction->GetBetaFunctionvsBeamEnergy(pz);
415 // fPrimaryAction->SetBeamBetaFunctionX(bf);
416 // fPrimaryAction->SetBeamBetaFunctionY(bf);
417 // fPrimaryAction->SetProtonBeam();
418  }
419 
420  else if (cmd == fBeamBetaFunctionX ) {
421  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
422  fPrimaryAction->SetBeamBetaFunctionX(cmdWD->GetNewDoubleValue(val));
425  }
426  else if (cmd == fBeamBetaFunctionY ) {
427  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
428  fPrimaryAction->SetBeamBetaFunctionY(cmdWD->GetNewDoubleValue(val));
431  }
432  else if (cmd == fBeamEmittanceX ) {
433  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
434  fPrimaryAction->SetBeamEmittanceX(cmdWD->GetNewDoubleValue(val));
437  }
438  else if (cmd == fBeamEmittanceY ) {
439  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
440  fPrimaryAction->SetBeamEmittanceY(cmdWD->GetNewDoubleValue(val));
443  }
444  else if (cmd == fInputFlukaFileName)
445  {
446  fPrimaryAction->OpenNtupleFLUKAASCII(val.c_str());
447  }
448  else if (cmd == fRadiusAnnularBeam ) {
449  G4UIcmdWithADoubleAndUnit* cmdWD = dynamic_cast<G4UIcmdWithADoubleAndUnit*> (cmd);
450  fPrimaryAction->SetRadiusAnnularBeam(cmdWD->GetNewDoubleValue(val));
451  }
452 
453 }
454 
G4UIcmdWithADoubleAndUnit * fGeantinoZOrigin
G4UIcmdWithADoubleAndUnit * fProtonMomentum
G4bool OpenNtupleFLUKAASCII(G4String ntupleName)
G4UIcmdWith3VectorAndUnit * fMuGeantinoZOriginScan
G4UIcmdWithoutParameter * fUseGeantino
G4UIcmdWithADoubleAndUnit * fBeamMaxValYCmd
LBNEPrimaryMessenger(LBNEPrimaryGeneratorAction *)
void msg(const char *fmt,...)
Definition: message.cpp:107
G4UIcmdWithADoubleAndUnit * fBeamBetaFunctionX
G4UIcmdWithADoubleAndUnit * fBeamSigmaXCmd
std::string string
Definition: nybbler.cc:12
void SetYOriginForMuGeantinoScan(G4ThreeVector v)
LBNEPrimaryGeneratorAction * fPrimaryAction
void SetPtForMuGeantinoScan(G4ThreeVector v)
G4UIcmdWithoutParameter * fUseMuonGeantino
G4UIcmdWith3VectorAndUnit * fMuGeantinoMomentumScan
void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithADoubleAndUnit * fRadiusAnnularBeam
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:45
G4UIcmdWith3VectorAndUnit * fMuGeantinoYOriginScan
G4UIcmdWithADoubleAndUnit * fBeamSigmaYCmd
G4UIcmdWithADoubleAndUnit * fGeantinoOpeningAngle
void SetAngleForMuGeantinoScan(G4ThreeVector v)
G4UIcmdWith3VectorAndUnit * fMuGeantinoPtScan
G4UIcmdWithADoubleAndUnit * fBeamMaxValXCmd
T abs(T value)
G4UIcmdWithABool * fCorrectForAngleCmd
G4UIcmdWithABool * fBeamOnTargetCmd
void SetMomentumForMuGeantinoScan(G4ThreeVector v)
G4UIcmdWithADoubleAndUnit * fBeamBetaFunctionY
G4UIcmdWithADoubleAndUnit * fBeamEmittanceX
G4UIcmdWithADoubleAndUnit * fGeantinoZOriginSigma
G4UIcmdWithADoubleAndUnit * fBeamOffsetYCmd
G4UIcmdWithADoubleAndUnit * fBeamEmittanceY
G4UIcmdWithADoubleAndUnit * fBeamPhiCmd
G4UIcmdWith3VectorAndUnit * fMuGeantinoAngleScan
int GetVerboseLevel() const
void SetZOriginForMuGeantinoScan(G4ThreeVector v)
list cmd
Definition: getreco.py:22
G4UIcmdWithAString * fInputFlukaFileName
G4UIcmdWithoutParameter * fUseChargedGeantino
G4UIcmdWithADoubleAndUnit * fGeantinoOpeningAngleMin
G4UIcmdWithADoubleAndUnit * fBeamThetaCmd
G4UIcmdWithADoubleAndUnit * fBeamOffsetXCmd