13 #include "G4LogicalVolumeStore.hh"
24 public Observer<const BeginOfTrack*>,
37 void update(
const G4Step*)
override;
41 int findVolume(
const G4VTouchable* touch,
bool stop)
const;
56 nList_ = listNames_.size();
57 edm::LogVerbatim(
"HGCSim") <<
"HGCalTBMBProducer initialized for " << nList_ <<
" volumes";
62 produces<MaterialAccountingCaloCollection>(
"HGCalTBMB");
68 hgc->emplace_back(mbc);
75 intLen_ = std::vector<double>(nList_ + 1, 0);
76 stepLen_ = std::vector<double>(nList_ + 1, 0);
79 const G4Track* aTrack = (*trk)();
80 const G4ThreeVector& mom = aTrack->GetMomentum();
81 double theEnergy = aTrack->GetTotalEnergy();
82 int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
83 edm::LogVerbatim(
"HGCSim") <<
"HGCalTBMBProducer: Track " << aTrack->GetTrackID() <<
" Code " << theID <<
" Energy "
84 << theEnergy /
CLHEP::GeV <<
" GeV; Momentum " << mom;
89 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
90 double step = aStep->GetStepLength();
91 double radl = material->GetRadlen();
92 double intl = material->GetNuclearInterLength();
94 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
100 intLen_[indx] += (step / intl);
106 edm::LogVerbatim(
"HGCSim") <<
"HGCalTBMBProducer::Step in " << touch->GetVolume(0)->GetLogicalVolume()->GetName()
107 <<
" Index " << indx <<
" Step " << step <<
" RadL " << step / radl <<
" IntL "
112 G4Track*
track = aStep->GetTrack();
113 track->SetTrackStatus(fStopAndKill);
138 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
139 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
140 if (aStep->GetPostStepPoint() !=
nullptr)
141 hitPoint = aStep->GetPostStepPoint()->GetPosition();
142 double zz = hitPoint.z();
147 edm::LogVerbatim(
"HGCSim") <<
" HGCalTBMBProducer::Name " << touch->GetVolume(0)->GetName() <<
" z " << zz <<
" Flag"
155 int level = (touch->GetHistoryDepth()) + 1;
159 if (strcmp(name.c_str(),
stopName_.c_str()) == 0)
162 for (
unsigned int k = 0;
k <
nList_; ++
k) {
163 if (strcmp(name.c_str(),
listNames_[
k].c_str()) == 0) {
Log< level::Info, true > LogVerbatim
#define DEFINE_SIMWATCHER(type)
MaterialAccountingCaloCollection matcoll_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const HGCalTBMBProducer & operator=(const HGCalTBMBProducer &)=delete
std::vector< MaterialAccountingCalo > MaterialAccountingCaloCollection
HGCalTBMBProducer(const edm::ParameterSet &)
std::vector< std::string > listNames_
std::vector< double > m_radLen
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.
int findVolume(const G4VTouchable *touch, bool stop) const
std::vector< double > stepLen_
T getParameter(std::string const &) const
std::vector< double > m_intLen
~HGCalTBMBProducer() override=default
std::vector< double > intLen_
std::vector< double > m_stepLen
bool stopAfter(const G4Step *)