Back to home page

EIC code displayed by LXR

 
 

    


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

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 /// \file RE05/include/RE05CalorimeterHit.hh
0028 /// \brief Definition of the RE05CalorimeterHit class
0029 //
0030 
0031 #ifndef RE05CalorimeterHit_h
0032 #define RE05CalorimeterHit_h 1
0033 
0034 #include "G4Allocator.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4RotationMatrix.hh"
0037 #include "G4THitsCollection.hh"
0038 #include "G4ThreeVector.hh"
0039 #include "G4Transform3D.hh"
0040 #include "G4Types.hh"
0041 #include "G4VHit.hh"
0042 
0043 class G4AttDef;
0044 
0045 class RE05CalorimeterHit : public G4VHit
0046 {
0047   public:
0048     RE05CalorimeterHit();
0049     RE05CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi);
0050     virtual ~RE05CalorimeterHit();
0051     RE05CalorimeterHit(const RE05CalorimeterHit& right);
0052     const RE05CalorimeterHit& operator=(const RE05CalorimeterHit& right);
0053     G4bool operator==(const RE05CalorimeterHit& right) const;
0054 
0055     inline void* operator new(size_t);
0056     inline void operator delete(void* aHit);
0057 
0058     virtual void Draw();
0059     virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
0060     virtual std::vector<G4AttValue>* CreateAttValues() const;
0061     virtual void Print();
0062 
0063   private:
0064     G4int fZCellID;
0065     G4int fPhiCellID;
0066     G4double fEdep;
0067     G4ThreeVector fPos;
0068     G4RotationMatrix fRot;
0069     const G4LogicalVolume* fLogV;
0070     static std::map<G4String, G4AttDef> fAttDefs;
0071 
0072   public:
0073     inline void SetCellID(G4int z, G4int phi)
0074     {
0075       fZCellID = z;
0076       fPhiCellID = phi;
0077     }
0078     inline G4int GetZ() { return fZCellID; }
0079     inline G4int GetPhi() { return fPhiCellID; }
0080     inline void SetEdep(G4double de) { fEdep = de; }
0081     inline void AddEdep(G4double de) { fEdep += de; }
0082     inline G4double GetEdep() { return fEdep; }
0083     inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
0084     inline G4ThreeVector GetPos() { return fPos; }
0085     inline void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
0086     inline G4RotationMatrix GetRot() { return fRot; }
0087     inline const G4LogicalVolume* GetLogV() { return fLogV; }
0088 };
0089 
0090 typedef G4THitsCollection<RE05CalorimeterHit> RE05CalorimeterHitsCollection;
0091 
0092 extern G4ThreadLocal G4Allocator<RE05CalorimeterHit>* RE05CalorimeterHitAllocator;
0093 
0094 inline void* RE05CalorimeterHit::operator new(size_t)
0095 {
0096   if (!RE05CalorimeterHitAllocator)
0097     RE05CalorimeterHitAllocator = new G4Allocator<RE05CalorimeterHit>;
0098   return (void*)RE05CalorimeterHitAllocator->MallocSingle();
0099 }
0100 
0101 inline void RE05CalorimeterHit::operator delete(void* aHit)
0102 {
0103   RE05CalorimeterHitAllocator->FreeSingle((RE05CalorimeterHit*)aHit);
0104 }
0105 
0106 #endif