EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EicDircOpBoundaryProcess.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4EicDircOpBoundaryProcess.cc
2 
3 #include <Geant4/G4Step.hh>
4 #include <Geant4/G4TouchableHistory.hh>
5 #include <Geant4/G4Track.hh>
6 
7 #include <set>
8 
9 G4VParticleChange* G4EicDircOpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
10 {
11  G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
12  G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
13  G4VParticleChange* pParticleChange = G4OpBoundaryProcess::PostStepDoIt(aTrack, aStep);
14  // static std::set<std::string> prevol;
15  // static std::set<std::string> postvol;
16  // std::string prevolnam = pPreStepPoint->GetPhysicalVolume()->GetName();
17  // if (prevol.find(prevolnam) == prevol.end())
18  // {
19  // std::cout << "PreStep in " <<prevolnam << std::endl;
20  // prevol.insert(prevolnam);
21  // }
22  // std::string postvolnam = pPostStepPoint->GetPhysicalVolume()->GetName();
23  // if (postvol.find(postvolnam) == postvol.end())
24  // {
25  // std::cout << "PostStep in " <<postvolnam << std::endl;
26  // postvol.insert(postvolnam);
27  // }
28 
29  // int parentId = aTrack.GetParentID();
30  // std::cout<<"parentId "<<parentId <<std::endl;
31  // if(parentId==1) pParticleChange->ProposeTrackStatus(fStopAndKill);
32 
33  /*double endofbar = 0.5*(4200+4*0.05); //1250/2.;
34 
35  // ideal focusing
36 // if(PrtManager::Instance()->GetLens() == 10)
37 {
38  G4ThreeVector theGlobalPoint1 = pPostStepPoint->GetPosition();
39  G4TouchableHistory* touchable = (G4TouchableHistory*)(pPostStepPoint->GetTouchable());
40  G4ThreeVector lpoint = touchable->GetHistory()->GetTransform( 1 ).TransformPoint(theGlobalPoint1);
41  if(lpoint.getZ() < endofbar+0.0001 && lpoint.getZ() > endofbar-0.0001){
42  G4ThreeVector ww = pPreStepPoint->GetTouchableHandle()->GetHistory()->
43  GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0,0,endofbar));
44 
45  if(aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName()!="wGlue")
46  pParticleChange->ProposeTrackStatus(fStopAndKill);
47  else
48  aParticleChange.ProposePosition(ww.getX(), ww.getY(),lpoint.getZ()-0.0005);
49  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
50  }
51  }
52 
53  {
54  pParticleChange->ProposeTrackStatus(fStopAndKill);
55  if(pPreStepPoint->GetPosition().z() < endofbar) pParticleChange->ProposeTrackStatus(fStopAndKill);
56  }
57 
58  if(aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName()=="wExpVol" && pPostStepPoint->GetPosition().z()<pPreStepPoint->GetPosition().z()){
59  pParticleChange->ProposeTrackStatus(fStopAndKill);
60  }*/
61 
62  if (aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName() == "wLens3" && pPostStepPoint->GetPosition().z() > pPreStepPoint->GetPosition().z())
63  {
64  pParticleChange->ProposeTrackStatus(fStopAndKill);
65  }
66 
67  // kill photons outside bar and prizm
68 
69  if (GetStatus() == FresnelRefraction && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName() == "wDirc")
70  {
71  pParticleChange->ProposeTrackStatus(fStopAndKill);
72  }
73 
74  if ((aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName() == "wLens1" || aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName() == "wLens2") && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName() == "wDirc")
75  {
76  pParticleChange->ProposeTrackStatus(fStopAndKill);
77  }
78 
79  // // black edge of the lens3
80  // if((aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName()=="wLens3"
81  // && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName()=="wDirc")
82  // || (aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName()=="wLens3"
83  // && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName()=="wLens3")){
84  // pParticleChange->ProposeTrackStatus(fStopAndKill);
85  // }
86 
87  if (aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName() == "wLens1" && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName() == "wLens1")
88  {
89  pParticleChange->ProposeTrackStatus(fStopAndKill);
90  }
91  if (aStep.GetPreStepPoint()->GetPhysicalVolume()->GetName() == "wLens2" && aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName() == "wLens2")
92  {
93  pParticleChange->ProposeTrackStatus(fStopAndKill);
94  }
95 
96  return pParticleChange;
97 }