@@ -25,7 +25,8 @@ plane::plane(double position, double material, bool measurement, double resoluti
2525 m_position(position) {}
2626
2727
28- telescope::telescope (std::vector<gblsim::plane> planes, double beam_energy) :
28+ telescope::telescope (std::vector<gblsim::plane> planes, double beam_energy, double material) :
29+ m_volumeMaterial(material),
2930 m_listOfPoints(),
3031 m_listOfLabels()
3132{
@@ -63,24 +64,32 @@ telescope::telescope(std::vector<gblsim::plane> planes, double beam_energy) :
6364 // Let's first add the air:
6465 double plane_distance = pl->m_position - oldpos;
6566 LOG (logDEBUG2) << " Distance to next plane: " << plane_distance;
67+ double distance = 0 ;
6668
67- // Propagate [mm] from 0 to 0.21 = 0.5 - 1/sqrt(12)
68- double distance = 0.21 * plane_distance; arclength += distance;
69+ // Check if a volume scatterer with radiation length != 0 has been defined:
70+ if (m_volumeMaterial > 0.0 ) {
71+ // Propagate [mm] from 0 to 0.21 = 0.5 - 1/sqrt(12)
72+ distance = 0.21 * plane_distance; arclength += distance;
6973
70- // Add air :
71- m_listOfPoints.push_back (getPoint (distance,getScatterer (beam_energy,0.5 *plane_distance/X0_Air ,total_materialbudget)));
72- LOG (logDEBUG3) << " Added air scat at " << arclength;
74+ // Add volume scatterer :
75+ m_listOfPoints.push_back (getPoint (distance,getScatterer (beam_energy,0.5 *plane_distance/m_volumeMaterial ,total_materialbudget)));
76+ LOG (logDEBUG3) << " Added volume scat at " << arclength;
7377
74- // Propagate [mm] 0.58 = from 0.21 to 0.79 = 0.5 + 1/sqrt(12)
75- distance = 0.58 * plane_distance; arclength += distance;
78+ // Propagate [mm] 0.58 = from 0.21 to 0.79 = 0.5 + 1/sqrt(12)
79+ distance = 0.58 * plane_distance; arclength += distance;
7680
77- // Factor 0.5 for the air as it is split into two scatterers:
78- m_listOfPoints.push_back (getPoint (distance,getScatterer (beam_energy,0.5 *plane_distance/X0_Air ,total_materialbudget)));
79- LOG (logDEBUG3) << " Added air scat at " << arclength;
81+ // Factor 0.5 for the volume as it is split into two scatterers:
82+ m_listOfPoints.push_back (getPoint (distance,getScatterer (beam_energy,0.5 *plane_distance/m_volumeMaterial ,total_materialbudget)));
83+ LOG (logDEBUG3) << " Added volume scat at " << arclength;
8084
81- // Propagate [mm] from 0 to 0.21 = 0.5 - 1/sqrt(12)
82- distance = 0.21 * plane_distance; arclength += distance;
83- LOG (logDEBUG) << " Added air scatterers." ;
85+ // Propagate [mm] from 0 to 0.21 = 0.5 - 1/sqrt(12)
86+ distance = 0.21 * plane_distance; arclength += distance;
87+ LOG (logDEBUG) << " Added volume scatterers." ;
88+ }
89+ else {
90+ // No volume scatterer defined (vacuum), simply propagate to the next plane:
91+ distance = plane_distance;
92+ }
8493
8594 if (pl->m_measurement ) {
8695 m_listOfPoints.push_back (getPoint (distance,pl->m_resolution ,getScatterer (beam_energy,pl->m_materialbudget ,total_materialbudget)));
@@ -111,11 +120,13 @@ double telescope::getTotalMaterialBudget(std::vector<gblsim::plane> planes) {
111120 total_materialbudget += p->m_materialbudget ;
112121 }
113122
114- // Add the air as scattering material:
115- double total_distance = (planes.back ().m_position - planes.front ().m_position );
116- LOG (logDEBUG2) << " Adding x/X0=" << (total_distance/X0_Air) << " (air)" ;
117- total_materialbudget += total_distance/X0_Air;
118-
123+ if (m_volumeMaterial > 0.0 ) {
124+ // Add the air as scattering material:
125+ double total_distance = (planes.back ().m_position - planes.front ().m_position );
126+ LOG (logDEBUG2) << " Adding x/X0=" << (total_distance/m_volumeMaterial) << " (air)" ;
127+ total_materialbudget += total_distance/m_volumeMaterial;
128+ }
129+
119130 LOG (logDEBUG) << " Total track material budget x/X0=" << total_materialbudget;
120131 return total_materialbudget;
121132}
0 commit comments