BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSMultiSensitiveDetectorOrdered.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSMULTISENSITIVEDETECTORORDERED_H
20#define BDSMULTISENSITIVEDETECTORORDERED_H
21
22#include "BDSSensitiveDetector.hh"
23
24#include "G4String.hh"
25#include "G4Types.hh"
26#include "G4VSensitiveDetector.hh"
27
28#include <vector>
29
40class BDSMultiSensitiveDetectorOrdered: public G4VSensitiveDetector
41{
42public:
43 BDSMultiSensitiveDetectorOrdered(const G4String& name);
44
46
49
50 virtual void Initialize(G4HCofThisEvent* /*HCE*/) {;}
51 virtual void EndOfEvent(G4HCofThisEvent* /*HEC*/) {;}
52 virtual void clear();
53 virtual void DrawAll();
54 virtual void PrintAll();
55 virtual G4VSensitiveDetector* Clone() const;
56
57 using sds_t = std::vector<BDSSensitiveDetector*>;
58 using sdsConstIter = sds_t::const_iterator;
59 BDSSensitiveDetector* GetSD(const int i) const {return sensitiveDetectors[i];}
60 sds_t::size_type GetSize() const {return sensitiveDetectors.size();}
61 sdsConstIter GetBegin() const {return sensitiveDetectors.begin();}
62 sdsConstIter GetEnd() const {return sensitiveDetectors.end();}
63 void ClearSDs() {sensitiveDetectors.clear();}
64 void AddSD(BDSSensitiveDetector* sd) {sensitiveDetectors.push_back(sd);}
65
66protected:
67 virtual G4bool ProcessHits(G4Step* step,
68 G4TouchableHistory* rOHist);
69
71 virtual G4int GetCollectionID(G4int /*i*/) final {return -1;}
72
73private:
74 sds_t sensitiveDetectors;
75};
76
77#endif
Modified G4MultiSensitiveDetector that retains order and passes hits in sequence.
virtual G4int GetCollectionID(G4int) final
The following method does not have a meaning for this concrete class.
Virtual class to define interface for ordered multi-sensitive detector.