Warning, file /geant4/examples/basic/B5/include/EmCalorimeterHit.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0020 
0021 
0022 
0023 
0024 
0025 
0026 
0027 
0028 
0029 
0030 #ifndef B5EmCalorimeterHit_h
0031 #define B5EmCalorimeterHit_h 1
0032 
0033 #include "G4VHit.hh"
0034 
0035 #include "G4Allocator.hh"
0036 #include "G4RotationMatrix.hh"
0037 #include "G4THitsCollection.hh"
0038 #include "G4ThreeVector.hh"
0039 #include "globals.hh"
0040 
0041 class G4AttDef;
0042 class G4AttValue;
0043 class G4LogicalVolume;
0044 
0045 namespace B5
0046 {
0047 
0048 
0049 
0050 
0051 
0052 
0053 
0054 
0055 class EmCalorimeterHit : public G4VHit
0056 {
0057   public:
0058     EmCalorimeterHit() = default;
0059     EmCalorimeterHit(G4int cellID);
0060     EmCalorimeterHit(const EmCalorimeterHit& right) = default;
0061     ~EmCalorimeterHit() override = default;
0062 
0063     EmCalorimeterHit& operator=(const EmCalorimeterHit& right) = default;
0064     G4bool operator==(const EmCalorimeterHit& right) const;
0065 
0066     inline void* operator new(size_t);
0067     inline void operator delete(void* aHit);
0068 
0069     void Draw() override;
0070     const std::map<G4String, G4AttDef>* GetAttDefs() const override;
0071     std::vector<G4AttValue>* CreateAttValues() const override;
0072     void Print() override;
0073 
0074     void SetCellID(G4int z) { fCellID = z; }
0075     G4int GetCellID() const { return fCellID; }
0076 
0077     void SetEdep(G4double de) { fEdep = de; }
0078     void AddEdep(G4double de) { fEdep += de; }
0079     G4double GetEdep() const { return fEdep; }
0080 
0081     void SetPos(G4ThreeVector xyz) { fPos = xyz; }
0082     G4ThreeVector GetPos() const { return fPos; }
0083 
0084     void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
0085     G4RotationMatrix GetRot() const { return fRot; }
0086 
0087     void SetLogV(G4LogicalVolume* val) { fPLogV = val; }
0088     const G4LogicalVolume* GetLogV() const { return fPLogV; }
0089 
0090   private:
0091     G4int fCellID = -1;
0092     G4double fEdep = 0.;
0093     G4ThreeVector fPos;
0094     G4RotationMatrix fRot;
0095     const G4LogicalVolume* fPLogV = nullptr;
0096 };
0097 
0098 using EmCalorimeterHitsCollection = G4THitsCollection<EmCalorimeterHit>;
0099 
0100 extern G4ThreadLocal G4Allocator<EmCalorimeterHit>* EmCalorimeterHitAllocator;
0101 
0102 inline void* EmCalorimeterHit::operator new(size_t)
0103 {
0104   if (!EmCalorimeterHitAllocator) {
0105     EmCalorimeterHitAllocator = new G4Allocator<EmCalorimeterHit>;
0106   }
0107   return (void*)EmCalorimeterHitAllocator->MallocSingle();
0108 }
0109 
0110 inline void EmCalorimeterHit::operator delete(void* aHit)
0111 {
0112   EmCalorimeterHitAllocator->FreeSingle((EmCalorimeterHit*)aHit);
0113 }
0114 
0115 }  
0116 
0117 
0118 
0119 #endif