Import Geant4 9.5.0 source tree
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
|
||||
namespace CexmcAST
|
||||
{
|
||||
void Subtree::Print( int level ) const
|
||||
void Subtree::Print( int level ) const
|
||||
{
|
||||
static const std::string opId[] =
|
||||
{ "UNINITIALIZED", "TOP", "u -", "!", "*", "/", "+", "-", "<", "<=",
|
||||
@@ -97,7 +97,7 @@ namespace CexmcAST
|
||||
}
|
||||
|
||||
|
||||
void Subtree::PrintLeaf( const Leaf * leaf, int level ) const
|
||||
void Subtree::PrintLeaf( const Leaf * leaf, int level ) const
|
||||
{
|
||||
const Variable * variable( NULL );
|
||||
std::stringstream value;
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace
|
||||
}
|
||||
|
||||
|
||||
const G4double CexmcASTEval::constants[] = { eV, keV, MeV, GeV, mm, cm, m };
|
||||
const G4double CexmcASTEval::constants[] = { eV, keV, MeV, GeV, mm, cm, m };
|
||||
|
||||
|
||||
CexmcASTEval::CexmcASTEval( const CexmcEventFastSObject * evFastSObject,
|
||||
|
||||
@@ -65,13 +65,13 @@ void GetNormalizedAngularRange( const CexmcAngularRangeList & src,
|
||||
if ( std::fabs( k->top - ( k - 1 )->top ) < epsilon ||
|
||||
k->bottom + epsilon >= ( k - 1 )->bottom )
|
||||
{
|
||||
dst.erase( k );
|
||||
k = dst.erase( k );
|
||||
continue;
|
||||
}
|
||||
if ( k->top + epsilon >= ( k - 1 )->bottom )
|
||||
{
|
||||
( k - 1 )->bottom = k->bottom;
|
||||
dst.erase( k );
|
||||
k = dst.erase( k );
|
||||
continue;
|
||||
}
|
||||
++k;
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <G4ThreeVector.hh>
|
||||
#include <G4LorentzVector.hh>
|
||||
#include "CexmcChargeExchangeReconstructor.hh"
|
||||
@@ -51,20 +52,20 @@
|
||||
#include "CexmcProductionModel.hh"
|
||||
#include "CexmcRunManager.hh"
|
||||
#include "CexmcException.hh"
|
||||
#include "CexmcCommon.hh"
|
||||
|
||||
|
||||
CexmcChargeExchangeReconstructor::CexmcChargeExchangeReconstructor(
|
||||
const CexmcProductionModel * productionModel ) :
|
||||
outputParticleMass( 0 ), nucleusOutputParticleMass( 0 ),
|
||||
outputParticleMass( 0 ), nucleusOutputParticleMass( 0 ),
|
||||
useTableMass( false ), useMassCut( false ), massCutOPCenter( 0 ),
|
||||
massCutNOPCenter( 0 ), massCutOPWidth( 0 ), massCutNOPWidth( 0 ),
|
||||
massCutEllipseAngle( 0 ), useAbsorbedEnergyCut( false ),
|
||||
absorbedEnergyCutCLCenter( 0 ), absorbedEnergyCutCRCenter( 0 ),
|
||||
absorbedEnergyCutCLWidth( 0 ), absorbedEnergyCutCRWidth( 0 ),
|
||||
absorbedEnergyCutEllipseAngle( 0 ), hasMassCutTriggered( false ),
|
||||
hasAbsorbedEnergyCutTriggered( false ), beamParticleIsInitialized( false ),
|
||||
particleGun( NULL ), messenger( NULL )
|
||||
absorbedEnergyCutEllipseAngle( 0 ), expectedMomentumAmp( -1 ),
|
||||
edCollectionAlgorithm( CexmcCollectEDInAllCrystals ),
|
||||
hasMassCutTriggered( false ), hasAbsorbedEnergyCutTriggered( false ),
|
||||
beamParticleIsInitialized( false ), particleGun( NULL ), messenger( NULL )
|
||||
{
|
||||
if ( ! productionModel )
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
@@ -121,6 +122,9 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
|
||||
beamParticleIsInitialized = true;
|
||||
}
|
||||
|
||||
if ( edCollectionAlgorithm == CexmcCollectEDInAdjacentCrystals )
|
||||
collectEDInAdjacentCrystals = true;
|
||||
|
||||
ReconstructEntryPoints( edStore );
|
||||
if ( hasBasicTrigger )
|
||||
ReconstructTargetPoint();
|
||||
@@ -136,6 +140,12 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
|
||||
G4double calorimeterEDLeft( edStore->calorimeterEDLeft );
|
||||
G4double calorimeterEDRight( edStore->calorimeterEDRight );
|
||||
|
||||
if ( edCollectionAlgorithm == CexmcCollectEDInAdjacentCrystals )
|
||||
{
|
||||
calorimeterEDLeft = calorimeterEDLeftAdjacent;
|
||||
calorimeterEDRight = calorimeterEDRightAdjacent;
|
||||
}
|
||||
|
||||
//G4double cosOutputParticleLAB(
|
||||
//( calorimeterEDLeft * cosAngleLeft +
|
||||
//calorimeterEDRight * cosAngleRight ) /
|
||||
@@ -152,17 +162,21 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
|
||||
opdpRightMomentum.setMag( calorimeterEDRight );
|
||||
G4ThreeVector opMomentum( opdpLeftMomentum + opdpRightMomentum );
|
||||
|
||||
/* opMass will be used only in calculation of output particle's total
|
||||
* energy, in other places outputParticleMass should be used instead */
|
||||
G4double opMass( useTableMass ?
|
||||
productionModelData.outputParticle->GetPDGMass() :
|
||||
outputParticleMass );
|
||||
G4double opEnergy( std::sqrt(
|
||||
opMomentum.mag2() + opMass * opMass ) );
|
||||
/* the formula below is equivalent to
|
||||
* calorimeterEDLeft + calorimeterEDRight if opMass = outputParticleMass */
|
||||
G4double opEnergy( std::sqrt( opMomentum.mag2() +
|
||||
opMass * opMass ) );
|
||||
productionModelData.outputParticleLAB = G4LorentzVector( opMomentum,
|
||||
opEnergy );
|
||||
|
||||
G4ThreeVector incidentParticleMomentum( particleGun->GetOrigDirection() );
|
||||
G4double incidentParticleMomentumAmp(
|
||||
particleGun->GetOrigMomentumAmp() );
|
||||
G4double incidentParticleMomentumAmp( expectedMomentumAmp > 0 ?
|
||||
expectedMomentumAmp : particleGun->GetOrigMomentumAmp() );
|
||||
incidentParticleMomentum *= incidentParticleMomentumAmp;
|
||||
|
||||
G4double incidentParticlePDGMass(
|
||||
@@ -179,6 +193,7 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
|
||||
productionModelData.nucleusParticle->GetPDGMass() );
|
||||
productionModelData.nucleusParticleLAB = G4LorentzVector(
|
||||
G4ThreeVector( 0, 0, 0 ), nucleusParticlePDGMass );
|
||||
|
||||
G4LorentzVector lVecSum( productionModelData.incidentParticleLAB +
|
||||
productionModelData.nucleusParticleLAB );
|
||||
G4ThreeVector boostVec( lVecSum.boostVector() );
|
||||
@@ -200,19 +215,9 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
|
||||
productionModelData.outputParticleSCM.boost( -boostVec );
|
||||
productionModelData.nucleusOutputParticleSCM.boost( -boostVec );
|
||||
|
||||
G4double edDelta2(
|
||||
std::pow( ( calorimeterEDLeft - calorimeterEDRight ) /
|
||||
( calorimeterEDLeft + calorimeterEDRight ),
|
||||
2 ) );
|
||||
G4double outputParticleKinEnergy(
|
||||
std::sqrt( 2 * opMass * opMass / ( 1 - cosTheAngle ) /
|
||||
( 1 - edDelta2 ) ) - opMass );
|
||||
G4ThreeVector nopMomentum( incidentParticleMomentum - opMomentum );
|
||||
G4double nopEnergy(
|
||||
std::sqrt( incidentParticleMomentum.mag2() +
|
||||
incidentParticlePDGMass2 ) +
|
||||
nucleusParticlePDGMass -
|
||||
( outputParticleKinEnergy + opMass ) );
|
||||
G4double nopEnergy( incidentParticleEnergy + nucleusParticlePDGMass -
|
||||
opEnergy );
|
||||
nucleusOutputParticleMass = std::sqrt( nopEnergy * nopEnergy -
|
||||
nopMomentum.mag2() );
|
||||
|
||||
@@ -292,3 +297,10 @@ G4bool CexmcChargeExchangeReconstructor::HasFullTrigger( void ) const
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CexmcChargeExchangeReconstructor::SetExpectedMomentumAmpDiff(
|
||||
G4double value )
|
||||
{
|
||||
expectedMomentumAmp = particleGun->GetOrigMomentumAmp() + value;
|
||||
}
|
||||
|
||||
|
||||
+110
-36
@@ -42,6 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <G4UIcmdWithABool.hh>
|
||||
#include <G4UIcmdWithAString.hh>
|
||||
#include <G4UIcmdWithADoubleAndUnit.hh>
|
||||
#include "CexmcChargeExchangeReconstructorMessenger.hh"
|
||||
#include "CexmcChargeExchangeReconstructor.hh"
|
||||
@@ -56,7 +57,8 @@ CexmcChargeExchangeReconstructorMessenger::
|
||||
mCutOPWidth( NULL ), mCutNOPWidth( NULL ), mCutAngle( NULL ),
|
||||
useAbsorbedEnergyCut( NULL ), aeCutCLCenter( NULL ),
|
||||
aeCutCRCenter( NULL ), aeCutCLWidth( NULL ), aeCutCRWidth( NULL ),
|
||||
aeCutAngle( NULL )
|
||||
aeCutAngle( NULL ), setExpectedMomentumAmp( NULL ),
|
||||
setExpectedMomentumAmpDiff( NULL ), setEDCollectionAlgorithm( NULL )
|
||||
{
|
||||
useTableMass = new G4UIcmdWithABool(
|
||||
( CexmcMessenger::reconstructorDirName + "useTableMass" ).c_str(),
|
||||
@@ -64,138 +66,180 @@ CexmcChargeExchangeReconstructorMessenger::
|
||||
useTableMass->SetGuidance( "\n If true then reconstructor will use "
|
||||
"table mass of output\n particle when building output particle "
|
||||
"energy,\n otherwise reconstructed mass will be used" );
|
||||
useTableMass->SetParameterName( "UseTableMass", false );
|
||||
useTableMass->SetDefaultValue( false );
|
||||
useTableMass->SetParameterName( "UseTableMass", true );
|
||||
useTableMass->SetDefaultValue( true );
|
||||
useTableMass->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
useMassCut = new G4UIcmdWithABool(
|
||||
( CexmcMessenger::reconstructorDirName + "useMassCut" ).c_str(), this );
|
||||
useMassCut->SetGuidance( "\n Use elliptical cut for masses of output "
|
||||
"particle\n and nucleus output particle" );
|
||||
useMassCut->SetParameterName( "UseMassCut", false );
|
||||
useMassCut->SetDefaultValue( false );
|
||||
useMassCut->SetParameterName( "UseMassCut", true );
|
||||
useMassCut->SetDefaultValue( true );
|
||||
useMassCut->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
mCutOPCenter = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "mCutOPCenter" ).c_str(),
|
||||
this );
|
||||
mCutOPCenter->SetGuidance( "Center of the ellipse in output particle mass "
|
||||
"coordinate" );
|
||||
mCutOPCenter->SetGuidance( "\n Center of the ellipse in output particle "
|
||||
"mass coordinate" );
|
||||
mCutOPCenter->SetParameterName( "MCutOPCenter", false );
|
||||
mCutOPCenter->SetDefaultValue( reconstructor->GetProductionModelData().
|
||||
outputParticle->GetPDGMass() );
|
||||
mCutOPCenter->SetDefaultUnit( "MeV" );
|
||||
mCutOPCenter->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
mCutOPCenter->SetDefaultUnit( "MeV" );
|
||||
mCutOPCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
mCutNOPCenter = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "mCutNOPCenter" ).c_str(),
|
||||
this );
|
||||
mCutNOPCenter->SetGuidance( "Center of the ellipse in nucleus output "
|
||||
mCutNOPCenter->SetGuidance( "\n Center of the ellipse in nucleus output "
|
||||
"particle mass\n coordinate" );
|
||||
mCutNOPCenter->SetParameterName( "MCutNOPCenter", false );
|
||||
mCutNOPCenter->SetDefaultValue( reconstructor->GetProductionModelData().
|
||||
nucleusOutputParticle->GetPDGMass() );
|
||||
mCutNOPCenter->SetDefaultUnit( "MeV" );
|
||||
mCutNOPCenter->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
mCutNOPCenter->SetDefaultUnit( "MeV" );
|
||||
mCutNOPCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
mCutOPWidth = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "mCutOPWidth" ).c_str(),
|
||||
this );
|
||||
mCutOPWidth->SetGuidance( "Width of the ellipse in output particle mass "
|
||||
"coordinate" );
|
||||
mCutOPWidth->SetGuidance( "\n Width of the ellipse in output particle "
|
||||
"mass coordinate" );
|
||||
mCutOPWidth->SetParameterName( "MCutOPWidth", false );
|
||||
mCutOPWidth->SetDefaultValue( reconstructor->GetProductionModelData().
|
||||
outputParticle->GetPDGMass() * 0.1 );
|
||||
mCutOPWidth->SetDefaultUnit( "MeV" );
|
||||
mCutOPWidth->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
mCutOPWidth->SetDefaultUnit( "MeV" );
|
||||
mCutOPWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
mCutNOPWidth = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "mCutNOPWidth" ).c_str(),
|
||||
this );
|
||||
mCutNOPWidth->SetGuidance( "Width of the ellipse in nucleus output "
|
||||
"particle mass\n coordinate" );
|
||||
mCutNOPWidth->SetGuidance( "\n Width of the ellipse in nucleus output "
|
||||
"particle mass\n coordinate" );
|
||||
mCutNOPWidth->SetParameterName( "MCutNOPWidth", false );
|
||||
mCutNOPWidth->SetDefaultValue( reconstructor->GetProductionModelData().
|
||||
nucleusOutputParticle->GetPDGMass() * 0.1 );
|
||||
mCutNOPWidth->SetDefaultUnit( "MeV" );
|
||||
mCutNOPWidth->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
mCutNOPWidth->SetDefaultUnit( "MeV" );
|
||||
mCutNOPWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
mCutAngle = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "mCutAngle" ).c_str(),
|
||||
this );
|
||||
mCutAngle->SetGuidance( "Angle of the ellipse" );
|
||||
mCutAngle->SetGuidance( "\n Angle of the ellipse" );
|
||||
mCutAngle->SetParameterName( "MCutAngle", false );
|
||||
mCutAngle->SetDefaultValue( 0 );
|
||||
mCutAngle->SetDefaultUnit( "deg" );
|
||||
mCutAngle->SetUnitCandidates( "deg rad" );
|
||||
mCutAngle->SetDefaultUnit( "deg" );
|
||||
mCutAngle->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
useAbsorbedEnergyCut = new G4UIcmdWithABool(
|
||||
( CexmcMessenger::reconstructorDirName + "useAbsorbedEnergyCut" ).
|
||||
c_str(), this );
|
||||
useAbsorbedEnergyCut->SetGuidance( "Use elliptical cut for absorbed "
|
||||
"energies in\n calorimeters" );
|
||||
useAbsorbedEnergyCut->SetParameterName( "UseAbsorbedEnergyCut", false );
|
||||
useAbsorbedEnergyCut->SetDefaultValue( false );
|
||||
useAbsorbedEnergyCut->SetGuidance( "\n Use elliptical cut for absorbed "
|
||||
"energies in\n calorimeters" );
|
||||
useAbsorbedEnergyCut->SetParameterName( "UseAbsorbedEnergyCut", true );
|
||||
useAbsorbedEnergyCut->SetDefaultValue( true );
|
||||
useAbsorbedEnergyCut->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
aeCutCLCenter = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "aeCutCLCenter" ).c_str(),
|
||||
this );
|
||||
aeCutCLCenter->SetGuidance( "Center of the ellipse in left calorimeter"
|
||||
"\n absorbed energy coordinate" );
|
||||
aeCutCLCenter->SetGuidance( "\n Center of the ellipse in left "
|
||||
"calorimeter\n absorbed energy coordinate" );
|
||||
aeCutCLCenter->SetParameterName( "AECutCLCenter", false );
|
||||
aeCutCLCenter->SetDefaultValue( 0 );
|
||||
aeCutCLCenter->SetDefaultUnit( "MeV" );
|
||||
aeCutCLCenter->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
aeCutCLCenter->SetDefaultUnit( "MeV" );
|
||||
aeCutCLCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
aeCutCRCenter = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "aeCutCRCenter" ).c_str(),
|
||||
this );
|
||||
aeCutCRCenter->SetGuidance( "Center of the ellipse in right calorimeter"
|
||||
"\n absorbed energy coordinate" );
|
||||
aeCutCRCenter->SetGuidance( "\n Center of the ellipse in right "
|
||||
"calorimeter\n absorbed energy coordinate" );
|
||||
aeCutCRCenter->SetParameterName( "AECutCRCenter", false );
|
||||
aeCutCRCenter->SetDefaultValue( 0 );
|
||||
aeCutCRCenter->SetDefaultUnit( "MeV" );
|
||||
aeCutCRCenter->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
aeCutCRCenter->SetDefaultUnit( "MeV" );
|
||||
aeCutCRCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
aeCutCLWidth = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "aeCutCLWidth" ).c_str(),
|
||||
this );
|
||||
aeCutCLWidth->SetGuidance( "Width of the ellipse in left calorimeter"
|
||||
"\n absorbed energy coordinate" );
|
||||
aeCutCLWidth->SetGuidance( "\n Width of the ellipse in left calorimeter"
|
||||
"\n absorbed energy coordinate" );
|
||||
aeCutCLWidth->SetParameterName( "AECutCLWidth", false );
|
||||
aeCutCLWidth->SetDefaultValue( 0 );
|
||||
aeCutCLWidth->SetDefaultUnit( "MeV" );
|
||||
aeCutCLWidth->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
aeCutCLWidth->SetDefaultUnit( "MeV" );
|
||||
aeCutCLWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
aeCutCRWidth = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "aeCutCRWidth" ).c_str(),
|
||||
this );
|
||||
aeCutCRWidth->SetGuidance( "Width of the ellipse in right calorimeter"
|
||||
"\n absorbed energy coordinate" );
|
||||
aeCutCRWidth->SetGuidance( "\n Width of the ellipse in right calorimeter"
|
||||
"\n absorbed energy coordinate" );
|
||||
aeCutCRWidth->SetParameterName( "AECutCRWidth", false );
|
||||
aeCutCRWidth->SetDefaultValue( 0 );
|
||||
aeCutCRWidth->SetDefaultUnit( "MeV" );
|
||||
aeCutCRWidth->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
aeCutCRWidth->SetDefaultUnit( "MeV" );
|
||||
aeCutCRWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
aeCutAngle = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "aeCutAngle" ).c_str(),
|
||||
this );
|
||||
aeCutAngle->SetGuidance( "Angle of the ellipse" );
|
||||
aeCutAngle->SetGuidance( "\n Angle of the ellipse" );
|
||||
aeCutAngle->SetParameterName( "AECutAngle", false );
|
||||
aeCutAngle->SetDefaultValue( 0 );
|
||||
aeCutAngle->SetDefaultUnit( "deg" );
|
||||
aeCutAngle->SetUnitCandidates( "deg rad" );
|
||||
aeCutAngle->SetDefaultUnit( "deg" );
|
||||
aeCutAngle->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setExpectedMomentumAmp = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "momentumAmp" ).c_str(),
|
||||
this );
|
||||
setExpectedMomentumAmp->SetGuidance( "\n Momentum of a beam particle "
|
||||
"expected in the target;\n this value may differ from original "
|
||||
"momentum\n of the beam as far as profile data of the beam refer\n"
|
||||
" to the place where it starts. This parameter is used only\n"
|
||||
" in reconstruction procedure");
|
||||
setExpectedMomentumAmp->SetParameterName( "RecMomentumAmp", false );
|
||||
setExpectedMomentumAmp->SetRange( "RecMomentumAmp > 0" );
|
||||
setExpectedMomentumAmp->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
setExpectedMomentumAmp->SetDefaultUnit( "MeV" );
|
||||
setExpectedMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setExpectedMomentumAmpDiff = new G4UIcmdWithADoubleAndUnit(
|
||||
( CexmcMessenger::reconstructorDirName + "momentumAmpDiff" ).c_str(),
|
||||
this );
|
||||
setExpectedMomentumAmpDiff->SetGuidance( "\n Expected difference "
|
||||
"between momenta of the beam\n on its start and in the target. This "
|
||||
"parameter can\n be used to automatically calculate value of the\n"
|
||||
" previous parameter 'momentumAmp'" );
|
||||
setExpectedMomentumAmpDiff->SetParameterName( "RecMomentumAmpDiff", false );
|
||||
setExpectedMomentumAmpDiff->SetDefaultValue( 0 );
|
||||
setExpectedMomentumAmpDiff->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
setExpectedMomentumAmpDiff->SetDefaultUnit( "MeV" );
|
||||
setExpectedMomentumAmpDiff->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
setEDCollectionAlgorithm = new G4UIcmdWithAString(
|
||||
( CexmcMessenger::reconstructorDirName + "edCollectionAlgo" ).c_str(),
|
||||
this );
|
||||
setEDCollectionAlgorithm->SetGuidance(
|
||||
"\n Choose crystals to be selected when energy deposit collected\n"
|
||||
" all - all,\n"
|
||||
" adjacent - crystal with maximum energy deposit and\n"
|
||||
" adjacent crystals" );
|
||||
setEDCollectionAlgorithm->SetParameterName( "EDCollectionAlgo", false );
|
||||
setEDCollectionAlgorithm->SetCandidates( "all adjacent" );
|
||||
setEDCollectionAlgorithm->SetDefaultValue( "all" );
|
||||
setEDCollectionAlgorithm->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
}
|
||||
|
||||
|
||||
@@ -215,6 +259,9 @@ CexmcChargeExchangeReconstructorMessenger::
|
||||
delete aeCutCLWidth;
|
||||
delete aeCutCRWidth;
|
||||
delete aeCutAngle;
|
||||
delete setExpectedMomentumAmp;
|
||||
delete setExpectedMomentumAmpDiff;
|
||||
delete setEDCollectionAlgorithm;
|
||||
}
|
||||
|
||||
|
||||
@@ -301,6 +348,33 @@ void CexmcChargeExchangeReconstructorMessenger::SetNewValue(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
|
||||
break;
|
||||
}
|
||||
if ( cmd == setExpectedMomentumAmp )
|
||||
{
|
||||
reconstructor->SetExpectedMomentumAmp(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
|
||||
break;
|
||||
}
|
||||
if ( cmd == setExpectedMomentumAmpDiff )
|
||||
{
|
||||
reconstructor->SetExpectedMomentumAmpDiff(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
|
||||
break;
|
||||
}
|
||||
if ( cmd == setEDCollectionAlgorithm )
|
||||
{
|
||||
CexmcEDCollectionAlgoritm
|
||||
edCollectionAlgorithm( CexmcCollectEDInAllCrystals );
|
||||
do
|
||||
{
|
||||
if ( value == "adjacent" )
|
||||
{
|
||||
edCollectionAlgorithm = CexmcCollectEDInAdjacentCrystals;
|
||||
break;
|
||||
}
|
||||
} while ( false );
|
||||
reconstructor->SetEDCollectionAlgorithm( edCollectionAlgorithm );
|
||||
break;
|
||||
}
|
||||
} while ( false );
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "CexmcEnergyDepositStore.hh"
|
||||
#include "CexmcTrackPointsStore.hh"
|
||||
|
||||
|
||||
G4Allocator< CexmcTrackPointInfo > trackPointInfoAllocator;
|
||||
G4Allocator< CexmcEnergyDepositStore > energyDepositStoreAllocator;
|
||||
G4Allocator< CexmcTrackPointsStore > trackPointsStoreAllocator;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace CexmcCustomFilter
|
||||
{
|
||||
ast = boost::get< Subtree >( node );
|
||||
}
|
||||
catch( const boost::bad_get & )
|
||||
catch ( const boost::bad_get & )
|
||||
{
|
||||
ast.type = Operator( Top );
|
||||
ast.children.push_back( node );
|
||||
@@ -112,7 +112,7 @@ namespace CexmcCustomFilter
|
||||
* 0) or a unary operator or a function occured */
|
||||
while ( true )
|
||||
{
|
||||
Subtree * candidate = boost::get< Subtree >(
|
||||
Subtree * candidate = boost::get< Subtree >(
|
||||
&astDeepestRight->children[ 0 ] );
|
||||
if ( ! candidate )
|
||||
break;
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include "CexmcSetup.hh"
|
||||
#include "CexmcRunManager.hh"
|
||||
#include "CexmcSensitiveDetectorsAttributes.hh"
|
||||
#include "CexmcCommon.hh"
|
||||
|
||||
|
||||
CexmcEnergyDepositDigitizer::CexmcEnergyDepositDigitizer(
|
||||
@@ -166,7 +165,7 @@ void CexmcEnergyDepositDigitizer::Digitize( void )
|
||||
CexmcDetectorRoleName[ CexmcMonitorDetectorRole ] +
|
||||
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] ) );
|
||||
const CexmcEnergyDepositCollection *
|
||||
hitsCollection( static_cast< const CexmcEnergyDepositCollection* >(
|
||||
hitsCollection( static_cast< const CexmcEnergyDepositCollection * >(
|
||||
digiManager->GetHitsCollection( hcId ) ) );
|
||||
|
||||
if ( hitsCollection )
|
||||
@@ -179,11 +178,11 @@ void CexmcEnergyDepositDigitizer::Digitize( void )
|
||||
hcId = digiManager->GetHitsCollectionID(
|
||||
CexmcDetectorRoleName[ CexmcVetoCounterDetectorRole ] +
|
||||
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] );
|
||||
hitsCollection = static_cast< const CexmcEnergyDepositCollection* >(
|
||||
hitsCollection = static_cast< const CexmcEnergyDepositCollection * >(
|
||||
digiManager->GetHitsCollection( hcId ) );
|
||||
if ( hitsCollection )
|
||||
{
|
||||
for ( std::map< G4int, G4double* >::iterator
|
||||
for ( CexmcEnergyDepositCollectionData::iterator
|
||||
k( hitsCollection->GetMap()->begin() );
|
||||
k != hitsCollection->GetMap()->end(); ++k )
|
||||
{
|
||||
@@ -217,11 +216,11 @@ void CexmcEnergyDepositDigitizer::Digitize( void )
|
||||
hcId = digiManager->GetHitsCollectionID(
|
||||
CexmcDetectorRoleName[ CexmcCalorimeterDetectorRole ] +
|
||||
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] );
|
||||
hitsCollection = static_cast< const CexmcEnergyDepositCollection* >(
|
||||
hitsCollection = static_cast< const CexmcEnergyDepositCollection * >(
|
||||
digiManager->GetHitsCollection( hcId ) );
|
||||
if ( hitsCollection )
|
||||
{
|
||||
for ( std::map< G4int, G4double* >::iterator
|
||||
for ( CexmcEnergyDepositCollectionData::iterator
|
||||
k( hitsCollection->GetMap()->begin() );
|
||||
k != hitsCollection->GetMap()->end(); ++k )
|
||||
{
|
||||
|
||||
@@ -70,8 +70,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
setMonitorThreshold->SetGuidance( "Monitor trigger threshold" );
|
||||
setMonitorThreshold->SetParameterName( "MonitorThreshold", false );
|
||||
setMonitorThreshold->SetDefaultValue( 0 );
|
||||
setMonitorThreshold->SetDefaultUnit( "MeV" );
|
||||
setMonitorThreshold->SetUnitCandidates( "ev keV MeV GeV" );
|
||||
setMonitorThreshold->SetDefaultUnit( "MeV" );
|
||||
setMonitorThreshold->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setVetoCountersThreshold = new G4UIcmdWithADoubleAndUnit(
|
||||
@@ -81,8 +81,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
setVetoCountersThreshold->SetParameterName( "VetoCountersThreshold",
|
||||
false );
|
||||
setVetoCountersThreshold->SetDefaultValue( 0 );
|
||||
setVetoCountersThreshold->SetDefaultUnit( "MeV" );
|
||||
setVetoCountersThreshold->SetUnitCandidates( "ev keV MeV GeV" );
|
||||
setVetoCountersThreshold->SetDefaultUnit( "MeV" );
|
||||
setVetoCountersThreshold->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -94,8 +94,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
setLeftVetoCounterThreshold->SetParameterName( "LeftVetoCounterThreshold",
|
||||
false );
|
||||
setLeftVetoCounterThreshold->SetDefaultValue( 0 );
|
||||
setLeftVetoCounterThreshold->SetDefaultUnit( "MeV" );
|
||||
setLeftVetoCounterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
|
||||
setLeftVetoCounterThreshold->SetDefaultUnit( "MeV" );
|
||||
setLeftVetoCounterThreshold->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -107,8 +107,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
setRightVetoCounterThreshold->SetParameterName( "RightVetoCounterThreshold",
|
||||
false );
|
||||
setRightVetoCounterThreshold->SetDefaultValue( 0 );
|
||||
setRightVetoCounterThreshold->SetDefaultUnit( "MeV" );
|
||||
setRightVetoCounterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
|
||||
setRightVetoCounterThreshold->SetDefaultUnit( "MeV" );
|
||||
setRightVetoCounterThreshold->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -119,8 +119,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
setCalorimetersThreshold->SetParameterName( "CalorimetersThreshold",
|
||||
false );
|
||||
setCalorimetersThreshold->SetDefaultValue( 0 );
|
||||
setCalorimetersThreshold->SetDefaultUnit( "MeV" );
|
||||
setCalorimetersThreshold->SetUnitCandidates( "ev keV MeV GeV" );
|
||||
setCalorimetersThreshold->SetDefaultUnit( "MeV" );
|
||||
setCalorimetersThreshold->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -132,8 +132,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
setLeftCalorimeterThreshold->SetParameterName( "LeftCalorimeterThreshold",
|
||||
false );
|
||||
setLeftCalorimeterThreshold->SetDefaultValue( 0 );
|
||||
setLeftCalorimeterThreshold->SetDefaultUnit( "MeV" );
|
||||
setLeftCalorimeterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
|
||||
setLeftCalorimeterThreshold->SetDefaultUnit( "MeV" );
|
||||
setLeftCalorimeterThreshold->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -145,8 +145,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
setRightCalorimeterThreshold->SetParameterName( "RightCalorimeterThreshold",
|
||||
false );
|
||||
setRightCalorimeterThreshold->SetDefaultValue( 0 );
|
||||
setRightCalorimeterThreshold->SetDefaultUnit( "MeV" );
|
||||
setRightCalorimeterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
|
||||
setRightCalorimeterThreshold->SetDefaultUnit( "MeV" );
|
||||
setRightCalorimeterThreshold->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -162,8 +162,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
"value" );
|
||||
setCalorimeterTriggerAlgorithm->SetParameterName(
|
||||
"CalorimeterTriggerAlgorithm", false );
|
||||
setCalorimeterTriggerAlgorithm->SetDefaultValue( "inner" );
|
||||
setCalorimeterTriggerAlgorithm->SetCandidates( "all inner" );
|
||||
setCalorimeterTriggerAlgorithm->SetDefaultValue( "inner" );
|
||||
setCalorimeterTriggerAlgorithm->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -179,8 +179,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
"value of\n 'outerCrystalsVetoFraction'" );
|
||||
setOuterCrystalsVetoAlgorithm->SetParameterName(
|
||||
"OuterCrystalsVetoAlgorithm", false );
|
||||
setOuterCrystalsVetoAlgorithm->SetDefaultValue( "none" );
|
||||
setOuterCrystalsVetoAlgorithm->SetCandidates( "none max fraction" );
|
||||
setOuterCrystalsVetoAlgorithm->SetDefaultValue( "none" );
|
||||
setOuterCrystalsVetoAlgorithm->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -204,8 +204,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
|
||||
applyFiniteCrystalResolution->SetGuidance( "\n Specify if finite "
|
||||
"energy resolution of the crystals\n will be accounted" );
|
||||
applyFiniteCrystalResolution->SetParameterName(
|
||||
"ApplyFiniteCrystalResolution", false );
|
||||
applyFiniteCrystalResolution->SetDefaultValue( false );
|
||||
"ApplyFiniteCrystalResolution", true );
|
||||
applyFiniteCrystalResolution->SetDefaultValue( true );
|
||||
applyFiniteCrystalResolution->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -302,7 +302,7 @@ void CexmcEnergyDepositDigitizerMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
}
|
||||
if ( cmd == setCalorimeterTriggerAlgorithm )
|
||||
{
|
||||
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm(
|
||||
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm(
|
||||
CexmcAllCrystalsMakeEDTriggerThreshold );
|
||||
do
|
||||
{
|
||||
@@ -319,7 +319,7 @@ void CexmcEnergyDepositDigitizerMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
}
|
||||
if ( cmd == setOuterCrystalsVetoAlgorithm )
|
||||
{
|
||||
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm(
|
||||
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm(
|
||||
CexmcNoOuterCrystalsVeto );
|
||||
do
|
||||
{
|
||||
|
||||
@@ -51,9 +51,6 @@
|
||||
#include "CexmcSetup.hh"
|
||||
|
||||
|
||||
G4int CexmcEnergyDepositInCalorimeter::copyDepth1BitsOffset( 8 );
|
||||
|
||||
|
||||
CexmcEnergyDepositInCalorimeter::CexmcEnergyDepositInCalorimeter(
|
||||
const G4String & name, const CexmcSetup * setup ) :
|
||||
CexmcEnergyDepositInLeftRightSet( name, setup )
|
||||
@@ -88,13 +85,11 @@ void CexmcEnergyDepositInCalorimeter::PrintAll( void )
|
||||
if ( nmbOfEntries == 0 )
|
||||
return;
|
||||
|
||||
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
|
||||
G4cout << " PrimitiveScorer " << GetName() << G4endl;
|
||||
G4cout << " Number of entries " << nmbOfEntries << G4endl;
|
||||
PrintHeader( nmbOfEntries );
|
||||
|
||||
for( std::map< G4int, G4double* >::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
for ( CexmcEnergyDepositCollectionData::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
{
|
||||
G4bool isRightDetector( itr->first >> leftRightBitsOffset );
|
||||
G4int index( itr->first &
|
||||
|
||||
@@ -51,9 +51,6 @@
|
||||
#include "CexmcSetup.hh"
|
||||
|
||||
|
||||
G4int CexmcEnergyDepositInLeftRightSet::leftRightBitsOffset( 16 );
|
||||
|
||||
|
||||
CexmcEnergyDepositInLeftRightSet::CexmcEnergyDepositInLeftRightSet(
|
||||
const G4String & name, const CexmcSetup * setup ) :
|
||||
CexmcSimpleEnergyDeposit( name ), setup( setup )
|
||||
@@ -81,13 +78,11 @@ void CexmcEnergyDepositInLeftRightSet::PrintAll( void )
|
||||
if ( nmbOfEntries == 0 )
|
||||
return;
|
||||
|
||||
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
|
||||
G4cout << " PrimitiveScorer " << GetName() << G4endl;
|
||||
G4cout << " Number of entries " << nmbOfEntries << G4endl;
|
||||
PrintHeader( nmbOfEntries );
|
||||
|
||||
for( std::map< G4int, G4double* >::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
for ( CexmcEnergyDepositCollectionData::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
{
|
||||
G4bool isRightDetector( itr->first >> leftRightBitsOffset );
|
||||
const G4String detectorSide( isRightDetector ? "right" : "left" );
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#ifdef CEXMC_USE_PERSISTENCY
|
||||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#endif
|
||||
@@ -59,10 +60,8 @@
|
||||
#include "CexmcEventFastSObject.hh"
|
||||
#include "CexmcTrackingAction.hh"
|
||||
#include "CexmcChargeExchangeReconstructor.hh"
|
||||
#ifdef CEXMC_USE_ROOT
|
||||
#include "CexmcHistoManager.hh"
|
||||
#endif
|
||||
#include "CexmcRunManager.hh"
|
||||
#include "CexmcHistoManager.hh"
|
||||
#include "CexmcRun.hh"
|
||||
#include "CexmcPhysicsManager.hh"
|
||||
#include "CexmcProductionModel.hh"
|
||||
@@ -82,13 +81,19 @@ namespace
|
||||
G4double CexmcBigCircleScreenSize( 10.0 );
|
||||
G4Colour CexmcTrackPointsMarkerColour( 0.0, 1.0, 0.4 );
|
||||
G4Colour CexmcRecTrackPointsMarkerColour( 1.0, 0.4, 0.0 );
|
||||
|
||||
|
||||
inline G4double CexmcGetKinEnergy( G4double momentumAmp, G4double mass )
|
||||
{
|
||||
return std::sqrt( momentumAmp * momentumAmp + mass * mass ) - mass;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CexmcEventAction::CexmcEventAction( CexmcPhysicsManager * physicsManager,
|
||||
G4int verbose ) :
|
||||
physicsManager( physicsManager ), reconstructor( NULL ), verbose( verbose ),
|
||||
verboseDraw( 4 ), messenger( NULL )
|
||||
physicsManager( physicsManager ), reconstructor( NULL ), opKinEnergy( 0. ),
|
||||
verbose( verbose ), verboseDraw( 4 ), messenger( NULL )
|
||||
{
|
||||
G4DigiManager * digiManager( G4DigiManager::GetDMpointer() );
|
||||
digiManager->AddNewModule( new CexmcEnergyDepositDigitizer(
|
||||
@@ -128,7 +133,7 @@ void CexmcEventAction::BeginOfEventAction( const G4Event * )
|
||||
|
||||
|
||||
CexmcEnergyDepositStore * CexmcEventAction::MakeEnergyDepositStore(
|
||||
const CexmcEnergyDepositDigitizer * digitizer, G4bool useInnerRefCrystal )
|
||||
const CexmcEnergyDepositDigitizer * digitizer )
|
||||
{
|
||||
G4double monitorED( digitizer->GetMonitorED() );
|
||||
G4double vetoCounterEDLeft( digitizer->GetVetoCounterEDLeft() );
|
||||
@@ -139,18 +144,12 @@ CexmcEnergyDepositStore * CexmcEventAction::MakeEnergyDepositStore(
|
||||
G4int calorimeterEDLeftMaxY( digitizer->GetCalorimeterEDLeftMaxY() );
|
||||
G4int calorimeterEDRightMaxX( digitizer->GetCalorimeterEDRightMaxX() );
|
||||
G4int calorimeterEDRightMaxY( digitizer->GetCalorimeterEDRightMaxY() );
|
||||
if ( useInnerRefCrystal )
|
||||
{
|
||||
digitizer->TransformToAdjacentInnerCrystal( calorimeterEDLeftMaxX,
|
||||
calorimeterEDLeftMaxY );
|
||||
digitizer->TransformToAdjacentInnerCrystal( calorimeterEDRightMaxX,
|
||||
calorimeterEDRightMaxY );
|
||||
}
|
||||
|
||||
const CexmcEnergyDepositCalorimeterCollection &
|
||||
calorimeterEDLeftCollection(
|
||||
calorimeterEDLeftCollection(
|
||||
digitizer->GetCalorimeterEDLeftCollection() );
|
||||
const CexmcEnergyDepositCalorimeterCollection &
|
||||
calorimeterEDRightCollection(
|
||||
calorimeterEDRightCollection(
|
||||
digitizer->GetCalorimeterEDRightCollection() );
|
||||
|
||||
/* ATTENTION: return object in heap - must be freed by caller! */
|
||||
@@ -266,8 +265,8 @@ void CexmcEventAction::PrintProductionModelData(
|
||||
|
||||
|
||||
void CexmcEventAction::PrintReconstructedData(
|
||||
const CexmcAngularRangeList & triggeredRecAngularRanges,
|
||||
const CexmcAngularRange & angularGap ) const
|
||||
const CexmcAngularRangeList & triggeredRecAngularRanges,
|
||||
const CexmcAngularRange & angularGap ) const
|
||||
{
|
||||
G4cout << " --- Reconstructed data: " << G4endl;
|
||||
G4cout << " -- entry points:" << G4endl;
|
||||
@@ -352,6 +351,11 @@ void CexmcEventAction::FillTPTHistos( const CexmcTrackPointsStore * tpStore,
|
||||
tpStore->targetTPOutputParticle.positionLocal.x(),
|
||||
tpStore->targetTPOutputParticle.positionLocal.y(),
|
||||
tpStore->targetTPOutputParticle.positionLocal.z() );
|
||||
if ( histoManager->GetVerboseLevel() > 0 )
|
||||
{
|
||||
histoManager->Add( CexmcMomentumIP_TPT_Histo, 0,
|
||||
pmData.incidentParticleLAB.rho() );
|
||||
}
|
||||
}
|
||||
|
||||
for ( CexmcAngularRangeList::const_iterator
|
||||
@@ -377,16 +381,10 @@ void CexmcEventAction::FillTPTHistos( const CexmcTrackPointsStore * tpStore,
|
||||
tpStore->targetTPOutputParticle.positionLocal.x(),
|
||||
tpStore->targetTPOutputParticle.positionLocal.y(),
|
||||
tpStore->targetTPOutputParticle.positionLocal.z() );
|
||||
G4double momentumAmp(
|
||||
tpStore->targetTPOutputParticle.momentumAmp );
|
||||
G4double mass( tpStore->targetTPOutputParticle.particle->
|
||||
GetPDGMass() );
|
||||
G4double kinEnergy( std::sqrt( momentumAmp * momentumAmp +
|
||||
mass * mass ) -mass );
|
||||
histoManager->Add( CexmcKinEnOP_LAB_ARReal_TPT_Histo,
|
||||
k->index, kinEnergy );
|
||||
histoManager->Add( CexmcAngleOP_SCM_ARReal_TPT_Histo,
|
||||
k->index, pmData.outputParticleSCM.cosTheta() );
|
||||
histoManager->Add( CexmcKinEnOP_LAB_ARReal_TPT_Histo, k->index,
|
||||
opKinEnergy );
|
||||
histoManager->Add( CexmcAngleOP_SCM_ARReal_TPT_Histo, k->index,
|
||||
pmData.outputParticleSCM.cosTheta() );
|
||||
}
|
||||
if ( tpStore->targetTPOutputParticleDecayProductParticle1.IsValid() &&
|
||||
tpStore->targetTPOutputParticleDecayProductParticle2.IsValid() )
|
||||
@@ -396,8 +394,8 @@ void CexmcEventAction::FillTPTHistos( const CexmcTrackPointsStore * tpStore,
|
||||
directionWorld.angle( tpStore->
|
||||
targetTPOutputParticleDecayProductParticle2.
|
||||
directionWorld ) / deg );
|
||||
histoManager->Add( CexmcOpenAngle_ARReal_TPT_Histo,
|
||||
k->index, openAngle );
|
||||
histoManager->Add( CexmcOpenAngle_ARReal_TPT_Histo, k->index,
|
||||
openAngle );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,20 +500,14 @@ void CexmcEventAction::FillRTHistos( G4bool reconstructorHasFullTrigger,
|
||||
tpStore->targetTPOutputParticle.positionLocal.x(),
|
||||
tpStore->targetTPOutputParticle.positionLocal.y(),
|
||||
tpStore->targetTPOutputParticle.positionLocal.z() );
|
||||
G4double momentumAmp(
|
||||
tpStore->targetTPOutputParticle.momentumAmp );
|
||||
G4double mass( tpStore->targetTPOutputParticle.particle->
|
||||
GetPDGMass() );
|
||||
G4double kinEnergy( std::sqrt( momentumAmp * momentumAmp +
|
||||
mass * mass ) -mass );
|
||||
histoManager->Add( CexmcKinEnOP_LAB_ARReal_RT_Histo,
|
||||
k->index, kinEnergy );
|
||||
histoManager->Add( CexmcAngleOP_SCM_ARReal_RT_Histo,
|
||||
k->index, pmData.outputParticleSCM.cosTheta() );
|
||||
histoManager->Add( CexmcKinEnOP_LAB_ARReal_RT_Histo, k->index,
|
||||
opKinEnergy );
|
||||
histoManager->Add( CexmcAngleOP_SCM_ARReal_RT_Histo, k->index,
|
||||
pmData.outputParticleSCM.cosTheta() );
|
||||
G4double diffCosTheta( pmData.outputParticleSCM.cosTheta() -
|
||||
recCosTheta );
|
||||
histoManager->Add( CexmcDiffAngleOP_SCM_ARReal_RT_Histo,
|
||||
k->index, diffCosTheta );
|
||||
histoManager->Add( CexmcDiffAngleOP_SCM_ARReal_RT_Histo, k->index,
|
||||
diffCosTheta );
|
||||
}
|
||||
if ( tpStore->targetTPOutputParticleDecayProductParticle1.IsValid() &&
|
||||
tpStore->targetTPOutputParticleDecayProductParticle2.IsValid() )
|
||||
@@ -525,12 +517,12 @@ void CexmcEventAction::FillRTHistos( G4bool reconstructorHasFullTrigger,
|
||||
directionWorld.angle( tpStore->
|
||||
targetTPOutputParticleDecayProductParticle2.
|
||||
directionWorld ) / deg );
|
||||
histoManager->Add( CexmcOpenAngle_ARReal_RT_Histo,
|
||||
k->index, openAngle );
|
||||
histoManager->Add( CexmcOpenAngle_ARReal_RT_Histo, k->index,
|
||||
openAngle );
|
||||
G4double diffOpenAngle( openAngle - reconstructor->GetTheAngle() /
|
||||
deg );
|
||||
histoManager->Add( CexmcDiffOpenAngle_ARReal_RT_Histo,
|
||||
k->index, diffOpenAngle );
|
||||
histoManager->Add( CexmcDiffOpenAngle_ARReal_RT_Histo, k->index,
|
||||
diffOpenAngle );
|
||||
}
|
||||
if ( tpStore->calorimeterTPLeft.IsValid() )
|
||||
{
|
||||
@@ -583,12 +575,10 @@ void CexmcEventAction::DrawTrajectories( const G4Event * event )
|
||||
|
||||
nTraj = trajContainer->entries();
|
||||
|
||||
G4int drawMode( drawTrajectoryMarkers ? 1000 : 0 );
|
||||
|
||||
for ( int i( 0 ); i < nTraj; ++i )
|
||||
{
|
||||
G4VTrajectory * traj( ( *trajContainer )[ i ] );
|
||||
traj->DrawTrajectory( drawMode );
|
||||
traj->DrawTrajectory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,7 +739,7 @@ void CexmcEventAction::SaveEvent( const G4Event * event,
|
||||
runManager->GetEventsArchive() );
|
||||
if ( archive )
|
||||
{
|
||||
CexmcEventSObject sObject( event->GetEventID(),
|
||||
CexmcEventSObject sObject = { event->GetEventID(),
|
||||
edDigitizerHasTriggered, edStore->monitorED,
|
||||
edStore->vetoCounterEDLeft, edStore->vetoCounterEDRight,
|
||||
edStore->calorimeterEDLeft, edStore->calorimeterEDRight,
|
||||
@@ -760,7 +750,7 @@ void CexmcEventAction::SaveEvent( const G4Event * event,
|
||||
tpStore->targetTPOutputParticleDecayProductParticle1,
|
||||
tpStore->targetTPOutputParticleDecayProductParticle2,
|
||||
tpStore->vetoCounterTPLeft, tpStore->vetoCounterTPRight,
|
||||
tpStore->calorimeterTPLeft, tpStore->calorimeterTPRight, pmData );
|
||||
tpStore->calorimeterTPLeft, tpStore->calorimeterTPRight, pmData };
|
||||
archive->operator<<( sObject );
|
||||
const CexmcRun * run( static_cast< const CexmcRun * >(
|
||||
runManager->GetCurrentRun() ) );
|
||||
@@ -791,9 +781,9 @@ void CexmcEventAction::SaveEventFast( const G4Event * event,
|
||||
if ( ! tpDigitizerHasTriggered )
|
||||
opCosThetaSCM = CexmcInvalidCosTheta;
|
||||
|
||||
CexmcEventFastSObject sObject( event->GetEventID(), opCosThetaSCM,
|
||||
edDigitizerHasTriggered,
|
||||
edDigitizerMonitorHasTriggered );
|
||||
CexmcEventFastSObject sObject = { event->GetEventID(), opCosThetaSCM,
|
||||
edDigitizerHasTriggered,
|
||||
edDigitizerMonitorHasTriggered };
|
||||
archive->operator<<( sObject );
|
||||
const CexmcRun * run( static_cast< const CexmcRun * >(
|
||||
runManager->GetCurrentRun() ) );
|
||||
@@ -809,10 +799,10 @@ void CexmcEventAction::EndOfEventAction( const G4Event * event )
|
||||
{
|
||||
G4DigiManager * digiManager( G4DigiManager::GetDMpointer() );
|
||||
CexmcEnergyDepositDigitizer * energyDepositDigitizer(
|
||||
static_cast< CexmcEnergyDepositDigitizer* >( digiManager->
|
||||
static_cast< CexmcEnergyDepositDigitizer * >( digiManager->
|
||||
FindDigitizerModule( CexmcEDDigitizerName ) ) );
|
||||
CexmcTrackPointsDigitizer * trackPointsDigitizer(
|
||||
static_cast< CexmcTrackPointsDigitizer* >( digiManager->
|
||||
CexmcTrackPointsDigitizer * trackPointsDigitizer(
|
||||
static_cast< CexmcTrackPointsDigitizer * >( digiManager->
|
||||
FindDigitizerModule( CexmcTPDigitizerName ) ) );
|
||||
|
||||
energyDepositDigitizer->Digitize();
|
||||
@@ -832,10 +822,9 @@ void CexmcEventAction::EndOfEventAction( const G4Event * event )
|
||||
G4bool reconstructorHasFullTrigger( false );
|
||||
|
||||
CexmcEnergyDepositStore * edStore( MakeEnergyDepositStore(
|
||||
energyDepositDigitizer,
|
||||
reconstructor->IsInnerRefCrystalUsed() ) );
|
||||
energyDepositDigitizer ) );
|
||||
CexmcTrackPointsStore * tpStore( MakeTrackPointsStore(
|
||||
trackPointsDigitizer ) );
|
||||
trackPointsDigitizer ) );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -845,9 +834,9 @@ void CexmcEventAction::EndOfEventAction( const G4Event * event )
|
||||
if ( ! productionModel )
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
const CexmcAngularRangeList & angularRanges(
|
||||
const CexmcAngularRangeList & angularRanges(
|
||||
productionModel->GetAngularRanges() );
|
||||
const CexmcAngularRangeList & triggeredAngularRanges(
|
||||
const CexmcAngularRangeList & triggeredAngularRanges(
|
||||
productionModel->GetTriggeredAngularRanges() );
|
||||
const CexmcProductionModelData & pmData(
|
||||
productionModel->GetProductionModelData() );
|
||||
@@ -950,21 +939,25 @@ void CexmcEventAction::EndOfEventAction( const G4Event * event )
|
||||
#endif
|
||||
|
||||
#ifdef CEXMC_USE_ROOT
|
||||
if ( edDigitizerHasTriggered )
|
||||
/* opKinEnergy will be used in several histos */
|
||||
if ( tpStore->targetTPOutputParticle.IsValid() )
|
||||
{
|
||||
FillEDTHistos( edStore, triggeredAngularRanges );
|
||||
opKinEnergy = CexmcGetKinEnergy(
|
||||
tpStore->targetTPOutputParticle.momentumAmp,
|
||||
tpStore->targetTPOutputParticle.particle->GetPDGMass() );
|
||||
}
|
||||
|
||||
if ( tpDigitizerHasTriggered )
|
||||
{
|
||||
if ( edDigitizerHasTriggered )
|
||||
FillEDTHistos( edStore, triggeredAngularRanges );
|
||||
|
||||
/* fill TPT histos only when the monitor has triggered because events
|
||||
* when it was missed have less value for us */
|
||||
if ( tpDigitizerHasTriggered && edDigitizerMonitorHasTriggered )
|
||||
FillTPTHistos( tpStore, pmData, triggeredAngularRanges );
|
||||
}
|
||||
|
||||
if ( reconstructorHasBasicTrigger )
|
||||
{
|
||||
FillRTHistos( reconstructorHasFullTrigger, edStore, tpStore,
|
||||
pmData, triggeredAngularRanges );
|
||||
}
|
||||
#endif
|
||||
|
||||
G4Event * theEvent( const_cast< G4Event * >( event ) );
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
*/
|
||||
|
||||
#include <G4UIcmdWithAnInteger.hh>
|
||||
#include <G4UIcmdWithABool.hh>
|
||||
#include "CexmcEventActionMessenger.hh"
|
||||
#include "CexmcEventAction.hh"
|
||||
#include "CexmcMessenger.hh"
|
||||
@@ -51,7 +50,7 @@
|
||||
CexmcEventActionMessenger::CexmcEventActionMessenger(
|
||||
CexmcEventAction * eventAction ) :
|
||||
eventAction( eventAction ), setVerboseLevel( NULL ),
|
||||
setVerboseDrawLevel( NULL ), drawTrajectoryMarkers( NULL )
|
||||
setVerboseDrawLevel( NULL )
|
||||
{
|
||||
setVerboseLevel = new G4UIcmdWithAnInteger(
|
||||
( CexmcMessenger::eventDirName + "verbose" ).c_str() , this );
|
||||
@@ -65,8 +64,8 @@ CexmcEventActionMessenger::CexmcEventActionMessenger(
|
||||
"event\n triggered,\n"
|
||||
" 4 - print messages on every event" );
|
||||
setVerboseLevel->SetParameterName( "Verbose", false );
|
||||
setVerboseLevel->SetDefaultValue( 0 );
|
||||
setVerboseLevel->SetRange( "Verbose >= 0 && Verbose <= 4" );
|
||||
setVerboseLevel->SetDefaultValue( 0 );
|
||||
setVerboseLevel->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setVerboseDrawLevel = new G4UIcmdWithAnInteger(
|
||||
@@ -84,17 +83,9 @@ CexmcEventActionMessenger::CexmcEventActionMessenger(
|
||||
" 4 - draw trajectories and/or track points on "
|
||||
"every event" );
|
||||
setVerboseDrawLevel->SetParameterName( "VerboseDraw", false );
|
||||
setVerboseDrawLevel->SetDefaultValue( 4 );
|
||||
setVerboseDrawLevel->SetRange( "VerboseDraw >= 0 && VerboseDraw <= 4" );
|
||||
setVerboseDrawLevel->SetDefaultValue( 4 );
|
||||
setVerboseDrawLevel->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
drawTrajectoryMarkers = new G4UIcmdWithABool(
|
||||
( CexmcMessenger::visDirName + "drawTrajMarkers" ).c_str() , this );
|
||||
drawTrajectoryMarkers->SetGuidance( "draw markers in places where "
|
||||
"trajectories change" );
|
||||
drawTrajectoryMarkers->SetParameterName( "DrawTrajMarkers", false );
|
||||
drawTrajectoryMarkers->SetDefaultValue( false );
|
||||
drawTrajectoryMarkers->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +93,6 @@ CexmcEventActionMessenger::~CexmcEventActionMessenger()
|
||||
{
|
||||
delete setVerboseLevel;
|
||||
delete setVerboseDrawLevel;
|
||||
delete drawTrajectoryMarkers;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,12 +113,6 @@ void CexmcEventActionMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4UIcmdWithAnInteger::GetNewIntValue( value ) );
|
||||
break;
|
||||
}
|
||||
if ( cmd == drawTrajectoryMarkers )
|
||||
{
|
||||
eventAction->DrawTrajectoryMarkers(
|
||||
G4UIcmdWithABool::GetNewBoolValue( value ) );
|
||||
break;
|
||||
}
|
||||
} while ( false );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* ============================================================================
|
||||
*
|
||||
* Filename: CexmcEventSObject.cc
|
||||
*
|
||||
* Description: event data serialization helper
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 30.12.2009 17:10:25
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Alexey Radkov (),
|
||||
* Company: PNPI
|
||||
*
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
#ifdef CEXMC_USE_PERSISTENCY
|
||||
|
||||
#include "CexmcEventSObject.hh"
|
||||
#include "CexmcTrackPointInfo.hh"
|
||||
|
||||
|
||||
CexmcEventSObject::CexmcEventSObject() : edDigitizerMonitorHasTriggered( true )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CexmcEventSObject::CexmcEventSObject( G4int eventId,
|
||||
G4bool edDigitizerMonitorHasTriggered, G4double monitorED,
|
||||
G4double vetoCounterEDLeft, G4double vetoCounterEDRight,
|
||||
G4double calorimeterEDLeft, G4double calorimeterEDRight,
|
||||
const CexmcEnergyDepositCalorimeterCollection &
|
||||
calorimeterEDLeftCollection,
|
||||
const CexmcEnergyDepositCalorimeterCollection &
|
||||
calorimeterEDRightCollection,
|
||||
const CexmcTrackPointInfo & monitorTP,
|
||||
const CexmcTrackPointInfo & targetTPBeamParticle,
|
||||
const CexmcTrackPointInfo & targetTPOutputParticle,
|
||||
const CexmcTrackPointInfo & targetTPNucleusParticle,
|
||||
const CexmcTrackPointInfo &
|
||||
targetTPOutputParticleDecayProductParticle1,
|
||||
const CexmcTrackPointInfo &
|
||||
targetTPOutputParticleDecayProductParticle2,
|
||||
const CexmcTrackPointInfo & vetoCounterTPLeft,
|
||||
const CexmcTrackPointInfo & vetoCounterTPRight,
|
||||
const CexmcTrackPointInfo & calorimeterTPLeft,
|
||||
const CexmcTrackPointInfo & calorimeterTPRight,
|
||||
const CexmcProductionModelData & productionModelData ) :
|
||||
eventId( eventId ),
|
||||
edDigitizerMonitorHasTriggered( edDigitizerMonitorHasTriggered ),
|
||||
monitorED( monitorED ), vetoCounterEDLeft( vetoCounterEDLeft ),
|
||||
vetoCounterEDRight( vetoCounterEDRight ),
|
||||
calorimeterEDLeft( calorimeterEDLeft ),
|
||||
calorimeterEDRight( calorimeterEDRight ),
|
||||
calorimeterEDLeftCollection( calorimeterEDLeftCollection ),
|
||||
calorimeterEDRightCollection( calorimeterEDRightCollection ),
|
||||
monitorTP( monitorTP ), targetTPBeamParticle( targetTPBeamParticle ),
|
||||
targetTPOutputParticle( targetTPOutputParticle ),
|
||||
targetTPNucleusParticle( targetTPNucleusParticle ),
|
||||
targetTPOutputParticleDecayProductParticle1(
|
||||
targetTPOutputParticleDecayProductParticle1 ),
|
||||
targetTPOutputParticleDecayProductParticle2(
|
||||
targetTPOutputParticleDecayProductParticle2 ),
|
||||
vetoCounterTPLeft( vetoCounterTPLeft ),
|
||||
vetoCounterTPRight( vetoCounterTPRight ),
|
||||
calorimeterTPLeft( calorimeterTPLeft ),
|
||||
calorimeterTPRight( calorimeterTPRight ),
|
||||
productionModelData( productionModelData )
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -70,9 +70,9 @@ CexmcHadronicProcess::~CexmcHadronicProcess()
|
||||
|
||||
|
||||
void CexmcHadronicProcess::RegisterProductionModel(
|
||||
CexmcProductionModel * productionModel_ )
|
||||
CexmcProductionModel * model )
|
||||
{
|
||||
productionModel = productionModel_;
|
||||
productionModel = model;
|
||||
|
||||
interaction = dynamic_cast< G4HadronicInteraction * >( productionModel );
|
||||
|
||||
@@ -122,7 +122,7 @@ void CexmcHadronicProcess::FillTotalResult( G4HadFinalState * hadFinalState,
|
||||
if ( hadFinalState->GetStatusChange() == stopAndKill )
|
||||
theTotalResult->ProposeTrackStatus( fStopAndKill );
|
||||
|
||||
for( G4int i( 0 ); i < numberOfSecondaries; ++i )
|
||||
for ( G4int i( 0 ); i < numberOfSecondaries; ++i )
|
||||
{
|
||||
G4double time( hadFinalState->GetSecondary( i )->GetTime() );
|
||||
if ( time < 0 )
|
||||
|
||||
@@ -116,7 +116,7 @@ void CexmcHistoManager::Destroy( void )
|
||||
|
||||
CexmcHistoManager::CexmcHistoManager() : outFile( NULL ),
|
||||
isInitialized( false ), opName( "" ), nopName( "" ), opMass( 0. ),
|
||||
nopMass( 0. ),
|
||||
nopMass( 0. ), verboseLevel( 0 ),
|
||||
#ifdef CEXMC_USE_ROOTQT
|
||||
rootCanvas( NULL ),
|
||||
#endif
|
||||
@@ -128,7 +128,7 @@ CexmcHistoManager::CexmcHistoManager() : outFile( NULL ),
|
||||
CexmcHistoVector() ) );
|
||||
}
|
||||
|
||||
messenger = new CexmcHistoManagerMessenger;
|
||||
messenger = new CexmcHistoManagerMessenger( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ void CexmcHistoManager::AddHisto( const CexmcHistoData & data,
|
||||
CexmcHistosMap::iterator found( histos.find( data.type ) );
|
||||
|
||||
if ( found == histos.end() )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
CexmcHistoVector & histoVector( found->second );
|
||||
|
||||
@@ -286,13 +286,13 @@ void CexmcHistoManager::Initialize( void )
|
||||
CexmcPhysicsManager * physicsManager( runManager->GetPhysicsManager() );
|
||||
|
||||
if ( ! physicsManager )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
CexmcProductionModel * productionModel( physicsManager->
|
||||
GetProductionModel() );
|
||||
|
||||
if ( ! productionModel )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
G4ParticleDefinition * outputParticle(
|
||||
productionModel->GetOutputParticle() );
|
||||
@@ -300,7 +300,7 @@ void CexmcHistoManager::Initialize( void )
|
||||
productionModel->GetNucleusOutputParticle() );
|
||||
|
||||
if ( ! outputParticle || ! nucleusOutputParticle )
|
||||
throw CexmcException ( CexmcIncompleteProductionModel );
|
||||
throw CexmcException( CexmcIncompleteProductionModel );
|
||||
|
||||
opName = outputParticle->GetParticleName();
|
||||
nopName = nucleusOutputParticle->GetParticleName();
|
||||
@@ -327,12 +327,12 @@ void CexmcHistoManager::Initialize( void )
|
||||
const CexmcSetup * setup( static_cast< const CexmcSetup * >(
|
||||
runManager->GetUserDetectorConstruction() ) );
|
||||
if ( ! setup )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
const G4LogicalVolume * lVolume( setup->GetVolume( CexmcSetup::Monitor ) );
|
||||
|
||||
if ( ! lVolume )
|
||||
throw CexmcException ( CexmcIncompatibleGeometry );
|
||||
throw CexmcException( CexmcIncompatibleGeometry );
|
||||
|
||||
nBinsMinX = CexmcHistoBeamMomentumMin;
|
||||
nBinsMaxX = CexmcHistoBeamMomentumMax;
|
||||
@@ -343,11 +343,17 @@ void CexmcHistoManager::Initialize( void )
|
||||
false, CexmcTPT, "mombp", "Beam momentum at the monitor", axes ) );
|
||||
AddHisto( CexmcHistoData( CexmcMomentumBP_RT_Histo, Cexmc_TH1F, false,
|
||||
false, CexmcRT, "mombp", "Beam momentum at the monitor", axes ) );
|
||||
if ( verboseLevel > 0 )
|
||||
{
|
||||
AddHisto( CexmcHistoData( CexmcMomentumIP_TPT_Histo, Cexmc_TH1F, false,
|
||||
false, CexmcTPT, "momip", "Momentum of the incident particle",
|
||||
axes ) );
|
||||
}
|
||||
|
||||
G4Box * box( dynamic_cast< G4Box * >( lVolume->GetSolid() ) );
|
||||
|
||||
if ( ! box )
|
||||
throw CexmcException ( CexmcIncompatibleGeometry );
|
||||
throw CexmcException( CexmcIncompatibleGeometry );
|
||||
|
||||
G4double width( box->GetXHalfLength() * 2 );
|
||||
G4double height( box->GetYHalfLength() * 2 );
|
||||
@@ -366,7 +372,7 @@ void CexmcHistoManager::Initialize( void )
|
||||
G4Tubs * tube( dynamic_cast< G4Tubs * >( lVolume->GetSolid() ) );
|
||||
|
||||
if ( ! tube )
|
||||
throw CexmcException ( CexmcIncompatibleGeometry );
|
||||
throw CexmcException( CexmcIncompatibleGeometry );
|
||||
|
||||
G4double radius( tube->GetOuterRadius() );
|
||||
height = tube->GetZHalfLength() * 2;
|
||||
@@ -410,9 +416,9 @@ void CexmcHistoManager::Initialize( void )
|
||||
axes.push_back( CexmcHistoAxisData( nBinsX, nBinsMinX, nBinsMaxX ) );
|
||||
axes.push_back( CexmcHistoAxisData( nBinsY, nBinsMinY, nBinsMaxY ) );
|
||||
AddHisto( CexmcHistoData( CexmcAbsorbedEnergy_EDT_Histo, Cexmc_TH2F, false,
|
||||
false, CexmcEDT, "ae", "Absorbed energy (rc vs. ls)", axes ) );
|
||||
false, CexmcEDT, "ae", "Absorbed energy (rc vs. lc)", axes ) );
|
||||
AddHisto( CexmcHistoData( CexmcAbsorbedEnergy_RT_Histo, Cexmc_TH2F, false,
|
||||
false, CexmcRT, "ae", "Absorbed energy (rc vs. ls)", axes ) );
|
||||
false, CexmcRT, "ae", "Absorbed energy (rc vs. lc)", axes ) );
|
||||
|
||||
SetupARHistos( runManager->GetPhysicsManager()->GetProductionModel()->
|
||||
GetAngularRanges() );
|
||||
@@ -499,7 +505,7 @@ void CexmcHistoManager::AddARHistos( const CexmcAngularRange & aRange )
|
||||
const CexmcSetup * setup( static_cast< const CexmcSetup * >(
|
||||
runManager->GetUserDetectorConstruction() ) );
|
||||
if ( ! setup )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
const G4LogicalVolume * lVolume( setup->GetVolume(
|
||||
CexmcSetup::Calorimeter ) );
|
||||
@@ -507,7 +513,7 @@ void CexmcHistoManager::AddARHistos( const CexmcAngularRange & aRange )
|
||||
G4Box * box( dynamic_cast< G4Box * >( lVolume->GetSolid() ) );
|
||||
|
||||
if ( ! box )
|
||||
throw CexmcException ( CexmcIncompatibleGeometry );
|
||||
throw CexmcException( CexmcIncompatibleGeometry );
|
||||
|
||||
G4double width( box->GetXHalfLength() * 2 );
|
||||
G4double height( box->GetYHalfLength() * 2 );
|
||||
@@ -650,7 +656,7 @@ void CexmcHistoManager::AddARHistos( const CexmcAngularRange & aRange )
|
||||
G4Tubs * tube( dynamic_cast< G4Tubs * >( lVolume->GetSolid() ) );
|
||||
|
||||
if ( ! tube )
|
||||
throw CexmcException ( CexmcIncompatibleGeometry );
|
||||
throw CexmcException( CexmcIncompatibleGeometry );
|
||||
|
||||
G4double radius( tube->GetOuterRadius() );
|
||||
height = tube->GetZHalfLength() * 2;
|
||||
@@ -676,7 +682,7 @@ void CexmcHistoManager::Add( CexmcHistoType histoType, unsigned int index,
|
||||
{
|
||||
CexmcHistosMap::iterator found( histos.find( histoType ) );
|
||||
if ( found == histos.end() || histos[ histoType ].size() <= index )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
histos[ histoType ][ index ]->Fill( x );
|
||||
}
|
||||
@@ -687,7 +693,7 @@ void CexmcHistoManager::Add( CexmcHistoType histoType, unsigned int index,
|
||||
{
|
||||
CexmcHistosMap::iterator found( histos.find( histoType ) );
|
||||
if ( found == histos.end() || histos[ histoType ].size() <= index )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
/* no cast needed because TH1 has virtual method
|
||||
* Fill( Double_t, Double_t ) */
|
||||
@@ -700,7 +706,7 @@ void CexmcHistoManager::Add( CexmcHistoType histoType, unsigned int index,
|
||||
{
|
||||
CexmcHistosMap::iterator found( histos.find( histoType ) );
|
||||
if ( found == histos.end() || histos[ histoType ].size() <= index )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
/* cast needed because TH1 does not have virtual method
|
||||
* Fill( Double_t, Double_t, Double_t ) */
|
||||
@@ -715,7 +721,7 @@ void CexmcHistoManager::Add( CexmcHistoType histoType, unsigned int index,
|
||||
{
|
||||
CexmcHistosMap::iterator found( histos.find( histoType ) );
|
||||
if ( found == histos.end() || histos[ histoType ].size() <= index )
|
||||
throw CexmcException ( CexmcWeirdException );
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
++binX;
|
||||
++binY;
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#ifdef CEXMC_USE_ROOT
|
||||
|
||||
#include <G4UIcmdWithoutParameter.hh>
|
||||
#include <G4UIcmdWithAnInteger.hh>
|
||||
#include <G4UIcmdWithAString.hh>
|
||||
#include <G4String.hh>
|
||||
#include "CexmcHistoManagerMessenger.hh"
|
||||
@@ -51,12 +52,22 @@
|
||||
#include "CexmcMessenger.hh"
|
||||
|
||||
|
||||
CexmcHistoManagerMessenger::CexmcHistoManagerMessenger() :
|
||||
listHistos( NULL ), printHisto( NULL )
|
||||
CexmcHistoManagerMessenger::CexmcHistoManagerMessenger(
|
||||
CexmcHistoManager * histoManager ) :
|
||||
histoManager( histoManager ), setVerboseLevel( NULL ), listHistos( NULL ),
|
||||
printHisto( NULL )
|
||||
#ifdef CEXMC_USE_ROOTQT
|
||||
, drawHisto( NULL )
|
||||
#endif
|
||||
{
|
||||
setVerboseLevel = new G4UIcmdWithAnInteger(
|
||||
( CexmcMessenger::histoDirName + "verbose" ).c_str(), this );
|
||||
setVerboseLevel->SetGuidance( "0 - basic set of histograms created, "
|
||||
"1 - extra histograms created" );
|
||||
setVerboseLevel->SetParameterName( "Verbose", true );
|
||||
setVerboseLevel->SetDefaultValue( 0 );
|
||||
setVerboseLevel->AvailableForStates( G4State_PreInit );
|
||||
|
||||
listHistos = new G4UIcmdWithoutParameter(
|
||||
( CexmcMessenger::histoDirName + "list" ).c_str(), this );
|
||||
listHistos->SetGuidance( "List available histograms" );
|
||||
@@ -83,6 +94,7 @@ CexmcHistoManagerMessenger::CexmcHistoManagerMessenger() :
|
||||
|
||||
CexmcHistoManagerMessenger::~CexmcHistoManagerMessenger()
|
||||
{
|
||||
delete setVerboseLevel;
|
||||
delete listHistos;
|
||||
delete printHisto;
|
||||
#ifdef CEXMC_USE_ROOTQT
|
||||
@@ -91,20 +103,26 @@ CexmcHistoManagerMessenger::~CexmcHistoManagerMessenger()
|
||||
}
|
||||
|
||||
|
||||
void CexmcHistoManagerMessenger::SetNewValue(
|
||||
G4UIcommand * cmd, G4String value )
|
||||
void CexmcHistoManagerMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4String value )
|
||||
{
|
||||
CexmcHistoManager * histoManager( CexmcHistoManager::Instance() );
|
||||
|
||||
do
|
||||
{
|
||||
if ( cmd == setVerboseLevel )
|
||||
{
|
||||
histoManager->SetVerboseLevel(
|
||||
G4UIcmdWithAnInteger::GetNewIntValue( value ) );
|
||||
break;
|
||||
}
|
||||
if ( cmd == listHistos )
|
||||
{
|
||||
histoManager->List();
|
||||
break;
|
||||
}
|
||||
if ( cmd == printHisto )
|
||||
{
|
||||
histoManager->Print( value );
|
||||
break;
|
||||
}
|
||||
#ifdef CEXMC_USE_ROOTQT
|
||||
if ( cmd == drawHisto )
|
||||
@@ -116,6 +134,7 @@ void CexmcHistoManagerMessenger::SetNewValue(
|
||||
histoManager->Draw( std::string( value, 0, delimPos ),
|
||||
delimPosEnd == G4String::npos ? "" :
|
||||
value.c_str() + delimPosEnd );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
} while ( false );
|
||||
|
||||
@@ -62,9 +62,9 @@ CexmcParticleGunMessenger::CexmcParticleGunMessenger(
|
||||
setParticle = new G4UIcmdWithAString(
|
||||
( CexmcMessenger::gunDirName + "particle" ).c_str(), this );
|
||||
setParticle->SetGuidance( "Incident beam particle" );
|
||||
setParticle->SetDefaultValue( "pi-" );
|
||||
setParticle->SetParameterName( "BeamParticle", false );
|
||||
setParticle->SetCandidates( "pi-" );
|
||||
setParticle->SetDefaultValue( "pi-" );
|
||||
setParticle->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setOrigPosition = new G4UIcmdWith3VectorAndUnit(
|
||||
@@ -72,8 +72,8 @@ CexmcParticleGunMessenger::CexmcParticleGunMessenger(
|
||||
setOrigPosition->SetGuidance( "Original position of the beam" );
|
||||
setOrigPosition->SetParameterName( "PositionX", "PositionY", "PositionZ",
|
||||
false );
|
||||
setOrigPosition->SetDefaultUnit( "cm" );
|
||||
setOrigPosition->SetUnitCandidates( "mm cm m" );
|
||||
setOrigPosition->SetDefaultUnit( "cm" );
|
||||
setOrigPosition->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setOrigDirection = new G4UIcmdWith3Vector(
|
||||
@@ -92,8 +92,8 @@ CexmcParticleGunMessenger::CexmcParticleGunMessenger(
|
||||
setOrigMomentumAmp->SetGuidance( "Original momentum of the beam" );
|
||||
setOrigMomentumAmp->SetParameterName( "MomentumAmp", false );
|
||||
setOrigMomentumAmp->SetRange( "MomentumAmp > 0" );
|
||||
setOrigMomentumAmp->SetDefaultUnit( "MeV" );
|
||||
setOrigMomentumAmp->SetUnitCandidates( "eV keV MeV GeV" );
|
||||
setOrigMomentumAmp->SetDefaultUnit( "MeV" );
|
||||
setOrigMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ CexmcParticleGunMessenger::~CexmcParticleGunMessenger()
|
||||
}
|
||||
|
||||
|
||||
void CexmcParticleGunMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4String value )
|
||||
void CexmcParticleGunMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4String value )
|
||||
{
|
||||
do
|
||||
{
|
||||
|
||||
@@ -58,8 +58,8 @@ CexmcPhysicsManagerMessenger::CexmcPhysicsManagerMessenger(
|
||||
"length in the\n target; can be used for precise tuning of the "
|
||||
"center of\n distribution of interaction vertices in the target" );
|
||||
setMaxILCorrection->SetParameterName( "MaxILCorrection", false );
|
||||
setMaxILCorrection->SetDefaultUnit( "mm" );
|
||||
setMaxILCorrection->SetUnitCandidates( "mm cm m" );
|
||||
setMaxILCorrection->SetDefaultUnit( "mm" );
|
||||
setMaxILCorrection->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ CexmcPhysicsManagerMessenger::~CexmcPhysicsManagerMessenger()
|
||||
}
|
||||
|
||||
|
||||
void CexmcPhysicsManagerMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4String value )
|
||||
void CexmcPhysicsManagerMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4String value )
|
||||
{
|
||||
do
|
||||
{
|
||||
|
||||
@@ -59,8 +59,8 @@ CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
|
||||
fwhmPosX->SetGuidance( "Set positional fwhm of the beam along X axis" );
|
||||
fwhmPosX->SetParameterName( "FwhmPosX", false );
|
||||
fwhmPosX->SetDefaultValue( 0 );
|
||||
fwhmPosX->SetDefaultUnit( "cm" );
|
||||
fwhmPosX->SetUnitCandidates( "mm cm m" );
|
||||
fwhmPosX->SetDefaultUnit( "cm" );
|
||||
fwhmPosX->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
fwhmPosY = new G4UIcmdWithADoubleAndUnit(
|
||||
@@ -68,8 +68,8 @@ CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
|
||||
fwhmPosY->SetGuidance( "Set positional fwhm of the beam along Y axis" );
|
||||
fwhmPosY->SetParameterName( "FwhmPosY", false );
|
||||
fwhmPosY->SetDefaultValue( 0 );
|
||||
fwhmPosY->SetDefaultUnit( "cm" );
|
||||
fwhmPosY->SetUnitCandidates( "mm cm m" );
|
||||
fwhmPosY->SetDefaultUnit( "cm" );
|
||||
fwhmPosY->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
fwhmDirX = new G4UIcmdWithADoubleAndUnit(
|
||||
@@ -77,8 +77,8 @@ CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
|
||||
fwhmDirX->SetGuidance( "Set directional fwhm of the beam along X axis" );
|
||||
fwhmDirX->SetParameterName( "FwhmDirX", false );
|
||||
fwhmDirX->SetDefaultValue( 0 );
|
||||
fwhmDirX->SetDefaultUnit( "deg" );
|
||||
fwhmDirX->SetUnitCandidates( "deg rad" );
|
||||
fwhmDirX->SetDefaultUnit( "deg" );
|
||||
fwhmDirX->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
fwhmDirY = new G4UIcmdWithADoubleAndUnit(
|
||||
@@ -86,16 +86,16 @@ CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
|
||||
fwhmDirY->SetGuidance( "Set directional fwhm of the beam along Y axis" );
|
||||
fwhmDirY->SetParameterName( "FwhmDirY", false );
|
||||
fwhmDirY->SetDefaultValue( 0 );
|
||||
fwhmDirY->SetDefaultUnit( "deg" );
|
||||
fwhmDirY->SetUnitCandidates( "deg rad" );
|
||||
fwhmDirY->SetDefaultUnit( "deg" );
|
||||
fwhmDirY->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
fwhmMomentumAmp = new G4UIcmdWithADouble(
|
||||
( CexmcMessenger::gunDirName + "fwhmMomentumAmp" ).c_str(), this );
|
||||
fwhmMomentumAmp->SetGuidance( "Set fwhm of the beam momentum as fraction "
|
||||
"of its value" );
|
||||
fwhmMomentumAmp->SetDefaultValue( 0 );
|
||||
fwhmMomentumAmp->SetParameterName( "FwhmMomentumAmp", false );
|
||||
fwhmMomentumAmp->SetDefaultValue( 0 );
|
||||
fwhmMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
}
|
||||
|
||||
|
||||
+25
-16
@@ -24,41 +24,50 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* ============================================================================
|
||||
* =============================================================================
|
||||
*
|
||||
* Filename: CexmcEventFastSObject.cc
|
||||
* Filename: CexmcPrimitiveScorer.cc
|
||||
*
|
||||
* Description: event data serialization helper
|
||||
* Description: primitive scorer with a messenger
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 02.01.2010 20:31:12
|
||||
* Created: 24.01.2011 18:34:30
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Alexey Radkov (),
|
||||
* Company: PNPI
|
||||
*
|
||||
* ============================================================================
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
#ifdef CEXMC_USE_PERSISTENCY
|
||||
|
||||
#include "CexmcEventFastSObject.hh"
|
||||
#include <G4ios.hh>
|
||||
#include "CexmcPrimitiveScorer.hh"
|
||||
#include "CexmcSensitiveDetectorMessenger.hh"
|
||||
|
||||
|
||||
CexmcEventFastSObject::CexmcEventFastSObject()
|
||||
CexmcPrimitiveScorer::CexmcPrimitiveScorer( const G4String & name ) :
|
||||
G4VPrimitiveScorer( name ), messenger( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CexmcEventFastSObject::CexmcEventFastSObject( G4int eventId,
|
||||
G4double opCosThetaSCM, G4bool edDigitizerHasTriggered,
|
||||
G4bool edDigitizerMonitorHasTriggered ) :
|
||||
eventId( eventId ), opCosThetaSCM( opCosThetaSCM ),
|
||||
edDigitizerHasTriggered( edDigitizerHasTriggered ),
|
||||
edDigitizerMonitorHasTriggered( edDigitizerMonitorHasTriggered )
|
||||
CexmcPrimitiveScorer::~CexmcPrimitiveScorer()
|
||||
{
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void CexmcPrimitiveScorer::InitializeMessenger( void )
|
||||
{
|
||||
messenger = new CexmcSensitiveDetectorMessenger( this );
|
||||
}
|
||||
|
||||
|
||||
void CexmcPrimitiveScorer::PrintHeader( G4int nmbOfEntries ) const
|
||||
{
|
||||
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
|
||||
G4cout << " PrimitiveScorer " << primitiveName << G4endl;
|
||||
G4cout << " Number of entries " << nmbOfEntries << G4endl;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void CexmcProductionModel::SetAngularRange( G4double top, G4double bottom,
|
||||
{
|
||||
G4double binWidth( ( top - bottom ) / nmbOfDivs );
|
||||
G4double curTop( curBottom );
|
||||
curBottom -= binWidth;
|
||||
curBottom -= binWidth;
|
||||
angularRanges.push_back( CexmcAngularRange( curTop, curBottom, i ) );
|
||||
}
|
||||
#ifdef CEXMC_USE_ROOT
|
||||
|
||||
@@ -58,8 +58,8 @@ CexmcProductionModelMessenger::CexmcProductionModelMessenger(
|
||||
this );
|
||||
applyFermiMotion->SetGuidance( "Switch on/off fermi motion in target "
|
||||
"nuclei" );
|
||||
applyFermiMotion->SetParameterName( "ApplyFermiMotionInTarget", false );
|
||||
applyFermiMotion->SetDefaultValue( false );
|
||||
applyFermiMotion->SetParameterName( "ApplyFermiMotionInTarget", true );
|
||||
applyFermiMotion->SetDefaultValue( true );
|
||||
applyFermiMotion->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setAngularRange = new G4UIcmdWith3Vector(
|
||||
@@ -102,8 +102,8 @@ CexmcProductionModelMessenger::~CexmcProductionModelMessenger()
|
||||
}
|
||||
|
||||
|
||||
void CexmcProductionModelMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4String value )
|
||||
void CexmcProductionModelMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4String value )
|
||||
{
|
||||
do
|
||||
{
|
||||
|
||||
@@ -47,12 +47,13 @@
|
||||
#include "CexmcRunManager.hh"
|
||||
|
||||
|
||||
CexmcReconstructor::CexmcReconstructor() :
|
||||
hasBasicTrigger( false ),
|
||||
CexmcReconstructor::CexmcReconstructor() : hasBasicTrigger( false ),
|
||||
epDefinitionAlgorithm( CexmcEntryPointBySqrtEDWeights ),
|
||||
epDepthDefinitionAlgorithm( CexmcEntryPointDepthPlain ),
|
||||
csAlgorithm( CexmcSelectAllCrystals ), useInnerRefCrystal( false ),
|
||||
epDepth( 0 ), theAngle( 0 ), targetEPInitialized( false ), messenger( NULL )
|
||||
epDepth( 0 ), theAngle( 0 ), calorimeterEDLeftAdjacent( 0 ),
|
||||
calorimeterEDRightAdjacent( 0 ), collectEDInAdjacentCrystals( false ),
|
||||
targetEPInitialized( false ), messenger( NULL )
|
||||
{
|
||||
G4RunManager * runManager( G4RunManager::GetRunManager() );
|
||||
const CexmcSetup * setup( static_cast< const CexmcSetup * >(
|
||||
@@ -72,7 +73,8 @@ CexmcReconstructor::~CexmcReconstructor()
|
||||
}
|
||||
|
||||
|
||||
void CexmcReconstructor::Reconstruct( const CexmcEnergyDepositStore * edStore )
|
||||
void CexmcReconstructor::Reconstruct(
|
||||
const CexmcEnergyDepositStore * edStore )
|
||||
{
|
||||
ReconstructEntryPoints( edStore );
|
||||
if ( hasBasicTrigger )
|
||||
@@ -89,14 +91,20 @@ G4bool CexmcReconstructor::HasFullTrigger( void ) const
|
||||
|
||||
|
||||
void CexmcReconstructor::ReconstructEntryPoints(
|
||||
const CexmcEnergyDepositStore * edStore )
|
||||
const CexmcEnergyDepositStore * edStore )
|
||||
{
|
||||
G4int nCrystalsInColumn( calorimeterGeometry.nCrystalsInColumn );
|
||||
G4int nCrystalsInRow( calorimeterGeometry.nCrystalsInRow );
|
||||
G4double crystalWidth( calorimeterGeometry.crystalWidth );
|
||||
G4double crystalHeight( calorimeterGeometry.crystalHeight );
|
||||
G4int columnLeft( edStore->calorimeterEDLeftMaxX );
|
||||
G4int rowLeft( edStore->calorimeterEDLeftMaxY );
|
||||
G4int columnRight( edStore->calorimeterEDRightMaxX );
|
||||
G4int rowRight( edStore->calorimeterEDRightMaxY );
|
||||
G4double crystalLength( calorimeterGeometry.crystalLength );
|
||||
|
||||
if ( useInnerRefCrystal )
|
||||
{
|
||||
TransformToAdjacentInnerCrystal( columnLeft, rowLeft );
|
||||
TransformToAdjacentInnerCrystal( columnRight, rowRight );
|
||||
}
|
||||
|
||||
calorimeterEPLeftPosition.setX( 0 );
|
||||
calorimeterEPLeftPosition.setY( 0 );
|
||||
calorimeterEPLeftPosition.setZ( -crystalLength / 2 + epDepth );
|
||||
@@ -110,196 +118,54 @@ void CexmcReconstructor::ReconstructEntryPoints(
|
||||
calorimeterEPRightDirection.setY( 0 );
|
||||
calorimeterEPRightDirection.setZ( 0 );
|
||||
|
||||
G4int columnLeft( edStore->calorimeterEDLeftMaxX );
|
||||
G4int rowLeft( edStore->calorimeterEDLeftMaxY );
|
||||
G4int columnRight( edStore->calorimeterEDRightMaxX );
|
||||
G4int rowRight( edStore->calorimeterEDRightMaxY );
|
||||
G4double xInCalorimeterLeftOffset(
|
||||
( G4double( columnLeft ) - G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2 );
|
||||
G4double yInCalorimeterLeftOffset(
|
||||
( G4double( rowLeft ) - G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2 );
|
||||
G4double xInCalorimeterRightOffset(
|
||||
( G4double( columnRight ) - G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2 );
|
||||
G4double yInCalorimeterRightOffset(
|
||||
( G4double( rowRight ) - G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2 );
|
||||
G4int i( 0 );
|
||||
G4double xWeightsSum( 0 );
|
||||
G4double yWeightsSum( 0 );
|
||||
G4double energySum( 0 );
|
||||
G4bool edInAdjacentCrystalsCollected( false );
|
||||
|
||||
switch ( epDefinitionAlgorithm )
|
||||
{
|
||||
case CexmcEntryPointInTheCenter :
|
||||
break;
|
||||
case CexmcEntryPointInTheCenterOfCrystalWithMaxED :
|
||||
calorimeterEPLeftPosition.setX( xInCalorimeterLeftOffset );
|
||||
calorimeterEPLeftPosition.setY( yInCalorimeterLeftOffset );
|
||||
calorimeterEPRightPosition.setX( xInCalorimeterRightOffset );
|
||||
calorimeterEPRightPosition.setY( yInCalorimeterRightOffset );
|
||||
{
|
||||
G4int nCrystalsInColumn(
|
||||
calorimeterGeometry.nCrystalsInColumn );
|
||||
G4int nCrystalsInRow( calorimeterGeometry.nCrystalsInRow );
|
||||
G4double crystalWidth( calorimeterGeometry.crystalWidth );
|
||||
G4double crystalHeight( calorimeterGeometry.crystalHeight );
|
||||
|
||||
calorimeterEPLeftPosition.setX(
|
||||
( G4double( columnLeft ) - G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2 );
|
||||
calorimeterEPLeftPosition.setY(
|
||||
( G4double( rowLeft ) - G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2 );
|
||||
calorimeterEPRightPosition.setX(
|
||||
( G4double( columnRight ) - G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2 );
|
||||
calorimeterEPRightPosition.setY(
|
||||
( G4double( rowRight ) - G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2 );
|
||||
}
|
||||
break;
|
||||
case CexmcEntryPointByLinearEDWeights :
|
||||
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
|
||||
k( edStore->calorimeterEDLeftCollection.begin() );
|
||||
k != edStore->calorimeterEDLeftCollection.end(); ++k )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( i - rowLeft > 1 || i - rowLeft < -1 ) )
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
G4int j( 0 );
|
||||
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
|
||||
l( k->begin() ); l != k->end(); ++l )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( j - columnLeft > 1 || j - columnLeft < -1 ) )
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
xInCalorimeterLeftOffset = ( G4double( j ) -
|
||||
G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2;
|
||||
xWeightsSum += *l * xInCalorimeterLeftOffset;
|
||||
yInCalorimeterLeftOffset = ( G4double( i ) -
|
||||
G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2;
|
||||
yWeightsSum += *l * yInCalorimeterLeftOffset;
|
||||
energySum += *l;
|
||||
++j;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
calorimeterEPLeftPosition.setX( xWeightsSum / energySum );
|
||||
calorimeterEPLeftPosition.setY( yWeightsSum / energySum );
|
||||
i = 0;
|
||||
xWeightsSum = 0;
|
||||
yWeightsSum = 0;
|
||||
energySum = 0;
|
||||
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
|
||||
k( edStore->calorimeterEDRightCollection.begin() );
|
||||
k != edStore->calorimeterEDRightCollection.end(); ++k )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( i - rowRight > 1 || i - rowRight < -1 ) )
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
G4int j( 0 );
|
||||
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
|
||||
l( k->begin() ); l != k->end(); ++l )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( j - columnRight > 1 || j - columnRight < -1 ) )
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
xInCalorimeterRightOffset = ( G4double( j ) -
|
||||
G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2;
|
||||
xWeightsSum += *l * xInCalorimeterRightOffset;
|
||||
yInCalorimeterRightOffset = ( G4double( i ) -
|
||||
G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2;
|
||||
yWeightsSum += *l * yInCalorimeterRightOffset;
|
||||
energySum += *l;
|
||||
++j;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
calorimeterEPRightPosition.setX( xWeightsSum / energySum );
|
||||
calorimeterEPRightPosition.setY( yWeightsSum / energySum );
|
||||
break;
|
||||
case CexmcEntryPointBySqrtEDWeights :
|
||||
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
|
||||
k( edStore->calorimeterEDLeftCollection.begin() );
|
||||
k != edStore->calorimeterEDLeftCollection.end(); ++k )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( i - rowLeft > 1 || i - rowLeft < -1 ) )
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
G4double x( 0 );
|
||||
G4double y( 0 );
|
||||
|
||||
G4int j( 0 );
|
||||
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
|
||||
l( k->begin() ); l != k->end(); ++l )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( j - columnLeft > 1 || j - columnLeft < -1 ) )
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
CalculateWeightedEPPosition( edStore->calorimeterEDLeftCollection,
|
||||
rowLeft, columnLeft, x, y,
|
||||
calorimeterEDLeftAdjacent );
|
||||
calorimeterEPLeftPosition.setX( x );
|
||||
calorimeterEPLeftPosition.setY( y );
|
||||
CalculateWeightedEPPosition( edStore->calorimeterEDRightCollection,
|
||||
rowRight, columnRight, x, y,
|
||||
calorimeterEDRightAdjacent );
|
||||
calorimeterEPRightPosition.setX( x );
|
||||
calorimeterEPRightPosition.setY( y );
|
||||
|
||||
xInCalorimeterLeftOffset = ( G4double( j ) -
|
||||
G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2;
|
||||
xWeightsSum += std::sqrt( *l ) * xInCalorimeterLeftOffset;
|
||||
yInCalorimeterLeftOffset = ( G4double( i ) -
|
||||
G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2;
|
||||
yWeightsSum += std::sqrt( *l ) * yInCalorimeterLeftOffset;
|
||||
energySum += std::sqrt( *l );
|
||||
++j;
|
||||
}
|
||||
++i;
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals )
|
||||
edInAdjacentCrystalsCollected = true;
|
||||
}
|
||||
calorimeterEPLeftPosition.setX( xWeightsSum / energySum );
|
||||
calorimeterEPLeftPosition.setY( yWeightsSum / energySum );
|
||||
i = 0;
|
||||
xWeightsSum = 0;
|
||||
yWeightsSum = 0;
|
||||
energySum = 0;
|
||||
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
|
||||
k( edStore->calorimeterEDRightCollection.begin() );
|
||||
k != edStore->calorimeterEDRightCollection.end(); ++k )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( i - rowRight > 1 || i - rowRight < -1 ) )
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
G4int j( 0 );
|
||||
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
|
||||
l( k->begin() ); l != k->end(); ++l )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( j - columnRight > 1 || j - columnRight < -1 ) )
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
xInCalorimeterRightOffset = ( G4double( j ) -
|
||||
G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2;
|
||||
xWeightsSum += std::sqrt( *l ) * xInCalorimeterRightOffset;
|
||||
yInCalorimeterRightOffset = ( G4double( i ) -
|
||||
G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2;
|
||||
yWeightsSum += std::sqrt( *l ) * yInCalorimeterRightOffset;
|
||||
energySum += std::sqrt( *l );
|
||||
++j;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
calorimeterEPRightPosition.setX( xWeightsSum / energySum );
|
||||
calorimeterEPRightPosition.setY( yWeightsSum / energySum );
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
@@ -351,6 +217,8 @@ void CexmcReconstructor::ReconstructEntryPoints(
|
||||
calorimeterEPRightPositionZOffset );
|
||||
}
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
calorimeterEPLeftWorldPosition = calorimeterLeftTransform.TransformPoint(
|
||||
@@ -362,6 +230,16 @@ void CexmcReconstructor::ReconstructEntryPoints(
|
||||
calorimeterEPRightWorldDirection = calorimeterRightTransform.TransformAxis(
|
||||
calorimeterEPRightDirection );
|
||||
|
||||
if ( collectEDInAdjacentCrystals && ! edInAdjacentCrystalsCollected )
|
||||
{
|
||||
CollectEDInAdjacentCrystals( edStore->calorimeterEDLeftCollection,
|
||||
rowLeft, columnLeft,
|
||||
calorimeterEDLeftAdjacent );
|
||||
CollectEDInAdjacentCrystals( edStore->calorimeterEDRightCollection,
|
||||
rowRight, columnRight,
|
||||
calorimeterEDRightAdjacent );
|
||||
}
|
||||
|
||||
hasBasicTrigger = true;
|
||||
}
|
||||
|
||||
@@ -398,3 +276,100 @@ void CexmcReconstructor::ReconstructAngle( void )
|
||||
hasBasicTrigger = true;
|
||||
}
|
||||
|
||||
|
||||
void CexmcReconstructor::CollectEDInAdjacentCrystals(
|
||||
const CexmcEnergyDepositCalorimeterCollection & edHits,
|
||||
G4int row, G4int column, G4double & ed )
|
||||
{
|
||||
G4int i( 0 );
|
||||
|
||||
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
|
||||
k( edHits.begin() ); k != edHits.end(); ++k )
|
||||
{
|
||||
if ( i - row > 1 || i - row < -1 )
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
G4int j( 0 );
|
||||
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
|
||||
l( k->begin() ); l != k->end(); ++l )
|
||||
{
|
||||
if ( j - column > 1 || j - column < -1 )
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
ed += *l;
|
||||
++j;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CexmcReconstructor::CalculateWeightedEPPosition(
|
||||
const CexmcEnergyDepositCalorimeterCollection & edHits,
|
||||
G4int row, G4int column, G4double & x, G4double & y,
|
||||
G4double & ed )
|
||||
{
|
||||
G4int nCrystalsInColumn( calorimeterGeometry.nCrystalsInColumn );
|
||||
G4int nCrystalsInRow( calorimeterGeometry.nCrystalsInRow );
|
||||
G4double crystalWidth( calorimeterGeometry.crystalWidth );
|
||||
G4double crystalHeight( calorimeterGeometry.crystalHeight );
|
||||
|
||||
G4int i( 0 );
|
||||
G4double xWeightsSum( 0 );
|
||||
G4double yWeightsSum( 0 );
|
||||
G4double energyWeightsSum( 0 );
|
||||
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals )
|
||||
ed = 0.;
|
||||
|
||||
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
|
||||
k( edHits.begin() ); k != edHits.end(); ++k )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( i - row > 1 || i - row < -1 ) )
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
G4int j( 0 );
|
||||
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
|
||||
l( k->begin() ); l != k->end(); ++l )
|
||||
{
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
|
||||
( j - column > 1 || j - column < -1 ) )
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( csAlgorithm == CexmcSelectAdjacentCrystals )
|
||||
ed += *l;
|
||||
|
||||
G4double xInCalorimeterOffset(
|
||||
( G4double( j ) - G4double( nCrystalsInRow ) / 2 ) *
|
||||
crystalWidth + crystalWidth / 2 );
|
||||
G4double energyWeight(
|
||||
epDefinitionAlgorithm ==
|
||||
CexmcEntryPointBySqrtEDWeights ?
|
||||
std::sqrt( *l ) : *l );
|
||||
xWeightsSum += energyWeight * xInCalorimeterOffset;
|
||||
G4double yInCalorimeterOffset(
|
||||
( G4double( i ) - G4double( nCrystalsInColumn ) / 2 ) *
|
||||
crystalHeight + crystalHeight / 2 );
|
||||
yWeightsSum += energyWeight * yInCalorimeterOffset;
|
||||
energyWeightsSum += energyWeight;
|
||||
++j;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
x = xWeightsSum / energyWeightsSum;
|
||||
y = yWeightsSum / energyWeightsSum;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,11 +72,11 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
|
||||
" deposit in crystals,\n"
|
||||
" sqrt - entry points defined by square root weights of\n"
|
||||
" energy deposit in crystals" );
|
||||
setCalorimeterEntryPointDefinitionAlgorithm->SetDefaultValue( "sqrt" );
|
||||
setCalorimeterEntryPointDefinitionAlgorithm->SetParameterName(
|
||||
"EntryPointDefinitionAlgo", false );
|
||||
setCalorimeterEntryPointDefinitionAlgorithm->SetCandidates(
|
||||
"center simple linear sqrt" );
|
||||
setCalorimeterEntryPointDefinitionAlgorithm->SetDefaultValue( "sqrt" );
|
||||
setCalorimeterEntryPointDefinitionAlgorithm->AvailableForStates(
|
||||
G4State_PreInit, G4State_Idle );
|
||||
|
||||
@@ -93,12 +93,12 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
|
||||
" with origin in the center of the target;\n"
|
||||
" radius of the sphere is sum of distance to\n"
|
||||
" the calorimeter and 'entryPointDepth' value" );
|
||||
setCalorimeterEntryPointDepthDefinitionAlgorithm->SetDefaultValue(
|
||||
"plain" );
|
||||
setCalorimeterEntryPointDepthDefinitionAlgorithm->SetParameterName(
|
||||
"EntryPointDepthDefinitionAlgo", false );
|
||||
setCalorimeterEntryPointDepthDefinitionAlgorithm->SetCandidates(
|
||||
"plain sphere" );
|
||||
setCalorimeterEntryPointDepthDefinitionAlgorithm->SetDefaultValue(
|
||||
"plain" );
|
||||
setCalorimeterEntryPointDepthDefinitionAlgorithm->AvailableForStates(
|
||||
G4State_PreInit, G4State_Idle );
|
||||
|
||||
@@ -106,14 +106,14 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
|
||||
( CexmcMessenger::reconstructorDirName + "crystalSelectionAlgo" ).
|
||||
c_str(), this );
|
||||
setCrystalSelectionAlgorithm->SetGuidance(
|
||||
"\n Choose which crystals will be selected in weighted entry point\n"
|
||||
"\n Choose crystals to be selected in weighted entry point\n"
|
||||
" reconstruction algorithms\n"
|
||||
" all - all,\n"
|
||||
" adjacent - crystal with maximum energy deposit and\n"
|
||||
" adjacent crystals" );
|
||||
setCrystalSelectionAlgorithm->SetDefaultValue( "all" );
|
||||
setCrystalSelectionAlgorithm->SetParameterName( "CrystalSelAlgo", false );
|
||||
setCrystalSelectionAlgorithm->SetCandidates( "all adjacent" );
|
||||
setCrystalSelectionAlgorithm->SetDefaultValue( "all" );
|
||||
setCrystalSelectionAlgorithm->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -124,11 +124,12 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
|
||||
"\n Defines that if the crystal with maximum energy deposit in\n"
|
||||
" calorimeter is an outer crystal then the closest inner crystal\n"
|
||||
" will be chosen as the reference for adjacent crystal selection\n"
|
||||
" algorithm and simple entry point definition algorithm.\n"
|
||||
" If not set then the reference crystal will be found from all\n"
|
||||
" crystals in calorimeter" );
|
||||
useInnerRefCrystal->SetDefaultValue( false );
|
||||
useInnerRefCrystal->SetParameterName( "UseInnerRefCrystal", false );
|
||||
" algorithm and simple entry point definition algorithm. It also\n"
|
||||
" affects energy deposit collection if adjacent crystals\n"
|
||||
" algorithm was chosen for that. If not set then the reference\n"
|
||||
" crystal will be found from all crystals in calorimeter" );
|
||||
useInnerRefCrystal->SetParameterName( "UseInnerRefCrystal", true );
|
||||
useInnerRefCrystal->SetDefaultValue( true );
|
||||
useInnerRefCrystal->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setCalorimeterEntryPointDepth = new G4UIcmdWithADoubleAndUnit(
|
||||
@@ -139,8 +140,8 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
|
||||
" between output particle decay products" );
|
||||
setCalorimeterEntryPointDepth->SetParameterName( "EntryPointDepth", false );
|
||||
setCalorimeterEntryPointDepth->SetDefaultValue( 0 );
|
||||
setCalorimeterEntryPointDepth->SetDefaultUnit( "cm" );
|
||||
setCalorimeterEntryPointDepth->SetUnitCandidates( "mm cm m" );
|
||||
setCalorimeterEntryPointDepth->SetDefaultUnit( "cm" );
|
||||
setCalorimeterEntryPointDepth->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
}
|
||||
@@ -167,18 +168,18 @@ void CexmcReconstructorMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
epDefinitionAlgorithm( CexmcEntryPointInTheCenter );
|
||||
do
|
||||
{
|
||||
if ( value == "simple" )
|
||||
if ( value == "simple" )
|
||||
{
|
||||
epDefinitionAlgorithm =
|
||||
CexmcEntryPointInTheCenterOfCrystalWithMaxED;
|
||||
break;
|
||||
}
|
||||
if ( value == "linear" )
|
||||
if ( value == "linear" )
|
||||
{
|
||||
epDefinitionAlgorithm = CexmcEntryPointByLinearEDWeights;
|
||||
break;
|
||||
}
|
||||
if ( value == "sqrt" )
|
||||
if ( value == "sqrt" )
|
||||
{
|
||||
epDefinitionAlgorithm = CexmcEntryPointBySqrtEDWeights;
|
||||
break;
|
||||
@@ -194,7 +195,7 @@ void CexmcReconstructorMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
epDepthDefinitionAlgorithm( CexmcEntryPointDepthPlain );
|
||||
do
|
||||
{
|
||||
if ( value == "sphere" )
|
||||
if ( value == "sphere" )
|
||||
{
|
||||
epDepthDefinitionAlgorithm = CexmcEntryPointDepthSphere;
|
||||
break;
|
||||
@@ -210,7 +211,7 @@ void CexmcReconstructorMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
csAlgorithm( CexmcSelectAllCrystals );
|
||||
do
|
||||
{
|
||||
if ( value == "adjacent" )
|
||||
if ( value == "adjacent" )
|
||||
{
|
||||
csAlgorithm = CexmcSelectAdjacentCrystals;
|
||||
break;
|
||||
|
||||
@@ -64,6 +64,16 @@ namespace
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
G4double PDK( G4double a, G4double b, G4double c )
|
||||
{
|
||||
G4double x( ( a - b - c ) * ( a + b + c ) * ( a - b + c ) *
|
||||
( a + b - c ) );
|
||||
x = std::sqrt( x ) / ( 2 * a );
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +119,7 @@ G4double CexmcReimplementedGenbod::Generate( void )
|
||||
G4double wt( maxWeight );
|
||||
G4double pd[ maxParticles ];
|
||||
|
||||
for ( int i( 0 ); i < nmbOfOutputParticles - 1; ++i )
|
||||
for ( int i( 0 ); i < nmbOfOutputParticles - 1; ++i )
|
||||
{
|
||||
pd[ i ] = PDK( invMas[ i + 1 ], invMas[ i ],
|
||||
outVec[ i + 1 ].mass / GeV );
|
||||
@@ -226,13 +236,3 @@ void CexmcReimplementedGenbod::SetMaxWeight( void )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
G4double CexmcReimplementedGenbod::PDK( G4double a, G4double b, G4double c )
|
||||
{
|
||||
G4double x( ( a - b - c ) * ( a + b + c ) * ( a - b + c ) *
|
||||
( a + b - c ) );
|
||||
x = std::sqrt( x ) / ( 2 * a );
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void CexmcRun::IncrementNmbOfHitsSampled( G4int index )
|
||||
CexmcNmbOfHitsInRanges::iterator found(
|
||||
nmbOfHitsSampled.find( index ) );
|
||||
if ( found == nmbOfHitsSampled.end() )
|
||||
nmbOfHitsSampled.insert( std::pair< int, int >( index, 1 ) );
|
||||
nmbOfHitsSampled.insert( CexmcNmbOfHitsInRangesData( index, 1 ) );
|
||||
else
|
||||
++found->second;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ void CexmcRun::IncrementNmbOfHitsSampledFull( G4int index )
|
||||
CexmcNmbOfHitsInRanges::iterator found(
|
||||
nmbOfHitsSampledFull.find( index ) );
|
||||
if ( found == nmbOfHitsSampledFull.end() )
|
||||
nmbOfHitsSampledFull.insert( std::pair< int, int >( index, 1 ) );
|
||||
nmbOfHitsSampledFull.insert( CexmcNmbOfHitsInRangesData( index, 1 ) );
|
||||
else
|
||||
++found->second;
|
||||
}
|
||||
@@ -78,7 +78,8 @@ void CexmcRun::IncrementNmbOfHitsTriggeredRealRange( G4int index )
|
||||
CexmcNmbOfHitsInRanges::iterator found(
|
||||
nmbOfHitsTriggeredRealRange.find( index ) );
|
||||
if ( found == nmbOfHitsTriggeredRealRange.end() )
|
||||
nmbOfHitsTriggeredRealRange.insert( std::pair< int, int >( index, 1 ) );
|
||||
nmbOfHitsTriggeredRealRange.insert(
|
||||
CexmcNmbOfHitsInRangesData( index, 1 ) );
|
||||
else
|
||||
++found->second;
|
||||
}
|
||||
@@ -89,7 +90,8 @@ void CexmcRun::IncrementNmbOfHitsTriggeredRecRange( G4int index )
|
||||
CexmcNmbOfHitsInRanges::iterator found(
|
||||
nmbOfHitsTriggeredRecRange.find( index ) );
|
||||
if ( found == nmbOfHitsTriggeredRecRange.end() )
|
||||
nmbOfHitsTriggeredRecRange.insert( std::pair< int, int >( index, 1 ) );
|
||||
nmbOfHitsTriggeredRecRange.insert(
|
||||
CexmcNmbOfHitsInRangesData( index, 1 ) );
|
||||
else
|
||||
++found->second;
|
||||
}
|
||||
@@ -100,7 +102,7 @@ void CexmcRun::IncrementNmbOfOrphanHits( G4int index )
|
||||
CexmcNmbOfHitsInRanges::iterator found(
|
||||
nmbOfOrphanHits.find( index ) );
|
||||
if ( found == nmbOfOrphanHits.end() )
|
||||
nmbOfOrphanHits.insert( std::pair< int, int >( index, 1 ) );
|
||||
nmbOfOrphanHits.insert( CexmcNmbOfHitsInRangesData( index, 1 ) );
|
||||
else
|
||||
++found->second;
|
||||
}
|
||||
|
||||
@@ -173,6 +173,9 @@ void CexmcRunAction::PrintResults(
|
||||
auxStrings.push_back( auxString );
|
||||
}
|
||||
|
||||
G4cout << " --- Setup acceptances (range | real (trg / mon) | "
|
||||
"rec (trg / mon / all)):" << G4endl;
|
||||
|
||||
G4int i( 0 );
|
||||
for ( CexmcAngularRangeList::const_iterator k( angularRanges.begin() );
|
||||
k != angularRanges.end(); ++k )
|
||||
@@ -218,8 +221,9 @@ void CexmcRunAction::PrintResults(
|
||||
}
|
||||
|
||||
G4cout << " ---" << G4endl;
|
||||
G4cout << " False hits (edt, rec): " << nmbOfFalseHitsTriggeredEDT <<
|
||||
" | " << nmbOfFalseHitsTriggeredRec << G4endl;
|
||||
G4cout << " False hits (edt | rec): " <<
|
||||
nmbOfFalseHitsTriggeredEDT << " | " << nmbOfFalseHitsTriggeredRec <<
|
||||
G4endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,11 +250,12 @@ void CexmcRunAction::EndOfRunAction( const G4Run * run )
|
||||
const CexmcAngularRangeList & angularRanges(
|
||||
productionModel->GetAngularRanges() );
|
||||
|
||||
G4cout << " --- Setup acceptances (real, rec):" << G4endl;
|
||||
G4cout << G4endl;
|
||||
PrintResults( nmbOfHitsSampled, nmbOfHitsSampledFull,
|
||||
nmbOfHitsTriggeredRealRange, nmbOfHitsTriggeredRecRange,
|
||||
nmbOfOrphanHits, angularRanges,
|
||||
theRun->GetNmbOfFalseHitsTriggeredEDT(),
|
||||
theRun->GetNmbOfFalseHitsTriggeredRec() );
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#ifdef CEXMC_USE_PERSISTENCY
|
||||
#include <boost/archive/binary_iarchive.hpp>
|
||||
@@ -59,6 +60,9 @@
|
||||
#include <G4Region.hh>
|
||||
#include <G4RegionStore.hh>
|
||||
#include <G4ProductionCuts.hh>
|
||||
#include <G4VisManager.hh>
|
||||
#include <G4Scene.hh>
|
||||
#include <G4VModel.hh>
|
||||
#include "CexmcRunManager.hh"
|
||||
#include "CexmcRunManagerMessenger.hh"
|
||||
#include "CexmcRunAction.hh"
|
||||
@@ -87,6 +91,7 @@
|
||||
#include "CexmcBasicPhysicsSettings.hh"
|
||||
#include "CexmcSensitiveDetectorsAttributes.hh"
|
||||
#include "CexmcCustomFilterEval.hh"
|
||||
#include "CexmcScenePrimitives.hh"
|
||||
|
||||
|
||||
namespace
|
||||
@@ -141,35 +146,11 @@ CexmcRunManager::CexmcRunManager( const G4String & projectId,
|
||||
}
|
||||
|
||||
|
||||
void CexmcRunManager::BeamParticleChangeHook( void )
|
||||
{
|
||||
const CexmcEventAction * eventAction(
|
||||
static_cast< const CexmcEventAction * >( userEventAction ) );
|
||||
if ( ! eventAction )
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
CexmcEventAction * theEventAction( const_cast< CexmcEventAction * >(
|
||||
eventAction ) );
|
||||
theEventAction->BeamParticleChangeHook();
|
||||
}
|
||||
|
||||
|
||||
CexmcRunManager::~CexmcRunManager()
|
||||
{
|
||||
#ifdef CEXMC_USE_PERSISTENCY
|
||||
if ( ProjectIsRead() && zipGdmlFile )
|
||||
{
|
||||
G4String cmd( G4String( "bzip2 " ) + projectsDir + "/" + rProject +
|
||||
gdmlFileExtension );
|
||||
if ( system( cmd ) != 0 )
|
||||
G4cerr << "Failed to zip geometry data" << G4endl;
|
||||
}
|
||||
|
||||
#ifdef CEXMC_USE_CUSTOM_FILTER
|
||||
delete customFilter;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
@@ -182,8 +163,8 @@ void CexmcRunManager::ReadPreinitProjectData( void )
|
||||
return;
|
||||
|
||||
/* read run data */
|
||||
std::ifstream runDataFile( ( projectsDir + "/" + rProject + ".rdb" ).
|
||||
c_str() );
|
||||
std::ifstream runDataFile( ( projectsDir + "/" + rProject + ".rdb" ).
|
||||
c_str() );
|
||||
if ( ! runDataFile )
|
||||
throw CexmcException( CexmcReadProjectIncomplete );
|
||||
|
||||
@@ -197,13 +178,16 @@ void CexmcRunManager::ReadPreinitProjectData( void )
|
||||
productionModelType = sObject.productionModelType;
|
||||
|
||||
/* read gdml file */
|
||||
G4String fileExtension( zipGdmlFile ? gdmlbz2FileExtension :
|
||||
gdmlFileExtension );
|
||||
G4String cmd( G4String( "cp " ) + projectsDir + "/" + rProject +
|
||||
fileExtension + " " + projectsDir + "/" + projectId +
|
||||
fileExtension );
|
||||
if ( ProjectIsSaved() && system( cmd ) != 0 )
|
||||
throw CexmcException( CexmcReadProjectIncomplete );
|
||||
G4String cmd;
|
||||
if ( ProjectIsSaved() )
|
||||
{
|
||||
G4String fileExtension( zipGdmlFile ? gdmlbz2FileExtension :
|
||||
gdmlFileExtension );
|
||||
cmd = G4String( "cp " ) + projectsDir + "/" + rProject + fileExtension +
|
||||
" " + projectsDir + "/" + projectId + fileExtension;
|
||||
if ( system( cmd ) != 0 )
|
||||
throw CexmcException( CexmcReadProjectIncomplete );
|
||||
}
|
||||
|
||||
if ( zipGdmlFile )
|
||||
{
|
||||
@@ -331,6 +315,8 @@ void CexmcRunManager::ReadProject( void )
|
||||
reconstructor->SetAbsorbedEnergyCutCLWidth( sObject.aeCutCLWidth );
|
||||
reconstructor->SetAbsorbedEnergyCutCRWidth( sObject.aeCutCRWidth );
|
||||
reconstructor->SetAbsorbedEnergyCutEllipseAngle( sObject.aeCutAngle );
|
||||
reconstructor->SetExpectedMomentumAmp( sObject.expectedMomentumAmp );
|
||||
reconstructor->SetEDCollectionAlgorithm( sObject.edCollectionAlgorithm );
|
||||
|
||||
physicsManager->SetProposedMaxIL( sObject.proposedMaxIL );
|
||||
|
||||
@@ -412,7 +398,7 @@ void CexmcRunManager::SaveProject( void )
|
||||
nmbOfSavedFastEvents = run->GetNmbOfSavedFastEvents();
|
||||
}
|
||||
|
||||
CexmcRunSObject sObjectToWrite(
|
||||
CexmcRunSObject sObjectToWrite = {
|
||||
basePhysicsUsed, productionModelType, gdmlFileName, etaDecayTable,
|
||||
physicsManager->GetProductionModel()->GetAngularRanges(),
|
||||
physicsManager->GetProductionModel()->IsFermiMotionOn(),
|
||||
@@ -456,7 +442,9 @@ void CexmcRunManager::SaveProject( void )
|
||||
nmbOfFalseHitsTriggeredRec, nmbOfSavedEvents, nmbOfSavedFastEvents,
|
||||
numberOfEventsProcessed, numberOfEventsProcessedEffective,
|
||||
numberOfEventToBeProcessed, rProject, skipInteractionsWithoutEDTonWrite,
|
||||
cfFileName, evDataVerboseLevel, physicsManager->GetProposedMaxIL() );
|
||||
cfFileName, evDataVerboseLevel, physicsManager->GetProposedMaxIL(),
|
||||
reconstructor->GetExpectedMomentumAmp(),
|
||||
reconstructor->GetEDCollectionAlgorithm(), 0 };
|
||||
|
||||
std::ofstream runDataFile( ( projectsDir + "/" + projectId + ".rdb" ).
|
||||
c_str() );
|
||||
@@ -465,20 +453,6 @@ void CexmcRunManager::SaveProject( void )
|
||||
boost::archive::binary_oarchive archive( runDataFile );
|
||||
archive << sObjectToWrite;
|
||||
}
|
||||
|
||||
/* save gdml file */
|
||||
G4String cmd( G4String( "cp " ) + gdmlFileName + " " +
|
||||
projectsDir + "/" + projectId +
|
||||
gdmlFileExtension );
|
||||
CexmcExceptionType exceptionType( CexmcSystemException );
|
||||
if ( zipGdmlFile )
|
||||
{
|
||||
cmd = G4String( "bzip2 -c " ) + gdmlFileName + " > " + projectsDir +
|
||||
"/" + projectId + gdmlbz2FileExtension;
|
||||
exceptionType = CexmcFileCompressException;
|
||||
}
|
||||
if ( system( cmd ) != 0 )
|
||||
throw CexmcException( exceptionType );
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -490,7 +464,7 @@ void CexmcRunManager::DoCommonEventLoop( G4int nEvent, const G4String & cmd,
|
||||
G4int iEvent( 0 );
|
||||
G4int iEventEffective( 0 );
|
||||
|
||||
for( iEvent = 0; iEventEffective < nEvent; ++iEvent )
|
||||
for ( iEvent = 0; iEventEffective < nEvent; ++iEvent )
|
||||
{
|
||||
currentEvent = GenerateEvent( iEvent );
|
||||
eventManager->ProcessOneEvent( currentEvent );
|
||||
@@ -515,11 +489,11 @@ void CexmcRunManager::DoCommonEventLoop( G4int nEvent, const G4String & cmd,
|
||||
}
|
||||
AnalyzeEvent( currentEvent );
|
||||
UpdateScoring();
|
||||
if( iEvent < nSelect )
|
||||
if ( iEvent < nSelect )
|
||||
G4UImanager::GetUIpointer()->ApplyCommand( cmd );
|
||||
StackPreviousEvent( currentEvent );
|
||||
currentEvent = 0;
|
||||
if( runAborted )
|
||||
if ( runAborted )
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -939,7 +913,6 @@ void CexmcRunManager::DoEventLoop( G4int nEvent, const char * macroFile,
|
||||
std::ofstream eventsDataFile(
|
||||
( projectsDir + "/" + projectId + ".edb" ).c_str() );
|
||||
boost::archive::binary_oarchive eventsArchive_( eventsDataFile );
|
||||
eventsArchive = &eventsArchive_;
|
||||
std::ofstream fastEventsDataFile(
|
||||
( projectsDir + "/" + projectId + ".fdb" ).c_str() );
|
||||
boost::archive::binary_oarchive fastEventsArchive_(
|
||||
@@ -979,12 +952,12 @@ void CexmcRunManager::DoEventLoop( G4int nEvent, const char * macroFile,
|
||||
DoCommonEventLoop( nEvent, cmd, nSelect );
|
||||
#endif
|
||||
|
||||
if( verboseLevel > 0 )
|
||||
if ( verboseLevel > 0 )
|
||||
{
|
||||
timer->Stop();
|
||||
G4cout << "Run terminated." << G4endl;
|
||||
G4cout << "Run Summary" << G4endl;
|
||||
if( runAborted )
|
||||
if ( runAborted )
|
||||
{
|
||||
G4cout << " Run Aborted after " << numberOfEventsProcessed <<
|
||||
" events processed." << G4endl;
|
||||
@@ -1007,6 +980,8 @@ void CexmcRunManager::PrintReadRunData( void ) const
|
||||
if ( ! ProjectIsRead() )
|
||||
return;
|
||||
|
||||
G4bool refCrystalInfoPrinted( false );
|
||||
|
||||
G4cout << CEXMC_LINE_START << "Run data read from project '" << rProject <<
|
||||
"'" << G4endl;
|
||||
G4cout << " (archive class version " <<
|
||||
@@ -1105,6 +1080,20 @@ void CexmcRunManager::PrintReadRunData( void ) const
|
||||
sObject.crystalResolutionData;
|
||||
}
|
||||
G4cout << " -- Reconstructor settings: " << G4endl;
|
||||
if ( sObject.expectedMomentumAmp > 0 )
|
||||
{
|
||||
G4cout << " -- expected momentum in the target: " <<
|
||||
G4BestUnit( sObject.expectedMomentumAmp, "Energy" ) << G4endl;
|
||||
}
|
||||
G4cout << " -- ed collection algorithm (0 - all, 1 - adjacent): " <<
|
||||
sObject.edCollectionAlgorithm << G4endl;
|
||||
if ( sObject.edCollectionAlgorithm == CexmcCollectEDInAdjacentCrystals )
|
||||
{
|
||||
G4cout <<
|
||||
" -- inner crystal used as reference (0 - no, 1 - yes): " <<
|
||||
sObject.useInnerRefCrystal << G4endl;
|
||||
refCrystalInfoPrinted = true;
|
||||
}
|
||||
G4cout << " -- entry point definition algorithm " << G4endl;
|
||||
G4cout << " (0 - center of calorimeter, 1 - center of crystal with "
|
||||
"max ED," << G4endl;
|
||||
@@ -1122,12 +1111,13 @@ void CexmcRunManager::PrintReadRunData( void ) const
|
||||
" -- crystal selection algorithm (0 - all, 1 - adjacent): " <<
|
||||
sObject.csAlgorithm << G4endl;
|
||||
}
|
||||
if ( sObject.epDefinitionAlgorithm ==
|
||||
if ( ! refCrystalInfoPrinted &&
|
||||
( sObject.epDefinitionAlgorithm ==
|
||||
CexmcEntryPointInTheCenterOfCrystalWithMaxED ||
|
||||
( ( sObject.epDefinitionAlgorithm == CexmcEntryPointBySqrtEDWeights ||
|
||||
sObject.epDefinitionAlgorithm ==
|
||||
CexmcEntryPointByLinearEDWeights ) &&
|
||||
sObject.csAlgorithm == CexmcSelectAdjacentCrystals ) )
|
||||
sObject.csAlgorithm == CexmcSelectAdjacentCrystals ) ) )
|
||||
{
|
||||
G4cout <<
|
||||
" -- inner crystal used as reference (0 - no, 1 - yes): " <<
|
||||
@@ -1168,7 +1158,7 @@ void CexmcRunManager::PrintReadRunData( void ) const
|
||||
G4cout << " -- absorbed energy cut angle of the ellipse: " <<
|
||||
sObject.aeCutAngle / deg << " deg" << G4endl;
|
||||
}
|
||||
G4cout << " -- Setup acceptances (real, rec): " << G4endl;
|
||||
G4cout << G4endl;
|
||||
CexmcRunAction::PrintResults( sObject.nmbOfHitsSampled,
|
||||
sObject.nmbOfHitsSampledFull,
|
||||
sObject.nmbOfHitsTriggeredRealRange,
|
||||
@@ -1177,13 +1167,15 @@ void CexmcRunManager::PrintReadRunData( void ) const
|
||||
sObject.angularRanges,
|
||||
sObject.nmbOfFalseHitsTriggeredEDT,
|
||||
sObject.nmbOfFalseHitsTriggeredRec );
|
||||
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
|
||||
void CexmcRunManager::ReadAndPrintEventsData( void ) const
|
||||
{
|
||||
if ( ! ProjectIsRead() )
|
||||
return;
|
||||
|
||||
CexmcEventSObject evSObject;
|
||||
|
||||
/* read events data */
|
||||
@@ -1229,6 +1221,9 @@ void CexmcRunManager::ReadAndPrintEventsData( void ) const
|
||||
void CexmcRunManager::PrintReadData(
|
||||
const CexmcOutputDataTypeSet & outputData ) const
|
||||
{
|
||||
if ( ! ProjectIsRead() )
|
||||
return;
|
||||
|
||||
G4bool addSpace( false );
|
||||
|
||||
CexmcOutputDataTypeSet::const_iterator found(
|
||||
@@ -1238,7 +1233,15 @@ void CexmcRunManager::PrintReadData(
|
||||
G4String cmd( G4String( "cat " ) + projectsDir + "/" + rProject +
|
||||
gdmlFileExtension );
|
||||
if ( system( cmd ) != 0 )
|
||||
G4cerr << "Failed to cat geometry data" << G4endl;
|
||||
throw CexmcException( CexmcReadProjectIncomplete );
|
||||
|
||||
if ( zipGdmlFile )
|
||||
{
|
||||
cmd = G4String( "bzip2 " ) + projectsDir + "/" + rProject +
|
||||
gdmlFileExtension;
|
||||
if ( system( cmd ) != 0 )
|
||||
throw CexmcException( CexmcFileCompressException );
|
||||
}
|
||||
|
||||
addSpace = true;
|
||||
}
|
||||
@@ -1267,6 +1270,7 @@ void CexmcRunManager::PrintReadData(
|
||||
{
|
||||
etaDecayTable->GetDecayChannel( k->first )->SetBR( k->second );
|
||||
}
|
||||
|
||||
PrintReadRunData();
|
||||
}
|
||||
}
|
||||
@@ -1298,3 +1302,83 @@ void CexmcRunManager::SetCustomFilter( const G4String & cfFileName_ )
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void CexmcRunManager::RegisterScenePrimitives( void )
|
||||
{
|
||||
G4VisManager * visManager( static_cast< G4VisManager * >(
|
||||
G4VVisManager::GetConcreteInstance() ) );
|
||||
if ( ! visManager )
|
||||
return;
|
||||
|
||||
G4Scene * curScene( visManager->GetCurrentScene() );
|
||||
if ( ! curScene )
|
||||
return;
|
||||
|
||||
/* G4Scene declarations lack this kind of typedef */
|
||||
typedef std::vector< G4VModel * > MList;
|
||||
const MList & mList( curScene->GetRunDurationModelList() );
|
||||
|
||||
for ( MList::const_iterator k( mList.begin() ); k != mList.end(); ++k )
|
||||
{
|
||||
if ( ( *k )->GetGlobalDescription() == CexmcScenePrimitivesDescription )
|
||||
return;
|
||||
}
|
||||
|
||||
CexmcSetup * setup( static_cast< CexmcSetup * >( userDetector ) );
|
||||
if ( ! setup )
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
/* BEWARE: looks like G4Scene won't delete models from its lists upon
|
||||
* termination! Hence destructor of the new model won't be called */
|
||||
curScene->AddRunDurationModel( new CexmcScenePrimitives( setup ) );
|
||||
}
|
||||
|
||||
|
||||
void CexmcRunManager::BeamParticleChangeHook( void )
|
||||
{
|
||||
const CexmcEventAction * eventAction(
|
||||
static_cast< const CexmcEventAction * >( userEventAction ) );
|
||||
if ( ! eventAction )
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
CexmcEventAction * theEventAction( const_cast< CexmcEventAction * >(
|
||||
eventAction ) );
|
||||
theEventAction->BeamParticleChangeHook();
|
||||
}
|
||||
|
||||
|
||||
void CexmcRunManager::SetupConstructionHook( void )
|
||||
{
|
||||
#ifdef CEXMC_USE_PERSISTENCY
|
||||
/* save gdml file */
|
||||
G4String cmd( "" );
|
||||
CexmcExceptionType exceptionType( CexmcSystemException );
|
||||
|
||||
if ( zipGdmlFile )
|
||||
{
|
||||
if ( ProjectIsRead() )
|
||||
{
|
||||
cmd = G4String( "bzip2 " ) + projectsDir + "/" + rProject +
|
||||
gdmlFileExtension;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ProjectIsSaved() )
|
||||
cmd = G4String( "bzip2 -c " ) + gdmlFileName + " > " +
|
||||
projectsDir + "/" + projectId + gdmlbz2FileExtension;
|
||||
}
|
||||
exceptionType = CexmcFileCompressException;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! ProjectIsRead() && ProjectIsSaved() )
|
||||
cmd = G4String( "cp " ) + gdmlFileName + " " + projectsDir + "/" +
|
||||
projectId + gdmlFileExtension;
|
||||
/* else already saved in ReadPreinitProjectData() */
|
||||
}
|
||||
|
||||
if ( ! cmd.empty() && system( cmd ) != 0 )
|
||||
throw CexmcException( exceptionType );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <G4UIcmdWithAString.hh>
|
||||
#include <G4UIcmdWithAnInteger.hh>
|
||||
#include <G4UIcmdWithABool.hh>
|
||||
#include <G4UIcmdWithoutParameter.hh>
|
||||
#include "CexmcRunManager.hh"
|
||||
#include "CexmcRunManagerMessenger.hh"
|
||||
#include "CexmcMessenger.hh"
|
||||
@@ -57,7 +58,7 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
|
||||
#ifdef CEXMC_USE_PERSISTENCY
|
||||
replayEvents( NULL ), seekTo( NULL ), skipInteractionsWithoutEDT( NULL ),
|
||||
#endif
|
||||
validateGdmlFile( NULL )
|
||||
registerScenePrimitives( NULL ), validateGdmlFile( NULL )
|
||||
{
|
||||
setProductionModel = new G4UIcmdWithAString(
|
||||
( CexmcMessenger::physicsDirName + "productionModel" ).c_str(), this );
|
||||
@@ -85,8 +86,8 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
|
||||
" interaction - events with studied interaction triggered,\n"
|
||||
" trigger - only events with trigger" );
|
||||
setEventCountPolicy->SetParameterName( "EventCountPolicy", false );
|
||||
setEventCountPolicy->SetDefaultValue( "all" );
|
||||
setEventCountPolicy->SetCandidates( "all interaction trigger" );
|
||||
setEventCountPolicy->SetDefaultValue( "all" );
|
||||
setEventCountPolicy->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setEventDataVerboseLevel = new G4UIcmdWithAString(
|
||||
@@ -98,8 +99,8 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
|
||||
" interaction - when studied interaction triggered (TPT)" );
|
||||
setEventDataVerboseLevel->SetParameterName( "EventDataVerboseLevel",
|
||||
false );
|
||||
setEventDataVerboseLevel->SetDefaultValue( "trigger" );
|
||||
setEventDataVerboseLevel->SetCandidates( "nosave trigger interaction" );
|
||||
setEventDataVerboseLevel->SetDefaultValue( "trigger" );
|
||||
setEventDataVerboseLevel->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
@@ -111,8 +112,8 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
|
||||
"\n If number of events is 0 (or not specified) then all"
|
||||
"\n run will be replayed" );
|
||||
replayEvents->SetParameterName( "ReplayEvents", true );
|
||||
replayEvents->SetDefaultValue( 0 );
|
||||
replayEvents->SetRange( "ReplayEvents >= 0" );
|
||||
replayEvents->SetDefaultValue( 0 );
|
||||
replayEvents->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
seekTo = new G4UIcmdWithAnInteger(
|
||||
@@ -123,8 +124,8 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
|
||||
"\n first recorded event with interaction after fourth recorded"
|
||||
"\n event with trigger" );
|
||||
seekTo->SetParameterName( "SeekTo", false );
|
||||
seekTo->SetDefaultValue( 0 );
|
||||
seekTo->SetRange( "SeekTo >= 0" );
|
||||
seekTo->SetDefaultValue( 0 );
|
||||
seekTo->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
skipInteractionsWithoutEDT = new G4UIcmdWithABool(
|
||||
@@ -141,6 +142,14 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
|
||||
G4State_Idle );
|
||||
#endif
|
||||
|
||||
registerScenePrimitives = new G4UIcmdWithoutParameter(
|
||||
( CexmcMessenger::visDirName + "registerScenePrimitives" ).c_str(),
|
||||
this );
|
||||
registerScenePrimitives->SetGuidance( "Register custom scene primitives "
|
||||
"(radial lines,\n inner crystals highlights etc.)" );
|
||||
registerScenePrimitives->AvailableForStates( G4State_PreInit,
|
||||
G4State_Idle );
|
||||
|
||||
validateGdmlFile = new G4UIcmdWithABool(
|
||||
( CexmcMessenger::geometryDirName + "validateGdmlFile" ).c_str(),
|
||||
this );
|
||||
@@ -163,6 +172,7 @@ CexmcRunManagerMessenger::~CexmcRunManagerMessenger()
|
||||
delete seekTo;
|
||||
delete skipInteractionsWithoutEDT;
|
||||
#endif
|
||||
delete registerScenePrimitives;
|
||||
delete validateGdmlFile;
|
||||
}
|
||||
|
||||
@@ -265,6 +275,11 @@ void CexmcRunManagerMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if ( cmd == registerScenePrimitives )
|
||||
{
|
||||
runManager->RegisterScenePrimitives();
|
||||
break;
|
||||
}
|
||||
if ( cmd == validateGdmlFile )
|
||||
{
|
||||
runManager->SetGdmlFileValidation(
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* ============================================================================
|
||||
*
|
||||
* Filename: CexmcRunSObject.cc
|
||||
*
|
||||
* Description: run data serialization helper
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 23.12.2009 14:41:49
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Alexey Radkov (),
|
||||
* Company: PNPI
|
||||
*
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
#ifdef CEXMC_USE_PERSISTENCY
|
||||
|
||||
#include "CexmcRunSObject.hh"
|
||||
|
||||
CexmcRunSObject::CexmcRunSObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CexmcRunSObject::CexmcRunSObject(
|
||||
CexmcBasePhysicsUsed basePhysicsUsed,
|
||||
CexmcProductionModelType productionModelType,
|
||||
const std::string & gdmlFileName,
|
||||
const CexmcSimpleDecayTableStore & etaDecayTable,
|
||||
const CexmcAngularRangeList & angularRanges, G4bool fermiMotionIsOn,
|
||||
const std::vector< G4double > & calorimeterRegCuts,
|
||||
CexmcEventCountPolicy eventCountPolicy,
|
||||
const std::string & beamParticle,
|
||||
const CexmcSimpleThreeVectorStore & beamPos,
|
||||
const CexmcSimpleThreeVectorStore & beamDir, G4double beamMomentumAmp,
|
||||
G4double beamFwhmPosX, G4double beamFwhmPosY, G4double beamFwhmDirX,
|
||||
G4double beamFwhmDirY, G4double beamFwhmMomentumAmp,
|
||||
G4double monitorEDThreshold, G4double vetoCounterEDLeftThreshold,
|
||||
G4double vetoCounterEDRightThreshold,
|
||||
G4double calorimeterEDLeftThreshold,
|
||||
G4double calorimeterEDRightThreshold,
|
||||
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm,
|
||||
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm,
|
||||
G4double outerCrystalsVetoFraction,
|
||||
G4bool applyFiniteCrystalResolution,
|
||||
const CexmcEnergyRangeWithDoubleValueList & crystalResolutionData,
|
||||
CexmcCalorimeterEntryPointDefinitionAlgorithm epDefinitionAlgorithm,
|
||||
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
|
||||
epDepthDefinitionAlgorithm,
|
||||
CexmcCrystalSelectionAlgorithm csAlgorithm, G4bool useInnerRefCrystal,
|
||||
G4double epDepth, G4bool useTableMass, G4bool useMassCut,
|
||||
G4double mCutOPCenter, G4double mCutNOPCenter, G4double mCutOPWidth,
|
||||
G4double mCutNOPWidth, G4double mCutAngle,
|
||||
G4bool useAbsorbedEnergyCut, G4double aeCutCLCenter,
|
||||
G4double aeCutCRCenter, G4double aeCutCLWidth, G4double aeCutCRWidth,
|
||||
G4double aeCutAngle, CexmcNmbOfHitsInRanges nmbOfHitsSampled,
|
||||
CexmcNmbOfHitsInRanges nmbOfHitsSampledFull,
|
||||
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRealRange,
|
||||
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRecRange,
|
||||
CexmcNmbOfHitsInRanges nmbOfOrphanHits,
|
||||
G4int nmbOfFalseHitsTriggeredEDT, G4int nmbOfFalseHitsTriggeredRec,
|
||||
G4int nmbOfSavedEvents, G4int nmbOfSavedFastEvents,
|
||||
G4int numberOfEventsProcessed, G4int numberOfEventsProcessedEffective,
|
||||
G4int numberOfEventsToBeProcessed, const std::string & rProject,
|
||||
G4bool interactionsWithoutEDTWereSkipped,
|
||||
const std::string & cfFileName,
|
||||
CexmcEventDataVerboseLevel evDataVerboseLevel,
|
||||
G4double proposedMaxIL ) :
|
||||
basePhysicsUsed( basePhysicsUsed ),
|
||||
productionModelType( productionModelType ), gdmlFileName( gdmlFileName ),
|
||||
etaDecayTable( etaDecayTable ), angularRanges( angularRanges ),
|
||||
fermiMotionIsOn( fermiMotionIsOn ),
|
||||
calorimeterRegCuts( calorimeterRegCuts ),
|
||||
eventCountPolicy( eventCountPolicy ), beamParticle( beamParticle ),
|
||||
beamPos( beamPos ), beamDir( beamDir ), beamMomentumAmp( beamMomentumAmp ),
|
||||
beamFwhmPosX( beamFwhmPosX ), beamFwhmPosY( beamFwhmPosY ),
|
||||
beamFwhmDirX( beamFwhmDirX ), beamFwhmDirY( beamFwhmDirY ),
|
||||
beamFwhmMomentumAmp( beamFwhmMomentumAmp ),
|
||||
monitorEDThreshold( monitorEDThreshold ),
|
||||
vetoCounterEDLeftThreshold( vetoCounterEDLeftThreshold ),
|
||||
vetoCounterEDRightThreshold( vetoCounterEDRightThreshold ),
|
||||
calorimeterEDLeftThreshold( calorimeterEDLeftThreshold ),
|
||||
calorimeterEDRightThreshold( calorimeterEDRightThreshold ),
|
||||
calorimeterTriggerAlgorithm( calorimeterTriggerAlgorithm ),
|
||||
outerCrystalsVetoAlgorithm( outerCrystalsVetoAlgorithm ),
|
||||
outerCrystalsVetoFraction( outerCrystalsVetoFraction ),
|
||||
applyFiniteCrystalResolution( applyFiniteCrystalResolution ),
|
||||
crystalResolutionData( crystalResolutionData ),
|
||||
epDefinitionAlgorithm( epDefinitionAlgorithm ),
|
||||
epDepthDefinitionAlgorithm( epDepthDefinitionAlgorithm ),
|
||||
csAlgorithm( csAlgorithm ), useInnerRefCrystal( useInnerRefCrystal ),
|
||||
epDepth( epDepth ), useTableMass( useTableMass ), useMassCut( useMassCut ),
|
||||
mCutOPCenter( mCutOPCenter ), mCutNOPCenter( mCutNOPCenter ),
|
||||
mCutOPWidth( mCutOPWidth ), mCutNOPWidth( mCutNOPWidth ),
|
||||
mCutAngle( mCutAngle ), useAbsorbedEnergyCut( useAbsorbedEnergyCut ),
|
||||
aeCutCLCenter( aeCutCLCenter ), aeCutCRCenter( aeCutCRCenter ),
|
||||
aeCutCLWidth( aeCutCLWidth ), aeCutCRWidth( aeCutCRWidth ),
|
||||
aeCutAngle( aeCutAngle ), nmbOfHitsSampled( nmbOfHitsSampled ),
|
||||
nmbOfHitsSampledFull( nmbOfHitsSampledFull ),
|
||||
nmbOfHitsTriggeredRealRange( nmbOfHitsTriggeredRealRange ),
|
||||
nmbOfHitsTriggeredRecRange( nmbOfHitsTriggeredRecRange ),
|
||||
nmbOfOrphanHits( nmbOfOrphanHits ),
|
||||
nmbOfFalseHitsTriggeredEDT( nmbOfFalseHitsTriggeredEDT ),
|
||||
nmbOfFalseHitsTriggeredRec( nmbOfFalseHitsTriggeredRec ),
|
||||
nmbOfSavedEvents( nmbOfSavedEvents ),
|
||||
nmbOfSavedFastEvents( nmbOfSavedFastEvents ),
|
||||
numberOfEventsProcessed( numberOfEventsProcessed ),
|
||||
numberOfEventsProcessedEffective( numberOfEventsProcessedEffective ),
|
||||
numberOfEventsToBeProcessed( numberOfEventsToBeProcessed ),
|
||||
rProject( rProject ),
|
||||
interactionsWithoutEDTWereSkipped( interactionsWithoutEDTWereSkipped ),
|
||||
cfFileName( cfFileName ), evDataVerboseLevel( evDataVerboseLevel ),
|
||||
proposedMaxIL( proposedMaxIL ), actualVersion( CEXMC_RUN_SOBJECT_VERSION )
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* =============================================================================
|
||||
*
|
||||
* Filename: CexmcScenePrimitives.cc
|
||||
*
|
||||
* Description: auxiliary scene primitives (radial lines etc.)
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 03.01.2011 11:45:33
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Alexey Radkov (),
|
||||
* Company: PNPI
|
||||
*
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <G4Polyline.hh>
|
||||
#include <G4Circle.hh>
|
||||
#include <G4Polyhedron.hh>
|
||||
#include <G4ThreeVector.hh>
|
||||
#include <G4VisAttributes.hh>
|
||||
#include <G4VGraphicsScene.hh>
|
||||
#include <G4AffineTransform.hh>
|
||||
#include <G4Transform3D.hh>
|
||||
#include <G4Point3D.hh>
|
||||
#include "CexmcScenePrimitives.hh"
|
||||
#include "CexmcScenePrimitivesMessenger.hh"
|
||||
#include "CexmcSetup.hh"
|
||||
#include "CexmcCommon.hh"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
G4double CexmcRadialLineWidth( 2.0 );
|
||||
G4double CexmcRadialLineCapScreenSize( 4.0 );
|
||||
G4double CexmcMarkerScreenSize( 2.0 );
|
||||
G4double CexmcICHlLineLineWidth( 1.0 );
|
||||
G4Colour CexmcDefaultSPColour( 1.0, 1.0, 1.0 );
|
||||
}
|
||||
|
||||
|
||||
CexmcScenePrimitives::CexmcScenePrimitives( CexmcSetup * setup ) :
|
||||
setup( setup ), markTargetCenter( false ), highlightInnerCrystals( false ),
|
||||
messenger( NULL )
|
||||
{
|
||||
messenger = new CexmcScenePrimitivesMessenger( this );
|
||||
SetGlobalDescription( CexmcScenePrimitivesDescription );
|
||||
spColours[ CexmcTargetCenterMark_SP ] = CexmcDefaultSPColour;
|
||||
spColours[ CexmcRadialLine_SP ] = CexmcDefaultSPColour;
|
||||
spColours[ CexmcInnerCrystalsHl_SP ] = CexmcDefaultSPColour;
|
||||
}
|
||||
|
||||
|
||||
CexmcScenePrimitives::~CexmcScenePrimitives()
|
||||
{
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
|
||||
void CexmcScenePrimitives::DescribeYourselfTo( G4VGraphicsScene & scene )
|
||||
{
|
||||
if ( markTargetCenter )
|
||||
MarkTargetCenter( scene );
|
||||
if ( highlightInnerCrystals )
|
||||
HighlightInnerCrystals( scene );
|
||||
for ( CexmcRadialLines::const_iterator k( radialLines.begin() );
|
||||
k != radialLines.end(); ++k )
|
||||
{
|
||||
DrawRadialLine( scene, &*k );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CexmcScenePrimitives::MarkTargetCenter( G4VGraphicsScene & scene )
|
||||
{
|
||||
G4Circle circle;
|
||||
circle.SetScreenSize( CexmcMarkerScreenSize );
|
||||
circle.SetFillStyle( G4Circle::filled );
|
||||
circle.SetVisAttributes( spColours[ CexmcTargetCenterMark_SP ] );
|
||||
|
||||
const G4AffineTransform & transform( setup->GetTargetTransform() );
|
||||
G4Transform3D transform3D( G4RotationMatrix(),
|
||||
transform.NetTranslation() );
|
||||
|
||||
scene.BeginPrimitives( transform3D );
|
||||
scene.AddPrimitive( circle );
|
||||
scene.EndPrimitives();
|
||||
}
|
||||
|
||||
|
||||
void CexmcScenePrimitives::DrawRadialLine( G4VGraphicsScene & scene,
|
||||
const CexmcRadialLine * rLine )
|
||||
{
|
||||
G4double theta( rLine->theta * deg );
|
||||
G4double phi( rLine->phi * deg );
|
||||
G4double length( rLine->length * cm );
|
||||
G4Point3D radialLineEnd( - std::sin( theta ) * std::cos( phi ) * length,
|
||||
std::sin( theta ) * std::sin( phi ) * length,
|
||||
std::cos( theta ) * length );
|
||||
|
||||
G4Polyline line;
|
||||
line.push_back( G4ThreeVector() );
|
||||
line.push_back( radialLineEnd );
|
||||
|
||||
G4VisAttributes visAttributes( spColours[ CexmcRadialLine_SP ] );
|
||||
visAttributes.SetLineWidth( CexmcRadialLineWidth );
|
||||
line.SetVisAttributes( visAttributes );
|
||||
|
||||
G4Circle circle;
|
||||
circle.SetScreenSize( CexmcRadialLineCapScreenSize );
|
||||
circle.SetFillStyle( G4Circle::filled );
|
||||
circle.SetVisAttributes( spColours[ CexmcRadialLine_SP ] );
|
||||
|
||||
const G4AffineTransform & transform( setup->GetTargetTransform() );
|
||||
G4Transform3D transform3D( G4RotationMatrix(),
|
||||
transform.NetTranslation() );
|
||||
|
||||
scene.BeginPrimitives( transform3D );
|
||||
scene.AddPrimitive( circle );
|
||||
scene.AddPrimitive( line );
|
||||
scene.EndPrimitives();
|
||||
}
|
||||
|
||||
|
||||
void CexmcScenePrimitives::HighlightInnerCrystals( G4VGraphicsScene & scene )
|
||||
{
|
||||
const CexmcSetup::CalorimeterGeometryData & calorimeterGeometry(
|
||||
setup->GetCalorimeterGeometry() );
|
||||
G4double icWidth( calorimeterGeometry.crystalWidth *
|
||||
( calorimeterGeometry.nCrystalsInRow - 2 ) / 2 );
|
||||
G4double icHeight( calorimeterGeometry.crystalHeight *
|
||||
( calorimeterGeometry.nCrystalsInColumn - 2 ) / 2 );
|
||||
G4double icLength( calorimeterGeometry.crystalLength / 2 );
|
||||
icWidth = icWidth < 0 ? 0 : icWidth;
|
||||
icHeight = icHeight < 0 ? 0 : icHeight;
|
||||
|
||||
G4PolyhedronBox innerCrystals( icWidth, icHeight, icLength );
|
||||
G4VisAttributes visAttributes( spColours[ CexmcInnerCrystalsHl_SP ] );
|
||||
visAttributes.SetLineWidth( CexmcICHlLineLineWidth );
|
||||
innerCrystals.SetVisAttributes( visAttributes );
|
||||
|
||||
const G4AffineTransform & transformLeft(
|
||||
setup->GetCalorimeterLeftTransform() );
|
||||
G4Transform3D transform3DLeft(
|
||||
transformLeft.NetRotation().inverse(),
|
||||
transformLeft.NetTranslation() );
|
||||
const G4AffineTransform & transformRight(
|
||||
setup->GetCalorimeterRightTransform() );
|
||||
G4Transform3D transform3DRight(
|
||||
transformRight.NetRotation().inverse(),
|
||||
transformRight.NetTranslation() );
|
||||
|
||||
scene.BeginPrimitives( transform3DLeft );
|
||||
scene.AddPrimitive( innerCrystals );
|
||||
scene.EndPrimitives();
|
||||
scene.BeginPrimitives( transform3DRight );
|
||||
scene.AddPrimitive( innerCrystals );
|
||||
scene.EndPrimitives();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* =============================================================================
|
||||
*
|
||||
* Filename: CexmcScenePrimitivesMessenger.cc
|
||||
*
|
||||
* Description: draw auxiliary scene primitives
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 03.01.2011 12:42:03
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Alexey Radkov (),
|
||||
* Company: PNPI
|
||||
*
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
#include <G4UIparameter.hh>
|
||||
#include <G4UIcommand.hh>
|
||||
#include <G4UIcmdWith3Vector.hh>
|
||||
#include <G4UIcmdWithABool.hh>
|
||||
#include <G4UIcmdWithoutParameter.hh>
|
||||
#include <G4Colour.hh>
|
||||
#include "CexmcScenePrimitives.hh"
|
||||
#include "CexmcScenePrimitivesMessenger.hh"
|
||||
#include "CexmcMessenger.hh"
|
||||
|
||||
|
||||
CexmcScenePrimitivesMessenger::CexmcScenePrimitivesMessenger(
|
||||
CexmcScenePrimitives * scenePrimitives ) :
|
||||
scenePrimitives( scenePrimitives ), drawRadialLine( NULL ),
|
||||
clearRadialLines( NULL ), markTargetCenter( NULL ),
|
||||
highlightInnerCrystals( NULL ), setColour( NULL )
|
||||
{
|
||||
drawRadialLine = new G4UIcmdWith3Vector(
|
||||
( CexmcMessenger::visDirName + "drawRadialLine" ).c_str(), this );
|
||||
drawRadialLine->SetGuidance( "Draw radial line with specified theta, phi "
|
||||
"(both in deg!)\n and length (in cm!)" );
|
||||
drawRadialLine->SetParameterName( "RadialLineTheta", "RadialLinePhi",
|
||||
"RadialLineLength", true );
|
||||
drawRadialLine->SetRange( "RadialLineLength >= 0." );
|
||||
drawRadialLine->SetDefaultValue( G4ThreeVector( 0., 0., 100. ) );
|
||||
drawRadialLine->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
clearRadialLines = new G4UIcmdWithoutParameter(
|
||||
( CexmcMessenger::visDirName + "clearRadialLines" ).c_str(), this );
|
||||
clearRadialLines->SetGuidance( "Clear all existing radial lines" );
|
||||
clearRadialLines->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
markTargetCenter = new G4UIcmdWithABool(
|
||||
( CexmcMessenger::visDirName + "markTargetCenter" ).c_str(), this );
|
||||
markTargetCenter->SetGuidance( "Mark/unmark target center" );
|
||||
markTargetCenter->SetParameterName( "MarkTargetCenter", true );
|
||||
markTargetCenter->SetDefaultValue( true );
|
||||
markTargetCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
highlightInnerCrystals = new G4UIcmdWithABool(
|
||||
( CexmcMessenger::visDirName + "hlIC" ).c_str(), this );
|
||||
highlightInnerCrystals->SetGuidance( "Highlight inner crystals in "
|
||||
"calorimeters on/off" );
|
||||
highlightInnerCrystals->SetParameterName( "HighlightInnerCrystals", true );
|
||||
highlightInnerCrystals->SetDefaultValue( true );
|
||||
highlightInnerCrystals->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
|
||||
setColour = new G4UIcommand(
|
||||
( CexmcMessenger::visDirName + "setColour" ).c_str(), this );
|
||||
setColour->SetGuidance( "Set colour of specified scene primitive" );
|
||||
G4UIparameter * parameter( new G4UIparameter( "ScenePrimitive", 's',
|
||||
false ) );
|
||||
parameter->SetGuidance( "Scene primitive, possible values:\n"
|
||||
" tc - target center mark,\n"
|
||||
" rl - radial lines,\n"
|
||||
" ic - inner crystal highlights" );
|
||||
parameter->SetParameterCandidates( "tc rl ic" );
|
||||
setColour->SetParameter( parameter );
|
||||
parameter = new G4UIparameter( "red", 's', true );
|
||||
parameter->SetGuidance( "Red component or string, e.g. \"blue\", in which "
|
||||
"case succeeding colour\n components are ignored" );
|
||||
parameter->SetDefaultValue( "1.0" );
|
||||
setColour->SetParameter( parameter );
|
||||
parameter = new G4UIparameter( "green", 'd', true );
|
||||
parameter->SetGuidance( "Green component" );
|
||||
parameter->SetDefaultValue( 1.0 );
|
||||
setColour->SetParameter( parameter );
|
||||
parameter = new G4UIparameter( "blue", 'd', true );
|
||||
parameter->SetGuidance( "Blue component" );
|
||||
parameter->SetDefaultValue( 1.0 );
|
||||
setColour->SetParameter( parameter );
|
||||
parameter = new G4UIparameter( "opacity", 'd', true );
|
||||
parameter->SetGuidance( "Opacity" );
|
||||
parameter->SetDefaultValue( 1.0 );
|
||||
setColour->SetParameter( parameter );
|
||||
setColour->AvailableForStates( G4State_PreInit, G4State_Idle );
|
||||
}
|
||||
|
||||
|
||||
CexmcScenePrimitivesMessenger::~CexmcScenePrimitivesMessenger()
|
||||
{
|
||||
delete drawRadialLine;
|
||||
delete clearRadialLines;
|
||||
delete markTargetCenter;
|
||||
delete highlightInnerCrystals;
|
||||
delete setColour;
|
||||
}
|
||||
|
||||
|
||||
void CexmcScenePrimitivesMessenger::SetNewValue( G4UIcommand * cmd,
|
||||
G4String value )
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( cmd == drawRadialLine )
|
||||
{
|
||||
G4ThreeVector line( G4UIcmdWith3Vector::GetNew3VectorValue(
|
||||
value ) );
|
||||
scenePrimitives->DrawRadialLine( line );
|
||||
break;
|
||||
}
|
||||
if ( cmd == clearRadialLines )
|
||||
{
|
||||
scenePrimitives->ClearRadialLines();
|
||||
break;
|
||||
}
|
||||
if ( cmd == markTargetCenter )
|
||||
{
|
||||
scenePrimitives->MarkTargetCenter(
|
||||
G4UIcmdWithABool::GetNewBoolValue( value ) );
|
||||
break;
|
||||
}
|
||||
if ( cmd == highlightInnerCrystals )
|
||||
{
|
||||
scenePrimitives->HighlightInnerCrystals(
|
||||
G4UIcmdWithABool::GetNewBoolValue( value ) );
|
||||
break;
|
||||
}
|
||||
if ( cmd == setColour )
|
||||
{
|
||||
G4String name;
|
||||
G4String redOrString;
|
||||
G4double green( 1 );
|
||||
G4double blue( 1 );
|
||||
G4double opacity( 1 );
|
||||
G4Colour colour( 1, green, blue, opacity );
|
||||
std::istringstream iss( value );
|
||||
|
||||
iss >> name >> redOrString >> green >> blue >> opacity;
|
||||
|
||||
if ( std::isalpha( redOrString[ size_t( 0 ) ] ) )
|
||||
{
|
||||
G4Colour::GetColour( redOrString, colour );
|
||||
}
|
||||
else
|
||||
{
|
||||
colour = G4Colour( G4UIcommand::ConvertToDouble( redOrString ),
|
||||
green, blue );
|
||||
}
|
||||
colour = G4Colour( colour.GetRed(), colour.GetGreen(),
|
||||
colour.GetBlue(), opacity );
|
||||
|
||||
CexmcSPType primitive( CexmcTargetCenterMark_SP );
|
||||
do
|
||||
{
|
||||
if ( name == "tc" )
|
||||
{
|
||||
primitive = CexmcTargetCenterMark_SP;
|
||||
break;
|
||||
}
|
||||
if ( name == "rl" )
|
||||
{
|
||||
primitive = CexmcRadialLine_SP;
|
||||
break;
|
||||
}
|
||||
if ( name == "ic" )
|
||||
{
|
||||
primitive = CexmcInnerCrystalsHl_SP;
|
||||
break;
|
||||
}
|
||||
return;
|
||||
} while ( false );
|
||||
|
||||
scenePrimitives->SetColour( primitive, colour );
|
||||
break;
|
||||
}
|
||||
} while ( false );
|
||||
}
|
||||
|
||||
@@ -46,22 +46,34 @@
|
||||
#include <G4UIcommandTree.hh>
|
||||
#include <G4UIcmdWithAnInteger.hh>
|
||||
#include <G4VPrimitiveScorer.hh>
|
||||
#include <G4MultiFunctionalDetector.hh>
|
||||
#include "CexmcSensitiveDetectorMessenger.hh"
|
||||
#include "CexmcMessenger.hh"
|
||||
#include "CexmcException.hh"
|
||||
|
||||
|
||||
CexmcSensitiveDetectorMessenger::CexmcSensitiveDetectorMessenger(
|
||||
G4VPrimitiveScorer * scorer, const G4String & detectorName ) :
|
||||
G4VPrimitiveScorer * scorer ) :
|
||||
scorer( scorer ), detectorPath( NULL ), setVerboseLevel( NULL )
|
||||
{
|
||||
G4String detectorFullPath(
|
||||
( CexmcMessenger::detectorDirName + detectorName + "/" ).c_str() );
|
||||
G4MultiFunctionalDetector * detector(
|
||||
scorer->GetMultiFunctionalDetector() );
|
||||
/* detector of the scorer must have been already initialized provided
|
||||
* CexmcPrimitiveScorer::InitializeMessenger() was properly called upon
|
||||
* creation of the setup */
|
||||
if ( ! detector )
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
G4String detectorFullPath( ( CexmcMessenger::detectorDirName +
|
||||
detector->GetName() + "/" + scorer->GetName() + "/" ).
|
||||
c_str() );
|
||||
G4UImanager * uiManager( G4UImanager::GetUIpointer() );
|
||||
if ( ! uiManager->GetTree()->FindCommandTree( detectorFullPath.c_str() ) )
|
||||
{
|
||||
detectorPath = new G4UIdirectory( detectorFullPath.c_str() );
|
||||
detectorPath->SetGuidance( "Settings for given sensitive detector" );
|
||||
}
|
||||
|
||||
setVerboseLevel = new G4UIcmdWithAnInteger(
|
||||
( detectorFullPath + "verbose" ).c_str(), this );
|
||||
setVerboseLevel->SetGuidance( "0 - do not print messages, "
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
|
||||
#include <G4GDMLParser.hh>
|
||||
#include <G4MultiFunctionalDetector.hh>
|
||||
#include <G4VPrimitiveScorer.hh>
|
||||
#include <G4SDManager.hh>
|
||||
#include <G4LogicalVolume.hh>
|
||||
#include <G4VPhysicalVolume.hh>
|
||||
@@ -53,9 +52,9 @@
|
||||
#include <G4Region.hh>
|
||||
#include <G4RegionStore.hh>
|
||||
#include <G4ProductionCuts.hh>
|
||||
#include <G4RunManager.hh>
|
||||
#include <G4VUserPhysicsList.hh>
|
||||
#include "CexmcSetup.hh"
|
||||
#include "CexmcPrimitiveScorer.hh"
|
||||
#include "CexmcTrackPoints.hh"
|
||||
#include "CexmcTrackPointsInLeftRightSet.hh"
|
||||
#include "CexmcTrackPointsInCalorimeter.hh"
|
||||
@@ -63,6 +62,7 @@
|
||||
#include "CexmcSimpleEnergyDeposit.hh"
|
||||
#include "CexmcEnergyDepositInLeftRightSet.hh"
|
||||
#include "CexmcEnergyDepositInCalorimeter.hh"
|
||||
#include "CexmcRunManager.hh"
|
||||
#include "CexmcPhysicsManager.hh"
|
||||
#include "CexmcException.hh"
|
||||
|
||||
@@ -82,7 +82,7 @@ G4VPhysicalVolume * CexmcSetup::Construct( void )
|
||||
if ( world )
|
||||
return world;
|
||||
|
||||
G4GDMLParser gdmlParser;
|
||||
G4GDMLParser gdmlParser;
|
||||
|
||||
gdmlParser.Read( gdmlFile, validateGDMLFile );
|
||||
world = gdmlParser.GetWorldVolume();
|
||||
@@ -93,9 +93,14 @@ G4VPhysicalVolume * CexmcSetup::Construct( void )
|
||||
|
||||
ReadRightDetectors();
|
||||
|
||||
CexmcRunManager * runManager( static_cast< CexmcRunManager * >(
|
||||
G4RunManager::GetRunManager() ) );
|
||||
|
||||
runManager->SetupConstructionHook();
|
||||
|
||||
const CexmcPhysicsManager * physicsManager(
|
||||
dynamic_cast< const CexmcPhysicsManager * >(
|
||||
G4RunManager::GetRunManager()->GetUserPhysicsList() ) );
|
||||
runManager->GetUserPhysicsList() ) );
|
||||
|
||||
if ( ! physicsManager )
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
@@ -108,33 +113,32 @@ G4VPhysicalVolume * CexmcSetup::Construct( void )
|
||||
}
|
||||
|
||||
|
||||
void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
void CexmcSetup::SetupSpecialVolumes( const G4GDMLParser & gdmlParser )
|
||||
{
|
||||
G4MultiFunctionalDetector * detector[ CexmcNumberOfDetectorRoles ] =
|
||||
{ NULL };
|
||||
const G4LogicalVolumeStore * lvs( G4LogicalVolumeStore::GetInstance() );
|
||||
|
||||
for( std::vector< G4LogicalVolume * >::const_iterator
|
||||
for ( std::vector< G4LogicalVolume * >::const_iterator
|
||||
lvIter( lvs->begin() ); lvIter != lvs->end(); ++lvIter )
|
||||
{
|
||||
G4String volumeName( G4String( ( *lvIter )->GetName() ) );
|
||||
G4GDMLAuxListType auxInfo( gdmlParser.GetVolumeAuxiliaryInformation(
|
||||
*lvIter ) );
|
||||
std::vector< G4GDMLAuxPairType >::const_iterator pair(
|
||||
auxInfo.begin() );
|
||||
CexmcDetectorRole curDetectorRole( CexmcNumberOfDetectorRoles );
|
||||
|
||||
for( pair = auxInfo.begin(); pair != auxInfo.end(); ++pair )
|
||||
for ( G4GDMLAuxListType::const_iterator pair( auxInfo.begin() );
|
||||
pair != auxInfo.end(); ++pair )
|
||||
{
|
||||
G4VPrimitiveScorer * scorer( NULL );
|
||||
G4String detectorName( "uninitialized" );
|
||||
CexmcPrimitiveScorer * scorer( NULL );
|
||||
G4String detectorName( "uninitialized" );
|
||||
do
|
||||
{
|
||||
if ( pair->type == "EnergyDepositDetector" )
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( pair->value < 0.5 )
|
||||
if ( pair->value == "MonitorRole" )
|
||||
{
|
||||
AssertAndAsignDetectorRole( curDetectorRole,
|
||||
CexmcMonitorDetectorRole );
|
||||
@@ -142,7 +146,7 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
CexmcDetectorTypeName[ CexmcEDDetector ] );
|
||||
break;
|
||||
}
|
||||
if ( pair->value < 1.5 )
|
||||
if ( pair->value == "VetoCounterRole" )
|
||||
{
|
||||
AssertAndAsignDetectorRole( curDetectorRole,
|
||||
CexmcVetoCounterDetectorRole );
|
||||
@@ -151,7 +155,7 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
this );
|
||||
break;
|
||||
}
|
||||
if ( pair->value < 2.5 )
|
||||
if ( pair->value == "CalorimeterRole" )
|
||||
{
|
||||
AssertAndAsignDetectorRole( curDetectorRole,
|
||||
CexmcCalorimeterDetectorRole );
|
||||
@@ -171,7 +175,7 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( pair->value < 0.5 )
|
||||
if ( pair->value == "MonitorRole" )
|
||||
{
|
||||
AssertAndAsignDetectorRole( curDetectorRole,
|
||||
CexmcMonitorDetectorRole );
|
||||
@@ -179,7 +183,7 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
CexmcDetectorTypeName[ CexmcTPDetector ] );
|
||||
break;
|
||||
}
|
||||
if ( pair->value < 1.5 )
|
||||
if ( pair->value == "VetoCounterRole" )
|
||||
{
|
||||
AssertAndAsignDetectorRole( curDetectorRole,
|
||||
CexmcVetoCounterDetectorRole );
|
||||
@@ -188,7 +192,7 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
this );
|
||||
break;
|
||||
}
|
||||
if ( pair->value < 2.5 )
|
||||
if ( pair->value == "CalorimeterRole" )
|
||||
{
|
||||
AssertAndAsignDetectorRole( curDetectorRole,
|
||||
CexmcCalorimeterDetectorRole );
|
||||
@@ -197,7 +201,7 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
this );
|
||||
break;
|
||||
}
|
||||
if ( pair->value < 3.5 )
|
||||
if ( pair->value == "TargetRole" )
|
||||
{
|
||||
AssertAndAsignDetectorRole( curDetectorRole,
|
||||
CexmcTargetDetectorRole );
|
||||
@@ -222,7 +226,7 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( pair->value < 0.5 )
|
||||
if ( pair->value == "CalorimeterRegion" )
|
||||
{
|
||||
G4Region * region( NULL );
|
||||
if ( calorimeterRegionInitialized )
|
||||
@@ -260,19 +264,19 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( pair->value < 0.5 )
|
||||
if ( pair->value == "Monitor" )
|
||||
{
|
||||
monitorVolume = *lvIter;
|
||||
G4cout << CEXMC_LINE_START "Monitor volume '";
|
||||
break;
|
||||
}
|
||||
if ( pair->value < 1.5 )
|
||||
if ( pair->value == "VetoCounter" )
|
||||
{
|
||||
vetoCounterVolume = *lvIter;
|
||||
G4cout << CEXMC_LINE_START "VetoCounter volume '";
|
||||
break;
|
||||
}
|
||||
if ( pair->value < 2.5 )
|
||||
if ( pair->value == "Calorimeter" )
|
||||
{
|
||||
calorimeterVolume = *lvIter;
|
||||
G4cout << CEXMC_LINE_START "Calorimeter volume '";
|
||||
@@ -280,7 +284,7 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
calorimeterGeometryDataInitialized = true;
|
||||
break;
|
||||
}
|
||||
if ( pair->value < 3.5 )
|
||||
if ( pair->value == "Target" )
|
||||
{
|
||||
targetVolume = *lvIter;
|
||||
G4cout << CEXMC_LINE_START "Target volume '";
|
||||
@@ -302,6 +306,9 @@ void CexmcSetup::SetupSpecialVolumes( G4GDMLParser & gdmlParser )
|
||||
new G4MultiFunctionalDetector( detectorName );
|
||||
}
|
||||
detector[ curDetectorRole ]->RegisterPrimitive( scorer );
|
||||
/* now that scorer has initialized pointer to its detector, its
|
||||
* messenger's path shall be properly initialized as well */
|
||||
scorer->InitializeMessenger();
|
||||
/* NB: logical volumes in GDML file may not have multiple
|
||||
* detector roles: for example volume Monitor may have only one
|
||||
* role MonitorRole. This restriction arises from that fact that
|
||||
|
||||
@@ -58,7 +58,7 @@ CexmcSimpleDecayTableStore::CexmcSimpleDecayTableStore(
|
||||
for ( G4int i( 0 ); i < decayTable->entries(); ++i )
|
||||
{
|
||||
decayBranches.insert(
|
||||
std::pair< G4int, G4double >( i,
|
||||
CexmcDecayBranchesStore::value_type( i,
|
||||
decayTable->GetDecayChannel( i )->GetBR() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,19 +44,11 @@
|
||||
#include <G4UnitsTable.hh>
|
||||
#include <G4HCofThisEvent.hh>
|
||||
#include "CexmcSimpleEnergyDeposit.hh"
|
||||
#include "CexmcSensitiveDetectorMessenger.hh"
|
||||
|
||||
|
||||
CexmcSimpleEnergyDeposit::CexmcSimpleEnergyDeposit( const G4String & name ) :
|
||||
G4VPrimitiveScorer( name ), messenger( NULL ), hcId( -1 )
|
||||
CexmcPrimitiveScorer( name ), hcId( -1 )
|
||||
{
|
||||
messenger = new CexmcSensitiveDetectorMessenger( this, name );
|
||||
}
|
||||
|
||||
|
||||
CexmcSimpleEnergyDeposit::~CexmcSimpleEnergyDeposit()
|
||||
{
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,12 +74,12 @@ G4bool CexmcSimpleEnergyDeposit::ProcessHits( G4Step * step,
|
||||
|
||||
void CexmcSimpleEnergyDeposit::Initialize( G4HCofThisEvent * hcOfEvent )
|
||||
{
|
||||
eventMap = new CexmcEnergyDepositCollection(
|
||||
GetMultiFunctionalDetector()->GetName(), GetName() );
|
||||
if( hcId < 0 )
|
||||
{
|
||||
eventMap = new CexmcEnergyDepositCollection( detector->GetName(),
|
||||
primitiveName );
|
||||
|
||||
if ( hcId < 0 )
|
||||
hcId = GetCollectionID( 0 );
|
||||
}
|
||||
|
||||
hcOfEvent->AddHitsCollection( hcId, eventMap );
|
||||
}
|
||||
|
||||
@@ -117,14 +109,12 @@ void CexmcSimpleEnergyDeposit::PrintAll( void )
|
||||
if ( nmbOfEntries == 0 )
|
||||
return;
|
||||
|
||||
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
|
||||
G4cout << " PrimitiveScorer " << GetName() << G4endl;
|
||||
G4cout << " Number of entries " << nmbOfEntries << G4endl;
|
||||
PrintHeader( nmbOfEntries );
|
||||
|
||||
/* index is ever 0 */
|
||||
for( std::map< G4int, G4double* >::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
/* index is always 0 */
|
||||
for ( CexmcEnergyDepositCollectionData::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
{
|
||||
G4cout << " energy deposit: " <<
|
||||
G4BestUnit( *( itr->second ), "Energy" ) << G4endl;
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <G4UnitsTable.hh>
|
||||
#include "CexmcSimpleRangeWithValue.hh"
|
||||
|
||||
@@ -80,8 +80,8 @@ CexmcSimpleTrackPointInfoStore::operator CexmcTrackPointInfo() const
|
||||
throw CexmcException( CexmcWeirdException );
|
||||
|
||||
return CexmcTrackPointInfo( positionLocal, positionWorld, directionLocal,
|
||||
directionWorld, momentumAmp, particleDefinition,
|
||||
trackId, trackType );
|
||||
directionWorld, momentumAmp, particleDefinition,
|
||||
trackId, trackType );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,20 +45,12 @@
|
||||
#include <G4AffineTransform.hh>
|
||||
#include <G4UnitsTable.hh>
|
||||
#include "CexmcTrackPoints.hh"
|
||||
#include "CexmcSensitiveDetectorMessenger.hh"
|
||||
#include "CexmcTrackInfo.hh"
|
||||
|
||||
|
||||
CexmcTrackPoints::CexmcTrackPoints( const G4String & name ) :
|
||||
G4VPrimitiveScorer( name ), messenger( NULL ), hcId( -1 )
|
||||
CexmcPrimitiveScorer( name ), hcId( -1 )
|
||||
{
|
||||
messenger = new CexmcSensitiveDetectorMessenger( this, name );
|
||||
}
|
||||
|
||||
|
||||
CexmcTrackPoints::~CexmcTrackPoints()
|
||||
{
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,12 +114,12 @@ G4bool CexmcTrackPoints::ProcessHits( G4Step * step, G4TouchableHistory * )
|
||||
|
||||
void CexmcTrackPoints::Initialize( G4HCofThisEvent * hcOfEvent )
|
||||
{
|
||||
eventMap = new CexmcTrackPointsCollection(
|
||||
GetMultiFunctionalDetector()->GetName(), GetName() );
|
||||
if( hcId < 0 )
|
||||
{
|
||||
eventMap = new CexmcTrackPointsCollection( detector->GetName(),
|
||||
primitiveName );
|
||||
|
||||
if ( hcId < 0 )
|
||||
hcId = GetCollectionID( 0 );
|
||||
}
|
||||
|
||||
hcOfEvent->AddHitsCollection( hcId, eventMap );
|
||||
}
|
||||
|
||||
@@ -157,13 +149,11 @@ void CexmcTrackPoints::PrintAll( void )
|
||||
if ( nmbOfEntries == 0 )
|
||||
return;
|
||||
|
||||
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
|
||||
G4cout << " PrimitiveScorer " << GetName() << G4endl;
|
||||
G4cout << " Number of entries " << nmbOfEntries << G4endl;
|
||||
PrintHeader( nmbOfEntries );
|
||||
|
||||
for( std::map< G4int, CexmcTrackPointInfo* >::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
for ( CexmcTrackPointsCollectionData::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
{
|
||||
G4cout << " track id " << itr->first << G4endl;
|
||||
G4cout << " , position: " <<
|
||||
|
||||
@@ -94,12 +94,12 @@ void CexmcTrackPointsDigitizer::Digitize( void )
|
||||
CexmcDetectorRoleName[ CexmcMonitorDetectorRole ] +
|
||||
"/" + CexmcDetectorTypeName[ CexmcTPDetector ] ) );
|
||||
const CexmcTrackPointsCollection *
|
||||
hitsCollection( static_cast< const CexmcTrackPointsCollection* >(
|
||||
hitsCollection( static_cast< const CexmcTrackPointsCollection * >(
|
||||
digiManager->GetHitsCollection( hcId ) ) );
|
||||
|
||||
if ( hitsCollection )
|
||||
{
|
||||
for ( std::map< G4int, CexmcTrackPointInfo* >::iterator
|
||||
for ( CexmcTrackPointsCollectionData::iterator
|
||||
k( hitsCollection->GetMap()->begin() );
|
||||
k != hitsCollection->GetMap()->end(); ++k )
|
||||
{
|
||||
@@ -111,12 +111,12 @@ void CexmcTrackPointsDigitizer::Digitize( void )
|
||||
hcId = digiManager->GetHitsCollectionID(
|
||||
CexmcDetectorRoleName[ CexmcTargetDetectorRole ] +
|
||||
"/" + CexmcDetectorTypeName[ CexmcTPDetector ] );
|
||||
hitsCollection = static_cast< const CexmcTrackPointsCollection* >(
|
||||
hitsCollection = static_cast< const CexmcTrackPointsCollection * >(
|
||||
digiManager->GetHitsCollection( hcId ) );
|
||||
|
||||
if ( hitsCollection )
|
||||
{
|
||||
for ( std::map< G4int, CexmcTrackPointInfo* >::iterator
|
||||
for ( CexmcTrackPointsCollectionData::iterator
|
||||
k( hitsCollection->GetMap()->begin() );
|
||||
k != hitsCollection->GetMap()->end(); ++k )
|
||||
{
|
||||
@@ -161,12 +161,12 @@ void CexmcTrackPointsDigitizer::Digitize( void )
|
||||
hcId = digiManager->GetHitsCollectionID(
|
||||
CexmcDetectorRoleName[ CexmcVetoCounterDetectorRole ] +
|
||||
"/" + CexmcDetectorTypeName[ CexmcTPDetector ] );
|
||||
hitsCollection = static_cast< const CexmcTrackPointsCollection* >(
|
||||
hitsCollection = static_cast< const CexmcTrackPointsCollection * >(
|
||||
digiManager->GetHitsCollection( hcId ) );
|
||||
|
||||
if ( hitsCollection )
|
||||
{
|
||||
for ( std::map< G4int, CexmcTrackPointInfo* >::iterator
|
||||
for ( CexmcTrackPointsCollectionData::iterator
|
||||
k( hitsCollection->GetMap()->begin() );
|
||||
k != hitsCollection->GetMap()->end(); ++k )
|
||||
{
|
||||
@@ -193,12 +193,12 @@ void CexmcTrackPointsDigitizer::Digitize( void )
|
||||
hcId = digiManager->GetHitsCollectionID(
|
||||
CexmcDetectorRoleName[ CexmcCalorimeterDetectorRole ] +
|
||||
"/" + CexmcDetectorTypeName[ CexmcTPDetector ] );
|
||||
hitsCollection = static_cast< const CexmcTrackPointsCollection* >(
|
||||
hitsCollection = static_cast< const CexmcTrackPointsCollection * >(
|
||||
digiManager->GetHitsCollection( hcId ) );
|
||||
|
||||
if ( hitsCollection )
|
||||
{
|
||||
for ( std::map< G4int, CexmcTrackPointInfo* >::iterator
|
||||
for ( CexmcTrackPointsCollectionData::iterator
|
||||
k( hitsCollection->GetMap()->begin() );
|
||||
k != hitsCollection->GetMap()->end(); ++k )
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ CexmcTrackPointsFilter::CexmcTrackPointsFilter( const G4String & name ) :
|
||||
|
||||
G4bool CexmcTrackPointsFilter::Accept( const G4Step * step ) const
|
||||
{
|
||||
G4Track * track( step->GetTrack() );
|
||||
G4Track * track( step->GetTrack() );
|
||||
CexmcTrackInfo * trackInfo( static_cast< CexmcTrackInfo * >(
|
||||
track->GetUserInformation() ) );
|
||||
|
||||
|
||||
@@ -51,10 +51,6 @@
|
||||
#include "CexmcSetup.hh"
|
||||
|
||||
|
||||
G4int CexmcTrackPointsInCalorimeter::copyDepth0BitsOffset( 8 );
|
||||
G4int CexmcTrackPointsInCalorimeter::copyDepth1BitsOffset( 16 );
|
||||
|
||||
|
||||
CexmcTrackPointsInCalorimeter::CexmcTrackPointsInCalorimeter(
|
||||
const G4String & name, const CexmcSetup * setup ) :
|
||||
CexmcTrackPointsInLeftRightSet( name, setup )
|
||||
@@ -89,13 +85,11 @@ void CexmcTrackPointsInCalorimeter::PrintAll( void )
|
||||
if ( nmbOfEntries == 0 )
|
||||
return;
|
||||
|
||||
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
|
||||
G4cout << " PrimitiveScorer " << GetName() << G4endl;
|
||||
G4cout << " Number of entries " << nmbOfEntries << G4endl;
|
||||
PrintHeader( nmbOfEntries );
|
||||
|
||||
for( std::map< G4int, CexmcTrackPointInfo* >::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
for ( CexmcTrackPointsCollectionData::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
{
|
||||
G4bool isRightDetector( itr->first >> leftRightBitsOffset );
|
||||
G4int index( itr->first &
|
||||
|
||||
@@ -51,9 +51,6 @@
|
||||
#include "CexmcSetup.hh"
|
||||
|
||||
|
||||
G4int CexmcTrackPointsInLeftRightSet::leftRightBitsOffset( 24 );
|
||||
|
||||
|
||||
CexmcTrackPointsInLeftRightSet::CexmcTrackPointsInLeftRightSet(
|
||||
const G4String & name, const CexmcSetup * setup ) :
|
||||
CexmcTrackPoints( name ), setup( setup )
|
||||
@@ -81,13 +78,11 @@ void CexmcTrackPointsInLeftRightSet::PrintAll( void )
|
||||
if ( nmbOfEntries == 0 )
|
||||
return;
|
||||
|
||||
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
|
||||
G4cout << " PrimitiveScorer " << GetName() << G4endl;
|
||||
G4cout << " Number of entries " << nmbOfEntries << G4endl;
|
||||
PrintHeader( nmbOfEntries );
|
||||
|
||||
for( std::map< G4int, CexmcTrackPointInfo* >::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
for ( CexmcTrackPointsCollectionData::iterator
|
||||
itr( eventMap->GetMap()->begin() );
|
||||
itr != eventMap->GetMap()->end(); ++itr )
|
||||
{
|
||||
G4bool isRightDetector( itr->first >> leftRightBitsOffset );
|
||||
const G4String detectorSide( isRightDetector ? "right" : "left" );
|
||||
|
||||
Reference in New Issue
Block a user