Skip to content

Commit

Permalink
Fix the eA beam loading scattering parameter (#105)
Browse files Browse the repository at this point in the history
* Flipped IP6 Far Forward detector stacks, include position, angle and field

* flip crossing sign in HepMC event gen

* flip crossing sign in beam chambers

* before merging

* Added the far backward region into Fun4all

* Fixed a few issues suggested by Jin

* Implemented the designed IP8 detector location

* Extended the farbackward vaccum enclosure to include maximum path

* fix overlap of world vol.

* Updated IP6 detector location, and unflipped the x coord, angle, and field

* Added the far forward evaluator

* Adding FFR evaluator

* void

* Updated the IP8 configuration and main macro to include forward Eval

* Fixed IP8 changes which were not merge into the master

* Added the virtual detector in the farbackward region

* Added the B0 detector models in the Fun4all
There are three choices:
1. Real detector stack
2. Disk plane to help occupancy study
3. Hit planes replicating the real detector goemetry

* Added the B0 detector

* Fixed the issue for gradient field not scaling

* Setting Forward/backward enclosure and magnets to active

* Fixed B0 Orientiion for IP6 and IP8; IP8 1st RP with 5cm radius hole

* Improved B0 geometry based on Sasha's suggestion

* Reformatted G4_hFarFwdBeamLine_EIC.C style

* Adding the RP implementation to the macro for IP6 and IP8

* merge

* Corrected RP2nd option

* default

* before merging

* Added the Far Backward Magnets and Detectors

* Adding Far Backward detectors and magnets

* Adding far backward magnets and detectors

* Adding Beam scattering parameterization from the CDR

* Adding IP8 backward beamline

* Adding fixes to the ep and eA beam

* Small changes

Co-authored-by: Jin Huang <jhuang@bnl.gov>
Co-authored-by: cdean-github <cameron.dean@cern.ch>
Co-authored-by: cdean-github <59485912+cdean-github@users.noreply.github.com>
  • Loading branch information
4 people authored Feb 28, 2022
1 parent e566f0f commit 56c8259
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 60 deletions.
146 changes: 88 additions & 58 deletions common/G4_Input.C
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ namespace Input

// ---------------------------------------

// cout << Enable::HFARFWD_ION_ENERGY << " " << Enable::HFARBWD_E_ENERGY << endl;

cout << Enable::HFARFWD_ION_ENERGY << " " << Enable::HFARBWD_E_ENERGY << endl;
float ION_Energy = Enable::HFARFWD_ION_ENERGY;
float ELECTRON_Energy = Enable::HFARBWD_E_ENERGY;

TString beam_setting_str;
beam_setting_str.Form("%.0fx%.0f", Enable::HFARFWD_ION_ENERGY, Enable::HFARBWD_E_ENERGY);
beam_setting_str.Form("%.0fx%.0f", ION_Energy, ELECTRON_Energy);

cout << "Beam scattering setting: " << beam_setting_str << endl;

Expand Down Expand Up @@ -170,71 +172,99 @@ namespace Input

bool setting_found = false;

float ION_Energy_Setting = 275;
float ION_Energy_Setting_diff = 275;

std::ifstream infile(beamFile);

if (infile.is_open())
{
double biggest_z = 0.;
int imagnet = 0;
std::string line;
while (std::getline(infile, line))
if (infile.is_open())
{

// if (!line.compare(0, 1, "#")) {
if (line.find("#")!=std::string::npos) {
continue;
}

std::istringstream iss(line);

if (!(iss >> settingname >> beta_star_p_h >> beta_star_p_v >> beta_star_e_h >> beta_star_e_v >> emit_p_h >> emit_p_v >> emit_e_h >> emit_e_v >> beam_angular_divergence_p_h >> beam_angular_divergence_p_v >> beam_angular_divergence_e_h >> beam_angular_divergence_e_v >> sigma_p_l >> sigma_e_l))
{
cout << "could not decode " << line << endl;
gSystem->Exit(1);

} else {
//
cout << line << endl;
///
if (settingname==beam_setting_str) {
// if (settingname=="275x18") {
// if (settingname=="41x5") {

cout << beta_star_p_h << " "<< beta_star_p_v << endl;
cout << "BBBbBBBB" << endl;

setting_found = true;

break;
}

}

// cout << "Could not find the specifed beam collision energy setting setting!" << endl;
// gSystem->Exit(1);

}

infile.close();

}

double biggest_z = 0.;
int imagnet = 0;
std::string line;
while (std::getline(infile, line))
{

if (line.find("#")!=std::string::npos) {
continue;
}

std::istringstream iss(line);

if (!(iss >> settingname >> beta_star_p_h >> beta_star_p_v >> beta_star_e_h >> beta_star_e_v >> emit_p_h >> emit_p_v >> emit_e_h >> emit_e_v >> beam_angular_divergence_p_h >> beam_angular_divergence_p_v >> beam_angular_divergence_e_h >> beam_angular_divergence_e_v >> sigma_p_l >> sigma_e_l))
{
cout << "could not decode " << line << endl;
gSystem->Exit(1);

} else {

cout << line << endl;

if (settingname==beam_setting_str) {
setting_found = true;
}

// cout << "aaaaaa "<< settingname.find("x") << " " << settingname.substr(0, settingname.find("x")) << endl;

float hadron_setting = stof(settingname.substr(0, settingname.find("x")));

// cout << hadron_setting - ION_Energy << endl;

if (fabs(hadron_setting - ION_Energy) < ION_Energy_Setting_diff ) {
ION_Energy_Setting = hadron_setting;
ION_Energy_Setting_diff = fabs(hadron_setting - ION_Energy);
}
}
}

// Reseting the pointer to the infile
infile.clear();
infile.seekg(0,std::ios::beg);
// cout << infile.getline() << endl;;

if(!setting_found) {
beam_setting_str.Form("%.0fx%.0f", ION_Energy_Setting, ELECTRON_Energy);
}

while (std::getline(infile, line))
{

if (line.find("#")!=std::string::npos) {
continue;
}

std::istringstream iss(line);

if (!(iss >> settingname >> beta_star_p_h >> beta_star_p_v >> beta_star_e_h >> beta_star_e_v >> emit_p_h >> emit_p_v >> emit_e_h >> emit_e_v >> beam_angular_divergence_p_h >> beam_angular_divergence_p_v >> beam_angular_divergence_e_h >> beam_angular_divergence_e_v >> sigma_p_l >> sigma_e_l))
{
cout << "could not decode " << line << endl;
gSystem->Exit(1);

} else {

cout << line << endl;

if (settingname == beam_setting_str) {

// cout << beta_star_p_h << " "<< beta_star_p_v << endl;
// cout << "BBBbBBBB" << endl;

setting_found = true;

break;
}

}
}

infile.close();
}

if (!setting_found) {

cout << "Could not find the specifed beam collision energy setting setting!" << endl;
cout << "Could not find the specifed beam collision energy setting!" << endl;
gSystem->Exit(1);

}


cout << "AAAA" << endl;

cout << beta_star_p_h << " " << beta_star_p_v << " "<< beta_star_e_h << " " << beta_star_e_v << endl;

cout << "-----------------------------" << endl;

// ---------------------------------------

HepMCGen->PHHepMCGenHelper_Verbosity(VERBOSITY);
Expand Down
22 changes: 20 additions & 2 deletions detectors/EICDetector/Fun4All_G4_EICDetector.C
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int Fun4All_G4_EICDetector(
// switching IPs by comment/uncommenting the following lines
// used for both beamline setting and for the event generator crossing boost
Enable::IP6 = true;
// Enable::IP8 = true;
//Enable::IP8 = true;


//===============
Expand Down Expand Up @@ -138,6 +138,9 @@ int Fun4All_G4_EICDetector(
// Input::GUN_NUMBER = 3; // if you need 3 of them
// Input::GUN_VERBOSITY = 0;

// Particle ion gun
// Input::IONGUN = true;

// Upsilon generator
// Input::UPSILON = true;
// Input::UPSILON_NUMBER = 3; // if you need 3 of them
Expand Down Expand Up @@ -210,6 +213,20 @@ int Fun4All_G4_EICDetector(
INPUTGENERATOR::Gun[0]->AddParticle("pi-", 0, 1, 0);
INPUTGENERATOR::Gun[0]->set_vtx(0, 0, 0);
}

if (Input::IONGUN)
{
float theta = -25e-3;

INPUTGENERATOR::IonGun[0]->SetA(197);
INPUTGENERATOR::IonGun[0]->SetZ(79);
INPUTGENERATOR::IonGun[0]->SetCharge(79);
INPUTGENERATOR::IonGun[0]->SetMom(sin(theta)*110*197, 0,cos(theta)*110*197); // -25 mrad

INPUTGENERATOR::IonGun[0]->Print();

}

// pythia6
if (Input::PYTHIA6)
{
Expand Down Expand Up @@ -278,7 +295,7 @@ int Fun4All_G4_EICDetector(
// Enable::DSTREADER = true;

// turn the display on (default off)
// Enable::DISPLAY = true;
// Enable::DISPLAY = true;

//======================
// What to run
Expand Down Expand Up @@ -488,6 +505,7 @@ int Fun4All_G4_EICDetector(
//---------------
// G4WORLD::PhysicsList = "FTFP_BERT"; //FTFP_BERT_HP best for calo
// G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans
// G4WORLD::WorldMaterial = "G4_Galactic"; // set to G4_GALACTIC for material scans

//---------------
// Magnet Settings
Expand Down

0 comments on commit 56c8259

Please sign in to comment.