1 #ifndef MACRO_G4HFARBWDBEAMLINE_EIC_C
2 #define MACRO_G4HFARBWDBEAMLINE_EIC_C
11 #include <eicg4zdc/EICG4ZDCHitTree.h>
12 #include <eicg4zdc/EICG4ZDCNtuple.h>
13 #include <eicg4zdc/EICG4ZDCSubsystem.h>
15 #include <eicg4lumi/EICG4LumiSubsystem.h>
42 namespace hFarBwdBeamLine
64 cout <<
"You cannot have magnets for both IP6 and IP8 ON at the same time" << endl;
119 magFile = string(getenv(
"CALIBRATIONROOT")) +
"/Beam/ip6_h_farBwdBeamLineMagnets.dat";
122 magFile = string(getenv(
"CALIBRATIONROOT")) +
"/Beam/ip8_35mrad_h_farBwdBeamLineMagnets.dat";
126 cout <<
" You have to enable either the IP6 or IP8 Magnet configuration to define magnets! " << endl;
132 bool magnet_active =
true;
134 int absorberactive = 0;
141 std::ifstream infile(magFile);
142 if (infile.is_open())
144 double biggest_z = 0.;
147 while (std::getline(infile, line))
149 if (!line.compare(0, 3,
"eDB") ||
150 !line.compare(0, 2,
"eQ") ||
151 !line.compare(0, 2,
"eS"))
153 std::istringstream iss(line);
158 double inner_radius_zin;
159 double inner_radius_zout;
160 double outer_magnet_diameter;
163 double dipole_field_x;
164 double fieldgradient;
165 if (!(iss >> magname >> x >> y >> z >> inner_radius_zin >> inner_radius_zout >> outer_magnet_diameter >> length >> angle >> dipole_field_x >> fieldgradient))
167 cout <<
"coud not decode " << line << endl;
178 if (inner_radius_zin != inner_radius_zout)
180 cout <<
"inner radius at front of magnet " << inner_radius_zin
181 <<
" not equal radius at back of magnet " << inner_radius_zout
182 <<
" needs change in code (replace tube by cone for beamline)" << endl;
189 <<
"\tID number " << imagnet << endl;
190 cout <<
"magname: " << magname << endl;
191 cout <<
"x: " << x << endl;
192 cout <<
"y: " << y << endl;
193 cout <<
"z: " << z << endl;
194 cout <<
"inner_radius_zin: " << inner_radius_zin << endl;
195 cout <<
"inner_radius_zout: " << inner_radius_zout << endl;
196 cout <<
"outer_magnet_diameter: " << outer_magnet_diameter << endl;
197 cout <<
"length: " << length << endl;
198 cout <<
"angle: " << angle << endl;
199 cout <<
"dipole_field_x: " << dipole_field_x << endl;
200 cout <<
"fieldgradient: " << fieldgradient << endl;
202 if (!magname.compare(0, 3,
"eDB"))
206 else if (!magname.compare(0, 2,
"eQ"))
208 magtype =
"QUADRUPOLE";
210 else if (!magname.compare(0, 2,
"eS"))
212 magtype =
"SEXTUPOLE";
216 cout <<
"cannot decode magnet name " << magname << endl;
224 inner_radius_zin *= 100.;
225 outer_magnet_diameter *= 100.;
226 angle = (angle / TMath::Pi() * 180.) / 1000.;
232 dipole_field_x = dipole_field_x*scaleFactor;
233 fieldgradient = fieldgradient * scaleFactor;
236 if (magnetlist.empty() || magnetlist.find(imagnet) != magnetlist.end())
272 if (fabs(z) + length > biggest_z)
274 biggest_z = fabs(z) +
length;
327 cout <<
"You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl;
417 string paramFileLumi = string(getenv(
"CALIBRATIONROOT")) +
"/LumiMonAndTaggers/LumiMon.dat";
420 LumiDet->SetParametersFromFile( paramFileLumi );
421 LumiDet->OverlapCheck( overlapCheck );
424 LumiDet->SetActive(
true );
425 if( verbosity ) { LumiDet->Verbosity( verbosity ); }
556 cout <<
"You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl;
563 detBackward->SuperDetector(
"backTruth");
564 detBackward->set_double_param(
"place_x", 0);
565 detBackward->set_double_param(
"place_y", 0);
568 detBackward->set_double_param(
"rot_y", 0);
569 detBackward->set_double_param(
"radius", 0);
570 detBackward->set_double_param(
"thickness", 30);
571 detBackward->set_double_param(
"length", 0.03);
572 detBackward->set_string_param(
"material",
"G4_Si");
576 detBackward->SetActive();
577 detBackward->OverlapCheck(overlapCheck);
578 detBackward->set_color(1, 0, 0, 0.5);
580 detBackward->BlackHole();
581 if (verbosity) detBackward->Verbosity(verbosity);