8 #include "Acts/Surfaces/Surface.hpp" 
    9 #include "Acts/Geometry/TrackingGeometry.hpp" 
   29            ATH_MSG_FATAL(
"Number of module patterns and noise probabilities  differs: " 
   31            return StatusCode::FAILURE;
 
   35            ATH_MSG_FATAL(
"Number of noise probabilities and number of noise shapes differs: " 
   37            return StatusCode::FAILURE;
 
   43            ATH_MSG_FATAL(
"Maximjum wafer hash too large (" << wafer_hash_max
 
   44                          << 
"). This algorithm only supports wafer hashes up to " 
   46            return StatusCode::FAILURE;
 
   50         std::shared_ptr<const Acts::TrackingGeometry> tracking_geometry = 
m_trackingGeometryTool->trackingGeometry();
 
   53         std::vector<unsigned int> module_pattern_idx;
 
   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; };
 
   63         tracking_geometry->visitSurfaces([&
counter, &module_data, &module_pattern_idx, 
this](
const Acts::Surface *surface_ptr) {
 
   64            if (!surface_ptr) 
return;
 
   65            const Acts::Surface &surface = *surface_ptr;
 
   66            const Acts::DetectorElementBase*detector_element = surface.associatedDetectorElement();
 
   67            if (detector_element) {
 
   69               if (acts_detector_element) {
 
   72                     if (module_pattern_idx.empty()) {
 
   73                        ++
counter.n_no_matching_pattern;
 
   78                     ++
counter.n_detector_elements_of_correct_type;
 
   87               ++
counter.n_missing_detector_elements;
 
   91                       << (
counter.n_missing_detector_elements + 
counter.n_detector_elements)
 
   92                       << 
" (wrong type " << 
counter.n_wrong_type << 
")" 
   93                       << 
" expected detector type " << 
counter.n_detector_elements_of_correct_type
 
   94                       << 
" without match " << 
counter.n_no_matching_pattern);
 
   95         if (
counter.n_missing_detector_elements || 
counter.n_wrong_type>0) {
 
   96            ATH_MSG_ERROR(
"Encountered " << 
counter.n_wrong_type << 
" associated detector elements with wrong type and " 
   97                          << 
counter.n_missing_detector_elements << 
" surfaces without detector element.");
 
  102         unsigned int pattern_i=0;
 
  103         for (
const std::vector<double> &shape : 
m_noiseShape.value()) {
 
  106            if (std::abs(
scale-1.)>1
e-5) {
 
  107               ATH_MSG_FATAL(
"Noise shape integral for pattern " << pattern_i << 
" not 1. but " << 
scale);
 
  108               return StatusCode::FAILURE;
 
  112            for (
double value : shape) {
 
  125         constexpr 
unsigned int n_different_pixel_matrices_max=6;
 
  126         m_dimPerHist.reserve(n_different_pixel_matrices_max);
 
  127         for (
unsigned int hist_type_i=0; hist_type_i<
kNHistTypes; ++hist_type_i) {
 
  128            m_hist[hist_type_i].reserve(n_different_pixel_matrices_max);
 
  132         m_noiseShapeHist.reserve(n_different_pixel_matrices_max);
 
  134         unsigned int max_y_axis = (((wafer_hash_max+99)/100+9)/10)*10;
 
  135         for (
unsigned int hist_type_i=0; hist_type_i<
kNHistTypes; ++hist_type_i) {
 
  138               hist_name << 
s_histNames.at(hist_type_i) << 
"_hits_per_module";
 
  140               hist_title << 
s_histTitles.at(hist_type_i) << 
" hits per module";
 
  143               m_moduleHist.at(hist_type_i) = 
new TH2F(hist_name.
str().c_str(), hist_title.
str().c_str(),
 
  145                                                       max_y_axis, -0.5, max_y_axis-0.5
 
  148            m_moduleHist[hist_type_i]->GetXaxis()->SetTitle(
"ID hash % 100");
 
  149            m_moduleHist[hist_type_i]->GetYaxis()->SetTitle(
"ID hash / 100");
 
  151               return StatusCode::FAILURE;
 
  156      return StatusCode::SUCCESS;
 
  162      return StatusCode::SUCCESS;
 
  166      unsigned int key=(n_rows << 16) | n_cols;
 
  167      std::vector<unsigned int>::const_iterator 
iter = 
std::find(m_dimPerHist.begin(),m_dimPerHist.end(), 
key );
 
  168      if (
iter == m_dimPerHist.end()) {
 
  169         if (m_dimPerHist.size() == m_dimPerHist.capacity()) {
 
  170            if (m_dimPerHist.capacity()==0) {
 
  171               return std::make_tuple(
nullptr,
nullptr,
nullptr);
 
  176                                      m_noiseShapeHist.empty() ? 
nullptr : m_noiseShapeHist.back());
 
  182            for (
unsigned int hist_type_i=0; hist_type_i<
kNHistTypes; ++hist_type_i) {
 
  184               name << 
s_histNames.at(hist_type_i) << 
"_hits_" << n_rows << 
"_" << n_cols;
 
  186               title << 
s_histTitles.at(hist_type_i) << 
"hits for " << n_rows << 
"(rows) #times " << n_cols << 
" (columns)";
 
  189                  m_hist.at(hist_type_i).push_back(
new TH2F(
name.str().c_str(), 
title.str().c_str(),
 
  190                                            n_cols, -0.5, n_cols-0.5,
 
  191                                            n_rows, -0.5, n_rows-0.5
 
  194               m_hist[hist_type_i].back()->GetXaxis()->SetTitle(
"offline column");
 
  195               m_hist[hist_type_i].back()->GetYaxis()->SetTitle(
"offline row");
 
  197                  throw std::runtime_error(
"Failed to register histogram.");
 
  201               std::stringstream 
name;
 
  202               name << 
"noise_shape_" << n_rows << 
"_" << n_cols;
 
  203               std::stringstream 
title;
 
  204               title << 
"Noise shape for " << n_rows << 
"(rows) #times " << n_cols << 
" (columns)";
 
  206               m_noiseShapeHist.back()->GetXaxis()->SetTitle(
"offline column");
 
  207               m_noiseShapeHist.back()->GetYaxis()->SetTitle(
"offline row");
 
  209                  throw std::runtime_error(
"Failed to register histogram.");
 
  212            m_dimPerHist.push_back(
key);
 
  215                                   m_noiseShapeHist.empty() ? 
nullptr : m_noiseShapeHist.back()
 
  222                                m_noiseShapeHist.empty() ? 
nullptr : m_noiseShapeHist.at(
iter-m_dimPerHist.begin()));