File indexing completed on 2025-01-31 09:21:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #include <G4UIcmdWithABool.hh>
0045 #include <G4UIcmdWithAString.hh>
0046 #include <G4UIcmdWithADoubleAndUnit.hh>
0047 #include "CexmcReconstructorMessenger.hh"
0048 #include "CexmcReconstructor.hh"
0049 #include "CexmcMessenger.hh"
0050 #include "CexmcCommon.hh"
0051
0052
0053 CexmcReconstructorMessenger::CexmcReconstructorMessenger(
0054 CexmcReconstructor * reconstructor_ ) :
0055 reconstructor( reconstructor_ ),
0056 setCalorimeterEntryPointDefinitionAlgorithm( NULL ),
0057 setCrystalSelectionAlgorithm( NULL ), useInnerRefCrystal( NULL ),
0058 setCalorimeterEntryPointDepth( NULL )
0059 {
0060 setCalorimeterEntryPointDefinitionAlgorithm = new G4UIcmdWithAString(
0061 ( CexmcMessenger::reconstructorDirName + "entryPointDefinitionAlgo" ).
0062 c_str(), this );
0063 setCalorimeterEntryPointDefinitionAlgorithm->SetGuidance(
0064 "\n Algorithm to reconstruct entry point of output particle"
0065 "\n decay products in calorimeter"
0066 "\n (none of the following algorithms reconstruct directions)\n"
0067 " center - entry points defined in the center of the\n"
0068 " calorimeters,\n"
0069 " simple - entry points defined in the center of the crystal\n"
0070 " that has maximum energy deposit value,\n"
0071 " linear - entry points defined by linear weights of energy\n"
0072 " deposit in crystals,\n"
0073 " sqrt - entry points defined by square root weights of\n"
0074 " energy deposit in crystals" );
0075 setCalorimeterEntryPointDefinitionAlgorithm->SetParameterName(
0076 "EntryPointDefinitionAlgo", false );
0077 setCalorimeterEntryPointDefinitionAlgorithm->SetCandidates(
0078 "center simple linear sqrt" );
0079 setCalorimeterEntryPointDefinitionAlgorithm->SetDefaultValue( "sqrt" );
0080 setCalorimeterEntryPointDefinitionAlgorithm->AvailableForStates(
0081 G4State_PreInit, G4State_Idle );
0082
0083 setCalorimeterEntryPointDepthDefinitionAlgorithm = new G4UIcmdWithAString(
0084 ( CexmcMessenger::reconstructorDirName +
0085 "entryPointDepthDefinitionAlgo" ).c_str(), this );
0086 setCalorimeterEntryPointDepthDefinitionAlgorithm->SetGuidance(
0087 "\n Algorithm to reconstruct entry point depth of output\n"
0088 " particle decay products in calorimeter\n"
0089 " (value is defined by 'entryPointDepth' parameter)\n"
0090 " plain - depth is a constant\n"
0091 " sphere - depth depends on X and Y of calorimeter entry\n"
0092 " points and locates on surface of a sphere\n"
0093 " with origin in the center of the target;\n"
0094 " radius of the sphere is sum of distance to\n"
0095 " the calorimeter and 'entryPointDepth' value" );
0096 setCalorimeterEntryPointDepthDefinitionAlgorithm->SetParameterName(
0097 "EntryPointDepthDefinitionAlgo", false );
0098 setCalorimeterEntryPointDepthDefinitionAlgorithm->SetCandidates(
0099 "plain sphere" );
0100 setCalorimeterEntryPointDepthDefinitionAlgorithm->SetDefaultValue(
0101 "plain" );
0102 setCalorimeterEntryPointDepthDefinitionAlgorithm->AvailableForStates(
0103 G4State_PreInit, G4State_Idle );
0104
0105 setCrystalSelectionAlgorithm = new G4UIcmdWithAString(
0106 ( CexmcMessenger::reconstructorDirName + "crystalSelectionAlgo" ).
0107 c_str(), this );
0108 setCrystalSelectionAlgorithm->SetGuidance(
0109 "\n Choose crystals to be selected in weighted entry point\n"
0110 " reconstruction algorithms\n"
0111 " all - all,\n"
0112 " adjacent - crystal with maximum energy deposit and\n"
0113 " adjacent crystals" );
0114 setCrystalSelectionAlgorithm->SetParameterName( "CrystalSelAlgo", false );
0115 setCrystalSelectionAlgorithm->SetCandidates( "all adjacent" );
0116 setCrystalSelectionAlgorithm->SetDefaultValue( "all" );
0117 setCrystalSelectionAlgorithm->AvailableForStates( G4State_PreInit,
0118 G4State_Idle );
0119
0120 useInnerRefCrystal = new G4UIcmdWithABool(
0121 ( CexmcMessenger::reconstructorDirName + "useInnerRefCrystal" ).
0122 c_str(), this );
0123 useInnerRefCrystal->SetGuidance(
0124 "\n Defines that if the crystal with maximum energy deposit in\n"
0125 " calorimeter is an outer crystal then the closest inner crystal\n"
0126 " will be chosen as the reference for adjacent crystal selection\n"
0127 " algorithm and simple entry point definition algorithm. It also\n"
0128 " affects energy deposit collection if adjacent crystals\n"
0129 " algorithm was chosen for that. If not set then the reference\n"
0130 " crystal will be found from all crystals in calorimeter" );
0131 useInnerRefCrystal->SetParameterName( "UseInnerRefCrystal", true );
0132 useInnerRefCrystal->SetDefaultValue( true );
0133 useInnerRefCrystal->AvailableForStates( G4State_PreInit, G4State_Idle );
0134
0135 setCalorimeterEntryPointDepth = new G4UIcmdWithADoubleAndUnit(
0136 ( CexmcMessenger::reconstructorDirName + "entryPointDepth" ).c_str(),
0137 this );
0138 setCalorimeterEntryPointDepth->SetGuidance(
0139 "\n Depth of entry point used in reconstruction of angle\n"
0140 " between output particle decay products" );
0141 setCalorimeterEntryPointDepth->SetParameterName( "EntryPointDepth", false );
0142 setCalorimeterEntryPointDepth->SetDefaultValue( 0 );
0143 setCalorimeterEntryPointDepth->SetUnitCandidates( "mm cm m" );
0144 setCalorimeterEntryPointDepth->SetDefaultUnit( "cm" );
0145 setCalorimeterEntryPointDepth->AvailableForStates( G4State_PreInit,
0146 G4State_Idle );
0147 }
0148
0149
0150 CexmcReconstructorMessenger::~CexmcReconstructorMessenger()
0151 {
0152 delete setCalorimeterEntryPointDefinitionAlgorithm;
0153 delete setCalorimeterEntryPointDepthDefinitionAlgorithm;
0154 delete setCrystalSelectionAlgorithm;
0155 delete useInnerRefCrystal;
0156 delete setCalorimeterEntryPointDepth;
0157 }
0158
0159
0160 void CexmcReconstructorMessenger::SetNewValue( G4UIcommand * cmd,
0161 G4String value )
0162 {
0163 do
0164 {
0165 if ( cmd == setCalorimeterEntryPointDefinitionAlgorithm )
0166 {
0167 CexmcCalorimeterEntryPointDefinitionAlgorithm
0168 epDefinitionAlgorithm( CexmcEntryPointInTheCenter );
0169 do
0170 {
0171 if ( value == "simple" )
0172 {
0173 epDefinitionAlgorithm =
0174 CexmcEntryPointInTheCenterOfCrystalWithMaxED;
0175 break;
0176 }
0177 if ( value == "linear" )
0178 {
0179 epDefinitionAlgorithm = CexmcEntryPointByLinearEDWeights;
0180 break;
0181 }
0182 if ( value == "sqrt" )
0183 {
0184 epDefinitionAlgorithm = CexmcEntryPointBySqrtEDWeights;
0185 break;
0186 }
0187 } while ( false );
0188 reconstructor->SetCalorimeterEntryPointDefinitionAlgorithm(
0189 epDefinitionAlgorithm );
0190 break;
0191 }
0192 if ( cmd == setCalorimeterEntryPointDepthDefinitionAlgorithm )
0193 {
0194 CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
0195 epDepthDefinitionAlgorithm( CexmcEntryPointDepthPlain );
0196 do
0197 {
0198 if ( value == "sphere" )
0199 {
0200 epDepthDefinitionAlgorithm = CexmcEntryPointDepthSphere;
0201 break;
0202 }
0203 } while ( false );
0204 reconstructor->SetCalorimeterEntryPointDepthDefinitionAlgorithm(
0205 epDepthDefinitionAlgorithm );
0206 break;
0207 }
0208 if ( cmd == setCrystalSelectionAlgorithm )
0209 {
0210 CexmcCrystalSelectionAlgorithm
0211 csAlgorithm( CexmcSelectAllCrystals );
0212 do
0213 {
0214 if ( value == "adjacent" )
0215 {
0216 csAlgorithm = CexmcSelectAdjacentCrystals;
0217 break;
0218 }
0219 } while ( false );
0220 reconstructor->SetCrystalSelectionAlgorithm( csAlgorithm );
0221 break;
0222 }
0223 if ( cmd == useInnerRefCrystal )
0224 {
0225 reconstructor->UseInnerRefCrystal(
0226 G4UIcmdWithABool::GetNewBoolValue( value ) );
0227 break;
0228 }
0229 if ( cmd == setCalorimeterEntryPointDepth )
0230 {
0231 reconstructor->SetCalorimeterEntryPointDepth(
0232 G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0233 break;
0234 }
0235 } while ( false );
0236 }
0237