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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/decay/src/G4UnknownDecay.cc (Version 11.3.0) and /processes/decay/src/G4UnknownDecay.cc (Version 9.1.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4UnknownDecay.cc,v 1.5 2007/10/06 07:01:09 kurasige Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
 27 //                                                 29 //
 28 //                                                 30 // 
 29 // -------------------------------------------     31 // --------------------------------------------------------------
 30 //      GEANT 4 class implementation file          32 //      GEANT 4 class implementation file
 31 //                                                 33 //
 32 // -------------------------------------------     34 // ------------------------------------------------------------
 33 //                                                 35 //
 34                                                    36 
 35 #include "G4UnknownDecay.hh"                       37 #include "G4UnknownDecay.hh"
 36                                                << 
 37 #include "G4PhysicalConstants.hh"              << 
 38 #include "G4SystemOfUnits.hh"                  << 
 39 #include "G4DynamicParticle.hh"                    38 #include "G4DynamicParticle.hh"
 40 #include "G4DecayProducts.hh"                      39 #include "G4DecayProducts.hh"
 41 #include "G4PhysicsLogVector.hh"                   40 #include "G4PhysicsLogVector.hh"
 42 #include "G4ParticleChangeForDecay.hh"             41 #include "G4ParticleChangeForDecay.hh"
 43 #include "G4DecayProcessType.hh"               << 
 44                                                    42 
 45 // constructor                                     43 // constructor
 46 G4UnknownDecay::G4UnknownDecay(const G4String&     44 G4UnknownDecay::G4UnknownDecay(const G4String& processName)
 47                                :G4VDiscretePro     45                                :G4VDiscreteProcess(processName, fDecay),
 48         verboseLevel(1),                           46         verboseLevel(1),
 49                                 HighestValue(2     47                                 HighestValue(20.0)
 50 {                                                  48 {
 51   // set Process Sub Type                      << 
 52   SetProcessSubType(static_cast<int>(DECAY_Unk << 
 53                                                << 
 54 #ifdef G4VERBOSE                                   49 #ifdef G4VERBOSE
 55   if (GetVerboseLevel()>1) {                       50   if (GetVerboseLevel()>1) {
 56     G4cout << "G4UnknownDecay  constructor " <     51     G4cout << "G4UnknownDecay  constructor " << "  Name:" << processName << G4endl;
 57   }                                                52   }
 58 #endif                                             53 #endif
 59   pParticleChange = &fParticleChangeForDecay;      54   pParticleChange = &fParticleChangeForDecay;
 60 }                                                  55 }
 61                                                    56 
 62 G4UnknownDecay::~G4UnknownDecay()                  57 G4UnknownDecay::~G4UnknownDecay()
 63 {                                                  58 {
 64 }                                                  59 }
 65                                                    60 
 66 G4bool G4UnknownDecay::IsApplicable(const G4Pa     61 G4bool G4UnknownDecay::IsApplicable(const G4ParticleDefinition& aParticleType)
 67 {                                                  62 {
 68   if(aParticleType.GetParticleName()=="unknown     63   if(aParticleType.GetParticleName()=="unknown") return true;
 69   return false;                                    64   return false;
 70 }                                                  65 }
 71                                                    66 
 72 G4double G4UnknownDecay::GetMeanFreePath(const     67 G4double G4UnknownDecay::GetMeanFreePath(const G4Track& /*aTrack*/,G4double, G4ForceCondition*)
 73 {                                                  68 {
 74    return 0.0;                                 <<  69    return  DBL_MIN;
 75 }                                                  70 }
 76                                                    71 
 77 void G4UnknownDecay::BuildPhysicsTable(const G     72 void G4UnknownDecay::BuildPhysicsTable(const G4ParticleDefinition&)
 78 {                                                  73 {
 79   return;                                          74   return;
 80 }                                                  75 }
 81                                                    76 
 82 G4VParticleChange* G4UnknownDecay::DecayIt(con     77 G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step& )
 83 {                                                  78 {
 84   // The DecayIt() method returns by pointer a     79   // The DecayIt() method returns by pointer a particle-change object.
 85   // Units are expressed in GEANT4 internal un     80   // Units are expressed in GEANT4 internal units.
 86                                                    81 
 87   //   Initialize ParticleChange                   82   //   Initialize ParticleChange
 88   //     all members of G4VParticleChange are      83   //     all members of G4VParticleChange are set to equal to 
 89   //     corresponding member in G4Track           84   //     corresponding member in G4Track
 90   fParticleChangeForDecay.Initialize(aTrack);      85   fParticleChangeForDecay.Initialize(aTrack);
 91                                                    86 
 92   // get particle                                  87   // get particle 
 93   const G4DynamicParticle* aParticle = aTrack.     88   const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
 94                                                    89 
 95   //check if thePreAssignedDecayProducts exist     90   //check if thePreAssignedDecayProducts exists
 96   const G4DecayProducts* o_products = (aPartic     91   const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts());
 97   G4bool isPreAssigned = (o_products != nullpt <<  92   G4bool isPreAssigned = (o_products != 0);   
 98   G4DecayProducts* products = nullptr;         <<  93   G4DecayProducts* products = 0;
 99                                                    94 
100   if (!isPreAssigned ){                            95   if (!isPreAssigned ){
101     fParticleChangeForDecay.SetNumberOfSeconda     96     fParticleChangeForDecay.SetNumberOfSecondaries(0);
102     // Kill the parent particle                    97     // Kill the parent particle
103     fParticleChangeForDecay.ProposeTrackStatus     98     fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
104     fParticleChangeForDecay.ProposeLocalEnergy     99     fParticleChangeForDecay.ProposeLocalEnergyDeposit(0.0); 
105                                                   100     
106     ClearNumberOfInteractionLengthLeft();         101     ClearNumberOfInteractionLengthLeft();
107     return &fParticleChangeForDecay ;             102     return &fParticleChangeForDecay ;
108   }                                               103   }
109                                                   104 
110   // copy decay products                          105   // copy decay products 
111   products = new G4DecayProducts(*o_products);    106   products = new G4DecayProducts(*o_products); 
112                                                   107   
113   // get parent particle information .........    108   // get parent particle information ...................................
114   G4double   ParentEnergy  = aParticle->GetTot    109   G4double   ParentEnergy  = aParticle->GetTotalEnergy();
115   G4double   ParentMass    = aParticle->GetMas    110   G4double   ParentMass    = aParticle->GetMass();
116   if (ParentEnergy < ParentMass) {                111   if (ParentEnergy < ParentMass) {
117     ParentEnergy = ParentMass;                    112     ParentEnergy = ParentMass;
118 #ifdef G4VERBOSE                                  113 #ifdef G4VERBOSE
119     if (GetVerboseLevel()>1) {                    114     if (GetVerboseLevel()>1) {
120       G4cout << "G4UnknownDecay::DoIt  : Total    115       G4cout << "G4UnknownDecay::DoIt  : Total Energy is less than its mass" << G4endl;
121       G4cout << " Particle: " << aParticle->Ge    116       G4cout << " Particle: " << aParticle->GetDefinition()->GetParticleName();
122       G4cout << " Energy:"    << ParentEnergy/    117       G4cout << " Energy:"    << ParentEnergy/MeV << "[MeV]";
123       G4cout << " Mass:"    << ParentMass/MeV     118       G4cout << " Mass:"    << ParentMass/MeV << "[MeV]";
124       G4cout << G4endl;                           119       G4cout << G4endl;
125     }                                             120     }
126 #endif                                            121 #endif
127   }                                               122   }
128   G4ThreeVector ParentDirection(aParticle->Get    123   G4ThreeVector ParentDirection(aParticle->GetMomentumDirection());
129                                                   124 
130   G4double energyDeposit = 0.0;                   125   G4double energyDeposit = 0.0;
131   G4double finalGlobalTime = aTrack.GetGlobalT    126   G4double finalGlobalTime = aTrack.GetGlobalTime();
132   //boost all decay products to laboratory fra    127   //boost all decay products to laboratory frame
133   //if the particle has traveled                  128   //if the particle has traveled 
134   if(aParticle->GetPreAssignedDecayProperTime( << 129   if(aParticle->GetPreAssignedDecayProperTime()>0.) {
135     products->Boost( ParentEnergy, ParentDirec    130     products->Boost( ParentEnergy, ParentDirection);
136   }                                               131   }
137                                                   132 
138   //add products in fParticleChangeForDecay       133   //add products in fParticleChangeForDecay
139   G4int numberOfSecondaries = products->entrie    134   G4int numberOfSecondaries = products->entries();
140   fParticleChangeForDecay.SetNumberOfSecondari    135   fParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries);
141 #ifdef G4VERBOSE                                  136 #ifdef G4VERBOSE
142   if (GetVerboseLevel()>1) {                      137   if (GetVerboseLevel()>1) {
143     G4cout << "G4UnknownDecay::DoIt  : Decay v    138     G4cout << "G4UnknownDecay::DoIt  : Decay vertex :";
144     G4cout << " Time: " << finalGlobalTime/ns     139     G4cout << " Time: " << finalGlobalTime/ns << "[ns]";
145     G4cout << " X:" << (aTrack.GetPosition()).    140     G4cout << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]";
146     G4cout << " Y:" << (aTrack.GetPosition()).    141     G4cout << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]";
147     G4cout << " Z:" << (aTrack.GetPosition()).    142     G4cout << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]";
148     G4cout << G4endl;                             143     G4cout << G4endl;
149     G4cout << "G4UnknownDecay::DoIt  : decay p    144     G4cout << "G4UnknownDecay::DoIt  : decay products in Lab. Frame" << G4endl;
150     products->DumpInfo();                         145     products->DumpInfo();
151   }                                               146   }
152 #endif                                            147 #endif
153   G4int index;                                    148   G4int index;
154   G4ThreeVector currentPosition;                  149   G4ThreeVector currentPosition;
155   const G4TouchableHandle thand = aTrack.GetTo    150   const G4TouchableHandle thand = aTrack.GetTouchableHandle();
156   for (index=0; index < numberOfSecondaries; i << 151   for (index=0; index < numberOfSecondaries; index++)
157     // get current position of the track       << 152   {
158     currentPosition = aTrack.GetPosition();    << 153      // get current position of the track
159     // create a new track object               << 154      currentPosition = aTrack.GetPosition();
160     G4Track* secondary = new G4Track( products << 155      // create a new track object
                                                   >> 156      G4Track* secondary = new G4Track( products->PopProducts(),
161               finalGlobalTime ,                   157               finalGlobalTime ,
162               currentPosition );                  158               currentPosition );
163     // switch on good for tracking flag        << 159      // switch on good for tracking flag
164     secondary->SetGoodForTrackingFlag();       << 160      secondary->SetGoodForTrackingFlag();
165     secondary->SetTouchableHandle(thand);      << 161      secondary->SetTouchableHandle(thand);
166     // add the secondary track in the List     << 162      // add the secondary track in the List
167     fParticleChangeForDecay.AddSecondary(secon << 163      fParticleChangeForDecay.AddSecondary(secondary);
168   }                                               164   }
169   delete products;                                165   delete products;
170                                                << 166 
171   // Kill the parent particle                     167   // Kill the parent particle
172   fParticleChangeForDecay.ProposeTrackStatus(     168   fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
173   fParticleChangeForDecay.ProposeLocalEnergyDe    169   fParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit); 
174   fParticleChangeForDecay.ProposeGlobalTime( f    170   fParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime );
175   // reset NumberOfInteractionLengthLeft          171   // reset NumberOfInteractionLengthLeft
176   ClearNumberOfInteractionLengthLeft();           172   ClearNumberOfInteractionLengthLeft();
177                                                   173 
178   return &fParticleChangeForDecay ;               174   return &fParticleChangeForDecay ;
179 }                                                 175 } 
180                                                   176 
181 void G4UnknownDecay::ProcessDescription(std::o << 
182 {                                              << 
183   outFile << GetProcessName()                  << 
184     << ": Decay of 'unknown' particles. \n"    << 
185     << "kinematics of daughters are dertermine << 
186     << "by PreAssignedDecayProducts. \n";      << 
187 }                                              << 
188                                                   177 
189                                                   178 
190                                                   179 
191                                                   180 
192                                                   181 
193                                                   182