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

Sensitive detector. More...

#include <Doxymodules_parameterisations.h>

Inheritance diagram for Par03SensitiveDetector:
G4VSensitiveDetector G4VFastSimSensitiveDetector

Public Member Functions

 Par03SensitiveDetector (G4String aName)
 
 Par03SensitiveDetector (G4String aName, G4int aNumLayers, G4int aNumPhi, G4int aNumRho)
 
virtual ~Par03SensitiveDetector ()
 
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
 Process energy deposit from the fast simulation.
 
Par03HitRetrieveAndSetupHit (G4TouchableHistory *aTouchable)
 Process energy deposit - common part for full and fast simulation It is invoked from ProcessHits() methods, and sets basic hit properties (position, etc.), common for hit from fast and full simulation.
 
- Public Member Functions inherited from G4VFastSimSensitiveDetector
G4bool Hit (const G4FastHit *aHit, const G4FastTrack *aTrack, G4TouchableHandle *aTouchable)
 

Private Attributes

Par03HitsCollectionfHitsCollection = nullptr
 Collection of hits.
 
G4int fHitCollectionID = -1
 ID of collection of hits.
 
G4int fCellNoZ = 10
 Number of readout cells along z axis.
 
G4int fCellNoRho = 10
 Number of readout cells along radius of cylinder.
 
G4int fCellNoPhi = 10
 Number of readout cells along azimuthal angle.
 

Detailed Description

Sensitive detector.

Describes how to store the energy deposited within the detector. It derives from two classes: G4VSensitiveDetector and G4VFastSimSensitiveDetector. Addition of G4VFastSimSensitiveDetector is necessary in order to handle the energy deposits from the fast simulation.

Two ProcessHits() methods are introduced to handle energy deposited from full (detailed) simulation, and from fast simulation. The common part is handled by RetrieveAdnSetupHit() method.

Definition at line 68 of file Doxymodules_parameterisations.h.

Constructor & Destructor Documentation

◆ Par03SensitiveDetector() [1/2]

Par03SensitiveDetector::Par03SensitiveDetector ( G4String  aName)

Definition at line 35 of file Par03SensitiveDetector.cc.

37{
38 collectionName.insert("hits");
39}

◆ Par03SensitiveDetector() [2/2]

Par03SensitiveDetector::Par03SensitiveDetector ( G4String  aName,
G4int  aNumLayers,
G4int  aNumPhi,
G4int  aNumRho 
)

Definition at line 42 of file Par03SensitiveDetector.cc.

45 , fCellNoZ(aNumLayers)
46 , fCellNoRho(aNumRho)
47 , fCellNoPhi(aNumPhi)
48{
49 collectionName.insert("hits");
50}
G4int fCellNoPhi
Number of readout cells along azimuthal angle.
G4int fCellNoZ
Number of readout cells along z axis.
G4int fCellNoRho
Number of readout cells along radius of cylinder.

◆ ~Par03SensitiveDetector()

Par03SensitiveDetector::~Par03SensitiveDetector ( )
virtualdefault

Member Function Documentation

◆ Initialize()

void Par03SensitiveDetector::Initialize ( G4HCofThisEvent HCE)
finalvirtual

Create hit collection.

Definition at line 58 of file Par03SensitiveDetector.cc.

59{
61 new Par03HitsCollection(SensitiveDetectorName, collectionName[0]);
62 if(fHitCollectionID < 0)
63 {
65 G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
66 }
67 aHCE->AddHitsCollection(fHitCollectionID, fHitsCollection);
68
69 // fill calorimeter hits with zero energy deposition
70 for(G4int iphi = 0; iphi < fCellNoPhi; iphi++)
71 for(G4int irho = 0; irho < fCellNoRho; irho++)
72 for(G4int iz = 0; iz < fCellNoZ; iz++)
73 {
74 auto hit = new Par03Hit();
75 fHitsCollection->insert(hit);
76 }
77}
G4THitsCollection< Par03Hit > Par03HitsCollection
Definition Par03Hit.hh:132
Hit class to store energy deposited in the sensitive detector.
G4int fHitCollectionID
ID of collection of hits.
Par03HitsCollection * fHitsCollection
Collection of hits.

◆ ProcessHits() [1/2]

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

Process energy deposit from the full simulation.

Definition at line 81 of file Par03SensitiveDetector.cc.

82{
83 G4double edep = aStep->GetTotalEnergyDeposit();
84 if(edep == 0.)
85 return true;
86
87 auto aTouchable =
88 (G4TouchableHistory*) (aStep->GetPreStepPoint()->GetTouchable());
89
90 auto hit = RetrieveAndSetupHit(aTouchable);
91
92 // Add energy deposit from G4Step
93 hit->AddEdep(edep);
94
95 // Fill time information from G4Step
96 // If it's already filled, choose hit with earliest global time
97 if(hit->GetTime() == -1 ||
98 hit->GetTime() > aStep->GetTrack()->GetGlobalTime())
99 hit->SetTime(aStep->GetTrack()->GetGlobalTime());
100
101 // Set hit type to full simulation (only if hit is not already marked as fast
102 // sim)
103 if(hit->GetType() != 1)
104 hit->SetType(0);
105
106 return true;
107}
Par03Hit * RetrieveAndSetupHit(G4TouchableHistory *aTouchable)
Process energy deposit - common part for full and fast simulation It is invoked from ProcessHits() me...

◆ ProcessHits() [2/2]

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

Process energy deposit from the fast simulation.

Implements G4VFastSimSensitiveDetector.

Definition at line 111 of file Par03SensitiveDetector.cc.

114{
115 G4double edep = aHit->GetEnergy();
116 if(edep == 0.)
117 return true;
118
119 auto hit = RetrieveAndSetupHit(aTouchable);
120
121 // Add energy deposit from G4FastHit
122 hit->AddEdep(edep);
123
124 // Fill time information from G4FastTrack
125 // If it's already filled, choose hit with earliest global time
126 if(hit->GetTime() == -1 ||
127 hit->GetTime() > aTrack->GetPrimaryTrack()->GetGlobalTime())
128 {
129 hit->SetTime(aTrack->GetPrimaryTrack()->GetGlobalTime());
130 }
131
132 // Set hit type to fast simulation (even if hit was already marked as full
133 // sim, overwrite it)
134 hit->SetType(1);
135
136 return true;
137}
G4double GetEnergy() const

◆ RetrieveAndSetupHit()

Par03Hit * Par03SensitiveDetector::RetrieveAndSetupHit ( G4TouchableHistory aTouchable)

Process energy deposit - common part for full and fast simulation It is invoked from ProcessHits() methods, and sets basic hit properties (position, etc.), common for hit from fast and full simulation.

Definition at line 141 of file Par03SensitiveDetector.cc.

143{
144 G4int rhoNo = aTouchable->GetCopyNumber(0); // cell
145 G4int phiNo = aTouchable->GetCopyNumber(1); // segment
146 G4int zNo = aTouchable->GetCopyNumber(2); // layer
147
148 std::size_t hitID = fCellNoRho * fCellNoZ * phiNo + fCellNoZ * rhoNo + zNo;
149
150 if(hitID >= fHitsCollection->entries())
151 {
152 G4Exception(
153 "Par03SensitiveDetector::RetrieveAndSetupHit()", "InvalidSetup",
154 FatalException,
155 "Size of hit collection in Par03SensitiveDetector is smaller than the "
156 "number of cells created in Par03DetectorConstruction!");
157 }
158 Par03Hit* hit = (*fHitsCollection)[hitID];
159
160 if(hit->GetRhoId() < 0)
161 {
162 hit->SetRhoId(rhoNo);
163 hit->SetPhiId(phiNo);
164 hit->SetZid(zNo);
165 hit->SetLogV(aTouchable->GetVolume(0)->GetLogicalVolume());
166 G4AffineTransform transform = aTouchable->GetHistory()->GetTopTransform();
167 hit->SetRot(transform.NetRotation());
168 transform.Invert();
169 hit->SetPos(transform.NetTranslation());
170 }
171 return hit;
172}
G4int GetRhoId() const
Get rho id of the cell in the readout segmentation.
Definition Par03Hit.hh:93
void SetPhiId(G4int aPhi)
Set phi id of the cell in the readout segmentation.
Definition Par03Hit.hh:95
void SetZid(G4int aZ)
Set Z id of the cell in the readout segmentation.
Definition Par03Hit.hh:87
void SetRhoId(G4int aRho)
Set Rho id of the cell in the readout segmentation.
Definition Par03Hit.hh:91
void SetRot(G4RotationMatrix aXYZ)
Set rotation.
Definition Par03Hit.hh:77
void SetLogV(G4LogicalVolume *aLogVol)
Definition Par03Hit.hh:107
void SetPos(G4ThreeVector aXYZ)
Set position.
Definition Par03Hit.hh:73

Member Data Documentation

◆ fHitsCollection

Par03HitsCollection* Par03SensitiveDetector::fHitsCollection = nullptr
private

Collection of hits.

Definition at line 74 of file Par03SensitiveDetector.hh.

◆ fHitCollectionID

G4int Par03SensitiveDetector::fHitCollectionID = -1
private

ID of collection of hits.

Definition at line 76 of file Par03SensitiveDetector.hh.

◆ fCellNoZ

G4int Par03SensitiveDetector::fCellNoZ = 10
private

Number of readout cells along z axis.

Definition at line 78 of file Par03SensitiveDetector.hh.

◆ fCellNoRho

G4int Par03SensitiveDetector::fCellNoRho = 10
private

Number of readout cells along radius of cylinder.

Definition at line 80 of file Par03SensitiveDetector.hh.

◆ fCellNoPhi

G4int Par03SensitiveDetector::fCellNoPhi = 10
private

Number of readout cells along azimuthal angle.

Definition at line 82 of file Par03SensitiveDetector.hh.


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

Applications | User Support | Publications | Collaboration