30 #include "CLHEP/Units/SystemOfUnits.h" 32 #include "Geant4/G4MuonMinus.hh" 33 #include "Geant4/G4MuonPlus.hh" 34 #include "Geant4/G4ParticleDefinition.hh" 35 #include "Geant4/G4StackManager.hh" 36 #include "Geant4/G4String.hh" 37 #include "Geant4/G4ThreeVector.hh" 38 #include "Geant4/G4Track.hh" 39 #include "Geant4/G4TrackStatus.hh" 40 #include "Geant4/G4VProcess.hh" 43 #include "RtypesCore.h" 51 : fstage(0), freqMuon(2), freqIsoMuon(0), freqIso(10), fangRoI(30. *
CLHEP::deg)
65 G4ClassificationOfNewTrack classification = fWaiting;
68 Double_t buffer = 500;
72 int ppdg = aTrack->GetParentID();
73 TString process(
"NA");
74 if (ppdg) process = (TString)aTrack->GetCreatorProcess()->GetProcessName();
78 if (aTrack->GetParentID() == 0) {
79 G4ParticleDefinition* particleType = aTrack->GetDefinition();
80 if (((particleType == G4MuonPlus::MuonPlusDefinition()) ||
81 (particleType == G4MuonMinus::MuonMinusDefinition())) &&
82 !volName.Contains(
"unknown")) {
83 classification = fUrgent;
86 if (volName.Contains(
"unknown")) classification = fKill;
91 if (aTrack->GetTrackStatus() == fSuspend) {
break; }
93 if ((aTrack->GetDefinition()->GetPDGEncoding() == 2112 ||
94 aTrack->GetDefinition()->GetPDGEncoding() == 130 ||
95 aTrack->GetDefinition()->GetPDGEncoding() == 310 ||
96 aTrack->GetDefinition()->GetPDGEncoding() == 311 ||
97 aTrack->GetDefinition()->GetPDGEncoding() == 3122) &&
98 (aTrack->GetParentID() == 1) && !volName.Contains(
"unknown")) {
100 const G4ThreeVector tr4Pos = aTrack->GetPosition();
102 const TVector3 trPos(tr4Pos.x() / CLHEP::cm, tr4Pos.y() / CLHEP::cm, tr4Pos.z() / CLHEP::cm);
104 classification = fUrgent;
107 if (trPos.X() < (geom->
DetHalfWidth() * 2.0 + buffer) && trPos.X() > (-buffer) &&
110 trPos.Z() < (geom->
DetLength() + buffer) && trPos.Z() > (-buffer))
113 classification = fUrgent;
119 classification = fKill;
125 if (volName.Contains(
"unknown")) classification = fKill;
133 if (aTrack->GetParentID() == 0 && !volName.Contains(
"unknown")) {
134 classification = fUrgent;
139 classification = fUrgent;
140 if (
fStack & 0
x4 && aTrack->GetCreatorProcess()->GetProcessName().contains(
"muIoni")) {
141 classification = fKill;
145 else if (volName.Contains(
"unknown")) {
146 classification = fKill;
150 if (aTrack->GetDefinition()->GetPDGEncoding() == 11 &&
151 aTrack->GetCreatorProcess()->GetProcessName().contains(
"muIoni")) {
152 classification = fKill;
156 classification = fKill;
160 return classification;
166 const G4ThreeVector tr4Pos = aTrack->GetPosition();
169 const geo::Point_t trPos(tr4Pos.x() / CLHEP::cm, tr4Pos.y() / CLHEP::cm, tr4Pos.z() / CLHEP::cm);
190 stackManager->ReClassify();
201 stackManager->ReClassify();
207 stackManager->ReClassify();
std::string GetLArTPCVolumeName(TPCID const &tpcid=tpc_zero) const
Return the name of specified LAr TPC volume.
Length_t DetHalfWidth(TPCID const &tpcid=tpc_zero) const
Returns the half width of the active volume of the specified TPC.
std::string InsideTPC(const G4Track *aTrack)
virtual ~LArStackingAction()
Length_t DetLength(TPCID const &tpcid=tpc_zero) const
Returns the length of the active volume of the specified TPC.
std::string VolumeName(Point_t const &point) const
Returns the name of the deepest volume containing specified point.
Float_t x4[n_points_geant4]
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)
Length_t DetHalfHeight(TPCID const &tpcid=tpc_zero) const
Returns the half height of the active volume of the specified TPC.
virtual void PrepareNewEvent()
art framework interface to geometry description