|
|
#include <DreamSD.h>
|
| DreamSD (const std::string &, const DDCompactView *, const cms::DDCompactView *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *) |
|
uint32_t | setDetUnitId (const G4Step *) override |
|
| ~DreamSD () override |
|
| CaloSD (const std::string &aSDname, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false) |
|
void | clear () override |
|
void | clearHits () override |
|
void | DrawAll () override |
|
void | EndOfEvent (G4HCofThisEvent *eventHC) override |
|
void | fillHits (edm::PCaloHitContainer &, const std::string &) override |
|
void | Initialize (G4HCofThisEvent *HCE) override |
|
bool | isItFineCalo (const G4VTouchable *touch) |
|
void | PrintAll () override |
|
bool | ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *) override |
|
G4bool | ProcessHits (G4Step *step, G4TouchableHistory *) override |
|
void | reset () override |
|
| ~CaloSD () override |
|
| SensitiveCaloDetector (const std::string &iname, const SensitiveDetectorCatalog &clg) |
|
void | EndOfEvent (G4HCofThisEvent *eventHC) override |
|
const std::vector< std::string > & | getNames () const |
|
void | Initialize (G4HCofThisEvent *eventHC) override |
|
bool | isCaloSD () const |
|
| SensitiveDetector (const std::string &iname, const SensitiveDetectorCatalog &, bool calo) |
|
| ~SensitiveDetector () override |
|
| Observer () |
|
void | slotForUpdate (const BeginOfRun * iT) |
|
virtual | ~Observer () |
|
| Observer () |
|
void | slotForUpdate (const BeginOfEvent * iT) |
|
virtual | ~Observer () |
|
| Observer () |
|
void | slotForUpdate (const BeginOfTrack * iT) |
|
virtual | ~Observer () |
|
| Observer () |
|
void | slotForUpdate (const EndOfTrack * iT) |
|
virtual | ~Observer () |
|
| Observer () |
|
void | slotForUpdate (const EndOfEvent * iT) |
|
virtual | ~Observer () |
|
|
double | getEnergyDeposit (const G4Step *) override |
|
void | initRun () override |
|
bool | checkHit () |
|
CaloG4Hit * | createNewHit (const G4Step *, const G4Track *) |
|
virtual void | endEvent () |
|
virtual double | EnergyCorrected (const G4Step &step, const G4Track *) |
|
virtual bool | filterHit (CaloG4Hit *, double) |
|
double | getAttenuation (const G4Step *aStep, double birk1, double birk2, double birk3) const |
|
virtual uint16_t | getDepth (const G4Step *) |
|
virtual bool | getFromLibrary (const G4Step *step) |
|
int | getNumberOfHits () |
|
double | getResponseWt (const G4Track *) |
|
virtual int | getTrackID (const G4Track *) |
|
void | hitBookkeepingFineCalo (const G4Step *step, const G4Track *currentTrack, CaloG4Hit *hit) |
|
bool | hitExists (const G4Step *) |
|
void | ignoreRejection () |
|
virtual void | initEvent (const BeginOfEvent *) |
|
void | printDetectorLevels (const G4VTouchable *) const |
|
void | processHit (const G4Step *step) |
|
void | resetForNewPrimary (const G4Step *) |
|
void | setNumberCheckedHits (int val) |
|
void | setParameterized (bool val) |
|
G4ThreeVector | setToGlobal (const G4ThreeVector &, const G4VTouchable *) const |
|
G4ThreeVector | setToLocal (const G4ThreeVector &, const G4VTouchable *) const |
|
virtual int | setTrackID (const G4Step *) |
|
void | setUseMap (bool val) |
|
void | update (const ::EndOfEvent *) override |
|
void | update (const BeginOfEvent *) override |
| This routine will be called when the appropriate signal arrives. More...
|
|
void | update (const BeginOfRun *) override |
| This routine will be called when the appropriate signal arrives. More...
|
|
void | update (const BeginOfTrack *trk) override |
| This routine will be called when the appropriate signal arrives. More...
|
|
void | update (const EndOfTrack *trk) override |
| This routine will be called when the appropriate signal arrives. More...
|
|
void | updateHit (CaloG4Hit *) |
|
TrackInformation * | cmsTrackInformation (const G4Track *aTrack) |
|
Local3DPoint | ConvertToLocal3DPoint (const G4ThreeVector &point) const |
|
Local3DPoint | FinalStepPosition (const G4Step *step, coordinates) const |
|
Local3DPoint | InitialStepPosition (const G4Step *step, coordinates) const |
|
Local3DPoint | LocalPostStepPosition (const G4Step *step) const |
|
Local3DPoint | LocalPreStepPosition (const G4Step *step) const |
|
void | NaNTrap (const G4Step *step) const |
|
void | setNames (const std::vector< std::string > &) |
|
virtual void | update (const EndOfEvent *)=0 |
| This routine will be called when the appropriate signal arrives. More...
|
|
Definition at line 22 of file DreamSD.h.
◆ DimensionMap
◆ Doubles
◆ DreamSD()
Definition at line 34 of file DreamSD.cc.
49 dd4hep_ =
p.getParameter<
bool>(
"g4GeometryDD4hepSource");
53 edm::LogVerbatim(
"EcalSim") <<
"Constructing a DreamSD with name " << GetName()
54 <<
"\nDreamSD:: Use of Birks law is set to " <<
useBirk_
55 <<
" with three constants kB = " <<
birk1_ <<
", C1 = " <<
birk2_ <<
", C2 = " <<
birk3_
56 <<
"\n Slope for Light yield is set to " <<
slopeLY_
57 <<
"\n Parameterization of Cherenkov is set to " <<
doCherenkov_
61 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
63 for (
auto lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite, ++
k)
References birk1_, birk2_, birk3_, chAngleIntegrals_, dd4hep_, doCherenkov_, g, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), initMap(), dqmdumpme::k, MeV, Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, readBothSide_, slopeLY_, and useBirk_.
◆ ~DreamSD()
◆ cherenkovDeposit_()
double DreamSD::cherenkovDeposit_ |
( |
const G4Step * |
aStep | ) |
|
|
private |
Returns the total energy due to Cherenkov radiation.
Definition at line 254 of file DreamSD.cc.
255 double cherenkovEnergy = 0;
257 return cherenkovEnergy;
258 G4Material *material = aStep->GetTrack()->GetMaterial();
262 if (Rindex ==
nullptr) {
264 return cherenkovEnergy;
269 int Rlength = Rindex->GetVectorLength() - 1;
270 double Pmin = Rindex->Energy(0);
271 double Pmax = Rindex->Energy(Rlength);
276 const G4StepPoint *pPreStepPoint = aStep->GetPreStepPoint();
277 const G4StepPoint *pPostStepPoint = aStep->GetPostStepPoint();
278 const G4ThreeVector &x0 = pPreStepPoint->GetPosition();
279 G4ThreeVector p0 = aStep->GetDeltaPosition().unit();
280 const G4DynamicParticle *aParticle = aStep->GetTrack()->GetDynamicParticle();
281 const double charge = aParticle->GetDefinition()->GetPDGCharge();
283 double beta = 0.5 * (pPreStepPoint->GetBeta() + pPostStepPoint->GetBeta());
284 double BetaInverse = 1.0 /
beta;
292 if (meanNumberOfPhotons <= 0.0) {
294 edm::LogVerbatim(
"EcalSim") <<
"Mean number of photons is zero: " << meanNumberOfPhotons <<
", stopping here";
296 return cherenkovEnergy;
300 meanNumberOfPhotons *= aStep->GetStepLength();
303 int numPhotons = static_cast<int>(G4Poisson(meanNumberOfPhotons));
305 if (numPhotons <= 0) {
307 edm::LogVerbatim(
"EcalSim") <<
"Poission number of photons is zero: " << numPhotons <<
", stopping here";
309 return cherenkovEnergy;
314 double maxCos = BetaInverse / (*Rindex)[Rlength];
315 double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
318 for (
int iPhoton = 0; iPhoton < numPhotons; ++iPhoton) {
321 double sampledMomentum, sampledRI;
322 double cosTheta, sin2Theta;
326 randomNumber = G4UniformRand();
327 sampledMomentum = Pmin + randomNumber *
dp;
328 sampledRI = Rindex->Value(sampledMomentum);
329 cosTheta = BetaInverse / sampledRI;
331 sin2Theta = (1.0 - cosTheta) * (1.0 + cosTheta);
332 randomNumber = G4UniformRand();
334 }
while (randomNumber * maxSin2 > sin2Theta);
338 randomNumber = G4UniformRand();
340 double phi = twopi * randomNumber;
347 double sinTheta =
sqrt(sin2Theta);
350 double pz = cosTheta;
351 G4ThreeVector photonDirection(
px,
py, pz);
354 photonDirection.rotateUz(p0);
357 randomNumber = G4UniformRand();
358 G4ThreeVector photonPosition = x0 + randomNumber * aStep->GetDeltaPosition();
359 G4ThreeVector photonMomentum = sampledMomentum * photonDirection;
364 return cherenkovEnergy;
References HLT_FULL_cff::beta, ALCARECOTkAlJpsiMuMu_cff::charge, funct::cos(), Phase1L1TJetProducer_cfi::cosPhi, Calorimetry_cff::dp, getAverageNumberOfPhotons_(), getPhotonEnergyDeposit_(), materialPropertiesTable_, phi, dataAnalyzerFineBiningParameters_cff::Pmax, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, funct::sin(), Phase1L1TJetProducer_cfi::sinPhi, and mathSSE::sqrt().
Referenced by getEnergyDeposit().
◆ crystalLength()
double DreamSD::crystalLength |
( |
G4LogicalVolume * |
lv | ) |
const |
|
private |
◆ crystalWidth()
double DreamSD::crystalWidth |
( |
G4LogicalVolume * |
lv | ) |
const |
|
private |
◆ curve_LY()
double DreamSD::curve_LY |
( |
const G4Step * |
aStep, |
|
|
int |
flag |
|
) |
| |
|
private |
Definition at line 207 of file DreamSD.cc.
208 auto const stepPoint = aStep->GetPreStepPoint();
209 auto const lv = stepPoint->GetTouchable()->GetVolume(0)->GetLogicalVolume();
210 G4String nameVolume = lv->GetName();
213 G4ThreeVector localPoint =
setToLocal(stepPoint->GetPosition(), stepPoint->GetTouchable());
215 double localz = localPoint.x();
216 double dapd = 0.5 * crlength -
flag * localz;
217 if (dapd >= -0.1 || dapd <= crlength + 0.1) {
221 edm::LogWarning(
"EcalSim") <<
"DreamSD: light coll curve : wrong distance "
222 <<
"to APD " << dapd <<
" crlength = " << crlength <<
" crystal name = " << nameVolume
223 <<
" z of localPoint = " << localz <<
" take weight = " <<
weight;
226 edm::LogVerbatim(
"EcalSim") <<
"DreamSD, light coll curve : " << dapd <<
" crlength = " << crlength
227 <<
" crystal name = " << nameVolume <<
" z of localPoint = " << localz
228 <<
" take weight = " <<
weight;
References crystalLength(), RemoveAddSevLevel::flag, CaloSD::setToLocal(), slopeLY_, and mps_merge::weight.
Referenced by getEnergyDeposit().
◆ fillMap()
void DreamSD::fillMap |
( |
const std::string & |
name, |
|
|
double |
length, |
|
|
double |
width |
|
) |
| |
|
private |
Definition at line 188 of file DreamSD.cc.
189 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
190 edm::LogVerbatim(
"EcalSim") <<
"LV Store with " << lvs->size() <<
" elements";
191 G4LogicalVolume *lv =
nullptr;
192 for (
auto lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
194 if ((*lvcite)->GetName() == static_cast<G4String>(
name)) {
200 edm::LogVerbatim(
"EcalSim") <<
"DreamSD::fillMap (for " <<
name <<
" Logical Volume " << lv <<
" Length " << length
201 <<
" Width " <<
width;
References Skims_PA_cff::name, ApeEstimator_cff::width, and xtalLMap_.
Referenced by initMap().
◆ getAverageNumberOfPhotons_()
double DreamSD::getAverageNumberOfPhotons_ |
( |
const double |
charge, |
|
|
const double |
beta, |
|
|
const G4Material * |
aMaterial, |
|
|
const G4MaterialPropertyVector * |
rIndex |
|
) |
| |
|
private |
◆ getEnergyDeposit()
double DreamSD::getEnergyDeposit |
( |
const G4Step * |
aStep | ) |
|
|
overrideprotectedvirtual |
Reimplemented from CaloSD.
Definition at line 70 of file DreamSD.cc.
75 double edep = aStep->GetTotalEnergyDeposit() *
weight;
82 edm::LogVerbatim(
"EcalSim") <<
"DreamSD:: " << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() <<
" Side "
83 <<
side_ <<
" Light Collection Efficiency " <<
weight <<
" Weighted Energy Deposit "
References birk1_, birk2_, birk3_, cherenkovDeposit_(), curve_LY(), doCherenkov_, CaloSD::getAttenuation(), MeV, side_, useBirk_, and mps_merge::weight.
◆ getPhotonEnergyDeposit_()
double DreamSD::getPhotonEnergyDeposit_ |
( |
const G4ParticleMomentum & |
p, |
|
|
const G4ThreeVector & |
x, |
|
|
const G4Step * |
aStep |
|
) |
| |
|
private |
◆ initMap()
void DreamSD::initMap |
( |
const std::string & |
sd | ) |
|
|
private |
Definition at line 123 of file DreamSD.cc.
127 while (fv.firstChild()) {
128 std::string name = static_cast<std::string>(dd4hep::dd::noNamespace(fv.name()));
129 std::vector<double> paras(fv.parameters());
145 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
147 const DDSolid &sol = fv.logicalPart().solid();
152 <<
" Parameter 0 = " << paras[0];
158 G4LogicalVolume *lv =
nullptr;
159 for (
auto lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
160 if ((*lvcite)->GetName() ==
name) {
172 edm::LogVerbatim(
"EcalSim") <<
"DreamSD: Length Table for ReadOutName = " <<
sd <<
":";
174 DimensionMap::const_iterator ite =
xtalLMap_.begin();
177 G4String
name =
"Unknown";
178 if (ite->first !=
nullptr)
179 name = (ite->first)->GetName();
181 edm::LogVerbatim(
"EcalSim") <<
" " <<
i <<
" " << ite->first <<
" " <<
name <<
" L = " << ite->second.first
182 <<
" W = " << ite->second.second;
References cpvDD4Hep_, cpvDDD_, dd4hep_, cms::DDSolidShapeMap, fillMap(), ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), cms::DDFilteredView::firstChild(), mps_fire::i, k_ScaleFromDD4HepToG4, k_ScaleFromDDDToG4, DDFilteredView::logicalPart(), Skims_PA_cff::name, cms::dd::name(), DDName::name(), DDBase< N, C >::name(), cms::DDFilteredView::name(), DDFilteredView::next(), DDSolid::parameters(), cms::DDFilteredView::parameters(), sd, DDSolid::shape(), cms::DDFilteredView::shape(), DDLogicalPart::solid(), jetUpdater_cfi::sort, AlCaHLTBitMon_QueryRunRegistry::string, ApeEstimator_cff::width, and xtalLMap_.
Referenced by DreamSD().
◆ initRun()
void DreamSD::initRun |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ setDetUnitId()
uint32_t DreamSD::setDetUnitId |
( |
const G4Step * |
aStep | ) |
|
|
overridevirtual |
◆ setPbWO2MaterialProperties_()
bool DreamSD::setPbWO2MaterialProperties_ |
( |
G4Material * |
aMaterial | ) |
|
|
private |
Sets material properties at run-time...
Definition at line 433 of file DreamSD.cc.
435 if (pbWO2Name != aMaterial->GetName()) {
437 <<
"expecting " << pbWO2Name <<
", got " << aMaterial->GetName();
441 G4MaterialPropertiesTable *
table =
new G4MaterialPropertiesTable();
445 const int nEntries = 14;
446 double PhotonEnergy[nEntries] = {1.7712 * eV,
460 double RefractiveIndex[nEntries] = {2.17728,
475 table->AddProperty(
"RINDEX", PhotonEnergy, RefractiveIndex, nEntries);
476 aMaterial->SetMaterialPropertiesTable(
table);
483 double currentRI = RefractiveIndex[
index];
484 double currentPM = PhotonEnergy[
index];
485 double currentCAI = 0.0;
487 double prevPM = currentPM;
488 double prevCAI = currentCAI;
489 double prevRI = currentRI;
490 while (++
index < nEntries) {
491 currentRI = RefractiveIndex[
index];
492 currentPM = PhotonEnergy[
index];
493 currentCAI = 0.5 * (1.0 / (prevRI * prevRI) + 1.0 / (currentRI * currentRI));
494 currentCAI = prevCAI + (currentPM - prevPM) * currentCAI;
499 prevCAI = currentCAI;
504 edm::LogVerbatim(
"EcalSim") <<
"Material properties set for " << aMaterial->GetName();
References chAngleIntegrals_, AlCaHLTBitMon_QueryRunRegistry::string, and TableParser::table.
Referenced by initRun().
◆ birk1_
◆ birk2_
◆ birk3_
◆ chAngleIntegrals_
std::unique_ptr<G4PhysicsFreeVector> DreamSD::chAngleIntegrals_ |
|
private |
◆ cpvDD4Hep_
◆ cpvDDD_
◆ dd4hep_
◆ doCherenkov_
bool DreamSD::doCherenkov_ |
|
private |
◆ k_ScaleFromDD4HepToG4
constexpr double DreamSD::k_ScaleFromDD4HepToG4 = 1.0 / dd4hep::mm |
|
staticconstexprprivate |
◆ k_ScaleFromDDDToG4
constexpr double DreamSD::k_ScaleFromDDDToG4 = 1.0 |
|
staticconstexprprivate |
◆ materialPropertiesTable_
G4MaterialPropertiesTable* DreamSD::materialPropertiesTable_ |
|
private |
◆ nphotons_
◆ readBothSide_
bool DreamSD::readBothSide_ |
|
private |
◆ side_
◆ slopeLY_
◆ useBirk_
◆ xtalLMap_
std::pair< double, double > Doubles
void initMap(const std::string &)
void fillMap(const std::string &, double, double)
static constexpr double k_ScaleFromDDDToG4
const cms::DDCompactView * cpvDD4Hep_
double cherenkovDeposit_(const G4Step *aStep)
Returns the total energy due to Cherenkov radiation.
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
double getPhotonEnergyDeposit_(const G4ParticleMomentum &p, const G4ThreeVector &x, const G4Step *aStep)
Returns energy deposit for a given photon.
std::unique_ptr< G4PhysicsFreeVector > chAngleIntegrals_
Table of Cherenkov angle integrals vs photon momentum.
T getUntrackedParameter(std::string const &, T const &) const
double crystalWidth(G4LogicalVolume *) const
G4MaterialPropertiesTable * materialPropertiesTable_
Log< level::Warning, false > LogWarning
Sin< T >::type sin(const T &t)
DDSolidShape shape(void) const
The type of the solid.
Cos< T >::type cos(const T &t)
std::string name(Mapping a, V value)
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
double getAverageNumberOfPhotons_(const double charge, const double beta, const G4Material *aMaterial, const G4MaterialPropertyVector *rIndex)
Returns average number of photons created by track.
bool setPbWO2MaterialProperties_(G4Material *aMaterial)
Sets material properties at run-time...
static double getEfficiency(const double &waveLengthNm)
Return efficiency for given photon wavelength (in nm)
CaloSD(const std::string &aSDname, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
const std::string & name() const
Returns the name.
static constexpr double k_ScaleFromDD4HepToG4
const DDCompactView * cpvDDD_
double crystalLength(G4LogicalVolume *) const
Log< level::Info, true > LogVerbatim
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
A DDSolid represents the shape of a part.
T getParameter(std::string const &) const
double curve_LY(const G4Step *, int)
Abs< T >::type abs(const T &t)
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g