Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CexmcReconstructorMessenger.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 /*
27  * ============================================================================
28  *
29  * Filename: CexmcReconstructorMessenger.cc
30  *
31  * Description: reconstructor messenger
32  *
33  * Version: 1.0
34  * Created: 02.12.2009 15:38:30
35  * Revision: none
36  * Compiler: gcc
37  *
38  * Author: Alexey Radkov (),
39  * Company: PNPI
40  *
41  * ============================================================================
42  */
43 
44 #include <G4UIcmdWithABool.hh>
45 #include <G4UIcmdWithAString.hh>
48 #include "CexmcReconstructor.hh"
49 #include "CexmcMessenger.hh"
50 #include "CexmcCommon.hh"
51 
52 
54  CexmcReconstructor * reconstructor ) :
55  reconstructor( reconstructor ),
56  setCalorimeterEntryPointDefinitionAlgorithm( NULL ),
57  setCrystalSelectionAlgorithm( NULL ), useInnerRefCrystal( NULL ),
58  setCalorimeterEntryPointDepth( NULL )
59 {
60  setCalorimeterEntryPointDefinitionAlgorithm = new G4UIcmdWithAString(
61  ( CexmcMessenger::reconstructorDirName + "entryPointDefinitionAlgo" ).
62  c_str(), this );
63  setCalorimeterEntryPointDefinitionAlgorithm->SetGuidance(
64  "\n Algorithm to reconstruct entry point of output particle"
65  "\n decay products in calorimeter"
66  "\n (none of the following algorithms reconstruct directions)\n"
67  " center - entry points defined in the center of the\n"
68  " calorimeters,\n"
69  " simple - entry points defined in the center of the crystal\n"
70  " that has maximum energy deposit value,\n"
71  " linear - entry points defined by linear weights of energy\n"
72  " deposit in crystals,\n"
73  " sqrt - entry points defined by square root weights of\n"
74  " energy deposit in crystals" );
75  setCalorimeterEntryPointDefinitionAlgorithm->SetParameterName(
76  "EntryPointDefinitionAlgo", false );
77  setCalorimeterEntryPointDefinitionAlgorithm->SetCandidates(
78  "center simple linear sqrt" );
79  setCalorimeterEntryPointDefinitionAlgorithm->SetDefaultValue( "sqrt" );
80  setCalorimeterEntryPointDefinitionAlgorithm->AvailableForStates(
82 
83  setCalorimeterEntryPointDepthDefinitionAlgorithm = new G4UIcmdWithAString(
85  "entryPointDepthDefinitionAlgo" ).c_str(), this );
86  setCalorimeterEntryPointDepthDefinitionAlgorithm->SetGuidance(
87  "\n Algorithm to reconstruct entry point depth of output\n"
88  " particle decay products in calorimeter\n"
89  " (value is defined by 'entryPointDepth' parameter)\n"
90  " plain - depth is a constant\n"
91  " sphere - depth depends on X and Y of calorimeter entry\n"
92  " points and locates on surface of a sphere\n"
93  " with origin in the center of the target;\n"
94  " radius of the sphere is sum of distance to\n"
95  " the calorimeter and 'entryPointDepth' value" );
96  setCalorimeterEntryPointDepthDefinitionAlgorithm->SetParameterName(
97  "EntryPointDepthDefinitionAlgo", false );
98  setCalorimeterEntryPointDepthDefinitionAlgorithm->SetCandidates(
99  "plain sphere" );
100  setCalorimeterEntryPointDepthDefinitionAlgorithm->SetDefaultValue(
101  "plain" );
102  setCalorimeterEntryPointDepthDefinitionAlgorithm->AvailableForStates(
104 
105  setCrystalSelectionAlgorithm = new G4UIcmdWithAString(
106  ( CexmcMessenger::reconstructorDirName + "crystalSelectionAlgo" ).
107  c_str(), this );
108  setCrystalSelectionAlgorithm->SetGuidance(
109  "\n Choose crystals to be selected in weighted entry point\n"
110  " reconstruction algorithms\n"
111  " all - all,\n"
112  " adjacent - crystal with maximum energy deposit and\n"
113  " adjacent crystals" );
114  setCrystalSelectionAlgorithm->SetParameterName( "CrystalSelAlgo", false );
115  setCrystalSelectionAlgorithm->SetCandidates( "all adjacent" );
116  setCrystalSelectionAlgorithm->SetDefaultValue( "all" );
117  setCrystalSelectionAlgorithm->AvailableForStates( G4State_PreInit,
118  G4State_Idle );
119 
120  useInnerRefCrystal = new G4UIcmdWithABool(
121  ( CexmcMessenger::reconstructorDirName + "useInnerRefCrystal" ).
122  c_str(), this );
123  useInnerRefCrystal->SetGuidance(
124  "\n Defines that if the crystal with maximum energy deposit in\n"
125  " calorimeter is an outer crystal then the closest inner crystal\n"
126  " will be chosen as the reference for adjacent crystal selection\n"
127  " algorithm and simple entry point definition algorithm. It also\n"
128  " affects energy deposit collection if adjacent crystals\n"
129  " algorithm was chosen for that. If not set then the reference\n"
130  " crystal will be found from all crystals in calorimeter" );
131  useInnerRefCrystal->SetParameterName( "UseInnerRefCrystal", true );
132  useInnerRefCrystal->SetDefaultValue( true );
133  useInnerRefCrystal->AvailableForStates( G4State_PreInit, G4State_Idle );
134 
135  setCalorimeterEntryPointDepth = new G4UIcmdWithADoubleAndUnit(
136  ( CexmcMessenger::reconstructorDirName + "entryPointDepth" ).c_str(),
137  this );
138  setCalorimeterEntryPointDepth->SetGuidance(
139  "\n Depth of entry point used in reconstruction of angle\n"
140  " between output particle decay products" );
141  setCalorimeterEntryPointDepth->SetParameterName( "EntryPointDepth", false );
142  setCalorimeterEntryPointDepth->SetDefaultValue( 0 );
143  setCalorimeterEntryPointDepth->SetUnitCandidates( "mm cm m" );
144  setCalorimeterEntryPointDepth->SetDefaultUnit( "cm" );
145  setCalorimeterEntryPointDepth->AvailableForStates( G4State_PreInit,
146  G4State_Idle );
147 }
148 
149 
151 {
152  delete setCalorimeterEntryPointDefinitionAlgorithm;
153  delete setCalorimeterEntryPointDepthDefinitionAlgorithm;
154  delete setCrystalSelectionAlgorithm;
155  delete useInnerRefCrystal;
156  delete setCalorimeterEntryPointDepth;
157 }
158 
159 
161  G4String value )
162 {
163  do
164  {
165  if ( cmd == setCalorimeterEntryPointDefinitionAlgorithm )
166  {
168  epDefinitionAlgorithm( CexmcEntryPointInTheCenter );
169  do
170  {
171  if ( value == "simple" )
172  {
173  epDefinitionAlgorithm =
175  break;
176  }
177  if ( value == "linear" )
178  {
179  epDefinitionAlgorithm = CexmcEntryPointByLinearEDWeights;
180  break;
181  }
182  if ( value == "sqrt" )
183  {
184  epDefinitionAlgorithm = CexmcEntryPointBySqrtEDWeights;
185  break;
186  }
187  } while ( false );
189  epDefinitionAlgorithm );
190  break;
191  }
192  if ( cmd == setCalorimeterEntryPointDepthDefinitionAlgorithm )
193  {
195  epDepthDefinitionAlgorithm( CexmcEntryPointDepthPlain );
196  do
197  {
198  if ( value == "sphere" )
199  {
200  epDepthDefinitionAlgorithm = CexmcEntryPointDepthSphere;
201  break;
202  }
203  } while ( false );
205  epDepthDefinitionAlgorithm );
206  break;
207  }
208  if ( cmd == setCrystalSelectionAlgorithm )
209  {
211  csAlgorithm( CexmcSelectAllCrystals );
212  do
213  {
214  if ( value == "adjacent" )
215  {
216  csAlgorithm = CexmcSelectAdjacentCrystals;
217  break;
218  }
219  } while ( false );
220  reconstructor->SetCrystalSelectionAlgorithm( csAlgorithm );
221  break;
222  }
223  if ( cmd == useInnerRefCrystal )
224  {
225  reconstructor->UseInnerRefCrystal(
227  break;
228  }
229  if ( cmd == setCalorimeterEntryPointDepth )
230  {
231  reconstructor->SetCalorimeterEntryPointDepth(
233  break;
234  }
235  } while ( false );
236 }
237 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
char cmd[1024]
Definition: tracer.cxx:25
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetCalorimeterEntryPointDepth(G4double depth)
CexmcReconstructorMessenger(CexmcReconstructor *reconstructor)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
static G4String reconstructorDirName
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
CexmcCrystalSelectionAlgorithm
Definition: CexmcCommon.hh:170
void SetCrystalSelectionAlgorithm(CexmcCrystalSelectionAlgorithm algo)
void SetCalorimeterEntryPointDefinitionAlgorithm(CexmcCalorimeterEntryPointDefinitionAlgorithm algo)
void SetNewValue(G4UIcommand *cmd, G4String value)
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void UseInnerRefCrystal(G4bool on=true)
const XML_Char int const XML_Char * value
void SetCandidates(const char *candidateList)
void SetCalorimeterEntryPointDepthDefinitionAlgorithm(CexmcCalorimeterEntryPointDepthDefinitionAlgorithm algo)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
Definition: CexmcCommon.hh:163
CexmcCalorimeterEntryPointDefinitionAlgorithm
Definition: CexmcCommon.hh:154
void SetUnitCandidates(const char *candidateList)