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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 ]

Diff markup

Differences between /examples/extended/parameterisations/Par04/include/Par04Hit.hh (Version 11.3.0) and /examples/extended/parameterisations/Par04/include/Par04Hit.hh (Version 11.0.p2)


  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 #ifndef PAR04HIT_HH                                26 #ifndef PAR04HIT_HH
 27 #define PAR04HIT_HH                                27 #define PAR04HIT_HH
 28                                                    28 
 29 #include "G4Allocator.hh"  // for G4Allocator  <<  29 #include <stddef.h>                      // for size_t
 30 #include "G4RotationMatrix.hh"  // for G4Rotat <<  30 #include <G4Types.hh>                    // for G4int, G4double
 31 #include "G4THitsCollection.hh"  // for G4THit <<  31 #include <map>                           // for map
 32 #include "G4ThreeVector.hh"  // for G4ThreeVec <<  32 #include <tls.hh>                        // for G4ThreadLocal
 33 #include "G4VHit.hh"  // for G4VHit            <<  33 #include <vector>                        // for vector
 34                                                <<  34 #include "G4Allocator.hh"                // for G4Allocator
 35 #include <G4Types.hh>  // for G4int, G4double  <<  35 #include "G4RotationMatrix.hh"           // for G4RotationMatrix
 36 #include <map>  // for map                     <<  36 #include "G4THitsCollection.hh"          // for G4THitsCollection
 37 #include <stddef.h>  // for size_t             <<  37 #include "G4ThreeVector.hh"              // for G4ThreeVector
 38 #include <tls.hh>  // for G4ThreadLocal        <<  38 #include "G4VHit.hh"                     // for G4VHit
 39 #include <vector>  // for vector               << 
 40 class G4AttDef;                                    39 class G4AttDef;
 41 class G4AttValue;                                  40 class G4AttValue;
 42 class G4LogicalVolume;                             41 class G4LogicalVolume;
 43 class G4String;                                    42 class G4String;
 44                                                    43 
 45 /**                                                44 /**
 46  * @brief Hit class to store energy deposited      45  * @brief Hit class to store energy deposited in the sensitive detector.
 47  *                                                 46  *
 48  * Hit class registers position and energy dep     47  * Hit class registers position and energy deposited within the sensitive
 49  * detector. Cell ID is stored using identifie     48  * detector. Cell ID is stored using identifiers of readout segmentation (z,
 50  * phi, rho). Additionally, pointer to cell lo     49  * phi, rho). Additionally, pointer to cell logical volume, its position and
 51  * rotation are saved for visualisation purpos     50  * rotation are saved for visualisation purposes. Time allows to filter hits in
 52  * visualisation. Type of hit allows to distin     51  * visualisation. Type of hit allows to distinguish between hits originating
 53  * from full simulation (type 0) and fast simu     52  * from full simulation (type 0) and fast simulation (type 1).
 54  *                                                 53  *
 55  */                                                54  */
 56                                                    55 
 57 class Par04Hit : public G4VHit                     56 class Par04Hit : public G4VHit
 58 {                                                  57 {
 59   public:                                      <<  58  public:
 60     Par04Hit();                                <<  59   Par04Hit();
 61     Par04Hit(const Par04Hit& aRight);          <<  60   Par04Hit(const Par04Hit& aRight);
 62     virtual ~Par04Hit();                       <<  61   virtual ~Par04Hit();
 63                                                <<  62 
 64     const Par04Hit& operator=(const Par04Hit&  <<  63   const Par04Hit& operator=(const Par04Hit& aRight);
 65     int operator==(const Par04Hit& aRight) con <<  64   int operator==(const Par04Hit& aRight) const;
 66                                                <<  65 
 67     inline void* operator new(size_t);         <<  66   inline void* operator new(size_t);
 68     inline void operator delete(void* aHit);   <<  67   inline void operator delete(void* aHit);
 69     /// Visualise hits. If pointer to the logi <<  68   /// Visualise hits. If pointer to the logical volume was set, cell shape is
 70     /// drawn taking into account proper radia <<  69   /// drawn taking into account proper radial position (taken from fRhoId)
 71     virtual void Draw() final;                 <<  70   virtual void Draw() final;
 72     /// Retrieve atributes' names in order to  <<  71   /// Retrieve atributes' names in order to allow filtering
 73     virtual const std::map<G4String, G4AttDef> <<  72   virtual const std::map<G4String, G4AttDef>* GetAttDefs() const final;
 74     /// Create attributes for the visualisatio <<  73   /// Create attributes for the visualisation.
 75     virtual std::vector<G4AttValue>* CreateAtt <<  74   virtual std::vector<G4AttValue>* CreateAttValues() const final;
 76     /// Print hit properties.                  <<  75   /// Print hit properties.
 77     virtual void Print() final;                <<  76   virtual void Print() final;
 78     /// Set position                           <<  77   /// Set position
 79     inline void SetPos(G4ThreeVector aXYZ) { f <<  78   inline void SetPos(G4ThreeVector aXYZ) { fPos = aXYZ; }
 80     /// Get position                           <<  79   /// Get position
 81     inline G4ThreeVector GetPos() const { retu <<  80   inline G4ThreeVector GetPos() const { return fPos; }
 82     /// Set rotation                           <<  81   /// Set rotation
 83     inline void SetRot(G4RotationMatrix aXYZ)  <<  82   inline void SetRot(G4RotationMatrix aXYZ) { fRot = aXYZ; }
 84     /// Get rotation                           <<  83   /// Get rotation
 85     inline G4RotationMatrix GetRot() const { r <<  84   inline G4RotationMatrix GetRot() const { return fRot; }
 86     /// Set energy                             <<  85   /// Set energy
 87     inline void SetEdep(G4double aEdep) { fEde <<  86   inline void SetEdep(G4double aEdep) { fEdep = aEdep; }
 88     /// Add energy to previous value           <<  87   /// Add energy to previous value
 89     inline void AddEdep(G4double aEdep) { fEde <<  88   inline void AddEdep(G4double aEdep) { fEdep += aEdep; }
 90     /// Get energy                             <<  89   /// Get energy
 91     inline G4double GetEdep() const { return f <<  90   inline G4double GetEdep() const { return fEdep; }
 92     /// Set number of deposits per hit/cell    <<  91   /// Set Z id of the cell in the readout segmentation
 93     inline void SetNdep(G4int aNdep) { fNdep = <<  92   inline void SetZid(G4int aZ) { fZId = aZ; }
 94     /// Add number of deposits to previous val <<  93   /// Get Z id of the cell in the readout segmentation
 95     inline void AddNdep(G4int aNdep = 1) { fNd <<  94   inline G4int GetZid() const { return fZId; }
 96     /// Get number of deposits per hit/cell    <<  95   /// Set Rho id of the cell in the readout segmentation
 97     inline G4int GetNdep() const { return fNde <<  96   inline void SetRhoId(G4int aRho) { fRhoId = aRho; }
 98     /// Set Z id of the cell in the readout se <<  97   /// Get rho id of the cell in the readout segmentation
 99     inline void SetZid(G4int aZ) { fZId = aZ;  <<  98   inline G4int GetRhoId() const { return fRhoId; }
100     /// Get Z id of the cell in the readout se <<  99   /// Set phi id of the cell in the readout segmentation
101     inline G4int GetZid() const { return fZId; << 100   inline void SetPhiId(G4int aPhi) { fPhiId = aPhi; }
102     /// Set Rho id of the cell in the readout  << 101   /// Get phi id of the cell in the readout segmentation
103     inline void SetRhoId(G4int aRho) { fRhoId  << 102   inline G4int GetPhiId() const { return fPhiId; }
104     /// Get rho id of the cell in the readout  << 103   /// Set time
105     inline G4int GetRhoId() const { return fRh << 104   inline void SetTime(G4double aTime) { fTime = aTime; }
106     /// Set phi id of the cell in the readout  << 105   /// Get time
107     inline void SetPhiId(G4int aPhi) { fPhiId  << 106   inline G4double GetTime() const { return fTime; }
108     /// Get phi id of the cell in the readout  << 107   /// Set type (0 = full sim, 1 = fast sim)
109     inline G4int GetPhiId() const { return fPh << 108   inline void SetType(G4int aType) { fType = aType; }
110     /// Set time                               << 109   /// Get type (0 = full sim, 1 = fast sim)
111     inline void SetTime(G4double aTime) { fTim << 110   inline G4int GetType() const { return fType; }
112     /// Get time                               << 111   // Set pointer to cell logical volume
113     inline G4double GetTime() const { return f << 112   inline void SetLogV(G4LogicalVolume* aLogVol) { fLogVol = aLogVol; }
114     /// Set type (0 = full sim, 1 = fast sim)  << 113   // Get pointer to cell logical volume
115     inline void SetType(G4int aType) { fType = << 114   inline const G4LogicalVolume* GetLogVol() { return fLogVol; }
116     /// Get type (0 = full sim, 1 = fast sim)  << 115 
117     inline G4int GetType() const { return fTyp << 116  public:
118     // Set pointer to cell logical volume      << 117   /// Energy deposit
119     inline void SetLogV(G4LogicalVolume* aLogV << 118   G4double fEdep = 0;
120     // Get pointer to cell logical volume      << 119   /// Z ID of readout cell
121     inline const G4LogicalVolume* GetLogVol()  << 120   G4int fZId = -1;
122                                                << 121   /// Rho ID of readout cell
123   public:                                      << 122   G4int fRhoId = -1;
124     /// Energy deposit                         << 123   /// Phi ID of readout cell
125     G4double fEdep = 0;                        << 124   G4int fPhiId = -1;
126     /// Counter of deposits in a hit/cell      << 125   /// Position
127     G4int fNdep = 0;                           << 126   G4ThreeVector fPos = { -1, -1, -1 };
128     /// Z ID of readout cell                   << 127   /// Rotation
129     G4int fZId = -1;                           << 128   G4RotationMatrix fRot;
130     /// Rho ID of readout cell                 << 129   /// Time
131     G4int fRhoId = -1;                         << 130   G4double fTime = -1;
132     /// Phi ID of readout cell                 << 131   /// Type: 0 = full sim, 1 = fast sim
133     G4int fPhiId = -1;                         << 132   G4int fType = -1;
134     /// Position                               << 133   /// Pointer to logical volume for visualisation
135     G4ThreeVector fPos = {-1, -1, -1};         << 134   G4LogicalVolume* fLogVol = nullptr;
136     /// Rotation                               << 
137     G4RotationMatrix fRot;                     << 
138     /// Time                                   << 
139     G4double fTime = -1;                       << 
140     /// Type: 0 = full sim, 1 = fast sim       << 
141     G4int fType = -1;                          << 
142     /// Pointer to logical volume for visualis << 
143     G4LogicalVolume* fLogVol = nullptr;        << 
144 };                                                135 };
145                                                   136 
146 typedef G4THitsCollection<Par04Hit> Par04HitsC    137 typedef G4THitsCollection<Par04Hit> Par04HitsCollection;
147                                                   138 
148 extern G4ThreadLocal G4Allocator<Par04Hit>* Pa    139 extern G4ThreadLocal G4Allocator<Par04Hit>* Par04HitAllocator;
149                                                   140 
150 inline void* Par04Hit::operator new(size_t)       141 inline void* Par04Hit::operator new(size_t)
151 {                                                 142 {
152   if (!Par04HitAllocator) Par04HitAllocator =  << 143   if(!Par04HitAllocator)
153   return (void*)Par04HitAllocator->MallocSingl << 144     Par04HitAllocator = new G4Allocator<Par04Hit>;
                                                   >> 145   return (void*) Par04HitAllocator->MallocSingle();
154 }                                                 146 }
155                                                   147 
156 inline void Par04Hit::operator delete(void* aH    148 inline void Par04Hit::operator delete(void* aHit)
157 {                                                 149 {
158   Par04HitAllocator->FreeSingle((Par04Hit*)aHi << 150   Par04HitAllocator->FreeSingle((Par04Hit*) aHit);
159 }                                                 151 }
160                                                   152 
161 #endif /* PAR04HIT_HH */                          153 #endif /* PAR04HIT_HH */
162                                                   154