Skip to content

Commit 427cd2c

Browse files
committed
Add in accounting for attenuation in air when making DRF.
1 parent a7c57ce commit 427cd2c

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

InterSpec/MakeDrf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ class MakeDrf : public Wt::WContainerWidget
175175

176176
Wt::WGroupBox *m_effOptionGroup;
177177

178+
Wt::WCheckBox *m_airAttenuate;
179+
178180
/** ToDo: make chart properly interactive so user doesnt need to input the
179181
energy range manually.
180182
*/

InterSpec_resources/MakeDrf.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
margin-bottom: 5px;
1818
}
1919

20+
.AirAttenCb {
21+
}
22+
2023
.MakeDrfErrTxt {
2124
padding: 1em;
2225
margin: 2px;

src/MakeDrf.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
#include "InterSpec/PeakSearchGuiUtils.h"
8181
#include "InterSpec/MassAttenuationTool.h"
8282
#include "InterSpec/DecayDataBaseServer.h"
83+
#include "InterSpec/GammaInteractionCalc.h"
8384
#include "InterSpec/DetectorPeakResponse.h"
8485

8586

@@ -1348,6 +1349,7 @@ MakeDrf::MakeDrf( InterSpec *viewer, MaterialDB *materialDB,
13481349
m_effEqnOrder( nullptr ),
13491350
m_effEqnUnits( nullptr ),
13501351
m_effOptionGroup( nullptr ),
1352+
m_airAttenuate( nullptr ),
13511353
m_chartLowerE( nullptr ),
13521354
m_chartUpperE( nullptr ),
13531355
m_errorMsg( nullptr ),
@@ -1415,6 +1417,14 @@ MakeDrf::MakeDrf( InterSpec *viewer, MaterialDB *materialDB,
14151417
m_effOptionGroup->hide();
14161418
m_fwhmOptionGroup->hide();
14171419

1420+
WGroupBox *genOpts = new WGroupBox( fitOptionsDiv );
1421+
m_airAttenuate = new WCheckBox( "Atten. for air", genOpts );
1422+
m_airAttenuate->setChecked( true );
1423+
m_airAttenuate->setInline( false );
1424+
m_airAttenuate->addStyleClass( "AirAttenCb" );
1425+
m_airAttenuate->checked().connect( this, &MakeDrf::handleSourcesUpdates );
1426+
m_airAttenuate->unChecked().connect( this, &MakeDrf::handleSourcesUpdates );
1427+
14181428
m_chart = new MakeDrfChart();
14191429
DrfChartHolder *chartholder = new DrfChartHolder( m_chart, nullptr );
14201430
upperLayout->addWidget( chartholder, 0, 1 );
@@ -1975,6 +1985,8 @@ void MakeDrf::handleSourcesUpdates()
19751985
detDiamInvalid = true;
19761986
}
19771987

1988+
const bool doAirAtten = m_airAttenuate->isChecked();
1989+
19781990
//Go through and and grab background peaks
19791991
vector<DrfPeak *> backgroundpeaks;
19801992
for( auto w : m_files->children() )
@@ -2115,10 +2127,19 @@ void MakeDrf::handleSourcesUpdates()
21152127

21162128

21172129

2118-
auto trans_frac = []( const float energy, MakeDrfSrcDef *src ) -> double {
2130+
auto trans_frac = [doAirAtten]( const float energy, MakeDrfSrcDef *src ) -> double {
2131+
2132+
double airTransFrac = 1.0;
2133+
if( doAirAtten )
2134+
{
2135+
const double distance = src->distance();
2136+
const double mu = GammaInteractionCalc::transmission_length_coefficient_air( energy );
2137+
airTransFrac = exp( -mu * distance );
2138+
}//if( doAirAtten )
2139+
21192140
ShieldingSelect *shield = src ? src->shielding() : nullptr;
21202141
if( !shield )
2121-
return 1.0;
2142+
return airTransFrac;
21222143

21232144
//ToDo: Attenuation calculation not checked!
21242145
double an = 14, ad = 0.0;
@@ -2141,7 +2162,7 @@ void MakeDrf::handleSourcesUpdates()
21412162
}//if( shield->isGenericMaterial() ) / else
21422163

21432164
const double mu = MassAttenuation::massAttenuationCoeficient( an, energy );
2144-
return exp( -mu * ad );
2165+
return airTransFrac * exp( -mu * ad );
21452166
};//trans_frac lambda
21462167

21472168

0 commit comments

Comments
 (0)