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

Last change on this file since 1345 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.2 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.6 2009/08/01 07:57:13 kurasige Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
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;
42const G4ParticleDefinition* G4ProductionCuts::protonDef = 0;
43
44G4ProductionCuts::G4ProductionCuts() :
45  isModified(true)
46{
47  for (G4int i=0; i< NumberOfG4CutIndex; i++) {
48    fRangeCuts.push_back(0.0);
49  }
50}
51
52G4ProductionCuts::G4ProductionCuts(const G4ProductionCuts& right) 
53{
54  *this = right;
55}
56
57G4ProductionCuts::~G4ProductionCuts()
58{
59  fRangeCuts.clear();
60}
61
62G4ProductionCuts & G4ProductionCuts::operator=(const G4ProductionCuts &right)
63{
64  if (&right==this) return *this;
65
66  for (G4int i=0; i< NumberOfG4CutIndex; i++) {
67    fRangeCuts[i] = right.fRangeCuts[i];
68  }
69  isModified = right.isModified;
70
71  return *this;
72}
73
74
75
76G4int G4ProductionCuts::operator==(const G4ProductionCuts &right) const
77{
78  return (this == &right);
79}
80
81
82G4int G4ProductionCuts::operator!=(const G4ProductionCuts &right) const
83{
84  return (this !=  &right);
85}
86
87
88G4int  G4ProductionCuts::GetIndex(const G4String& name)
89{
90  static G4String gamma("gamma");
91  static G4String electron("e-");
92  static G4String positron("e+");
93  static G4String proton("proton");
94 
95  G4int index;
96  if       ( name == gamma )        { index =  0; }
97  else  if ( name == electron )     { index =  1; }
98  else  if ( name == positron )     { index =  2; }
99  else  if ( name == proton )       { index =  3; }
100  else                              { index = -1; }
101
102  return index;
103}
104
105
106G4int  G4ProductionCuts::GetIndex(const G4ParticleDefinition* ptcl)
107{ 
108  if(!ptcl) return -1;
109  // In the first call, pointers are set
110  if(gammaDef==0  && ptcl->GetParticleName()=="gamma")  { gammaDef = ptcl; }
111  if(electDef==0  && ptcl->GetParticleName()=="e-")     { electDef = ptcl; }
112  if(positDef==0  && ptcl->GetParticleName()=="e+")     { positDef = ptcl; }
113  if(protonDef==0 && ptcl->GetParticleName()=="proton") { protonDef = ptcl; }
114
115  G4int index;
116  if(ptcl==gammaDef)       { index = 0;  }
117  else if(ptcl==electDef)  { index = 1;  }
118  else if(ptcl==positDef)  { index = 2;  }
119  else if(ptcl==protonDef) { index = 3;  }
120  else                     { index = -1; }
121
122  return index;
123}
124
Note: See TracBrowser for help on using the repository browser.