Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Par04ParallelFastSensitiveDetector Class Reference

Sensitive detector. More...

#include <Par04ParallelFastSensitiveDetector.hh>

Inheritance diagram for Par04ParallelFastSensitiveDetector:
G4VSensitiveDetector G4VFastSimSensitiveDetector

Public Member Functions

 Par04ParallelFastSensitiveDetector (G4String aName)
 
 Par04ParallelFastSensitiveDetector (G4String aName, G4int aNbOfLayers, G4int aNbOfSlices)
 
virtual ~Par04ParallelFastSensitiveDetector ()
 
virtual void Initialize (G4HCofThisEvent *HCE) final
 Create hit collection.
 
virtual G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *aROhist) final
 Process energy deposit from the full simulation.
 
virtual G4bool ProcessHits (const G4FastHit *aHit, const G4FastTrack *aTrack, G4TouchableHistory *aROhist) final
 
virtual void EndOfEvent (G4HCofThisEvent *aHC) final
 
- Public Member Functions inherited from G4VFastSimSensitiveDetector
G4bool Hit (const G4FastHit *aHit, const G4FastTrack *aTrack, G4TouchableHandle *aTouchable)
 

Private Attributes

Par04HitsCollectionfHitsCollection = nullptr
 Collection of hits.
 
std::unordered_map< G4int, std::unique_ptr< Par04Hit > > fHitsMap
 
G4int fHitCollectionID = -1
 ID of collection of hits.
 
G4int fNbOfLayers = 1
 Number of readout cells.
 
G4int fNbOfSlices = 1
 

Detailed Description

Sensitive detector.

Definition at line 50 of file Par04ParallelFastSensitiveDetector.hh.

Constructor & Destructor Documentation

◆ Par04ParallelFastSensitiveDetector() [1/2]

Par04ParallelFastSensitiveDetector::Par04ParallelFastSensitiveDetector ( G4String  aName)

Definition at line 52 of file Par04ParallelFastSensitiveDetector.cc.

54{
55 collectionName.insert("physicalCellsFastSim");
56}

◆ Par04ParallelFastSensitiveDetector() [2/2]

Par04ParallelFastSensitiveDetector::Par04ParallelFastSensitiveDetector ( G4String  aName,
G4int  aNbOfLayers,
G4int  aNbOfSlices 
)

Definition at line 59 of file Par04ParallelFastSensitiveDetector.cc.

63 , fNbOfLayers(aNbOfLayers)
64 , fNbOfSlices(aNbOfSlices)
65{
66 collectionName.insert("physicalCellsFastSim");
67}

◆ ~Par04ParallelFastSensitiveDetector()

Par04ParallelFastSensitiveDetector::~Par04ParallelFastSensitiveDetector ( )
virtualdefault

Member Function Documentation

◆ Initialize()

void Par04ParallelFastSensitiveDetector::Initialize ( G4HCofThisEvent HCE)
finalvirtual

Create hit collection.

Definition at line 75 of file Par04ParallelFastSensitiveDetector.cc.

76{
77 fHitsCollection = new Par04HitsCollection(SensitiveDetectorName, collectionName[0]);
78 if(fHitCollectionID < 0)
79 {
80 fHitCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
81 }
82 aHCE->AddHitsCollection(fHitCollectionID, fHitsCollection);
83}
G4THitsCollection< Par04Hit > Par04HitsCollection
Definition Par04Hit.hh:145
Par04HitsCollection * fHitsCollection
Collection of hits.

◆ ProcessHits() [1/2]

G4bool Par04ParallelFastSensitiveDetector::ProcessHits ( G4Step aStep,
G4TouchableHistory aROhist 
)
finalvirtual

Process energy deposit from the full simulation.

Definition at line 86 of file Par04ParallelFastSensitiveDetector.cc.

87{
88 return true;
89}

◆ ProcessHits() [2/2]

G4bool Par04ParallelFastSensitiveDetector::ProcessHits ( const G4FastHit aHit,
const G4FastTrack aTrack,
G4TouchableHistory aROhist 
)
finalvirtual

Implements G4VFastSimSensitiveDetector.

Definition at line 92 of file Par04ParallelFastSensitiveDetector.cc.

95{
96 G4double edep = aHit->GetEnergy();
97 if(edep == 0.)
98 return true;
99
100 G4int layerNo = aTouchable->GetCopyNumber(0);
101 G4int sliceNo = aTouchable->GetCopyNumber(1);
102 G4int rowNo = aTouchable->GetCopyNumber(2);
103
104 G4int hitID = fNbOfLayers*fNbOfSlices*rowNo+fNbOfLayers*sliceNo+layerNo;
105 auto hit = fHitsMap[hitID].get();
106 if (hit==nullptr) {
107 fHitsMap[hitID] = std::unique_ptr<Par04Hit>(new Par04Hit());
108 hit = fHitsMap[hitID].get();
109 hit->SetPhiId(sliceNo);
110 hit->SetRhoId(layerNo);
111 hit->SetZid(rowNo);
112 }
113 if (layerNo != hit->GetRhoId()) {
114 G4cout << "ERROR, problem with Layer IDs: " << layerNo << " != " << hit->GetRhoId() << G4endl;
115 return false;
116 }
117 if (sliceNo != hit->GetPhiId()) {
118 G4cout << "ERROR, problem with Slice IDs: " << sliceNo << " != " << hit->GetPhiId() << G4endl;
119 return false;
120 }
121 if (rowNo != hit->GetZid()) {
122 G4cout << "ERROR, problem with Row IDs: " << rowNo << " != " << hit->GetZid() << G4endl;
123 return false;
124 }
125
126 // Add energy deposit from G4Step
127 hit->AddEdep(edep);
128 // Increment the counter
129 hit->AddNdep(1);
130 // Set hit type to parallel world fast simulation (even if hit was already marked as full
131 // sim, overwrite it)
132 hit->SetType(3);
133
134 return true;
135}
G4double GetEnergy() const
Hit class to store energy deposited in the sensitive detector.
std::unordered_map< G4int, std::unique_ptr< Par04Hit > > fHitsMap

◆ EndOfEvent()

void Par04ParallelFastSensitiveDetector::EndOfEvent ( G4HCofThisEvent aHC)
finalvirtual

Definition at line 138 of file Par04ParallelFastSensitiveDetector.cc.

139{
140 for(const auto& hits: fHitsMap){
141 fHitsCollection->insert(new Par04Hit(*hits.second.get()));
142 }
143 fHitsMap.clear();
144}

Member Data Documentation

◆ fHitsCollection

Par04HitsCollection* Par04ParallelFastSensitiveDetector::fHitsCollection = nullptr
private

Collection of hits.

Definition at line 70 of file Par04ParallelFastSensitiveDetector.hh.

◆ fHitsMap

std::unordered_map<G4int, std::unique_ptr<Par04Hit> > Par04ParallelFastSensitiveDetector::fHitsMap
private

Definition at line 71 of file Par04ParallelFastSensitiveDetector.hh.

◆ fHitCollectionID

G4int Par04ParallelFastSensitiveDetector::fHitCollectionID = -1
private

ID of collection of hits.

Definition at line 73 of file Par04ParallelFastSensitiveDetector.hh.

◆ fNbOfLayers

G4int Par04ParallelFastSensitiveDetector::fNbOfLayers = 1
private

Number of readout cells.

Definition at line 75 of file Par04ParallelFastSensitiveDetector.hh.

◆ fNbOfSlices

G4int Par04ParallelFastSensitiveDetector::fNbOfSlices = 1
private

Definition at line 76 of file Par04ParallelFastSensitiveDetector.hh.


The documentation for this class was generated from the following files:

Applications | User Support | Publications | Collaboration