60 using Counter =
struct {
unsigned int n_detector_elements, n_missing_detector_elements, n_wrong_type,
61 n_no_matching_pattern, n_detector_elements_of_correct_type; };
62 Counter counter {0u,0u,0u,0u,0u};
63 tracking_geometry->visitSurfaces([&counter, &module_data, &module_pattern_idx,
this](
const Acts::Surface *surface_ptr) {
67 if (!acts_detector_element)
return;
70 if (module_pattern_idx.empty()) {
71 ++counter.n_no_matching_pattern;
73 m_noiseParamIdx.at(acts_detector_element->identifyHash()) = module_pattern_idx.front();
75 ++
counter.n_detector_elements_of_correct_type;
79 << (
counter.n_missing_detector_elements +
counter.n_detector_elements)
80 <<
" (wrong type " <<
counter.n_wrong_type <<
")"
81 <<
" expected detector type " <<
counter.n_detector_elements_of_correct_type
82 <<
" without match " <<
counter.n_no_matching_pattern);
83 if (
counter.n_missing_detector_elements ||
counter.n_wrong_type>0) {
84 ATH_MSG_ERROR(
"Encountered " <<
counter.n_wrong_type <<
" associated detector elements with wrong type and "
85 <<
counter.n_missing_detector_elements <<
" surfaces without detector element.");
90 unsigned int pattern_i=0;
91 for (
const std::vector<double> &shape :
m_noiseShape.value()) {
93 double scale=std::accumulate(shape.begin(), shape.end(),0.);
94 if (std::abs(scale-1.)>1e-5) {
95 ATH_MSG_FATAL(
"Noise shape integral for pattern " << pattern_i <<
" not 1. but " << scale);
96 return StatusCode::FAILURE;
101 for (
double value : shape) {
114 constexpr unsigned int n_different_pixel_matrices_max=6;
115 m_dimPerHist.reserve(n_different_pixel_matrices_max);
116 for (
unsigned int hist_type_i=0; hist_type_i<
kNHistTypes; ++hist_type_i) {
117 m_hist[hist_type_i].reserve(n_different_pixel_matrices_max);
121 m_noiseShapeHist.reserve(n_different_pixel_matrices_max);
123 unsigned int max_y_axis = (((wafer_hash_max+99)/100+9)/10)*10;
124 for (
unsigned int hist_type_i=0; hist_type_i<
kNHistTypes; ++hist_type_i) {
126 HistUtil::StringCat hist_name;
127 hist_name <<
s_histNames.at(hist_type_i) <<
"_hits_per_module";
128 HistUtil::StringCat hist_title;
129 hist_title <<
s_histTitles.at(hist_type_i) <<
" hits per module";
131 HistUtil::ProtectHistogramCreation
protect;
132 m_moduleHist.at(hist_type_i) =
new TH2F(hist_name.
str().c_str(), hist_title.
str().c_str(),
134 max_y_axis, -0.5, max_y_axis-0.5
137 m_moduleHist[hist_type_i]->GetXaxis()->SetTitle(
"ID hash % 100");
138 m_moduleHist[hist_type_i]->GetYaxis()->SetTitle(
"ID hash / 100");
140 return StatusCode::FAILURE;
145 return StatusCode::SUCCESS;
151 return StatusCode::SUCCESS;
155 unsigned int key=(n_rows << 16) | n_cols;
156 std::vector<unsigned int>::const_iterator iter = std::find(m_dimPerHist.begin(),m_dimPerHist.end(), key );
157 if (iter == m_dimPerHist.end()) {
158 if (m_dimPerHist.size() == m_dimPerHist.capacity()) {
159 if (m_dimPerHist.capacity()==0) {
160 return std::make_tuple(
nullptr,
nullptr,
nullptr);
165 m_noiseShapeHist.empty() ?
nullptr : m_noiseShapeHist.back());
171 for (
unsigned int hist_type_i=0; hist_type_i<
kNHistTypes; ++hist_type_i) {
173 name <<
s_histNames.at(hist_type_i) <<
"_hits_" << n_rows <<
"_" << n_cols;
175 title <<
s_histTitles.at(hist_type_i) <<
"hits for " << n_rows <<
"(rows) #times " << n_cols <<
" (columns)";
178 m_hist.at(hist_type_i).push_back(
new TH2F(name.str().c_str(), title.str().c_str(),
179 n_cols, -0.5, n_cols-0.5,
180 n_rows, -0.5, n_rows-0.5
183 m_hist[hist_type_i].back()->GetXaxis()->SetTitle(
"offline column");
184 m_hist[hist_type_i].back()->GetYaxis()->SetTitle(
"offline row");
186 throw std::runtime_error(
"Failed to register histogram.");
190 std::stringstream name;
191 name <<
"noise_shape_" << n_rows <<
"_" << n_cols;
192 std::stringstream title;
193 title <<
"Noise shape for " << n_rows <<
"(rows) #times " << n_cols <<
" (columns)";
194 m_noiseShapeHist.push_back(
new TH1F(name.str().c_str(), title.str().c_str(),
m_maxNShape+1, -0.5,
m_maxNShape+.5));
195 m_noiseShapeHist.back()->GetXaxis()->SetTitle(
"offline column");
196 m_noiseShapeHist.back()->GetYaxis()->SetTitle(
"offline row");
198 throw std::runtime_error(
"Failed to register histogram.");
201 m_dimPerHist.push_back(key);
204 m_noiseShapeHist.empty() ?
nullptr : m_noiseShapeHist.back()
209 return std::make_tuple(m_hist[
kRejectedHits].at(iter-m_dimPerHist.begin()),
211 m_noiseShapeHist.empty() ?
nullptr : m_noiseShapeHist.at(iter-m_dimPerHist.begin()));