13 #include "G4LogicalVolumeStore.hh" 24 public Observer<const BeginOfTrack*>,
37 void update(
const G4Step*)
override;
41 int findVolume(
const G4VTouchable* touch,
bool stop)
const;
55 stopName_(m_p.getParameter<
std::
string>(
"StopName")),
56 stopZ_(m_p.getParameter<double>(
"MaximumZ")),
57 nList_(listNames_.
size()) {
63 produces<MaterialAccountingCaloCollection>(
"HGCalTBMB");
69 hgc->emplace_back(mbc);
80 const G4Track* aTrack = (*trk)();
81 const G4ThreeVector& mom = aTrack->GetMomentum();
82 double theEnergy = aTrack->GetTotalEnergy();
83 int theID = (
int)(aTrack->GetDefinition()->GetPDGEncoding());
84 edm::LogVerbatim(
"HGCSim") <<
"HGCalTBMBProducer: Track " << aTrack->GetTrackID() <<
" Code " << theID <<
" Energy " 85 << theEnergy / CLHEP::GeV <<
" GeV; Momentum " << mom;
90 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
91 double step = aStep->GetStepLength();
92 double radl = material->GetRadlen();
93 double intl = material->GetNuclearInterLength();
95 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
107 edm::LogVerbatim(
"HGCSim") <<
"HGCalTBMBProducer::Step in " << touch->GetVolume(0)->GetLogicalVolume()->GetName()
108 <<
" Index " << indx <<
" Step " <<
step <<
" RadL " <<
step / radl <<
" IntL " 113 G4Track*
track = aStep->GetTrack();
114 track->SetTrackStatus(fStopAndKill);
139 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
140 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
141 if (aStep->GetPostStepPoint() !=
nullptr)
142 hitPoint = aStep->GetPostStepPoint()->GetPosition();
143 double zz = hitPoint.z();
148 edm::LogVerbatim(
"HGCSim") <<
" HGCalTBMBProducer::Name " << touch->GetVolume(0)->GetName() <<
" z " <<
zz <<
" Flag" 156 int level = (touch->GetHistoryDepth()) + 1;
163 for (
unsigned int k = 0;
k <
nList_; ++
k) {
Log< level::Info, true > LogVerbatim
#define DEFINE_SIMWATCHER(type)
MaterialAccountingCaloCollection matcoll_
const HGCalTBMBProducer & operator=(const HGCalTBMBProducer &)=delete
std::vector< MaterialAccountingCalo > MaterialAccountingCaloCollection
HGCalTBMBProducer(const edm::ParameterSet &)
const unsigned int nList_
std::vector< double > m_radLen
const std::string stopName_
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< double > radLen_
void update(const BeginOfTrack *) override
This routine will be called when the appropriate signal arrives.
std::vector< double > stepLen_
const edm::ParameterSet m_p
const std::vector< std::string > listNames_
std::vector< double > m_intLen
~HGCalTBMBProducer() override=default
std::vector< double > intLen_
std::vector< double > m_stepLen
bool stopAfter(const G4Step *)
int findVolume(const G4VTouchable *touch, bool stop) const