| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GtDiffuserBallTool.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * GtDiffuserBallTool - LED light source for calibration
00003  *
00004  * Tool to generate photons from surface of diffuser ball, used in AD 
00005  * calibration. It chooses a random point on the ball as the photon 
00006  * vertex and emits a photon in a uniform random direction, away from the ball.
00007  * The vertices may be distributed isotropically or anisotropically. 
00008  * The momentum direction is on a hemisphere, whose plane lies tangent to the 
00009  * vertex. 
00010  *
00011  * The light emitted from the LED has 4 options for m_wavelengthMode to describe
00012  * the LED wavelength spectrum:
00013  * "Fixed"   - monochromatic (default)
00014  * "Uniform" - uniformly distributed with mean m_wavelength and half-range 
00015  *             m_wavelengthSpread
00016  * "Smeared" - gaussian distributed with mean of m_wavelength 
00017  * "Defined" - user-defined PDF for random number generator
00018  *
00019  * The light emitted from the LED has 2 options for m_timingMode to describe
00020  * the LED timing distribution within an event:
00021  * "Instant" - all vertices within an event are emitted simultaneously at 
00022  *             the beginning of the event (t=0) (default)
00023  * "Defined" - user-defined PDF for random number generator
00024  *
00025  * "Defined" m_modeWave (m_modeTime) has 2 vectors the user must input - Python 
00026  * lists will convert to vectors. Variable m_pdfWave (m_pdfTime) for property 
00027  * PdfWave (PdfTime) is a vector containing the bin content for the wavelength 
00028  * spectrum (timing distribution) histogram. Variable m_edgesWave (m_edgesTime) 
00029  * for property PdfEdgesWave (PdfEdgesTime) is a vector containing the bin edges 
00030  * of the histogram. Inputting this allows for dealing with uneven bin sizes. 
00031  * The pdf does not need to be normalized. Obviously, m_edges should have one 
00032  * more element than m_pdf.
00033  *
00034  *
00035  *
00036  * Kim Boddy, kboddy@caltech.edu
00037  * 05 Aug 2008
00038  * 06 Jan 2009, Include anisotropy
00039  *****************************************************************************/
00040 
00041 #ifndef GTDIFFUSERBALLTOOL_H
00042 #define GTDIFFUSERBALLTOOL_H
00043 
00044 #include "GenTools/IHepMCEventMutator.h"
00045 #include "GaudiAlg/GaudiTool.h"
00046 #include "GaudiKernel/RndmGenerators.h"
00047 
00048 
00049 class GtDiffuserBallTool : public GaudiTool,
00050                            virtual public IHepMCEventMutator
00051 {
00052  public: 
00053   GtDiffuserBallTool(const std::string& type,
00054                      const std::string& name, 
00055                      const IInterface* parent);
00056   virtual ~GtDiffuserBallTool();
00057 
00058   // GaudiTool interface
00059   virtual StatusCode initialize();
00060   virtual StatusCode finalize();
00061 
00062   // HepMCEventMutator interface
00063   virtual StatusCode mutate(HepMC::GenEvent& event);
00064  
00065  private:
00066 
00067   // Number of photons per event to generate, default = 3500
00068   int m_particlesPerEvent;
00069   
00070   // Mode to smear event-by-event number of photons
00071   // Fixed: No fluctuation
00072   // Gaus: Gaussian distributed
00073   // Lorentz: Lorentz distributed
00074   std::string m_particlesPerEventMode;
00075   // Width of photon number distribution (sigma for Gaus, FWHM for Lorentz)
00076   int m_particlesPerEventSpread;
00077   
00078   // Mode to operate wavelength
00079   // Fixed:   LED emits monochromatic light (default)
00080   // Uniform: LED emits uniform light
00081   // Smeared: LED emits gaussian distributed light 
00082   // Defined: LED emits user-defined spectrum of light
00083   std::string m_wavelengthMode;
00084 
00085   // Mode to operate timing distribution
00086   // Instant: LED emits light instantaneously at beginning of event (default) 
00087   // Defined: LED emits light with user-defined timing distribution
00088   std::string m_timingMode;
00089 
00090   // Wavelength of photons from LED, default is 430 nm (2.9 eV)
00091   double m_wavelength;
00092 
00093   // Spread (sigma of Gaussian or 1/2 range of uniform) for wavelength spectrum, default is 5nm
00094   double m_wavelengthSpread;
00095 
00096   // Frequency of pulses from LED - default is 500 Hz
00097   double m_pulseFrequency;
00098 
00099   // Radius of diffuser ball - default is 0.9525 cm (0.75 inch diameter)
00100   double m_radius;
00101 
00102   // Turn on (true) or off (false) anisotropy - default is on
00103   bool m_anisotropy;
00104   // If true, create bright spot on diffuser ball - default is theta=0, phi=0
00105   double m_bright_theta;
00106   double m_bright_phi;
00107 
00108   // Property: Reduce the number of photons and scale the weight of
00109   // each to compensate.  Default scaling is 3.7 (based on maximum
00110   // quantum eff.)
00111   double m_photonScaleWeight;
00112 
00113   // Name of geometry positioner for the diffuser ball
00114   std::string m_geomPosToolName;
00115 
00116   std::string m_particleName; // The PDG name for the particle
00117   int m_pid;                  // PDG particle ID
00118 
00119   Rndm::Numbers m_uni,m_randWave,m_randTime, m_randPartNo;
00120 
00121   // user-defined PDF and associated bin edges for LED spectrum 
00122   // default is single count in narrow bin centered around default m_wavelength
00123   std::vector<double> m_pdfWave;
00124   std::vector<double> m_edgesWave;
00125   std::vector<double> m_cdfWave; // Transient storage of Cum. Dist. Func.
00126 
00127   // user-defined PDF and associated bin edges for timing distribution within an event
00128   // default is single count in narrow bin near t=0
00129   std::vector<double> m_pdfTime;
00130   std::vector<double> m_edgesTime;
00131   std::vector<double> m_cdfTime; // Transient storage of Cum. Dist. Func.
00132 
00133   StatusCode oneVertex(HepMC::GenEvent& event);
00134   double GetWave();
00135   double GetTime();
00136   double ConvertCdfRand(const double& rand, const std::vector<double>& cdf, 
00137                         const std::vector<double>& edges);
00138 
00139 };
00140 
00141 
00142 #endif //GTDIFFUSERBALLTOOL_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:55:36 2011 for GenTools by doxygen 1.4.7