14 #include "G4SDManager.hh" 17 #include "G4VProcess.hh" 23 #include "G4StepPoint.hh" 28 : theDebugLevel(theConf.getUntrackedParameter<
int>(
"DebugLevel",0)),
29 theEnergyLossScalingFactor(theConf.getUntrackedParameter<double>(
"EnergyLossScalingFactor",1.0)),
30 theMPDebug(theConf.getUntrackedParameter<
int>(
"MaterialPropertiesDebugLevel",0)),
31 theSiAbsLengthScale(theConf.getUntrackedParameter<double>(
"SiAbsorptionLengthScalingFactor",1.0)),
33 theMaterialProperties(),
34 thePrimaryGenerator(), theSteppingAction(),
35 theBarrelHits(0), theEndcapHits(0),
36 theParameterSet(theConf)
40 edm::LogInfo(
"SimLaserAlignmentSimulation") <<
" ***** AC1CMS: Configuration from ParameterSet ***** " 43 <<
"\n AC1CMS: theMPDebugLevel = " <<
theMPDebug 60 LogDebug(
"SimLaserAlignmentSimulation") <<
"<LaserAlignmentSimulation::update(const BeginOfRun * myRun)>" 61 <<
"\n ***** AC1CMS: Start of Run: " << (*myRun)()->GetRunID() <<
" ***** ";
79 G4SDManager * theSDManager = G4SDManager::GetSDMpointer();
80 theSDManager->ListTree();
86 LogDebug(
"SimLaserAlignmentSimulation") <<
"<LaserAlignmentSimulation::update(const BeginOfEvent * myEvent)>" 87 <<
"\n AC1CMS: Event number = " << (*myEvent)()->GetEventID();
103 LogDebug(
"SimLaserAlignmentSimulationStepping") <<
"<LaserAlignmentSimulation::update(const G4Step * myStep)>";
105 G4Step * theStep =
const_cast<G4Step*
>(myStep);
111 if ( ( theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()==
"OpAbsorption" ) )
113 LogDebug(
"SimLaserAlignmentSimulationStepping") <<
"<LaserAlignmentSimulation::update(const G4Step*)>: Photon was absorbed! ";
116 if ( theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector() )
118 LogDebug(
"SimLaserAlignmentSimulationStepping") <<
" AC1CMS: Setting the EnergyLoss to " << theStep->GetTotalEnergyDeposit()
119 <<
"\n AC1CMS: The z position is " << theStep->GetPreStepPoint()->GetPosition().z()
120 <<
"\n AC1CMS: the Sensitive Detector: " 121 << theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector()->GetName()
122 <<
"\n AC1CMS: the Material: " << theStep->GetPreStepPoint()->GetMaterial()->GetName()
123 <<
"\n AC1CMS: the Logical Volume: " 124 << theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
126 if (theStep->GetTotalEnergyDeposit() > 0.0)
130 (theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector());
132 theSD->
ProcessHits(theStep, ((G4TouchableHistory *)(theStep->GetPreStepPoint()->GetTouchable())));
136 if ( ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TECModule3RphiActive" ) ||
137 ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TECModule5RphiActive" ) )
141 else if ( ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TOBActiveSter0" ) ||
142 ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TOBActiveRphi0" ) ||
143 ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TIBActiveRphi2" ) )
151 LogDebug(
"SimLaserAlignmentSimulationStepping") <<
" AC1CMS: No SensitiveDetector available for this Step ... No Hit created :-( " 152 <<
"\n AC1CMS: The Material was: " << theStep->GetPreStepPoint()->GetMaterial()->GetName();
163 LogDebug(
"SimLaserAlignmentSimulation") <<
"<LaserAlignmentSimulation::update(const EndOfEvent * myEvent)>" 164 <<
"\n AC1CMS: End of Event " << (*myEvent)()->GetEventID();
168 <<
" (Barrel / Endcaps) *** ";
173 LogDebug(
"SimLaserAlignmentSimulation") <<
"<LaserAlignmentSimulation::update(const EndOfRun * myRun)>";
177 edm::LogInfo(
"SimLaserAlignmentSimulation") <<
" AC1CMS: Number of Events = " << (*myRun)()->GetNumberOfEventToBeProcessed()
179 <<
" ***** AC1CMS: End of Run: " << (*myRun)()->GetRunID() <<
" ***** ";
#define DEFINE_SIMWATCHER(type)
virtual bool ProcessHits(G4Step *, G4TouchableHistory *)
double theSiAbsLengthScale
virtual void UserSteppingAction(const G4Step *myStep)
stepping action: set energydeposit when a photon is absorbed in a Si module
virtual ~LaserAlignmentSimulation()
destructor
double theEnergyLossScalingFactor
void update(const BeginOfRun *myRun)
observer for BeginOfRun
LaserAlignmentSimulation(edm::ParameterSet const &theConf)
constructor
LaserPrimaryGeneratorAction * thePrimaryGenerator
MaterialProperties * theMaterialProperties
LaserSteppingAction * theSteppingAction
void GeneratePrimaries(G4Event *myEvent)
call the corresponding GeneratePrimaries routines for both TEC's and the Barrel
edm::ParameterSet theParameterSet