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