Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PhotonFullBlueTracker.cxx

Go to the documentation of this file.
00001 #include "PhotonFullBlueTracker.h"
00002 #include "PhotonTransportMaker.h"
00003 #include "ScintPhoton.h"
00004 #include "MessageService/MsgService.h"
00005 #include "Plex/PlexHandle.h"
00006 
00007 CVSID( " $Id: PhotonFullBlueTracker.cxx,v 1.10 2006/12/01 20:12:11 rhatcher Exp $" );
00008 
00009 ClassImp(PhotonFullBlueTracker)
00010 
00011 PhotonTransportMakerProxy<PhotonFullBlueTracker>
00012         gPhotonFullBlueTrackerProxy("photonFullBlueTracker"); 
00013 
00014 
00016 // Constructor
00017 PhotonFullBlueTracker::PhotonFullBlueTracker() :
00018   fBlueSpectrumTable("PHOTONBLUESPECTRUM"),
00019   fScintAttenTable("PHOTONSCINTATTEN"),
00020   fTiO2ReflecTable("PHOTONTIO2PAINTREFLEC"),
00021   fFibreAbsorbTable("PHOTONFIBREABSORB"),
00022   fScintAttenTuneFactor(1.0),
00023   fTiO2ReflecTuneFactor(1.0) 
00024 {
00025   Configure(PhotonConfiguration());
00026 
00027   if ( (fBlueSpectrumTable.GetNumRows()<1) ||
00028        (fScintAttenTable.GetNumRows()<1) ||
00029        (fTiO2ReflecTable.GetNumRows()<1) ||
00030        (fFibreAbsorbTable.GetNumRows()<1) ) {
00031     MSG("Photon",Msg::kError) << "Can't find data for one of tables! Aborting!\n";
00032     assert(0);
00033   }
00034 }
00035 
00037 // Configure the model.
00038 void 
00039 PhotonFullBlueTracker::Configure( const Registry& r )
00040 {
00041   MSG("Photon",Msg::kDebug) << "Configuring FullBlueTrackerModel." << std::endl;
00042 
00043   double tmpd;
00044   if(r.Get("ScintDecayTime",tmpd)) fScintDecayTime = tmpd;
00045   if(r.Get("ScintAttenTuneFactor",tmpd)) {
00046     fScintAttenTuneFactor = tmpd;
00047     MSG("Photon",Msg::kDebug) << "Setting fScintAttenTuneFactor to " << fScintAttenTuneFactor << endl;
00048   }
00049   if(r.Get("TiO2ReflecTuneFactor",tmpd))
00050     fTiO2ReflecTuneFactor = tmpd;
00051 
00052   // The other classses in the model need configuring:
00053   ScintPhoton::Configure(r);
00054 
00055   SetBluePrescaleFactor(1.0); // No prescaling.
00056 }
00057 
00058 void 
00059 PhotonFullBlueTracker::Reset( const VldContext& cx )
00060 {
00061   // Ensure tables are up-to-date.
00062   fBlueSpectrumTable.Reset(cx);
00063   fScintAttenTable.Reset(cx);
00064   fTiO2ReflecTable.Reset(cx);
00065   fFibreAbsorbTable.Reset(cx);
00066 }
00067 
00068 
00069 
00070 
00071 Bool_t 
00072 PhotonFullBlueTracker::ScintPhotonToFibreHit( const DigiScintHit*    hit, 
00073                                            const UgliStripHandle& inStrip,
00074                                            DigiPhoton*            &outPhoton )
00075 {
00076   outPhoton = NULL;
00077   // This default method uses the ScintPhoton class to do the dirty work.
00078 
00079   
00080   if(!hit) return false;
00081 
00082   // Make the photon.
00083   ScintPhoton*  photon = new ScintPhoton();  
00084 
00085   // Find the location/time for the blue photon.
00086 
00087   Double_t delta = fRandom->Rndm();
00088   TVector3 x1(hit->X1(),hit->Y1(),hit->Z1());
00089   TVector3 x2(hit->X2(),hit->Y2(),hit->Z2());
00090 
00091   TVector3 p = x1 + delta*(x2-x1);
00092   Double_t t = hit->T1() + delta * (hit->T2() - hit->T1()) +
00093     fRandom->Exp(fScintDecayTime);
00094 
00095 
00096 
00097   // The point of this loop is to ensure that we actually manage to 
00098   // simulate a photon successfully.. it doesn't just disappear, but
00099   // is successfully tracked to SOMEWHERE.
00100   bool ok;
00101   do {
00102     TVector3 dir(0,0,0); // let the scint photon do it.
00103     photon->Reset(fRandom,
00104                   hit,
00105                   inStrip,
00106                   p, t,
00107                   dir);
00108 
00109       // Find a wavelength for the photon.
00110     double wavelength_nm = fBlueSpectrumTable.Pick(fRandom->Rndm());
00111     photon->SetWavelength( wavelength_nm * Munits::nm );
00112     
00113     // Find the relevant constants.
00114     // Must set these AFTER the Reset() command, which re-initialized the
00115     // defaults.
00116     photon->SetScintAtten( fScintAttenTable.Interpolate(wavelength_nm) *
00117                            fScintAttenTuneFactor );
00118     photon->SetTiO2Reflec( fTiO2ReflecTable.Interpolate(wavelength_nm) *
00119                            fTiO2ReflecTuneFactor );
00120     
00121     photon->Propagate();
00122     ok = ! photon->GeomError(); // Geometry errors are bad.
00123   } while(!ok);
00124 
00125   // Successful photon.. may or may not have hit green.
00126   outPhoton = (DigiPhoton*) photon;
00127 
00128 
00129   // Simple check for intra-strip light leakage. Not completely correct; this SHOULD
00130   // be part of the photon tracking code.. but simple and straightforward.
00131   if(inStrip.WlsBypass() > 0.) {
00132     float x = outPhoton->X();
00133     // Deal with the case where the hit was near the edge of a two-part strip.
00134     // See if the hit is contained or not.
00135     if( ( (x + inStrip.GetHalfLength()) > inStrip.PartialLength(StripEnd::kNegative) ) 
00136         && ( (inStrip.GetHalfLength() - x) > inStrip.PartialLength(StripEnd::kPositive) )
00137         ) {
00138       
00139       // The photon got leaked out into the coil hole bypass
00140       return false;
00141     }    
00142   }
00143 
00144   return (photon->InFibre()); 
00145 }
00146 
00147 
00148 
00149 

Generated on Mon Feb 15 11:07:21 2010 for loon by  doxygen 1.3.9.1