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 <TRandom.h>
0004 
0005 #include "DigitizedHit.h"
0006 #include "GeantImport.h"
0007 
0008 namespace IRT2 {
0009 
0010 class CherenkovPhotonDetector;
0011 
0012 struct BlackoutCell {
0013 BlackoutCell(CherenkovPhotonDetector *pd, unsigned icopy, unsigned iX, unsigned iY):
0014   m_PhotonDetector(pd), m_Copy(icopy), m_iX(iX), m_iY(iY) {};
0015   ~BlackoutCell() {};
0016 
0017   bool operator<(const BlackoutCell& other) const {
0018     return 
0019       (m_PhotonDetector <  other.m_PhotonDetector) ||
0020       (m_PhotonDetector == other.m_PhotonDetector && m_Copy <  other.m_Copy) ||
0021       (m_PhotonDetector == other.m_PhotonDetector && m_Copy == other.m_Copy && m_iX  < other.m_iX) ||
0022       (m_PhotonDetector == other.m_PhotonDetector && m_Copy == other.m_Copy && m_iX == other.m_iX && m_iY < other.m_iY);
0023   }
0024 
0025   CherenkovPhotonDetector *m_PhotonDetector;
0026   unsigned m_Copy, m_iX, m_iY;
0027 };
0028 
0029 class Digitization : public virtual GeantImport {
0030  public:
0031   Digitization();
0032   ~Digitization() {};
0033 
0034   unsigned GetDigitizedHitCount( void )                     const { return m_Hits.size(); };
0035   const std::vector<DigitizedHit> &GetDigitizedHits( void ) const { return m_Hits; };
0036   const DigitizedHit *GetDigitizedHit(unsigned id)          const { 
0037     return (id < m_Hits.size() ? &m_Hits[id] : 0);
0038   };
0039 
0040   void SetBlackoutBlowupValue(unsigned value) { m_BlackoutBlowupValue = value; };
0041 
0042   CherenkovRadiator *AddBlackoutRadiator(const char *rname);
0043   void SetSensorActiveAreaPixellation(unsigned div)  { m_SensorActiveAreaPixellation = div; };
0044   void SetSinglePhotonTimingResolution(double value) { m_SinglePhotonTimingResolution = value; };
0045 
0046  protected:
0047   std::vector<DigitizedHit> &Hits( void ) { return m_Hits; };
0048   void ProduceDigitizedHits(bool calibration);
0049   void ClearBlackoutCells( void ) { m_BlackoutCells.clear(); };
0050   void ClearDigitizedHits( void ) { m_Hits.clear(); }
0051   double GetSinglePhotonTimingResolution( void ) const { return m_SinglePhotonTimingResolution; };
0052 
0053  private:
0054   TRandom m_rndm;                                   
0055   std::vector<DigitizedHit> m_Hits;                 
0056 
0057   // Radiator pointer and summing up (assume 2^n) scaling factor on the sensor plane;
0058   std::set<CherenkovRadiator*> m_BlackoutRadiators;
0059   // FIXME: this can be done more efficiently (using cell-to-cell distance); for now just 
0060   // shut down all hits which fall into the same cell as a "background" radiator, at 
0061   // 2^n larger macro-pad;
0062   unsigned m_BlackoutBlowupValue;
0063 
0064   std::set<BlackoutCell> m_BlackoutCells;    
0065 
0066   double m_SinglePhotonTimingResolution;
0067   unsigned m_SensorActiveAreaPixellation;
0068 };
0069 
0070 } // namespace IRT2