CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
LaserAlignmentSimulation Class Reference

#include <LaserAlignmentSimulation.h>

Inheritance diagram for LaserAlignmentSimulation:
SimWatcher Observer< const EndOfTrack *> Observer< const BeginOfTrack *> Observer< const EndOfRun *> Observer< const EndOfEvent *> Observer< const G4Step *> Observer< const BeginOfEvent *> Observer< const BeginOfRun *>

Public Member Functions

 LaserAlignmentSimulation (edm::ParameterSet const &theConf)
 constructor More...
 
void update (const BeginOfRun *myRun) override
 observer for BeginOfRun More...
 
void update (const BeginOfEvent *myEvent) override
 observer for BeginOfEvent More...
 
void update (const G4Step *myStep) override
 observer for G4Step More...
 
void update (const EndOfEvent *myEvent) override
 observer for EndOfEvent More...
 
void update (const EndOfRun *myRun) override
 observer for EndOfRun More...
 
void update (const BeginOfTrack *myTrack) override
 observer for BeginOfTrack More...
 
void update (const EndOfTrack *myTrack) override
 observer for EndOfTrack More...
 
 ~LaserAlignmentSimulation () override
 destructor More...
 
- Public Member Functions inherited from Observer< const BeginOfRun *>
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent *>
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step *>
 Observer ()
 
void slotForUpdate (const G4Step * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent *>
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfRun *>
 Observer ()
 
void slotForUpdate (const EndOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack *>
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack *>
 Observer ()
 
void slotForUpdate (const EndOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from SimWatcher
virtual void beginRun (edm::EventSetup const &)
 
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
virtual void registerConsumes (edm::ConsumesCollector)
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
virtual ~SimWatcher ()
 

Private Attributes

int theBarrelHits
 
int theDebugLevel
 
int theEndcapHits
 
double theEnergyLossScalingFactor
 
MaterialPropertiestheMaterialProperties
 
int theMPDebug
 
edm::ParameterSet theParameterSet
 
LaserPrimaryGeneratorActionthePrimaryGenerator
 
double theSiAbsLengthScale
 
LaserSteppingActiontheSteppingAction
 
G4Timer * theTimer
 

Additional Inherited Members

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

SimWatcher for the simulation of the Laser Alignment System of the CMS Tracker

Date
2007/03/20 12:01:00
Revision
1.3
Author
Maarten Thomas

Definition at line 42 of file LaserAlignmentSimulation.h.

Constructor & Destructor Documentation

◆ LaserAlignmentSimulation()

LaserAlignmentSimulation::LaserAlignmentSimulation ( edm::ParameterSet const &  theConf)
explicit

constructor

Definition at line 25 of file LaserAlignmentSimulation.cc.

References theDebugLevel, theEnergyLossScalingFactor, theMPDebug, theSiAbsLengthScale, and theTimer.

26  : theDebugLevel(theConf.getUntrackedParameter<int>("DebugLevel", 0)),
27  theEnergyLossScalingFactor(theConf.getUntrackedParameter<double>("EnergyLossScalingFactor", 1.0)),
28  theMPDebug(theConf.getUntrackedParameter<int>("MaterialPropertiesDebugLevel", 0)),
29  theSiAbsLengthScale(theConf.getUntrackedParameter<double>("SiAbsorptionLengthScalingFactor", 1.0)),
30  theTimer(),
34  theBarrelHits(0),
35  theEndcapHits(0),
36  theParameterSet(theConf) {
37  // make some noise
38  edm::LogInfo("SimLaserAlignmentSimulation")
39  << " ***** AC1CMS: Configuration from ParameterSet ***** "
40  << "\n AC1CMS: theDebugLevel = " << theDebugLevel
41  << "\n AC1CMS: theEnergyLossScalingFactor = " << theEnergyLossScalingFactor
42  << "\n AC1CMS: theMPDebugLevel = " << theMPDebug
43  << "\n AC1CMS: theSiAbsLengthScalingFactor = " << theSiAbsLengthScale;
44 
45  // declare timer
46  theTimer = new G4Timer;
47 }
Log< level::Info, false > LogInfo
LaserPrimaryGeneratorAction * thePrimaryGenerator
MaterialProperties * theMaterialProperties
LaserSteppingAction * theSteppingAction

◆ ~LaserAlignmentSimulation()

LaserAlignmentSimulation::~LaserAlignmentSimulation ( )
override

destructor

Definition at line 49 of file LaserAlignmentSimulation.cc.

References theMaterialProperties, thePrimaryGenerator, theSteppingAction, and theTimer.

49  {
50  if (theMaterialProperties != nullptr) {
51  delete theMaterialProperties;
52  }
53  if (theSteppingAction != nullptr) {
54  delete theSteppingAction;
55  }
56  if (thePrimaryGenerator != nullptr) {
57  delete thePrimaryGenerator;
58  }
59  if (theTimer != nullptr) {
60  delete theTimer;
61  }
62 }
LaserPrimaryGeneratorAction * thePrimaryGenerator
MaterialProperties * theMaterialProperties
LaserSteppingAction * theSteppingAction

Member Function Documentation

◆ update() [1/7]

void LaserAlignmentSimulation::update ( const BeginOfRun myRun)
overridevirtual

observer for BeginOfRun

Implements Observer< const BeginOfRun *>.

Definition at line 64 of file LaserAlignmentSimulation.cc.

References LogDebug, theDebugLevel, theMaterialProperties, theMPDebug, theParameterSet, thePrimaryGenerator, theSiAbsLengthScale, theSteppingAction, and theTimer.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

64  {
65  LogDebug("SimLaserAlignmentSimulation")
66  << "<LaserAlignmentSimulation::update(const BeginOfRun * myRun)>"
67  << "\n ***** AC1CMS: Start of Run: " << (*myRun)()->GetRunID() << " ***** ";
68 
69  // start timer
70  theTimer->Start();
71 
72  // the PrimaryGeneratorAction: defines the used particlegun for the Laser
73  // events
75 
76  // the UserSteppingAction: at the moment this prints only some information
78 
79  // construct your own material properties for setting refractionindex and so
80  // on
82 
83  // list the tree of sensitive detectors
84  if (theDebugLevel >= 1) {
85  G4SDManager *theSDManager = G4SDManager::GetSDMpointer();
86  theSDManager->ListTree();
87  }
88 }
LaserPrimaryGeneratorAction * thePrimaryGenerator
MaterialProperties * theMaterialProperties
LaserSteppingAction * theSteppingAction
#define LogDebug(id)

◆ update() [2/7]

void LaserAlignmentSimulation::update ( const BeginOfEvent myEvent)
overridevirtual

observer for BeginOfEvent

Implements Observer< const BeginOfEvent *>.

Definition at line 90 of file LaserAlignmentSimulation.cc.

References LaserPrimaryGeneratorAction::GeneratePrimaries(), LogDebug, ecalTB2006H4_GenSimDigiReco_cfg::myEvent, theBarrelHits, theEndcapHits, and thePrimaryGenerator.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

90  {
91  LogDebug("SimLaserAlignmentSimulation") << "<LaserAlignmentSimulation::update(const BeginOfEvent * myEvent)>"
92  << "\n AC1CMS: Event number = " << (*myEvent)()->GetEventID();
93 
94  // some statistics for this event
95  theBarrelHits = 0;
96  theEndcapHits = 0;
97 
98  // generate the Primaries
100 }
void GeneratePrimaries(G4Event *myEvent) override
LaserPrimaryGeneratorAction * thePrimaryGenerator
#define LogDebug(id)

◆ update() [3/7]

void LaserAlignmentSimulation::update ( const G4Step *  myStep)
overridevirtual

observer for G4Step

Implements Observer< const G4Step *>.

Definition at line 104 of file LaserAlignmentSimulation.cc.

References LogDebug, TkAccumulatingSensitiveDetector::ProcessHits(), theBarrelHits, theEndcapHits, theSteppingAction, and LaserSteppingAction::UserSteppingAction().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

104  {
105  LogDebug("SimLaserAlignmentSimulationStepping") << "<LaserAlignmentSimulation::update(const G4Step * myStep)>";
106 
107  G4Step *theStep = const_cast<G4Step *>(myStep);
108 
109  // do the LaserSteppingAction
111 
112  // Trigger sensitive detector manually since photon is absorbed
113  if ((theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == "OpAbsorption")) {
114  LogDebug("SimLaserAlignmentSimulationStepping") << "<LaserAlignmentSimulation::update(const G4Step*)>: Photon was "
115  "absorbed! ";
116 
117  if (theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector()) {
118  LogDebug("SimLaserAlignmentSimulationStepping")
119  << " AC1CMS: Setting the EnergyLoss to " << theStep->GetTotalEnergyDeposit()
120  << "\n AC1CMS: The z position is " << theStep->GetPreStepPoint()->GetPosition().z()
121  << "\n AC1CMS: the Sensitive Detector: "
122  << theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector()->GetName()
123  << "\n AC1CMS: the Material: " << theStep->GetPreStepPoint()->GetMaterial()->GetName()
124  << "\n AC1CMS: the Logical Volume: "
125  << theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
126 
127  if (theStep->GetTotalEnergyDeposit() > 0.0) {
128  // process a hit
131  *)(theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector());
132 
133  theSD->ProcessHits(theStep, ((G4TouchableHistory *)(theStep->GetPreStepPoint()->GetTouchable())));
134 
135  // some statistics for this event
136  if ((theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
137  "TECModule3RphiActive") ||
138  (theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
139  "TECModule5RphiActive")) {
140  theEndcapHits++;
141  } else if ((theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
142  "TOBActiveSter0") ||
143  (theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
144  "TOBActiveRphi0") ||
145  (theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() ==
146  "TIBActiveRphi2")) {
147  theBarrelHits++;
148  }
149  }
150  } else {
151  LogDebug("SimLaserAlignmentSimulationStepping")
152  << " AC1CMS: No SensitiveDetector available for this Step ... No Hit "
153  "created :-( "
154  << "\n AC1CMS: The Material was: " << theStep->GetPreStepPoint()->GetMaterial()->GetName();
155  }
156  }
157 }
bool ProcessHits(G4Step *, G4TouchableHistory *) override
LaserSteppingAction * theSteppingAction
void UserSteppingAction(const G4Step *myStep) override
#define LogDebug(id)

◆ update() [4/7]

void LaserAlignmentSimulation::update ( const EndOfEvent myEvent)
overridevirtual

observer for EndOfEvent

Implements Observer< const EndOfEvent *>.

Definition at line 161 of file LaserAlignmentSimulation.cc.

References LogDebug, theBarrelHits, and theEndcapHits.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

161  {
162  LogDebug("SimLaserAlignmentSimulation") << "<LaserAlignmentSimulation::update(const EndOfEvent * myEvent)>"
163  << "\n AC1CMS: End of Event " << (*myEvent)()->GetEventID();
164 
165  // some statistics for this event
166  edm::LogInfo("SimLaserAlignmentSimulation")
167  << " *** Number of Hits: " << theBarrelHits << " / " << theEndcapHits << " (Barrel / Endcaps) *** ";
168 }
Log< level::Info, false > LogInfo
#define LogDebug(id)

◆ update() [5/7]

void LaserAlignmentSimulation::update ( const EndOfRun myRun)
overridevirtual

observer for EndOfRun

Implements Observer< const EndOfRun *>.

Definition at line 170 of file LaserAlignmentSimulation.cc.

References LogDebug, and theTimer.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

170  {
171  LogDebug("SimLaserAlignmentSimulation") << "<LaserAlignmentSimulation::update(const EndOfRun * myRun)>";
172 
173  // stop timer
174  theTimer->Stop();
175  edm::LogInfo("SimLaserAlignmentSimulation")
176  << " AC1CMS: Number of Events = " << (*myRun)()->GetNumberOfEventToBeProcessed() << " " << *theTimer
177  << " ***** AC1CMS: End of Run: " << (*myRun)()->GetRunID() << " ***** ";
178 }
Log< level::Info, false > LogInfo
#define LogDebug(id)

◆ update() [6/7]

void LaserAlignmentSimulation::update ( const BeginOfTrack myTrack)
overridevirtual

◆ update() [7/7]

void LaserAlignmentSimulation::update ( const EndOfTrack myTrack)
overridevirtual

Member Data Documentation

◆ theBarrelHits

int LaserAlignmentSimulation::theBarrelHits
private

Definition at line 84 of file LaserAlignmentSimulation.h.

Referenced by update().

◆ theDebugLevel

int LaserAlignmentSimulation::theDebugLevel
private

Definition at line 73 of file LaserAlignmentSimulation.h.

Referenced by LaserAlignmentSimulation(), and update().

◆ theEndcapHits

int LaserAlignmentSimulation::theEndcapHits
private

Definition at line 85 of file LaserAlignmentSimulation.h.

Referenced by update().

◆ theEnergyLossScalingFactor

double LaserAlignmentSimulation::theEnergyLossScalingFactor
private

Definition at line 74 of file LaserAlignmentSimulation.h.

Referenced by LaserAlignmentSimulation().

◆ theMaterialProperties

MaterialProperties* LaserAlignmentSimulation::theMaterialProperties
private

Definition at line 80 of file LaserAlignmentSimulation.h.

Referenced by update(), and ~LaserAlignmentSimulation().

◆ theMPDebug

int LaserAlignmentSimulation::theMPDebug
private

Definition at line 75 of file LaserAlignmentSimulation.h.

Referenced by LaserAlignmentSimulation(), and update().

◆ theParameterSet

edm::ParameterSet LaserAlignmentSimulation::theParameterSet
private

Definition at line 87 of file LaserAlignmentSimulation.h.

Referenced by update().

◆ thePrimaryGenerator

LaserPrimaryGeneratorAction* LaserAlignmentSimulation::thePrimaryGenerator
private

Definition at line 81 of file LaserAlignmentSimulation.h.

Referenced by update(), and ~LaserAlignmentSimulation().

◆ theSiAbsLengthScale

double LaserAlignmentSimulation::theSiAbsLengthScale
private

Definition at line 76 of file LaserAlignmentSimulation.h.

Referenced by LaserAlignmentSimulation(), and update().

◆ theSteppingAction

LaserSteppingAction* LaserAlignmentSimulation::theSteppingAction
private

Definition at line 82 of file LaserAlignmentSimulation.h.

Referenced by update(), and ~LaserAlignmentSimulation().

◆ theTimer

G4Timer* LaserAlignmentSimulation::theTimer
private