CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Settings.cc
Go to the documentation of this file.
3 #include <set>
4 #include <cmath>
5 
6 using namespace std;
7 
8 namespace tmtt {
9 
12 
13  Settings::Settings()
14  : //--------------------------------------------------------------------------------------------------
15  // TMTT related configuration parameters, including Kalman Filter.
16  // Meaning of these parameters explained in TrackFindingTMTT/python/TMTrackProducer_Defaults_cfi.py
17  //--------------------------------------------------------------------------------------------------
18 
19  // General cfg params
20  enableDigitize_(false),
21  useApproxB_(true),
22  bApprox_gradient_(0.886454),
23  bApprox_intercept_(0.504148),
24  numPhiNonants_(9),
25  numPhiSectors_(9),
26  chosenRofPhi_(55.), // Hourglass radius in r-phi (tracklet)
27  etaRegions_(
28  {-2.4, -2.08, -1.68, -1.26, -0.90, -0.62, -0.41, -0.20, 0.0, 0.20, 0.41, 0.62, 0.90, 1.26, 1.68, 2.08, 2.4}),
29  chosenRofZ_(50.0), // Hourglass radius in r-z (this must be tmtt)
30  houghMinPt_(2.0), // L1 track pt cut
31  minStubLayers_(4),
32  minPtToReduceLayers_(99999.),
33  reduceLayerID_(true),
38  stubMatchStrict_(false),
39 
40  // Kalman filter track fit cfg
42  //kalmanDebugLevel_(2), // Good for debugging
45  kalmanAddBeamConstr_(false), // Apply post-fit beam-spot constraint to 5-param fit
46  kalmanRemove2PScut_(true),
47  kalmanMaxSkipLayersHard_(1), // On "hard" input tracks
48  kalmanMaxSkipLayersEasy_(2), // On "easy" input tracks
49  kalmanMaxStubsEasy_(10), // Max. #stubs an input track can have to be defined "easy"
50  kfUseMaybeLayers_(true),
51  kfLayerVsPtToler_({999., 999., 0.1, 0.1, 0.05, 0.05, 0.05}),
52  kfLayerVsD0Cut5_({999., 999., 999., 10., 10., 10., 10.}),
53  kfLayerVsZ0Cut5_({999., 999., 25.5, 25.5, 25.5, 25.5, 25.5}),
54  kfLayerVsZ0Cut4_({999., 999., 15., 15., 15., 15., 15.}),
55  kfLayerVsChiSq5_({999., 999., 10., 30., 80., 120., 160.}),
56  kfLayerVsChiSq4_({999., 999., 10., 30., 80., 120., 160.}),
57  kalmanMaxStubsPerLayer_(4), // To save resources, consider at most this many stubs per layer per track.
58  kalmanMultiScattTerm_(0.00075),
60  kalmanHOtilted_(true),
61  kalmanHOhelixExp_(true),
62  kalmanHOalpha_(1),
64  kalmanHOfw_(false) {
65  hybrid_ = true;
66  magneticField_ = 0.; // Value set later
67  killScenario_ = 0; // Emulation of dead modules
68 
69  if (hybrid_) {
70  if (not useApproxB_) {
71  throw cms::Exception("BadConfig")
72  << "TMTT Settings Error: module tilt angle unknown, so must set useApproxB = true";
73  }
74  }
75  }
76 
79 
81  :
82 
83  // See either Analyze_Defaults_cfi.py or Settings.h for description of these parameters.
84 
85  //=== Tags for Input ES & ED data.
86  magneticFieldInputTag_(iConfig.getParameter<edm::ESInputTag>("magneticFieldInputTag")),
87  trackerGeometryInputTag_(iConfig.getParameter<edm::ESInputTag>("trackerGeometryInputTag")),
88  trackerTopologyInputTag_(iConfig.getParameter<edm::ESInputTag>("trackerTopologyInputTag")),
89  ttStubAlgoInputTag_(iConfig.getParameter<edm::ESInputTag>("ttStubAlgoInputTag")),
90 
91  stubInputTag_(iConfig.getParameter<edm::InputTag>("stubInputTag")),
92  tpInputTag_(iConfig.getParameter<edm::InputTag>("tpInputTag")),
93  stubTruthInputTag_(iConfig.getParameter<edm::InputTag>("stubTruthInputTag")),
94  clusterTruthInputTag_(iConfig.getParameter<edm::InputTag>("clusterTruthInputTag")),
95  genJetInputTag_(iConfig.getParameter<edm::InputTag>("genJetInputTag")),
96 
97  //=== Parameter sets for differents types of configuration parameter.
98  genCuts_(iConfig.getParameter<edm::ParameterSet>("GenCuts")),
99  stubCuts_(iConfig.getParameter<edm::ParameterSet>("StubCuts")),
100  stubDigitize_(iConfig.getParameter<edm::ParameterSet>("StubDigitize")),
101  trackerModuleType_(iConfig.getParameter<edm::ParameterSet>("TrackerModuleType")),
102  geometricProc_(iConfig.getParameter<edm::ParameterSet>("GeometricProc")),
103  phiSectors_(iConfig.getParameter<edm::ParameterSet>("PhiSectors")),
104  etaSectors_(iConfig.getParameter<edm::ParameterSet>("EtaSectors")),
105  htArraySpecRphi_(iConfig.getParameter<edm::ParameterSet>("HTArraySpecRphi")),
106  htFillingRphi_(iConfig.getParameter<edm::ParameterSet>("HTFillingRphi")),
107  rzFilterOpts_(iConfig.getParameter<edm::ParameterSet>("RZfilterOpts")),
108  l1TrackDef_(iConfig.getParameter<edm::ParameterSet>("L1TrackDef")),
109  dupTrkRemoval_(iConfig.getParameter<edm::ParameterSet>("DupTrkRemoval")),
110  trackMatchDef_(iConfig.getParameter<edm::ParameterSet>("TrackMatchDef")),
111  trackFitSettings_(iConfig.getParameter<edm::ParameterSet>("TrackFitSettings")),
112  deadModuleOpts_(iConfig.getParameter<edm::ParameterSet>("DeadModuleOpts")),
113  trackDigi_(iConfig.getParameter<edm::ParameterSet>("TrackDigi")),
114 
115  //=== General settings
116 
117  enableMCtruth_(iConfig.getParameter<bool>("EnableMCtruth")),
118  enableHistos_(iConfig.getParameter<bool>("EnableHistos")),
119  enableOutputIntermediateTTTracks_(iConfig.getParameter<bool>("EnableOutputIntermediateTTTracks")),
120 
121  //=== Cuts on MC truth tracks used for tracking efficiency measurements.
122 
123  genMinPt_(genCuts_.getParameter<double>("GenMinPt")),
124  genMaxAbsEta_(genCuts_.getParameter<double>("GenMaxAbsEta")),
125  genMaxVertR_(genCuts_.getParameter<double>("GenMaxVertR")),
126  genMaxVertZ_(genCuts_.getParameter<double>("GenMaxVertZ")),
127  genMaxD0_(genCuts_.getParameter<double>("GenMaxD0")),
128  genMaxZ0_(genCuts_.getParameter<double>("GenMaxZ0")),
129  genMinStubLayers_(genCuts_.getParameter<unsigned int>("GenMinStubLayers")),
130 
131  //=== Cuts applied to stubs before arriving in L1 track finding board.
132 
133  degradeBendRes_(stubCuts_.getParameter<unsigned int>("DegradeBendRes")),
134  maxStubEta_(stubCuts_.getParameter<double>("MaxStubEta")),
135  killLowPtStubs_(stubCuts_.getParameter<bool>("KillLowPtStubs")),
136  printStubWindows_(stubCuts_.getParameter<bool>("PrintStubWindows")),
137  bendCut_(stubCuts_.getParameter<double>("BendCut")),
138  bendCutExtra_(stubCuts_.getParameter<double>("BendCutExtra")),
139  orderStubsByBend_(stubCuts_.getParameter<bool>("OrderStubsByBend")),
140 
141  //=== Optional stub digitization.
142 
143  enableDigitize_(stubDigitize_.getParameter<bool>("EnableDigitize")),
144 
145  //--- Parameters available in MP board.
146  phiSectorBits_(stubDigitize_.getParameter<unsigned int>("PhiSectorBits")),
147  phiSBits_(stubDigitize_.getParameter<unsigned int>("PhiSBits")),
148  phiSRange_(stubDigitize_.getParameter<double>("PhiSRange")),
149  rtBits_(stubDigitize_.getParameter<unsigned int>("RtBits")),
150  rtRange_(stubDigitize_.getParameter<double>("RtRange")),
151  zBits_(stubDigitize_.getParameter<unsigned int>("ZBits")),
152  zRange_(stubDigitize_.getParameter<double>("ZRange")),
153  //--- Parameters available in GP board (excluding any in common with MP specified above).
154  phiNBits_(stubDigitize_.getParameter<unsigned int>("PhiNBits")),
155  phiNRange_(stubDigitize_.getParameter<double>("PhiNRange")),
156  bendBits_(stubDigitize_.getParameter<unsigned int>("BendBits")),
157 
158  //=== Tracker Module Type for FW.
159  pitchVsType_(trackerModuleType_.getParameter<vector<double>>("PitchVsType")),
160  spaceVsType_(trackerModuleType_.getParameter<vector<double>>("SpaceVsType")),
161  barrelVsTypeTmp_(trackerModuleType_.getParameter<vector<unsigned int>>("BarrelVsType")),
162  psVsTypeTmp_(trackerModuleType_.getParameter<vector<unsigned int>>("PSVsType")),
163  tiltedVsTypeTmp_(trackerModuleType_.getParameter<vector<unsigned int>>("TiltedVsType")),
164 
165  //=== Configuration of Geometric Processor.
166  useApproxB_(geometricProc_.getParameter<bool>("UseApproxB")),
167  bApprox_gradient_(geometricProc_.getParameter<double>("BApprox_gradient")),
168  bApprox_intercept_(geometricProc_.getParameter<double>("BApprox_intercept")),
169 
170  //=== Division of Tracker into phi sectors.
171  numPhiNonants_(phiSectors_.getParameter<unsigned int>("NumPhiNonants")),
172  numPhiSectors_(phiSectors_.getParameter<unsigned int>("NumPhiSectors")),
173  chosenRofPhi_(phiSectors_.getParameter<double>("ChosenRofPhi")),
174  useStubPhi_(phiSectors_.getParameter<bool>("UseStubPhi")),
175  useStubPhiTrk_(phiSectors_.getParameter<bool>("UseStubPhiTrk")),
176  assumedPhiTrkRes_(phiSectors_.getParameter<double>("AssumedPhiTrkRes")),
177  calcPhiTrkRes_(phiSectors_.getParameter<bool>("CalcPhiTrkRes")),
178 
179  //=== Division of Tracker into eta sectors.
180  etaRegions_(etaSectors_.getParameter<vector<double>>("EtaRegions")),
181  chosenRofZ_(etaSectors_.getParameter<double>("ChosenRofZ")),
182  beamWindowZ_(etaSectors_.getParameter<double>("BeamWindowZ")),
183  allowOver2EtaSecs_(etaSectors_.getParameter<bool>("AllowOver2EtaSecs")),
184 
185  //=== r-phi Hough transform array specifications.
186  houghMinPt_(htArraySpecRphi_.getParameter<double>("HoughMinPt")),
187  houghNbinsPt_(htArraySpecRphi_.getParameter<unsigned int>("HoughNbinsPt")),
188  houghNbinsPhi_(htArraySpecRphi_.getParameter<unsigned int>("HoughNbinsPhi")),
189  enableMerge2x2_(htArraySpecRphi_.getParameter<bool>("EnableMerge2x2")),
190  maxPtToMerge2x2_(htArraySpecRphi_.getParameter<double>("MaxPtToMerge2x2")),
191  numSubSecsEta_(htArraySpecRphi_.getParameter<unsigned int>("NumSubSecsEta")),
192  shape_(htArraySpecRphi_.getParameter<unsigned int>("Shape")),
193  miniHTstage_(htArraySpecRphi_.getParameter<bool>("MiniHTstage")),
194  miniHoughNbinsPt_(htArraySpecRphi_.getParameter<unsigned int>("MiniHoughNbinsPt")),
195  miniHoughNbinsPhi_(htArraySpecRphi_.getParameter<unsigned int>("MiniHoughNbinsPhi")),
196  miniHoughMinPt_(htArraySpecRphi_.getParameter<double>("MiniHoughMinPt")),
197  miniHoughDontKill_(htArraySpecRphi_.getParameter<bool>("MiniHoughDontKill")),
198  miniHoughDontKillMinPt_(htArraySpecRphi_.getParameter<double>("MiniHoughDontKillMinPt")),
199  miniHoughLoadBalance_(htArraySpecRphi_.getParameter<unsigned int>("MiniHoughLoadBalance")),
200 
201  //=== Rules governing how stubs are filled into the r-phi Hough Transform array.
202  killSomeHTCellsRphi_(htFillingRphi_.getParameter<unsigned int>("KillSomeHTCellsRphi")),
203  useBendFilter_(htFillingRphi_.getParameter<bool>("UseBendFilter")),
204  maxStubsInCell_(htFillingRphi_.getParameter<unsigned int>("MaxStubsInCell")),
205  maxStubsInCellMiniHough_(htFillingRphi_.getParameter<unsigned int>("MaxStubsInCellMiniHough")),
206  busySectorKill_(htFillingRphi_.getParameter<bool>("BusySectorKill")),
207  busySectorNumStubs_(htFillingRphi_.getParameter<unsigned int>("BusySectorNumStubs")),
208  busySectorMbinRanges_(htFillingRphi_.getParameter<vector<unsigned int>>("BusySectorMbinRanges")),
209  busySectorMbinOrder_(htFillingRphi_.getParameter<vector<unsigned int>>("BusySectorMbinOrder")),
210  busyInputSectorKill_(htFillingRphi_.getParameter<bool>("BusyInputSectorKill")),
211  busyInputSectorNumStubs_(htFillingRphi_.getParameter<unsigned int>("BusyInputSectorNumStubs")),
212  muxOutputsHT_(htFillingRphi_.getParameter<unsigned int>("MuxOutputsHT")),
213  etaRegWhitelist_(htFillingRphi_.getParameter<vector<unsigned int>>("EtaRegWhitelist")),
214 
215  //=== Options controlling r-z track filters (or any other track filters run after the Hough transform, as opposed to inside it).
216 
217  rzFilterName_(rzFilterOpts_.getParameter<string>("RZFilterName")),
218  seedResCut_(rzFilterOpts_.getParameter<double>("SeedResCut")),
219  keepAllSeed_(rzFilterOpts_.getParameter<bool>("KeepAllSeed")),
220  maxSeedCombinations_(rzFilterOpts_.getParameter<unsigned int>("MaxSeedCombinations")),
221  maxGoodSeedCombinations_(rzFilterOpts_.getParameter<unsigned int>("MaxGoodSeedCombinations")),
222  maxSeedsPerStub_(rzFilterOpts_.getParameter<unsigned int>("MaxSeedsPerStub")),
223  zTrkSectorCheck_(rzFilterOpts_.getParameter<bool>("zTrkSectorCheck")),
224  minFilterLayers_(rzFilterOpts_.getParameter<unsigned int>("MinFilterLayers")),
225 
226  //=== Rules for deciding when the track finding has found an L1 track candidate
227 
228  minStubLayers_(l1TrackDef_.getParameter<unsigned int>("MinStubLayers")),
229  minPtToReduceLayers_(l1TrackDef_.getParameter<double>("MinPtToReduceLayers")),
230  etaSecsReduceLayers_(l1TrackDef_.getParameter<vector<unsigned int>>("EtaSecsReduceLayers")),
231  reduceLayerID_(l1TrackDef_.getParameter<bool>("ReducedLayerID")),
232 
233  //=== Specification of algorithm to eliminate duplicate tracks.
234 
235  dupTrkAlgFit_(dupTrkRemoval_.getParameter<unsigned int>("DupTrkAlgFit")),
236 
237  //=== Rules for deciding when a reconstructed L1 track matches a MC truth particle (i.e. tracking particle).
238 
239  minFracMatchStubsOnReco_(trackMatchDef_.getParameter<double>("MinFracMatchStubsOnReco")),
240  minFracMatchStubsOnTP_(trackMatchDef_.getParameter<double>("MinFracMatchStubsOnTP")),
241  minNumMatchLayers_(trackMatchDef_.getParameter<unsigned int>("MinNumMatchLayers")),
242  minNumMatchPSLayers_(trackMatchDef_.getParameter<unsigned int>("MinNumMatchPSLayers")),
243  stubMatchStrict_(trackMatchDef_.getParameter<bool>("StubMatchStrict")),
244 
245  //=== Track Fitting Settings
246 
247  trackFitters_(trackFitSettings_.getParameter<vector<std::string>>("TrackFitters")),
248  useRZfilter_(trackFitSettings_.getParameter<vector<std::string>>("UseRZfilter")),
249  detailedFitOutput_(trackFitSettings_.getParameter<bool>("DetailedFitOutput")),
250  trackFitCheat_(trackFitSettings_.getParameter<bool>("TrackFitCheat")),
251  //
252  numTrackFitIterations_(trackFitSettings_.getParameter<unsigned int>("NumTrackFitIterations")),
253  killTrackFitWorstHit_(trackFitSettings_.getParameter<bool>("KillTrackFitWorstHit")),
254  generalResidualCut_(trackFitSettings_.getParameter<double>("GeneralResidualCut")),
255  killingResidualCut_(trackFitSettings_.getParameter<double>("KillingResidualCut")),
256  //
257  digitizeSLR_(trackFitSettings_.getParameter<bool>("DigitizeSLR")),
258  dividerBitsHelix_(trackFitSettings_.getParameter<unsigned int>("DividerBitsHelix")),
259  dividerBitsHelixZ_(trackFitSettings_.getParameter<unsigned int>("DividerBitsHelixZ")),
260  ShiftingBitsDenRPhi_(trackFitSettings_.getParameter<unsigned int>("ShiftingBitsDenRPhi")),
261  ShiftingBitsDenRZ_(trackFitSettings_.getParameter<unsigned int>("ShiftingBitsDenRZ")),
262  ShiftingBitsPt_(trackFitSettings_.getParameter<unsigned int>("ShiftingBitsPt")),
263  ShiftingBitsPhi_(trackFitSettings_.getParameter<unsigned int>("ShiftingBitsPhi")),
264 
265  ShiftingBitsLambda_(trackFitSettings_.getParameter<unsigned int>("ShiftingBitsLambda")),
266  ShiftingBitsZ0_(trackFitSettings_.getParameter<unsigned int>("ShiftingBitsZ0")),
267  slr_chi2cut_(trackFitSettings_.getParameter<double>("SLR_chi2cut")),
268  residualCut_(trackFitSettings_.getParameter<double>("ResidualCut")),
269  //
270  kalmanDebugLevel_(trackFitSettings_.getParameter<unsigned int>("KalmanDebugLevel")),
271  kalmanMinNumStubs_(trackFitSettings_.getParameter<unsigned int>("KalmanMinNumStubs")),
272  kalmanMaxNumStubs_(trackFitSettings_.getParameter<unsigned int>("KalmanMaxNumStubs")),
273  kalmanAddBeamConstr_(trackFitSettings_.getParameter<bool>("KalmanAddBeamConstr")),
274  kalmanRemove2PScut_(trackFitSettings_.getParameter<bool>("KalmanRemove2PScut")),
275  kalmanMaxSkipLayersHard_(trackFitSettings_.getParameter<unsigned>("KalmanMaxSkipLayersHard")),
276  kalmanMaxSkipLayersEasy_(trackFitSettings_.getParameter<unsigned>("KalmanMaxSkipLayersEasy")),
277  kalmanMaxStubsEasy_(trackFitSettings_.getParameter<unsigned>("KalmanMaxStubsEasy")),
278  kfUseMaybeLayers_(trackFitSettings_.getParameter<bool>("KFUseMaybeLayers")),
279 
280  kfLayerVsPtToler_(trackFitSettings_.getParameter<vector<double>>("KFLayerVsPtToler")),
281  kfLayerVsD0Cut5_(trackFitSettings_.getParameter<vector<double>>("KFLayerVsD0Cut5")),
282  kfLayerVsZ0Cut5_(trackFitSettings_.getParameter<vector<double>>("KFLayerVsZ0Cut5")),
283  kfLayerVsZ0Cut4_(trackFitSettings_.getParameter<vector<double>>("KFLayerVsZ0Cut4")),
284  kfLayerVsChiSq5_(trackFitSettings_.getParameter<vector<double>>("KFLayerVsChiSq5")),
285  kfLayerVsChiSq4_(trackFitSettings_.getParameter<vector<double>>("KFLayerVsChiSq4")),
286 
287  kalmanMaxStubsPerLayer_(trackFitSettings_.getParameter<unsigned>("KalmanMaxStubsPerLayer")),
288  kalmanMultiScattTerm_(trackFitSettings_.getParameter<double>("KalmanMultiScattTerm")),
289  kalmanChi2RphiScale_(trackFitSettings_.getParameter<unsigned>("KalmanChi2RphiScale")),
290  kalmanHOtilted_(trackFitSettings_.getParameter<bool>("KalmanHOtilted")),
291  kalmanHOhelixExp_(trackFitSettings_.getParameter<bool>("KalmanHOhelixExp")),
292  kalmanHOalpha_(trackFitSettings_.getParameter<unsigned int>("KalmanHOalpha")),
293  kalmanHOprojZcorr_(trackFitSettings_.getParameter<unsigned int>("KalmanHOprojZcorr")),
294  kalmanHOfw_(trackFitSettings_.getParameter<bool>("KalmanHOfw")),
295 
296  //=== Treatment of dead modules.
297 
298  killScenario_(deadModuleOpts_.getParameter<unsigned int>("KillScenario")),
299  killRecover_(deadModuleOpts_.getParameter<bool>("KillRecover")),
300 
301  //=== Track digitisation configuration for various track fitters
302 
303  slr_skipTrackDigi_(trackDigi_.getParameter<bool>("SLR_skipTrackDigi")),
304  slr_oneOver2rBits_(trackDigi_.getParameter<unsigned int>("SLR_oneOver2rBits")),
305  slr_oneOver2rRange_(trackDigi_.getParameter<double>("SLR_oneOver2rRange")),
306  slr_d0Bits_(trackDigi_.getParameter<unsigned int>("SLR_d0Bits")),
307  slr_d0Range_(trackDigi_.getParameter<double>("SLR_d0Range")),
308  slr_phi0Bits_(trackDigi_.getParameter<unsigned int>("SLR_phi0Bits")),
309  slr_phi0Range_(trackDigi_.getParameter<double>("SLR_phi0Range")),
310  slr_z0Bits_(trackDigi_.getParameter<unsigned int>("SLR_z0Bits")),
311  slr_z0Range_(trackDigi_.getParameter<double>("SLR_z0Range")),
312  slr_tanlambdaBits_(trackDigi_.getParameter<unsigned int>("SLR_tanlambdaBits")),
313  slr_tanlambdaRange_(trackDigi_.getParameter<double>("SLR_tanlambdaRange")),
314  slr_chisquaredBits_(trackDigi_.getParameter<unsigned int>("SLR_chisquaredBits")),
315  slr_chisquaredRange_(trackDigi_.getParameter<double>("SLR_chisquaredRange")),
316  //
317  kf_skipTrackDigi_(trackDigi_.getParameter<bool>("KF_skipTrackDigi")),
318  kf_oneOver2rBits_(trackDigi_.getParameter<unsigned int>("KF_oneOver2rBits")),
319  kf_oneOver2rRange_(trackDigi_.getParameter<double>("KF_oneOver2rRange")),
320  kf_d0Bits_(trackDigi_.getParameter<unsigned int>("KF_d0Bits")),
321  kf_d0Range_(trackDigi_.getParameter<double>("KF_d0Range")),
322  kf_phi0Bits_(trackDigi_.getParameter<unsigned int>("KF_phi0Bits")),
323  kf_phi0Range_(trackDigi_.getParameter<double>("KF_phi0Range")),
324  kf_z0Bits_(trackDigi_.getParameter<unsigned int>("KF_z0Bits")),
325  kf_z0Range_(trackDigi_.getParameter<double>("KF_z0Range")),
326  kf_tanlambdaBits_(trackDigi_.getParameter<unsigned int>("KF_tanlambdaBits")),
327  kf_tanlambdaRange_(trackDigi_.getParameter<double>("KF_tanlambdaRange")),
328  kf_chisquaredBits_(trackDigi_.getParameter<unsigned int>("KF_chisquaredBits")),
329  kf_chisquaredRange_(trackDigi_.getParameter<double>("KF_chisquaredRange")),
330  kf_chisquaredBinEdges_(trackDigi_.getParameter<vector<double>>("KF_chisquaredBinEdges")),
331  //
332  other_skipTrackDigi_(trackDigi_.getParameter<bool>("Other_skipTrackDigi")),
333 
334  // Plot options
335  resPlotOpt_(iConfig.getParameter<bool>("ResPlotOpt")),
336 
337  // Name of output EDM file if any.
338  // N.B. This parameter does not appear inside TMTrackProducer_Defaults_cfi.py . It is created inside
339  // tmtt_tf_analysis_cfg.py .
340  writeOutEdmFile_(iConfig.getUntrackedParameter<bool>("WriteOutEdmFile", true)),
341 
342  // Bfield in Tesla. (Unknown at job initiation. Set to true value for each event
343  magneticField_(0.),
344 
345  // Hybrid tracking
346  hybrid_(iConfig.getParameter<bool>("Hybrid")) {
347  // If user didn't specify any PDG codes, use e,mu,pi,K,p, to avoid picking up unstable particles like Xi-.
348  vector<unsigned int> genPdgIdsUnsigned(genCuts_.getParameter<vector<unsigned int>>("GenPdgIds"));
349  if (genPdgIdsUnsigned.empty()) {
350  genPdgIdsUnsigned = {11, 13, 211, 321, 2212};
351  }
352 
353  // For simplicity, user need not distinguish particles from antiparticles in configuration file.
354  // But here we must store both explicitely in Settings, since TrackingParticleSelector expects them.
355  for (unsigned int i = 0; i < genPdgIdsUnsigned.size(); i++) {
356  genPdgIds_.push_back(genPdgIdsUnsigned[i]);
357  genPdgIds_.push_back(-genPdgIdsUnsigned[i]);
358  }
359 
360  // Clean up list of fitters that require the r-z track filter to be run before them,
361  // by removing those fitters that are not to be run.
362  vector<string> useRZfilterTmp;
363  for (const string& name : useRZfilter_) {
364  if (std::count(trackFitters_.begin(), trackFitters_.end(), name) > 0)
365  useRZfilterTmp.push_back(name);
366  }
367  useRZfilter_ = useRZfilterTmp;
368 
369  // As python cfg doesn't know type "vbool", fix it here.
370  for (unsigned int i = 0; i < barrelVsTypeTmp_.size(); i++) {
371  barrelVsType_.push_back(bool(barrelVsTypeTmp_[i]));
372  psVsType_.push_back(bool(psVsTypeTmp_[i]));
373  tiltedVsType_.push_back(bool(tiltedVsTypeTmp_[i]));
374  }
375 
376  //--- Sanity checks
377 
378  if (!(useStubPhi_ || useStubPhiTrk_))
379  throw cms::Exception("BadConfig")
380  << "Settings: Invalid cfg parameters - You cant set both UseStubPhi & useStubPhiTrk to false.";
381 
383  throw cms::Exception("BadConfig")
384  << "Settings: Invalid cfg parameters - You are setting the minimum number of layers incorrectly : type A.";
386  throw cms::Exception("BadConfig")
387  << "Settings: Invalid cfg parameters - You are setting the minimum number of layers incorrectly : type B.";
389  throw cms::Exception("BadConfig")
390  << "Settings: Invalid cfg parameters - You are setting the minimum number of layers incorrectly : type C.";
391 
392  // If reducing number of required layers for high Pt tracks, then above checks must be redone.
393  bool doReduceLayers = (minPtToReduceLayers_ < 10000. || not etaSecsReduceLayers_.empty());
394  if (doReduceLayers && minStubLayers_ > 4) {
396  throw cms::Exception("BadConfig")
397  << "Settings: Invalid cfg parameters - You are setting the minimum number of layers incorrectly : type D.";
399  throw cms::Exception("BadConfig")
400  << "Settings: Invalid cfg parameters - You are setting the minimum number of layers incorrectly : type E.";
401  }
402 
403  constexpr float verySmall = 0.1;
404  if (houghMinPt_ < verySmall)
405  throw cms::Exception("BadConfig") << "Settings: Invalid cfg parameters -- HoughMinPt must be positive.";
407 
408  for (const unsigned int& iEtaReg : etaSecsReduceLayers_) {
409  if (iEtaReg >= etaRegions_.size())
410  throw cms::Exception("BadConfig") << "Settings: You specified an eta sector number in EtaSecsReduceLayers "
411  "which exceeds the total number of eta sectors! "
412  << iEtaReg << " " << etaRegions_.size();
413  }
414 
415  // Chains of m bin ranges for output of HT.
416  if (!busySectorMbinOrder_.empty()) {
417  // User has specified an order in which the m bins should be chained together. Check if it makes sense.
418  if (busySectorMbinOrder_.size() != houghNbinsPt_)
419  throw cms::Exception("BadConfig")
420  << "Settings: Invalid cfg parameters - BusySectorMbinOrder used by HT MUX contains wrong number of "
421  "elements. Unless you are optimising the MUX, suggest you configure it to an empty vector.";
422  set<unsigned int> mOrderCheck;
423  for (const unsigned int& m : busySectorMbinOrder_) {
424  mOrderCheck.insert(m);
425  }
426  if (mOrderCheck.size() != houghNbinsPt_)
427  throw cms::Exception("BadConfig")
428  << "Settings: Invalid cfg parameters - BusySectorMbinOrder used by HT MUX contains duplicate elements.";
429  unsigned int sum_nr = 0;
430  for (unsigned int nr : busySectorMbinRanges_) {
431  sum_nr += nr;
432  }
433  if (sum_nr != houghNbinsPt_)
434  throw cms::Exception("BadConfig")
435  << "Settings: Invalid cfg parameters - Sum of entries in BusySectorMbinRanges is incorrect.";
436  }
437 
438  if (miniHTstage_) {
439  if (enableMerge2x2_)
440  throw cms::Exception("BadConfig")
441  << "Settings: it is not allowed to enable both MiniHTstage & EnableMerge2x2 options.";
442  // Options for 2nd stage mini HT
443  if (shape_ != 0)
444  throw cms::Exception("BadConfig")
445  << "Settings: Invalid cfg parameters - 2nd stage mini HT only allowed for square-shaped cells.";
446  if (miniHoughNbinsPt_ != 2 || miniHoughNbinsPhi_ != 2)
447  throw cms::Exception("BadConfig") << "Settings: 2nd mini HT has so dar only been implemented in C++ for 2x2.";
448  }
449 
450  if (enableMerge2x2_) {
451  if (miniHTstage_)
452  throw cms::Exception("BadConfig")
453  << "Settings: it is not allowed to enable both MiniHTstage & EnableMerge2x2 options.";
454  // Merging of HT cells has not yet been implemented for diamond or hexagonal HT cell shape.
455  if (enableMerge2x2_ && shape_ != 0)
456  throw cms::Exception("BadConfig")
457  << "Settings: Invalid cfg parameters - merging only allowed for square-shaped cells.";
458  }
459 
460  // Check Kalman fit params.
462  throw cms::Exception("BadConfig")
463  << "Settings: Invalid cfg parameters - KalmanMaxNumStubs is less than KalmanMaxNumStubs.";
464  }
465 
466  bool Settings::isHTRPhiEtaRegWhitelisted(unsigned const iEtaReg) const {
467  bool whitelisted = true;
468 
469  bool const whitelist_enabled = (!etaRegWhitelist_.empty());
470  if (whitelist_enabled) {
471  whitelisted = (std::count(etaRegWhitelist_.begin(), etaRegWhitelist_.end(), iEtaReg) > 0);
472  }
473 
474  return whitelisted;
475  }
476 
477 } // namespace tmtt
kfLayerVsChiSq4_({999., 999., 10., 30., 80., 120., 160.})
std::vector< double > etaRegions_
Definition: Settings.h:504
unsigned int miniHoughNbinsPt_
Definition: Settings.h:518
kalmanHOalpha_(1)
minNumMatchLayers_(4)
kfLayerVsD0Cut5_({999., 999., 999., 10., 10., 10., 10.})
std::vector< bool > barrelVsType_
Definition: Settings.h:482
std::vector< unsigned int > barrelVsTypeTmp_
Definition: Settings.h:485
kalmanHOfw_(false)
Definition: Settings.cc:64
std::vector< unsigned int > psVsTypeTmp_
Definition: Settings.h:486
bool enableMerge2x2_
Definition: Settings.h:513
kalmanMaxSkipLayersHard_(1)
kfUseMaybeLayers_(true)
std::vector< std::string > useRZfilter_
Definition: Settings.h:567
edm::ParameterSet genCuts_
Definition: Settings.h:425
kfLayerVsPtToler_({999., 999., 0.1, 0.1, 0.05, 0.05, 0.05})
kalmanMaxSkipLayersEasy_(2)
std::vector< bool > tiltedVsType_
Definition: Settings.h:484
kalmanMaxNumStubs_(6)
unsigned int miniHoughNbinsPhi_
Definition: Settings.h:519
kalmanMinNumStubs_(4)
kfLayerVsZ0Cut4_({999., 999., 15., 15., 15., 15., 15.})
kalmanHOtilted_(true)
std::vector< int > genPdgIds_
Definition: Settings.h:454
bool miniHTstage_
Definition: Settings.h:517
std::vector< unsigned int > etaSecsReduceLayers_
Definition: Settings.h:552
kalmanChi2RphiScale_(8)
kalmanMaxStubsPerLayer_(4)
houghMinPt_(2.0)
double houghMinPt_
Definition: Settings.h:510
kalmanRemove2PScut_(true)
kalmanMaxStubsEasy_(10)
std::vector< std::string > trackFitters_
Definition: Settings.h:566
bool isHTRPhiEtaRegWhitelisted(unsigned const iEtaReg) const
Definition: Settings.cc:466
kfLayerVsChiSq5_({999., 999., 10., 30., 80., 120., 160.})
unsigned int minStubLayers_
Definition: Settings.h:550
stubMatchStrict_(false)
unsigned int houghNbinsPt_
Definition: Settings.h:511
chosenRofZ_(50.0)
std::vector< bool > psVsType_
Definition: Settings.h:483
bool useStubPhiTrk_
Definition: Settings.h:499
minFracMatchStubsOnTP_(-99)
std::vector< unsigned int > etaRegWhitelist_
Definition: Settings.h:537
kalmanHOprojZcorr_(1)
unsigned int shape_
Definition: Settings.h:516
unsigned int minNumMatchLayers_
Definition: Settings.h:561
unsigned int genMinStubLayers_
Definition: Settings.h:455
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
minNumMatchPSLayers_(0)
reduceLayerID_(true)
bool useStubPhi_
Definition: Settings.h:498
std::vector< unsigned int > busySectorMbinRanges_
Definition: Settings.h:532
kalmanAddBeamConstr_(false)
double miniHoughMinPt_
Definition: Settings.h:520
unsigned int kalmanMinNumStubs_
Definition: Settings.h:591
minStubLayers_(4)
minFracMatchStubsOnReco_(-99)
std::vector< unsigned int > busySectorMbinOrder_
Definition: Settings.h:533
minPtToReduceLayers_(99999.)
unsigned int kalmanMaxNumStubs_
Definition: Settings.h:592
kalmanMultiScattTerm_(0.00075)
kfLayerVsZ0Cut5_({999., 999., 25.5, 25.5, 25.5, 25.5, 25.5})
kalmanDebugLevel_(0)
std::vector< unsigned int > tiltedVsTypeTmp_
Definition: Settings.h:487
double minPtToReduceLayers_
Definition: Settings.h:551
kalmanHOhelixExp_(true)