Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:53

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /*
0027  * ============================================================================
0028  *
0029  *       Filename:  CexmcProductionModelMessenger.cc
0030  *
0031  *    Description:  set various production model aspects
0032  *
0033  *        Version:  1.0
0034  *        Created:  03.11.2009 16:01:24
0035  *       Revision:  none
0036  *       Compiler:  gcc
0037  *
0038  *         Author:  Alexey Radkov (), 
0039  *        Company:  PNPI
0040  *
0041  * ============================================================================
0042  */
0043 
0044 #include <G4UIcmdWithABool.hh>
0045 #include <G4UIcmdWith3Vector.hh>
0046 #include "CexmcProductionModel.hh"
0047 #include "CexmcProductionModelMessenger.hh"
0048 #include "CexmcMessenger.hh"
0049 
0050 
0051 CexmcProductionModelMessenger::CexmcProductionModelMessenger(
0052                                     CexmcProductionModel *  productionModel_ ) :
0053     productionModel( productionModel_ ), applyFermiMotion( NULL ),
0054     setAngularRange( NULL ), addAngularRange( NULL )
0055 {
0056     applyFermiMotion = new G4UIcmdWithABool(
0057         ( CexmcMessenger::physicsDirName + "applyFermiMotionInTarget" ).c_str(),
0058         this );
0059     applyFermiMotion->SetGuidance( "Switch on/off fermi motion in target "
0060                                    "nuclei" );
0061     applyFermiMotion->SetParameterName( "ApplyFermiMotionInTarget", true );
0062     applyFermiMotion->SetDefaultValue( true );
0063     applyFermiMotion->AvailableForStates( G4State_PreInit, G4State_Idle );
0064 
0065     setAngularRange = new G4UIcmdWith3Vector(
0066         ( CexmcMessenger::physicsDirName + "setAngularRange" ).c_str(), this );
0067     setAngularRange->SetGuidance(
0068         "\n    Set angular range of interest given in values of cosinus;\n"
0069         "    first two values give the range (descending or ascending),\n"
0070         "    third value gives number of equal divisions within the\n"
0071         "    range." );
0072     setAngularRange->SetParameterName( "ARangeTop", "ARangeBottom",
0073                                        "ARangeNmbOfDivisions", false );
0074     setAngularRange->SetRange(
0075         "ARangeTop >= -1.0 && ARangeTop <= 1.0 && "
0076         "ARangeBottom >= -1.0 && ARangeBottom <= 1.0 && "
0077         "ARangeNmbOfDivisions >= 1" );
0078     setAngularRange->AvailableForStates( G4State_PreInit, G4State_Idle );
0079 
0080     addAngularRange = new G4UIcmdWith3Vector(
0081         ( CexmcMessenger::physicsDirName + "addAngularRange" ).c_str(), this );
0082     addAngularRange->SetGuidance(
0083         "\n    Add angular range of interest given in values of cosinus;\n"
0084         "    first two values give the range (descending or ascending),\n"
0085         "    third value gives number of equal divisions within the\n"
0086         "    range." );
0087     addAngularRange->SetParameterName( "ARangeTop", "ARangeBottom",
0088                                        "ARangeNmbOfDivisions", false );
0089     addAngularRange->SetRange(
0090         "ARangeTop >= -1.0 && ARangeTop <= 1.0 && "
0091         "ARangeBottom >= -1.0 && ARangeBottom <= 1.0 && "
0092         "ARangeNmbOfDivisions >= 1" );
0093     addAngularRange->AvailableForStates( G4State_PreInit, G4State_Idle );
0094 }
0095 
0096 
0097 CexmcProductionModelMessenger::~CexmcProductionModelMessenger()
0098 {
0099     delete applyFermiMotion;
0100     delete setAngularRange;
0101     delete addAngularRange;
0102 }
0103 
0104 
0105 void  CexmcProductionModelMessenger::SetNewValue( G4UIcommand *  cmd,
0106                                                   G4String  value )
0107 {
0108     do
0109     {
0110         if ( cmd == applyFermiMotion )
0111         {
0112             productionModel->ApplyFermiMotion(
0113                                 G4UIcmdWithABool::GetNewBoolValue( value ) );
0114             break;
0115         }
0116         if ( cmd == setAngularRange )
0117         {
0118             G4ThreeVector  vec( G4UIcmdWith3Vector::GetNew3VectorValue(
0119                                                                     value ) );
0120             G4double       top( std::max( vec.x(), vec.y() ) );
0121             G4double       bottom( std::min( vec.x(), vec.y() ) );
0122             productionModel->SetAngularRange( top, bottom,
0123                                               static_cast< int >( vec.z() ) );
0124             break;
0125         }
0126         if ( cmd == addAngularRange )
0127         {
0128             G4ThreeVector  vec( G4UIcmdWith3Vector::GetNew3VectorValue(
0129                                                                     value ) );
0130             G4double       top( std::max( vec.x(), vec.y() ) );
0131             G4double       bottom( std::min( vec.x(), vec.y() ) );
0132             productionModel->AddAngularRange( top, bottom,
0133                                               static_cast< int >( vec.z() ) );
0134             break;
0135         }
0136     } while ( false );
0137 }
0138