ATLAS Offline Software
Loading...
Searching...
No Matches
AFP_TDSensitiveDetector.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef AFP_G4_SD_AFP_TDSensitiveDetector_h
6#define AFP_G4_SD_AFP_TDSensitiveDetector_h
7
8// Base class
9#include "G4VSensitiveDetector.hh"
10
11// use of the hits
13#include <gtest/gtest_prod.h>
14
15// STL header
16#include <string>
17#include <utility>
18
19class G4Step;
20class G4TouchableHistory;
21
22class AFP_TDSensitiveDetector : public G4VSensitiveDetector
23{
24 FRIEND_TEST( AFP_TDSensitiveDetectortest, ProcessHits );
25 FRIEND_TEST( AFP_TDSensitiveDetectortest, AddHit );
26
27public:
28 // Constructor
29 AFP_TDSensitiveDetector(const std::string& name, const std::string& hitCollectionName);
30
31 // Destructor
32 ~AFP_TDSensitiveDetector() { /* I don't own myHitColl if all has gone well */ }
33
34 // Called from G4 at the start of each G4 event
35 void Initialize(G4HCofThisEvent *) override final;
36 G4bool ProcessHits(G4Step*, G4TouchableHistory*) override final;
37
41 template <class... Args> void AddHit(Args&&... args)
42 {
43 if (m_HitColl) {
44 m_HitColl->Emplace(std::forward<Args>(args)...);
45 }
46 }
47
48 static constexpr double TDMaxQEff = 0.15;
49
50private:
52
54 // The hits collection
56 // Non-owning cache set by Initialize; HitCollectionMap owns the collection.
58};
59
60#endif //AFP_G4_SD_AFP_TDSensitiveDetector_h
AFP_TDSimHitCollectionBuilder * m_HitColl
AFP_TDSimHitCollectionBuilder * getHitCollection() const
FRIEND_TEST(AFP_TDSensitiveDetectortest, AddHit)
G4bool ProcessHits(G4Step *, G4TouchableHistory *) override final
static constexpr double TDMaxQEff
AFP_TDSensitiveDetector(const std::string &name, const std::string &hitCollectionName)
void Initialize(G4HCofThisEvent *) override final
void AddHit(Args &&... args)
Templated method to stuff a single hit into the sensitive detector class.
FRIEND_TEST(AFP_TDSensitiveDetectortest, ProcessHits)