00001 #include "PhotonCompositeGreenTracker.h"
00002 #include "PhotonTransportMaker.h"
00003 #include "PhotonUtil.h"
00004 #include "Calibrator/Calibrator.h"
00005 #include "MessageService/MsgService.h"
00006 #include "Plex/PlexHandle.h"
00007 #include <cmath>
00008
00009 CVSID( "$Id: PhotonCompositeGreenTracker.cxx,v 1.3 2006/12/01 19:59:25 rhatcher Exp $" );
00010
00011 ClassImp(PhotonCompositeGreenTracker)
00012 PhotonTransportMakerProxy<PhotonCompositeGreenTracker>
00013 gPhotonCompositeGreenTrackerProxy("photonCompositeGreenTracker");
00014
00015
00017
00018 PhotonCompositeGreenTracker::PhotonCompositeGreenTracker()
00019 {
00020 Configure(PhotonConfiguration());
00021 }
00022
00024
00025 void
00026 PhotonCompositeGreenTracker::Configure( const Registry& r )
00027 {
00028
00029 MSG("Photon",Msg::kDebug) << "Configuring CompositeGreenTracker." << std::endl;
00030
00031 double tmpd;
00032 if (r.Get("FibreIndex",tmpd)) fFibreIndex = tmpd;
00033 if (r.Get("ClearFibreIndex",tmpd)) fClearFibreIndex = tmpd;
00034
00035 if (r.Get("ReflectorFibreReflec",tmpd)) fReflectorFibreReflec = tmpd;
00036 if (r.Get("QuantumEfficiency",tmpd)) fQuantumEfficiency = tmpd;
00037 if (r.Get("FibreAttenN1",tmpd)) fFibreAttenN1 = tmpd;
00038 if (r.Get("FibreAttenN2",tmpd)) fFibreAttenN2 = tmpd;
00039 if (r.Get("FibreAttenLength1",tmpd)) fFibreAttenLength1 = tmpd;
00040 if (r.Get("FibreAttenLength2",tmpd)) fFibreAttenLength2 = tmpd;
00041 if (r.Get("ClearFibreAttenN1",tmpd)) fClearFibreAttenN1 = tmpd;
00042 if (r.Get("ClearFibreAttenN2",tmpd)) fClearFibreAttenN2 = tmpd;
00043 if (r.Get("ClearFibreAttenLength1",tmpd)) fClearFibreAttenLength1 = tmpd;
00044 if (r.Get("ClearFibreAttenLength2",tmpd)) fClearFibreAttenLength2 = tmpd ;
00045
00046 SetGreenPrescaleFactor(fQuantumEfficiency);
00047 }
00048
00049
00050
00052
00053
00054
00055
00056 Bool_t
00057 PhotonCompositeGreenTracker::GreenPhotonToPe( const UgliStripHandle& inStrip,
00058 DigiPhoton* inGreenPhoton,
00059 DigiPE* &outPe,
00060 StripEnd::StripEnd_t &outEnd)
00061 {
00062 outPe = NULL;
00063 if(!inGreenPhoton) return false;
00064
00065
00066 StripEnd::StripEnd_t dir =
00067 (inGreenPhoton->GetCosX()>0) ? StripEnd::kPositive : StripEnd::kNegative;
00068
00069 StripEnd::StripEnd_t readout = dir;
00070
00071
00072 if(inStrip.IsMirrored(dir)) {
00073
00074
00075 if(fRandom->Rndm() > fReflectorFibreReflec) {
00076 return false;
00077 }
00078
00079
00080 readout = (dir==StripEnd::kPositive) ? StripEnd::kNegative : StripEnd::kPositive;
00081 }
00082
00083
00084
00085 Double_t clearDist = inStrip.ClearFiber(readout);
00086
00087
00088 Double_t clearProb = PhotonUtil::DoubleExp(clearDist,
00089 fClearFibreAttenN1, fClearFibreAttenN2,
00090 fClearFibreAttenLength1, fClearFibreAttenLength2,
00091 true);
00092 if(fRandom->Rndm() > clearProb) return false;
00093
00094
00095
00096
00097
00098 double distToCenter = (inGreenPhoton->GetCosX()>0) ? (-inGreenPhoton->X())
00099 : (inGreenPhoton->X());
00100
00101 Double_t halfgreen = inStrip.GetHalfLength()
00102 +inStrip.WlsPigtail(readout);
00103
00104
00105 Double_t greenDist = distToCenter
00106 + halfgreen;
00107
00108
00109
00110 double bypassExtra = 0;
00111 if(inStrip.WlsBypass() >0) {
00112 bypassExtra = ( inStrip.PartialLength(StripEnd::kNegative) +
00113 inStrip.PartialLength(StripEnd::kPositive) +
00114 inStrip.WlsBypass() -
00115 inStrip.GetHalfLength()*2.0 );
00116
00117
00118 float x_break =0.5* (inStrip.PartialLength(StripEnd::kNegative)
00119 - inStrip.PartialLength(StripEnd::kPositive) );
00120
00121 if(inGreenPhoton->X() < x_break) {
00122
00123 if(dir==StripEnd::kPositive) greenDist+= bypassExtra;
00124 } else {
00125
00126 if(dir==StripEnd::kNegative) greenDist+= bypassExtra;
00127 }
00128 }
00129
00130 if(readout!=dir) {
00131
00132 greenDist+= inStrip.GetHalfLength()*2.0;
00133 greenDist+= bypassExtra;
00134 greenDist+= inStrip.WlsPigtail(dir)*2.0;
00135
00136 }
00137
00138
00139
00140 double gdir = 1.0;
00141 if(readout == StripEnd::kNegative) gdir = -1.0;
00142 Calibrator& Cal = Calibrator::Instance();
00143 PlexStripEndId seid = inStrip.GetSEId();
00144 seid.SetEnd(readout);
00145
00146 double greenProb =1.0-
00147 ( Cal.DecalAttenCorrected(1.0, inGreenPhoton->X(), seid)
00148 / Cal.DecalAttenCorrected(1.0, gdir*halfgreen, seid) );
00149
00150
00151
00152 if(fRandom->Rndm() < greenProb) return false;
00153
00154
00155
00156 double greenBouncedDist = greenDist/ fabs(inGreenPhoton->GetCosX());
00157 double clearBouncedDist = clearDist/ fabs(inGreenPhoton->GetCosX());
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167 double time = inGreenPhoton->T()
00168 + greenBouncedDist * fFibreIndex / Munits::c_light
00169 + clearBouncedDist * fClearFibreIndex / Munits::c_light;
00170
00171 PlexHandle plex(fContext);
00172 PlexPixelSpotId psid = plex.GetPixelSpotId(seid);
00173
00174 outPe = new DigiPE( time, psid, inGreenPhoton->ParentHit() );
00175 outEnd = readout;
00176
00177 return true;
00178 }
00179
00180