CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MaterialBudgetHcal Class Reference

#include <MaterialBudgetHcal.h>

Inheritance diagram for MaterialBudgetHcal:
SimWatcher Observer< const BeginOfTrack *> Observer< const G4Step *> Observer< const EndOfTrack *>

Public Member Functions

void beginRun (edm::EventSetup const &) override
 
 MaterialBudgetHcal (const edm::ParameterSet &)
 
 MaterialBudgetHcal (const MaterialBudgetHcal &)=delete
 
const MaterialBudgetHcaloperator= (const MaterialBudgetHcal &)=delete
 
void registerConsumes (edm::ConsumesCollector) override
 
- Public Member Functions inherited from SimWatcher
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack *>
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step *>
 Observer ()
 
void slotForUpdate (const G4Step * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack *>
 Observer ()
 
void slotForUpdate (const EndOfTrack * iT)
 
virtual ~Observer ()
 

Private Member Functions

bool stopAfter (const G4Step *)
 
void update (const BeginOfTrack *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

edm::ESGetToken< cms::DDCompactView, IdealGeometryRecordcpvTokenDD4hep_
 
edm::ESGetToken< DDCompactView, IdealGeometryRecordcpvTokenDDD_
 
bool fromdd4hep_
 
double rMax_
 
std::unique_ptr< MaterialBudgetCastorHistostheHistoCastor_
 
std::unique_ptr< MaterialBudgetHcalHistostheHistoHcal_
 
double zMax_
 

Additional Inherited Members

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

Definition at line 21 of file MaterialBudgetHcal.h.

Constructor & Destructor Documentation

◆ MaterialBudgetHcal() [1/2]

MaterialBudgetHcal::MaterialBudgetHcal ( const edm::ParameterSet p)

Definition at line 16 of file MaterialBudgetHcal.cc.

References fromdd4hep_, edm::ParameterSet::getUntrackedParameter(), visualization-live-secondInstance_cfg::m, AlCaHLTBitMon_ParallelJobs::p, rMax_, theHistoCastor_, theHistoHcal_, and zMax_.

16  {
17  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MaterialBudgetHcal");
18  rMax_ = m_p.getUntrackedParameter<double>("RMax", 4.5) * CLHEP::m;
19  zMax_ = m_p.getUntrackedParameter<double>("ZMax", 13.0) * CLHEP::m;
20  fromdd4hep_ = m_p.getUntrackedParameter<bool>("Fromdd4hep", false);
21  bool doHcal = m_p.getUntrackedParameter<bool>("DoHCAL", true);
22  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcal initialized with rMax " << rMax_ << " mm and zMax " << zMax_
23  << " mm doHcal is set to " << doHcal << " and Fromdd4hep to " << fromdd4hep_;
24  if (doHcal) {
25  theHistoHcal_ = std::make_unique<MaterialBudgetHcalHistos>(m_p);
26  theHistoCastor_.reset(nullptr);
27  } else {
28  theHistoHcal_.reset(nullptr);
29  theHistoCastor_ = std::make_unique<MaterialBudgetCastorHistos>(m_p);
30  }
31 }
Log< level::Info, true > LogVerbatim
std::unique_ptr< MaterialBudgetHcalHistos > theHistoHcal_
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< MaterialBudgetCastorHistos > theHistoCastor_

◆ MaterialBudgetHcal() [2/2]

MaterialBudgetHcal::MaterialBudgetHcal ( const MaterialBudgetHcal )
delete

Member Function Documentation

◆ beginRun()

void MaterialBudgetHcal::beginRun ( edm::EventSetup const &  es)
overridevirtual

Reimplemented from SimWatcher.

Definition at line 41 of file MaterialBudgetHcal.cc.

References cpvTokenDD4hep_, cpvTokenDDD_, fromdd4hep_, edm::EventSetup::getHandle(), and theHistoHcal_.

41  {
42  //----- Check that selected volumes are indeed part of the geometry
43  // Numbering From DDD
44  if (fromdd4hep_) {
45  const auto& pDD = es.getHandle(cpvTokenDD4hep_);
46  if (theHistoHcal_)
47  theHistoHcal_->fillBeginJob((*pDD));
48  } else {
49  const auto& pDD = es.getHandle(cpvTokenDDD_);
50  if (theHistoHcal_)
51  theHistoHcal_->fillBeginJob((*pDD));
52  }
53 }
std::unique_ptr< MaterialBudgetHcalHistos > theHistoHcal_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4hep_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_

◆ operator=()

const MaterialBudgetHcal& MaterialBudgetHcal::operator= ( const MaterialBudgetHcal )
delete

◆ registerConsumes()

void MaterialBudgetHcal::registerConsumes ( edm::ConsumesCollector  cc)
overridevirtual

Reimplemented from SimWatcher.

Definition at line 33 of file MaterialBudgetHcal.cc.

References edm::BeginRun, gpuPixelDoublets::cc, cpvTokenDD4hep_, cpvTokenDDD_, and fromdd4hep_.

33  {
34  if (fromdd4hep_)
36  else
38  edm::LogVerbatim("MaterialBudget") << "MaterialBudgetHcal: Initialize the token for CompactView";
39 }
Log< level::Info, true > LogVerbatim
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4hep_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_

◆ stopAfter()

bool MaterialBudgetHcal::stopAfter ( const G4Step *  aStep)
private

Definition at line 84 of file MaterialBudgetHcal.cc.

References funct::abs(), rMax_, findQualityFiles::rr, zMax_, and geometryCSVtoXML::zz.

Referenced by update().

84  {
85  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
86  double rr = hitPoint.perp();
87  double zz = std::abs(hitPoint.z());
88 
89  if (rr > rMax_ || zz > zMax_) {
90  edm::LogVerbatim("MaterialBudget") << " MaterialBudgetHcal::StopAfter R = " << rr << " and Z = " << zz;
91  return true;
92  } else {
93  return false;
94  }
95 }
Log< level::Info, true > LogVerbatim
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ update() [1/3]

void MaterialBudgetHcal::update ( const BeginOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack *>.

Definition at line 55 of file MaterialBudgetHcal.cc.

References theHistoCastor_, and theHistoHcal_.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

55  {
56  const G4Track* aTrack = (*trk)(); // recover G4 pointer if wanted
57  if (theHistoHcal_)
58  theHistoHcal_->fillStartTrack(aTrack);
59  if (theHistoCastor_)
60  theHistoCastor_->fillStartTrack(aTrack);
61 }
std::unique_ptr< MaterialBudgetHcalHistos > theHistoHcal_
std::unique_ptr< MaterialBudgetCastorHistos > theHistoCastor_

◆ update() [2/3]

void MaterialBudgetHcal::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step *>.

Definition at line 63 of file MaterialBudgetHcal.cc.

References stopAfter(), theHistoCastor_, theHistoHcal_, and HLT_2024v14_cff::track.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

63  {
64  //---------- each step
65  if (theHistoHcal_)
66  theHistoHcal_->fillPerStep(aStep);
67  if (theHistoCastor_)
68  theHistoCastor_->fillPerStep(aStep);
69 
70  //----- Stop tracking after selected position
71  if (stopAfter(aStep)) {
72  G4Track* track = aStep->GetTrack();
73  track->SetTrackStatus(fStopAndKill);
74  }
75 }
std::unique_ptr< MaterialBudgetHcalHistos > theHistoHcal_
bool stopAfter(const G4Step *)
std::unique_ptr< MaterialBudgetCastorHistos > theHistoCastor_

◆ update() [3/3]

void MaterialBudgetHcal::update ( const EndOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack *>.

Definition at line 77 of file MaterialBudgetHcal.cc.

References theHistoCastor_, and theHistoHcal_.

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

77  {
78  if (theHistoHcal_)
79  theHistoHcal_->fillEndTrack();
80  if (theHistoCastor_)
81  theHistoCastor_->fillEndTrack();
82 }
std::unique_ptr< MaterialBudgetHcalHistos > theHistoHcal_
std::unique_ptr< MaterialBudgetCastorHistos > theHistoCastor_

Member Data Documentation

◆ cpvTokenDD4hep_

edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> MaterialBudgetHcal::cpvTokenDD4hep_
private

Definition at line 44 of file MaterialBudgetHcal.h.

Referenced by beginRun(), and registerConsumes().

◆ cpvTokenDDD_

edm::ESGetToken<DDCompactView, IdealGeometryRecord> MaterialBudgetHcal::cpvTokenDDD_
private

Definition at line 43 of file MaterialBudgetHcal.h.

Referenced by beginRun(), and registerConsumes().

◆ fromdd4hep_

bool MaterialBudgetHcal::fromdd4hep_
private

Definition at line 46 of file MaterialBudgetHcal.h.

Referenced by beginRun(), MaterialBudgetHcal(), and registerConsumes().

◆ rMax_

double MaterialBudgetHcal::rMax_
private

Definition at line 45 of file MaterialBudgetHcal.h.

Referenced by MaterialBudgetHcal(), and stopAfter().

◆ theHistoCastor_

std::unique_ptr<MaterialBudgetCastorHistos> MaterialBudgetHcal::theHistoCastor_
private

Definition at line 42 of file MaterialBudgetHcal.h.

Referenced by MaterialBudgetHcal(), and update().

◆ theHistoHcal_

std::unique_ptr<MaterialBudgetHcalHistos> MaterialBudgetHcal::theHistoHcal_
private

Definition at line 41 of file MaterialBudgetHcal.h.

Referenced by beginRun(), MaterialBudgetHcal(), and update().

◆ zMax_

double MaterialBudgetHcal::zMax_
private

Definition at line 45 of file MaterialBudgetHcal.h.

Referenced by MaterialBudgetHcal(), and stopAfter().