All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
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 41 of file LArStackingAction.h.

Constructor & Destructor Documentation

LArStackingAction::LArStackingAction ( int  )

Definition at line 50 of file LArStackingAction.cxx.

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

Definition at line 64 of file LArStackingAction.cxx.

65 { //delete theMessenger;
66 }

Member Function Documentation

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

Definition at line 69 of file LArStackingAction.cxx.

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

Definition at line 77 of file LArStackingAction.h.

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

Definition at line 75 of file LArStackingAction.h.

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

Definition at line 73 of file LArStackingAction.h.

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

Definition at line 79 of file LArStackingAction.h.

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

Definition at line 173 of file LArStackingAction.cxx.

174 {
175 
176  art::ServiceHandle<geo::Geometry const> geom;
177  const G4ThreeVector tr4Pos = aTrack->GetPosition();
178 
179  // G4 returns positions in mm, have to convert to cm for LArSoft coordinate systems
180  const TVector3 trPos(tr4Pos.x()/CLHEP::cm,tr4Pos.y()/CLHEP::cm,tr4Pos.z()/CLHEP::cm);
181 
182  const std::string volName(geom->VolumeName(trPos));
183 
184  return volName;
185 }
void LArStackingAction::NewStage ( )
virtual

Definition at line 188 of file LArStackingAction.cxx.

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

Definition at line 225 of file LArStackingAction.cxx.

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

Definition at line 76 of file LArStackingAction.h.

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

Definition at line 74 of file LArStackingAction.h.

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

Definition at line 72 of file LArStackingAction.h.

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

Definition at line 78 of file LArStackingAction.h.

78 { fangRoI = val; }

Member Data Documentation

G4double LArStackingAction::fangRoI
private

Definition at line 67 of file LArStackingAction.h.

G4int LArStackingAction::freqIso
private

Definition at line 66 of file LArStackingAction.h.

G4int LArStackingAction::freqIsoMuon
private

Definition at line 65 of file LArStackingAction.h.

G4int LArStackingAction::freqMuon
private

Definition at line 64 of file LArStackingAction.h.

G4int LArStackingAction::fStack

Definition at line 52 of file LArStackingAction.h.

G4int LArStackingAction::fstage
private

Definition at line 63 of file LArStackingAction.h.


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