CMS 3D CMS Logo

SensitiveDetector Class Reference

#include <SimG4Core/SensitiveDetector/interface/SensitiveDetector.h>

Inheritance diagram for SensitiveDetector:

SensitiveCaloDetector SensitiveTkDetector CaloSD CaloTrkProcessing BscSD FP420SD MuonSensitiveDetector TkAccumulatingSensitiveDetector TotemSD CastorSD DreamSD ECalSD EcalTBH4BeamSD HCalSD HcalTB02SD HcalTB06BeamSD ZdcSD

List of all members.

Public Types

enum  coordinates { WorldCoordinates, LocalCoordinates }

Public Member Functions

virtual void AssignSD (std::string &vname)
virtual void clearHits ()=0
Local3DPoint ConvertToLocal3DPoint (G4ThreeVector point)
virtual void EndOfEvent (G4HCofThisEvent *eventHC)
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
virtual std::vector< std::string > getNames ()
virtual void Initialize (G4HCofThisEvent *eventHC)
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
std::string nameOfSD ()
void NaNTrap (G4Step *step)
virtual G4bool ProcessHits (G4Step *step, G4TouchableHistory *tHistory)=0
void Register ()
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &, edm::ParameterSet const &p)
virtual uint32_t setDetUnitId (G4Step *step)=0
virtual ~SensitiveDetector ()

Private Attributes

G4Step * currentStep
std::string name


Detailed Description

Definition at line 24 of file SensitiveDetector.h.


Member Enumeration Documentation

enum SensitiveDetector::coordinates

Enumerator:
WorldCoordinates 
LocalCoordinates 

Definition at line 38 of file SensitiveDetector.h.


Constructor & Destructor Documentation

SensitiveDetector::SensitiveDetector ( std::string &  iname,
const DDCompactView cpv,
SensitiveDetectorCatalog ,
edm::ParameterSet const &  p 
) [explicit]

SensitiveDetector::~SensitiveDetector (  )  [virtual]

Definition at line 18 of file SensitiveDetector.cc.

00018 {}


Member Function Documentation

virtual void SensitiveDetector::AssignSD ( std::string &  vname  )  [virtual]

Referenced by BscSD::BscSD(), CaloSD::CaloSD(), FP420SD::FP420SD(), MuonSensitiveDetector::MuonSensitiveDetector(), and TotemSD::TotemSD().

virtual void SensitiveDetector::clearHits (  )  [pure virtual]

Implemented in CaloSD, CaloTrkProcessing, BscSD, TotemSD, FP420SD, MuonSensitiveDetector, and TkAccumulatingSensitiveDetector.

Local3DPoint SensitiveDetector::ConvertToLocal3DPoint ( G4ThreeVector  point  ) 

Definition at line 70 of file SensitiveDetector.cc.

Referenced by MuonSensitiveDetector::createHit(), TkAccumulatingSensitiveDetector::createHit(), FinalStepPosition(), MuonSensitiveDetector::FinalStepPositionVsParent(), InitialStepPosition(), and MuonSensitiveDetector::InitialStepPositionVsParent().

00071 {
00072     return Local3DPoint(p.x(),p.y(),p.z());
00073 }

void SensitiveDetector::EndOfEvent ( G4HCofThisEvent *  eventHC  )  [virtual]

Reimplemented in CaloSD, CaloTrkProcessing, BscSD, TotemSD, FP420SD, MuonSensitiveDetector, and TkAccumulatingSensitiveDetector.

Definition at line 39 of file SensitiveDetector.cc.

00039 {}

Local3DPoint SensitiveDetector::FinalStepPosition ( G4Step *  s,
coordinates  c 
)

Definition at line 56 of file SensitiveDetector.cc.

References ConvertToLocal3DPoint(), currentStep, and WorldCoordinates.

Referenced by MuonSensitiveDetector::createHit(), TkAccumulatingSensitiveDetector::createHit(), MuonSensitiveDetector::updateHit(), and TkAccumulatingSensitiveDetector::updateHit().

00057 {
00058     currentStep = s;
00059     G4StepPoint * postStepPoint = currentStep->GetPostStepPoint();
00060     G4StepPoint * preStepPoint  = currentStep->GetPreStepPoint();
00061     G4ThreeVector globalCoordinates = postStepPoint->GetPosition();
00062     if (c == WorldCoordinates) return ConvertToLocal3DPoint(globalCoordinates);
00063     G4TouchableHistory * theTouchable = (G4TouchableHistory *)
00064                                         (preStepPoint->GetTouchable());
00065     G4ThreeVector localCoordinates = theTouchable->GetHistory()
00066                   ->GetTopTransform().TransformPoint(globalCoordinates);
00067     return ConvertToLocal3DPoint(localCoordinates); 
00068 }

virtual std::vector<std::string> SensitiveDetector::getNames (  )  [inline, virtual]

Reimplemented in BscSD, FP420SD, MuonSensitiveDetector, and TkAccumulatingSensitiveDetector.

Definition at line 43 of file SensitiveDetector.h.

References nameOfSD(), and pyDBSRunClass::temp.

Referenced by CaloTrkProcessing::CaloTrkProcessing(), HCalSD::HCalSD(), and HcalTB06BeamSD::HcalTB06BeamSD().

00044   {
00045     std::vector<std::string> temp;
00046     temp.push_back(nameOfSD());
00047     return temp;
00048   }

void SensitiveDetector::Initialize ( G4HCofThisEvent *  eventHC  )  [virtual]

Reimplemented in CaloSD, CaloTrkProcessing, BscSD, TotemSD, and FP420SD.

Definition at line 20 of file SensitiveDetector.cc.

00020 {}

Local3DPoint SensitiveDetector::InitialStepPosition ( G4Step *  s,
coordinates  c 
)

Definition at line 43 of file SensitiveDetector.cc.

References ConvertToLocal3DPoint(), currentStep, and WorldCoordinates.

Referenced by TkAccumulatingSensitiveDetector::closeHit(), MuonSensitiveDetector::createHit(), TkAccumulatingSensitiveDetector::createHit(), and MuonSensitiveDetector::ProcessHits().

00044 {
00045     currentStep = s;
00046     G4StepPoint * preStepPoint = currentStep->GetPreStepPoint();
00047     G4ThreeVector globalCoordinates = preStepPoint->GetPosition();
00048     if (c == WorldCoordinates) return ConvertToLocal3DPoint(globalCoordinates);
00049     G4TouchableHistory * theTouchable=(G4TouchableHistory *)
00050                                       (preStepPoint->GetTouchable());
00051     G4ThreeVector localCoordinates = theTouchable->GetHistory()
00052                   ->GetTopTransform().TransformPoint(globalCoordinates);
00053     return ConvertToLocal3DPoint(localCoordinates); 
00054 }

std::string SensitiveDetector::nameOfSD (  )  [inline]

Definition at line 42 of file SensitiveDetector.h.

References name.

Referenced by getNames().

00042 { return name; }

void SensitiveDetector::NaNTrap ( G4Step *  step  ) 

Definition at line 75 of file SensitiveDetector.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::isnan(), and NULL.

Referenced by CaloSD::ProcessHits(), and HCalSD::ProcessHits().

00076 {
00077 
00078     if ( aStep == NULL ) return ;
00079     
00080     G4Track* CurrentTrk = aStep->GetTrack() ;
00081     G4ThreeVector CurrentPos = CurrentTrk->GetPosition() ;
00082     G4ThreeVector CurrentMom = CurrentTrk->GetMomentum() ;
00083     G4VPhysicalVolume* pCurrentVol = CurrentTrk->GetVolume() ;
00084     G4String NameOfVol ;
00085     if ( pCurrentVol != NULL )
00086     {
00087        NameOfVol = pCurrentVol->GetName() ;
00088     }
00089     else
00090     {
00091        NameOfVol = "CorruptedVolumeInfo" ;
00092     }
00093     
00094     // for simplicity... maybe isnan() will work on the 3-vector directly...
00095     //
00096     double xyz[3] ;
00097     xyz[0] = CurrentPos.x() ;
00098     xyz[1] = CurrentPos.y() ;
00099     xyz[2] = CurrentPos.z() ;
00100     
00101     //
00102     // this is another trick to check on a NaN, maybe it's even CPU-faster...
00103     // but ler's stick to system function isnan(...) for now
00104     //
00105     // if ( !(xyz[0]==xyz[0]) || !(xyz[1]==xyz[1]) || !(xyz[2]==xyz[2]) )
00106     if( isnan(xyz[0]+xyz[1]+xyz[2]) != 0 )
00107     {
00108        // std::cout << " NaN detected in volume " << NameOfVol << std::endl ;
00109        throw SimG4Exception( "SimG4CoreSensitiveDetector: Corrupted Event - NaN detected (position)" ) ;
00110     }
00111 
00112     xyz[0] = CurrentMom.x() ;
00113     xyz[1] = CurrentMom.y() ;
00114     xyz[2] = CurrentMom.z() ;
00115     if ( !(xyz[0]==xyz[0]) || !(xyz[1]==xyz[1]) || !(xyz[2]==xyz[2]) ||
00116          isnan(xyz[0]) != 0 || isnan(xyz[1]) != 0 || isnan(xyz[2]) != 0 )
00117     {
00118        std::cout << " NaN detected in volume " << NameOfVol << std::endl ;
00119        throw SimG4Exception( "SimG4CoreSensitiveDetector: Corrupted Event - NaN detected (3-momentum)" ) ;
00120     }
00121 
00122    return ;
00123 
00124 }

virtual G4bool SensitiveDetector::ProcessHits ( G4Step *  step,
G4TouchableHistory *  tHistory 
) [pure virtual]

Implemented in CaloSD, CaloTrkProcessing, HCalSD, DreamSD, BscSD, TotemSD, FP420SD, MuonSensitiveDetector, and TkAccumulatingSensitiveDetector.

void SensitiveDetector::Register (  ) 

Definition at line 22 of file SensitiveDetector.cc.

Referenced by BscSD::BscSD(), CaloSD::CaloSD(), FP420SD::FP420SD(), MuonSensitiveDetector::MuonSensitiveDetector(), and TotemSD::TotemSD().

00023 {
00024   G4SDManager * SDman = G4SDManager::GetSDMpointer();
00025   SDman->AddNewDetector(this);
00026 }

virtual uint32_t SensitiveDetector::setDetUnitId ( G4Step *  step  )  [pure virtual]

Implemented in CaloSD, CaloTrkProcessing, ECalSD, HCalSD, DreamSD, EcalTBH4BeamSD, BscSD, CastorSD, TotemSD, ZdcSD, FP420SD, HcalTB02SD, HcalTB06BeamSD, MuonSensitiveDetector, and TkAccumulatingSensitiveDetector.


Member Data Documentation

G4Step* SensitiveDetector::currentStep [private]

Definition at line 54 of file SensitiveDetector.h.

Referenced by FinalStepPosition(), and InitialStepPosition().

std::string SensitiveDetector::name [private]

Reimplemented in BscSD, TotemSD, and FP420SD.

Definition at line 53 of file SensitiveDetector.h.

Referenced by CastorSD::getEnergyDeposit(), HcalTB06BeamSD::getNames(), ECalSD::getRadiationLenght(), HcalTB02SD::initMap(), ECalSD::initMap(), DreamSD::initMap(), nameOfSD(), and HcalTB06BeamSD::setDetUnitId().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:31 2009 for CMSSW by  doxygen 1.5.4