30 #include "Geant4/G4SDManager.hh" 31 #include "Geant4/G4RunManager.hh" 32 #include "Geant4/G4Event.hh" 33 #include "Geant4/G4HCofThisEvent.hh" 34 #include "Geant4/G4Track.hh" 35 #include "Geant4/G4TrackStatus.hh" 36 #include "Geant4/G4ParticleDefinition.hh" 37 #include "Geant4/G4ParticleTypes.hh" 38 #include "Geant4/G4ios.hh" 50 #include "cetlib_except/exception.h" 57 , fangRoI(30.*
CLHEP::deg)
70 G4ClassificationOfNewTrack
73 G4ClassificationOfNewTrack classification = fWaiting;
76 Double_t buffer = 500;
80 int ppdg = aTrack->GetParentID();
81 TString process(
"NA");
82 if (ppdg) process = (TString)aTrack->GetCreatorProcess()->GetProcessName();
87 if (aTrack->GetParentID()==0)
89 G4ParticleDefinition *particleType = aTrack->GetDefinition();
90 if( ((particleType==G4MuonPlus::MuonPlusDefinition())
91 || (particleType==G4MuonMinus::MuonMinusDefinition())
93 && !volName.Contains(
"unknown")
95 classification = fUrgent;
98 if (volName.Contains(
"unknown")) classification = fKill;
103 if(aTrack->GetTrackStatus()==fSuspend) {
break; }
105 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"))
108 const G4ThreeVector tr4Pos = aTrack->GetPosition();
110 const TVector3 trPos(tr4Pos.x()/CLHEP::cm,tr4Pos.y()/CLHEP::cm,tr4Pos.z()/CLHEP::cm);
112 classification = fUrgent;
116 trPos.X() < (geom->
DetHalfWidth()*2.0 + buffer) && trPos.X() > (-buffer) &&
118 trPos.Z() < (geom->
DetLength() + buffer) && trPos.Z() > (-buffer)
121 { classification = fUrgent;
break; }
125 { classification = fKill;
break; }
131 if (volName.Contains(
"unknown")) classification = fKill;
139 if(aTrack->GetParentID() == 0 && !volName.Contains(
"unknown")){
140 classification = fUrgent;
146 classification = fUrgent;
148 aTrack->GetCreatorProcess()->GetProcessName().contains(
"muIoni")
151 classification = fKill;
155 else if (volName.Contains(
"unknown") ){
156 classification = fKill;
160 if(aTrack->GetDefinition()->GetPDGEncoding()==11
161 && aTrack->GetCreatorProcess()->GetProcessName().contains(
"muIoni") )
163 classification = fKill;
167 classification = fKill;
171 return classification;
179 const G4ThreeVector tr4Pos = aTrack->GetPosition();
182 const TVector3 trPos(tr4Pos.x()/CLHEP::cm,tr4Pos.y()/CLHEP::cm,tr4Pos.z()/CLHEP::cm);
184 const std::string volName(geom->
VolumeName(trPos));
206 stackManager->ReClassify();
217 stackManager->ReClassify();
223 stackManager->ReClassify();
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
std::string InsideTPC(const G4Track *aTrack)
virtual ~LArStackingAction()
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)
virtual void PrepareNewEvent()
std::string VolumeName(geo::Point_t const &point) const
Returns the name of the deepest volume containing specified point.
art framework interface to geometry description
std::string GetLArTPCVolumeName(geo::TPCID const &tpcid) const
Return the name of specified LAr TPC volume.