source: trunk/source/processes/management/src/G4VProcess.cc @ 846

Last change on this file since 846 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 7.1 KB
Line 
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// $Id: G4VProcess.cc,v 1.15.2.1 2008/04/25 11:47:07 kurasige Exp $
28// GEANT4 tag $Name: geant4-09-01-patch-02 $
29//
30//
31// --------------------------------------------------------------
32//      GEANT 4 class implementation file
33//
34//      History: first implementation, based on object model of
35//      2nd December 1995, G.Cosmo
36// --------------------------------------------------------------
37//   New Physics scheme           8 Jan. 1997  H.Kurahige
38// ------------------------------------------------------------
39//   removed thePhysicsTable           02 Aug. 1998 H.Kurashige
40//   Modified DumpInfo                 15 Aug. 1998 H.Kurashige
41
42#include "G4PhysicsTable.hh"
43#include "G4MaterialTable.hh"
44#include "G4ElementTable.hh"
45#include "G4ElementVector.hh"
46#include "G4VProcess.hh"
47
48G4VProcess::G4VProcess(const G4String& aName, G4ProcessType   aType )
49                  : pParticleChange(0),
50                    theNumberOfInteractionLengthLeft(-1.0),
51                    currentInteractionLength(-1.0),
52                    theProcessName(aName),
53                    theProcessType(aType),
54                    thePILfactor(1.0),
55                    enableAtRestDoIt(true),
56                    enableAlongStepDoIt(true),
57                    enablePostStepDoIt(true),
58                    verboseLevel(0)
59{
60  pParticleChange = &aParticleChange;
61}
62
63G4VProcess::~G4VProcess()
64{
65}
66
67G4VProcess::G4VProcess(const G4VProcess& right)
68          : pParticleChange(0),
69            theNumberOfInteractionLengthLeft(-1.0),
70            currentInteractionLength(-1.0),
71            theProcessName(right.theProcessName),
72            theProcessType(right.theProcessType),
73            thePILfactor(1.0),
74            enableAtRestDoIt(true),
75            enableAlongStepDoIt(true),
76            enablePostStepDoIt(true),
77            verboseLevel(right.verboseLevel)
78{
79}
80
81
82void G4VProcess::SubtractNumberOfInteractionLengthLeft(
83                                  G4double previousStepSize )
84{
85  if (currentInteractionLength>0.0) {
86    theNumberOfInteractionLengthLeft -= previousStepSize/currentInteractionLength;
87    if(theNumberOfInteractionLengthLeft<0.) {
88      theNumberOfInteractionLengthLeft=perMillion;
89    }         
90   
91  } else {
92#ifdef G4VERBOSE
93    if (verboseLevel>0) {
94      G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()";
95      G4cerr << " [" << theProcessName << "]" <<G4endl;
96      G4cerr << " currentInteractionLength = " << currentInteractionLength/cm << " [cm]";
97      G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]";
98      G4cerr << G4endl;
99    }
100#endif
101    G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft()",
102                "Negative currentInteractionLength",EventMustBeAborted,theProcessName);
103  }
104}
105
106void G4VProcess::StartTracking(G4Track*)
107{
108  currentInteractionLength = -1.0;
109  theNumberOfInteractionLengthLeft = -1.0;
110#ifdef G4VERBOSE
111  if (verboseLevel>2) {
112    G4cout << "G4VProcess::StartTracking() [" << theProcessName << "]" <<G4endl;
113  }
114#endif
115}
116
117void G4VProcess::EndTracking()
118{
119#ifdef G4VERBOSE
120  if (verboseLevel>2) {
121    G4cout << "G4VProcess::EndTracking() [" << theProcessName << "]" <<G4endl;
122  }
123#endif
124  theNumberOfInteractionLengthLeft = -1.0;
125  currentInteractionLength = -1.0;
126}
127
128
129const G4String& G4VProcess::GetProcessTypeName(G4ProcessType aType ) 
130{
131  static G4String typeNotDefined= "NotDefined";
132  static G4String typeTransportation = "Transportation";
133  static G4String typeElectromagnetic = "Electromagnetic";
134  static G4String typeOptical = "Optical";
135  static G4String typeHadronic = "Hadronic";
136  static G4String typePhotolepton_hadron = "Photolepton_hadron";
137  static G4String typeDecay = "Decay";
138  static G4String typeGeneral = "General";
139  static G4String typeParameterisation = "Parameterisation";
140  static G4String typeUserDefined = "UserDefined";
141  static G4String noType = "------";   // Do not modify this !!!!
142
143  if (aType ==   fNotDefined) {
144    return  typeNotDefined;
145  } else if  (aType ==   fTransportation ) {
146    return typeTransportation;
147  } else if  (aType ==   fElectromagnetic ) {
148    return typeElectromagnetic;
149  } else if  (aType ==   fOptical ) {
150    return typeOptical;
151  } else if  (aType ==   fHadronic ) {
152    return typeHadronic;
153  } else if  (aType ==   fPhotolepton_hadron ) {
154    return typePhotolepton_hadron;
155  } else if  (aType ==   fDecay ) {
156    return typeDecay;
157  } else if  (aType ==   fGeneral ) {
158    return typeGeneral;
159  } else if  (aType ==   fParameterisation ) {
160    return typeParameterisation;
161  } else if  (aType ==   fUserDefined ) {
162    return typeUserDefined;
163  } else {
164    return noType; 
165  }
166}
167
168G4VProcess & G4VProcess::operator=(const G4VProcess &)
169{
170  G4Exception("G4VProcess::operator=","Illegal operation",
171              JustWarning,"Assignment operator is called");
172  return *this;
173}
174
175G4int G4VProcess::operator==(const G4VProcess &right) const
176{
177  return (this == &right);
178}
179
180G4int G4VProcess::operator!=(const G4VProcess &right) const
181{
182  return (this !=  &right);
183}
184
185void G4VProcess::DumpInfo() const
186{
187  G4cout << "Process Name " << theProcessName ;
188  G4cout << " : Type[" << GetProcessTypeName(theProcessType) << "]"<< G4endl;
189}
190
191
192const G4String&  G4VProcess::GetPhysicsTableFileName(const G4ParticleDefinition* particle,
193                                                     const G4String& directory,
194                                                     const G4String& tableName,
195                                                     G4bool ascii)
196{
197  G4String thePhysicsTableFileExt;
198  if (ascii) thePhysicsTableFileExt = ".asc";
199  else       thePhysicsTableFileExt = ".dat";
200
201  thePhysicsTableFileName = directory + "/";
202  thePhysicsTableFileName += tableName + "." +  theProcessName + ".";
203  thePhysicsTableFileName += particle->GetParticleName() + thePhysicsTableFileExt;
204 
205  return thePhysicsTableFileName;
206}
207
208
209
210
211
212
213
214
215
216
217
Note: See TracBrowser for help on using the repository browser.