Go to the documentation of this file.00001
00009 #include "Alignment/LaserAlignmentSimulation/interface/LaserSteppingAction.h"
00010 #include "G4ParticleTypes.hh"
00011
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013
00014 LaserSteppingAction::LaserSteppingAction(edm::ParameterSet const& theConf)
00015 : theDebugLevel(theConf.getUntrackedParameter<int>("DebugLevel",0)),
00016 theEnergyLossScalingFactor(theConf.getUntrackedParameter<double>("EnergyLossScalingFactor",1.0))
00017 {
00018 }
00019
00020 LaserSteppingAction::~LaserSteppingAction()
00021 {
00022 }
00023
00024 void LaserSteppingAction::UserSteppingAction(const G4Step * myStep)
00025 {
00026 G4Step * theStep = const_cast<G4Step*>(myStep);
00027
00028 G4Track * theTrack = theStep->GetTrack();
00029
00030
00031 {
00032 G4TrackStatus isGood = theTrack->GetTrackStatus();
00033
00034 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: the PreStep Material = "
00035 << theStep->GetPreStepPoint()->GetMaterial()->GetName()
00036 << "\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: The Track Status = " << isGood;
00037 if ( isGood == fStopAndKill )
00038 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: Track Status = fStopAndKill ";
00039
00040 if ( theStep->GetPreStepPoint()->GetProcessDefinedStep() != 0 )
00041 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: PreStep Process = "
00042 << theStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
00043 if ( theStep->GetPostStepPoint()->GetProcessDefinedStep() != 0 )
00044 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: PostStep Process = "
00045 << theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
00046 }
00047
00048
00049
00050 if ( ( theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()== "OpAbsorption" ) )
00051 {
00052 LogDebug("LaserAlignmentStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step*)>: Photon was absorbed! ";
00053
00054 if ( theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector() )
00055 {
00056 double EnergyLoss = theEnergyLossScalingFactor * theTrack->GetTotalEnergy();
00057
00058
00059
00060 if ( ( (theStep->GetPreStepPoint()->GetPosition().z() > 1262.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1382.5 )
00061 || (theStep->GetPreStepPoint()->GetPosition().z() < -1262.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1382.5 ) )
00062 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
00063 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
00064 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 3.66 )
00065 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.23 )
00066 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.80 ) ) ) )
00067 { theStep->AddTotalEnergyDeposit(EnergyLoss); }
00068
00069 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1262.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1382.5 )
00070 || (theStep->GetPreStepPoint()->GetPosition().z() < -1262.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1382.5 ) )
00071 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2*0.2)); }
00072
00073 else if ( ( (theStep->GetPreStepPoint()->GetPosition().z() > 1402.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1522.5 )
00074 || (theStep->GetPreStepPoint()->GetPosition().z() < -1402.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1522.5 ) )
00075 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
00076 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
00077 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 3.66 )
00078 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.23 )
00079 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.80 ) ) ) )
00080 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2)); }
00081
00082 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1402.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1522.5 )
00083 || (theStep->GetPreStepPoint()->GetPosition().z() < -1402.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1522.5 ) )
00084 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2)); }
00085
00086 else if ( ( (theStep->GetPreStepPoint()->GetPosition().z() > 1542.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1662.5 )
00087 || (theStep->GetPreStepPoint()->GetPosition().z() < -1542.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1662.5 ) )
00088 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
00089 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
00090 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 3.66 )
00091 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.23 )
00092 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.80 ) ) ) )
00093 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2)); }
00094
00095 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1542.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1662.5 )
00096 || (theStep->GetPreStepPoint()->GetPosition().z() < -1542.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1662.5 ) )
00097 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2)); }
00098
00099 else if ( ( (theStep->GetPreStepPoint()->GetPosition().z() > 1682.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1802.5 )
00100 || (theStep->GetPreStepPoint()->GetPosition().z() < -1682.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1802.5 ) )
00101 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
00102 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
00103 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 3.66 )
00104 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.23 )
00105 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.80 ) ) ) )
00106 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2)); }
00107
00108 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1682.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1802.5 )
00109 || (theStep->GetPreStepPoint()->GetPosition().z() < -1682.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1802.5 ) )
00110 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2)); }
00111
00112 else if ( ( ( theStep->GetPreStepPoint()->GetPosition().z() > 1822.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1942.5 )
00113 || ( theStep->GetPreStepPoint()->GetPosition().z() < -1822.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1942.5 ) )
00114 && ( ( ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.295 )
00115 || ( theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 && theStep->GetPreStepPoint()->GetPosition().phi() < 1.86 )
00116 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 3.63 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 3.66 )
00117 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.20 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.23 )
00118 || ( theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI > 5.76 && theStep->GetPreStepPoint()->GetPosition().phi() + 2.0*M_PI < 5.80 ) ) ) )
00119 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2*0.2)); }
00120
00121 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1822.5 && theStep->GetPreStepPoint()->GetPosition().z() < 1942.5 )
00122 || (theStep->GetPreStepPoint()->GetPosition().z() < -1822.5 && theStep->GetPreStepPoint()->GetPosition().z() > -1942.5 ) )
00123 { theStep->AddTotalEnergyDeposit(EnergyLoss); }
00124
00125 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 1997.5 && theStep->GetPreStepPoint()->GetPosition().z() < 2117.5 )
00126 || (theStep->GetPreStepPoint()->GetPosition().z() < -1997.5 && theStep->GetPreStepPoint()->GetPosition().z() > -2117.5 ) )
00127 { theStep->AddTotalEnergyDeposit(EnergyLoss); }
00128
00129 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 2187.5 && theStep->GetPreStepPoint()->GetPosition().z() < 2307.5 )
00130 || (theStep->GetPreStepPoint()->GetPosition().z() < -2187.5 && theStep->GetPreStepPoint()->GetPosition().z() > -2307.5 ) )
00131 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2)); }
00132
00133 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 2392.5 && theStep->GetPreStepPoint()->GetPosition().z() < 2512.5 )
00134 || (theStep->GetPreStepPoint()->GetPosition().z() < -2392.5 && theStep->GetPreStepPoint()->GetPosition().z() > -2512.5 ) )
00135 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2)); }
00136
00137 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > 2607.5 && theStep->GetPreStepPoint()->GetPosition().z() < 2727.5 )
00138 || (theStep->GetPreStepPoint()->GetPosition().z() < -2607.5 && theStep->GetPreStepPoint()->GetPosition().z() > -2727.5 ) )
00139 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2*0.2)); }
00140
00141 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > -870.0 && theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
00142 (theStep->GetPreStepPoint()->GetPosition().perp() > 500.0 && theStep->GetPreStepPoint()->GetPosition().perp() < 630.0) )
00143 { theStep->AddTotalEnergyDeposit(EnergyLoss/(0.2*0.2)); }
00144 else
00145 {
00146
00147
00148 theStep->ResetTotalEnergyDeposit();
00149 }
00150 }
00151 }
00152
00153
00154
00155
00156 else if ( ( (theStep->GetPreStepPoint()->GetMaterial()->GetName() == "TOB_Wafer") &&
00157 (theStep->GetPostStepPoint()->GetMaterial()->GetName() == "Air") ) )
00158 {
00159 LogDebug("LaserAlignmentSimulationStepping") << " AC1CMS: stepping aborted! ";
00160 theTrack->SetTrackStatus(fStopAndKill);
00161 }
00162 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > -870.0 &&
00163 theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
00164 (theStep->GetPreStepPoint()->GetPosition().perp() > 630.0) )
00165 {
00166 LogDebug("LaserAlignmentSimulationStepping") << " AC1CMS: stepping aborted! ";
00167 theTrack->SetTrackStatus(fStopAndKill);
00168 }
00169
00170
00171
00172 else if ( ( (theStep->GetPreStepPoint()->GetMaterial()->GetName() == "TIB_Wafer") &&
00173 (theStep->GetPostStepPoint()->GetMaterial()->GetName() == "Air") ) )
00174 {
00175 LogDebug("LaserAlignmentSimulationStepping") << " AC1CMS: stepping aborted! ";
00176 theTrack->SetTrackStatus(fStopAndKill);
00177 }
00178 else if ( (theStep->GetPreStepPoint()->GetPosition().z() > -870.0 &&
00179 theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
00180 (theStep->GetPreStepPoint()->GetPosition().perp() < 500.0) )
00181 {
00182 LogDebug("LaserAlignmentSimulationStepping") << " AC1CMS: stepping aborted! ";
00183 theTrack->SetTrackStatus(fStopAndKill);
00184 }
00185
00186
00187 else if ( ( ( (theStep->GetPreStepPoint()->GetMaterial()->GetName() == "TEC_Wafer") &&
00188 (theStep->GetPostStepPoint()->GetMaterial()->GetName() == "T_Air") ) ||
00189 ( (theStep->GetPreStepPoint()->GetMaterial()->GetName() == "TEC_Wafer") &&
00190 (theStep->GetPostStepPoint()->GetMaterial()->GetName() == "Air") ) ) &&
00191 (theStep->GetPreStepPoint()->GetMomentum().z() != theStep->GetPostStepPoint()->GetMomentum().z() ) &&
00192 (theStep->GetPostStepPoint()->GetPosition().z() == -1137.25) )
00193 {
00194 LogDebug("LaserAlignmentSimulationStepping") << " AC1CMS: stepping aborted! photon in wrong direction";
00195 theTrack->SetTrackStatus(fStopAndKill);
00196 }
00197
00198
00199 else if ( ( theStep->GetPostStepPoint()->GetPosition().z() > -1100.0 )
00200 && ( theStep->GetPostStepPoint()->GetPosition().z() < 1100.0 )
00201 && ( theStep->GetPostStepPoint()->GetMomentumDirection().z() > 0.8 ) )
00202 {
00203 LogDebug("LaserAlignmentSimulationStepping") << " AC1CMS: stepping aborted! photon in wrong direction";
00204 theTrack->SetTrackStatus(fStopAndKill);
00205 }
00206 else
00207 {
00208 LogDebug("LaserAlignmentSimulationStepping") << " AC1CMS: stepping continuous ... ";
00209 }
00210
00211
00212
00213
00214 if ( theTrack->GetTrackStatus() != fAlive )
00215 {
00216 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: Track is not alive! -> return ";
00217 return;
00218 }
00219
00220
00221 if ( theTrack->GetParentID() != 0 )
00222 {
00223 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: Track is not a primary! -> return ";
00224 return;
00225 }
00226
00227
00228 if ( theDebugLevel >= 4 )
00229 {
00230 G4ParticleDefinition * theOpticalType = theTrack->GetDefinition();
00231 if ( theOpticalType == G4OpticalPhoton::OpticalPhotonDefinition() )
00232 {
00233 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: Optical Photon found! ";
00234 }
00235
00236
00237 G4StepPoint * thePreStepPoint = theStep->GetPreStepPoint();
00238 G4VPhysicalVolume * thePreStepPhysicalVolume = thePreStepPoint->GetPhysicalVolume();
00239 G4String thePreStepPhysicalVolumeName = thePreStepPhysicalVolume->GetName();
00240 G4Material * thePreStepMaterial = thePreStepPoint->GetMaterial();
00241
00242 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PreStep Position = " << thePreStepPoint->GetPosition()
00243 << "\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PreStep Physical Volume = " << thePreStepPhysicalVolumeName
00244 << "\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PreStep Material =" << thePreStepMaterial->GetName();
00245
00246 G4StepPoint * thePostStepPoint = theStep->GetPostStepPoint();
00247 G4VPhysicalVolume * thePostStepPhysicalVolume = thePostStepPoint->GetPhysicalVolume();
00248 G4String thePostStepPhysicalVolumeName = thePostStepPhysicalVolume->GetName();
00249 G4Material * thePostStepMaterial = thePostStepPoint->GetMaterial();
00250
00251 LogDebug("LaserAlignmentSimulationStepping") << "<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PostStep Position = " << thePostStepPoint->GetPosition()
00252 << "\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PostStep Physical Volume = " << thePostStepPhysicalVolumeName
00253 << "\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the PostStep Material = " << thePostStepMaterial->GetName();
00254 }
00255 }