#include <SimG4CMS/EcalTestBeam/interface/EcalTBH4BeamSD.h>
Public Member Functions | |
EcalTBH4BeamSD (G4String, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *) | |
virtual double | getEnergyDeposit (G4Step *) |
virtual uint32_t | setDetUnitId (G4Step *step) |
void | setNumberingScheme (EcalNumberingScheme *scheme) |
virtual | ~EcalTBH4BeamSD () |
Private Member Functions | |
void | getBaseNumber (const G4Step *aStep) |
Private Attributes | |
double | birk1 |
double | birk2 |
double | birk3 |
EcalNumberingScheme * | numberingScheme |
EcalBaseNumber | theBaseNumber |
bool | useBirk |
bool | useWeight |
Definition at line 21 of file EcalTBH4BeamSD.h.
EcalTBH4BeamSD::EcalTBH4BeamSD | ( | G4String | name, | |
const DDCompactView & | cpv, | |||
SensitiveDetectorCatalog & | clg, | |||
edm::ParameterSet const & | p, | |||
const SimTrackManager * | manager | |||
) |
Definition at line 20 of file EcalTBH4BeamSD.cc.
References birk1, birk2, birk3, g, edm::ParameterSet::getParameter(), setNumberingScheme(), and useBirk.
00023 : 00024 CaloSD(name, cpv, clg, p, manager), numberingScheme(0) { 00025 00026 edm::ParameterSet m_EcalTBH4BeamSD = p.getParameter<edm::ParameterSet>("EcalTBH4BeamSD"); 00027 useBirk= m_EcalTBH4BeamSD.getParameter<bool>("UseBirkLaw"); 00028 birk1 = m_EcalTBH4BeamSD.getParameter<double>("BirkC1")*(g/(MeV*cm2)); 00029 birk2 = m_EcalTBH4BeamSD.getParameter<double>("BirkC2"); 00030 birk3 = m_EcalTBH4BeamSD.getParameter<double>("BirkC3"); 00031 00032 EcalNumberingScheme* scheme=0; 00033 if (name == "EcalTBH4BeamHits") { 00034 scheme = dynamic_cast<EcalNumberingScheme*>(new EcalHodoscopeNumberingScheme()); 00035 } 00036 else {edm::LogWarning("EcalTBSim") << "EcalTBH4BeamSD: ReadoutName not supported\n";} 00037 00038 if (scheme) setNumberingScheme(scheme); 00039 edm::LogInfo("EcalTBSim") << "Constructing a EcalTBH4BeamSD with name " 00040 << GetName(); 00041 edm::LogInfo("EcalTBSim") << "EcalTBH4BeamSD:: Use of Birks law is set to " 00042 << useBirk << " with three constants kB = " 00043 << birk1 << ", C1 = " << birk2 << ", C2 = " 00044 << birk3; 00045 }
EcalTBH4BeamSD::~EcalTBH4BeamSD | ( | ) | [virtual] |
Definition at line 47 of file EcalTBH4BeamSD.cc.
References numberingScheme.
00047 { 00048 if (numberingScheme) delete numberingScheme; 00049 }
void EcalTBH4BeamSD::getBaseNumber | ( | const G4Step * | aStep | ) | [private] |
Definition at line 85 of file EcalTBH4BeamSD.cc.
References EcalBaseNumber::addLevel(), EcalBaseNumber::getCapacity(), LogDebug, EcalBaseNumber::reset(), EcalBaseNumber::setSize(), and theBaseNumber.
Referenced by setDetUnitId().
00085 { 00086 00087 theBaseNumber.reset(); 00088 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable(); 00089 int theSize = touch->GetHistoryDepth()+1; 00090 if ( theBaseNumber.getCapacity() < theSize ) theBaseNumber.setSize(theSize); 00091 //Get name and copy numbers 00092 if ( theSize > 1 ) { 00093 for (int ii = 0; ii < theSize ; ii++) { 00094 theBaseNumber.addLevel(touch->GetVolume(ii)->GetName(),touch->GetReplicaNumber(ii)); 00095 LogDebug("EcalTBSim") << "EcalTBH4BeamSD::getBaseNumber(): Adding level " << ii 00096 << ": " << touch->GetVolume(ii)->GetName() << "[" 00097 << touch->GetReplicaNumber(ii) << "]"; 00098 } 00099 } 00100 }
double EcalTBH4BeamSD::getEnergyDeposit | ( | G4Step * | aStep | ) | [virtual] |
Reimplemented from CaloSD.
Definition at line 51 of file EcalTBH4BeamSD.cc.
References birk1, birk2, birk3, CaloSD::getAttenuation(), LogDebug, NULL, CaloSD::preStepPoint, useBirk, and weight.
00051 { 00052 00053 if (aStep == NULL) { 00054 return 0; 00055 } else { 00056 preStepPoint = aStep->GetPreStepPoint(); 00057 G4String nameVolume = preStepPoint->GetPhysicalVolume()->GetName(); 00058 00059 // take into account light collection curve for crystals 00060 double weight = 1.; 00061 if (useBirk) weight *= getAttenuation(aStep, birk1, birk2, birk3); 00062 double edep = aStep->GetTotalEnergyDeposit() * weight; 00063 LogDebug("EcalTBSim") << "EcalTBH4BeamSD:: " << nameVolume 00064 <<" Light Collection Efficiency " << weight 00065 << " Weighted Energy Deposit " << edep/MeV << " MeV"; 00066 return edep; 00067 } 00068 }
uint32_t EcalTBH4BeamSD::setDetUnitId | ( | G4Step * | step | ) | [virtual] |
Implements CaloSD.
Definition at line 70 of file EcalTBH4BeamSD.cc.
References getBaseNumber(), EcalNumberingScheme::getUnitID(), numberingScheme, and theBaseNumber.
00070 { 00071 getBaseNumber(aStep); 00072 return (numberingScheme == 0 ? 0 : numberingScheme->getUnitID(theBaseNumber)); 00073 }
void EcalTBH4BeamSD::setNumberingScheme | ( | EcalNumberingScheme * | scheme | ) |
Definition at line 75 of file EcalTBH4BeamSD.cc.
References numberingScheme.
Referenced by EcalTBH4BeamSD().
00075 { 00076 if (scheme != 0) { 00077 edm::LogInfo("EcalTBSim") << "EcalTBH4BeamSD: updates numbering scheme for " 00078 << GetName() << "\n"; 00079 if (numberingScheme) delete numberingScheme; 00080 numberingScheme = scheme; 00081 } 00082 }
double EcalTBH4BeamSD::birk1 [private] |
Definition at line 38 of file EcalTBH4BeamSD.h.
Referenced by EcalTBH4BeamSD(), and getEnergyDeposit().
double EcalTBH4BeamSD::birk2 [private] |
Definition at line 38 of file EcalTBH4BeamSD.h.
Referenced by EcalTBH4BeamSD(), and getEnergyDeposit().
double EcalTBH4BeamSD::birk3 [private] |
Definition at line 38 of file EcalTBH4BeamSD.h.
Referenced by EcalTBH4BeamSD(), and getEnergyDeposit().
Definition at line 35 of file EcalTBH4BeamSD.h.
Referenced by setDetUnitId(), setNumberingScheme(), and ~EcalTBH4BeamSD().
EcalBaseNumber EcalTBH4BeamSD::theBaseNumber [private] |
bool EcalTBH4BeamSD::useBirk [private] |
Definition at line 37 of file EcalTBH4BeamSD.h.
Referenced by EcalTBH4BeamSD(), and getEnergyDeposit().
bool EcalTBH4BeamSD::useWeight [private] |
Definition at line 36 of file EcalTBH4BeamSD.h.