|
32 | 32 | #include "SimG4Core/Notification/interface/BeginOfJob.h" |
33 | 33 | #include "SimG4Core/Notification/interface/CMSSteppingVerbose.h" |
34 | 34 | #include "SimG4Core/Notification/interface/SimTrackManager.h" |
| 35 | +#include "SimG4Core/Notification/interface/CurrentG4Track.h" |
35 | 36 | #include "SimG4Core/Watcher/interface/SimWatcherFactory.h" |
36 | 37 |
|
37 | 38 | #include "SimG4Core/Geometry/interface/DDDWorld.h" |
@@ -180,6 +181,9 @@ RunManagerMTWorker::RunManagerMTWorker(const edm::ParameterSet& p, edm::Consumes |
180 | 181 | m_G4CommandsEndRun(p.getParameter<std::vector<std::string>>("G4CommandsEndRun")), |
181 | 182 | m_p(p) { |
182 | 183 | int id = getThreadIndex(); |
| 184 | + if (id > CurrentG4Track::NumberOfThreads()) { |
| 185 | + CurrentG4Track::setNumberOfThreads(id); |
| 186 | + } |
183 | 187 | edm::LogVerbatim("SimG4CoreApplication") << "RunManagerMTWorker for the thread " << id; |
184 | 188 |
|
185 | 189 | // Initialize per-thread output |
@@ -744,44 +748,34 @@ void RunManagerMTWorker::DumpMagneticField(const G4Field* field, const std::stri |
744 | 748 | // CMS magnetic field volume |
745 | 749 | double rmax = 9000 * CLHEP::mm; |
746 | 750 | double zmax = 24000 * CLHEP::mm; |
747 | | - double phimax = CLHEP::twopi; |
748 | 751 |
|
749 | | - double dr = 2 * CLHEP::cm; |
| 752 | + double dx = 10 * CLHEP::cm; |
750 | 753 | double dz = 10 * CLHEP::cm; |
751 | | - double dphi = phimax / 32.; |
752 | 754 |
|
753 | | - int nr = G4lrint(rmax / dr); |
| 755 | + int nx = G4lrint(2 * rmax / dx); |
754 | 756 | int nz = G4lrint(2 * zmax / dz); |
755 | | - int nphi = G4lrint(phimax / dphi); |
756 | 757 |
|
757 | 758 | double point[4] = {0.0, 0.0, 0.0, 0.0}; |
758 | 759 | double bfield[3] = {0.0, 0.0, 0.0}; |
759 | 760 |
|
760 | | - double z; |
761 | | - double d1 = 1. / CLHEP::rad; |
762 | 761 | double d2 = 1. / CLHEP::mm; |
763 | 762 | double d3 = 1. / CLHEP::tesla; |
764 | 763 |
|
765 | 764 | fout << std::setprecision(6); |
766 | | - fout << "### " << file << " CMS magnetic field: phi(rad) R(mm) Z(mm) Bx(tesla) By(tesla) Bz(tesla) ###" << G4endl; |
767 | | - for (int k = 0; k <= nphi; ++k) { |
768 | | - double phi = k * dphi; |
769 | | - double cosf = cos(phi); |
770 | | - double sinf = sin(phi); |
771 | | - double r = 0.0; |
772 | | - double z0 = -zmax; |
773 | | - for (int i = 0; i <= nr; ++i) { |
774 | | - z = z0; |
| 765 | + fout << "### " << file << " CMS magnetic field: X(mm) Y(mm) Z(mm) Bx(tesla) By(tesla) Bz(tesla) ###" << G4endl; |
| 766 | + for (int k = 0; k <= nx; ++k) { |
| 767 | + double x = k * dx - rmax; |
| 768 | + for (int i = 0; i <= nx; ++i) { |
| 769 | + double y = i * dx - rmax; |
775 | 770 | for (int j = 0; j <= nz; ++j) { |
776 | | - point[0] = r * cosf; |
777 | | - point[1] = r * sinf; |
| 771 | + double z = j * dz - zmax; |
| 772 | + point[0] = x; |
| 773 | + point[1] = y; |
778 | 774 | point[2] = z; |
779 | 775 | field->GetFieldValue(point, bfield); |
780 | | - fout << phi * d1 << " " << r * d2 << " " << z * d2 << " " << bfield[0] * d3 << " " << bfield[1] * d3 << " " |
| 776 | + fout << x * d2 << " " << y * d2 << " " << z * d2 << " " << bfield[0] * d3 << " " << bfield[1] * d3 << " " |
781 | 777 | << bfield[2] * d3 << G4endl; |
782 | | - z += dz; |
783 | 778 | } |
784 | | - r += dr; |
785 | 779 | } |
786 | 780 | } |
787 | 781 | fout.close(); |
|
0 commit comments