Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-23 10:34:23

0001 #pragma once
0002 
0003 #include <map>
0004 
0005 #include "G4Object.h"
0006 #include "FlatSurface.h"
0007 
0008 #include "DataInterpolation.h"
0009 
0010 #include "IRT.h"
0011 
0012 namespace IRT2 {
0013 
0014 class CherenkovPhotonDetector: public G4Object {
0015  public:
0016  CherenkovPhotonDetector(G4VSolid *solid = 0, G4Material *material = 0):
0017   G4Object(solid, material), m_QERangeMin(0.0), m_QERangeMax(0.0), m_QE(0), m_ScaleFactor(1.0),
0018     m_GeometricEfficiency(0.0), m_CopyIdentifierLevel(0) {};
0019   ~CherenkovPhotonDetector() { delete m_QE; };
0020 
0021   void SetQE(double min, double max, /*const*/ DataInterpolation *qe, double scale = 1.0) { 
0022     m_QERangeMin = min; 
0023     m_QERangeMax = max; 
0024 
0025     delete m_QE;
0026     m_QE = qe; 
0027     m_ScaleFactor = scale;
0028   };
0029 
0030   inline bool CheckQERange(double e) const { return m_QE && e >= m_QERangeMin && e <= m_QERangeMax; };
0031   /*const*/ DataInterpolation *GetQE( void ) const { return m_QE; };
0032   double GetScaleFactor( void ) const { return m_ScaleFactor; };
0033   void SetGeometricEfficiency(double value) { m_GeometricEfficiency = value; };
0034   double GetGeometricEfficiency( void ) const { return m_GeometricEfficiency; };
0035 
0036   void SetActiveAreaSize(double size) { m_ActiveAreaSize = size; };
0037   double GetActiveAreaSize( void ) const { return m_ActiveAreaSize; };
0038 
0039   void SetCopyIdentifierLevel(unsigned lv) { m_CopyIdentifierLevel = lv; };
0040   unsigned GetCopyIdentifierLevel( void ) const { return m_CopyIdentifierLevel; };
0041 
0042   void AddItselfToOpticalBoundaries(IRT *irt, ParametricSurface *surface) /*const*/ {
0043     auto boundary = new OpticalBoundary(0, surface, true);
0044     irt->AddOpticalBoundary(boundary);
0045 
0046     m_OpticalBoundaryStorage.push_back(boundary);
0047   };
0048   IRT *AllocateIRT(unsigned sector, uint64_t icopy) { 
0049     auto irt = new IRT(/*sector*/); 
0050 
0051     if (m_IRT.find(std::make_pair(sector, icopy)) == m_IRT.end()) {
0052       std::vector<IRT*> ret;
0053       ret.push_back(irt);
0054       m_IRT[std::make_pair(sector,icopy)] = ret;
0055     } else 
0056       m_IRT[std::make_pair(sector,icopy)].push_back(irt);
0057 
0058     return irt; 
0059   };
0060   // FIXME: should be (sector,icopy) if ever used again;
0061   //IRT *GetIRT(uint64_t icopy) { return (m_IRT.find(icopy) == m_IRT.end() ? 0 : m_IRT[icopy][0]); };
0062   //std::vector<IRT*> *GetIRTs(uint64_t icopy) { 
0063   //return (m_IRT.find(icopy) == m_IRT.end() ? 0 : &m_IRT[icopy]); 
0064   //};
0065   std::vector<IRT*> *GetIRTs(unsigned sector, uint64_t icopy) { 
0066     return (m_IRT.find(std::make_pair(sector,icopy)) == m_IRT.end() ? 0 :
0067         &m_IRT[std::make_pair(sector, icopy)]); 
0068   };
0069 
0070  private:
0071   // One optical path for each clone (identified by a logical volume copy);
0072   //std::map<uint64_t, std::vector<IRT*>> m_IRT;
0073   std::map<std::pair<unsigned,uint64_t>, std::vector<IRT*>> m_IRT;
0074 
0075   // IRT has a TRef by (unfortunate) design -> need a serialized storage buffer to refer to;
0076   std::vector<OpticalBoundary*> m_OpticalBoundaryStorage;
0077 
0078   // NB: the actual getQE() method can not be in this class since it will require linking 
0079   // against GEANT libraries; that's fine;
0080   double m_QERangeMin, m_QERangeMax;  //!
0081   /*const*/ DataInterpolation *m_QE;    //!
0082   // May want to renormalize the QE curve, for instance to peak at 100%, but keep the 
0083   // QE(lambda) dependency; also helps to select undetected photons, which follow the 
0084   // QE(lambda) curve (so are representative for e.g. <n> calculation), but do not pass 
0085   // the overall (uniform) efficiency test, see CherenkovSteppingAction::UserSteppingAction();
0086   double m_ScaleFactor;               //!
0087 
0088   double m_GeometricEfficiency;
0089 
0090   // In case a squared flat surface;
0091   double m_ActiveAreaSize;
0092 
0093   unsigned m_CopyIdentifierLevel;     //!
0094 
0095 #ifndef DISABLE_ROOT_IO
0096   ClassDef(CherenkovPhotonDetector, 7);
0097 #endif
0098 };
0099 
0100 } // namespace IRT2