12 #include "G4LogicalVolumeStore.hh"
25 public Observer<const BeginOfTrack*>,
36 void update(
const G4Step*)
override;
40 int findVolume(
const G4VTouchable* touch,
bool stop)
const;
55 nList_ = listNames_.size();
56 edm::LogVerbatim(
"HGCSim") <<
"HGCalTBMB initialized for " << nList_ <<
" volumes";
64 <<
"please add it to config file";
67 for (
unsigned int i = 0;
i <=
nList_;
i++) {
69 sprintf(name,
"RadL%d",
i);
70 sprintf(title,
"MB(X0) for (%s)", named.c_str());
74 sprintf(name,
"IntL%d",
i);
75 sprintf(title,
"MB(L0) for (%s)", named.c_str());
79 sprintf(name,
"StepL%d",
i);
80 sprintf(title,
"MB(Step) for (%s)", named.c_str());
92 intLen_ = std::vector<double>(nList_ + 1, 0);
93 stepLen_ = std::vector<double>(nList_ + 1, 0);
96 const G4Track* aTrack = (*trk)();
97 const G4ThreeVector& mom = aTrack->GetMomentum();
98 double theEnergy = aTrack->GetTotalEnergy();
99 int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
100 edm::LogVerbatim(
"HGCSim") <<
"MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() <<
" Code " << theID
101 <<
" Energy " << theEnergy /
CLHEP::GeV <<
" GeV; Momentum " << mom;
106 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
107 double step = aStep->GetStepLength();
108 double radl = material->GetRadlen();
109 double intl = material->GetNuclearInterLength();
111 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
116 radLen_[indx] += (step / radl);
117 intLen_[indx] += (step / intl);
123 edm::LogVerbatim(
"HGCSim") <<
"HGCalTBMB::Step in " << touch->GetVolume(0)->GetLogicalVolume()->GetName() <<
" Index "
124 << indx <<
" Step " << step <<
" RadL " << step / radl <<
" IntL " << step / intl;
128 G4Track*
track = aStep->GetTrack();
129 track->SetTrackStatus(fStopAndKill);
150 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
151 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
152 if (aStep->GetPostStepPoint() !=
nullptr)
153 hitPoint = aStep->GetPostStepPoint()->GetPosition();
154 double zz = hitPoint.z();
159 edm::LogVerbatim(
"HGCSim") <<
" HGCalTBMB::Name " << touch->GetVolume(0)->GetName() <<
" z " << zz <<
" Flag" << flag;
166 int level = (touch->GetHistoryDepth()) + 1;
170 if (strcmp(name.c_str(),
stopName_.c_str()) == 0)
173 for (
unsigned int k = 0;
k <
nList_; ++
k) {
174 if (strcmp(name.c_str(),
listNames_[
k].c_str()) == 0) {
Log< level::Info, true > LogVerbatim
const HGCalTBMB & operator=(const HGCalTBMB &)=delete
#define DEFINE_SIMWATCHER(type)
T * make(const Args &...args) const
make new ROOT object
int findVolume(const G4VTouchable *touch, bool stop) const
bool stopAfter(const G4Step *)
std::vector< double > intLen_
std::vector< TH1D * > me100_
std::vector< TH1D * > me300_
void update(const BeginOfTrack *) override
This routine will be called when the appropriate signal arrives.
HGCalTBMB(const edm::ParameterSet &)
T getParameter(std::string const &) const
std::vector< TH1D * > me200_
std::vector< double > radLen_
std::vector< std::string > listNames_
std::vector< double > stepLen_