12 #include "G4LogicalVolumeStore.hh"
15 #include "DD4hep/Filter.h"
29 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget initialized for " <<
detTypes.size() <<
" detector types";
45 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget Stop condition for " <<
etaRegions.size() <<
" eta regions";
56 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
57 std::vector<G4LogicalVolume*>::const_iterator lvcite;
59 unsigned int kount =
detNames.size();
60 for (
unsigned int ii = 0;
ii < kount; ++
ii)
63 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
66 static_cast<std::string>(dd4hep::dd::noNamespace((*lvcite)->GetName())).c_str()) == 0) {
100 const G4Track* aTrack = (*trk)();
101 const G4ThreeVector& mom = aTrack->GetMomentum();
102 if (mom.theta() != 0) {
111 double theEnergy = aTrack->GetTotalEnergy();
112 int theID = (
int)(aTrack->GetDefinition()->GetPDGEncoding());
113 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() <<
" Code " << theID
114 <<
" Energy " << theEnergy /
CLHEP::GeV <<
" GeV; Eta " <<
eta_ <<
" Phi "
115 <<
phi_ / CLHEP::deg <<
" PT " << mom.perp() /
CLHEP::GeV <<
" GeV *****";
121 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
122 double step = aStep->GetStepLength();
123 double radl = material->GetRadlen();
124 double intl = material->GetNuclearInterLength();
126 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
127 unsigned int indx =
detTypes.size();
131 if (
detLevels[nc +
kk] <= (
int)((touch->GetHistoryDepth()) + 1)) {
133 if ((touch->GetVolume(
jj)->GetLogicalVolume()) ==
logVolumes[nc +
kk]) {
149 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget::Step in "
150 << dd4hep::dd::noNamespace(touch->GetVolume(0)->GetLogicalVolume()->GetName())
151 <<
" Index " << indx <<
" Step " <<
step <<
" RadL " <<
step / radl <<
" IntL "
156 G4Track*
track = aStep->GetTrack();
157 track->SetTrackStatus(fStopAndKill);
194 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget::Volume[" <<
ii <<
"]: " <<
name <<
" eta " <<
eta_ <<
" == Step "
204 if (!
tfile.isAvailable())
206 <<
"please add it to config file";
213 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget: Booking user "
214 <<
"histos === with " << binEta <<
" bins "
215 <<
"in eta from " <<
minEta <<
" to " <<
maxEta <<
" and " << binPhi <<
" bins "
220 for (
unsigned int i = 0;
i <=
detTypes.size();
i++) {
225 sprintf(
name,
"%d",
i + 100);
226 sprintf(
title,
"MB(X0) prof Eta in %s", named.c_str());
228 sprintf(
name,
"%d",
i + 200);
229 sprintf(
title,
"MB(L0) prof Eta in %s", named.c_str());
231 sprintf(
name,
"%d",
i + 300);
232 sprintf(
title,
"MB(Step) prof Eta in %s", named.c_str());
234 sprintf(
name,
"%d",
i + 400);
235 sprintf(
title,
"MB(X0) prof Phi in %s", named.c_str());
237 sprintf(
name,
"%d",
i + 500);
238 sprintf(
title,
"MB(L0) prof Phi in %s", named.c_str());
240 sprintf(
name,
"%d",
i + 600);
241 sprintf(
title,
"MB(Step) prof Phi in %s", named.c_str());
245 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget: Booking user "
246 <<
"histos done ===";
250 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
251 if (aStep->GetPostStepPoint() !=
nullptr)
252 hitPoint = aStep->GetPostStepPoint()->GetPosition();
253 double rr = hitPoint.perp();
259 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudget::Eta " <<
eta_ <<
" in Region[" <<
ii <<
"] with "
272 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudget::Stop after R = " <<
rr <<
" and Z = " <<
zz;
278 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudget:: R = " <<
rr <<
" and Z = " <<
zz <<
" Flag " <<
flag;