Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:18:06

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