Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-01 07:07:32

0001 
0002 #include <map>
0003 #include <vector>
0004 
0005 #include <TRef.h>
0006 #include <TObject.h>
0007 #include <TVector3.h>
0008 #include <TString.h>
0009 
0010 #ifndef _CHERENKOV_RADIATOR_
0011 #define _CHERENKOV_RADIATOR_
0012 
0013 #include "ParametricSurface.h"
0014 class G4LogicalVolume;
0015 class G4RadiatorMaterial;
0016 
0017 class CherenkovRadiator: public TObject {
0018  public:
0019   // NB: do not want to use physical volume here because a particle can cross more than one of them
0020   // (at the sector boundary), while there is no good reason to separate these contributions;
0021  CherenkovRadiator(const G4LogicalVolume *volume = 0, const G4RadiatorMaterial *material = 0): 
0022   m_LogicalVolume(volume), m_Material(material), 
0023     m_ReferenceRefractiveIndex(0.0), m_ReferenceAttenuationLength(0.0), 
0024     m_ID(0), m_Stat(0), m_AverageTheta(0.0), m_TrajectoryBinCount(1), m_Smearing(0.0), 
0025     m_GaussianSmearing(false) {};
0026   ~CherenkovRadiator() {};
0027 
0028   double n( void )                               const { return m_ReferenceRefractiveIndex; };
0029   double GetReferenceAttenuationLength( void )   const { return m_ReferenceAttenuationLength; };
0030 
0031   void SetReferenceRefractiveIndex(double n)   { m_ReferenceRefractiveIndex   = n; };
0032   void SetReferenceAttenuationLength(double l) { m_ReferenceAttenuationLength = l; };
0033 
0034   const G4RadiatorMaterial *GetMaterial( void )  const { return m_Material; };
0035 
0036   ParametricSurface *GetFrontSide(unsigned path) {
0037     if (m_Borders.find(path) == m_Borders.end()) return 0;
0038 
0039     return dynamic_cast<ParametricSurface*>(m_Borders[path].first.GetObject());
0040   };
0041   ParametricSurface *GetRearSide(unsigned path) {
0042     if (m_Borders.find(path) == m_Borders.end()) return 0;
0043 
0044     return dynamic_cast<ParametricSurface*>(m_Borders[path].second.GetObject());
0045   };
0046   std::map<unsigned, std::pair<TRef, TRef>> m_Borders; 
0047 
0048   // Material name in dd4hep world;
0049   void SetAlternativeMaterialName(const char *name) { m_AlternativeMaterialName = name; };
0050   const char *GetAlternativeMaterialName( void ) const { 
0051     return m_AlternativeMaterialName.Data();
0052   };
0053 
0054  protected:
0055   // Run-time variables for the GEANT pass;
0056   const G4LogicalVolume *m_LogicalVolume;          //!
0057   const G4RadiatorMaterial *m_Material;            //!
0058 
0059  private:
0060 
0061   // Refractive index calculated for some fixed reference wave length (supposedly the average 
0062   // one as seen on the detected photon wave length plot);
0063   double m_ReferenceRefractiveIndex;
0064   double m_ReferenceAttenuationLength;
0065 
0066   TString m_AlternativeMaterialName;
0067 
0068  public:
0069   void SetTrajectoryBinCount(unsigned bins) { m_TrajectoryBinCount = bins; };
0070   double GetTrajectoryBinCount( void) const { return m_TrajectoryBinCount; };
0071 
0072   inline double GetSmearing( void ) const { return m_Smearing; };
0073   void SetGaussianSmearing(double sigma) { m_GaussianSmearing = true;  m_Smearing = sigma; }
0074   void SetUniformSmearing (double range) { m_GaussianSmearing = false; m_Smearing = range; }
0075   bool UseGaussianSmearing( void )  const { return m_GaussianSmearing; };
0076 
0077   // FIXME: memory leak;
0078   void ResetLocations( void ) { m_Locations.clear(); }
0079   void AddLocation(/*unsigned sector,*/ const TVector3 &x, const TVector3 &n) { 
0080     m_Locations/*[sector]*/.push_back(std::make_pair(x, n)); 
0081   };
0082 
0083   // Transient variables for the analysis script convenience;
0084   unsigned m_ID;                                   //!
0085   unsigned m_Stat;                                 //!
0086   double m_AverageTheta;                           //!
0087   TVector3 m_AverageVertexPosition;                //!
0088   double m_AverageRefractiveIndex;                 //!
0089 
0090   unsigned m_TrajectoryBinCount;                   //!
0091   // This is a hack for now;
0092   double m_Smearing;                               //!
0093   bool m_GaussianSmearing;                         //!
0094   //std::map<unsigned, std::vector<std::pair<TVector3, TVector3>>> _m_Locations; //!
0095   std::vector<std::pair<TVector3, TVector3>> m_Locations; //!
0096 
0097   std::vector<std::pair<double, double>> m_ri_lookup_table; //!
0098 
0099 #ifndef DISABLE_ROOT_IO
0100   ClassDef(CherenkovRadiator, 5);
0101 #endif
0102 };
0103 
0104 #endif