Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:53

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 B5/include/EmCalorimeterHit.hh
0028 /// \brief Definition of the B5::EmCalorimeterHit class
0029 
0030 #ifndef B5EmCalorimeterHit_h
0031 #define B5EmCalorimeterHit_h 1
0032 
0033 #include "G4VHit.hh"
0034 
0035 #include "G4Allocator.hh"
0036 #include "G4RotationMatrix.hh"
0037 #include "G4THitsCollection.hh"
0038 #include "G4ThreeVector.hh"
0039 #include "globals.hh"
0040 
0041 class G4AttDef;
0042 class G4AttValue;
0043 class G4LogicalVolume;
0044 
0045 namespace B5
0046 {
0047 
0048 /// EM Calorimeter hit
0049 ///
0050 /// It records:
0051 /// - the cell ID
0052 /// - the energy deposit
0053 /// - the cell logical volume, its position and rotation
0054 
0055 class EmCalorimeterHit : public G4VHit
0056 {
0057   public:
0058     EmCalorimeterHit() = default;
0059     EmCalorimeterHit(G4int cellID);
0060     EmCalorimeterHit(const EmCalorimeterHit& right) = default;
0061     ~EmCalorimeterHit() override = default;
0062 
0063     EmCalorimeterHit& operator=(const EmCalorimeterHit& right) = default;
0064     G4bool operator==(const EmCalorimeterHit& right) const;
0065 
0066     inline void* operator new(size_t);
0067     inline void operator delete(void* aHit);
0068 
0069     void Draw() override;
0070     const std::map<G4String, G4AttDef>* GetAttDefs() const override;
0071     std::vector<G4AttValue>* CreateAttValues() const override;
0072     void Print() override;
0073 
0074     void SetCellID(G4int z) { fCellID = z; }
0075     G4int GetCellID() const { return fCellID; }
0076 
0077     void SetEdep(G4double de) { fEdep = de; }
0078     void AddEdep(G4double de) { fEdep += de; }
0079     G4double GetEdep() const { return fEdep; }
0080 
0081     void SetPos(G4ThreeVector xyz) { fPos = xyz; }
0082     G4ThreeVector GetPos() const { return fPos; }
0083 
0084     void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
0085     G4RotationMatrix GetRot() const { return fRot; }
0086 
0087     void SetLogV(G4LogicalVolume* val) { fPLogV = val; }
0088     const G4LogicalVolume* GetLogV() const { return fPLogV; }
0089 
0090   private:
0091     G4int fCellID = -1;
0092     G4double fEdep = 0.;
0093     G4ThreeVector fPos;
0094     G4RotationMatrix fRot;
0095     const G4LogicalVolume* fPLogV = nullptr;
0096 };
0097 
0098 using EmCalorimeterHitsCollection = G4THitsCollection<EmCalorimeterHit>;
0099 
0100 extern G4ThreadLocal G4Allocator<EmCalorimeterHit>* EmCalorimeterHitAllocator;
0101 
0102 inline void* EmCalorimeterHit::operator new(size_t)
0103 {
0104   if (!EmCalorimeterHitAllocator) {
0105     EmCalorimeterHitAllocator = new G4Allocator<EmCalorimeterHit>;
0106   }
0107   return (void*)EmCalorimeterHitAllocator->MallocSingle();
0108 }
0109 
0110 inline void EmCalorimeterHit::operator delete(void* aHit)
0111 {
0112   EmCalorimeterHitAllocator->FreeSingle((EmCalorimeterHit*)aHit);
0113 }
0114 
0115 }  // namespace B5
0116 
0117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0118 
0119 #endif