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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 #ifndef PAR03HIT_HH
 27 #define PAR03HIT_HH
 28 
 29 #include "G4Allocator.hh"
 30 #include "G4RotationMatrix.hh"
 31 #include "G4THitsCollection.hh"
 32 #include "G4ThreeVector.hh"
 33 #include "G4VHit.hh"
 34 
 35 class G4AttDef;
 36 class G4AttValue;
 37 class G4LogicalVolume;
 38 
 39 /**
 40  * @brief Hit class to store energy deposited in the sensitive detector.
 41  *
 42  * Hit class registers position and energy deposited within the sensitive
 43  * detector. Cell ID is stored using identifiers of readout segmentation (z,
 44  * phi, rho). Additionally, pointer to cell logical volume, its position and
 45  * rotation are saved for visualisation purposes. Time allows to filter hits in
 46  * visualisation. Type of hit allows to distinguish between hits originating
 47  * from full simulation (type 0) and fast simulation (type 1).
 48  *
 49  */
 50 
 51 class Par03Hit : public G4VHit
 52 {
 53   public:
 54     Par03Hit();
 55     Par03Hit(const Par03Hit& aRight);
 56     virtual ~Par03Hit();
 57 
 58     const Par03Hit& operator=(const Par03Hit& aRight);
 59     int operator==(const Par03Hit& aRight) const;
 60 
 61     inline void* operator new(size_t);
 62     inline void operator delete(void* aHit);
 63     /// Visualise hits. If pointer to the logical volume was set, cell shape is
 64     /// drawn taking into account proper radial position (taken from fRhoId)
 65     virtual void Draw();
 66     /// Retrieve atributes' names in order to allow filtering
 67     virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
 68     /// Create attributes for the visualisation.
 69     virtual std::vector<G4AttValue>* CreateAttValues() const;
 70     /// Print hit properties.
 71     virtual void Print();
 72     /// Set position
 73     inline void SetPos(G4ThreeVector aXYZ) { fPos = aXYZ; }
 74     /// Get position
 75     inline G4ThreeVector GetPos() const { return fPos; }
 76     /// Set rotation
 77     inline void SetRot(G4RotationMatrix aXYZ) { fRot = aXYZ; }
 78     /// Get rotation
 79     inline G4RotationMatrix GetRot() const { return fRot; }
 80     /// Set energy
 81     inline void SetEdep(G4double aEdep) { fEdep = aEdep; }
 82     /// Add energy to previous value
 83     inline void AddEdep(G4double aEdep) { fEdep += aEdep; }
 84     /// Get energy
 85     inline G4double GetEdep() const { return fEdep; }
 86     /// Set Z id of the cell in the readout segmentation
 87     inline void SetZid(G4int aZ) { fZId = aZ; }
 88     /// Get Z id of the cell in the readout segmentation
 89     inline G4int GetZid() const { return fZId; }
 90     /// Set Rho id of the cell in the readout segmentation
 91     inline void SetRhoId(G4int aRho) { fRhoId = aRho; }
 92     /// Get rho id of the cell in the readout segmentation
 93     inline G4int GetRhoId() const { return fRhoId; }
 94     /// Set phi id of the cell in the readout segmentation
 95     inline void SetPhiId(G4int aPhi) { fPhiId = aPhi; }
 96     /// Get phi id of the cell in the readout segmentation
 97     inline G4int GetPhiId() const { return fPhiId; }
 98     /// Set time
 99     inline void SetTime(G4double aTime) { fTime = aTime; }
100     /// Get time
101     inline G4double GetTime() const { return fTime; }
102     /// Set type (0 = full sim, 1 = fast sim)
103     inline void SetType(G4int aType) { fType = aType; }
104     /// Get type (0 = full sim, 1 = fast sim)
105     inline G4int GetType() const { return fType; }
106     // Set pointer to cell logical volume
107     inline void SetLogV(G4LogicalVolume* aLogVol) { fLogVol = aLogVol; }
108     // Get pointer to cell logical volume
109     inline const G4LogicalVolume* GetLogVol() { return fLogVol; }
110 
111   public:
112     /// Energy deposit
113     G4double fEdep = 0;
114     /// Z ID of readout cell
115     G4int fZId = -1;
116     /// Rho ID of readout cell
117     G4int fRhoId = -1;
118     /// Phi ID of readout cell
119     G4int fPhiId = -1;
120     /// Position
121     G4ThreeVector fPos;
122     /// Rotation
123     G4RotationMatrix fRot;
124     /// Time
125     G4double fTime = -1;
126     /// Type: 0 = full sim, 1 = fast sim
127     G4int fType = -1;
128     /// Pointer to logical volume for visualisation
129     G4LogicalVolume* fLogVol = nullptr;
130 };
131 
132 typedef G4THitsCollection<Par03Hit> Par03HitsCollection;
133 
134 extern G4ThreadLocal G4Allocator<Par03Hit>* Par03HitAllocator;
135 
136 inline void* Par03Hit::operator new(size_t)
137 {
138   if (!Par03HitAllocator) Par03HitAllocator = new G4Allocator<Par03Hit>;
139   return (void*)Par03HitAllocator->MallocSingle();
140 }
141 
142 inline void Par03Hit::operator delete(void* aHit)
143 {
144   Par03HitAllocator->FreeSingle((Par03Hit*)aHit);
145 }
146 
147 #endif /* PAR03HIT_HH */
148