Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// *********************************************************
// Implemented from Mokka
// *********************************************************
//
// $Id: TimeProjectionChamberSensitiveDetector.hh,v 1.1 2009/05/13 08:22:57 steve Exp $
#ifndef TimeProjectionChamberSensitiveDetector_h
#define TimeProjectionChamberSensitiveDetector_h
#include "DetSimSD/DDG4SensitiveDetector.h"
#include "DDG4/Defs.h"
class TimeProjectionChamberSensitiveDetector: public DDG4SensitiveDetector {
public:
TimeProjectionChamberSensitiveDetector(const std::string& name, dd4hep::Detector& description);
void Initialize(G4HCofThisEvent* HCE);
G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
void EndOfEvent(G4HCofThisEvent* HCE);
void setThreshold(double e){m_thresholdEnergyDeposit=e;};
void setSameStepLimit(bool flag){m_lowPtStepLimit=(!flag);};
void setWriteMCTruthForLowPtHits(bool flag){m_writeMCParticleForLowPtHits=flag;};
void setLowPtCut(double cut){m_lowPtCut=cut;};
void setLowPtMaxHitSeparation(double length){m_lowPtMaxHitSeparation=length;};
/// helper function to avoid code duplication, writes a low Pt hit to the collection
void DepositLowPtHit();
/// helper function to avoid code duplication, resets all cumulative variables
void ResetCumulativeVariables();
/// helper function to avoid code duplication,
/// adds energy, track length and momentum of a low pt step to the cumulative variables
void CumulateLowPtStep(dd4hep::sim::Geant4StepHandler& h);
protected:
double m_thresholdEnergyDeposit = 0;
bool m_lowPtStepLimit = false;
bool m_writeMCParticleForLowPtHits = false;
double m_lowPtCut = 0;
double m_lowPtMaxHitSeparation = 0;
bool m_trackingPhysicsListELossOn = true;
HitCollection* m_hc = nullptr;
HitCollection* m_spaceHC = nullptr;
HitCollection* m_lowPtHC = nullptr;
dd4hep::Position CrossingOfPadRingCentre;
dd4hep::sim::Momentum MomentumAtPadRingCentre;
double dEInPadRow;
double globalTimeAtPadRingCentre;
double pathLengthInPadRow;
double CumulativePathLength;
double CumulativeEnergyDeposit;
dd4hep::Position CumulativeMeanPosition;
dd4hep::sim::Momentum CumulativeMeanMomentum;
int CumulativeNumSteps;
dd4hep::Position PreviousPostStepPosition; //< the end point of the previous step
int CurrentPDGEncoding; //< the PDG encoding of the particle causing the cumulative energy deposit
int CurrentTrackID; //< the TrackID of the particle causing the cumulative energy deposit
double CurrentGlobalTime; ///< the global time of the track causing the cumulative energy deposit
int CurrentCopyNumber; ///< copy number of the preStepPoint's TouchableHandle for the cumulative energy deposit
};
#endif