1 #ifndef MACRO_G4HFARFWDBEAMLINE_EIC_C
2 #define MACRO_G4HFARFWDBEAMLINE_EIC_C
11 #include <eicg4zdc/EICG4ZDCHitTree.h>
12 #include <eicg4zdc/EICG4ZDCNtuple.h>
13 #include <eicg4zdc/EICG4ZDCSubsystem.h>
15 #include <eicg4b0/EICG4B0Subsystem.h>
16 #include <eicg4b0ecal/EICG4B0ECALSubsystem.h>
17 #include <eicg4rp/EICG4RPSubsystem.h>
19 #include <eiceval/FarForwardEvaluator.h>
65 namespace hFarFwdBeamLine
90 cout <<
"You cannot have magnets for both IP6 and IP8 ON at the same time" << endl;
138 magFile = string(getenv(
"CALIBRATIONROOT")) +
"/Beam/ip6_h_farFwdBeamLineMagnets_v2.0.dat";
140 magFile = string(getenv(
"CALIBRATIONROOT")) +
"/Beam/ip8_35mrad_h_farFwdBeamLineMagnets.dat";
143 cout <<
" You have to enable either the IP6 or IP8 Magnet configuration to define magnets! " << endl;
148 bool magnet_active =
true;
149 int absorberactive = 0;
156 std::ifstream infile(magFile);
157 if (infile.is_open())
159 double biggest_z = 0.;
162 while (std::getline(infile, line))
164 if (!line.compare(0, 1,
"B") ||
165 !line.compare(0, 1,
"Q") ||
166 !line.compare(0, 1,
"S"))
168 std::istringstream iss(line);
173 double inner_radius_zin;
174 double inner_radius_zout;
175 double outer_magnet_diameter;
178 double dipole_field_x;
179 double fieldgradient;
180 if (!(iss >> magname >> x >> y >> z >> inner_radius_zin >> inner_radius_zout >> outer_magnet_diameter >> length >> angle >> dipole_field_x >> fieldgradient))
182 cout <<
"could not decode " << line << endl;
193 if (inner_radius_zin != inner_radius_zout)
195 cout <<
"inner radius at front of magnet " << inner_radius_zin
196 <<
" not equal radius at back of magnet " << inner_radius_zout
197 <<
" needs change in code (replace tube by cone for beamline)" << endl;
204 <<
"\tID number " << imagnet << endl;
205 cout <<
"magname: " << magname << endl;
206 cout <<
"x: " << x << endl;
207 cout <<
"y: " << y << endl;
208 cout <<
"z: " << z << endl;
209 cout <<
"inner_radius_zin: " << inner_radius_zin << endl;
210 cout <<
"inner_radius_zout: " << inner_radius_zout << endl;
211 cout <<
"outer_magnet_diameter: " << outer_magnet_diameter << endl;
212 cout <<
"length: " << length << endl;
213 cout <<
"angle: " << angle << endl;
214 cout <<
"dipole_field_x: " << dipole_field_x << endl;
215 cout <<
"fieldgradient: " << fieldgradient << endl;
217 if (!magname.compare(0, 1,
"B"))
221 else if (!magname.compare(0, 1,
"Q"))
223 magtype =
"QUADRUPOLE";
225 else if (!magname.compare(0, 1,
"S"))
227 magtype =
"SEXTUPOLE";
231 cout <<
"cannot decode magnet name " << magname << endl;
239 inner_radius_zin *= 100.;
240 outer_magnet_diameter *= 100.;
241 angle = (angle / TMath::Pi() * 180.) / 1000.;
247 dipole_field_x = dipole_field_x*scaleFactor;
248 fieldgradient = fieldgradient * scaleFactor;
251 if (magnetlist.empty() || magnetlist.find(imagnet) != magnetlist.end())
291 if (fabs(z) + length > biggest_z)
293 biggest_z = fabs(z) +
length;
307 cout <<
"You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl;
314 const double detZDCsurrogate_size_z = 0.1;
315 detZDCsurrogate->SuperDetector(
"ZDCsurrogate");
316 detZDCsurrogate->set_double_param(
"place_x",
PosFlip(-96.24));
317 detZDCsurrogate->set_double_param(
"place_y", 0);
319 detZDCsurrogate->set_double_param(
"rot_y",
AngleFlip(0.025 * TMath::RadToDeg()));
320 detZDCsurrogate->set_double_param(
"size_x", 60);
321 detZDCsurrogate->set_double_param(
"size_y", 60);
322 detZDCsurrogate->set_double_param(
"size_z", detZDCsurrogate_size_z);
323 detZDCsurrogate->set_string_param(
"material",
"G4_Si");
324 detZDCsurrogate->SetActive();
325 detZDCsurrogate->set_color(1, 0, 0, 0.5);
326 detZDCsurrogate->OverlapCheck(overlapCheck);
328 if (verbosity) detZDCsurrogate->Verbosity(verbosity);
344 const int offMomDetNr = 2;
345 const double om_zCent[offMomDetNr] = {3450, 3650};
346 const double om_xCent[offMomDetNr] = {-162, -171};
347 for (
int i = 0; i < offMomDetNr; i++)
350 detOM->SuperDetector(
"offMomTruth");
351 detOM->set_double_param(
"place_x",
PosFlip(om_xCent[i]));
352 detOM->set_double_param(
"place_y", 0);
354 detOM->set_double_param(
"rot_y",
AngleFlip(0.045 * TMath::RadToDeg()));
355 detOM->set_double_param(
"size_x", 50);
356 detOM->set_double_param(
"size_y", 35);
357 detOM->set_double_param(
"size_z", 0.03);
358 detOM->set_string_param(
"material",
"G4_Si");
360 if (verbosity) detOM->Verbosity(verbosity);
361 detOM->OverlapCheck(overlapCheck);
374 string paramFile = string(getenv(
"CALIBRATIONROOT")) +
"/RomanPots/RP_parameters_IP6.dat";
375 int Nlayers = GetParameterFromFile <int> (paramFile,
"Number_layers");
379 detRP->SuperDetector(
"rpTruth" );
381 detRP->set_int_param(
"layerNumber",
layer + 1 );
385 detRP->SetParametersFromFile( paramFile );
386 detRP->OverlapCheck( overlapCheck );
388 detRP->SetActive(
true );
389 if( verbosity ) { detRP->Verbosity( verbosity ); }
400 const int b0DetNr = 4;
401 const double b0Mag_zCent = 640;
402 const double b0Mag_zLen = 120;
403 const double b0tr[4]={10,40,70,100};
405 const double b0Cu_zLen = .2;
406 const double b0Si_zLen = .1;
407 const double b0Ecal_zLen = 10;
408 double pipe_hole_r = 3.5;
409 double pipe_hole = 2.5;
410 const double cable_hole = 2.0;
411 const double cable_x = -17.0;
413 const double d_radius = 7.0;
414 const double b0_radius = 19.0;
415 const double b0_magradius = 20.0;
416 const double spanning_angle = 240;
417 const double b0Ecal_z = 48;
418 double start_angle = 60;
419 const double cross_angle = 0.025;
427 cout <<
"Realistic B0"<<endl;
428 for (
int i = 0; i < b0DetNr; i++)
431 pipe_hole = b0tr[i]*cross_angle;
436 pipe_hole_r = pipe_hole_r + b0tr[b0DetNr-1]*cross_angle/2;
440 pipe_hole = b0tr[b0DetNr-1]*cross_angle;
443 cout <<
"Starting B0 Tracker layer "<<i+1<<endl;
444 cout <<
"Pipe Hole: "<< pipe_hole<<
"\t"<<pipe_x<<endl;
445 b0tr_z = b0tr[i] - b0Mag_zLen / 2;
447 detB0->SuperDetector(Form(
"b0Truth_%d", i));
448 detB0->set_double_param(
"place_x", 0);
449 detB0->set_double_param(
"place_y", 0);
451 detB0->set_double_param(
"pipe_hole", pipe_hole);
452 detB0->set_double_param(
"cable_hole", cable_hole);
453 detB0->set_double_param(
"outer_radius", b0_radius);
454 detB0->set_double_param(
"d_radius", d_radius);
455 detB0->set_double_param(
"length", b0Si_zLen);
456 detB0->set_string_param(
"material",
"G4_Si");
457 detB0->set_double_param(
"startAngle",start_angle);
458 detB0->set_double_param(
"spanningAngle",spanning_angle);
459 detB0->set_double_param(
"detid",i);
460 detB0->set_double_param(
"pipe_x", pipe_x);
461 detB0->set_double_param(
"pipe_y", 0);
462 detB0->set_double_param(
"pipe_z", 0);
463 detB0->set_double_param(
"pipe_hole_r", pipe_hole_r);
464 detB0->set_double_param(
"cable_x", cable_x);
465 detB0->set_double_param(
"cable_y", 0);
466 detB0->set_double_param(
"cable_z", 0);
467 detB0->set_double_param(
"place_z", b0tr_z);
468 detB0->SetActive(
true);
470 detB0->Verbosity(verbosity);
471 detB0->OverlapCheck(overlapCheck);
475 if (Enable::B0TRACKING){
499 detB0e->SuperDetector(
"b0Dead");
501 detB0e->set_double_param(
"pipe_hole", pipe_hole);
502 detB0e->set_double_param(
"place_x", 0);
503 detB0e->set_double_param(
"place_y", 0);
504 detB0e->set_double_param(
"d_radius", d_radius);
505 detB0e->set_double_param(
"pipe_x", pipe_x);
506 detB0e->set_double_param(
"pipe_y", 0);
507 detB0e->set_double_param(
"pipe_z", 0);
508 detB0e->set_double_param(
"pipe_hole_r", pipe_hole_r);
509 detB0e->set_double_param(
"cable_x", cable_x);
510 detB0e->set_double_param(
"cable_y", 0);
511 detB0e->set_double_param(
"cable_z", 0);
512 detB0e->set_double_param(
"outer_radius", b0_radius);
513 detB0e->set_double_param(
"length", b0Cu_zLen);
514 detB0e->set_string_param(
"material",
"G4_Cu");
515 detB0e->set_double_param(
"detid",i);
516 detB0e->set_double_param(
"startAngle",start_angle);
517 detB0e->set_double_param(
"spanningAngle",spanning_angle);
518 detB0e->set_double_param(
"place_z", b0tr_z +(b0Cu_zLen+b0Si_zLen)/2) ;
519 detB0e->SetActive(
false);
521 detB0e->Verbosity(verbosity);
522 detB0e->OverlapCheck(overlapCheck);
528 pipe_hole = b0Mag_zLen*cross_angle;
532 pipe_hole_r = pipe_hole_r + b0Mag_zLen*cross_angle/2;
534 cout <<
"Starting B0 ECAL "<<endl;
535 cout <<
"Pipe Hole: "<< pipe_hole<<
"\t"<<pipe_x<<endl;
539 cout << hFarFwdBeamLine::B0Magnet_x<<endl;
540 ostringstream mapping_b0ecal;
541 mapping_b0ecal << getenv(
"CALIBRATIONROOT") <<
"/B0Ecal/mapping/B0ECAL_mapping_v2.txt";
545 B0Ecal->SetTowerMappingFile(mapping_b0ecal.str());
546 B0Ecal->SuperDetector(
"B0ECAL");
547 B0Ecal->set_double_param(
"pipe_hole", pipe_hole);
548 B0Ecal->set_double_param(
"place_x", 0);
549 B0Ecal->set_double_param(
"place_y", 0);
550 B0Ecal->set_double_param(
"place_z", b0Ecal_z);
551 B0Ecal->set_double_param(
"pipe_x", pipe_x);
552 B0Ecal->set_double_param(
"pipe_y", 0);
553 B0Ecal->set_double_param(
"pipe_z", 0);
554 B0Ecal->set_double_param(
"pipe_hole_r", pipe_hole_r);
555 B0Ecal->set_double_param(
"cable_x", cable_x);
556 B0Ecal->set_double_param(
"cable_y", 0);
557 B0Ecal->set_double_param(
"cable_z", 0);
558 B0Ecal->set_double_param(
"length", b0Ecal_zLen);
559 B0Ecal->set_double_param(
"outer_radius", b0_radius);
560 B0Ecal->set_double_param(
"d_radius", d_radius);
561 B0Ecal->set_string_param(
"material",
"G4_PbWO4");
562 B0Ecal->set_double_param(
"startAngle",start_angle);
563 B0Ecal->set_double_param(
"spanningAngle",spanning_angle);
564 B0Ecal->set_double_param(
"detid",0);
565 B0Ecal->set_double_param(
"global_x",hFarFwdBeamLine::B0Magnet_x);
568 B0Ecal->set_int_param(
"lightyield",1);
569 B0Ecal->SetActive(
true);
571 B0Ecal->Verbosity(verbosity);
572 B0Ecal->OverlapCheck(overlapCheck);
577 auto *B0Ecal =
new EICG4B0Subsystem(Form(
"b0Truth_%d", 2*b0DetNr), 2*b0DetNr);
578 B0Ecal->SuperDetector(
"b0Truth");
579 B0Ecal->set_double_param(
"pipe_hole", pipe_hole);
580 B0Ecal->set_double_param(
"place_x", 0);
581 B0Ecal->set_double_param(
"place_y", 0);
582 B0Ecal->set_double_param(
"place_z", b0Ecal_z);
583 B0Ecal->set_double_param(
"pipe_x", pipe_x);
584 B0Ecal->set_double_param(
"pipe_y", 0);
585 B0Ecal->set_double_param(
"pipe_z", 0);
586 B0Ecal->set_double_param(
"pipe_hole_r", pipe_hole_r);
587 B0Ecal->set_double_param(
"cable_x", cable_x);
588 B0Ecal->set_double_param(
"cable_y", 0);
589 B0Ecal->set_double_param(
"cable_z", 0);
590 B0Ecal->set_double_param(
"length", b0Ecal_zLen);
591 B0Ecal->set_double_param(
"outer_radius", b0_radius);
592 B0Ecal->set_double_param(
"d_radius", d_radius);
593 B0Ecal->set_string_param(
"material",
"G4_PbWO4");
594 B0Ecal->set_double_param(
"startAngle",start_angle);
595 B0Ecal->set_double_param(
"spanningAngle",spanning_angle);
596 B0Ecal->set_double_param(
"detid",2*b0DetNr);
597 B0Ecal->SetActive(
true);
599 B0Ecal->Verbosity(verbosity);
600 B0Ecal->OverlapCheck(overlapCheck);
606 B0Ecale->SuperDetector(
"b0Dead");
608 B0Ecale->set_double_param(
"pipe_hole", pipe_hole);
609 B0Ecale->set_double_param(
"place_x", 0);
610 B0Ecale->set_double_param(
"place_y", 0);
611 B0Ecale->set_double_param(
"place_z", b0Ecal_z + (b0Ecal_zLen + b0Cu_zLen)/2);
612 B0Ecale->set_double_param(
"pipe_x", pipe_x);
613 B0Ecale->set_double_param(
"pipe_y", 0);
614 B0Ecale->set_double_param(
"pipe_z", 0);
615 B0Ecale->set_double_param(
"pipe_hole_r", pipe_hole_r);
616 B0Ecale->set_double_param(
"cable_x", cable_x);
617 B0Ecale->set_double_param(
"cable_y", 0);
618 B0Ecale->set_double_param(
"cable_z", 0);
619 B0Ecale->set_double_param(
"length", b0Cu_zLen);
620 B0Ecale->set_double_param(
"d_radius", d_radius);
621 B0Ecale->set_double_param(
"outer_radius", b0_radius);
622 B0Ecale->set_string_param(
"material",
"G4_Cu");
623 B0Ecale->set_double_param(
"startAngle",start_angle);
624 B0Ecale->set_double_param(
"spanningAngle",spanning_angle);
625 B0Ecale->set_double_param(
"detid",b0DetNr+1);
627 B0Ecale->SetActive(
false);
629 B0Ecale->Verbosity(verbosity);
630 B0Ecale->OverlapCheck(overlapCheck);
639 cout <<
"Circular hit planes"<<endl;
641 for (
int i = 0; i < b0DetNr; i++)
643 b0tr_z = b0tr[i] - b0Mag_zLen / 2;
645 detB0->SuperDetector(
"b0Truth");
647 detB0->set_double_param(
"radius", 0);
648 detB0->set_double_param(
"thickness", 20);
649 detB0->set_double_param(
"length", 0.1);
650 detB0->set_string_param(
"material",
"G4_Si");
651 detB0->set_double_param(
"place_z", b0tr_z);
652 detB0->SetActive(
true);
653 if (verbosity) detB0->Verbosity(verbosity);
654 detB0->OverlapCheck(overlapCheck);
659 if (Enable::B0TRACKING){
688 cout <<
"Realistic hit planes"<<endl;
690 for (
int i = 0; i < b0DetNr; i++) {
692 pipe_hole = b0tr[i]*cross_angle;
697 pipe_hole_r = pipe_hole_r + b0tr[b0DetNr-1]*cross_angle/2;
701 pipe_hole = b0tr[b0DetNr-1]*cross_angle;
704 cout <<
"Starting B0 Tracker layer "<<i+1<<endl;
705 cout <<
"Pipe Hole: "<< pipe_hole<<
"\t"<<pipe_x<<endl;
706 b0tr_z = b0tr[i] - b0Mag_zLen / 2;
708 detB0->SuperDetector(Form(
"b0Truth_%d", i));
709 detB0->set_double_param(
"place_x", 0);
710 detB0->set_double_param(
"place_y", 0);
712 detB0->set_double_param(
"pipe_hole", pipe_hole);
713 detB0->set_double_param(
"cable_hole", cable_hole);
714 detB0->set_double_param(
"outer_radius", b0_radius);
715 detB0->set_double_param(
"d_radius", d_radius);
716 detB0->set_double_param(
"length", b0Si_zLen);
717 detB0->set_string_param(
"material",
"G4_Si");
718 detB0->set_double_param(
"startAngle",start_angle);
719 detB0->set_double_param(
"spanningAngle",spanning_angle);
720 detB0->set_double_param(
"detid",i);
721 detB0->set_double_param(
"pipe_x", pipe_x);
722 detB0->set_double_param(
"pipe_y", 0);
723 detB0->set_double_param(
"pipe_z", 0);
724 detB0->set_double_param(
"pipe_hole_r", pipe_hole_r);
725 detB0->set_double_param(
"cable_x", cable_x);
726 detB0->set_double_param(
"cable_y", 0);
727 detB0->set_double_param(
"cable_z", 0);
728 detB0->set_double_param(
"place_z", b0tr_z);
729 detB0->SetActive(
true);
731 detB0->Verbosity(verbosity);
732 detB0->OverlapCheck(overlapCheck);
735 if (Enable::B0TRACKING){
774 cout <<
"You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl;
780 const int offMomDetNr = 2;
781 const double om_xCent[offMomDetNr] = {46, 49};
782 const double om_zCent[offMomDetNr] = {3250, 3450};
784 for (
int i = 0; i < offMomDetNr; i++)
787 detOM->SuperDetector(
"offMomTruth");
788 detOM->set_double_param(
"place_x",
PosFlip(om_xCent[i]));
789 detOM->set_double_param(
"place_y", 0);
791 detOM->set_double_param(
"rot_y",
AngleFlip(-0.045 * TMath::RadToDeg()));
792 detOM->set_double_param(
"size_x", 40);
793 detOM->set_double_param(
"size_y", 35);
794 detOM->set_double_param(
"size_z", 0.03);
795 detOM->set_string_param(
"material",
"G4_Si");
796 detOM->OverlapCheck(overlapCheck);
799 detOM->set_color(0, 0, 1, 0.5);
800 if (verbosity) detOM->Verbosity(verbosity);
805 const double detZDCsurrogate_size_z = 0.1;
806 detZDCsurrogate->SuperDetector(
"ZDCsurrogate");
807 detZDCsurrogate->set_double_param(
"place_x",
PosFlip(120));
808 detZDCsurrogate->set_double_param(
"place_y", 0);
810 detZDCsurrogate->set_double_param(
"rot_y",
AngleFlip(-0.035 * TMath::RadToDeg()));
811 detZDCsurrogate->set_double_param(
"size_x", 60);
812 detZDCsurrogate->set_double_param(
"size_y", 60);
813 detZDCsurrogate->set_double_param(
"size_z", detZDCsurrogate_size_z);
814 detZDCsurrogate->set_string_param(
"material",
"G4_Si");
815 detZDCsurrogate->SetActive();
816 detZDCsurrogate->OverlapCheck(overlapCheck);
817 detZDCsurrogate->set_color(1, 0, 0, 0.5);
819 if (verbosity) detZDCsurrogate->Verbosity(verbosity);
844 string paramFile = string(getenv(
"CALIBRATIONROOT")) +
"/RomanPots/RP_parameters_IP8.dat";
845 int Nlayers = GetParameterFromFile <int> (paramFile,
"Number_layers");
849 detRP->SuperDetector(
"rpTruth" );
851 detRP->set_int_param(
"layerNumber",
layer + 1 );
855 detRP->SetParametersFromFile( paramFile );
856 detRP->OverlapCheck( overlapCheck );
858 detRP->SetActive(
true );
859 if( verbosity ) { detRP->Verbosity( verbosity ); }
893 const int b0DetNr = 4;
894 const double b0Mag_zCent = 610;
895 const double b0Mag_zLen = 120;
896 const double b0tr[4]={10,40,70,100};
897 const double b0Cu_zLen = .2;
898 const double b0Si_zLen = .1;
899 const double b0Ecal_zLen = 10;
900 double pipe_hole_r = 3.5;
901 double pipe_hole = 2.5;
902 const double cable_hole = 2.0;
903 const double cable_x = 21.5;
905 const double d_radius = 7.0;
906 const double b0_radius = 23.5;
907 const double b0_magradius = 24.5;
908 const double spanning_angle = 240;
909 const double b0Ecal_z = 48;
910 double start_angle = -120;
911 const double cross_angle = 0.035;
919 cout <<
"Realistic B0"<<endl;
920 for (
int i = 0; i < b0DetNr; i++)
923 pipe_hole = b0tr[i]*cross_angle;
928 pipe_hole_r = pipe_hole_r + b0tr[b0DetNr-1]*cross_angle/2;
932 pipe_hole = b0tr[b0DetNr-1]*cross_angle;
935 cout <<
"Starting B0 Tracker layer "<<i+1<<endl;
936 cout <<
"Pipe Hole: "<< pipe_hole<<
"\t"<<pipe_x<<endl;
937 b0tr_z = b0tr[i] - b0Mag_zLen / 2;
939 detB0->SuperDetector(Form(
"b0Truth_%d", i));
940 detB0->set_double_param(
"place_x", 0);
941 detB0->set_double_param(
"place_y", 0);
943 detB0->set_double_param(
"pipe_hole", pipe_hole);
944 detB0->set_double_param(
"cable_hole", cable_hole);
945 detB0->set_double_param(
"outer_radius", b0_radius);
946 detB0->set_double_param(
"d_radius", d_radius);
947 detB0->set_double_param(
"length", b0Si_zLen);
948 detB0->set_string_param(
"material",
"G4_Si");
949 detB0->set_double_param(
"startAngle",start_angle);
950 detB0->set_double_param(
"spanningAngle",spanning_angle);
951 detB0->set_double_param(
"detid",i);
952 detB0->set_double_param(
"pipe_x", pipe_x);
953 detB0->set_double_param(
"pipe_y", 0);
954 detB0->set_double_param(
"pipe_z", 0);
955 detB0->set_double_param(
"pipe_hole_r", pipe_hole_r);
956 detB0->set_double_param(
"cable_x", cable_x);
957 detB0->set_double_param(
"cable_y", 0);
958 detB0->set_double_param(
"cable_z", 0);
959 detB0->set_double_param(
"place_z", b0tr_z);
960 detB0->SetActive(
true);
962 detB0->Verbosity(verbosity);
963 detB0->OverlapCheck(overlapCheck);
967 if (Enable::B0TRACKING){
991 detB0e->SuperDetector(
"b0Dead");
993 detB0e->set_double_param(
"pipe_hole", pipe_hole);
994 detB0e->set_double_param(
"place_x", 0);
995 detB0e->set_double_param(
"place_y", 0);
996 detB0e->set_double_param(
"d_radius", d_radius);
997 detB0e->set_double_param(
"pipe_x", pipe_x);
998 detB0e->set_double_param(
"pipe_y", 0);
999 detB0e->set_double_param(
"pipe_z", 0);
1000 detB0e->set_double_param(
"pipe_hole_r", pipe_hole_r);
1001 detB0e->set_double_param(
"cable_x", cable_x);
1002 detB0e->set_double_param(
"cable_y", 0);
1003 detB0e->set_double_param(
"cable_z", 0);
1004 detB0e->set_double_param(
"outer_radius", b0_radius);
1005 detB0e->set_double_param(
"length", b0Cu_zLen);
1006 detB0e->set_string_param(
"material",
"G4_Cu");
1007 detB0e->set_double_param(
"detid",i);
1008 detB0e->set_double_param(
"startAngle",start_angle);
1009 detB0e->set_double_param(
"spanningAngle",spanning_angle);
1010 detB0e->set_double_param(
"place_z", b0tr_z +(b0Cu_zLen+b0Si_zLen)/2) ;
1011 detB0e->SetActive(
false);
1013 detB0e->Verbosity(verbosity);
1014 detB0e->OverlapCheck(overlapCheck);
1020 pipe_hole = b0Mag_zLen*cross_angle;
1024 pipe_hole_r = pipe_hole_r + b0Mag_zLen*cross_angle/2;
1026 cout <<
"Starting B0 ECAL "<<endl;
1027 cout <<
"Pipe Hole: "<< pipe_hole<<
"\t"<<pipe_x<<endl;
1031 cout << hFarFwdBeamLine::B0Magnet_x<<endl;
1032 ostringstream mapping_b0ecal;
1033 mapping_b0ecal << getenv(
"CALIBRATIONROOT") <<
"/B0Ecal/mapping/B0ECAL_mapping_ip8_v1.txt";
1037 B0Ecal->SetTowerMappingFile(mapping_b0ecal.str());
1038 B0Ecal->SuperDetector(
"B0ECAL");
1039 B0Ecal->set_double_param(
"pipe_hole", pipe_hole);
1040 B0Ecal->set_double_param(
"place_x", 0);
1041 B0Ecal->set_double_param(
"place_y", 0);
1042 B0Ecal->set_double_param(
"place_z", b0Ecal_z);
1043 B0Ecal->set_double_param(
"pipe_x", pipe_x);
1044 B0Ecal->set_double_param(
"pipe_y", 0);
1045 B0Ecal->set_double_param(
"pipe_z", 0);
1046 B0Ecal->set_double_param(
"pipe_hole_r", pipe_hole_r);
1047 B0Ecal->set_double_param(
"cable_x", cable_x);
1048 B0Ecal->set_double_param(
"cable_y", 0);
1049 B0Ecal->set_double_param(
"cable_z", 0);
1050 B0Ecal->set_double_param(
"length", b0Ecal_zLen);
1051 B0Ecal->set_double_param(
"outer_radius", b0_radius);
1052 B0Ecal->set_double_param(
"d_radius", d_radius);
1053 B0Ecal->set_string_param(
"material",
"G4_PbWO4");
1054 B0Ecal->set_double_param(
"startAngle",start_angle);
1055 B0Ecal->set_double_param(
"spanningAngle",spanning_angle);
1056 B0Ecal->set_double_param(
"detid",0);
1057 B0Ecal->set_double_param(
"global_x",hFarFwdBeamLine::B0Magnet_x);
1060 B0Ecal->set_int_param(
"lightyield",1);
1061 B0Ecal->SetActive(
true);
1063 B0Ecal->Verbosity(verbosity);
1064 B0Ecal->OverlapCheck(overlapCheck);
1069 auto *B0Ecal =
new EICG4B0Subsystem(Form(
"b0Truth_%d", 2*b0DetNr), 2*b0DetNr);
1070 B0Ecal->SuperDetector(
"b0Truth");
1071 B0Ecal->set_double_param(
"pipe_hole", pipe_hole);
1072 B0Ecal->set_double_param(
"place_x", 0);
1073 B0Ecal->set_double_param(
"place_y", 0);
1074 B0Ecal->set_double_param(
"place_z", b0Ecal_z);
1075 B0Ecal->set_double_param(
"pipe_x", pipe_x);
1076 B0Ecal->set_double_param(
"pipe_y", 0);
1077 B0Ecal->set_double_param(
"pipe_z", 0);
1078 B0Ecal->set_double_param(
"pipe_hole_r", pipe_hole_r);
1079 B0Ecal->set_double_param(
"cable_x", cable_x);
1080 B0Ecal->set_double_param(
"cable_y", 0);
1081 B0Ecal->set_double_param(
"cable_z", 0);
1082 B0Ecal->set_double_param(
"length", b0Ecal_zLen);
1083 B0Ecal->set_double_param(
"outer_radius", b0_radius);
1084 B0Ecal->set_double_param(
"d_radius", d_radius);
1085 B0Ecal->set_string_param(
"material",
"G4_PbWO4");
1086 B0Ecal->set_double_param(
"startAngle",start_angle);
1087 B0Ecal->set_double_param(
"spanningAngle",spanning_angle);
1088 B0Ecal->set_double_param(
"detid",2*b0DetNr);
1089 B0Ecal->SetActive(
true);
1091 B0Ecal->Verbosity(verbosity);
1092 B0Ecal->OverlapCheck(overlapCheck);
1098 B0Ecale->SuperDetector(
"b0Dead");
1100 B0Ecale->set_double_param(
"pipe_hole", pipe_hole);
1101 B0Ecale->set_double_param(
"place_x", 0);
1102 B0Ecale->set_double_param(
"place_y", 0);
1103 B0Ecale->set_double_param(
"place_z", b0Ecal_z + (b0Ecal_zLen + b0Cu_zLen)/2);
1104 B0Ecale->set_double_param(
"pipe_x", pipe_x);
1105 B0Ecale->set_double_param(
"pipe_y", 0);
1106 B0Ecale->set_double_param(
"pipe_z", 0);
1107 B0Ecale->set_double_param(
"pipe_hole_r", pipe_hole_r);
1108 B0Ecale->set_double_param(
"cable_x", cable_x);
1109 B0Ecale->set_double_param(
"cable_y", 0);
1110 B0Ecale->set_double_param(
"cable_z", 0);
1111 B0Ecale->set_double_param(
"length", b0Cu_zLen);
1112 B0Ecale->set_double_param(
"d_radius", d_radius);
1113 B0Ecale->set_double_param(
"outer_radius", b0_radius);
1114 B0Ecale->set_string_param(
"material",
"G4_Cu");
1115 B0Ecale->set_double_param(
"startAngle",start_angle);
1116 B0Ecale->set_double_param(
"spanningAngle",spanning_angle);
1117 B0Ecale->set_double_param(
"detid",b0DetNr+1);
1119 B0Ecale->SetActive(
false);
1121 B0Ecale->Verbosity(verbosity);
1122 B0Ecale->OverlapCheck(overlapCheck);
1131 cout <<
"Circular hit planes"<<endl;
1133 for (
int i = 0; i < b0DetNr; i++)
1135 b0tr_z = b0tr[i] - b0Mag_zLen / 2;
1137 detB0->SuperDetector(
"b0Truth");
1139 detB0->set_double_param(
"radius", 0);
1140 detB0->set_double_param(
"thickness", 20);
1141 detB0->set_double_param(
"length", 0.1);
1142 detB0->set_string_param(
"material",
"G4_Si");
1143 detB0->set_double_param(
"place_z", b0tr_z);
1144 detB0->SetActive(
true);
1145 if (verbosity) detB0->Verbosity(verbosity);
1146 detB0->OverlapCheck(overlapCheck);
1151 if (Enable::B0TRACKING){
1180 cout <<
"Realistic hit planes"<<endl;
1182 for (
int i = 0; i < b0DetNr; i++) {
1184 pipe_hole = b0tr[i]*cross_angle;
1189 pipe_hole_r = pipe_hole_r + b0tr[b0DetNr-1]*cross_angle/2;
1193 pipe_hole = b0tr[b0DetNr-1]*cross_angle;
1196 cout <<
"Starting B0 Tracker layer "<<i+1<<endl;
1197 cout <<
"Pipe Hole: "<< pipe_hole<<
"\t"<<pipe_x<<endl;
1198 b0tr_z = b0tr[i] - b0Mag_zLen / 2;
1200 detB0->SuperDetector(Form(
"b0Truth_%d", i));
1201 detB0->set_double_param(
"place_x", 0);
1202 detB0->set_double_param(
"place_y", 0);
1204 detB0->set_double_param(
"pipe_hole", pipe_hole);
1205 detB0->set_double_param(
"cable_hole", cable_hole);
1206 detB0->set_double_param(
"outer_radius", b0_radius);
1207 detB0->set_double_param(
"d_radius", d_radius);
1208 detB0->set_double_param(
"length", b0Si_zLen);
1209 detB0->set_string_param(
"material",
"G4_Si");
1210 detB0->set_double_param(
"startAngle",start_angle);
1211 detB0->set_double_param(
"spanningAngle",spanning_angle);
1212 detB0->set_double_param(
"detid",i);
1213 detB0->set_double_param(
"pipe_x", pipe_x);
1214 detB0->set_double_param(
"pipe_y", 0);
1215 detB0->set_double_param(
"pipe_z", 0);
1216 detB0->set_double_param(
"pipe_hole_r", pipe_hole_r);
1217 detB0->set_double_param(
"cable_x", cable_x);
1218 detB0->set_double_param(
"cable_y", 0);
1219 detB0->set_double_param(
"cable_z", 0);
1220 detB0->set_double_param(
"place_z", b0tr_z);
1221 detB0->SetActive(
true);
1223 detB0->Verbosity(verbosity);
1224 detB0->OverlapCheck(overlapCheck);
1227 if (Enable::B0TRACKING){
1286 const int nSecQ = 5;
1287 const string nm[nSecQ] = {
"B0apf",
"Q1apf",
"Q1bpf",
"Q2pf",
"B1pf"};
1288 const double qlen[nSecQ] = {160, 150, 220, 440, 330};
1289 const double qir[nSecQ] = {4, 5.1, 7, 12, 12.2};
1290 const double qor[nSecQ] = {4.1, 5.2, 7.2, 12.2, 12.4};
1291 const double qrot[nSecQ] = {25, 19.5, 15, 15, 34};
1292 const double qxC[nSecQ] = {19.8, 24.47, 30.05, 39.5, 48};
1293 const double qyC[nSecQ] = {0, 0, 0, 0, 0};
1294 const double qzC[nSecQ] = {770, 922.8, 1106.3, 1416.7, 1806.7};
1295 for (
int i = 0; i < nSecQ; i++)
1338 const double len[nSec] = {850, 1150};
1339 const double ir1[nSec] = {17, 17};
1340 const double or1[nSec] = {17.1, 17.1};
1341 const double ir2[nSec] = {17, 7};
1342 const double or2[nSec] = {17.1, 7.1};
1343 const double xC[nSec] = {83, 130};
1344 const double yC[nSec] = {0, 0};
1345 const double zC[nSec] = {2550, 3550};
1346 for (
int i = 0; i < nSec; i++)