30 #include "CLHEP/Units/SystemOfUnits.h"
32 #include "Geant4/G4MuonMinus.hh"
33 #include "Geant4/G4MuonPlus.hh"
34 #include "Geant4/G4StackManager.hh"
35 #include "Geant4/G4String.hh"
36 #include "Geant4/G4ThreeVector.hh"
37 #include "Geant4/G4Track.hh"
38 #include "Geant4/G4TrackStatus.hh"
39 #include "Geant4/G4ParticleDefinition.hh"
40 #include "Geant4/G4VProcess.hh"
43 #include "RtypesCore.h"
48 #include "art/Framework/Services/Registry/ServiceHandle.h"
55 , fangRoI(30.*CLHEP::deg)
68 G4ClassificationOfNewTrack
71 G4ClassificationOfNewTrack classification = fWaiting;
72 art::ServiceHandle<geo::Geometry const> geom;
74 Double_t buffer = 500;
78 int ppdg = aTrack->GetParentID();
79 TString process(
"NA");
80 if (ppdg) process = (TString)aTrack->GetCreatorProcess()->GetProcessName();
85 if (aTrack->GetParentID()==0)
87 G4ParticleDefinition *particleType = aTrack->GetDefinition();
88 if( ((particleType==G4MuonPlus::MuonPlusDefinition())
89 || (particleType==G4MuonMinus::MuonMinusDefinition())
91 && !volName.Contains(
"unknown")
93 classification = fUrgent;
96 if (volName.Contains(
"unknown")) classification = fKill;
101 if(aTrack->GetTrackStatus()==fSuspend) {
break; }
103 if ((aTrack->GetDefinition()->GetPDGEncoding()==2112 || aTrack->GetDefinition()->GetPDGEncoding()==130 || aTrack->GetDefinition()->GetPDGEncoding()==310 || aTrack->GetDefinition()->GetPDGEncoding()==311 || aTrack->GetDefinition()->GetPDGEncoding()==3122 ) && (aTrack->GetParentID()==1) && !volName.Contains(
"unknown"))
106 const G4ThreeVector tr4Pos = aTrack->GetPosition();
108 const TVector3 trPos(tr4Pos.x()/CLHEP::cm,tr4Pos.y()/CLHEP::cm,tr4Pos.z()/CLHEP::cm);
110 classification = fUrgent;
114 trPos.X() < (geom->DetHalfWidth()*2.0 + buffer) && trPos.X() > (-buffer) &&
115 trPos.Y() < (geom->DetHalfHeight()*2.0 + buffer) && trPos.Y() > (-geom->DetHalfHeight()*2.0 - buffer) &&
116 trPos.Z() < (geom->DetLength() + buffer) && trPos.Z() > (-buffer)
119 { classification = fUrgent;
break; }
123 { classification = fKill;
break; }
129 if (volName.Contains(
"unknown")) classification = fKill;
137 if(aTrack->GetParentID() == 0 && !volName.Contains(
"unknown")){
138 classification = fUrgent;
142 if(volName.Contains(geom->GetLArTPCVolumeName()) && aTrack->GetParentID()!=0)
144 classification = fUrgent;
146 aTrack->GetCreatorProcess()->GetProcessName().contains(
"muIoni")
149 classification = fKill;
153 else if (volName.Contains(
"unknown") ){
154 classification = fKill;
158 if(aTrack->GetDefinition()->GetPDGEncoding()==11
159 && aTrack->GetCreatorProcess()->GetProcessName().contains(
"muIoni") )
161 classification = fKill;
165 classification = fKill;
169 return classification;
176 art::ServiceHandle<geo::Geometry const> geom;
177 const G4ThreeVector tr4Pos = aTrack->GetPosition();
180 const TVector3 trPos(tr4Pos.x()/CLHEP::cm,tr4Pos.y()/CLHEP::cm,tr4Pos.z()/CLHEP::cm);
182 const std::string volName(geom->VolumeName(trPos));
204 stackManager->ReClassify();
215 stackManager->ReClassify();
221 stackManager->ReClassify();
std::string InsideTPC(const G4Track *aTrack)
virtual ~LArStackingAction()
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)
virtual void PrepareNewEvent()
art framework interface to geometry description