Back to home page

EIC code displayed by LXR

 
 

    


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

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 runAndEvent/RE01/include/RE01CalorimeterHit.hh
0027 /// \brief Definition of the RE01CalorimeterHit class
0028 //
0029 //
0030 
0031 #ifndef RE01CalorimeterHit_h
0032 #define RE01CalorimeterHit_h 1
0033 
0034 #include "RE01TrackInformation.hh"
0035 
0036 #include "G4Allocator.hh"
0037 #include "G4LogicalVolume.hh"
0038 #include "G4RotationMatrix.hh"
0039 #include "G4THitsCollection.hh"
0040 #include "G4ThreeVector.hh"
0041 #include "G4Transform3D.hh"
0042 #include "G4Types.hh"
0043 #include "G4VHit.hh"
0044 
0045 class G4AttDef;
0046 class G4AttValue;
0047 
0048 class RE01CalorimeterHit : public G4VHit
0049 {
0050   public:
0051     RE01CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi);
0052     virtual ~RE01CalorimeterHit();
0053 
0054     inline void* operator new(size_t);
0055     inline void operator delete(void* aHit);
0056 
0057     virtual void Draw();
0058     virtual void Print();
0059     virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
0060     virtual std::vector<G4AttValue>* CreateAttValues() const;
0061 
0062     inline G4int GetZ() { return fZCellID; }
0063     inline G4int GetPhi() { return fPhiCellID; }
0064     inline void SetEdep(G4double de)
0065     {
0066       fEdep = de;
0067       fEdepByATrack = de;
0068     }
0069     inline void AddEdep(G4double de)
0070     {
0071       fEdep += de;
0072       fEdepByATrack += de;
0073     }
0074     inline G4double GetEdep() { return fEdep; }
0075     inline G4double GetEdepByATrack() { return fEdepByATrack; }
0076     inline void ClearEdepByATrack()
0077     {
0078       fEdepByATrack = 0.;
0079       fTrackInfo = RE01TrackInformation();
0080     }
0081     inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
0082     inline void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
0083     inline void SetTrackInformation(const G4Track* aTrack)
0084     {
0085       RE01TrackInformation* anInfo = (RE01TrackInformation*)(aTrack->GetUserInformation());
0086       fTrackInfo = *anInfo;
0087     }
0088     inline RE01TrackInformation* GetTrackInformation() { return &fTrackInfo; }
0089 
0090   private:
0091     G4int fZCellID;
0092     G4int fPhiCellID;
0093     G4double fEdep;
0094     G4ThreeVector fPos;
0095     G4RotationMatrix fRot;
0096     const G4LogicalVolume* fPLogV;
0097     G4double fEdepByATrack;
0098     RE01TrackInformation fTrackInfo;
0099 };
0100 
0101 typedef G4THitsCollection<RE01CalorimeterHit> RE01CalorimeterHitsCollection;
0102 
0103 extern G4ThreadLocal G4Allocator<RE01CalorimeterHit>* RE01CalorimeterHitAllocator;
0104 
0105 inline void* RE01CalorimeterHit::operator new(size_t)
0106 {
0107   if (!RE01CalorimeterHitAllocator)
0108     RE01CalorimeterHitAllocator = new G4Allocator<RE01CalorimeterHit>;
0109   return (void*)RE01CalorimeterHitAllocator->MallocSingle();
0110 }
0111 
0112 inline void RE01CalorimeterHit::operator delete(void* aHit)
0113 {
0114   RE01CalorimeterHitAllocator->FreeSingle((RE01CalorimeterHit*)aHit);
0115 }
0116 
0117 #endif