Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:32

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: Mathieu Karamitros
0028 
0029 // The code is developed in the framework of the ESA AO7146
0030 //
0031 // We would be very happy hearing from you, send us your feedback! :)
0032 //
0033 // In order for Geant4-DNA to be maintained and still open-source,
0034 // article citations are crucial. 
0035 // If you use Geant4-DNA chemistry and you publish papers about your software, 
0036 // in addition to the general paper on Geant4-DNA:
0037 //
0038 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
0039 //
0040 // we would be very happy if you could please also cite the following
0041 // reference papers on chemistry:
0042 //
0043 // J. Comput. Phys. 274 (2014) 841-882
0044 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 
0045 
0046 #ifndef G4ITBox_h
0047 #define G4ITBox_h
0048 
0049 #include "G4IT.hh"
0050 
0051 /**
0052  * G4ITBox behaves just like a stack for G4IT.
0053  * You can search for specific tracks.
0054  * Each G4IT knows to which G4ITBox it belongs and its corresponding node.
0055  * This makes the deletion of an element very fast.
0056  * The drawback is that a G4IT can only belong to one G4ITBox.
0057  * If you are not looking for this feature, please use std::list.
0058  */
0059 
0060 class G4ITBox
0061 {
0062 
0063 public:
0064   G4ITBox();
0065   ~G4ITBox();
0066 
0067   void ResetStack();
0068   void Push(G4IT*);
0069   void Extract(G4IT*);
0070 
0071   /** The FindIT methods are used for check only.
0072    * Those methods are not effective due to the
0073    * linear search. It is better to use GetIT(track)
0074    * in order to retrieve the IT and GetIT(track)->GetBox()
0075    * in order to check which is the box pointer.
0076    */
0077   G4IT* FindIT(const G4Track&);
0078   const G4IT* FindIT(const G4Track&) const;
0079   void TransferTo(G4ITBox*);
0080 
0081   inline G4bool Empty() const;
0082   inline G4int GetNTrack() const;
0083 
0084   inline G4IT* GetFirstIT();
0085   inline G4IT* GetLastIT();
0086   inline const G4IT* GetFirstIT() const;
0087   inline const G4IT* GetLastIT() const;
0088 
0089   inline void SetNextBox(G4ITBox* box);
0090   inline G4ITBox* GetNextBox();
0091   inline const G4ITBox* GetNextBox() const;
0092   inline void SetPreviousBox(G4ITBox* box);
0093   inline G4ITBox* GetPreviousBox();
0094   inline const G4ITBox* GetPreviousBox() const;
0095 
0096 private:
0097   const G4ITBox & operator=(const G4ITBox &right);
0098   G4int fNbIT{0};
0099   G4IT * fpFirstIT{nullptr};
0100   G4IT * fpLastIT{nullptr};
0101 
0102   G4ITBox* fpPreviousBox{nullptr};
0103   G4ITBox* fpNextBox{nullptr};
0104 };
0105 
0106 inline G4bool G4ITBox::Empty() const
0107 {
0108   return (fNbIT <= 0);
0109 }
0110 
0111 inline G4int G4ITBox::GetNTrack() const
0112 {
0113   return fNbIT;
0114 }
0115 inline G4IT* G4ITBox::GetFirstIT()
0116 {
0117   return fpFirstIT;
0118 }
0119 inline G4IT* G4ITBox::GetLastIT()
0120 {
0121   return fpLastIT;
0122 }
0123 
0124 inline const G4IT* G4ITBox::GetFirstIT() const
0125 {
0126   return fpFirstIT;
0127 }
0128 inline const G4IT* G4ITBox::GetLastIT() const
0129 {
0130   return fpLastIT;
0131 }
0132 
0133 inline void G4ITBox::SetNextBox(G4ITBox* box)
0134 {
0135   fpNextBox = box;
0136 }
0137 
0138 inline G4ITBox* G4ITBox::GetNextBox()
0139 {
0140   return fpNextBox;
0141 }
0142 
0143 inline void G4ITBox::SetPreviousBox(G4ITBox* box)
0144 {
0145   fpPreviousBox = box;
0146 }
0147 
0148 inline G4ITBox* G4ITBox::GetPreviousBox()
0149 {
0150   return fpPreviousBox;
0151 }
0152 
0153 #endif