55#include " A2DetectorConstruction.hh"
66#include " A2FileGeneratorMkin.hh"
77#include " A2FileGeneratorPluto.hh"
8+ #include " A2FileGeneratorGiBUU.hh"
89
910#include " G4ParticleGun.hh"
1011#include " Randomize.hh"
@@ -109,7 +110,8 @@ void A2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
109110 {
110111 // generate vertex for pluto input
111112 if (fFileGen ->GetType () == A2FileGenerator::kPluto ||
112- fFileGen ->GetType () == A2FileGenerator::kPlutoCocktail )
113+ fFileGen ->GetType () == A2FileGenerator::kPlutoCocktail ||
114+ fFileGen ->GetType () == A2FileGenerator::kGiBUU )
113115 {
114116 fFileGen ->GenerateVertexCylinder (fDetCon ->GetTarget ()->GetLength (),
115117 fDetCon ->GetTarget ()->GetCenter ().z (),
@@ -125,7 +127,9 @@ void A2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
125127 //
126128
127129 // check for first event
128- if (fNevent == 0 && fFileGen ->GetType () != A2FileGenerator::kPlutoCocktail )
130+ if (fNevent == 0 &&
131+ fFileGen ->GetType () != A2FileGenerator::kPlutoCocktail &&
132+ fFileGen ->GetType () != A2FileGenerator::kGiBUU )
129133 {
130134 for (G4int i = 0 ; i < fFileGen ->GetNParticles (); i++)
131135 {
@@ -349,10 +353,12 @@ void A2PrimaryGeneratorAction::SetUpFileInput(){
349353 TFile* ftest = new TFile (fInFileName );
350354 TTree* tree_mkin = 0 ;
351355 TTree* tree_pluto = 0 ;
356+ TTree* tree_gibuu = 0 ;
352357 if (ftest && !ftest->IsZombie ())
353358 {
354359 tree_mkin = (TTree*)ftest->Get (" h1" );
355360 tree_pluto = (TTree*)ftest->Get (" data" );
361+ tree_gibuu = (TTree*)ftest->Get (" RootTuple" );
356362 delete ftest;
357363 }
358364 else
@@ -375,6 +381,10 @@ void A2PrimaryGeneratorAction::SetUpFileInput(){
375381 exit (1 );
376382#endif
377383 }
384+ else if (tree_gibuu)
385+ {
386+ fFileGen = new A2FileGeneratorGiBUU (fInFileName );
387+ }
378388 else
379389 {
380390 G4cout << " A2PrimaryGeneratorAction::SetUpFileInput(): ROOT event-tree format is not supported!" << G4endl;
@@ -391,6 +401,8 @@ void A2PrimaryGeneratorAction::SetUpFileInput(){
391401 G4cout << " A2PrimaryGeneratorAction::SetUpFileInput(): Opening Pluto single-event file" << G4endl;
392402 else if (fFileGen ->GetType () == A2FileGenerator::kPlutoCocktail )
393403 G4cout << " A2PrimaryGeneratorAction::SetUpFileInput(): Opening Pluto cocktail-event file" << G4endl;
404+ else if (fFileGen ->GetType () == A2FileGenerator::kGiBUU )
405+ G4cout << " A2PrimaryGeneratorAction::SetUpFileInput(): Opening GiBUU-event file" << G4endl;
394406
395407 // create data structures for generated particles
396408 fNGenMaxParticles = fFileGen ->GetMaxParticles ();
@@ -408,7 +420,7 @@ void A2PrimaryGeneratorAction::SetUpFileInput(){
408420 }
409421 else
410422 {
411- if (fFileGen ->GetType () == A2FileGenerator::kPlutoCocktail )
423+ if (fFileGen ->GetType () == A2FileGenerator::kPlutoCocktail || fFileGen -> GetType () == A2FileGenerator:: kGiBUU )
412424 {
413425 G4cout << " A2PrimaryGeneratorAction::SetUpFileInput(): Particle tracking should not be specified if input is Pluto cocktail!" << G4endl;
414426 exit (1 );
@@ -419,11 +431,13 @@ void A2PrimaryGeneratorAction::SetUpFileInput(){
419431 G4cout<<" A2PrimaryGeneratorAction::SetUpFileInput(): Mismatch between number of tracked particles and particles marked for tracking!" <<G4endl;
420432 exit (1 );
421433 }
422- if (fFileGen ->GetType () == A2FileGenerator::kPluto || fFileGen ->GetType () == A2FileGenerator::kPlutoCocktail )
434+ if (fFileGen ->GetType () == A2FileGenerator::kPluto ||
435+ fFileGen ->GetType () == A2FileGenerator::kPlutoCocktail ||
436+ fFileGen ->GetType () == A2FileGenerator::kGiBUU )
423437 {
424438 if (fBeamDiameter == 0 )
425439 {
426- G4cout << " A2PrimaryGeneratorAction::SetUpFileInput(): Pluto-input requires a beam diameter set via /A2/generator/SetBeamDiameter" << G4endl;
440+ G4cout << " A2PrimaryGeneratorAction::SetUpFileInput(): Pluto/GiBUU -input requires a beam diameter set via /A2/generator/SetBeamDiameter" << G4endl;
427441 exit (1 );
428442 }
429443 }
0 commit comments