Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:37

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 /// \file persistency/P01/include/ExP01TrackerHit.hh
0027 /// \brief Definition of the ExP01TrackerHit class
0028 //
0029 //
0030 //
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 
0034 #ifndef ExP01TrackerHit_h
0035 #define ExP01TrackerHit_h 1
0036 
0037 #include "G4Allocator.hh"
0038 #include "G4THitsCollection.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4VHit.hh"
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 /// Hit implementation for the persistency example
0045 
0046 class ExP01TrackerHit : public G4VHit
0047 {
0048   public:
0049     ExP01TrackerHit();
0050     ~ExP01TrackerHit();
0051     ExP01TrackerHit(const ExP01TrackerHit&);
0052     const ExP01TrackerHit& operator=(const ExP01TrackerHit&);
0053     G4bool operator==(const ExP01TrackerHit&) const;
0054 
0055     inline void* operator new(size_t);
0056     inline void operator delete(void*);
0057 
0058     virtual void Draw();
0059     virtual void Print();
0060 
0061   public:
0062     void SetTrackID(G4int track) { fTrackID = track; };
0063     void SetChamberNb(G4int chamb) { fChamberNb = chamb; };
0064     void SetEdep(G4double de) { fEdep = de; };
0065     void SetPos(G4ThreeVector xyz) { fPos = xyz; };
0066 
0067     G4int GetTrackID() { return fTrackID; };
0068     G4int GetChamberNb() { return fChamberNb; };
0069     G4double GetEdep() { return fEdep; };
0070     G4ThreeVector GetPos() { return fPos; };
0071 
0072   private:
0073     G4int fTrackID;
0074     G4int fChamberNb;
0075     G4double fEdep;
0076     G4ThreeVector fPos;
0077 };
0078 
0079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0080 
0081 using ExP01TrackerHitsCollection = G4THitsCollection<ExP01TrackerHit>;
0082 
0083 extern G4ThreadLocal G4Allocator<ExP01TrackerHit>* ExP01TrackerHitAllocator;
0084 
0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0086 
0087 inline void* ExP01TrackerHit::operator new(size_t)
0088 {
0089   if (!ExP01TrackerHitAllocator) {
0090     ExP01TrackerHitAllocator = new G4Allocator<ExP01TrackerHit>;
0091   }
0092   return (void*)ExP01TrackerHitAllocator->MallocSingle();
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0096 
0097 inline void ExP01TrackerHit::operator delete(void* aHit)
0098 {
0099   ExP01TrackerHitAllocator->FreeSingle((ExP01TrackerHit*)aHit);
0100 }
0101 
0102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0103 
0104 #endif