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

PhotonCompositeGreenTracker.cxx

Go to the documentation of this file.
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 // Constructor
00018 PhotonCompositeGreenTracker::PhotonCompositeGreenTracker() 
00019 {
00020   Configure(PhotonConfiguration()); // Set up default values.
00021 }
00022 
00024 // Configure the model.
00025 void 
00026 PhotonCompositeGreenTracker::Configure( const Registry& r )
00027 {
00028   // The other classses in the model need configuring:
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   // Set the prescale factors.
00046   SetGreenPrescaleFactor(fQuantumEfficiency); // Phototube photocathode acceptance.
00047 }
00048 
00049 
00050 
00052 // Creates a green photon from a fibre hit, and tracks to the PMT.
00053 // Returns true if green photon made it, false if attenuated away.
00054 // Takes the blue wavelength (may not be used), position, and time,
00055 // and fills a DigiPE object.
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   // First, figure out which way we're going.
00066   StripEnd::StripEnd_t dir = 
00067     (inGreenPhoton->GetCosX()>0) ? StripEnd::kPositive : StripEnd::kNegative;
00068 
00069   StripEnd::StripEnd_t readout = dir; // Assume we're reading out the end it's going.
00070 
00071   // Is the end we've gotten to mirrored? 
00072   if(inStrip.IsMirrored(dir)) {
00073     // Ok, then we're going to need to flip it.
00074     // Does this photon survive the flip?
00075     if(fRandom->Rndm() > fReflectorFibreReflec) {
00076       return false;
00077     }
00078 
00079     // We survived the reflection.
00080     readout = (dir==StripEnd::kPositive) ? StripEnd::kNegative : StripEnd::kPositive;
00081   }
00082 
00083   // Find the distance down the clear strip.
00084   // Note that this distance is used only for attenuation, not for propagation time.
00085   Double_t clearDist = inStrip.ClearFiber(readout);
00086 
00087   // See if it survives the readout cable. 
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   // The photon is reflecting it's way down the strip.
00096   // Figure out how far it has to go in each medium.
00097 
00098   double distToCenter = (inGreenPhoton->GetCosX()>0) ? (-inGreenPhoton->X())
00099     : (inGreenPhoton->X());
00100 
00101   Double_t halfgreen = inStrip.GetHalfLength()         // Distance to end of strip;
00102                       +inStrip.WlsPigtail(readout); // Pigtail on readout end.
00103 
00104 
00105   Double_t greenDist = distToCenter // Distance to center of strip.
00106                      + halfgreen;
00107 
00108 
00109   // Deal with WLS bypass, if any
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     // place in the middle of the break;
00118     float x_break =0.5* (inStrip.PartialLength(StripEnd::kNegative) 
00119                          - inStrip.PartialLength(StripEnd::kPositive) );
00120 
00121     if(inGreenPhoton->X() < x_break) {
00122       // If the photon is at -ve end and going +ve, it goes through the bypass
00123       if(dir==StripEnd::kPositive)  greenDist+= bypassExtra;
00124     } else {
00125       // If the photon is at +ve end and going -ve, it goes through the bypass
00126       if(dir==StripEnd::kNegative)  greenDist+= bypassExtra;
00127     }
00128   }
00129 
00130   if(readout!=dir) {
00131     // i.e. we're going towards the mirror end but being read out on the non-mirror end
00132     greenDist+= inStrip.GetHalfLength()*2.0; // Gotta double back...
00133     greenDist+= bypassExtra;                 // ... through the ENTIRE green fibre
00134     greenDist+= inStrip.WlsPigtail(dir)*2.0; // And we have to go through the pigtail, if any
00135                                              // (N.B. This is for caldet, which has pigtails before the reflector)
00136   }
00137 
00138 
00139   // See if it survives the green fibre:
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   //MSG("mydebug",Msg::kInfo) << "Green survival prob: " << greenProb << endl;
00151 
00152   if(fRandom->Rndm() < greenProb) return false;
00153 
00154   // But... we don't travel in a straight line!
00155   // We bounce around the fibre a lot. This makes the path length longer.
00156   double greenBouncedDist = greenDist/ fabs(inGreenPhoton->GetCosX());
00157   double clearBouncedDist = clearDist/ fabs(inGreenPhoton->GetCosX());
00158   
00159   // ASSUME: no loss at connector interfaces
00160 
00161   // PMT: ASSUME:
00162   // FIXME: Assume 100% quantum efficiency, or efficiency dealt with
00163   // in photon computation.
00164 
00165   // Build the resultant digipe.
00166   // Find the time of arrival.
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 

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