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
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
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
00053 ScintPhoton::Configure(r);
00054
00055 SetBluePrescaleFactor(1.0);
00056 }
00057
00058 void
00059 PhotonFullBlueTracker::Reset( const VldContext& cx )
00060 {
00061
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
00078
00079
00080 if(!hit) return false;
00081
00082
00083 ScintPhoton* photon = new ScintPhoton();
00084
00085
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
00098
00099
00100 bool ok;
00101 do {
00102 TVector3 dir(0,0,0);
00103 photon->Reset(fRandom,
00104 hit,
00105 inStrip,
00106 p, t,
00107 dir);
00108
00109
00110 double wavelength_nm = fBlueSpectrumTable.Pick(fRandom->Rndm());
00111 photon->SetWavelength( wavelength_nm * Munits::nm );
00112
00113
00114
00115
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();
00123 } while(!ok);
00124
00125
00126 outPhoton = (DigiPhoton*) photon;
00127
00128
00129
00130
00131 if(inStrip.WlsBypass() > 0.) {
00132 float x = outPhoton->X();
00133
00134
00135 if( ( (x + inStrip.GetHalfLength()) > inStrip.PartialLength(StripEnd::kNegative) )
00136 && ( (inStrip.GetHalfLength() - x) > inStrip.PartialLength(StripEnd::kPositive) )
00137 ) {
00138
00139
00140 return false;
00141 }
00142 }
00143
00144 return (photon->InFibre());
00145 }
00146
00147
00148
00149