Back to home page

EIC code displayed by LXR

 
 

    


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

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  * G4ManyFastLists.icc
0028  *
0029  *  Created on: 17 nov. 2014
0030  *      Author: kara
0031  */
0032 
0033 #ifndef G4MANYFASTLISTS_ICC_
0034 #define G4MANYFASTLISTS_ICC_
0035 
0036 //____________________________________________________________
0037 //
0038 //                      G4TrackManyLists
0039 //____________________________________________________________
0040 template<class OBJECT>
0041   void G4ManyFastLists<OBJECT>::pop(OBJECT* __track)
0042   {
0043     // Ver 1
0044     G4FastList<OBJECT>::Pop(__track);
0045 //  G4FastListNode* __trackListNode = G4FastList<OBJECT>::GetNode(__track);
0046 //  G4FastList<OBJECT>* __trackList = G4FastList<OBJECT>::GetTrackList(__trackListNode);
0047 //  if(__trackList) __trackList->pop(__trackListNode);
0048 
0049 //Ver 2
0050 //  G4FastList<OBJECT>* __list = G4FastList<OBJECT>::GetTrackList(track);
0051 //  if(__list) __list->pop(track);
0052 
0053 // Ver 3
0054 //  G4FastListNode* __node = GetIT(track)->GetTrackListNode();
0055 //  __node->fListRef->fpTrackList->pop(track);
0056   }
0057 
0058 template<class OBJECT>
0059   G4ManyFastLists_iterator<OBJECT> G4ManyFastLists_iterator<OBJECT>::UpdateToNextValidList()
0060   {
0061 
0062 //    G4cout << "G4TrackManyList_iterator::UpdateToNextValidList" << G4endl;
0063 
0064     if (fCurrentListIt == fLists->end()) // check validity
0065     {
0066       HasReachedEnd();
0067       return *this;
0068     }
0069 
0070     fIterator = (*fCurrentListIt)->end();
0071     fCurrentListIt++;
0072 
0073     if (fCurrentListIt == fLists->end()) // check validity
0074     {
0075       HasReachedEnd();
0076       return *this;
0077     }
0078 
0079     fIterator = (*fCurrentListIt)->begin();
0080 
0081     while (fCurrentListIt != fLists->end()
0082         &&
0083 //        (
0084             fIterator == (*fCurrentListIt)->end()
0085 //            || (*fCurrentListIt)->empty()
0086 //            || fIterator.GetNode() == 0 || fIterator.GetNode()->GetObject() == 0)
0087 
0088     )
0089     {
0090 //      G4cout << "while" << G4endl;
0091       fIterator = (*fCurrentListIt)->end();
0092       fCurrentListIt++;
0093       if (fCurrentListIt == fLists->end())
0094       {
0095 //        G4cout << "return here" << G4endl;
0096         HasReachedEnd();
0097         return *this;
0098       }
0099       fIterator = (*fCurrentListIt)->begin();
0100     }
0101 
0102     if (fCurrentListIt == fLists->end())
0103     {
0104       HasReachedEnd();
0105     }
0106 
0107 //    assert(fIterator.GetNode());
0108 //    assert(fIterator.GetNode()->GetObject());
0109 
0110     return *this;
0111   }
0112 
0113 template<class OBJECT>
0114   G4ManyFastLists_iterator<OBJECT>&
0115   G4ManyFastLists_iterator<OBJECT>::operator++()
0116   {
0117     if (fCurrentListIt == fLists->end())
0118     {
0119       HasReachedEnd();
0120       return *this;
0121     }
0122 
0123     fIterator++;
0124 
0125     if (fIterator == (*fCurrentListIt)->end())
0126     {
0127       UpdateToNextValidList();
0128     }
0129 
0130     return *this;
0131   }
0132 
0133 #endif /* G4MANYFASTLISTS_ICC_ */