Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /* 26 /* 27 * =========================================== 27 * ============================================================================ 28 * 28 * 29 * Filename: CexmcReconstructorMessenge 29 * Filename: CexmcReconstructorMessenger.cc 30 * 30 * 31 * Description: reconstructor messenger 31 * Description: reconstructor messenger 32 * 32 * 33 * Version: 1.0 33 * Version: 1.0 34 * Created: 02.12.2009 15:38:30 34 * Created: 02.12.2009 15:38:30 35 * Revision: none 35 * Revision: none 36 * Compiler: gcc 36 * Compiler: gcc 37 * 37 * 38 * Author: Alexey Radkov (), 38 * Author: Alexey Radkov (), 39 * Company: PNPI 39 * Company: PNPI 40 * 40 * 41 * =========================================== 41 * ============================================================================ 42 */ 42 */ 43 43 44 #include <G4UIcmdWithABool.hh> 44 #include <G4UIcmdWithABool.hh> 45 #include <G4UIcmdWithAString.hh> 45 #include <G4UIcmdWithAString.hh> 46 #include <G4UIcmdWithADoubleAndUnit.hh> 46 #include <G4UIcmdWithADoubleAndUnit.hh> 47 #include "CexmcReconstructorMessenger.hh" 47 #include "CexmcReconstructorMessenger.hh" 48 #include "CexmcReconstructor.hh" 48 #include "CexmcReconstructor.hh" 49 #include "CexmcMessenger.hh" 49 #include "CexmcMessenger.hh" 50 #include "CexmcCommon.hh" 50 #include "CexmcCommon.hh" 51 51 52 52 53 CexmcReconstructorMessenger::CexmcReconstructo 53 CexmcReconstructorMessenger::CexmcReconstructorMessenger( 54 CexmcR << 54 CexmcReconstructor * reconstructor ) : 55 reconstructor( reconstructor_ ), << 55 reconstructor( reconstructor ), 56 setCalorimeterEntryPointDefinitionAlgorith 56 setCalorimeterEntryPointDefinitionAlgorithm( NULL ), 57 setCrystalSelectionAlgorithm( NULL ), useI 57 setCrystalSelectionAlgorithm( NULL ), useInnerRefCrystal( NULL ), 58 setCalorimeterEntryPointDepth( NULL ) 58 setCalorimeterEntryPointDepth( NULL ) 59 { 59 { 60 setCalorimeterEntryPointDefinitionAlgorith 60 setCalorimeterEntryPointDefinitionAlgorithm = new G4UIcmdWithAString( 61 ( CexmcMessenger::reconstructorDirName 61 ( CexmcMessenger::reconstructorDirName + "entryPointDefinitionAlgo" ). 62 c_str(), this ); 62 c_str(), this ); 63 setCalorimeterEntryPointDefinitionAlgorith 63 setCalorimeterEntryPointDefinitionAlgorithm->SetGuidance( 64 "\n Algorithm to reconstruct entry 64 "\n Algorithm to reconstruct entry point of output particle" 65 "\n decay products in calorimeter" 65 "\n decay products in calorimeter" 66 "\n (none of the following algorith 66 "\n (none of the following algorithms reconstruct directions)\n" 67 " center - entry points defined in 67 " center - entry points defined in the center of the\n" 68 " calorimeters,\n" 68 " calorimeters,\n" 69 " simple - entry points defined in 69 " simple - entry points defined in the center of the crystal\n" 70 " that has maximum energy 70 " that has maximum energy deposit value,\n" 71 " linear - entry points defined by 71 " linear - entry points defined by linear weights of energy\n" 72 " deposit in crystals,\n" 72 " deposit in crystals,\n" 73 " sqrt - entry points defined by sq 73 " sqrt - entry points defined by square root weights of\n" 74 " energy deposit in crystals 74 " energy deposit in crystals" ); 75 setCalorimeterEntryPointDefinitionAlgorith 75 setCalorimeterEntryPointDefinitionAlgorithm->SetParameterName( 76 "E 76 "EntryPointDefinitionAlgo", false ); 77 setCalorimeterEntryPointDefinitionAlgorith 77 setCalorimeterEntryPointDefinitionAlgorithm->SetCandidates( 78 "c 78 "center simple linear sqrt" ); 79 setCalorimeterEntryPointDefinitionAlgorith 79 setCalorimeterEntryPointDefinitionAlgorithm->SetDefaultValue( "sqrt" ); 80 setCalorimeterEntryPointDefinitionAlgorith 80 setCalorimeterEntryPointDefinitionAlgorithm->AvailableForStates( 81 G4 81 G4State_PreInit, G4State_Idle ); 82 82 83 setCalorimeterEntryPointDepthDefinitionAlg 83 setCalorimeterEntryPointDepthDefinitionAlgorithm = new G4UIcmdWithAString( 84 ( CexmcMessenger::reconstructorDirName 84 ( CexmcMessenger::reconstructorDirName + 85 "entryPointDepth 85 "entryPointDepthDefinitionAlgo" ).c_str(), this ); 86 setCalorimeterEntryPointDepthDefinitionAlg 86 setCalorimeterEntryPointDepthDefinitionAlgorithm->SetGuidance( 87 "\n Algorithm to reconstruct entry 87 "\n Algorithm to reconstruct entry point depth of output\n" 88 " particle decay products in calori 88 " particle decay products in calorimeter\n" 89 " (value is defined by 'entryPointD 89 " (value is defined by 'entryPointDepth' parameter)\n" 90 " plain - depth is a constant\n" 90 " plain - depth is a constant\n" 91 " sphere - depth depends on X and Y 91 " sphere - depth depends on X and Y of calorimeter entry\n" 92 " points and locates on su 92 " points and locates on surface of a sphere\n" 93 " with origin in the cente 93 " with origin in the center of the target;\n" 94 " radius of the sphere is 94 " radius of the sphere is sum of distance to\n" 95 " the calorimeter and 'ent 95 " the calorimeter and 'entryPointDepth' value" ); 96 setCalorimeterEntryPointDepthDefinitionAlg 96 setCalorimeterEntryPointDepthDefinitionAlgorithm->SetParameterName( 97 "EntryPoin 97 "EntryPointDepthDefinitionAlgo", false ); 98 setCalorimeterEntryPointDepthDefinitionAlg 98 setCalorimeterEntryPointDepthDefinitionAlgorithm->SetCandidates( 99 "plain sph 99 "plain sphere" ); 100 setCalorimeterEntryPointDepthDefinitionAlg 100 setCalorimeterEntryPointDepthDefinitionAlgorithm->SetDefaultValue( 101 "plain" ); 101 "plain" ); 102 setCalorimeterEntryPointDepthDefinitionAlg 102 setCalorimeterEntryPointDepthDefinitionAlgorithm->AvailableForStates( 103 103 G4State_PreInit, G4State_Idle ); 104 104 105 setCrystalSelectionAlgorithm = new G4UIcmd 105 setCrystalSelectionAlgorithm = new G4UIcmdWithAString( 106 ( CexmcMessenger::reconstructorDirName 106 ( CexmcMessenger::reconstructorDirName + "crystalSelectionAlgo" ). 107 c_str(), this ); 107 c_str(), this ); 108 setCrystalSelectionAlgorithm->SetGuidance( 108 setCrystalSelectionAlgorithm->SetGuidance( 109 "\n Choose crystals to be selected 109 "\n Choose crystals to be selected in weighted entry point\n" 110 " reconstruction algorithms\n" 110 " reconstruction algorithms\n" 111 " all - all,\n" 111 " all - all,\n" 112 " adjacent - crystal with maximum e 112 " adjacent - crystal with maximum energy deposit and\n" 113 " adjacent crystals" ); 113 " adjacent crystals" ); 114 setCrystalSelectionAlgorithm->SetParameter 114 setCrystalSelectionAlgorithm->SetParameterName( "CrystalSelAlgo", false ); 115 setCrystalSelectionAlgorithm->SetCandidate 115 setCrystalSelectionAlgorithm->SetCandidates( "all adjacent" ); 116 setCrystalSelectionAlgorithm->SetDefaultVa 116 setCrystalSelectionAlgorithm->SetDefaultValue( "all" ); 117 setCrystalSelectionAlgorithm->AvailableFor 117 setCrystalSelectionAlgorithm->AvailableForStates( G4State_PreInit, 118 118 G4State_Idle ); 119 119 120 useInnerRefCrystal = new G4UIcmdWithABool( 120 useInnerRefCrystal = new G4UIcmdWithABool( 121 ( CexmcMessenger::reconstructorDirName 121 ( CexmcMessenger::reconstructorDirName + "useInnerRefCrystal" ). 122 c_str(), this ); 122 c_str(), this ); 123 useInnerRefCrystal->SetGuidance( 123 useInnerRefCrystal->SetGuidance( 124 "\n Defines that if the crystal wit 124 "\n Defines that if the crystal with maximum energy deposit in\n" 125 " calorimeter is an outer crystal t 125 " calorimeter is an outer crystal then the closest inner crystal\n" 126 " will be chosen as the reference f 126 " will be chosen as the reference for adjacent crystal selection\n" 127 " algorithm and simple entry point 127 " algorithm and simple entry point definition algorithm. It also\n" 128 " affects energy deposit collection 128 " affects energy deposit collection if adjacent crystals\n" 129 " algorithm was chosen for that. If 129 " algorithm was chosen for that. If not set then the reference\n" 130 " crystal will be found from all cr 130 " crystal will be found from all crystals in calorimeter" ); 131 useInnerRefCrystal->SetParameterName( "Use 131 useInnerRefCrystal->SetParameterName( "UseInnerRefCrystal", true ); 132 useInnerRefCrystal->SetDefaultValue( true 132 useInnerRefCrystal->SetDefaultValue( true ); 133 useInnerRefCrystal->AvailableForStates( G4 133 useInnerRefCrystal->AvailableForStates( G4State_PreInit, G4State_Idle ); 134 134 135 setCalorimeterEntryPointDepth = new G4UIcm 135 setCalorimeterEntryPointDepth = new G4UIcmdWithADoubleAndUnit( 136 ( CexmcMessenger::reconstructorDirName 136 ( CexmcMessenger::reconstructorDirName + "entryPointDepth" ).c_str(), 137 this ); 137 this ); 138 setCalorimeterEntryPointDepth->SetGuidance 138 setCalorimeterEntryPointDepth->SetGuidance( 139 "\n Depth of entry point used in re 139 "\n Depth of entry point used in reconstruction of angle\n" 140 " between output particle decay pro 140 " between output particle decay products" ); 141 setCalorimeterEntryPointDepth->SetParamete 141 setCalorimeterEntryPointDepth->SetParameterName( "EntryPointDepth", false ); 142 setCalorimeterEntryPointDepth->SetDefaultV 142 setCalorimeterEntryPointDepth->SetDefaultValue( 0 ); 143 setCalorimeterEntryPointDepth->SetUnitCand 143 setCalorimeterEntryPointDepth->SetUnitCandidates( "mm cm m" ); 144 setCalorimeterEntryPointDepth->SetDefaultU 144 setCalorimeterEntryPointDepth->SetDefaultUnit( "cm" ); 145 setCalorimeterEntryPointDepth->AvailableFo 145 setCalorimeterEntryPointDepth->AvailableForStates( G4State_PreInit, 146 146 G4State_Idle ); 147 } 147 } 148 148 149 149 150 CexmcReconstructorMessenger::~CexmcReconstruct 150 CexmcReconstructorMessenger::~CexmcReconstructorMessenger() 151 { 151 { 152 delete setCalorimeterEntryPointDefinitionA 152 delete setCalorimeterEntryPointDefinitionAlgorithm; 153 delete setCalorimeterEntryPointDepthDefini 153 delete setCalorimeterEntryPointDepthDefinitionAlgorithm; 154 delete setCrystalSelectionAlgorithm; 154 delete setCrystalSelectionAlgorithm; 155 delete useInnerRefCrystal; 155 delete useInnerRefCrystal; 156 delete setCalorimeterEntryPointDepth; 156 delete setCalorimeterEntryPointDepth; 157 } 157 } 158 158 159 159 160 void CexmcReconstructorMessenger::SetNewValue 160 void CexmcReconstructorMessenger::SetNewValue( G4UIcommand * cmd, 161 161 G4String value ) 162 { 162 { 163 do 163 do 164 { 164 { 165 if ( cmd == setCalorimeterEntryPointDe 165 if ( cmd == setCalorimeterEntryPointDefinitionAlgorithm ) 166 { 166 { 167 CexmcCalorimeterEntryPointDefiniti 167 CexmcCalorimeterEntryPointDefinitionAlgorithm 168 epDefinitionAlgori 168 epDefinitionAlgorithm( CexmcEntryPointInTheCenter ); 169 do 169 do 170 { 170 { 171 if ( value == "simple" ) 171 if ( value == "simple" ) 172 { 172 { 173 epDefinitionAlgorithm = 173 epDefinitionAlgorithm = 174 CexmcEntryPointInT 174 CexmcEntryPointInTheCenterOfCrystalWithMaxED; 175 break; 175 break; 176 } 176 } 177 if ( value == "linear" ) 177 if ( value == "linear" ) 178 { 178 { 179 epDefinitionAlgorithm = Ce 179 epDefinitionAlgorithm = CexmcEntryPointByLinearEDWeights; 180 break; 180 break; 181 } 181 } 182 if ( value == "sqrt" ) 182 if ( value == "sqrt" ) 183 { 183 { 184 epDefinitionAlgorithm = Ce 184 epDefinitionAlgorithm = CexmcEntryPointBySqrtEDWeights; 185 break; 185 break; 186 } 186 } 187 } while ( false ); 187 } while ( false ); 188 reconstructor->SetCalorimeterEntry 188 reconstructor->SetCalorimeterEntryPointDefinitionAlgorithm( 189 189 epDefinitionAlgorithm ); 190 break; 190 break; 191 } 191 } 192 if ( cmd == setCalorimeterEntryPointDe 192 if ( cmd == setCalorimeterEntryPointDepthDefinitionAlgorithm ) 193 { 193 { 194 CexmcCalorimeterEntryPointDepthDef 194 CexmcCalorimeterEntryPointDepthDefinitionAlgorithm 195 epDepthDefinitionAlgor 195 epDepthDefinitionAlgorithm( CexmcEntryPointDepthPlain ); 196 do 196 do 197 { 197 { 198 if ( value == "sphere" ) 198 if ( value == "sphere" ) 199 { 199 { 200 epDepthDefinitionAlgorithm 200 epDepthDefinitionAlgorithm = CexmcEntryPointDepthSphere; 201 break; 201 break; 202 } 202 } 203 } while ( false ); 203 } while ( false ); 204 reconstructor->SetCalorimeterEntry 204 reconstructor->SetCalorimeterEntryPointDepthDefinitionAlgorithm( 205 205 epDepthDefinitionAlgorithm ); 206 break; 206 break; 207 } 207 } 208 if ( cmd == setCrystalSelectionAlgorit 208 if ( cmd == setCrystalSelectionAlgorithm ) 209 { 209 { 210 CexmcCrystalSelectionAlgorithm 210 CexmcCrystalSelectionAlgorithm 211 csAlgo 211 csAlgorithm( CexmcSelectAllCrystals ); 212 do 212 do 213 { 213 { 214 if ( value == "adjacent" ) 214 if ( value == "adjacent" ) 215 { 215 { 216 csAlgorithm = CexmcSelectA 216 csAlgorithm = CexmcSelectAdjacentCrystals; 217 break; 217 break; 218 } 218 } 219 } while ( false ); 219 } while ( false ); 220 reconstructor->SetCrystalSelection 220 reconstructor->SetCrystalSelectionAlgorithm( csAlgorithm ); 221 break; 221 break; 222 } 222 } 223 if ( cmd == useInnerRefCrystal ) 223 if ( cmd == useInnerRefCrystal ) 224 { 224 { 225 reconstructor->UseInnerRefCrystal( 225 reconstructor->UseInnerRefCrystal( 226 G4UIcmdWithABool::GetN 226 G4UIcmdWithABool::GetNewBoolValue( value ) ); 227 break; 227 break; 228 } 228 } 229 if ( cmd == setCalorimeterEntryPointDe 229 if ( cmd == setCalorimeterEntryPointDepth ) 230 { 230 { 231 reconstructor->SetCalorimeterEntry 231 reconstructor->SetCalorimeterEntryPointDepth( 232 G4UIcmdWithADoubleAndU 232 G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) ); 233 break; 233 break; 234 } 234 } 235 } while ( false ); 235 } while ( false ); 236 } 236 } 237 237 238 238