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