Back to home page

EIC code displayed by LXR

 
 

    


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

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:  CexmcProductionModel.hh
0030  *
0031  *    Description:  interface to production model
0032  *
0033  *        Version:  1.0
0034  *        Created:  03.11.2009 16:50:53
0035  *       Revision:  none
0036  *       Compiler:  gcc
0037  *
0038  *         Author:  Alexey Radkov (), 
0039  *        Company:  PNPI
0040  *
0041  * =============================================================================
0042  */
0043 
0044 #ifndef CEXMC_PRODUCTION_MODEL_HH
0045 #define CEXMC_PRODUCTION_MODEL_HH
0046 
0047 #include <G4Types.hh>
0048 #include <G4String.hh>
0049 #include <G4ios.hh>
0050 #include <G4ParticleDefinition.hh>
0051 #include "CexmcAngularRange.hh"
0052 #include "CexmcProductionModelData.hh"
0053 #include "CexmcHistoManager.hh"
0054 #include "CexmcException.hh"
0055 #include "CexmcCommon.hh"
0056 
0057 class  CexmcProductionModelMessenger;
0058 
0059 
0060 class  CexmcProductionModel
0061 {
0062     public:
0063         explicit CexmcProductionModel( const G4String &  name = "unspecified",
0064                                        G4bool  fermiMotionIsOn = false );
0065 
0066         virtual ~CexmcProductionModel();
0067 
0068     public:
0069         void  ApplyFermiMotion( G4bool  on, G4bool  fromMessenger = true );
0070 
0071         void  SetAngularRange( G4double  top, G4double  bottom,
0072                                G4int  nmbOfDivs );
0073 
0074         void  SetAngularRanges( const CexmcAngularRangeList &  angularRanges_ );
0075 
0076         void  AddAngularRange( G4double  top, G4double  bottom,
0077                                G4int  nmbOfDivs );
0078 
0079         void  SetProductionModelData(
0080                     const CexmcProductionModelData &  productionModelData_ );
0081 
0082         void  PrintInitialData( void ) const;
0083 
0084         const CexmcAngularRangeList &  GetAngularRanges( void ) const;
0085 
0086         const CexmcAngularRangeList &  GetTriggeredAngularRanges( void ) const;
0087 
0088         const CexmcProductionModelData &  GetProductionModelData( void ) const;
0089 
0090         G4bool  IsFermiMotionOn( void ) const;
0091 
0092         void    SetTriggeredAngularRanges( G4double  opCosThetaSCM );
0093 
0094         const G4String &  GetName( void ) const;
0095 
0096     public:
0097         G4ParticleDefinition *  GetIncidentParticle( void ) const;
0098 
0099         G4ParticleDefinition *  GetNucleusParticle( void ) const;
0100 
0101         G4ParticleDefinition *  GetOutputParticle( void ) const;
0102 
0103         G4ParticleDefinition *  GetNucleusOutputParticle( void ) const;
0104 
0105     protected:
0106         virtual void            FermiMotionStatusChangeHook( void );
0107 
0108     private:
0109         G4bool  IsValidCandidateForAngularRange( G4double  top,
0110                              G4double  bottom, G4int  nmbOfDivs = 1 ) const;
0111 
0112         G4bool  IsGoodCandidateForAngularRange( G4double  top,
0113                                                 G4double  bottom ) const;
0114 
0115     protected:
0116         G4String                  name;
0117 
0118         G4bool                    fermiMotionIsOn;
0119 
0120         CexmcAngularRangeList     angularRanges;
0121 
0122         CexmcAngularRangeList     angularRangesRef;
0123 
0124         CexmcAngularRangeList     triggeredAngularRanges;
0125 
0126         CexmcProductionModelData  productionModelData;
0127 
0128     protected:
0129         G4ParticleDefinition *    incidentParticle;
0130 
0131         G4ParticleDefinition *    nucleusParticle;
0132 
0133         G4ParticleDefinition *    outputParticle;
0134 
0135         G4ParticleDefinition *    nucleusOutputParticle;
0136 
0137     private:
0138         CexmcProductionModelMessenger *  messenger;
0139 };
0140 
0141 
0142 inline void  CexmcProductionModel::ApplyFermiMotion( G4bool  on,
0143                                                      G4bool  fromMessenger )
0144 {
0145     if ( fromMessenger )
0146         ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
0147 
0148     fermiMotionIsOn = on;
0149 
0150     FermiMotionStatusChangeHook();
0151 }
0152 
0153 
0154 inline void  CexmcProductionModel::SetAngularRanges(
0155                                 const CexmcAngularRangeList &  angularRanges_ )
0156 {
0157     angularRangesRef = angularRanges_;
0158     angularRanges = angularRangesRef;
0159 #ifdef CEXMC_USE_ROOT
0160     CexmcHistoManager::Instance()->SetupARHistos( angularRanges );
0161 #endif
0162 }
0163 
0164 
0165 inline void  CexmcProductionModel::SetProductionModelData(
0166                         const CexmcProductionModelData &  productionModelData_ )
0167 {
0168     productionModelData = productionModelData_;
0169 }
0170 
0171 
0172 inline void  CexmcProductionModel::PrintInitialData( void ) const
0173 {
0174     const char *  fermiMotionMsg( "Fermi motion in the target is off" );
0175     if ( fermiMotionIsOn )
0176         fermiMotionMsg = "Fermi motion in the target is on";
0177 
0178     G4cout << CEXMC_LINE_START << fermiMotionMsg << G4endl;
0179     G4cout << CEXMC_LINE_START << "Angular ranges:" << angularRanges;
0180 }
0181 
0182 
0183 inline const CexmcAngularRangeList &
0184                 CexmcProductionModel::GetAngularRanges( void ) const
0185 {
0186     return angularRanges;
0187 }
0188 
0189 
0190 inline const CexmcAngularRangeList &
0191                 CexmcProductionModel::GetTriggeredAngularRanges( void ) const
0192 {
0193     return triggeredAngularRanges;
0194 }
0195 
0196 
0197 inline const CexmcProductionModelData &
0198                 CexmcProductionModel::GetProductionModelData( void ) const
0199 {
0200     return productionModelData;
0201 }
0202 
0203 
0204 inline G4bool  CexmcProductionModel::IsFermiMotionOn( void ) const
0205 {
0206     return fermiMotionIsOn;
0207 }
0208 
0209 
0210 inline const G4String &  CexmcProductionModel::GetName( void ) const
0211 {
0212     return name;
0213 }
0214 
0215 
0216 inline  G4ParticleDefinition *  CexmcProductionModel::GetIncidentParticle(
0217                                                                     void ) const
0218 {
0219     return incidentParticle;
0220 }
0221 
0222 
0223 inline  G4ParticleDefinition *  CexmcProductionModel::GetNucleusParticle( void )
0224                                                                         const
0225 {
0226     return nucleusParticle;
0227 }
0228 
0229 
0230 inline  G4ParticleDefinition *  CexmcProductionModel::GetOutputParticle( void )
0231                                                                         const
0232 {
0233     return outputParticle;
0234 }
0235 
0236 
0237 inline  G4ParticleDefinition *  CexmcProductionModel::GetNucleusOutputParticle(
0238                                                                     void ) const
0239 {
0240     return nucleusOutputParticle;
0241 }
0242 
0243 
0244 inline G4bool  CexmcProductionModel::IsValidCandidateForAngularRange(
0245                     G4double  top, G4double  bottom, G4int  nmbOfDivs ) const
0246 {
0247     return top > bottom && top <= 1.0 && top > -1.0 && bottom < 1.0 &&
0248            bottom >= -1.0 && nmbOfDivs >= 1;
0249 }
0250 
0251 
0252 #endif
0253