CMS 3D CMS Logo

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 * >

List of all members.

Public Member Functions

 LaserAlignmentSimulation (edm::ParameterSet const &theConf)
 constructor
void update (const EndOfTrack *myTrack)
 observer for EndOfTrack
void update (const BeginOfEvent *myEvent)
 observer for BeginOfEvent
void update (const EndOfRun *myRun)
 observer for EndOfRun
void update (const EndOfEvent *myEvent)
 observer for EndOfEvent
void update (const G4Step *myStep)
 observer for G4Step
void update (const BeginOfTrack *myTrack)
 observer for BeginOfTrack
void update (const BeginOfRun *myRun)
 observer for BeginOfRun
virtual ~LaserAlignmentSimulation ()
 destructor

Private Attributes

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

Detailed Description

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

Date:
2007/12/04 23:53:06
Revision:
1.4
Author:
Maarten Thomas

Definition at line 42 of file LaserAlignmentSimulation.h.


Constructor & Destructor Documentation

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

constructor

Definition at line 29 of file LaserAlignmentSimulation.cc.

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

  : theDebugLevel(theConf.getUntrackedParameter<int>("DebugLevel",0)),
    theEnergyLossScalingFactor(theConf.getUntrackedParameter<double>("EnergyLossScalingFactor",1.0)),
    theMPDebug(theConf.getUntrackedParameter<int>("MaterialPropertiesDebugLevel",0)),
    theSiAbsLengthScale(theConf.getUntrackedParameter<double>("SiAbsorptionLengthScalingFactor",1.0)),
    theTimer(), 
    theMaterialProperties(),
    thePrimaryGenerator(), theSteppingAction(),
    theBarrelHits(0), theEndcapHits(0),
                theParameterSet(theConf)
{

  // make some noise
  edm::LogInfo("SimLaserAlignmentSimulation") << " *****     AC1CMS: Configuration from ParameterSet      ***** " 
                                    << "\n  AC1CMS: theDebugLevel               = " << theDebugLevel 
                                    << "\n  AC1CMS: theEnergyLossScalingFactor  = " << theEnergyLossScalingFactor 
                                    << "\n  AC1CMS: theMPDebugLevel             = " << theMPDebug
                                    << "\n  AC1CMS: theSiAbsLengthScalingFactor = " << theSiAbsLengthScale;

  // declare timer
  theTimer = new G4Timer;
}
LaserAlignmentSimulation::~LaserAlignmentSimulation ( ) [virtual]

destructor

Definition at line 52 of file LaserAlignmentSimulation.cc.

References theMaterialProperties, thePrimaryGenerator, theSteppingAction, and theTimer.

{
  if ( theMaterialProperties != 0 )        { delete theMaterialProperties; }
  if ( theSteppingAction != 0 )            { delete theSteppingAction; }
  if ( thePrimaryGenerator != 0 )          { delete thePrimaryGenerator; }
  if ( theTimer != 0 )                     { delete theTimer; }
}

Member Function Documentation

void LaserAlignmentSimulation::update ( const BeginOfRun myRun) [virtual]

observer for BeginOfRun

Implements Observer< const BeginOfRun * >.

Definition at line 60 of file LaserAlignmentSimulation.cc.

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

{
  LogDebug("SimLaserAlignmentSimulation") << "<LaserAlignmentSimulation::update(const BeginOfRun * myRun)>"
                                << "\n *****     AC1CMS: Start of Run: " << (*myRun)()->GetRunID() << "     ***** ";

  // start timer
  theTimer->Start();


  // the PrimaryGeneratorAction: defines the used particlegun for the Laser events
  thePrimaryGenerator = new LaserPrimaryGeneratorAction(theParameterSet);

  // the UserSteppingAction: at the moment this prints only some information
  theSteppingAction = new LaserSteppingAction(theParameterSet);

  // construct your own material properties for setting refractionindex and so on
  theMaterialProperties = new MaterialProperties(theMPDebug, theSiAbsLengthScale);

  // list the tree of sensitive detectors
  if (theDebugLevel >= 1)
    {
      G4SDManager * theSDManager = G4SDManager::GetSDMpointer();
      theSDManager->ListTree();
    }
}
void LaserAlignmentSimulation::update ( const EndOfTrack myTrack) [virtual]

observer for EndOfTrack

Implements Observer< const EndOfTrack * >.

Definition at line 159 of file LaserAlignmentSimulation.cc.

{
}
void LaserAlignmentSimulation::update ( const BeginOfTrack myTrack) [virtual]

observer for BeginOfTrack

Implements Observer< const BeginOfTrack * >.

Definition at line 99 of file LaserAlignmentSimulation.cc.

{
}
void LaserAlignmentSimulation::update ( const EndOfRun myRun) [virtual]

observer for EndOfRun

Implements Observer< const EndOfRun * >.

Definition at line 173 of file LaserAlignmentSimulation.cc.

References LogDebug, and theTimer.

{
  LogDebug("SimLaserAlignmentSimulation") << "<LaserAlignmentSimulation::update(const EndOfRun * myRun)>";

  // stop timer
  theTimer->Stop();
  edm::LogInfo("SimLaserAlignmentSimulation") << " AC1CMS: Number of Events = " << (*myRun)()->GetNumberOfEventToBeProcessed()
                                    << " " << *theTimer 
                                    << " *****     AC1CMS: End of Run: " << (*myRun)()->GetRunID() << "     ***** ";
}
void LaserAlignmentSimulation::update ( const EndOfEvent myEvent) [virtual]

observer for EndOfEvent

Implements Observer< const EndOfEvent * >.

Definition at line 163 of file LaserAlignmentSimulation.cc.

References LogDebug, theBarrelHits, and theEndcapHits.

{
  LogDebug("SimLaserAlignmentSimulation") << "<LaserAlignmentSimulation::update(const EndOfEvent * myEvent)>"
                                << "\n AC1CMS: End of Event " << (*myEvent)()->GetEventID();

  // some statistics for this event
  edm::LogInfo("SimLaserAlignmentSimulation") << " *** Number of Hits: " << theBarrelHits << " / " << theEndcapHits
                                    << " (Barrel / Endcaps) *** ";
}
void LaserAlignmentSimulation::update ( const G4Step *  myStep) [virtual]

observer for G4Step

Implements Observer< const G4Step * >.

Definition at line 103 of file LaserAlignmentSimulation.cc.

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

{
  LogDebug("SimLaserAlignmentSimulationStepping") << "<LaserAlignmentSimulation::update(const G4Step * myStep)>";

  G4Step * theStep = const_cast<G4Step*>(myStep);

  // do the LaserSteppingAction
  theSteppingAction->UserSteppingAction(theStep);

  // Trigger sensitive detector manually since photon is absorbed
  if ( ( theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()== "OpAbsorption" ) )
    {
      LogDebug("SimLaserAlignmentSimulationStepping") << "<LaserAlignmentSimulation::update(const G4Step*)>: Photon was absorbed! ";
      
      
      if ( theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector() )
        {
          LogDebug("SimLaserAlignmentSimulationStepping") << " AC1CMS: Setting the EnergyLoss to " << theStep->GetTotalEnergyDeposit() 
                                                << "\n AC1CMS: The z position is " << theStep->GetPreStepPoint()->GetPosition().z()
                                                << "\n AC1CMS: the Sensitive Detector: " 
                                                << theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector()->GetName()
                                                << "\n AC1CMS: the Material: " << theStep->GetPreStepPoint()->GetMaterial()->GetName()
                                                << "\n AC1CMS: the Logical Volume: " 
                                                << theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();

          if (theStep->GetTotalEnergyDeposit() > 0.0)
            {
              // process a hit
              TkAccumulatingSensitiveDetector * theSD = (TkAccumulatingSensitiveDetector*)
                (theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector());
              
              theSD->ProcessHits(theStep, ((G4TouchableHistory *)(theStep->GetPreStepPoint()->GetTouchable())));


              // some statistics for this event
              if ( ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() == "TECModule3RphiActive" ) || 
                   ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() == "TECModule5RphiActive" ) )
                {
                  theEndcapHits++;
                }
              else if ( ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() == "TOBActiveSter0" ) ||
                        ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() == "TOBActiveRphi0" ) ||
                        ( theStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() == "TIBActiveRphi2" ) )
                {
                  theBarrelHits++;
                }
            }
        }
      else 
        {
          LogDebug("SimLaserAlignmentSimulationStepping") << " AC1CMS: No SensitiveDetector available for this Step ... No Hit created :-( "
                                                << "\n AC1CMS: The Material was: " << theStep->GetPreStepPoint()->GetMaterial()->GetName(); 
        }
    }
}
void LaserAlignmentSimulation::update ( const BeginOfEvent myEvent) [virtual]

observer for BeginOfEvent

Implements Observer< const BeginOfEvent * >.

Definition at line 86 of file LaserAlignmentSimulation.cc.

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

{
  LogDebug("SimLaserAlignmentSimulation") << "<LaserAlignmentSimulation::update(const BeginOfEvent * myEvent)>"
                                << "\n AC1CMS: Event number = " << (*myEvent)()->GetEventID();

  // some statistics for this event
  theBarrelHits = 0;
  theEndcapHits = 0;

  // generate the Primaries
  thePrimaryGenerator->GeneratePrimaries((G4Event*)(*myEvent)());
}

Member Data Documentation

Definition at line 85 of file LaserAlignmentSimulation.h.

Referenced by update().

Definition at line 74 of file LaserAlignmentSimulation.h.

Referenced by LaserAlignmentSimulation(), and update().

Definition at line 86 of file LaserAlignmentSimulation.h.

Referenced by update().

Definition at line 75 of file LaserAlignmentSimulation.h.

Referenced by LaserAlignmentSimulation().

Definition at line 81 of file LaserAlignmentSimulation.h.

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

Definition at line 76 of file LaserAlignmentSimulation.h.

Referenced by LaserAlignmentSimulation(), and update().

Definition at line 88 of file LaserAlignmentSimulation.h.

Referenced by update().

Definition at line 82 of file LaserAlignmentSimulation.h.

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

Definition at line 77 of file LaserAlignmentSimulation.h.

Referenced by LaserAlignmentSimulation(), and update().

Definition at line 83 of file LaserAlignmentSimulation.h.

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