Back to home page

EIC code displayed by LXR

 
 

    


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

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:  CexmcChargeExchangeReconstructorMessenger.cc
0030  *
0031  *    Description:  charge exchange reconstructor messenger
0032  *
0033  *        Version:  1.0
0034  *        Created:  14.12.2009 17:53:33
0035  *       Revision:  none
0036  *       Compiler:  gcc
0037  *
0038  *         Author:  Alexey Radkov (), 
0039  *        Company:  PNPI
0040  *
0041  * ============================================================================
0042  */
0043 
0044 #include <G4UIcmdWithABool.hh>
0045 #include <G4UIcmdWithAString.hh>
0046 #include <G4UIcmdWithADoubleAndUnit.hh>
0047 #include "CexmcChargeExchangeReconstructorMessenger.hh"
0048 #include "CexmcChargeExchangeReconstructor.hh"
0049 #include "CexmcMessenger.hh"
0050 
0051 
0052 CexmcChargeExchangeReconstructorMessenger::
0053         CexmcChargeExchangeReconstructorMessenger(
0054                         CexmcChargeExchangeReconstructor *  reconstructor_ ) :
0055             reconstructor( reconstructor_ ), useTableMass( NULL ),
0056             useMassCut( NULL ), mCutOPCenter( NULL ), mCutNOPCenter( NULL ),
0057             mCutOPWidth( NULL ), mCutNOPWidth( NULL ), mCutAngle( NULL ),
0058             useAbsorbedEnergyCut( NULL ), aeCutCLCenter( NULL ),
0059             aeCutCRCenter( NULL ), aeCutCLWidth( NULL ), aeCutCRWidth( NULL ),
0060             aeCutAngle( NULL ), setExpectedMomentumAmp( NULL ),
0061             setExpectedMomentumAmpDiff( NULL ), setEDCollectionAlgorithm( NULL )
0062 {
0063     useTableMass = new G4UIcmdWithABool(
0064         ( CexmcMessenger::reconstructorDirName + "useTableMass" ).c_str(),
0065         this );
0066     useTableMass->SetGuidance( "\n    If true then reconstructor will use "
0067         "table mass of output\n    particle when building output particle "
0068         "energy,\n    otherwise reconstructed mass will be used" );
0069     useTableMass->SetParameterName( "UseTableMass", true );
0070     useTableMass->SetDefaultValue( true );
0071     useTableMass->AvailableForStates( G4State_PreInit, G4State_Idle );
0072 
0073     useMassCut = new G4UIcmdWithABool(
0074         ( CexmcMessenger::reconstructorDirName + "useMassCut" ).c_str(), this );
0075     useMassCut->SetGuidance( "\n    Use elliptical cut for masses of output "
0076                              "particle\n    and nucleus output particle" );
0077     useMassCut->SetParameterName( "UseMassCut", true );
0078     useMassCut->SetDefaultValue( true );
0079     useMassCut->AvailableForStates( G4State_PreInit, G4State_Idle );
0080 
0081     mCutOPCenter = new G4UIcmdWithADoubleAndUnit(
0082         ( CexmcMessenger::reconstructorDirName + "mCutOPCenter" ).c_str(),
0083         this );
0084     mCutOPCenter->SetGuidance( "\n    Center of the ellipse in output particle "
0085                                "mass coordinate" );
0086     mCutOPCenter->SetParameterName( "MCutOPCenter", false );
0087     mCutOPCenter->SetDefaultValue( reconstructor->GetProductionModelData().
0088                                    outputParticle->GetPDGMass() );
0089     mCutOPCenter->SetUnitCandidates( "eV keV MeV GeV" );
0090     mCutOPCenter->SetDefaultUnit( "MeV" );
0091     mCutOPCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
0092 
0093     mCutNOPCenter = new G4UIcmdWithADoubleAndUnit(
0094         ( CexmcMessenger::reconstructorDirName + "mCutNOPCenter" ).c_str(),
0095         this );
0096     mCutNOPCenter->SetGuidance( "\n    Center of the ellipse in nucleus output "
0097                                 "particle mass\n    coordinate" );
0098     mCutNOPCenter->SetParameterName( "MCutNOPCenter", false );
0099     mCutNOPCenter->SetDefaultValue( reconstructor->GetProductionModelData().
0100                                     nucleusOutputParticle->GetPDGMass() );
0101     mCutNOPCenter->SetUnitCandidates( "eV keV MeV GeV" );
0102     mCutNOPCenter->SetDefaultUnit( "MeV" );
0103     mCutNOPCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
0104 
0105     mCutOPWidth = new G4UIcmdWithADoubleAndUnit(
0106         ( CexmcMessenger::reconstructorDirName + "mCutOPWidth" ).c_str(),
0107         this );
0108     mCutOPWidth->SetGuidance( "\n    Width of the ellipse in output particle "
0109                                "mass coordinate" );
0110     mCutOPWidth->SetParameterName( "MCutOPWidth", false );
0111     mCutOPWidth->SetDefaultValue( reconstructor->GetProductionModelData().
0112                                   outputParticle->GetPDGMass() * 0.1 );
0113     mCutOPWidth->SetUnitCandidates( "eV keV MeV GeV" );
0114     mCutOPWidth->SetDefaultUnit( "MeV" );
0115     mCutOPWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
0116 
0117     mCutNOPWidth = new G4UIcmdWithADoubleAndUnit(
0118         ( CexmcMessenger::reconstructorDirName + "mCutNOPWidth" ).c_str(),
0119         this );
0120     mCutNOPWidth->SetGuidance( "\n    Width of the ellipse in nucleus output "
0121                                "particle mass\n    coordinate" );
0122     mCutNOPWidth->SetParameterName( "MCutNOPWidth", false );
0123     mCutNOPWidth->SetDefaultValue( reconstructor->GetProductionModelData().
0124                                    nucleusOutputParticle->GetPDGMass() * 0.1 );
0125     mCutNOPWidth->SetUnitCandidates( "eV keV MeV GeV" );
0126     mCutNOPWidth->SetDefaultUnit( "MeV" );
0127     mCutNOPWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
0128 
0129     mCutAngle = new G4UIcmdWithADoubleAndUnit(
0130         ( CexmcMessenger::reconstructorDirName + "mCutAngle" ).c_str(),
0131         this );
0132     mCutAngle->SetGuidance( "\n    Angle of the ellipse" );
0133     mCutAngle->SetParameterName( "MCutAngle", false );
0134     mCutAngle->SetDefaultValue( 0 );
0135     mCutAngle->SetUnitCandidates( "deg rad" );
0136     mCutAngle->SetDefaultUnit( "deg" );
0137     mCutAngle->AvailableForStates( G4State_PreInit, G4State_Idle );
0138 
0139     useAbsorbedEnergyCut = new G4UIcmdWithABool(
0140         ( CexmcMessenger::reconstructorDirName + "useAbsorbedEnergyCut" ).
0141             c_str(), this );
0142     useAbsorbedEnergyCut->SetGuidance( "\n    Use elliptical cut for absorbed "
0143                                        "energies in\n    calorimeters" );
0144     useAbsorbedEnergyCut->SetParameterName( "UseAbsorbedEnergyCut", true );
0145     useAbsorbedEnergyCut->SetDefaultValue( true );
0146     useAbsorbedEnergyCut->AvailableForStates( G4State_PreInit, G4State_Idle );
0147 
0148     aeCutCLCenter = new G4UIcmdWithADoubleAndUnit(
0149         ( CexmcMessenger::reconstructorDirName + "aeCutCLCenter" ).c_str(),
0150         this );
0151     aeCutCLCenter->SetGuidance( "\n    Center of the ellipse in left "
0152                                 "calorimeter\n    absorbed energy coordinate" );
0153     aeCutCLCenter->SetParameterName( "AECutCLCenter", false );
0154     aeCutCLCenter->SetDefaultValue( 0 );
0155     aeCutCLCenter->SetUnitCandidates( "eV keV MeV GeV" );
0156     aeCutCLCenter->SetDefaultUnit( "MeV" );
0157     aeCutCLCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
0158 
0159     aeCutCRCenter = new G4UIcmdWithADoubleAndUnit(
0160         ( CexmcMessenger::reconstructorDirName + "aeCutCRCenter" ).c_str(),
0161         this );
0162     aeCutCRCenter->SetGuidance( "\n    Center of the ellipse in right "
0163                                 "calorimeter\n    absorbed energy coordinate" );
0164     aeCutCRCenter->SetParameterName( "AECutCRCenter", false );
0165     aeCutCRCenter->SetDefaultValue( 0 );
0166     aeCutCRCenter->SetUnitCandidates( "eV keV MeV GeV" );
0167     aeCutCRCenter->SetDefaultUnit( "MeV" );
0168     aeCutCRCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
0169 
0170     aeCutCLWidth = new G4UIcmdWithADoubleAndUnit(
0171         ( CexmcMessenger::reconstructorDirName + "aeCutCLWidth" ).c_str(),
0172         this );
0173     aeCutCLWidth->SetGuidance( "\n    Width of the ellipse in left calorimeter"
0174                                "\n    absorbed energy coordinate" );
0175     aeCutCLWidth->SetParameterName( "AECutCLWidth", false );
0176     aeCutCLWidth->SetDefaultValue( 0 );
0177     aeCutCLWidth->SetUnitCandidates( "eV keV MeV GeV" );
0178     aeCutCLWidth->SetDefaultUnit( "MeV" );
0179     aeCutCLWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
0180 
0181     aeCutCRWidth = new G4UIcmdWithADoubleAndUnit(
0182         ( CexmcMessenger::reconstructorDirName + "aeCutCRWidth" ).c_str(),
0183         this );
0184     aeCutCRWidth->SetGuidance( "\n    Width of the ellipse in right calorimeter"
0185                                "\n    absorbed energy coordinate" );
0186     aeCutCRWidth->SetParameterName( "AECutCRWidth", false );
0187     aeCutCRWidth->SetDefaultValue( 0 );
0188     aeCutCRWidth->SetUnitCandidates( "eV keV MeV GeV" );
0189     aeCutCRWidth->SetDefaultUnit( "MeV" );
0190     aeCutCRWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
0191 
0192     aeCutAngle = new G4UIcmdWithADoubleAndUnit(
0193         ( CexmcMessenger::reconstructorDirName + "aeCutAngle" ).c_str(),
0194         this );
0195     aeCutAngle->SetGuidance( "\n    Angle of the ellipse" );
0196     aeCutAngle->SetParameterName( "AECutAngle", false );
0197     aeCutAngle->SetDefaultValue( 0 );
0198     aeCutAngle->SetUnitCandidates( "deg rad" );
0199     aeCutAngle->SetDefaultUnit( "deg" );
0200     aeCutAngle->AvailableForStates( G4State_PreInit, G4State_Idle );
0201 
0202     setExpectedMomentumAmp = new G4UIcmdWithADoubleAndUnit(
0203         ( CexmcMessenger::reconstructorDirName + "momentumAmp" ).c_str(),
0204         this );
0205     setExpectedMomentumAmp->SetGuidance( "\n    Momentum of a beam particle "
0206         "expected in the target;\n    this value may differ from original "
0207         "momentum\n    of the beam as far as profile data of the beam refer\n"
0208         "    to the place where it starts. This parameter is used only\n"
0209         "    in reconstruction procedure");
0210     setExpectedMomentumAmp->SetParameterName( "RecMomentumAmp", false );
0211     setExpectedMomentumAmp->SetRange( "RecMomentumAmp > 0" );
0212     setExpectedMomentumAmp->SetUnitCandidates( "eV keV MeV GeV" );
0213     setExpectedMomentumAmp->SetDefaultUnit( "MeV" );
0214     setExpectedMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
0215 
0216     setExpectedMomentumAmpDiff = new G4UIcmdWithADoubleAndUnit(
0217         ( CexmcMessenger::reconstructorDirName + "momentumAmpDiff" ).c_str(),
0218         this );
0219     setExpectedMomentumAmpDiff->SetGuidance( "\n    Expected difference "
0220         "between momenta of the beam\n    on its start and in the target. This "
0221         "parameter can\n    be used to automatically calculate value of the\n"
0222         "    previous parameter 'momentumAmp'" );
0223     setExpectedMomentumAmpDiff->SetParameterName( "RecMomentumAmpDiff", false );
0224     setExpectedMomentumAmpDiff->SetDefaultValue( 0 );
0225     setExpectedMomentumAmpDiff->SetUnitCandidates( "eV keV MeV GeV" );
0226     setExpectedMomentumAmpDiff->SetDefaultUnit( "MeV" );
0227     setExpectedMomentumAmpDiff->AvailableForStates( G4State_PreInit,
0228                                                     G4State_Idle );
0229 
0230     setEDCollectionAlgorithm = new G4UIcmdWithAString(
0231         ( CexmcMessenger::reconstructorDirName + "edCollectionAlgo" ).c_str(),
0232         this );
0233     setEDCollectionAlgorithm->SetGuidance(
0234         "\n    Choose crystals to be selected when energy deposit collected\n"
0235         "    all - all,\n"
0236         "    adjacent - crystal with maximum energy deposit and\n"
0237         "               adjacent crystals" );
0238     setEDCollectionAlgorithm->SetParameterName( "EDCollectionAlgo", false );
0239     setEDCollectionAlgorithm->SetCandidates( "all adjacent" );
0240     setEDCollectionAlgorithm->SetDefaultValue( "all" );
0241     setEDCollectionAlgorithm->AvailableForStates( G4State_PreInit,
0242                                                   G4State_Idle );
0243 }
0244 
0245 
0246 CexmcChargeExchangeReconstructorMessenger::
0247                                     ~CexmcChargeExchangeReconstructorMessenger()
0248 {
0249     delete useTableMass;
0250     delete useMassCut;
0251     delete mCutOPCenter;
0252     delete mCutNOPCenter;
0253     delete mCutOPWidth;
0254     delete mCutNOPWidth;
0255     delete mCutAngle;
0256     delete useAbsorbedEnergyCut;
0257     delete aeCutCLCenter;
0258     delete aeCutCRCenter;
0259     delete aeCutCLWidth;
0260     delete aeCutCRWidth;
0261     delete aeCutAngle;
0262     delete setExpectedMomentumAmp;
0263     delete setExpectedMomentumAmpDiff;
0264     delete setEDCollectionAlgorithm;
0265 }
0266 
0267 
0268 void  CexmcChargeExchangeReconstructorMessenger::SetNewValue(
0269                                         G4UIcommand *  cmd, G4String  value )
0270 {
0271     do
0272     {
0273         if ( cmd == useTableMass )
0274         {
0275             reconstructor->UseTableMass(
0276                         G4UIcmdWithABool::GetNewBoolValue( value ) );
0277             break;
0278         }
0279         if ( cmd == useMassCut )
0280         {
0281             reconstructor->UseMassCut(
0282                         G4UIcmdWithABool::GetNewBoolValue( value ) );
0283             break;
0284         }
0285         if ( cmd == mCutOPCenter )
0286         {
0287             reconstructor->SetMassCutOPCenter(
0288                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0289             break;
0290         }
0291         if ( cmd == mCutNOPCenter )
0292         {
0293             reconstructor->SetMassCutNOPCenter(
0294                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0295             break;
0296         }
0297         if ( cmd == mCutOPWidth )
0298         {
0299             reconstructor->SetMassCutOPWidth(
0300                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0301             break;
0302         }
0303         if ( cmd == mCutNOPWidth )
0304         {
0305             reconstructor->SetMassCutNOPWidth(
0306                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0307             break;
0308         }
0309         if ( cmd == mCutAngle )
0310         {
0311             reconstructor->SetMassCutEllipseAngle(
0312                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0313             break;
0314         }
0315         if ( cmd == useAbsorbedEnergyCut )
0316         {
0317             reconstructor->UseAbsorbedEnergyCut(
0318                         G4UIcmdWithABool::GetNewBoolValue( value ) );
0319             break;
0320         }
0321         if ( cmd == aeCutCLCenter )
0322         {
0323             reconstructor->SetAbsorbedEnergyCutCLCenter(
0324                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0325             break;
0326         }
0327         if ( cmd == aeCutCRCenter )
0328         {
0329             reconstructor->SetAbsorbedEnergyCutCRCenter(
0330                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0331             break;
0332         }
0333         if ( cmd == aeCutCLWidth )
0334         {
0335             reconstructor->SetAbsorbedEnergyCutCLWidth(
0336                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0337             break;
0338         }
0339         if ( cmd == aeCutCRWidth )
0340         {
0341             reconstructor->SetAbsorbedEnergyCutCRWidth(
0342                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0343             break;
0344         }
0345         if ( cmd == aeCutAngle )
0346         {
0347             reconstructor->SetAbsorbedEnergyCutEllipseAngle(
0348                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0349             break;
0350         }
0351         if ( cmd == setExpectedMomentumAmp )
0352         {
0353             reconstructor->SetExpectedMomentumAmp(
0354                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0355             break;
0356         }
0357         if ( cmd == setExpectedMomentumAmpDiff )
0358         {
0359             reconstructor->SetExpectedMomentumAmpDiff(
0360                         G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0361             break;
0362         }
0363         if ( cmd == setEDCollectionAlgorithm )
0364         {
0365             CexmcEDCollectionAlgoritm
0366                         edCollectionAlgorithm( CexmcCollectEDInAllCrystals );
0367             do
0368             {
0369                 if ( value == "adjacent" )
0370                 {
0371                     edCollectionAlgorithm = CexmcCollectEDInAdjacentCrystals;
0372                     break;
0373                 }
0374             } while ( false );
0375             reconstructor->SetEDCollectionAlgorithm( edCollectionAlgorithm );
0376             break;
0377         }
0378     } while ( false );
0379 }
0380