LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
LArStackingAction Class Reference

#include "LArStackingAction.h"

Inheritance diagram for LArStackingAction:

Public Member Functions

 LArStackingAction (int)
 
virtual ~LArStackingAction ()
 
virtual G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *aTrack)
 
virtual void NewStage ()
 
virtual void PrepareNewEvent ()
 
void SetNRequestMuon (G4int val)
 
G4int GetNRequestMuon () const
 
void SetNRequestIsoMuon (G4int val)
 
G4int GetNRequestIsoMuon () const
 
void SetNIsolation (G4int val)
 
G4int GetNIsolation () const
 
void SetRoIAngle (G4double val)
 
G4double GetRoIAngle () const
 

Public Attributes

G4int fStack
 

Private Member Functions

std::string InsideTPC (const G4Track *aTrack)
 

Private Attributes

G4int fstage
 
G4int freqMuon
 
G4int freqIsoMuon
 
G4int freqIso
 
G4double fangRoI
 

Detailed Description

Definition at line 40 of file LArStackingAction.h.

Constructor & Destructor Documentation

LArStackingAction::LArStackingAction ( int  )

Definition at line 52 of file LArStackingAction.cxx.

References fStack.

53  : fstage(0)
54  , freqMuon(2)
55  , freqIsoMuon(0)
56  , freqIso(10)
57  , fangRoI(30.*CLHEP::deg)
58 {
59  //theMessenger = new LArStackingActionMessenger(this);
60  fStack = dum;
61  // Positive values effect action in this routine. Negative values
62  // effect action in G4BadIdeaAction.
63 
64 }
LArStackingAction::~LArStackingAction ( )
virtual

Definition at line 66 of file LArStackingAction.cxx.

67 { //delete theMessenger;
68 }

Member Function Documentation

G4ClassificationOfNewTrack LArStackingAction::ClassifyNewTrack ( const G4Track *  aTrack)
virtual

Definition at line 71 of file LArStackingAction.cxx.

References geo::GeometryCore::DetHalfHeight(), geo::GeometryCore::DetHalfWidth(), geo::GeometryCore::DetLength(), fStack, fstage, geo::GeometryCore::GetLArTPCVolumeName(), and InsideTPC().

72 {
73  G4ClassificationOfNewTrack classification = fWaiting;
75  TString volName(InsideTPC(aTrack));
76  Double_t buffer = 500; // Keep muNucl neutrals within 5m (for now) of larTPC.
77 
78  // These 3 for now for investigation in gdb.
79  //int pdg = aTrack->GetDefinition()->GetPDGEncoding();
80  int ppdg = aTrack->GetParentID();
81  TString process("NA");
82  if (ppdg) process = (TString)aTrack->GetCreatorProcess()->GetProcessName();
83 
84 
85  switch(fstage){
86  case 0: // Fstage 0 : Primary muons only
87  if (aTrack->GetParentID()==0)
88  {
89  G4ParticleDefinition *particleType = aTrack->GetDefinition();
90  if( ((particleType==G4MuonPlus::MuonPlusDefinition())
91  || (particleType==G4MuonMinus::MuonMinusDefinition())
92  )
93  && !volName.Contains("unknown")
94  ){
95  classification = fUrgent;
96  }
97  }
98  if (volName.Contains("unknown")) classification = fKill;
99  break;
100 
101  case 1: // Stage 1 : K0,Lambda,n's made urgent here.
102  // Suspended tracks will be sent to the waiting stack
103  if(aTrack->GetTrackStatus()==fSuspend) { break; }
104 
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"))
106  {
107 
108  const G4ThreeVector tr4Pos = aTrack->GetPosition();
109  // G4 returns positions in mm, have to convert to cm for LArSoft coordinate systems
110  const TVector3 trPos(tr4Pos.x()/CLHEP::cm,tr4Pos.y()/CLHEP::cm,tr4Pos.z()/CLHEP::cm);
111  //double locNeut = trPos.Mag();
112  classification = fUrgent;
113  // std::cout << "LArStackingAction: DetHalfWidth, Height, FullLength: " << geom->DetHalfWidth() << ", " << geom->DetHalfHeight() << ", " << geom->DetLength() << std::endl;
114 
115  if (
116  trPos.X() < (geom->DetHalfWidth()*2.0 + buffer) && trPos.X() > (-buffer) &&
117  trPos.Y() < (geom->DetHalfHeight()*2.0 + buffer) && trPos.Y() > (-geom->DetHalfHeight()*2.0 - buffer) &&
118  trPos.Z() < (geom->DetLength() + buffer) && trPos.Z() > (-buffer)
119  )
120 
121  { classification = fUrgent; break; }
122  // These tracks need to be "scored" cuz every now and then they
123  // might get to the LAr.
124  else
125  { classification = fKill; break; }
126 
127 
128  }
129 
130  // if(aTrack->GetDefinition()->GetPDGCharge()==0.) { break; }
131  if (volName.Contains("unknown")) classification = fKill;
132  break;
133 
134  default:
135  // Track all other Primaries. Accept all secondaries in TPC.
136  // Kill muon ionization electrons outside TPC
137  // ignore primaries since they have no creator process
138 
139  if(aTrack->GetParentID() == 0 && !volName.Contains("unknown")){
140  classification = fUrgent;
141  break;
142  }
143 
144  if(volName.Contains(geom->GetLArTPCVolumeName()) && aTrack->GetParentID()!=0)
145  {
146  classification = fUrgent;
147  if (fStack & 0x4 &&
148  aTrack->GetCreatorProcess()->GetProcessName().contains("muIoni")
149  )
150  {
151  classification = fKill;
152  }
153  break;
154  }
155  else if (volName.Contains("unknown") ){
156  classification = fKill;
157  break;
158  }
159  // Leave this here, even though I claim we've Killed these in stage 2.
160  if(aTrack->GetDefinition()->GetPDGEncoding()==11
161  && aTrack->GetCreatorProcess()->GetProcessName().contains("muIoni") )
162  {
163  classification = fKill;
164  break;
165  }
166  // For now, kill every other thing, no matter where it is.
167  classification = fKill;
168 
169  } // end switch
170 
171  return classification;
172 }
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)
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.
std::string GetLArTPCVolumeName(geo::TPCID const &tpcid) const
Return the name of specified LAr TPC volume.
G4int LArStackingAction::GetNIsolation ( ) const
inline

Definition at line 76 of file LArStackingAction.h.

References freqIso.

76 { return freqIso; }
G4int LArStackingAction::GetNRequestIsoMuon ( ) const
inline

Definition at line 74 of file LArStackingAction.h.

References freqIsoMuon.

74 { return freqIsoMuon; }
G4int LArStackingAction::GetNRequestMuon ( ) const
inline

Definition at line 72 of file LArStackingAction.h.

References freqMuon.

72 { return freqMuon; }
G4double LArStackingAction::GetRoIAngle ( ) const
inline

Definition at line 78 of file LArStackingAction.h.

References fangRoI.

78 { return fangRoI; }
std::string LArStackingAction::InsideTPC ( const G4Track *  aTrack)
private

Definition at line 175 of file LArStackingAction.cxx.

References geo::GeometryCore::VolumeName().

Referenced by ClassifyNewTrack().

176 {
177 
179  const G4ThreeVector tr4Pos = aTrack->GetPosition();
180 
181  // G4 returns positions in mm, have to convert to cm for LArSoft coordinate systems
182  const TVector3 trPos(tr4Pos.x()/CLHEP::cm,tr4Pos.y()/CLHEP::cm,tr4Pos.z()/CLHEP::cm);
183 
184  const std::string volName(geom->VolumeName(trPos));
185 
186  return volName;
187 }
std::string VolumeName(geo::Point_t const &point) const
Returns the name of the deepest volume containing specified point.
void LArStackingAction::NewStage ( )
virtual

Definition at line 190 of file LArStackingAction.cxx.

References fstage.

191 {
192 
193  // Here when Urgent stack is empty. Waiting stack about to be made Urgent,
194  // upon saying ReClassify().
195  fstage++;
196 
197  // I yanked the ExN04's use here of stackManager->clear(), which clears stack
198  // and prepares to end the event. Think I may wanna do something like this if
199  // muon has been tracked, its doca is large, there are no hit voxels in the TPC,
200  // and I'm in further need of optimization.
201 
202  if(fstage==1){
203  // Stage 0->1 : check if at least "reqMuon" hits on muon chamber
204  // otherwise abort current event
205 
206  stackManager->ReClassify();
207  return;
208  }
209 
210  else if(fstage==2){
211  // Stage 1->2 : check the isolation of muon tracks
212  // at least "reqIsoMuon" isolated muons
213  // otherwise abort current event.
214  // Isolation requires "reqIso" or less hits
215  // (including own hits) in the RoI region
216  // in the tracker layers.
217  stackManager->ReClassify();
218  return;
219  }
220 
221  else{
222  // Other stage change : just re-classify
223  stackManager->ReClassify();
224  }
225 }
void LArStackingAction::PrepareNewEvent ( )
virtual

Definition at line 227 of file LArStackingAction.cxx.

References fstage.

228 {
229  fstage = 0;
230  //trkHits = 0;
231  //muonHits = 0;
232 }
void LArStackingAction::SetNIsolation ( G4int  val)
inline

Definition at line 75 of file LArStackingAction.h.

75 { freqIso = val; }
void LArStackingAction::SetNRequestIsoMuon ( G4int  val)
inline

Definition at line 73 of file LArStackingAction.h.

73 { freqIsoMuon = val; }
void LArStackingAction::SetNRequestMuon ( G4int  val)
inline

Definition at line 71 of file LArStackingAction.h.

71 { freqMuon = val; }
void LArStackingAction::SetRoIAngle ( G4double  val)
inline

Definition at line 77 of file LArStackingAction.h.

77 { fangRoI = val; }

Member Data Documentation

G4double LArStackingAction::fangRoI
private

Definition at line 66 of file LArStackingAction.h.

Referenced by GetRoIAngle().

G4int LArStackingAction::freqIso
private

Definition at line 65 of file LArStackingAction.h.

Referenced by GetNIsolation().

G4int LArStackingAction::freqIsoMuon
private

Definition at line 64 of file LArStackingAction.h.

Referenced by GetNRequestIsoMuon().

G4int LArStackingAction::freqMuon
private

Definition at line 63 of file LArStackingAction.h.

Referenced by GetNRequestMuon().

G4int LArStackingAction::fStack

Definition at line 51 of file LArStackingAction.h.

Referenced by ClassifyNewTrack(), and LArStackingAction().

G4int LArStackingAction::fstage
private

Definition at line 62 of file LArStackingAction.h.

Referenced by ClassifyNewTrack(), NewStage(), and PrepareNewEvent().


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