CMS 3D CMS Logo

Config.h
Go to the documentation of this file.
1 #ifndef RecoTracker_MkFitCore_interface_Config_h
2 #define RecoTracker_MkFitCore_interface_Config_h
3 
4 namespace mkfit {
5 
7 
8  struct PropagationFlags {
9  bool use_param_b_field : 1;
10  bool apply_material : 1;
11  // Could add: bool use_trig_approx -- now Config::useTrigApprox = true
12  // Could add: int n_prop_to_r_iters : 8 -- now Config::Niter = 5
13 
15 
18  };
19 
21  public:
30 
31  void set_as_default(bool force = false);
32 
33  static const PropagationConfig& get_default() { return *s_default; }
34 
35  private:
37  };
38 
39  //------------------------------------------------------------------------------
40 
41  namespace Const {
42  constexpr float PI = 3.14159265358979323846;
43  constexpr float TwoPI = 6.28318530717958647692;
44  constexpr float PIOver2 = Const::PI / 2.0f;
45  constexpr float PIOver4 = Const::PI / 4.0f;
46  constexpr float PI3Over4 = 3.0f * Const::PI / 4.0f;
47  constexpr float InvPI = 1.0f / Const::PI;
48  constexpr float sol = 0.299792458; // speed of light in nm/s
49 
50  // NAN and silly track parameter tracking options
51  constexpr bool nan_etc_sigs_enable = false;
52 
53  constexpr bool nan_n_silly_check_seeds = true;
54  constexpr bool nan_n_silly_print_bad_seeds = false;
55  constexpr bool nan_n_silly_fixup_bad_seeds = false;
56  constexpr bool nan_n_silly_remove_bad_seeds = true;
57 
58  constexpr bool nan_n_silly_check_cands_every_layer = false;
61 
62  constexpr bool nan_n_silly_check_cands_pre_bkfit = true;
63  constexpr bool nan_n_silly_check_cands_post_bkfit = true;
64  constexpr bool nan_n_silly_print_bad_cands_bkfit = false;
65  } // namespace Const
66 
67  inline float cdist(float a) { return a > Const::PI ? Const::TwoPI - a : a; }
68 
69  //------------------------------------------------------------------------------
70 
71  namespace Config {
72  // config for fitting
73  constexpr int nLayers = 10; // default/toy: 10; cms-like: 18 (barrel), 27 (endcap)
74 
75  // Layer constants for common barrel / endcap.
76  // TrackerInfo more or less has all this information.
77  constexpr int nMaxTrkHits = 64; // Used for array sizes in MkFitter/Finder, max hits in toy MC
78  constexpr int nAvgSimHits = 32; // Used for reserve() calls for sim hits/states
79 
80  // This will become layer dependent (in bits). To be consistent with min_dphi.
81  static constexpr int m_nphi = 256;
82 
83  // Config for propagation - could/should enter into PropagationFlags?!
84  constexpr int Niter = 5;
85  constexpr bool useTrigApprox = true;
86 
87  // Config for Bfield. Note: for now the same for CMS-2017 and CylCowWLids.
88  constexpr float Bfield = 3.8112;
89  constexpr float mag_c1 = 3.8114;
90  constexpr float mag_b0 = -3.94991e-06;
91  constexpr float mag_b1 = 7.53701e-06;
92  constexpr float mag_a = 2.43878e-11;
93 
94  // Config for SelectHitIndices
95  // Use extra arrays to store phi and q of hits.
96  // MT: This would in principle allow fast selection of good hits, if
97  // we had good error estimates and reasonable *minimal* phi and q windows.
98  // Speed-wise, those arrays (filling AND access, about half each) cost 1.5%
99  // and could help us reduce the number of hits we need to process with bigger
100  // potential gains.
101 #ifdef CONFIG_PhiQArrays
102  extern bool usePhiQArrays;
103 #else
104  constexpr bool usePhiQArrays = true;
105 #endif
106 
107  // sorting config (bonus,penalty)
108  constexpr float validHitBonus_ = 4;
109  constexpr float validHitSlope_ = 0.2;
110  constexpr float overlapHitBonus_ = 0; // set to negative for penalty
111  constexpr float missingHitPenalty_ = 8;
112  constexpr float tailMissingHitPenalty_ = 3;
113 
114  // Threading
115 #if defined(MKFIT_STANDALONE)
116  extern int numThreadsFinder;
117  extern int numThreadsEvents;
118  extern int numSeedsPerTask;
119 #else
120  constexpr int numThreadsFinder = 1;
121  constexpr int numThreadsEvents = 1;
122  constexpr int numSeedsPerTask = 32;
123 #endif
124 
125  // config on seed cleaning
126  constexpr float track1GeVradius = 87.6; // = 1/(c*B)
127  constexpr float c_etamax_brl = 0.9;
128  constexpr float c_dpt_common = 0.25;
129  constexpr float c_dzmax_brl = 0.005;
130  constexpr float c_drmax_brl = 0.010;
131  constexpr float c_ptmin_hpt = 2.0;
132  constexpr float c_dzmax_hpt = 0.010;
133  constexpr float c_drmax_hpt = 0.010;
134  constexpr float c_dzmax_els = 0.015;
135  constexpr float c_drmax_els = 0.015;
136 
137  // config on duplicate removal
138 #if defined(MKFIT_STANDALONE)
139  extern bool useHitsForDuplicates;
140  extern bool removeDuplicates;
141 #else
142  const bool useHitsForDuplicates = true;
143 #endif
144  extern const float maxdPhi;
145  extern const float maxdPt;
146  extern const float maxdEta;
147  extern const float minFracHitsShared;
148  extern const float maxdR;
149 
150  // duplicate removal: tighter version
151  extern const float maxd1pt;
152  extern const float maxdphi;
153  extern const float maxdcth;
154  extern const float maxcth_ob;
155  extern const float maxcth_fw;
156 
157  // ================================================================
158 
159  inline float bFieldFromZR(const float z, const float r) {
160  return (Config::mag_b0 * z * z + Config::mag_b1 * z + Config::mag_c1) * (Config::mag_a * r * r + 1.f);
161  }
162 
163  }; // namespace Config
164 
165  //------------------------------------------------------------------------------
166 
167 } // end namespace mkfit
168 #endif
static constexpr int m_nphi
Definition: Config.h:81
constexpr float c_drmax_els
Definition: Config.h:135
const float maxdPt
Definition: Config.cc:31
const float maxdphi
Definition: Config.cc:38
const float maxd1pt
Definition: Config.cc:37
PropagationFlags(int pfe)
Definition: Config.h:16
const float maxdcth
Definition: Config.cc:39
constexpr float validHitSlope_
Definition: Config.h:109
void set_as_default(bool force=false)
Definition: Config.cc:7
PropagationFlags forward_fit_pflags
Definition: Config.h:27
constexpr float c_dpt_common
Definition: Config.h:128
constexpr bool nan_n_silly_check_cands_post_bkfit
Definition: Config.h:63
constexpr bool nan_n_silly_print_bad_seeds
Definition: Config.h:54
constexpr float mag_c1
Definition: Config.h:89
constexpr bool nan_n_silly_print_bad_cands_bkfit
Definition: Config.h:64
PropagationFlags backward_fit_pflags
Definition: Config.h:26
constexpr bool nan_n_silly_check_cands_pre_bkfit
Definition: Config.h:62
static const PropagationConfig * s_default
Definition: Config.h:36
const float maxdR
Definition: Config.cc:34
constexpr bool nan_n_silly_check_seeds
Definition: Config.h:53
constexpr float PIOver2
Definition: Config.h:44
PropagationFlagsEnum
Definition: Config.h:6
constexpr float TwoPI
Definition: Config.h:43
constexpr bool nan_n_silly_fixup_bad_cands_every_layer
Definition: Config.h:60
const float maxcth_fw
Definition: Config.cc:41
constexpr bool usePhiQArrays
Definition: Config.h:104
constexpr int nLayers
Definition: Config.h:73
PropagationFlags finding_inter_layer_pflags
Definition: Config.h:24
const float maxcth_ob
Definition: Config.cc:40
constexpr float c_dzmax_hpt
Definition: Config.h:132
constexpr float c_etamax_brl
Definition: Config.h:127
constexpr float mag_b1
Definition: Config.h:91
static const PropagationConfig & get_default()
Definition: Config.h:33
const float maxdEta
Definition: Config.cc:33
constexpr float PI
Definition: Config.h:42
constexpr bool nan_n_silly_remove_bad_seeds
Definition: Config.h:56
constexpr float c_ptmin_hpt
Definition: Config.h:131
const float maxdPhi
Definition: Config.cc:32
constexpr float mag_a
Definition: Config.h:92
constexpr float Bfield
Definition: Config.h:88
constexpr float tailMissingHitPenalty_
Definition: Config.h:112
PropagationFlags seed_fit_pflags
Definition: Config.h:28
constexpr int numThreadsFinder
Definition: Config.h:120
constexpr bool useTrigApprox
Definition: Config.h:85
PropagationFlags pca_prop_pflags
Definition: Config.h:29
bool finding_requires_propagation_to_hit_pos
Definition: Config.h:23
float cdist(float a)
Definition: Config.h:67
constexpr float overlapHitBonus_
Definition: Config.h:110
constexpr bool nan_etc_sigs_enable
Definition: Config.h:51
constexpr int nAvgSimHits
Definition: Config.h:78
constexpr bool nan_n_silly_fixup_bad_seeds
Definition: Config.h:55
constexpr float sol
Definition: Config.h:48
float bFieldFromZR(const float z, const float r)
Definition: Config.h:159
constexpr float track1GeVradius
Definition: Config.h:126
constexpr float c_dzmax_els
Definition: Config.h:134
constexpr float c_dzmax_brl
Definition: Config.h:129
constexpr bool nan_n_silly_check_cands_every_layer
Definition: Config.h:58
constexpr int numSeedsPerTask
Definition: Config.h:122
constexpr float mag_b0
Definition: Config.h:90
constexpr int numThreadsEvents
Definition: Config.h:121
double a
Definition: hdecay.h:119
Definition: Config.py:1
PropagationFlags finding_intra_layer_pflags
Definition: Config.h:25
constexpr float c_drmax_hpt
Definition: Config.h:133
const bool useHitsForDuplicates
Definition: Config.h:142
constexpr float c_drmax_brl
Definition: Config.h:130
constexpr float PI3Over4
Definition: Config.h:46
constexpr bool nan_n_silly_print_bad_cands_every_layer
Definition: Config.h:59
constexpr float InvPI
Definition: Config.h:47
constexpr int nMaxTrkHits
Definition: Config.h:77
constexpr float PIOver4
Definition: Config.h:45
constexpr float validHitBonus_
Definition: Config.h:108
constexpr int Niter
Definition: Config.h:84
const float minFracHitsShared
Definition: Config.cc:35
constexpr float missingHitPenalty_
Definition: Config.h:111