57 printf(
"Layer %2d r(%7.4f, %7.4f) z(% 9.4f, % 9.4f) is_brl=%d, is_pix=%d, is_stereo=%d, q_bin=%.2f\n",
71 m_layers.reserve(n_brl + n_ec_pos + n_ec_neg);
79 for (
int i = 0;
i < n_brl; ++
i)
81 for (
int i = 0;
i < n_ec_pos; ++
i)
83 for (
int i = 0;
i < n_ec_neg; ++
i)
130 struct GeomFileHeader {
131 int f_magic = s_magic;
132 int f_format_version = s_version;
134 int f_sizeof_layerinfo =
sizeof(
LayerInfo);
138 GeomFileHeader() =
default;
144 template <
typename T>
145 int write_std_vec(FILE*
fp,
const std::vector<T>& vec,
int el_size = 0) {
147 fwrite(&
n,
sizeof(
int), 1,
fp);
149 fwrite(vec.data(),
sizeof(
T),
n,
fp);
151 for (
int i = 0;
i <
n; ++
i)
152 fwrite(&vec[
i], el_size, 1,
fp);
157 template <
typename T>
158 int read_std_vec(FILE*
fp, std::vector<T>& vec,
int el_size = 0) {
160 fread(&
n,
sizeof(
int), 1,
fp);
163 fread(vec.data(),
sizeof(
T),
n,
fp);
165 for (
int i = 0;
i <
n; ++
i)
166 fread(&vec[
i], el_size, 1,
fp);
173 FILE*
fp = fopen(
fname.c_str(),
"w");
176 "TrackerInfo::write_bin_file error opening file '%s', errno=%d: '%s'",
180 throw std::runtime_error(
"Filed opening file in TrackerInfo::write_bin_file");
184 fwrite(&fh,
sizeof(GeomFileHeader), 1,
fp);
191 for (
int l = 0;
l < fh.f_n_layers; ++
l) {
203 FILE*
fp = fopen(
fname.c_str(),
"r");
206 "TrackerInfo::read_bin_file error opening file '%s', errno=%d: '%s'\n",
210 throw std::runtime_error(
"Failed opening file in TrackerInfo::read_bin_file");
213 fread(&fh,
sizeof(GeomFileHeader), 1,
fp);
215 if (fh.f_magic != GeomFileHeader::s_magic) {
216 fprintf(
stderr,
"Incompatible input file (wrong magick).\n");
217 throw std::runtime_error(
"Filed opening file in TrackerInfo::read_bin_file");
219 if (fh.f_format_version != GeomFileHeader::s_version) {
221 "Unsupported file version %d. Supported version is %d.\n",
223 GeomFileHeader::s_version);
224 throw std::runtime_error(
"Unsupported file version in TrackerInfo::read_bin_file");
226 if (fh.f_sizeof_trackerinfo !=
sizeof(
TrackerInfo)) {
228 "sizeof(TrackerInfo) on file (%d) different from current value (%d).\n",
229 fh.f_sizeof_trackerinfo,
231 throw std::runtime_error(
"sizeof(TrackerInfo) mismatch in TrackerInfo::read_bin_file");
233 if (fh.f_sizeof_layerinfo !=
sizeof(
LayerInfo)) {
235 "sizeof(LayerInfo) on file (%d) different from current value (%d).\n",
236 fh.f_sizeof_layerinfo,
238 throw std::runtime_error(
"sizeof(LayerInfo) mismatch in TrackerInfo::read_bin_file");
240 if (fh.f_sizeof_moduleinfo !=
sizeof(
ModuleInfo)) {
242 "sizeof(ModuleInfo) on file (%d) different from current value (%d).\n",
243 fh.f_sizeof_moduleinfo,
245 throw std::runtime_error(
"sizeof(ModuleInfo) mismatch in TrackerInfo::read_bin_file");
248 printf(
"Opened TrackerInfoGeom file '%s', format version %d, n_layers %d\n",
258 for (
int l = 0;
l < fh.f_n_layers; ++
l) {
263 for (
int m = 0;
m < nm; ++
m) {
281 printf(
" Detailed module list N=%d\n", li.
n_modules());
284 auto*
p = mi.
pos.Array();
285 auto* z = mi.
zdir.Array();
286 auto*
x = mi.
xdir.Array();
288 printf(
"Layer %d, mid=%u; detid=0x%x pos=%.3f,%.3f,%.3f, " 289 "norm=%.3f,%.3f,%.3f, phi=%.3f,%.3f,%.3f\n",
291 z[0], z[1], z[2],
x[0],
x[1],
x[2]);
void extend_limits(float r, float z)
void read_bin_file(const std::string &fname)
void set_r_hole_range(float rh1, float rh2)
std::vector< int > m_barrel
PropagationFlags forward_fit_pflags
LayerInfo & new_barrel_layer()
PropagationFlags backward_fit_pflags
const TrackerInfo * tracker_info
std::vector< int > m_ecap_neg
LayerInfo & new_ecap_neg_layer()
void create_material(int nBinZ, float rngZ, int nBinR, float rngR)
void set_r_in_out(float r1, float r2)
std::vector< ModuleInfo > m_modules
PropagationFlags finding_inter_layer_pflags
void set_limits(float r1, float r2, float z1, float z2)
const ModuleInfo & module_info(unsigned int sid) const
LayerInfo & new_ecap_pos_layer()
int new_layer(LayerInfo::LayerType_e type)
PropagationFlags seed_fit_pflags
void create_layers(int n_brl, int n_ec_pos, int n_ec_neg)
PropagationFlags pca_prop_pflags
const LayerInfo & layer(int l) const
rectvec< Material > m_mat_vec
int n_total_modules() const
void print_tracker(int level) const
std::vector< int > m_ecap_pos
void apply_tracker_info(const TrackerInfo *ti)
void write_bin_file(const std::string &fname) const
PropagationFlags finding_intra_layer_pflags
std::unordered_map< unsigned int, unsigned int > m_detid2sid
std::vector< LayerInfo > m_layers
void reserve_layers(int n_brl, int n_ec_pos, int n_ec_neg)