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

PhotonFastBlueModel.cxx

Go to the documentation of this file.
00001 #include "PhotonFastBlueModel.h"
00002 #include "PhotonTransportMaker.h"
00003 #include "MessageService/MsgService.h"
00004 #include "Plex/PlexHandle.h"
00005 #include <cmath>
00006 
00007 CVSID( "$Id: PhotonFastBlueModel.cxx,v 1.12 2006/12/01 19:59:25 rhatcher Exp $" );
00008 
00009 ClassImp(PhotonFastBlueModel)
00010 
00011 PhotonTransportMakerProxy<PhotonFastBlueModel>
00012         gPhotonFastBlueModelProxy("photonFastBlueModel"); 
00013 
00015 // Constructor
00016 PhotonFastBlueModel::PhotonFastBlueModel() :
00017   fFastBlueSpectrumTable("PHOTONFASTBLUESPECTRUM")
00018 {
00019   Configure(PhotonConfiguration()); // Set up default values.
00020   
00021   if (fFastBlueSpectrumTable.GetNumRows()<1) {
00022     MSG("Photon",Msg::kError) << "Can't find data for table PHOTONFASTBLUESPECTRUM Aborting!\n";
00023     assert(0);
00024   }
00025   SetBluePrescaleFactor(0.20676); // Lots of prescaling! This model is very efficient.
00026 }
00027 
00029 // Configure the model.
00030 void 
00031 PhotonFastBlueModel::Configure( const Registry& r )
00032 {
00033   MSG("Photon",Msg::kDebug) << "Configuring FastBlueModelModel." << std::endl;
00034   double tmpd;
00035   if (r.Get("ScintDecayTime",tmpd))          fScintDecayTime = tmpd;
00036   if (r.Get("FibreRadius",tmpd))             fFibreRadius  = tmpd;
00037   if (r.Get("ReflectorScintReflec",tmpd))    fReflectorScintReflec  = tmpd;
00038   SetBluePrescaleFactor(0.20676); // Lots of prescaling! This model is very efficient.
00039 }
00040 
00041 void 
00042 PhotonFastBlueModel::Reset( const VldContext& cx )
00043 {
00044   // Ensure tables are up-to-date.
00045   fFastBlueSpectrumTable.Reset(cx);
00046 }
00047 
00048 
00049 Double_t PhotonFastBlueModel::GenTime(void)
00050 { 
00051   // choose a number from a double-exponential.
00052   /* Old.
00053  const double kLambda1 = 0.909973;
00054  const double kLambda2 = 0.012212;
00055  const double kArea1 = 377.615909;
00056  const double kArea2 = 124.790295;
00057   */
00058 
00059   const double kLambda1 = 0.846807;
00060   const double kLambda2 = 0.067829;
00061   const double kArea1 = 410.350066;
00062   const double kArea2 = 28.261422;
00063 
00064   float tt;
00065   if( fRandom->Rndm()*(kArea1+kArea2) < kArea1 ) 
00066     tt = fRandom->Exp(kLambda1);
00067   else 
00068     tt = fRandom->Exp(kLambda2);
00069   
00070   return tt * Munits::ns;
00071 }
00072 
00073 Double_t PhotonFastBlueModel::GenDx(void)
00074 {
00075   /* OLD.
00076   const double kLorentzWidth1 = 0.020726;
00077   const double kArea1 = 5.726562;
00078   const double kLorentzWidth2 = 0.000385;
00079   const double kArea2 = 2.729155;
00080   const double kLambda3 = 0.051335;
00081   const double kArea3 = 0.836376;
00082   */
00083   
00084   const double kLorentzWidth1 = 0.017853;
00085   const double kArea1 = 8.178052;
00086   const double kLorentzWidth2 = 0.001309;
00087   const double kArea2 = 0.864215;
00088   const double kLambda3 = 1.000000;
00089   const double kArea3 = 0.000000;
00090 
00091   const double kArea = kArea1+kArea2+kArea3;
00092 
00093   double choose = fRandom->Rndm() * kArea;
00094 
00095   if( choose < kArea1 ) {
00096     return tan(fRandom->Rndm() * TMath::Pi()) * kLorentzWidth1;
00097   
00098   } else if ( choose < (kArea2+kArea1) ) {
00099     return tan(fRandom->Rndm() * TMath::Pi()) * kLorentzWidth2;
00100   
00101   } else {
00102     double absdx = fRandom->Exp(kLambda3);
00103     if(fRandom->Rndm()>0.5) return -absdx;
00104     return absdx;
00105   }
00106   return 0; // for compiler happiness
00107 }
00108 
00109 Bool_t 
00110 PhotonFastBlueModel::ScintPhotonToFibreHit( const DigiScintHit*    hit, 
00111                                             const UgliStripHandle& inStrip,
00112                                             DigiPhoton*            &outPhoton )
00113 {
00114   outPhoton = NULL;
00115 
00116   // Find the location/time for the start of the blue photon.
00117   double along = fRandom->Rndm();
00118   double tstart = hit->T1() + along*(hit->T2() - hit->T1()) + fRandom->Exp(fScintDecayTime);
00119   double xstart = hit->X1() + along*(hit->X2() - hit->X1());
00120   
00121   double dt, dx;
00122   do {
00123     dt = GenTime();
00124     dx = GenDx();
00125   } while (dt*Munits::c_light/1.6 < fabs(dx)); // Throw out unphysical solutions.
00126   double t = tstart + dt;
00127   double x = xstart + dx;
00128 
00129   double wavelength = fFastBlueSpectrumTable.Pick(fRandom->Rndm()) * Munits::nm;
00130 
00131   // So, we have our chosen x, t, lambda.
00132   // Make an arbitrary direction and position relative to the fibre.
00133 
00134   // Deal with the ends of the strip.
00135   if ( fabs(x) > inStrip.GetHalfLength() ) {
00136 
00137     // Which end did it disappare through?
00138     StripEnd::StripEnd_t end = (x>0)?StripEnd::kPositive:StripEnd::kNegative;
00139     if(inStrip.IsMirrored(end)) {
00140       if(fRandom->Rndm()>fReflectorScintReflec) {
00141         return false; // Photon didn't get reflected    
00142       } else {
00143         // Photon bounced off of reflector.
00144         if(x>0) 
00145           x = inStrip.GetHalfLength() - x;
00146         else
00147           x = -inStrip.GetHalfLength() -x;
00148       }
00149 
00150     } else {
00151       // end wasn't mirrored.
00152       return false; // Photon escapes.
00153     }   
00154   }
00155 
00156   if(inStrip.WlsBypass() > 0.) {
00157     // Deal with the case where the hit was near the edge of a two-part strip.
00158     // See if the hit is contained or not.
00159     if( ( (x + inStrip.GetHalfLength()) > inStrip.PartialLength(StripEnd::kNegative) ) 
00160         && ( (inStrip.GetHalfLength() - x) > inStrip.PartialLength(StripEnd::kPositive) )
00161         ) {
00162       // The photon got leaked out into the coil hole bypass
00163       return false;
00164     }
00165 
00166   }
00167 
00168   outPhoton = new DigiPhoton(hit,
00169                              wavelength, t,
00170                              x, 0,  inStrip.GetHalfThickness()-fFibreRadius*2.0,
00171                              0, 0,  1.0);
00172   
00173   
00174   return true;
00175 }
00176 
00177 
00178 

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