#include <SensitiveDetector.h>
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 |
Definition at line 24 of file SensitiveDetector.h.
Definition at line 38 of file SensitiveDetector.h.
SensitiveDetector::SensitiveDetector | ( | std::string & | iname, |
const DDCompactView & | cpv, | ||
SensitiveDetectorCatalog & | , | ||
edm::ParameterSet const & | p | ||
) | [explicit] |
Definition at line 13 of file SensitiveDetector.cc.
: G4VSensitiveDetector(iname), name(iname) {}
SensitiveDetector::~SensitiveDetector | ( | ) | [virtual] |
Definition at line 18 of file SensitiveDetector.cc.
{}
void SensitiveDetector::AssignSD | ( | std::string & | vname | ) | [virtual] |
Definition at line 28 of file SensitiveDetector.cc.
References v.
Referenced by BscSD::BscSD(), CaloSD::CaloSD(), FiberSD::FiberSD(), FP420SD::FP420SD(), HFChamberSD::HFChamberSD(), HFWedgeSD::HFWedgeSD(), MuonSensitiveDetector::MuonSensitiveDetector(), PLTSensitiveDetector::PLTSensitiveDetector(), TkAccumulatingSensitiveDetector::TkAccumulatingSensitiveDetector(), and TotemSD::TotemSD().
{ G4LogicalVolumeStore * theStore = G4LogicalVolumeStore::GetInstance(); G4LogicalVolumeStore::const_iterator it; for (it = theStore->begin(); it != theStore->end(); it++) { G4LogicalVolume * v = *it; if (vname==v->GetName()) v->SetSensitiveDetector(this); } }
virtual void SensitiveDetector::clearHits | ( | ) | [pure virtual] |
Implemented in CaloSD, CaloTrkProcessing, BscSD, PLTSensitiveDetector, TotemSD, FP420SD, MuonSensitiveDetector, FiberSD, HFChamberSD, HFWedgeSD, and TkAccumulatingSensitiveDetector.
Local3DPoint SensitiveDetector::ConvertToLocal3DPoint | ( | G4ThreeVector | point | ) |
Definition at line 70 of file SensitiveDetector.cc.
Referenced by MuonSensitiveDetector::createHit(), PLTSensitiveDetector::createHit(), TkAccumulatingSensitiveDetector::createHit(), FinalStepPosition(), MuonSensitiveDetector::FinalStepPositionVsParent(), InitialStepPosition(), and MuonSensitiveDetector::InitialStepPositionVsParent().
{ return Local3DPoint(p.x(),p.y(),p.z()); }
void SensitiveDetector::EndOfEvent | ( | G4HCofThisEvent * | eventHC | ) | [virtual] |
Reimplemented in CaloSD, CaloTrkProcessing, BscSD, PLTSensitiveDetector, TotemSD, FP420SD, MuonSensitiveDetector, FiberSD, HFChamberSD, HFWedgeSD, and TkAccumulatingSensitiveDetector.
Definition at line 39 of file SensitiveDetector.cc.
{}
Local3DPoint SensitiveDetector::FinalStepPosition | ( | G4Step * | s, |
coordinates | c | ||
) |
Definition at line 56 of file SensitiveDetector.cc.
References ConvertToLocal3DPoint(), currentStep, alignCSCRings::s, and WorldCoordinates.
Referenced by MuonSensitiveDetector::createHit(), PLTSensitiveDetector::createHit(), TkAccumulatingSensitiveDetector::createHit(), MuonSensitiveDetector::updateHit(), PLTSensitiveDetector::updateHit(), and TkAccumulatingSensitiveDetector::updateHit().
{ currentStep = s; G4StepPoint * postStepPoint = currentStep->GetPostStepPoint(); G4StepPoint * preStepPoint = currentStep->GetPreStepPoint(); G4ThreeVector globalCoordinates = postStepPoint->GetPosition(); if (c == WorldCoordinates) return ConvertToLocal3DPoint(globalCoordinates); G4TouchableHistory * theTouchable = (G4TouchableHistory *) (preStepPoint->GetTouchable()); G4ThreeVector localCoordinates = theTouchable->GetHistory() ->GetTopTransform().TransformPoint(globalCoordinates); return ConvertToLocal3DPoint(localCoordinates); }
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 groupFilesInBlocks::temp.
Referenced by CaloTrkProcessing::CaloTrkProcessing(), HCalSD::HCalSD(), and HcalTB06BeamSD::HcalTB06BeamSD().
void SensitiveDetector::Initialize | ( | G4HCofThisEvent * | eventHC | ) | [virtual] |
Reimplemented in CaloSD, CaloTrkProcessing, BscSD, TotemSD, FP420SD, FiberSD, HFChamberSD, and HFWedgeSD.
Definition at line 20 of file SensitiveDetector.cc.
{}
Local3DPoint SensitiveDetector::InitialStepPosition | ( | G4Step * | s, |
coordinates | c | ||
) |
Definition at line 43 of file SensitiveDetector.cc.
References ConvertToLocal3DPoint(), currentStep, alignCSCRings::s, and WorldCoordinates.
Referenced by TkAccumulatingSensitiveDetector::closeHit(), PLTSensitiveDetector::closeHit(), MuonSensitiveDetector::createHit(), PLTSensitiveDetector::createHit(), TkAccumulatingSensitiveDetector::createHit(), and MuonSensitiveDetector::ProcessHits().
{ currentStep = s; G4StepPoint * preStepPoint = currentStep->GetPreStepPoint(); G4ThreeVector globalCoordinates = preStepPoint->GetPosition(); if (c == WorldCoordinates) return ConvertToLocal3DPoint(globalCoordinates); G4TouchableHistory * theTouchable=(G4TouchableHistory *) (preStepPoint->GetTouchable()); G4ThreeVector localCoordinates = theTouchable->GetHistory() ->GetTopTransform().TransformPoint(globalCoordinates); return ConvertToLocal3DPoint(localCoordinates); }
std::string SensitiveDetector::nameOfSD | ( | ) | [inline] |
Definition at line 42 of file SensitiveDetector.h.
References name.
Referenced by getNames().
{ return name; }
void SensitiveDetector::NaNTrap | ( | G4Step * | step | ) |
Definition at line 75 of file SensitiveDetector.cc.
References gather_cfg::cout, edm::detail::isnan(), and NULL.
Referenced by CaloSD::ProcessHits(), ZdcSD::ProcessHits(), and HCalSD::ProcessHits().
{ if ( aStep == NULL ) return ; G4Track* CurrentTrk = aStep->GetTrack() ; G4ThreeVector CurrentPos = CurrentTrk->GetPosition() ; G4ThreeVector CurrentMom = CurrentTrk->GetMomentum() ; G4VPhysicalVolume* pCurrentVol = CurrentTrk->GetVolume() ; G4String NameOfVol ; if ( pCurrentVol != NULL ) { NameOfVol = pCurrentVol->GetName() ; } else { NameOfVol = "CorruptedVolumeInfo" ; } // for simplicity... maybe isnan() will work on the 3-vector directly... // double xyz[3] ; xyz[0] = CurrentPos.x() ; xyz[1] = CurrentPos.y() ; xyz[2] = CurrentPos.z() ; // // this is another trick to check on a NaN, maybe it's even CPU-faster... // but ler's stick to system function isnan(...) for now // // if ( !(xyz[0]==xyz[0]) || !(xyz[1]==xyz[1]) || !(xyz[2]==xyz[2]) ) if( isnan(xyz[0]+xyz[1]+xyz[2]) != 0 ) { // std::cout << " NaN detected in volume " << NameOfVol << std::endl ; throw SimG4Exception( "SimG4CoreSensitiveDetector: Corrupted Event - NaN detected (position)" ) ; } xyz[0] = CurrentMom.x() ; xyz[1] = CurrentMom.y() ; xyz[2] = CurrentMom.z() ; if ( !(xyz[0]==xyz[0]) || !(xyz[1]==xyz[1]) || !(xyz[2]==xyz[2]) || isnan(xyz[0]) != 0 || isnan(xyz[1]) != 0 || isnan(xyz[2]) != 0 ) { std::cout << " NaN detected in volume " << NameOfVol << std::endl ; throw SimG4Exception( "SimG4CoreSensitiveDetector: Corrupted Event - NaN detected (3-momentum)" ) ; } return ; }
virtual G4bool SensitiveDetector::ProcessHits | ( | G4Step * | step, |
G4TouchableHistory * | tHistory | ||
) | [pure virtual] |
Implemented in CaloSD, CaloTrkProcessing, HCalSD, DreamSD, BscSD, PLTSensitiveDetector, TotemSD, ZdcSD, FP420SD, MuonSensitiveDetector, FiberSD, HFChamberSD, HFWedgeSD, and TkAccumulatingSensitiveDetector.
void SensitiveDetector::Register | ( | ) |
Definition at line 22 of file SensitiveDetector.cc.
Referenced by BscSD::BscSD(), CaloSD::CaloSD(), FiberSD::FiberSD(), FP420SD::FP420SD(), HFChamberSD::HFChamberSD(), HFWedgeSD::HFWedgeSD(), MuonSensitiveDetector::MuonSensitiveDetector(), PLTSensitiveDetector::PLTSensitiveDetector(), TkAccumulatingSensitiveDetector::TkAccumulatingSensitiveDetector(), and TotemSD::TotemSD().
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
SDman->AddNewDetector(this);
}
virtual uint32_t SensitiveDetector::setDetUnitId | ( | G4Step * | step | ) | [pure virtual] |
Implemented in CaloSD, CaloTrkProcessing, ECalSD, HCalSD, DreamSD, EcalTBH4BeamSD, BscSD, CastorSD, PLTSensitiveDetector, TotemSD, ZdcSD, FP420SD, HcalTB02SD, HcalTB06BeamSD, MuonSensitiveDetector, FiberSD, HFChamberSD, HFWedgeSD, and TkAccumulatingSensitiveDetector.
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 CaloTrkProcessing::CaloTrkProcessing(), CastorSD::getEnergyDeposit(), HcalTB06BeamSD::getNames(), HCalSD::HCalSD(), HcalTB02SD::initMap(), ECalSD::initMap(), DreamSD::initMap(), nameOfSD(), HCalSD::plotProfile(), and HcalTB06BeamSD::setDetUnitId().