source: trunk/source/processes/cuts/src/G4ProductionCuts.cc @ 961

Last change on this file since 961 was 961, checked in by garnier, 15 years ago

update processes

File size: 3.8 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: G4ProductionCuts.cc,v 1.5 2006/06/29 19:30:14 gunter Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30//
31// --------------------------------------------------------------
32//      GEANT 4 class implementation file/  History:
33//    18 Sep. 2002, H.Kuirashige : Structure created based on object model
34// --------------------------------------------------------------
35
36#include "G4ProductionCuts.hh"
37#include <iomanip>
38
39const G4ParticleDefinition* G4ProductionCuts::gammaDef = 0;
40const G4ParticleDefinition* G4ProductionCuts::electDef = 0;
41const G4ParticleDefinition* G4ProductionCuts::positDef = 0;
42
43G4ProductionCuts::G4ProductionCuts() :
44  isModified(true)
45{
46  for (G4int i=0; i< NumberOfG4CutIndex; i++) {
47    fRangeCuts.push_back(0.0);
48  }
49}
50
51G4ProductionCuts::G4ProductionCuts(const G4ProductionCuts& right) 
52{
53  *this = right;
54}
55
56G4ProductionCuts::~G4ProductionCuts()
57{
58  fRangeCuts.clear();
59}
60
61G4ProductionCuts & G4ProductionCuts::operator=(const G4ProductionCuts &right)
62{
63  if (&right==this) return *this;
64
65  for (G4int i=0; i< NumberOfG4CutIndex; i++) {
66    fRangeCuts[i] = right.fRangeCuts[i];
67  }
68  isModified = right.isModified;
69
70  return *this;
71}
72
73
74
75G4int G4ProductionCuts::operator==(const G4ProductionCuts &right) const
76{
77  return (this == &right);
78}
79
80
81G4int G4ProductionCuts::operator!=(const G4ProductionCuts &right) const
82{
83  return (this !=  &right);
84}
85
86
87G4int  G4ProductionCuts::GetIndex(const G4String& name)
88{
89  G4int index;
90  if       ( name == "gamma" )        { index =  0; }
91  else  if ( name == "e-" )           { index =  1; }
92  else  if ( name == "e+" )           { index =  2; }
93  else                                { index = -1; }
94
95  return index;
96}
97
98
99G4int  G4ProductionCuts::GetIndex(const G4ParticleDefinition* ptcl)
100{ 
101  if(!ptcl) return -1;
102  if(gammaDef==0 && ptcl->GetParticleName()=="gamma") { gammaDef = ptcl; }
103  if(electDef==0 && ptcl->GetParticleName()=="e-") { electDef = ptcl; }
104  if(positDef==0 && ptcl->GetParticleName()=="e+") { positDef = ptcl; }
105  G4int index;
106  if(ptcl==gammaDef)      { index = 0; }
107  else if(ptcl==electDef) { index = 1; }
108  else if(ptcl==positDef) { index = 2; }
109  else                    { index = -1; }
110
111  return index;
112}
113
Note: See TracBrowser for help on using the repository browser.