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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef BDSMULTISENSITIVEDETECTORORDERED_H
19#define BDSMULTISENSITIVEDETECTORORDERED_H
20
21#include "BDSSensitiveDetector.hh"
22
23#include "G4String.hh"
24#include "G4Types.hh"
25#include "G4VSensitiveDetector.hh"
26
27#include <vector>
28
39class BDSMultiSensitiveDetectorOrdered: public G4VSensitiveDetector
40{
41public:
42 BDSMultiSensitiveDetectorOrdered(const G4String& name);
43
45
48
49 virtual void Initialize(G4HCofThisEvent* /*HCE*/) {;}
50 virtual void EndOfEvent(G4HCofThisEvent* /*HEC*/) {;}
51 virtual void clear();
52 virtual void DrawAll();
53 virtual void PrintAll();
54 virtual G4VSensitiveDetector* Clone() const;
55
56 using sds_t = std::vector<BDSSensitiveDetector*>;
57 using sdsConstIter = sds_t::const_iterator;
58 BDSSensitiveDetector* GetSD(const int i) const {return sensitiveDetectors[i];}
59 sds_t::size_type GetSize() const {return sensitiveDetectors.size();}
60 sdsConstIter GetBegin() const {return sensitiveDetectors.begin();}
61 sdsConstIter GetEnd() const {return sensitiveDetectors.end();}
62 void ClearSDs() {sensitiveDetectors.clear();}
63 void AddSD(BDSSensitiveDetector* sd) {sensitiveDetectors.push_back(sd);}
64
65protected:
66 virtual G4bool ProcessHits(G4Step* step,
67 G4TouchableHistory* rOHist);
68
70 virtual G4int GetCollectionID(G4int /*i*/) final {return -1;}
71
72private:
73 sds_t sensitiveDetectors;
74};
75
76#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.