Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-29 07:50:55

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