CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Alignment/LaserAlignmentSimulation/src/LaserOpticalPhysicsList.cc

Go to the documentation of this file.
00001 
00009 #include "Alignment/LaserAlignmentSimulation/interface/LaserOpticalPhysicsList.h"
00010 #include "G4ProcessManager.hh" 
00011 
00012 #include "G4Cerenkov.hh" 
00013 #include "G4Scintillation.hh" 
00014 #include "G4OpAbsorption.hh" 
00015 #include "G4OpRayleigh.hh" 
00016 #include "G4OpBoundaryProcess.hh" 
00017 
00018 LaserOpticalPhysicsList::LaserOpticalPhysicsList(const G4String& name)
00019   :  G4VPhysicsConstructor(name),
00020      wasActivated(false),
00021      theScintProcess(), 
00022      theCerenkovProcess(), 
00023      theAbsorptionProcess(),
00024      theRayleighScattering(), 
00025      theBoundaryProcess(), 
00026      theWLSProcess()
00027 {
00028   if (verboseLevel > 0)
00029     std::cout << "<LaserOpticalPhysicsList::LaserOpticalPhysicsList(...)> entering constructor ..." << std::endl;
00030 }
00031 
00032 LaserOpticalPhysicsList::~LaserOpticalPhysicsList()
00033 {
00034   if (verboseLevel > 0)
00035     {
00036       std::cout << "<LaserOpticalPhysicsList::~LaserOpticalPhysicsList()> entering destructor ... " << std::endl;
00037       std::cout << "  deleting the processes ... ";
00038     }
00039   if ( theWLSProcess != 0 )         { delete theWLSProcess; }
00040   if ( theBoundaryProcess != 0 )    { delete theBoundaryProcess; }
00041   if ( theRayleighScattering != 0 ) { delete theRayleighScattering; }
00042   if ( theAbsorptionProcess != 0 )  { delete theAbsorptionProcess; }
00043 //  if ( theCerenkovProcess != 0 )    { delete theCerenkovProcess; }
00044   if ( theScintProcess != 0 )       { delete theScintProcess; }
00045   if (verboseLevel > 0)
00046     std::cout << " done " << std::endl;
00047 }
00048 
00049 void LaserOpticalPhysicsList::ConstructParticle()
00050 {
00051   if (verboseLevel > 0)
00052     std::cout << "<LaserOpticalPhysicsList::ConstructParticle()>: constructing the optical photon ... " << std::endl;
00053 
00054   // optical photon
00055   G4OpticalPhoton::OpticalPhotonDefinition();
00056 }
00057 
00058 void LaserOpticalPhysicsList::ConstructProcess()
00059 {
00060   if (verboseLevel > 0)
00061     std::cout << "<LaserOpticalPhysicsList::ConstructProcess()>: constructing the physics ... " << std::endl;
00062 
00063   theScintProcess = new G4Scintillation();
00064 //  theCerenkovProcess=new G4Cerenkov();
00065   theAbsorptionProcess=new G4OpAbsorption();
00066   theRayleighScattering=new G4OpRayleigh();
00067   theBoundaryProcess=new G4OpBoundaryProcess("OpBoundary");
00068   theWLSProcess=new G4OpWLS();
00069   
00070   // set the verbosity level
00071   theAbsorptionProcess->SetVerboseLevel(verboseLevel);
00072   theBoundaryProcess->SetVerboseLevel(verboseLevel);
00073 
00074   G4ProcessManager * pManager = 0;
00075   
00076   pManager = G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
00077   pManager->AddDiscreteProcess(theAbsorptionProcess);
00078   pManager->AddDiscreteProcess(theRayleighScattering);
00079   theBoundaryProcess->SetModel(unified);
00080   pManager->AddDiscreteProcess(theBoundaryProcess);
00081   pManager->AddDiscreteProcess(theWLSProcess);
00082   
00083   theScintProcess->SetScintillationYieldFactor(1.);
00084   theScintProcess->SetScintillationExcitationRatio(0.0);
00085   theScintProcess->SetTrackSecondariesFirst(true);
00086   
00087   theParticleIterator->reset();
00088   while( (*theParticleIterator)() )
00089     {
00090       G4ParticleDefinition* particle = theParticleIterator->value();
00091       pManager = particle->GetProcessManager();
00092 //      if(theCerenkovProcess->IsApplicable(*particle))
00093 //      {
00094 //        pManager->AddContinuousProcess(theCerenkovProcess);
00095 //      }
00096       if(theScintProcess->IsApplicable(*particle))
00097         {
00098           pManager->AddProcess(theScintProcess);
00099           pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
00100           pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
00101         }
00102     }
00103 
00104   wasActivated = true;
00105 }