Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:11

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 // --------------------------------------------------------------
0026 //
0027 
0028 #ifndef SensitiveDetectorHit_h
0029 #define SensitiveDetectorHit_h 1
0030 
0031 #include "G4Allocator.hh"
0032 #include "G4LogicalVolume.hh"
0033 #include "G4RotationMatrix.hh"
0034 #include "G4THitsCollection.hh"
0035 #include "G4ThreeVector.hh"
0036 #include "G4Transform3D.hh"
0037 #include "G4VHit.hh"
0038 
0039 class G4AttDef;
0040 class G4AttValue;
0041 
0042 class SensitiveDetectorHit : public G4VHit
0043 {
0044   public:
0045     SensitiveDetectorHit();
0046     SensitiveDetectorHit(G4int z);
0047     virtual ~SensitiveDetectorHit();
0048     SensitiveDetectorHit(const SensitiveDetectorHit& right);
0049     const SensitiveDetectorHit& operator=(const SensitiveDetectorHit& right);
0050     G4bool operator==(const SensitiveDetectorHit& right) const;
0051 
0052     inline void* operator new(size_t);
0053     inline void operator delete(void* aHit);
0054 
0055     virtual void Draw();
0056     virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
0057     virtual std::vector<G4AttValue>* CreateAttValues() const;
0058     virtual void Print();
0059 
0060   private:
0061     G4int fLayerID;
0062     G4ThreeVector fWorldPos;
0063 
0064   public:
0065     inline void SetLayerID(G4int z) { fLayerID = z; }
0066     inline G4int GetLayerID() const { return fLayerID; }
0067     inline void SetWorldPos(G4ThreeVector xyz) { fWorldPos = xyz; }
0068     inline G4ThreeVector GetWorldPos() const { return fWorldPos; }
0069 };
0070 
0071 typedef G4THitsCollection<SensitiveDetectorHit> SensitiveDetectorHitsCollection;
0072 
0073 #ifdef G4MULTITHREADED
0074 extern G4ThreadLocal G4Allocator<SensitiveDetectorHit>* SensitiveDetectorHitAllocator;
0075 #else
0076 extern G4Allocator<SensitiveDetectorHit> SensitiveDetectorHitAllocator;
0077 #endif
0078 
0079 inline void* SensitiveDetectorHit::operator new(size_t)
0080 {
0081 #ifdef G4MULTITHREADED
0082   if (!SensitiveDetectorHitAllocator)
0083     SensitiveDetectorHitAllocator = new G4Allocator<SensitiveDetectorHit>;
0084   return (void*)SensitiveDetectorHitAllocator->MallocSingle();
0085 #else
0086   void* aHit;
0087   aHit = (void*)SensitiveDetectorHitAllocator.MallocSingle();
0088   return aHit;
0089 #endif
0090 }
0091 
0092 inline void SensitiveDetectorHit::operator delete(void* aHit)
0093 {
0094 #ifdef G4MULTITHREADED
0095   SensitiveDetectorHitAllocator->FreeSingle((SensitiveDetectorHit*)aHit);
0096 #else
0097   SensitiveDetectorHitAllocator.FreeSingle((SensitiveDetectorHit*)aHit);
0098 #endif
0099 }
0100 
0101 #endif