Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-14 08:13:04

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 // Author: Christian Velten (2025)
0028 
0029 #ifndef G4MoleculeReactionCounter_hh
0030 #define G4MoleculeReactionCounter_hh 1
0031 
0032 #include "G4DNAMolecularReactionTable.hh"
0033 #include "G4VUserMoleculeReactionCounter.hh"
0034 
0035 //------------------------------------------------------------------------------
0036 
0037 struct G4MoleculeReactionCounterIndex : public G4VMoleculeReactionCounter::G4VMoleculeReactionCounterIndex
0038 {
0039     const G4DNAMolecularReactionData* ReactionData;
0040 
0041     G4MoleculeReactionCounterIndex() : ReactionData(nullptr) {}
0042     explicit G4MoleculeReactionCounterIndex(const G4DNAMolecularReactionData* reaction) : ReactionData(reaction) {}
0043     ~G4MoleculeReactionCounterIndex() override = default;
0044 
0045     G4bool operator<(G4VMoleculeReactionCounterIndex const& other) const override
0046     {
0047       return std::less{}(ReactionData, static_cast<const G4MoleculeReactionCounterIndex&>(other).ReactionData);
0048     }
0049     G4bool operator==(G4VMoleculeReactionCounterIndex const& other) const override
0050     {
0051       return std::equal_to{}(ReactionData, static_cast<const G4MoleculeReactionCounterIndex&>(other).ReactionData);
0052     }
0053     G4String FormattedReactionString(const G4DNAMolecularReactionData* reactionData) const;
0054 
0055     G4String GetInfo() const override
0056     {
0057       G4String null = "This reaction data is null";
0058       if (ReactionData == nullptr)
0059         return null;
0060       else
0061         return FormattedReactionString(ReactionData);
0062     }
0063     const G4DNAMolecularReactionData* GetReactionData() const override { return ReactionData; }
0064 };
0065 
0066 class G4MoleculeReactionCounter : public G4VUserMoleculeReactionCounter<G4MoleculeReactionCounterIndex>
0067 {
0068     //----------------------------------------------------------------------------
0069   public:
0070     G4MoleculeReactionCounter();
0071     G4MoleculeReactionCounter(G4String);
0072     ~G4MoleculeReactionCounter() override = default;
0073 
0074     void InitializeUser() override;
0075 
0076   public:
0077     std::unique_ptr<G4VMoleculeReactionCounterIndex> BuildSimpleIndex(const G4DNAMolecularReactionData*) const override;
0078 };
0079 
0080 #endif  // G4MoleculeReactionCounter_hh