Geant4_10
CexmcChargeExchangeReconstructorMessenger.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: CexmcChargeExchangeReconstructorMessenger.cc
30  *
31  * Description: charge exchange reconstructor messenger
32  *
33  * Version: 1.0
34  * Created: 14.12.2009 17:53:33
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>
49 #include "CexmcMessenger.hh"
50 
51 
54  CexmcChargeExchangeReconstructor * reconstructor ) :
55  reconstructor( reconstructor ), useTableMass( NULL ),
56  useMassCut( NULL ), mCutOPCenter( NULL ), mCutNOPCenter( NULL ),
57  mCutOPWidth( NULL ), mCutNOPWidth( NULL ), mCutAngle( NULL ),
58  useAbsorbedEnergyCut( NULL ), aeCutCLCenter( NULL ),
59  aeCutCRCenter( NULL ), aeCutCLWidth( NULL ), aeCutCRWidth( NULL ),
60  aeCutAngle( NULL ), setExpectedMomentumAmp( NULL ),
61  setExpectedMomentumAmpDiff( NULL ), setEDCollectionAlgorithm( NULL )
62 {
63  useTableMass = new G4UIcmdWithABool(
64  ( CexmcMessenger::reconstructorDirName + "useTableMass" ).c_str(),
65  this );
66  useTableMass->SetGuidance( "\n If true then reconstructor will use "
67  "table mass of output\n particle when building output particle "
68  "energy,\n otherwise reconstructed mass will be used" );
69  useTableMass->SetParameterName( "UseTableMass", true );
70  useTableMass->SetDefaultValue( true );
72 
73  useMassCut = new G4UIcmdWithABool(
74  ( CexmcMessenger::reconstructorDirName + "useMassCut" ).c_str(), this );
75  useMassCut->SetGuidance( "\n Use elliptical cut for masses of output "
76  "particle\n and nucleus output particle" );
77  useMassCut->SetParameterName( "UseMassCut", true );
78  useMassCut->SetDefaultValue( true );
80 
81  mCutOPCenter = new G4UIcmdWithADoubleAndUnit(
82  ( CexmcMessenger::reconstructorDirName + "mCutOPCenter" ).c_str(),
83  this );
84  mCutOPCenter->SetGuidance( "\n Center of the ellipse in output particle "
85  "mass coordinate" );
86  mCutOPCenter->SetParameterName( "MCutOPCenter", false );
87  mCutOPCenter->SetDefaultValue( reconstructor->GetProductionModelData().
88  outputParticle->GetPDGMass() );
89  mCutOPCenter->SetUnitCandidates( "eV keV MeV GeV" );
90  mCutOPCenter->SetDefaultUnit( "MeV" );
92 
93  mCutNOPCenter = new G4UIcmdWithADoubleAndUnit(
94  ( CexmcMessenger::reconstructorDirName + "mCutNOPCenter" ).c_str(),
95  this );
96  mCutNOPCenter->SetGuidance( "\n Center of the ellipse in nucleus output "
97  "particle mass\n coordinate" );
98  mCutNOPCenter->SetParameterName( "MCutNOPCenter", false );
99  mCutNOPCenter->SetDefaultValue( reconstructor->GetProductionModelData().
100  nucleusOutputParticle->GetPDGMass() );
101  mCutNOPCenter->SetUnitCandidates( "eV keV MeV GeV" );
102  mCutNOPCenter->SetDefaultUnit( "MeV" );
104 
105  mCutOPWidth = new G4UIcmdWithADoubleAndUnit(
106  ( CexmcMessenger::reconstructorDirName + "mCutOPWidth" ).c_str(),
107  this );
108  mCutOPWidth->SetGuidance( "\n Width of the ellipse in output particle "
109  "mass coordinate" );
110  mCutOPWidth->SetParameterName( "MCutOPWidth", false );
111  mCutOPWidth->SetDefaultValue( reconstructor->GetProductionModelData().
112  outputParticle->GetPDGMass() * 0.1 );
113  mCutOPWidth->SetUnitCandidates( "eV keV MeV GeV" );
114  mCutOPWidth->SetDefaultUnit( "MeV" );
116 
117  mCutNOPWidth = new G4UIcmdWithADoubleAndUnit(
118  ( CexmcMessenger::reconstructorDirName + "mCutNOPWidth" ).c_str(),
119  this );
120  mCutNOPWidth->SetGuidance( "\n Width of the ellipse in nucleus output "
121  "particle mass\n coordinate" );
122  mCutNOPWidth->SetParameterName( "MCutNOPWidth", false );
123  mCutNOPWidth->SetDefaultValue( reconstructor->GetProductionModelData().
124  nucleusOutputParticle->GetPDGMass() * 0.1 );
125  mCutNOPWidth->SetUnitCandidates( "eV keV MeV GeV" );
126  mCutNOPWidth->SetDefaultUnit( "MeV" );
128 
129  mCutAngle = new G4UIcmdWithADoubleAndUnit(
130  ( CexmcMessenger::reconstructorDirName + "mCutAngle" ).c_str(),
131  this );
132  mCutAngle->SetGuidance( "\n Angle of the ellipse" );
133  mCutAngle->SetParameterName( "MCutAngle", false );
134  mCutAngle->SetDefaultValue( 0 );
135  mCutAngle->SetUnitCandidates( "deg rad" );
136  mCutAngle->SetDefaultUnit( "deg" );
138 
139  useAbsorbedEnergyCut = new G4UIcmdWithABool(
140  ( CexmcMessenger::reconstructorDirName + "useAbsorbedEnergyCut" ).
141  c_str(), this );
142  useAbsorbedEnergyCut->SetGuidance( "\n Use elliptical cut for absorbed "
143  "energies in\n calorimeters" );
144  useAbsorbedEnergyCut->SetParameterName( "UseAbsorbedEnergyCut", true );
145  useAbsorbedEnergyCut->SetDefaultValue( true );
146  useAbsorbedEnergyCut->AvailableForStates( G4State_PreInit, G4State_Idle );
147 
148  aeCutCLCenter = new G4UIcmdWithADoubleAndUnit(
149  ( CexmcMessenger::reconstructorDirName + "aeCutCLCenter" ).c_str(),
150  this );
151  aeCutCLCenter->SetGuidance( "\n Center of the ellipse in left "
152  "calorimeter\n absorbed energy coordinate" );
153  aeCutCLCenter->SetParameterName( "AECutCLCenter", false );
154  aeCutCLCenter->SetDefaultValue( 0 );
155  aeCutCLCenter->SetUnitCandidates( "eV keV MeV GeV" );
156  aeCutCLCenter->SetDefaultUnit( "MeV" );
158 
159  aeCutCRCenter = new G4UIcmdWithADoubleAndUnit(
160  ( CexmcMessenger::reconstructorDirName + "aeCutCRCenter" ).c_str(),
161  this );
162  aeCutCRCenter->SetGuidance( "\n Center of the ellipse in right "
163  "calorimeter\n absorbed energy coordinate" );
164  aeCutCRCenter->SetParameterName( "AECutCRCenter", false );
165  aeCutCRCenter->SetDefaultValue( 0 );
166  aeCutCRCenter->SetUnitCandidates( "eV keV MeV GeV" );
167  aeCutCRCenter->SetDefaultUnit( "MeV" );
169 
170  aeCutCLWidth = new G4UIcmdWithADoubleAndUnit(
171  ( CexmcMessenger::reconstructorDirName + "aeCutCLWidth" ).c_str(),
172  this );
173  aeCutCLWidth->SetGuidance( "\n Width of the ellipse in left calorimeter"
174  "\n absorbed energy coordinate" );
175  aeCutCLWidth->SetParameterName( "AECutCLWidth", false );
176  aeCutCLWidth->SetDefaultValue( 0 );
177  aeCutCLWidth->SetUnitCandidates( "eV keV MeV GeV" );
178  aeCutCLWidth->SetDefaultUnit( "MeV" );
180 
181  aeCutCRWidth = new G4UIcmdWithADoubleAndUnit(
182  ( CexmcMessenger::reconstructorDirName + "aeCutCRWidth" ).c_str(),
183  this );
184  aeCutCRWidth->SetGuidance( "\n Width of the ellipse in right calorimeter"
185  "\n absorbed energy coordinate" );
186  aeCutCRWidth->SetParameterName( "AECutCRWidth", false );
187  aeCutCRWidth->SetDefaultValue( 0 );
188  aeCutCRWidth->SetUnitCandidates( "eV keV MeV GeV" );
189  aeCutCRWidth->SetDefaultUnit( "MeV" );
191 
192  aeCutAngle = new G4UIcmdWithADoubleAndUnit(
193  ( CexmcMessenger::reconstructorDirName + "aeCutAngle" ).c_str(),
194  this );
195  aeCutAngle->SetGuidance( "\n Angle of the ellipse" );
196  aeCutAngle->SetParameterName( "AECutAngle", false );
197  aeCutAngle->SetDefaultValue( 0 );
198  aeCutAngle->SetUnitCandidates( "deg rad" );
199  aeCutAngle->SetDefaultUnit( "deg" );
201 
202  setExpectedMomentumAmp = new G4UIcmdWithADoubleAndUnit(
203  ( CexmcMessenger::reconstructorDirName + "momentumAmp" ).c_str(),
204  this );
205  setExpectedMomentumAmp->SetGuidance( "\n Momentum of a beam particle "
206  "expected in the target;\n this value may differ from original "
207  "momentum\n of the beam as far as profile data of the beam refer\n"
208  " to the place where it starts. This parameter is used only\n"
209  " in reconstruction procedure");
210  setExpectedMomentumAmp->SetParameterName( "RecMomentumAmp", false );
211  setExpectedMomentumAmp->SetRange( "RecMomentumAmp > 0" );
212  setExpectedMomentumAmp->SetUnitCandidates( "eV keV MeV GeV" );
213  setExpectedMomentumAmp->SetDefaultUnit( "MeV" );
214  setExpectedMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
215 
216  setExpectedMomentumAmpDiff = new G4UIcmdWithADoubleAndUnit(
217  ( CexmcMessenger::reconstructorDirName + "momentumAmpDiff" ).c_str(),
218  this );
219  setExpectedMomentumAmpDiff->SetGuidance( "\n Expected difference "
220  "between momenta of the beam\n on its start and in the target. This "
221  "parameter can\n be used to automatically calculate value of the\n"
222  " previous parameter 'momentumAmp'" );
223  setExpectedMomentumAmpDiff->SetParameterName( "RecMomentumAmpDiff", false );
224  setExpectedMomentumAmpDiff->SetDefaultValue( 0 );
225  setExpectedMomentumAmpDiff->SetUnitCandidates( "eV keV MeV GeV" );
226  setExpectedMomentumAmpDiff->SetDefaultUnit( "MeV" );
227  setExpectedMomentumAmpDiff->AvailableForStates( G4State_PreInit,
228  G4State_Idle );
229 
230  setEDCollectionAlgorithm = new G4UIcmdWithAString(
231  ( CexmcMessenger::reconstructorDirName + "edCollectionAlgo" ).c_str(),
232  this );
233  setEDCollectionAlgorithm->SetGuidance(
234  "\n Choose crystals to be selected when energy deposit collected\n"
235  " all - all,\n"
236  " adjacent - crystal with maximum energy deposit and\n"
237  " adjacent crystals" );
238  setEDCollectionAlgorithm->SetParameterName( "EDCollectionAlgo", false );
239  setEDCollectionAlgorithm->SetCandidates( "all adjacent" );
240  setEDCollectionAlgorithm->SetDefaultValue( "all" );
241  setEDCollectionAlgorithm->AvailableForStates( G4State_PreInit,
242  G4State_Idle );
243 }
244 
245 
248 {
249  delete useTableMass;
250  delete useMassCut;
251  delete mCutOPCenter;
252  delete mCutNOPCenter;
253  delete mCutOPWidth;
254  delete mCutNOPWidth;
255  delete mCutAngle;
256  delete useAbsorbedEnergyCut;
257  delete aeCutCLCenter;
258  delete aeCutCRCenter;
259  delete aeCutCLWidth;
260  delete aeCutCRWidth;
261  delete aeCutAngle;
262  delete setExpectedMomentumAmp;
263  delete setExpectedMomentumAmpDiff;
264  delete setEDCollectionAlgorithm;
265 }
266 
267 
270 {
271  do
272  {
273  if ( cmd == useTableMass )
274  {
275  reconstructor->UseTableMass(
277  break;
278  }
279  if ( cmd == useMassCut )
280  {
281  reconstructor->UseMassCut(
283  break;
284  }
285  if ( cmd == mCutOPCenter )
286  {
287  reconstructor->SetMassCutOPCenter(
289  break;
290  }
291  if ( cmd == mCutNOPCenter )
292  {
293  reconstructor->SetMassCutNOPCenter(
295  break;
296  }
297  if ( cmd == mCutOPWidth )
298  {
299  reconstructor->SetMassCutOPWidth(
301  break;
302  }
303  if ( cmd == mCutNOPWidth )
304  {
305  reconstructor->SetMassCutNOPWidth(
307  break;
308  }
309  if ( cmd == mCutAngle )
310  {
311  reconstructor->SetMassCutEllipseAngle(
313  break;
314  }
315  if ( cmd == useAbsorbedEnergyCut )
316  {
317  reconstructor->UseAbsorbedEnergyCut(
319  break;
320  }
321  if ( cmd == aeCutCLCenter )
322  {
323  reconstructor->SetAbsorbedEnergyCutCLCenter(
325  break;
326  }
327  if ( cmd == aeCutCRCenter )
328  {
329  reconstructor->SetAbsorbedEnergyCutCRCenter(
331  break;
332  }
333  if ( cmd == aeCutCLWidth )
334  {
335  reconstructor->SetAbsorbedEnergyCutCLWidth(
337  break;
338  }
339  if ( cmd == aeCutCRWidth )
340  {
341  reconstructor->SetAbsorbedEnergyCutCRWidth(
343  break;
344  }
345  if ( cmd == aeCutAngle )
346  {
347  reconstructor->SetAbsorbedEnergyCutEllipseAngle(
349  break;
350  }
351  if ( cmd == setExpectedMomentumAmp )
352  {
353  reconstructor->SetExpectedMomentumAmp(
355  break;
356  }
357  if ( cmd == setExpectedMomentumAmpDiff )
358  {
359  reconstructor->SetExpectedMomentumAmpDiff(
361  break;
362  }
363  if ( cmd == setEDCollectionAlgorithm )
364  {
366  edCollectionAlgorithm( CexmcCollectEDInAllCrystals );
367  do
368  {
369  if ( value == "adjacent" )
370  {
371  edCollectionAlgorithm = CexmcCollectEDInAdjacentCrystals;
372  break;
373  }
374  } while ( false );
375  reconstructor->SetEDCollectionAlgorithm( edCollectionAlgorithm );
376  break;
377  }
378  } while ( false );
379 }
380 
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)
CexmcChargeExchangeReconstructorMessenger(CexmcChargeExchangeReconstructor *reconstructor)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
static G4String reconstructorDirName
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetEDCollectionAlgorithm(CexmcEDCollectionAlgoritm value)
const CexmcProductionModelData & GetProductionModelData(void) const
void SetDefaultValue(const char *defVal)
CexmcEDCollectionAlgoritm
Definition: CexmcCommon.hh:176
void SetDefaultUnit(const char *defUnit)
const XML_Char int const XML_Char * value
Definition: expat.h:331
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetUnitCandidates(const char *candidateList)