CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
mkfit::TrackerInfo Class Reference

#include <TrackerInfo.h>

Classes

struct  Material
 

Public Types

enum  EtaRegion {
  Reg_Begin = 0, Reg_Endcap_Neg = 0, Reg_Transition_Neg, Reg_Barrel,
  Reg_Transition_Pos, Reg_Endcap_Pos, Reg_End, Reg_Count = Reg_End
}
 

Public Member Functions

const std::vector< int > & barrel_layers () const
 
bool check_bins (int bz, int br) const
 
void create_layers (int n_brl, int n_ec_pos, int n_ec_neg)
 
void create_material (int nBinZ, float rngZ, int nBinR, float rngR)
 
const std::vector< int > & endcap_neg_layers () const
 
const std::vector< int > & endcap_pos_layers () const
 
const LayerInfolayer (int l) const
 
LayerInfolayer_nc (int l)
 
int mat_bin_r (float r) const
 
int mat_bin_z (float z) const
 
int mat_nbins_r () const
 
int mat_nbins_z () const
 
float mat_range_r () const
 
float mat_range_z () const
 
float material_bbxi (int binZ, int binR) const
 
float & material_bbxi (int binZ, int binR)
 
Material material_checked (float z, float r) const
 
float material_radl (int binZ, int binR) const
 
float & material_radl (int binZ, int binR)
 
int n_layers () const
 
int n_total_modules () const
 
LayerInfonew_barrel_layer ()
 
LayerInfonew_ecap_neg_layer ()
 
LayerInfonew_ecap_pos_layer ()
 
const LayerInfooperator[] (int l) const
 
const LayerInfoouter_barrel_layer () const
 
void print_tracker (int level) const
 
const PropagationConfigprop_config () const
 
PropagationConfigprop_config_nc ()
 
void read_bin_file (const std::string &fname)
 
void reserve_layers (int n_brl, int n_ec_pos, int n_ec_neg)
 
void write_bin_file (const std::string &fname) const
 

Private Member Functions

int new_layer (LayerInfo::LayerType_e type)
 

Private Attributes

std::vector< int > m_barrel
 
std::vector< int > m_ecap_neg
 
std::vector< int > m_ecap_pos
 
std::vector< LayerInfom_layers
 
float m_mat_fac_r
 
float m_mat_fac_z
 
float m_mat_range_r
 
float m_mat_range_z
 
rectvec< Materialm_mat_vec
 
PropagationConfig m_prop_config
 

Detailed Description

Definition at line 179 of file TrackerInfo.h.

Member Enumeration Documentation

◆ EtaRegion

Enumerator
Reg_Begin 
Reg_Endcap_Neg 
Reg_Transition_Neg 
Reg_Barrel 
Reg_Transition_Pos 
Reg_Endcap_Pos 
Reg_End 
Reg_Count 

Definition at line 181 of file TrackerInfo.h.

Member Function Documentation

◆ barrel_layers()

const std::vector<int>& mkfit::TrackerInfo::barrel_layers ( ) const
inline

Definition at line 211 of file TrackerInfo.h.

References m_barrel.

211 { return m_barrel; }
std::vector< int > m_barrel
Definition: TrackerInfo.h:246

◆ check_bins()

bool mkfit::TrackerInfo::check_bins ( int  bz,
int  br 
) const
inline

Definition at line 229 of file TrackerInfo.h.

References beamvalidation::br, and m_mat_vec.

Referenced by material_checked().

229 { return m_mat_vec.check_idcs(bz, br); }
rectvec< Material > m_mat_vec
Definition: TrackerInfo.h:252

◆ create_layers()

void mkfit::TrackerInfo::create_layers ( int  n_brl,
int  n_ec_pos,
int  n_ec_neg 
)

Definition at line 77 of file TrackerInfo.cc.

References mps_fire::i, new_barrel_layer(), new_ecap_neg_layer(), new_ecap_pos_layer(), and reserve_layers().

77  {
78  reserve_layers(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)
85  }
LayerInfo & new_barrel_layer()
Definition: TrackerInfo.cc:93
LayerInfo & new_ecap_neg_layer()
Definition: TrackerInfo.cc:103
LayerInfo & new_ecap_pos_layer()
Definition: TrackerInfo.cc:98
void reserve_layers(int n_brl, int n_ec_pos, int n_ec_neg)
Definition: TrackerInfo.cc:70

◆ create_material()

void mkfit::TrackerInfo::create_material ( int  nBinZ,
float  rngZ,
int  nBinR,
float  rngR 
)

◆ endcap_neg_layers()

const std::vector<int>& mkfit::TrackerInfo::endcap_neg_layers ( ) const
inline

Definition at line 213 of file TrackerInfo.h.

References m_ecap_neg.

213 { return m_ecap_neg; }
std::vector< int > m_ecap_neg
Definition: TrackerInfo.h:248

◆ endcap_pos_layers()

const std::vector<int>& mkfit::TrackerInfo::endcap_pos_layers ( ) const
inline

Definition at line 212 of file TrackerInfo.h.

References m_ecap_pos.

212 { return m_ecap_pos; }
std::vector< int > m_ecap_pos
Definition: TrackerInfo.h:247

◆ layer()

const LayerInfo& mkfit::TrackerInfo::layer ( int  l) const
inline

◆ layer_nc()

LayerInfo& mkfit::TrackerInfo::layer_nc ( int  l)
inline

◆ mat_bin_r()

int mkfit::TrackerInfo::mat_bin_r ( float  r) const
inline

Definition at line 228 of file TrackerInfo.h.

References m_mat_fac_r.

Referenced by MkFitGeometryESProducer::fillLayers(), and material_checked().

228 { return r * m_mat_fac_r; }

◆ mat_bin_z()

int mkfit::TrackerInfo::mat_bin_z ( float  z) const
inline

Definition at line 227 of file TrackerInfo.h.

References m_mat_fac_z.

Referenced by MkFitGeometryESProducer::fillLayers(), and material_checked().

227 { return z * m_mat_fac_z; }
float float float z

◆ mat_nbins_r()

int mkfit::TrackerInfo::mat_nbins_r ( ) const
inline

◆ mat_nbins_z()

int mkfit::TrackerInfo::mat_nbins_z ( ) const
inline

◆ mat_range_r()

float mkfit::TrackerInfo::mat_range_r ( ) const
inline

Definition at line 226 of file TrackerInfo.h.

References m_mat_range_r.

Referenced by MkFitGeometryESProducer::fillShapeAndPlacement().

226 { return m_mat_range_r; }

◆ mat_range_z()

float mkfit::TrackerInfo::mat_range_z ( ) const
inline

Definition at line 225 of file TrackerInfo.h.

References m_mat_range_z.

Referenced by MkFitGeometryESProducer::fillShapeAndPlacement().

225 { return m_mat_range_z; }

◆ material_bbxi() [1/2]

float mkfit::TrackerInfo::material_bbxi ( int  binZ,
int  binR 
) const
inline

Definition at line 231 of file TrackerInfo.h.

References m_mat_vec.

Referenced by MkFitGeometryESProducer::aggregateMaterialInfo(), and MkFitGeometryESProducer::fillLayers().

231 { return m_mat_vec(binZ, binR).bbxi; }
rectvec< Material > m_mat_vec
Definition: TrackerInfo.h:252

◆ material_bbxi() [2/2]

float& mkfit::TrackerInfo::material_bbxi ( int  binZ,
int  binR 
)
inline

Definition at line 233 of file TrackerInfo.h.

References m_mat_vec.

233 { return m_mat_vec(binZ, binR).bbxi; }
rectvec< Material > m_mat_vec
Definition: TrackerInfo.h:252

◆ material_checked()

Material mkfit::TrackerInfo::material_checked ( float  z,
float  r 
) const
inline

Definition at line 236 of file TrackerInfo.h.

References check_bins(), m_mat_vec, mat_bin_r(), mat_bin_z(), and g4SimHits_cfi::Material.

Referenced by mkfit::propagateHelixToRMPlex(), and mkfit::propagateHelixToZMPlex().

236  {
237  const int zbin = mat_bin_z(z), rbin = mat_bin_r(r);
238  return check_bins(zbin, rbin) ? m_mat_vec(zbin, rbin) : Material();
239  }
int mat_bin_z(float z) const
Definition: TrackerInfo.h:227
bool check_bins(int bz, int br) const
Definition: TrackerInfo.h:229
int mat_bin_r(float r) const
Definition: TrackerInfo.h:228
rectvec< Material > m_mat_vec
Definition: TrackerInfo.h:252

◆ material_radl() [1/2]

float mkfit::TrackerInfo::material_radl ( int  binZ,
int  binR 
) const
inline

Definition at line 232 of file TrackerInfo.h.

References m_mat_vec.

Referenced by MkFitGeometryESProducer::aggregateMaterialInfo(), and MkFitGeometryESProducer::fillLayers().

232 { return m_mat_vec(binZ, binR).radl; }
rectvec< Material > m_mat_vec
Definition: TrackerInfo.h:252

◆ material_radl() [2/2]

float& mkfit::TrackerInfo::material_radl ( int  binZ,
int  binR 
)
inline

Definition at line 234 of file TrackerInfo.h.

References m_mat_vec.

234 { return m_mat_vec(binZ, binR).radl; }
rectvec< Material > m_mat_vec
Definition: TrackerInfo.h:252

◆ n_layers()

int mkfit::TrackerInfo::n_layers ( ) const
inline

◆ n_total_modules()

int mkfit::TrackerInfo::n_total_modules ( ) const

Definition at line 108 of file TrackerInfo.cc.

References MainPageGenerator::l, and m_layers.

108  {
109  int nm = 0;
110  for (auto& l : m_layers)
111  nm += l.n_modules();
112  return nm;
113  }
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

◆ new_barrel_layer()

LayerInfo & mkfit::TrackerInfo::new_barrel_layer ( )

Definition at line 93 of file TrackerInfo.cc.

References mkfit::LayerInfo::Barrel, m_barrel, m_layers, and new_layer().

Referenced by create_layers().

93  {
95  return m_layers.back();
96  }
std::vector< int > m_barrel
Definition: TrackerInfo.h:246
int new_layer(LayerInfo::LayerType_e type)
Definition: TrackerInfo.cc:87
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

◆ new_ecap_neg_layer()

LayerInfo & mkfit::TrackerInfo::new_ecap_neg_layer ( )

Definition at line 103 of file TrackerInfo.cc.

References mkfit::LayerInfo::EndCapNeg, m_ecap_neg, m_layers, and new_layer().

Referenced by create_layers().

103  {
105  return m_layers.back();
106  }
std::vector< int > m_ecap_neg
Definition: TrackerInfo.h:248
int new_layer(LayerInfo::LayerType_e type)
Definition: TrackerInfo.cc:87
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

◆ new_ecap_pos_layer()

LayerInfo & mkfit::TrackerInfo::new_ecap_pos_layer ( )

Definition at line 98 of file TrackerInfo.cc.

References mkfit::LayerInfo::EndCapPos, m_ecap_pos, m_layers, and new_layer().

Referenced by create_layers().

98  {
100  return m_layers.back();
101  }
int new_layer(LayerInfo::LayerType_e type)
Definition: TrackerInfo.cc:87
std::vector< int > m_ecap_pos
Definition: TrackerInfo.h:247
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

◆ new_layer()

int mkfit::TrackerInfo::new_layer ( LayerInfo::LayerType_e  type)
private

◆ operator[]()

const LayerInfo& mkfit::TrackerInfo::operator[] ( int  l) const
inline

Definition at line 207 of file TrackerInfo.h.

References MainPageGenerator::l, and m_layers.

207 { return m_layers[l]; }
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

◆ outer_barrel_layer()

const LayerInfo& mkfit::TrackerInfo::outer_barrel_layer ( ) const
inline

Definition at line 209 of file TrackerInfo.h.

References m_barrel, and m_layers.

209 { return m_layers[m_barrel.back()]; }
std::vector< int > m_barrel
Definition: TrackerInfo.h:246
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

◆ print_tracker()

void mkfit::TrackerInfo::print_tracker ( int  level) const

Definition at line 275 of file TrackerInfo.cc.

References mkfit::ModuleInfo::detid, mps_fire::i, dqmiolumiharvest::j, layer(), personalPlayback::level, mkfit::LayerInfo::module_info(), n_layers(), mkfit::LayerInfo::n_modules(), AlCaHLTBitMon_ParallelJobs::p, mkfit::ModuleInfo::pos, mkfit::LayerInfo::print_layer(), x, mkfit::ModuleInfo::xdir, and mkfit::ModuleInfo::zdir.

275  {
276  if (level > 0) {
277  for (int i = 0; i < n_layers(); ++i) {
278  const LayerInfo& li = layer(i);
279  li.print_layer();
280  if (level > 1) {
281  printf(" Detailed module list N=%d\n", li.n_modules());
282  for (int j = 0; j < li.n_modules(); ++j) {
283  const ModuleInfo& mi = li.module_info(j);
284  auto* p = mi.pos.Array();
285  auto* z = mi.zdir.Array();
286  auto* x = mi.xdir.Array();
287  // clang-format off
288  printf("Layer %d, mid=%u; detid=0x%x pos=%.3f,%.3f,%.3f, "
289  "norm=%.3f,%.3f,%.3f, phi=%.3f,%.3f,%.3f\n",
290  i, j, mi.detid, p[0], p[1], p[2],
291  z[0], z[1], z[2], x[0], x[1], x[2]);
292  // clang-format on
293  }
294  printf("\n");
295  }
296  }
297  }
298  }
float float float z
int n_layers() const
Definition: TrackerInfo.h:201
const LayerInfo & layer(int l) const
Definition: TrackerInfo.h:202
float x

◆ prop_config()

const PropagationConfig& mkfit::TrackerInfo::prop_config ( ) const
inline

◆ prop_config_nc()

PropagationConfig& mkfit::TrackerInfo::prop_config_nc ( )
inline

Definition at line 216 of file TrackerInfo.h.

References m_prop_config.

216 { return m_prop_config; }
PropagationConfig m_prop_config
Definition: TrackerInfo.h:254

◆ read_bin_file()

void mkfit::TrackerInfo::read_bin_file ( const std::string &  fname)

Definition at line 202 of file TrackerInfo.cc.

References alignmentValidation::fname, personalPlayback::fp, MainPageGenerator::l, visualization-live-secondInstance_cfg::m, m_barrel, mkfit::LayerInfo::m_detid2sid, m_ecap_neg, m_ecap_pos, m_layers, m_mat_range_z, m_mat_vec, mkfit::LayerInfo::m_modules, and submitPVResolutionJobs::stderr.

Referenced by mkfit::execTrackerInfoCreatorPlugin(), and main().

202  {
203  FILE* fp = fopen(fname.c_str(), "r");
204  if (!fp) {
205  fprintf(stderr,
206  "TrackerInfo::read_bin_file error opening file '%s', errno=%d: '%s'\n",
207  fname.c_str(),
208  errno,
209  strerror(errno));
210  throw std::runtime_error("Failed opening file in TrackerInfo::read_bin_file");
211  }
212  GeomFileHeader fh;
213  fread(&fh, sizeof(GeomFileHeader), 1, fp);
214 
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");
218  }
219  if (fh.f_format_version != GeomFileHeader::s_version) {
220  fprintf(stderr,
221  "Unsupported file version %d. Supported version is %d.\n",
222  fh.f_format_version,
223  GeomFileHeader::s_version);
224  throw std::runtime_error("Unsupported file version in TrackerInfo::read_bin_file");
225  }
226  if (fh.f_sizeof_trackerinfo != sizeof(TrackerInfo)) {
227  fprintf(stderr,
228  "sizeof(TrackerInfo) on file (%d) different from current value (%d).\n",
229  fh.f_sizeof_trackerinfo,
230  (int)sizeof(TrackerInfo));
231  throw std::runtime_error("sizeof(TrackerInfo) mismatch in TrackerInfo::read_bin_file");
232  }
233  if (fh.f_sizeof_layerinfo != sizeof(LayerInfo)) {
234  fprintf(stderr,
235  "sizeof(LayerInfo) on file (%d) different from current value (%d).\n",
236  fh.f_sizeof_layerinfo,
237  (int)sizeof(LayerInfo));
238  throw std::runtime_error("sizeof(LayerInfo) mismatch in TrackerInfo::read_bin_file");
239  }
240  if (fh.f_sizeof_moduleinfo != sizeof(ModuleInfo)) {
241  fprintf(stderr,
242  "sizeof(ModuleInfo) on file (%d) different from current value (%d).\n",
243  fh.f_sizeof_moduleinfo,
244  (int)sizeof(ModuleInfo));
245  throw std::runtime_error("sizeof(ModuleInfo) mismatch in TrackerInfo::read_bin_file");
246  }
247 
248  printf("Opened TrackerInfoGeom file '%s', format version %d, n_layers %d\n",
249  fname.c_str(),
250  fh.f_format_version,
251  fh.f_n_layers);
252 
253  read_std_vec(fp, m_layers, (int)(offsetof(LayerInfo, m_is_pixel)) + 1);
254  read_std_vec(fp, m_barrel);
255  read_std_vec(fp, m_ecap_pos);
256  read_std_vec(fp, m_ecap_neg);
257 
258  for (int l = 0; l < fh.f_n_layers; ++l) {
259  LayerInfo& li = m_layers[l];
260  int nm = read_std_vec(fp, li.m_modules);
261 
262  li.m_detid2sid.clear();
263  for (int m = 0; m < nm; ++m) {
264  li.m_detid2sid.insert({li.m_modules[m].detid, m});
265  }
266  }
267 
268  fread(&m_mat_range_z, 4 * sizeof(float), 1, fp);
269  fread(&m_mat_vec, 2 * sizeof(int), 1, fp);
270  read_std_vec(fp, m_mat_vec.vector());
271 
272  fclose(fp);
273  }
std::vector< int > m_barrel
Definition: TrackerInfo.h:246
std::vector< int > m_ecap_neg
Definition: TrackerInfo.h:248
rectvec< Material > m_mat_vec
Definition: TrackerInfo.h:252
std::vector< int > m_ecap_pos
Definition: TrackerInfo.h:247
string fname
main script
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

◆ reserve_layers()

void mkfit::TrackerInfo::reserve_layers ( int  n_brl,
int  n_ec_pos,
int  n_ec_neg 
)

Definition at line 70 of file TrackerInfo.cc.

References m_barrel, m_ecap_neg, m_ecap_pos, and m_layers.

Referenced by create_layers().

70  {
71  m_layers.reserve(n_brl + n_ec_pos + n_ec_neg);
72  m_barrel.reserve(n_brl);
73  m_ecap_pos.reserve(n_ec_pos);
74  m_ecap_neg.reserve(n_ec_neg);
75  }
std::vector< int > m_barrel
Definition: TrackerInfo.h:246
std::vector< int > m_ecap_neg
Definition: TrackerInfo.h:248
std::vector< int > m_ecap_pos
Definition: TrackerInfo.h:247
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

◆ write_bin_file()

void mkfit::TrackerInfo::write_bin_file ( const std::string &  fname) const

Definition at line 172 of file TrackerInfo.cc.

References alignmentValidation::fname, personalPlayback::fp, MainPageGenerator::l, m_barrel, m_ecap_neg, m_ecap_pos, m_layers, m_mat_range_z, m_mat_vec, n_layers(), and submitPVResolutionJobs::stderr.

172  {
173  FILE* fp = fopen(fname.c_str(), "w");
174  if (!fp) {
175  fprintf(stderr,
176  "TrackerInfo::write_bin_file error opening file '%s', errno=%d: '%s'",
177  fname.c_str(),
178  errno,
179  strerror(errno));
180  throw std::runtime_error("Filed opening file in TrackerInfo::write_bin_file");
181  }
182  GeomFileHeader fh;
183  fh.f_n_layers = n_layers();
184  fwrite(&fh, sizeof(GeomFileHeader), 1, fp);
185 
186  write_std_vec(fp, m_layers, (int)(offsetof(LayerInfo, m_is_pixel)) + 1);
187  write_std_vec(fp, m_barrel);
188  write_std_vec(fp, m_ecap_pos);
189  write_std_vec(fp, m_ecap_neg);
190 
191  for (int l = 0; l < fh.f_n_layers; ++l) {
192  write_std_vec(fp, m_layers[l].m_modules);
193  }
194 
195  fwrite(&m_mat_range_z, 4 * sizeof(float), 1, fp);
196  fwrite(&m_mat_vec, 2 * sizeof(int), 1, fp);
197  write_std_vec(fp, m_mat_vec.vector());
198 
199  fclose(fp);
200  }
std::vector< int > m_barrel
Definition: TrackerInfo.h:246
std::vector< int > m_ecap_neg
Definition: TrackerInfo.h:248
int n_layers() const
Definition: TrackerInfo.h:201
rectvec< Material > m_mat_vec
Definition: TrackerInfo.h:252
std::vector< int > m_ecap_pos
Definition: TrackerInfo.h:247
string fname
main script
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:244

Member Data Documentation

◆ m_barrel

std::vector<int> mkfit::TrackerInfo::m_barrel
private

◆ m_ecap_neg

std::vector<int> mkfit::TrackerInfo::m_ecap_neg
private

◆ m_ecap_pos

std::vector<int> mkfit::TrackerInfo::m_ecap_pos
private

◆ m_layers

std::vector<LayerInfo> mkfit::TrackerInfo::m_layers
private

◆ m_mat_fac_r

float mkfit::TrackerInfo::m_mat_fac_r
private

Definition at line 251 of file TrackerInfo.h.

Referenced by create_material(), and mat_bin_r().

◆ m_mat_fac_z

float mkfit::TrackerInfo::m_mat_fac_z
private

Definition at line 251 of file TrackerInfo.h.

Referenced by create_material(), and mat_bin_z().

◆ m_mat_range_r

float mkfit::TrackerInfo::m_mat_range_r
private

Definition at line 250 of file TrackerInfo.h.

Referenced by create_material(), and mat_range_r().

◆ m_mat_range_z

float mkfit::TrackerInfo::m_mat_range_z
private

Definition at line 250 of file TrackerInfo.h.

Referenced by create_material(), mat_range_z(), read_bin_file(), and write_bin_file().

◆ m_mat_vec

rectvec<Material> mkfit::TrackerInfo::m_mat_vec
private

◆ m_prop_config

PropagationConfig mkfit::TrackerInfo::m_prop_config
private

Definition at line 254 of file TrackerInfo.h.

Referenced by prop_config(), and prop_config_nc().