Ignore:
Timestamp:
Apr 6, 2009, 12:34:39 PM (15 years ago)
Author:
garnier
Message:

update processes

Location:
trunk/source/processes/optical
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/optical/History

    r819 r963  
    1616     * Reverse chronological order (last date on top), please *
    1717     ----------------------------------------------------------
     18
     1914th Jan 2009 Peter Gumplinger (op-V09-02-00)
     20              respond to bug report 1040 by fixing G4OpBoundaryProcess.cc
     21
     2207th Nov 2008 Peter Gumplinger (op-V09-01-09)
     23              use new global/HEPRandom's G4RandomTools.hh
     24
     2524th Oct 2008 Peter Gumplinger (op-V09-01-08)
     26              use local G4OpProcessSubType.hh
     27
     2821st Oct 2008 Peter Gumplinger (op-V09-01-07)
     29              add SetProcessSubType for G4OpAbsorption, G4OpBoundaryProcess,
     30              G4OpRayleigh and G4OpWLS
     31
     3218th Aug 2008 Peter Gumplinger (op-V09-01-06)
     33              use signatures G4SwapPtr(T*& and G4SwapObj(T*
     34              in G4OpBoundaryProcess - to work with global-V09-01-12
     35
     3615th Aug 2008 Peter Gumplinger (op-V09-01-05)
     37              replaced G4SwapPtr with G4SwapObj for Rindex
     38              in G4OpBoundaryProcess - serious error since op-V09-01-00
     39              (see also Problem Report 1020)
     40
     414th July 2008 Peter Gumplinger (op-V09-01-04)
     42              In G4OpWLS now SetTouchableHandle(aTrack.GetTouchableHandle())
     43              for the secondaries in the DoIt.
     44              In G4OpBoundaryProcess.cc initialize the pointer:
     45              G4LogicalSurface* Surface = NULL;
     46
     4727th June 2008 Peter Gumplinger (op-V09-01-03)
     48               In G4OpBoundaryProcess changed unsafe cast
     49               (G4OpticalSurface*) to dynamic_cast<G4OpticalSurface*>
     50               following suggestion in bug-report #1014
     51
     526th June 2008 Peter Gumplinger (op-V09-01-02)
     53              G4OpRayleigh, G4OpWLS = trivial name changes:
     54              momentum->energy, momenta->energies
     55
     565th June 2008 Peter Gumplinger (op-V09-01-00)
     57              G4OpBoundaryProcess: Removed G4Swap methods - replaced by
     58              G4SwapPtr. Removed G4IsotropicRand method - replaced by
     59              G4RandomDirection. Add commented code to change absorption
     60              at a dielectric/metal boundary into transmission.
    1861
    196229th Oct 2007 Peter Gumplinger (op-V09-00-01)
  • trunk/source/processes/optical/include/G4OpAbsorption.hh

    r819 r963  
    2626//
    2727// $Id: G4OpAbsorption.hh,v 1.9 2006/06/29 21:08:36 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
  • trunk/source/processes/optical/include/G4OpBoundaryProcess.hh

    r819 r963  
    2525//
    2626//
    27 // $Id: G4OpBoundaryProcess.hh,v 1.16 2007/10/15 21:16:24 gum Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4OpBoundaryProcess.hh,v 1.18 2008/11/07 17:59:37 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    6868#include "geomdefs.hh"
    6969#include "Randomize.hh"
     70
     71#include "G4RandomTools.hh"
     72#include "G4RandomDirection.hh"
     73
    7074#include "G4Step.hh"
    7175#include "G4VDiscreteProcess.hh"
     
    162166private:
    163167
    164         void G4Swap(G4double* a, G4double* b) const;
    165 
    166         void G4Swap(G4Material* a, G4Material* b) const;
    167 
    168         void G4VectorSwap(G4ThreeVector* vec1, G4ThreeVector* vec2) const;
    169 
    170168        G4bool G4BooleanRand(const G4double prob) const;
    171 
    172         G4ThreeVector G4IsotropicRand() const;
    173 
    174         G4ThreeVector G4LambertianRand(const G4ThreeVector& normal);
    175 
    176         G4ThreeVector G4PlaneVectorRand(const G4ThreeVector& normal) const;
    177169
    178170        G4ThreeVector GetFacetNormal(const G4ThreeVector& Momentum,
     
    229221
    230222inline
    231 void G4OpBoundaryProcess::G4Swap(G4double* a, G4double* b) const
    232 {
    233         // swaps the contents of the objects pointed
    234         // to by 'a' and 'b'!
    235 
    236   G4double temp;
    237 
    238   temp = *a;
    239   *a = *b;
    240   *b = temp;
    241 }
    242 
    243 inline
    244 void G4OpBoundaryProcess::G4Swap(G4Material* a, G4Material* b) const
    245 {
    246         // ONLY swaps the pointers; i.e. what used to be pointed
    247         // to by 'a' is now pointed to by 'b' and vice versa!
    248 
    249    G4Material* temp = a;
    250 
    251    a = b;
    252    b = temp;
    253 }
    254 
    255 inline
    256 void G4OpBoundaryProcess::G4VectorSwap(G4ThreeVector* vec1,
    257                                        G4ThreeVector* vec2) const
    258 {
    259         // swaps the contents of the objects pointed
    260         // to by 'vec1' and 'vec2'!
    261 
    262   G4ThreeVector temp;
    263 
    264   temp = *vec1;
    265   *vec1 = *vec2;
    266   *vec2 = temp;
    267 }
    268 
    269 inline
    270223G4bool G4OpBoundaryProcess::G4BooleanRand(const G4double prob) const
    271224{
     
    273226
    274227  return (G4UniformRand() < prob);
    275 }
    276 
    277 inline
    278 G4ThreeVector G4OpBoundaryProcess::G4IsotropicRand() const
    279 {
    280   /* Returns a random isotropic unit vector. */
    281 
    282   G4ThreeVector vect;
    283   G4double len2;
    284 
    285   do {
    286 
    287     vect.setX(G4UniformRand() - 0.5);
    288     vect.setY(G4UniformRand() - 0.5);
    289     vect.setZ(G4UniformRand() - 0.5);
    290 
    291     len2 = vect.mag2();
    292 
    293   } while (len2 < 0.01 || len2 > 0.25);
    294 
    295   return vect.unit();
    296 }
    297 
    298 inline
    299 G4ThreeVector G4OpBoundaryProcess::
    300               G4LambertianRand(const G4ThreeVector& normal)
    301 {
    302   /* Returns a random lambertian unit vector. */
    303 
    304   G4ThreeVector vect;
    305   G4double ndotv;
    306 
    307   do {
    308     vect = G4IsotropicRand();
    309 
    310     ndotv = normal * vect;
    311 
    312     if (ndotv < 0.0) {
    313       vect = -vect;
    314       ndotv = -ndotv;
    315     }
    316 
    317   } while (!G4BooleanRand(ndotv));
    318   return vect;
    319 }
    320 
    321 inline
    322 G4ThreeVector G4OpBoundaryProcess::
    323               G4PlaneVectorRand(const G4ThreeVector& normal) const
    324 
    325   /* This function chooses a random vector within a plane given
    326      by the unit normal */
    327 {
    328   G4ThreeVector vec1 = normal.orthogonal();
    329 
    330   G4ThreeVector vec2 = vec1.cross(normal);
    331 
    332   G4double phi = twopi*G4UniformRand();
    333   G4double cosphi = std::cos(phi);
    334   G4double sinphi = std::sin(phi);
    335 
    336   return cosphi * vec1 + sinphi * vec2;
    337228}
    338229
  • trunk/source/processes/optical/include/G4OpRayleigh.hh

    r819 r963  
    2626//
    2727// $Id: G4OpRayleigh.hh,v 1.9 2006/06/29 21:08:40 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/optical/include/G4OpWLS.hh

    r819 r963  
    2626//
    2727// $Id: G4OpWLS.hh,v 1.4 2006/06/29 21:08:42 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
  • trunk/source/processes/optical/src/G4OpAbsorption.cc

    r819 r963  
    2525//
    2626//
    27 // $Id: G4OpAbsorption.cc,v 1.7 2006/06/29 21:08:50 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4OpAbsorption.cc,v 1.9 2008/10/24 19:52:28 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
     
    5252
    5353#include "G4ios.hh"
     54#include "G4OpProcessSubType.hh"
     55
    5456#include "G4OpAbsorption.hh"
    5557
     
    7678           G4cout << GetProcessName() << " is created " << G4endl;
    7779        }
     80
     81        SetProcessSubType(fOpAbsorption);
    7882}
    7983
  • trunk/source/processes/optical/src/G4OpBoundaryProcess.cc

    r819 r963  
    6767
    6868#include "G4ios.hh"
     69#include "G4OpProcessSubType.hh"
     70
    6971#include "G4OpBoundaryProcess.hh"
    7072#include "G4GeometryTolerance.hh"
     
    9395           G4cout << GetProcessName() << " is created " << G4endl;
    9496        }
     97
     98        SetProcessSubType(fOpBoundary);
    9599
    96100        theStatus = Undefined;
     
    220224        OpticalSurface = NULL;
    221225
    222         G4LogicalSurface* Surface = G4LogicalBorderSurface::GetSurface
    223                                     (pPreStepPoint ->GetPhysicalVolume(),
    224                                      pPostStepPoint->GetPhysicalVolume());
     226        G4LogicalSurface* Surface = NULL;
     227
     228        Surface = G4LogicalBorderSurface::GetSurface
     229                  (pPreStepPoint ->GetPhysicalVolume(),
     230                   pPostStepPoint->GetPhysicalVolume());
    225231
    226232        if (Surface == NULL){
     
    249255        }
    250256
    251         //      if (Surface) OpticalSurface = dynamic_cast <G4OpticalSurface*> (Surface->GetSurfaceProperty());
    252         if (Surface) OpticalSurface = (G4OpticalSurface*) Surface->GetSurfaceProperty();
     257        if (Surface) OpticalSurface =
     258           dynamic_cast <G4OpticalSurface*> (Surface->GetSurfaceProperty());
    253259
    254260        if (OpticalSurface) {
     
    429435
    430436          DielectricMetal();
     437
     438          // Uncomment the following lines if you wish to have
     439          //         Transmission instead of Absorption
     440          // if (theStatus == Absorption) {
     441          //    return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     442          // }
    431443
    432444        }
     
    579591           if( !G4BooleanRand(theReflectivity) && n == 1 ) {
    580592
     593             // Comment out DoAbsorption and uncomment theStatus = Absorption;
     594             // if you wish to have Transmission instead of Absorption
     595
    581596             DoAbsorption();
     597             // theStatus = Absorption;
    582598             break;
    583599
     
    657673              Through = false;
    658674              theGlobalNormal = -theGlobalNormal;
    659               G4Swap(Material1,Material2);
    660               G4Swap(&Rindex1,&Rindex2);
     675              G4SwapPtr(Material1,Material2);
     676              G4SwapObj(&Rindex1,&Rindex2);
    661677           }
    662678
     
    864880                else {
    865881                   Swap = !Swap;
    866                    G4Swap(Material1,Material2);
    867                    G4Swap(&Rindex1,&Rindex2);
     882                   G4SwapPtr(Material1,Material2);
     883                   G4SwapObj(&Rindex1,&Rindex2);
    868884                }
    869885                if ( theFinish == groundbackpainted )
  • trunk/source/processes/optical/src/G4OpRayleigh.cc

    r819 r963  
    2525//
    2626//
    27 // $Id: G4OpRayleigh.cc,v 1.14 2006/06/29 21:08:54 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4OpRayleigh.cc,v 1.17 2008/10/24 19:51:12 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    5757
    5858#include "G4ios.hh"
     59#include "G4OpProcessSubType.hh"
     60
    5961#include "G4OpRayleigh.hh"
    6062
     
    7880           : G4VDiscreteProcess(processName, type)
    7981{
     82        SetProcessSubType(fOpRayleigh);
    8083
    8184        thePhysicsTable = 0;
     
    248251        const G4Material* aMaterial = aTrack.GetMaterial();
    249252
    250         G4double thePhotonMomentum = aParticle->GetTotalMomentum();
     253        G4double thePhotonEnergy = aParticle->GetTotalEnergy();
    251254
    252255        G4double AttenuationLength = DBL_MAX;
     
    258261           AttenuationLength =
    259262                (*thePhysicsTable)(aMaterial->GetIndex())->
    260                            GetValue(thePhotonMomentum, isOutRange);
     263                           GetValue(thePhotonEnergy, isOutRange);
    261264        }
    262265        else {
     
    270273             if(AttenuationLengthVector){
    271274               AttenuationLength = AttenuationLengthVector ->
    272                                     GetProperty(thePhotonMomentum);
     275                                    GetProperty(thePhotonEnergy);
    273276             }
    274277             else{
     
    305308
    306309        // Retrieve vectors for refraction index
    307         // and photon momentum from the material properties table
     310        // and photon energy from the material properties table
    308311
    309312        G4MaterialPropertyVector* Rindex = aMPT->GetProperty("RINDEX");
     
    325328           while (++(*Rindex)) {
    326329
    327                 e = (Rindex->GetPhotonMomentum());
     330                e = (Rindex->GetPhotonEnergy());
    328331
    329332                refraction_index = Rindex->GetProperty();
     
    332335
    333336                if (verboseLevel>0) {
    334                         G4cout << Rindex->GetPhotonMomentum() << " MeV\t";
     337                        G4cout << Rindex->GetPhotonEnergy() << " MeV\t";
    335338                        G4cout << xlambda << " mm\t";
    336339                }
     
    347350                }
    348351                RayleighScatteringLengths->
    349                         InsertValues(Rindex->GetPhotonMomentum(), Dist);
     352                        InsertValues(Rindex->GetPhotonEnergy(), Dist);
    350353           }
    351354
  • trunk/source/processes/optical/src/G4OpWLS.cc

    r819 r963  
    2525//
    2626//
    27 // $Id: G4OpWLS.cc,v 1.9 2007/10/30 03:53:36 gum Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4OpWLS.cc,v 1.13 2008/10/24 19:50:50 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
     
    4646
    4747#include "G4ios.hh"
     48#include "G4OpProcessSubType.hh"
     49
    4850#include "G4OpWLS.hh"
    4951#include "G4WLSTimeGeneratorProfileDelta.hh"
     
    6163  : G4VDiscreteProcess(processName, type)
    6264{
     65  SetProcessSubType(fOpWLS);
     66
    6367  theIntegralTable = 0;
    6468 
     
    161165  for (G4int i = 0; i < NumPhotons; i++) {
    162166   
    163     // Determine photon momentum
     167    // Determine photon energy
    164168   
    165169    G4double CIIvalue = G4UniformRand()*CIImax;
    166     G4double sampledMomentum =
     170    G4double sampledEnergy =
    167171      WLSIntegral->GetEnergy(CIIvalue);
    168172   
    169173    if (verboseLevel>1) {
    170       G4cout << "sampledMomentum = " << sampledMomentum << G4endl;
     174      G4cout << "sampledEnergy = " << sampledEnergy << G4endl;
    171175      G4cout << "CIIvalue =        " << CIIvalue << G4endl;
    172176    }
     
    217221       photonPolarization.z());
    218222   
    219     aWLSPhoton->SetKineticEnergy(sampledMomentum);
     223    aWLSPhoton->SetKineticEnergy(sampledEnergy);
    220224   
    221225    // Generate new G4Track object:
     
    230234    G4Track* aSecondaryTrack =
    231235      new G4Track(aWLSPhoton,aSecondaryTime,aSecondaryPosition);
    232    
    233     aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
     236   
     237    aSecondaryTrack->SetTouchableHandle(aTrack.GetTouchableHandle());
     238    // aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
    234239   
    235240    aSecondaryTrack->SetParentID(aTrack.GetTrackID());
     
    285290         
    286291          // Retrieve the first intensity point in vector
    287           // of (photon momentum, intensity) pairs
     292          // of (photon energy, intensity) pairs
    288293         
    289294          theWLSVector->ResetIterator();
     
    295300          if (currentIN >= 0.0) {
    296301
    297             // Create first (photon momentum)
     302            // Create first (photon energy)
    298303           
    299304            G4double currentPM = theWLSVector->
    300               GetPhotonMomentum();
     305              GetPhotonEnergy();
    301306           
    302307            G4double currentCII = 0.0;
     
    311316            G4double prevIN  = currentIN;
    312317           
    313             // loop over all (photon momentum, intensity)
     318            // loop over all (photon energy, intensity)
    314319            // pairs stored for this material
    315320           
     
    317322              {
    318323                currentPM = theWLSVector->
    319                   GetPhotonMomentum();
     324                  GetPhotonEnergy();
    320325               
    321326                currentIN=theWLSVector->
     
    355360  const G4Material* aMaterial = aTrack.GetMaterial();
    356361
    357   G4double thePhotonMomentum = aParticle->GetTotalMomentum();
     362  G4double thePhotonEnergy = aParticle->GetTotalEnergy();
    358363
    359364  G4MaterialPropertiesTable* aMaterialPropertyTable;
     
    369374    if ( AttenuationLengthVector ){
    370375      AttenuationLength = AttenuationLengthVector->
    371         GetProperty (thePhotonMomentum);
     376        GetProperty (thePhotonEnergy);
    372377    }
    373378    else {
Note: See TracChangeset for help on using the changeset viewer.