34 if (TString(name.c_str()).Contains(
"Tracker")) {
35 namevalue =
DDValue(
"TrackingMaterialGroup", name);
36 }
else if (TString(name.c_str()).Contains(
"HGCal")) {
37 namevalue =
DDValue(
"Volume", name);
38 }
else if (TString(name.c_str()).Contains(
"HFNose")) {
39 namevalue =
DDValue(
"Volume", name);
41 LogTrace(
"MaterialAccountingGroup") << name << std::endl;
42 edm::LogError(
"MaterialAccountingGroup") <<
"Only Tracker , HGCal and HFNose are supported" << std::endl;
47 LogTrace(
"MaterialAccountingGroup") <<
"Elements within: " << name << std::endl;
51 LogTrace(
"MaterialAccountingGroup") <<
"Adding element at(r,z): ("
53 <<
GlobalPoint(position.x(), position.y(), position.z()).
z() <<
") cm"
72 m_dedx_vs_eta =
new TProfile((
m_name +
"_dedx_vs_eta").c_str(),
"Energy loss vs. eta", 600, -3, 3);
73 m_dedx_vs_z =
new TProfile((
m_name +
"_dedx_vs_z").c_str(),
"Energy loss vs. Z", 6000, -300, 300);
74 m_dedx_vs_r =
new TProfile((
m_name +
"_dedx_vs_r").c_str(),
"Energy loss vs. R", 1200, 0, 120);
75 m_radlen_vs_eta =
new TProfile((
m_name +
"_radlen_vs_eta").c_str(),
"Radiation lengths vs. eta", 600, -3, 3);
76 m_radlen_vs_z =
new TProfile((
m_name +
"_radlen_vs_z").c_str(),
"Radiation lengths vs. Z", 6000, -300, 300);
77 m_radlen_vs_r =
new TProfile((
m_name +
"_radlen_vs_r").c_str(),
"Radiation lengths vs. R", 1200, 0, 120);
106 LogTrace(
"MaterialAccountingGroup") <<
"Testing position: (x, y, z, r) = " << position.
x() <<
", " << position.
y()
107 <<
", " << position.
z() <<
", " << position.
perp() << std::endl;
152 (m_buffer.in().y() + m_buffer.out().y()) / 2.,
153 (m_buffer.in().z() + m_buffer.out().z()) / 2.);
157 m_dedx_vs_z->Fill(average.
z(), m_buffer.energyLoss(), 1.);
160 m_radlen_vs_z->Fill(average.
z(), m_buffer.radiationLengths(), 1.);
168 TCanvas
canvas(name.c_str(), plot->GetTitle(), 1280, 1024);
169 plot->SetFillColor(15);
170 plot->SetLineColor(1);
172 canvas.GetFrame()->SetFillColor(kWhite);
174 canvas.SaveAs((name +
".png").c_str(),
"");
177 plot->SetDirectory(
m_file);
187 new TH1F((name +
"_par").c_str(),
"Parametrization", 1, plot->GetXaxis()->GetXmin(), plot->GetXaxis()->GetXmax());
188 line->SetBinContent(1, average);
190 TCanvas
canvas(name.c_str(), plot->GetTitle(), 1280, 1024);
191 plot->SetFillColor(15);
192 plot->SetLineColor(1);
193 plot->SetLineWidth(2);
195 line->SetLineColor(2);
196 line->SetLineWidth(2);
198 canvas.GetFrame()->SetFillColor(kWhite);
200 canvas.SaveAs((name +
".png").c_str(),
"");
203 plot->SetDirectory(
m_file);
204 line->SetDirectory(
m_file);
209 std::stringstream
out;
210 out << std::setw(48) << std::left <<
m_name << std::right << std::fixed;
212 out <<
"BBox: " << std::setprecision(1) << std::setw(6) <<
m_boundingbox.
range_z().first <<
" < Z < "
214 out <<
", " << std::setprecision(1) << std::setw(5) <<
m_boundingbox.
range_r().first <<
" < R < "
216 out <<
" Elements: " << std::setw(6) <<
m_elements.size();
221 m_file =
new TFile((
m_name +
".root").c_str(),
"RECREATE");
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
MaterialAccountingGroup(const std::string &name, const DDCompactView &geometry)
explicit constructors
double averageRadiationLengths(void) const
return the average normalized number of radiation lengths
void endOfTrack(void)
commit the buffer and reset the "already hit by this track" flag
MaterialAccountingStep m_errors
MaterialAccountingStep m_buffer
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
std::vector< GlobalPoint > m_elements
Global3DPoint GlobalPoint
std::pair< double, double > range_r() const
std::string info(void) const
get some infos
Log< level::Error, false > LogError
BoundingBox m_boundingbox
Compact representation of the geometrical detector hierarchy.
double averageEnergyLoss(void) const
return the average normalized energy loss density factor for Bethe-Bloch
bool next()
set current node to the next node in the filtered tree
void savePlot(TH1F *plot, const std::string &name)
MaterialAccountingStep average(void) const
return the average normalized material accounting informations
void grow(double r, double z)
std::pair< double, double > range_z() const
const MaterialAccountingStep & material() const
static double const s_tolerance
std::string toString() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void savePlots(void)
save the plots
const GlobalPoint & position() const
T perp() const
Magnitude of transverse component.
bool inside(double r, double z) const
static int position[264][3]
TProfile * m_radlen_vs_eta
bool addDetector(const MaterialAccountingDetector &detector)
buffer material from a detector, if the detector is inside the DetLayer bounds
~MaterialAccountingGroup(void)
destructor
const DDTranslation & translation() const
The absolute translation of the current node.
MaterialAccountingStep m_accounting
bool inside(const MaterialAccountingDetector &detector) const
check if detector is inside any part of this layer