12 #include "CLHEP/Units/GlobalPhysicalConstants.h"
13 #include "CLHEP/Units/GlobalSystemOfUnits.h"
18 binEta =
p.getUntrackedParameter<
int>(
"NBinEta", 100);
19 binPhi =
p.getUntrackedParameter<
int>(
"NBinPhi", 180);
20 etaLow =
p.getUntrackedParameter<
double>(
"EtaLow", 5.0);
21 etaHigh =
p.getUntrackedParameter<
double>(
"EtaHigh", 7.0);
22 fillHistos =
p.getUntrackedParameter<
bool>(
"FillHisto",
true);
23 printSum =
p.getUntrackedParameter<
bool>(
"PrintSummary",
false);
24 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCastorHistos: FillHisto : " <<
fillHistos <<
" PrintSummary "
27 <<
"NX " <<
binPhi <<
" Range " << -
pi <<
":" <<
pi <<
" (Eta limit " <<
etaLow <<
":"
34 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCastorHistos: Save user "
42 const G4ThreeVector&
dir = aTrack->GetMomentum();
43 if (
dir.theta() != 0) {
49 double theEnergy = aTrack->GetTotalEnergy();
50 int theID = (
int)(aTrack->GetDefinition()->GetPDGEncoding());
59 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCastorHistos: Track " << aTrack->GetTrackID() <<
" Code " << theID
60 <<
" Energy " << theEnergy /
GeV <<
" GeV; Eta " <<
eta_ <<
" Phi " <<
phi_ / deg
61 <<
" PT " <<
dir.perp() /
GeV <<
" GeV *****";
65 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
66 double step = aStep->GetStepLength();
67 double radl = material->GetRadlen();
68 double intl = material->GetNuclearInterLength();
69 double density = material->GetDensity() / (
g / cm3);
73 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
93 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCastorHistos: " <<
name <<
" " <<
step <<
" " << matName <<
" "
97 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCastorHistos: Step at " <<
name <<
" Length " <<
step <<
" in "
98 << matName <<
" of density " <<
density <<
" g/cc; Radiation Length " << radl
100 <<
" Interaction Length " << intl <<
" mm\n"
101 <<
" Position " << aStep->GetPreStepPoint()->GetPosition()
102 <<
" Cylindrical R " << aStep->GetPreStepPoint()->GetPosition().perp()
104 <<
" L/Lambda " <<
step / intl <<
"/" <<
intLen;
107 int level = ((touch->GetHistoryDepth()) + 1);
110 name1 = touch->GetVolume(
level - 4)->GetName();
112 name2 = touch->GetVolume(
level - 5)->GetName();
113 if (name1 ==
"CAST") {
117 else if (
name2 ==
"CAHC")
119 else if (
name2 ==
"CEDC")
121 else if (
name2 ==
"CHDC")
128 LogDebug(
"MaterialBudget") <<
"MaterialBudgetCastorHistos: Level " <<
level <<
" Volume " << name1 <<
" and " <<
name2
129 <<
" ID1 " <<
id1 <<
" (" << id1Old <<
") ID2 " <<
id2 <<
" (" << id2Old <<
")";
170 if (!
tfile.isAvailable())
171 throw cms::Exception(
"BadConfig") <<
"MaterialBudgetCastorHistos: TFileService unavailable: "
172 <<
"please add it to config file";
175 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCastorHistos: Booking user "
176 <<
"histos === with " <<
binEta <<
" bins "
190 tag2 =
" (-ve Eta Side)";
192 tag2 =
" (+ve Eta Side)";
198 ireg = (ireg - 1) / 2;
218 me900[
i] =
tfile->make<TProfile2D>(std::to_string(
i + 900).c_str(),
219 (
"MB(X0) prof Eta Phi in region " +
title).c_str(),
226 me1000[
i] =
tfile->make<TProfile2D>(std::to_string(
i + 1000).c_str(),
227 (
"MB(L0) prof Eta Phi in region " +
title).c_str(),
234 me1100[
i] =
tfile->make<TProfile2D>(std::to_string(
i + 1100).c_str(),
235 (
"MB(Step) prof Eta Phi in region " +
title).c_str(),
242 me1200[
i] =
tfile->make<TH2F>(std::to_string(
i + 1200).c_str(),
243 (
"Eta vs Phi in region " +
title).c_str(),
252 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCastorHistos: Booking user "
253 <<
"histos done ===";
257 int ii = 2 * (
id - 1) + ix;
258 double etaAbs =
eta_;
263 LogDebug(
"MaterialBudget") <<
"MaterialBudgetCastorHistos:FillHisto "
264 <<
"called with index " <<
id <<
":" << ix <<
":" <<
ii <<
" eta " << etaAbs <<
" ("