Public Member Functions | Private Attributes | List of all members
EDepSim::SegmentSD Class Reference

#include <EDepSimSegmentSD.hh>

Inheritance diagram for EDepSim::SegmentSD:

Public Member Functions

 SegmentSD (G4String name)
 
virtual ~SegmentSD ()
 
void Initialize (G4HCofThisEvent *)
 
G4bool ProcessHits (G4Step *, G4TouchableHistory *)
 
void EndOfEvent (G4HCofThisEvent *)
 
void SetMaximumHitSagitta (double sagitta)
 
double GetMaximumHitSagitta (void)
 
void SetMaximumHitLength (double length)
 
double GetMaximumHitLength (void)
 

Private Attributes

EDepSim::HitSegment::HitSegmentCollectionfHits
 
int fHCID
 The hit collection id of fHits. More...
 
double fMaximumHitSagitta
 The maximum allowed sagitta;. More...
 
double fMaximumHitLength
 The maximum allowed length;. More...
 
int fLastHit
 The last hit that was found. More...
 

Detailed Description

Definition at line 17 of file EDepSimSegmentSD.hh.

Constructor & Destructor Documentation

EDepSim::SegmentSD::SegmentSD ( G4String  name)

Definition at line 21 of file EDepSimSegmentSD.cc.

22  :G4VSensitiveDetector(name),
23  fHits(NULL), fHCID(-1),
25  fLastHit(0) {
26  // In an unbelievably poor interface, the G4VSensitiveDetector class
27  // exposes the protected field "std::vector<G4String> collectionName" to
28  // the user and expects any derived classes to explicitly fill it with the
29  // names of the hit collection filled. The values in collectionName
30  // should be accessed through
31  // "G4VSensitiveDetector::GetCollectionName(i)".
32  collectionName.insert("SegmentHits");
33 }
static QCString name
Definition: declinfo.cpp:673
int fLastHit
The last hit that was found.
int fHCID
The hit collection id of fHits.
EDepSim::HitSegment::HitSegmentCollection * fHits
static constexpr double mm
Definition: Units.h:65
double fMaximumHitLength
The maximum allowed length;.
double fMaximumHitSagitta
The maximum allowed sagitta;.
EDepSim::SegmentSD::~SegmentSD ( )
virtual

Definition at line 35 of file EDepSimSegmentSD.cc.

35 {}

Member Function Documentation

void EDepSim::SegmentSD::EndOfEvent ( G4HCofThisEvent *  )

Definition at line 86 of file EDepSimSegmentSD.cc.

86 { }
double EDepSim::SegmentSD::GetMaximumHitLength ( void  )
inline

Definition at line 44 of file EDepSimSegmentSD.hh.

44 {return fMaximumHitLength;}
double fMaximumHitLength
The maximum allowed length;.
double EDepSim::SegmentSD::GetMaximumHitSagitta ( void  )
inline

Definition at line 35 of file EDepSimSegmentSD.hh.

35 {return fMaximumHitSagitta;}
double fMaximumHitSagitta
The maximum allowed sagitta;.
void EDepSim::SegmentSD::Initialize ( G4HCofThisEvent *  HCE)

Definition at line 37 of file EDepSimSegmentSD.cc.

37  {
39  GetCollectionName(0));
40 
41  if (fHCID<0) {
42  G4String hcName = GetName() + "/" + GetCollectionName(0);
43  fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(hcName);
44  EDepSimLog("Initialize SD for "
45  << GetName() << "/" << GetCollectionName(0)
46  << " w/ sagitta " << G4BestUnit(fMaximumHitSagitta,"Length")
47  << " & " << G4BestUnit(fMaximumHitLength,"Length"));
48  }
49  HCE->AddHitsCollection(fHCID, fHits);
50 }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
int fHCID
The hit collection id of fHits.
EDepSim::HitSegment::HitSegmentCollection * fHits
G4THitsCollection< EDepSim::HitSegment > HitSegmentCollection
double fMaximumHitLength
The maximum allowed length;.
double fMaximumHitSagitta
The maximum allowed sagitta;.
G4bool EDepSim::SegmentSD::ProcessHits ( G4Step *  theStep,
G4TouchableHistory *   
)

Definition at line 52 of file EDepSimSegmentSD.cc.

53  {
54  // Get the hit information.
55  G4double energyDeposit = theStep->GetTotalEnergyDeposit();
56  if (energyDeposit <= 0.) return true;
57 
58  EDepSimTrace("Process hit with " << energyDeposit
59  << " in " << theStep->GetTrack()->GetVolume()->GetName());
60 
61 
62  EDepSim::HitSegment* currentHit = NULL;
63 
64  // Check to see if the last hit in the vector of hits needs to be
65  // expanded.
66  if (0<=fLastHit && fLastHit < (int) fHits->entries()) {
67  EDepSim::HitSegment *tmpHit = (*fHits)[fLastHit];
68  if (tmpHit->SameHit(theStep)) {
69  currentHit = tmpHit;
70  }
71  }
72 
73  // If a hit wasn't found, create one.
74  if (!currentHit) {
75  currentHit = new EDepSim::HitSegment(fMaximumHitSagitta,
77  fLastHit = fHits->entries();
78  fHits->insert(currentHit);
79  }
80 
81  currentHit->AddStep(theStep);
82 
83  return true;
84 }
int fLastHit
The last hit that was found.
virtual bool SameHit(G4Step *theStep)
EDepSim::HitSegment::HitSegmentCollection * fHits
#define EDepSimTrace(outStream)
Definition: EDepSimLog.hh:653
double fMaximumHitLength
The maximum allowed length;.
double fMaximumHitSagitta
The maximum allowed sagitta;.
void EDepSim::SegmentSD::SetMaximumHitLength ( double  length)
inline

Set the maximum length for the EDepSim::HitSegment objects created by this sensitive detector.

Definition at line 39 of file EDepSimSegmentSD.hh.

39  {
40  EDepSimLog("Set max segment length to " << length
41  << " for " << GetName());
42  fMaximumHitLength = length;
43  }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
double fMaximumHitLength
The maximum allowed length;.
void EDepSim::SegmentSD::SetMaximumHitSagitta ( double  sagitta)
inline

Set the maximum sagitta for the EDepSim::HitSegment objects created by this sensitive detector.

Definition at line 30 of file EDepSimSegmentSD.hh.

30  {
31  EDepSimLog("Set max segment sagitta to " << sagitta
32  << " for " << GetName());
33  fMaximumHitSagitta = sagitta;
34  }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
double fMaximumHitSagitta
The maximum allowed sagitta;.

Member Data Documentation

int EDepSim::SegmentSD::fHCID
private

The hit collection id of fHits.

Definition at line 53 of file EDepSimSegmentSD.hh.

EDepSim::HitSegment::HitSegmentCollection* EDepSim::SegmentSD::fHits
private

The collection of hits that is being filled in the current event. It is constructed in Initialize, filled in ProcessHits, and added the the event in EndOfEvent.

Definition at line 50 of file EDepSimSegmentSD.hh.

int EDepSim::SegmentSD::fLastHit
private

The last hit that was found.

Definition at line 62 of file EDepSimSegmentSD.hh.

double EDepSim::SegmentSD::fMaximumHitLength
private

The maximum allowed length;.

Definition at line 59 of file EDepSimSegmentSD.hh.

double EDepSim::SegmentSD::fMaximumHitSagitta
private

The maximum allowed sagitta;.

Definition at line 56 of file EDepSimSegmentSD.hh.


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