Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file B5/include/HadCalorimeterHit.hh << 27 /// \file HadCalorimeterHit.hh 28 /// \brief Definition of the B5::HadCalorimete 28 /// \brief Definition of the B5::HadCalorimeterHit class 29 29 30 #ifndef B5HadCalorimeterHit_h 30 #ifndef B5HadCalorimeterHit_h 31 #define B5HadCalorimeterHit_h 1 31 #define B5HadCalorimeterHit_h 1 32 32 33 #include "G4VHit.hh" 33 #include "G4VHit.hh" 34 << 35 #include "G4Allocator.hh" << 36 #include "G4RotationMatrix.hh" << 37 #include "G4THitsCollection.hh" 34 #include "G4THitsCollection.hh" 38 #include "G4Threading.hh" << 35 #include "G4Allocator.hh" 39 #include "G4ThreeVector.hh" 36 #include "G4ThreeVector.hh" 40 #include "globals.hh" << 37 #include "G4LogicalVolume.hh" 41 << 38 #include "G4Transform3D.hh" 42 #include <map> << 39 #include "G4RotationMatrix.hh" 43 #include <vector> << 44 40 45 class G4AttDef; 41 class G4AttDef; 46 class G4AttValue; 42 class G4AttValue; 47 43 48 namespace B5 44 namespace B5 49 { 45 { 50 46 51 /// Hadron Calorimeter hit 47 /// Hadron Calorimeter hit 52 /// 48 /// 53 /// It records: 49 /// It records: 54 /// - the cell column ID and row ID 50 /// - the cell column ID and row ID 55 /// - the energy deposit 51 /// - the energy deposit 56 /// - the cell position and rotation 52 /// - the cell position and rotation 57 53 58 class HadCalorimeterHit : public G4VHit 54 class HadCalorimeterHit : public G4VHit 59 { 55 { 60 public: 56 public: 61 HadCalorimeterHit() = default; << 57 HadCalorimeterHit(); 62 HadCalorimeterHit(G4int iCol, G4int iRow); << 58 HadCalorimeterHit(G4int iCol,G4int iRow); 63 HadCalorimeterHit(const HadCalorimeterHit& << 59 HadCalorimeterHit(const HadCalorimeterHit &right) = default; 64 ~HadCalorimeterHit() override = default; << 60 ~HadCalorimeterHit() override; 65 61 66 HadCalorimeterHit& operator=(const HadCalo << 62 HadCalorimeterHit& operator=(const HadCalorimeterHit &right) = default; 67 G4bool operator==(const HadCalorimeterHit& << 63 G4bool operator==(const HadCalorimeterHit &right) const; 68 64 69 inline void* operator new(size_t); << 65 inline void *operator new(size_t); 70 inline void operator delete(void* aHit); << 66 inline void operator delete(void *aHit); 71 67 72 void Draw() override; 68 void Draw() override; 73 const std::map<G4String, G4AttDef>* GetAtt << 69 const std::map<G4String,G4AttDef>* GetAttDefs() const override; 74 std::vector<G4AttValue>* CreateAttValues() 70 std::vector<G4AttValue>* CreateAttValues() const override; 75 void Print() override; 71 void Print() override; 76 72 77 void SetColumnID(G4int z) { fColumnID = z; 73 void SetColumnID(G4int z) { fColumnID = z; } 78 G4int GetColumnID() const { return fColumn 74 G4int GetColumnID() const { return fColumnID; } 79 75 80 void SetRowID(G4int z) { fRowID = z; } 76 void SetRowID(G4int z) { fRowID = z; } 81 G4int GetRowID() const { return fRowID; } 77 G4int GetRowID() const { return fRowID; } 82 78 83 void SetEdep(G4double de) { fEdep = de; } 79 void SetEdep(G4double de) { fEdep = de; } 84 void AddEdep(G4double de) { fEdep += de; } 80 void AddEdep(G4double de) { fEdep += de; } 85 G4double GetEdep() const { return fEdep; } 81 G4double GetEdep() const { return fEdep; } 86 82 87 void SetPos(G4ThreeVector xyz) { fPos = xy 83 void SetPos(G4ThreeVector xyz) { fPos = xyz; } 88 G4ThreeVector GetPos() const { return fPos 84 G4ThreeVector GetPos() const { return fPos; } 89 85 90 void SetRot(G4RotationMatrix rmat) { fRot 86 void SetRot(G4RotationMatrix rmat) { fRot = rmat; } 91 G4RotationMatrix GetRot() const { return f 87 G4RotationMatrix GetRot() const { return fRot; } 92 88 93 private: 89 private: 94 G4int fColumnID = -1; 90 G4int fColumnID = -1; 95 G4int fRowID = -1; 91 G4int fRowID = -1; 96 G4double fEdep = 0.; 92 G4double fEdep = 0.; 97 G4ThreeVector fPos; 93 G4ThreeVector fPos; 98 G4RotationMatrix fRot; 94 G4RotationMatrix fRot; 99 }; 95 }; 100 96 101 using HadCalorimeterHitsCollection = G4THitsCo 97 using HadCalorimeterHitsCollection = G4THitsCollection<HadCalorimeterHit>; 102 98 103 extern G4ThreadLocal G4Allocator<HadCalorimete 99 extern G4ThreadLocal G4Allocator<HadCalorimeterHit>* HadCalorimeterHitAllocator; 104 100 105 inline void* HadCalorimeterHit::operator new(s 101 inline void* HadCalorimeterHit::operator new(size_t) 106 { 102 { 107 if (!HadCalorimeterHitAllocator) { 103 if (!HadCalorimeterHitAllocator) { 108 HadCalorimeterHitAllocator = new G4Allocat << 104 HadCalorimeterHitAllocator = new G4Allocator<HadCalorimeterHit>; 109 } 105 } 110 return (void*)HadCalorimeterHitAllocator->Ma 106 return (void*)HadCalorimeterHitAllocator->MallocSingle(); 111 } 107 } 112 108 113 inline void HadCalorimeterHit::operator delete 109 inline void HadCalorimeterHit::operator delete(void* aHit) 114 { 110 { 115 HadCalorimeterHitAllocator->FreeSingle((HadC << 111 HadCalorimeterHitAllocator->FreeSingle((HadCalorimeterHit*) aHit); 116 } 112 } 117 113 118 } // namespace B5 << 114 } 119 115 120 //....oooOO0OOooo........oooOO0OOooo........oo 116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 121 117 122 #endif 118 #endif 123 119