14 #include "G4SDManager.hh"
17 #include "G4VProcess.hh"
25 #include "G4StepPoint.hh"
30 : theDebugLevel(theConf.getUntrackedParameter<int>(
"DebugLevel",0)),
31 theEnergyLossScalingFactor(theConf.getUntrackedParameter<double>(
"EnergyLossScalingFactor",1.0)),
32 theMPDebug(theConf.getUntrackedParameter<int>(
"MaterialPropertiesDebugLevel",0)),
33 theSiAbsLengthScale(theConf.getUntrackedParameter<double>(
"SiAbsorptionLengthScalingFactor",1.0)),
35 theMaterialProperties(),
36 thePrimaryGenerator(), theSteppingAction(),
37 theBarrelHits(0), theEndcapHits(0),
38 theParameterSet(theConf)
42 edm::LogInfo(
"SimLaserAlignmentSimulation") <<
" ***** AC1CMS: Configuration from ParameterSet ***** "
45 <<
"\n AC1CMS: theMPDebugLevel = " <<
theMPDebug
62 LogDebug(
"SimLaserAlignmentSimulation") <<
"<LaserAlignmentSimulation::update(const BeginOfRun * myRun)>"
63 <<
"\n ***** AC1CMS: Start of Run: " << (*myRun)()->GetRunID() <<
" ***** ";
81 G4SDManager * theSDManager = G4SDManager::GetSDMpointer();
82 theSDManager->ListTree();
88 LogDebug(
"SimLaserAlignmentSimulation") <<
"<LaserAlignmentSimulation::update(const BeginOfEvent * myEvent)>"
89 <<
"\n AC1CMS: Event number = " << (*myEvent)()->GetEventID();
105 LogDebug(
"SimLaserAlignmentSimulationStepping") <<
"<LaserAlignmentSimulation::update(const G4Step * myStep)>";
107 G4Step * theStep =
const_cast<G4Step*
>(myStep);
113 if ( ( theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()==
"OpAbsorption" ) )
115 LogDebug(
"SimLaserAlignmentSimulationStepping") <<
"<LaserAlignmentSimulation::update(const G4Step*)>: Photon was absorbed! ";
118 if ( theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector() )
120 LogDebug(
"SimLaserAlignmentSimulationStepping") <<
" AC1CMS: Setting the EnergyLoss to " << theStep->GetTotalEnergyDeposit()
121 <<
"\n AC1CMS: The z position is " << theStep->GetPreStepPoint()->GetPosition().z()
122 <<
"\n AC1CMS: the Sensitive Detector: "
123 << theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector()->GetName()
124 <<
"\n AC1CMS: the Material: " << theStep->GetPreStepPoint()->GetMaterial()->GetName()
125 <<
"\n AC1CMS: the Logical Volume: "
126 << theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
128 if (theStep->GetTotalEnergyDeposit() > 0.0)
132 (theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector());
134 theSD->
ProcessHits(theStep, ((G4TouchableHistory *)(theStep->GetPreStepPoint()->GetTouchable())));
138 if ( ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TECModule3RphiActive" ) ||
139 ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TECModule5RphiActive" ) )
143 else if ( ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TOBActiveSter0" ) ||
144 ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TOBActiveRphi0" ) ||
145 ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
"TIBActiveRphi2" ) )
153 LogDebug(
"SimLaserAlignmentSimulationStepping") <<
" AC1CMS: No SensitiveDetector available for this Step ... No Hit created :-( "
154 <<
"\n AC1CMS: The Material was: " << theStep->GetPreStepPoint()->GetMaterial()->GetName();
165 LogDebug(
"SimLaserAlignmentSimulation") <<
"<LaserAlignmentSimulation::update(const EndOfEvent * myEvent)>"
166 <<
"\n AC1CMS: End of Event " << (*myEvent)()->GetEventID();
170 <<
" (Barrel / Endcaps) *** ";
175 LogDebug(
"SimLaserAlignmentSimulation") <<
"<LaserAlignmentSimulation::update(const EndOfRun * myRun)>";
179 edm::LogInfo(
"SimLaserAlignmentSimulation") <<
" AC1CMS: Number of Events = " << (*myRun)()->GetNumberOfEventToBeProcessed()
181 <<
" ***** 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