10 #include "G4ParticleTypes.hh" 15 : theDebugLevel(theConf.getUntrackedParameter<
int>(
"DebugLevel",0)),
16 theEnergyLossScalingFactor(theConf.getUntrackedParameter<double>(
"EnergyLossScalingFactor",1.0))
26 G4Step * theStep =
const_cast<G4Step*
>(myStep);
28 G4Track * theTrack = theStep->GetTrack();
32 G4TrackStatus isGood = theTrack->GetTrackStatus();
34 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: the PreStep Material = " 35 << theStep->GetPreStepPoint()->GetMaterial()->GetName()
36 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: The Track Status = " << isGood;
37 if ( isGood == fStopAndKill )
38 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: Track Status = fStopAndKill ";
40 if ( theStep->GetPreStepPoint()->GetProcessDefinedStep() != 0 )
41 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: PreStep Process = " 42 << theStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
43 if ( theStep->GetPostStepPoint()->GetProcessDefinedStep() != 0 )
44 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: PostStep Process = " 45 << theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
50 if ( ( theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()==
"OpAbsorption" ) )
52 LogDebug(
"LaserAlignmentStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step*)>: Photon was absorbed! ";
54 if ( theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector() )
60 if ( ( (theStep->GetPreStepPoint()->GetPosition().z() > 1262.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1382.5 )
61 || (theStep->GetPreStepPoint()->GetPosition().z() < -1262.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1382.5 ) )
62 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
63 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
64 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 3.66 )
65 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.23 )
66 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.80 ) ) ) )
67 { theStep->AddTotalEnergyDeposit(EnergyLoss); }
69 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1262.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1382.5 )
70 || (theStep->GetPreStepPoint()->GetPosition().z() < -1262.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1382.5 ) )
71 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2*0.2)); }
73 else if ( ( (theStep->GetPreStepPoint()->GetPosition().z() > 1402.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1522.5 )
74 || (theStep->GetPreStepPoint()->GetPosition().z() < -1402.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1522.5 ) )
75 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
76 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
77 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 3.66 )
78 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.23 )
79 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.80 ) ) ) )
80 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2)); }
82 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1402.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1522.5 )
83 || (theStep->GetPreStepPoint()->GetPosition().z() < -1402.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1522.5 ) )
84 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2)); }
86 else if ( ( (theStep->GetPreStepPoint()->GetPosition().z() > 1542.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1662.5 )
87 || (theStep->GetPreStepPoint()->GetPosition().z() < -1542.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1662.5 ) )
88 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
89 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
90 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 3.66 )
91 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.23 )
92 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.80 ) ) ) )
93 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2)); }
95 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1542.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1662.5 )
96 || (theStep->GetPreStepPoint()->GetPosition().z() < -1542.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1662.5 ) )
97 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2)); }
99 else if ( ( (theStep->GetPreStepPoint()->GetPosition().z() > 1682.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1802.5 )
100 || (theStep->GetPreStepPoint()->GetPosition().z() < -1682.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1802.5 ) )
101 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
102 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
103 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 3.66 )
104 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.23 )
105 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.80 ) ) ) )
106 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2)); }
108 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1682.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1802.5 )
109 || (theStep->GetPreStepPoint()->GetPosition().z() < -1682.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1802.5 ) )
110 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2)); }
112 else if ( ( ( theStep->GetPreStepPoint()->GetPosition().z() > 1822.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1942.5 )
113 || ( theStep->GetPreStepPoint()->GetPosition().z() < -1822.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1942.5 ) )
114 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
115 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
116 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 3.66 )
117 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.23 )
118 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*
M_PI < 5.80 ) ) ) )
119 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2*0.2)); }
121 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1822.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1942.5 )
122 || (theStep->GetPreStepPoint()->GetPosition().z() < -1822.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1942.5 ) )
123 { theStep->AddTotalEnergyDeposit(EnergyLoss); }
125 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1997.5 && theStep->GetPreStepPoint()->GetPosition().z() < 2117.5 )
126 || (theStep->GetPreStepPoint()->GetPosition().z() < -1997.5 && theStep->GetPreStepPoint()->GetPosition().z() > -2117.5 ) )
127 { theStep->AddTotalEnergyDeposit(EnergyLoss); }
129 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 2187.5 && theStep->GetPreStepPoint()->GetPosition().z() < 2307.5 )
130 || (theStep->GetPreStepPoint()->GetPosition().z() < -2187.5 && theStep->GetPreStepPoint()->GetPosition().z() > -2307.5 ) )
131 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2)); }
133 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 2392.5 && theStep->GetPreStepPoint()->GetPosition().z() < 2512.5 )
134 || (theStep->GetPreStepPoint()->GetPosition().z() < -2392.5 && theStep->GetPreStepPoint()->GetPosition().z() > -2512.5 ) )
135 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2)); }
137 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 2607.5 && theStep->GetPreStepPoint()->GetPosition().z() < 2727.5 )
138 || (theStep->GetPreStepPoint()->GetPosition().z() < -2607.5 && theStep->GetPreStepPoint()->GetPosition().z() > -2727.5 ) )
139 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2)); }
141 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > -870.0 && theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
142 (theStep->GetPreStepPoint()->GetPosition().perp() > 500.0 && theStep->GetPreStepPoint()->GetPosition().perp() < 630.0) )
143 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2)); }
148 theStep->ResetTotalEnergyDeposit();
156 else if ( ( (theStep->GetPreStepPoint()->GetMaterial()->GetName() ==
"TOB_Wafer") &&
157 (theStep->GetPostStepPoint()->GetMaterial()->GetName() ==
"Air") ) )
159 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! ";
160 theTrack->SetTrackStatus(fStopAndKill);
162 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > -870.0 &&
163 theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
164 (theStep->GetPreStepPoint()->GetPosition().perp() > 630.0) )
166 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! ";
167 theTrack->SetTrackStatus(fStopAndKill);
172 else if ( ( (theStep->GetPreStepPoint()->GetMaterial()->GetName() ==
"TIB_Wafer") &&
173 (theStep->GetPostStepPoint()->GetMaterial()->GetName() ==
"Air") ) )
175 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! ";
176 theTrack->SetTrackStatus(fStopAndKill);
178 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > -870.0 &&
179 theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
180 (theStep->GetPreStepPoint()->GetPosition().perp() < 500.0) )
182 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! ";
183 theTrack->SetTrackStatus(fStopAndKill);
187 else if ( ( ( (theStep->GetPreStepPoint()->GetMaterial()->GetName() ==
"TEC_Wafer") &&
188 (theStep->GetPostStepPoint()->GetMaterial()->GetName() ==
"T_Air") ) ||
189 ( (theStep->GetPreStepPoint()->GetMaterial()->GetName() ==
"TEC_Wafer") &&
190 (theStep->GetPostStepPoint()->GetMaterial()->GetName() ==
"Air") ) ) &&
191 (theStep->GetPreStepPoint()->GetMomentum().z() != theStep->GetPostStepPoint()->GetMomentum().z() ) &&
192 (theStep->GetPostStepPoint()->GetPosition().z() == -1137.25) )
194 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! photon in wrong direction";
195 theTrack->SetTrackStatus(fStopAndKill);
199 else if ( ( theStep->GetPostStepPoint()->GetPosition().z() > -1100.0 )
200 && ( theStep->GetPostStepPoint()->GetPosition().z() < 1100.0 )
201 && ( theStep->GetPostStepPoint()->GetMomentumDirection().z() > 0.8 ) )
203 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! photon in wrong direction";
204 theTrack->SetTrackStatus(fStopAndKill);
208 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping continuous ... ";
214 if ( theTrack->GetTrackStatus() != fAlive )
216 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: Track is not alive! -> return ";
221 if ( theTrack->GetParentID() != 0 )
223 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: Track is not a primary! -> return ";
230 G4ParticleDefinition * theOpticalType = theTrack->GetDefinition();
231 if ( theOpticalType == G4OpticalPhoton::OpticalPhotonDefinition() )
233 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: Optical Photon found! ";
237 G4StepPoint * thePreStepPoint = theStep->GetPreStepPoint();
238 G4VPhysicalVolume * thePreStepPhysicalVolume = thePreStepPoint->GetPhysicalVolume();
239 G4String thePreStepPhysicalVolumeName = thePreStepPhysicalVolume->GetName();
240 G4Material * thePreStepMaterial = thePreStepPoint->GetMaterial();
242 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PreStep Position = " << thePreStepPoint->GetPosition()
243 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PreStep Physical Volume = " << thePreStepPhysicalVolumeName
244 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PreStep Material =" << thePreStepMaterial->GetName();
246 G4StepPoint * thePostStepPoint = theStep->GetPostStepPoint();
247 G4VPhysicalVolume * thePostStepPhysicalVolume = thePostStepPoint->GetPhysicalVolume();
248 G4String thePostStepPhysicalVolumeName = thePostStepPhysicalVolume->GetName();
249 G4Material * thePostStepMaterial = thePostStepPoint->GetMaterial();
251 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PostStep Position = " << thePostStepPoint->GetPosition()
252 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PostStep Physical Volume = " << thePostStepPhysicalVolumeName
253 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PostStep Material = " << thePostStepMaterial->GetName();
virtual void UserSteppingAction(const G4Step *myStep)
stepping action: set energydeposit when a photon is absorbed in a Si module
virtual ~LaserSteppingAction()
destructor
double theEnergyLossScalingFactor
LaserSteppingAction(edm::ParameterSet const &theConf)
constructor