12 #include "CLHEP/Units/GlobalPhysicalConstants.h"
13 #include "CLHEP/Units/GlobalSystemOfUnits.h"
20 binEta =
p.getUntrackedParameter<
int>(
"NBinEta", 260);
21 binPhi =
p.getUntrackedParameter<
int>(
"NBinPhi", 180);
22 maxEta =
p.getUntrackedParameter<
double>(
"MaxEta", 5.2);
23 etaLow =
p.getUntrackedParameter<
double>(
"EtaLow", -5.2);
24 etaHigh =
p.getUntrackedParameter<
double>(
"EtaHigh", 5.2);
25 fillHistos =
p.getUntrackedParameter<
bool>(
"FillHisto",
true);
26 printSum =
p.getUntrackedParameter<
bool>(
"PrintSummary",
false);
42 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Names to be tested for " << attribute <<
" = "
55 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Names to be tested for " << attribute <<
" = "
57 for (
unsigned int i = 0;
i <
hfNames.size();
i++) {
64 std::string ecalRO[2] = {
"EcalHitsEB",
"EcalHitsEE"};
65 attribute =
"ReadOutName";
66 for (
int k = 0;
k < 2;
k++) {
70 std::vector<std::string> senstmp =
getNames(fv3);
71 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Names to be tested for " << attribute <<
" = "
72 <<
value <<
" has " << senstmp.size() <<
" elements";
73 for (
unsigned int i = 0;
i < senstmp.size();
i++)
86 const G4ThreeVector&
dir = aTrack->GetMomentum();
87 if (
dir.theta() != 0) {
93 double theEnergy = aTrack->GetTotalEnergy();
94 int theID = (
int)(aTrack->GetDefinition()->GetPDGEncoding());
103 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() <<
" Code " << theID
104 <<
" Energy " << theEnergy /
CLHEP::GeV <<
" GeV; Eta " <<
eta <<
" Phi "
109 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
110 double step = aStep->GetStepLength();
111 double radl = material->GetRadlen();
112 double intl = material->GetNuclearInterLength();
113 double density = material->GetDensity() / (
g / cm3);
116 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
137 <<
" Material " << matName <<
" Old Length " <<
stepLen <<
" X0 " <<
step / radl
140 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Step at " <<
name <<
" id " <<
id <<
":" << idOld
141 <<
" Length " <<
step <<
" in " << matName <<
" of density " <<
density
142 <<
" g/cc; Radiation Length " << radl <<
" mm; Interaction Length " << intl
145 << aStep->GetPreStepPoint()->GetPosition() <<
" Cylindrical R "
146 << aStep->GetPreStepPoint()->GetPosition().perp() <<
" Length (so far) "
151 int det = 0, lay = 0;
164 det = (touch->GetReplicaNumber(1)) / 1000;
165 lay = (touch->GetReplicaNumber(0) / 10) % 100 + 3;
180 }
else if (lay !=
layer) {
188 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Det " << det <<
" Layer " << lay <<
" Eta "
189 <<
eta <<
" Phi " <<
phi / CLHEP::deg;
191 }
else if (
layer == 1) {
205 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Step at " <<
name <<
" calls filHisto with "
217 if (!
isItHF(aStep->GetPostStepPoint()->GetTouchable())) {
220 <<
"MaterialBudgetHcalHistos: After HF in " <<
name <<
":"
221 << aStep->GetPostStepPoint()->GetTouchable()->GetVolume(0)->GetName() <<
" calls fillHisto with " <<
id;
250 if (!
tfile.isAvailable())
252 <<
"please add it to config file";
262 iter = std::to_string(
i);
264 std::to_string(
i + 100).c_str(), (
"MB(X0) prof Eta in region " + iter).c_str(),
binEta, -
maxEta,
maxEta);
266 std::to_string(
i + 200).c_str(), (
"MB(L0) prof Eta in region " + iter).c_str(),
binEta, -
maxEta,
maxEta);
268 std::to_string(
i + 300).c_str(), (
"MB(Step) prof Eta in region " + iter).c_str(),
binEta, -
maxEta,
maxEta);
272 std::to_string(
i + 500).c_str(), (
"MB(X0) prof Ph in region " + iter).c_str(),
binPhi, -
maxPhi,
maxPhi);
274 std::to_string(
i + 600).c_str(), (
"MB(L0) prof Ph in region " + iter).c_str(),
binPhi, -
maxPhi,
maxPhi);
276 std::to_string(
i + 700).c_str(), (
"MB(Step) prof Ph in region " + iter).c_str(),
binPhi, -
maxPhi,
maxPhi);
279 me900[
i] =
tfile->make<TProfile2D>(std::to_string(
i + 900).c_str(),
280 (
"MB(X0) prof Eta Phi in region " + iter).c_str(),
287 me1000[
i] =
tfile->make<TProfile2D>(std::to_string(
i + 1000).c_str(),
288 (
"MB(L0) prof Eta Phi in region " + iter).c_str(),
295 me1100[
i] =
tfile->make<TProfile2D>(std::to_string(
i + 1100).c_str(),
296 (
"MB(Step) prof Eta Phi in region " + iter).c_str(),
303 me1200[
i] =
tfile->make<TH2F>(std::to_string(
i + 1200).c_str(),
304 (
"Eta vs Phi in region " + iter).c_str(),
313 iter = std::to_string(
i);
314 me1300[
i] =
tfile->make<TH1F>(std::to_string(
i + 1300).c_str(),
315 (
"Events with layers Hit (0 all, 1 HB, ..) for " + iter).c_str(),
319 me1400[
i] =
tfile->make<TH2F>(std::to_string(
i + 1400).c_str(),
320 (
"Eta vs Phi for layers hit in " + iter).c_str(),
327 me1500[
i] =
tfile->make<TProfile>(std::to_string(
i + 1500).c_str(),
328 (
"Number of layers crossed (0 all, 1 HB, ..) for " + iter).c_str(),
334 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Booking user histos done ===";
339 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos:FillHisto called with index " <<
ii
404 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Save user histos ===";
408 std::vector<std::string>
tmp;
414 for (
unsigned int i = 0;
i <
tmp.size();
i++)
426 edm::LogVerbatim(
"MaterialBudget") <<
"MaterialBudgetHcalHistos:getDDDArray called for " <<
str;
431 const std::vector<double>& fvec =
value.doubles();
432 int nval = fvec.size();
434 throw cms::Exception(
"MaterialBudgetHcalHistos") <<
"nval = " << nval <<
" < 1 for array " <<
str <<
"\n";
439 throw cms::Exception(
"MaterialBudgetHcalHistos") <<
"cannot get array " <<
str <<
"\n";
444 std::vector<std::string>::const_iterator it =
sensitives.begin();
445 std::vector<std::string>::const_iterator itEnd =
sensitives.end();
446 for (; it != itEnd; ++it)
453 int levels = ((touch->GetHistoryDepth()) + 1);
454 for (
unsigned int it = 0; it <
hfNames.size(); it++) {
466 std::vector<std::string>::const_iterator it =
sensitiveEC.begin();
467 std::vector<std::string>::const_iterator itEnd =
sensitiveEC.end();
468 for (; it != itEnd; ++it)