Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:42

0001 #ifndef L1Trigger_TrackFindingTMTT_Settings_h
0002 #define L1Trigger_TrackFindingTMTT_Settings_h
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/Utilities/interface/InputTag.h"
0006 #include "FWCore/Utilities/interface/ESInputTag.h"
0007 #include "FWCore/Utilities/interface/Exception.h"
0008 #include "CLHEP/Units/PhysicalConstants.h"
0009 #include <vector>
0010 #include <iostream>
0011 #include <atomic>
0012 
0013 // Stores all configuration parameters + some hard-wired constants.
0014 
0015 namespace tmtt {
0016 
0017   class Settings {
0018   public:
0019     // Constructor for HYBRID (sets config to hard-wired consts to allow use outside CMSSW).
0020     Settings();
0021 
0022     // Constructor for TMTT (reads config from python cfg)
0023     Settings(const edm::ParameterSet& iConfig);
0024 
0025     // Input tags for ES & ED data.
0026     edm::ESInputTag magneticFieldInputTag() const { return magneticFieldInputTag_; }
0027     edm::ESInputTag trackerGeometryInputTag() const { return trackerGeometryInputTag_; }
0028     edm::ESInputTag trackerTopologyInputTag() const { return trackerTopologyInputTag_; }
0029     edm::ESInputTag ttStubAlgoInputTag() const { return ttStubAlgoInputTag_; }
0030 
0031     edm::InputTag stubInputTag() const { return stubInputTag_; }
0032     edm::InputTag tpInputTag() const { return tpInputTag_; }
0033     edm::InputTag stubTruthInputTag() const { return stubTruthInputTag_; }
0034     edm::InputTag clusterTruthInputTag() const { return clusterTruthInputTag_; }
0035     edm::InputTag genJetInputTag() const { return genJetInputTag_; }
0036 
0037     //=== General settings.
0038 
0039     // Enable all use of MC truth info (disable to save CPU).
0040     bool enableMCtruth() const { return enableMCtruth_; }
0041     // Enable output histograms & job tracking performance summary (disable to save CPU).
0042     bool enableHistos() const { return enableHistos_; }
0043     // Enable output of TTTracks from part-way through tracking chain (after HT & RZ).
0044     bool enableOutputIntermediateTTTracks() const { return enableOutputIntermediateTTTracks_; }
0045 
0046     //=== Cuts on MC truth tracks for tracking efficiency measurements.
0047 
0048     double genMinPt() const { return genMinPt_; }
0049     double genMaxAbsEta() const { return genMaxAbsEta_; }
0050     double genMaxVertR() const { return genMaxVertR_; }
0051     double genMaxVertZ() const { return genMaxVertZ_; }
0052     double genMaxD0() const { return genMaxD0_; }
0053     double genMaxZ0() const { return genMaxZ0_; }
0054     const std::vector<int>& genPdgIds() const { return genPdgIds_; }
0055     // Additional cut on MC truth tracks for algorithmic tracking efficiency measurements.
0056     unsigned int genMinStubLayers() const { return genMinStubLayers_; }  // Min. number of layers TP made stub in.
0057 
0058     //=== Cuts applied to stubs before arriving in L1 track finding board.
0059 
0060     // Reduce number of bits used by front-end chips to store stub bend info?
0061     // = 0 (no); = 1 (yes using official recipe); = 2 (yes using TMTT method)
0062     unsigned int degradeBendRes() const { return degradeBendRes_; }
0063     // Don't use stubs with eta beyond this cut, since the tracker geometry makes it impossible to reconstruct tracks with them.
0064     double maxStubEta() const { return maxStubEta_; }
0065     // Don't use stubs whose measured Pt from bend info is significantly below HTArraySpec.HoughMinPt, where "significantly" means allowing for resolution in q/Pt derived from stub bend resolution HTFilling.BendResolution
0066     bool killLowPtStubs() const { return killLowPtStubs_; }
0067     // Print stub windows corresponding to KillLowPtStubs, in python cfg format used by CMSSW.
0068     bool printStubWindows() const { return printStubWindows_; }
0069     // Bend resolution assumed by bend filter in units of strip pitch. Also used when assigning stubs to sectors if calcPhiTrkRes() is true.
0070     double bendCut() const { return bendCut_; }
0071     // Additional contribution to bend resolution from its encoding into a reduced number of bits.
0072     // This number is the assumed resolution relative to the naive guess of its value.
0073     // It is ignored in DegradeBendRes = 0.
0074     double bendCutExtra() const { return bendCutExtra_; }
0075     // Order stubs by bend in DTC, such that highest Pt stubs are transmitted first.
0076     bool orderStubsByBend() const { return orderStubsByBend_; }
0077 
0078     //=== Optional stub digitization configuration
0079 
0080     bool enableDigitize() const { return enableDigitize_; }
0081     //--- Parameters available in MP board.
0082     unsigned int phiSectorBits() const { return phiSectorBits_; }
0083     unsigned int phiSBits() const { return phiSBits_; }
0084     double phiSRange() const { return phiSRange_; }
0085     unsigned int rtBits() const { return rtBits_; }
0086     double rtRange() const { return rtRange_; }
0087     unsigned int zBits() const { return zBits_; }
0088     double zRange() const { return zRange_; }
0089     //--- Parameters available in GP board (excluding any in common with MP specified above).
0090     unsigned int phiNBits() const { return phiNBits_; }
0091     double phiNRange() const { return phiNRange_; }
0092     unsigned int bendBits() const { return bendBits_; }
0093 
0094     //=== Tracker module type for FW.
0095     const std::vector<double>& pitchVsType() const { return pitchVsType_; }
0096     const std::vector<double>& spaceVsType() const { return spaceVsType_; }
0097     const std::vector<bool>& barrelVsType() const { return barrelVsType_; }
0098     const std::vector<bool>& psVsType() const { return psVsType_; }
0099     const std::vector<bool>& tiltedVsType() const { return tiltedVsType_; }
0100 
0101     //=== Configuration of Geometric Processor.
0102     // Use an FPGA-friendly approximation to determine track angle dphi from bend in GP?
0103     bool useApproxB() const { return useApproxB_; }
0104     double bApprox_gradient() const { return bApprox_gradient_; }
0105     double bApprox_intercept() const { return bApprox_intercept_; }
0106 
0107     //=== Definition of phi sectors.
0108 
0109     unsigned int numPhiNonants() const { return numPhiNonants_; }
0110     unsigned int numPhiSectors() const { return numPhiSectors_; }
0111     // Use phi of track at this radius as sector hourglass reference radius.
0112     double chosenRofPhi() const { return chosenRofPhi_; }
0113     // Require stub phi to be consistent with track of Pt > HTArraySpec.HoughMinPt that crosses HT phi axis?
0114     bool useStubPhi() const { return useStubPhi_; }
0115     // Require stub phi0 (or phi65 etc.) as estimated from stub bend, to lie within HT phi axis, allowing tolerance specified below?
0116     bool useStubPhiTrk() const { return useStubPhiTrk_; }
0117     // Tolerance in stub phi0 (or phi65) assumed to be this fraction of phi sector width. (N.B. If > 0.5, then stubs can be shared by more than 2 phi sectors).
0118     double assumedPhiTrkRes() const { return assumedPhiTrkRes_; }
0119     // If true, tolerance in stub phi0 (or phi65 etc.) will be reduced below AssumedPhiTrkRes if stub bend resolution specified in StubCuts.BendResolution suggests it is safe to do so.
0120     bool calcPhiTrkRes() const { return calcPhiTrkRes_; }
0121 
0122     //=== Definition of eta sectors.
0123 
0124     const std::vector<double>& etaRegions() const { return etaRegions_; }  // Boundaries of eta regions de
0125     unsigned int numEtaRegions() const { return (etaRegions_.size() - 1); }
0126     // Use z of track at this radius for assignment of stubs to phi sectors & also for one of the axes of the r-z HT.
0127     double chosenRofZ() const { return chosenRofZ_; }
0128     // Half-width of window supposed to contain beam-spot in z.
0129     double beamWindowZ() const { return beamWindowZ_; }
0130     // If True, the code will not throw an error if a stub is assigned to 3 or more eta sectors.
0131     bool allowOver2EtaSecs() const { return allowOver2EtaSecs_; }
0132 
0133     //=== r-phi Hough transform array specifications.
0134 
0135     double houghMinPt() const { return houghMinPt_; }
0136     // Dimension in any q/Pt related variable. (If MiniHTstage = True, this refers to mini cells in whole HT array).
0137     unsigned int houghNbinsPt() const { return houghNbinsPt_; }
0138     // Dimension in any track-phi related variable. (If MiniHTstage = True, this refers to mini cells in whole HT array).
0139     unsigned int houghNbinsPhi() const { return houghNbinsPhi_; }
0140     // Groups of neighbouring 2x2 cells in HT will be treated as if they are a single large cell. (Also enabled in MiniHTstage = True).
0141     bool enableMerge2x2() const { return enableMerge2x2_; }
0142     // but only cells with pt < maxPtToMerge2x2() will be merged in this way (irrelevant if enableMerge2x2() = false).
0143     double maxPtToMerge2x2() const { return maxPtToMerge2x2_; }
0144     // Subdivide each sector into this number of subsectors in eta within r-phi HT.
0145     unsigned int numSubSecsEta() const { return numSubSecsEta_; }
0146     // define cell shape (0 square, 1 diamond, 2 hexagon, 3 brick)
0147     unsigned int shape() const { return shape_; }
0148     // Run 2nd stage HT with mini cells inside each 1st stage normal HT cell. N.B. This automatically std::sets EnableMerge2x2 = True & MaxPtToMerge = 999999.
0149     bool miniHTstage() const { return miniHTstage_; }
0150     // Number of mini cells along q/Pt & phi axes inside each normal HT cell.
0151     unsigned int miniHoughNbinsPt() const { return miniHoughNbinsPt_; }
0152     unsigned int miniHoughNbinsPhi() const { return miniHoughNbinsPhi_; }
0153     // Below this Pt threshold, the mini HT will not be used, so only tracks found by 1st stage coarse HT will be output. (Used to improve low Pt tracking). (HT cell numbering remains as if mini HT were in use everywhere).
0154     float miniHoughMinPt() const { return miniHoughMinPt_; }
0155     // If true, allows tracks found by 1st stage coarse HT to be output if 2nd stage mini HT finds no tracks.
0156     bool miniHoughDontKill() const { return miniHoughDontKill_; }
0157     // If MiniHoughDontKill=True, this option restricts it to keep 1st stage HT tracks only if their Pt is exceeds this cut. (Used to improve electron tracking above this threshold).
0158     float miniHoughDontKillMinPt() const { return miniHoughDontKillMinPt_; }
0159     // load balancing disabled = 0; static load balancing of output links = 1; dynamic load balancing of output links = 2.
0160     unsigned int miniHoughLoadBalance() const { return miniHoughLoadBalance_; }
0161 
0162     //=== Rules governing how stubs are filled into the r-phi Hough Transform array.
0163 
0164     // Take all cells in HT array crossed by line corresponding to each stub (= 0) or take only some to reduce rate at cost
0165     // of efficiency ( > 0). If this option is > 0, it can be 1 or 2, corresponding to different algorithms for rejecting some of the cells.
0166     unsigned int killSomeHTCellsRphi() const { return killSomeHTCellsRphi_; }
0167     // Use filter in each HT cell using only stubs which have consistent bend, allowing for resolution specified in StubCuts.BendResolution.
0168     bool useBendFilter() const { return useBendFilter_; }
0169     // A filter is used each HT cell, which prevents more than the specified number of stubs being stored in the cell. (Reflecting memory limit of hardware). N.B. If mini-HT is in use, then this cut applies to coarse-HT.
0170     unsigned int maxStubsInCell() const { return maxStubsInCell_; }
0171     // Similar cut for Mini-HT.
0172     unsigned int maxStubsInCellMiniHough() const { return maxStubsInCellMiniHough_; }
0173     // If this returns true, and if more than busySectorNumStubs() stubs are assigned to tracks by an r-phi HT array, then
0174     // the excess tracks are killed, with lowest Pt ones killed first. This is because hardware has finite readout time.
0175     bool busySectorKill() const { return busySectorKill_; }
0176     unsigned int busySectorNumStubs() const { return busySectorNumStubs_; }
0177     // If this returns a non-empty std::vector, then the BusySectorNumStubs cut is instead applied to the subset of tracks appearing in the following m bin ranges (q/Pt) of the HT array. The sum of the entries in the std::vector should equal the number of m bins in the HT, although the entries will be rescaled if this is not the case. If the std::vector is empty, this option is disabled. (P.S. If the HT includes "merged" cells, then the m bin ranges specified here should correspond to the bins before merging).
0178     const std::vector<unsigned int>& busySectorMbinRanges() const { return busySectorMbinRanges_; }
0179     // If BusySecMbinOrder is empty, then the groupings specified in BusySectorMbinRanges are applied to the m bins in the order
0180     // 0,1,2,3,4,5 ... . If it is not empty, then they are grouped in the order specified here.
0181     const std::vector<unsigned int>& busySectorMbinOrder() const { return busySectorMbinOrder_; }
0182     // If this is True, and more than BusyInputSectorNumStubs() are input to the HT array from the GP, then
0183     // the excess stubs are killed. This is because HT hardware has finite readin time.
0184     bool busyInputSectorKill() const { return busyInputSectorKill_; }
0185     unsigned int busyInputSectorNumStubs() const { return busyInputSectorNumStubs_; }
0186     // Multiplex the outputs from several HTs onto a single pair of output optical links?
0187     // Options: 0 = disable Mux; 1 = Dec. 2016 Mux; 2 = Mar 2018 Mux (transverse HT readout by m-bin);
0188     // 3 = Sept 2019 Mux (transverse HT readout by m-bin)
0189     unsigned int muxOutputsHT() const { return muxOutputsHT_; }
0190     // Is specified eta sector enabled?
0191     bool isHTRPhiEtaRegWhitelisted(unsigned const iEtaReg) const;
0192 
0193     //=== Options controlling r-z track filters (or any other track filters run after the Hough transform, as opposed to inside it).
0194 
0195     // Specify preferred r-z filter (from those available inside TrkRZfilter.cc) - currently only "SeedFilter".
0196     const std::string& rzFilterName() const { return rzFilterName_; }
0197     // --- Options relevant for Seed filter, (so only relevant if rzFilterName()="SeedFilter").
0198     // Cut at this many standard deviations on seed resolution.
0199     double seedResCut() const { return seedResCut_; }
0200     // Store stubs compatible with all possible good seed (relevant for Seed filter)?
0201     bool keepAllSeed() const { return keepAllSeed_; }
0202     // Maximum number of seed combinations to check (relevant for Seed filter).
0203     unsigned int maxSeedCombinations() const { return maxSeedCombinations_; }
0204     // Maximum number of seed combinations consistent with (z0,eta) sector constraints to bother checking per track candidate.
0205     unsigned int maxGoodSeedCombinations() const { return maxGoodSeedCombinations_; }
0206     // Maximum number of seeds that a single stub can be included in.
0207     unsigned int maxSeedsPerStub() const { return maxSeedsPerStub_; }
0208     // Check that estimated zTrk from seeding stub is within the sector boundaries (relevant for Seed filter)?
0209     bool zTrkSectorCheck() const { return zTrkSectorCheck_; }
0210     // Min. number of layers in rz track that must have stubs for track to be declared found.
0211     unsigned int minFilterLayers() const { return minFilterLayers_; }
0212 
0213     //=== Rules for deciding when the (HT) track finding has found an L1 track candidate
0214 
0215     // Min. number of layers in HT cell that must have stubs for track to be declared found.
0216     unsigned int minStubLayers() const { return minStubLayers_; }
0217     // Change min. number of layers cut to (MinStubLayers - 1) for tracks with Pt exceeding this cut.
0218     // If this is std::set to > 10000, this option is disabled.
0219     double minPtToReduceLayers() const { return minPtToReduceLayers_; }
0220     // Change min. number of layers cut to (MinStubLayers - 1) for tracks in these rapidity sectors.
0221     const std::vector<unsigned int>& etaSecsReduceLayers() const { return etaSecsReduceLayers_; }
0222     //Reduce this layer ID, so that it takes no more than 8 different values in any eta region (simplifies firmware)?
0223     bool reduceLayerID() const { return reduceLayerID_; }
0224 
0225     //=== Specification of algorithm to eliminate duplicate tracks
0226 
0227     // Algorithm run on tracks after the track helix fit has been done.
0228     unsigned int dupTrkAlgFit() const { return dupTrkAlgFit_; }
0229 
0230     //=== Rules for deciding when a reconstructed L1 track matches a MC truth particle (i.e. tracking particle).
0231 
0232     //--- Three different ways to define if a tracking particle matches a reco track candidate. (Usually, std::set two of them to ultra loose).
0233     // Min. fraction of matched stubs relative to number of stubs on reco track.
0234     double minFracMatchStubsOnReco() const { return minFracMatchStubsOnReco_; }
0235     // Min. fraction of matched stubs relative to number of stubs on tracking particle.
0236     double minFracMatchStubsOnTP() const { return minFracMatchStubsOnTP_; }
0237     // Min. number of matched layers & min. number of matched PS layers..
0238     unsigned int minNumMatchLayers() const { return minNumMatchLayers_; }
0239     unsigned int minNumMatchPSLayers() const { return minNumMatchPSLayers_; }
0240     // Associate stub to TP only if the TP contributed to both its clusters? (If False, then associate even if only one cluster was made by TP).
0241     bool stubMatchStrict() const { return stubMatchStrict_; }
0242 
0243     //=== Track Fitting Settings
0244 
0245     //--- Options applicable to all track fitters ---
0246 
0247     // Track fitting algorithms to use. You can run several in parallel.
0248     const std::vector<std::string>& trackFitters() const { return trackFitters_; }
0249     // Indicate subset of fitters wanting r-z track filter to be run before them.
0250     // (Excludes fitters that are not run).
0251     const std::vector<std::string>& useRZfilter() const { return useRZfilter_; }
0252     // Print detailed summary of track fit performance at end of job (as opposed to a brief one)?
0253     bool detailedFitOutput() const { return detailedFitOutput_; }
0254     // Use MC truth to eliminate all fake tracks & all incorrect stubs assigned to tracks before doing fit.
0255     bool trackFitCheat() const { return trackFitCheat_; }
0256 
0257     //--- Options for chi2 track fitter ---
0258 
0259     // Number of iterations that the track fit should perform.
0260     unsigned int numTrackFitIterations() const { return numTrackFitIterations_; }
0261     // Optionally remove hit with worst residual in track fit? (Only used by chi2 track fit).
0262     bool killTrackFitWorstHit() const { return killTrackFitWorstHit_; }
0263     // Cuts in standard deviations used to kill hits with big residuals during fit. If the residual exceeds the "General"
0264     // cut, the hit is killed providing it leaves the track with enough hits to survive. If the residual exceeds the
0265     // "Killing" cut, the hit is killed even if that kills the track.
0266     double generalResidualCut() const { return generalResidualCut_; }
0267     double killingResidualCut() const { return killingResidualCut_; }
0268 
0269     //--- Additional options for Davide Cieri's Simple Linear Regression track fitter ---
0270 
0271     // Digitize Simple Linear Regression variables & calculation. (Disabled if EnableDigitize=False).
0272     bool digitizeSLR() const { return digitizeSLR_; }
0273     /// Number of bits to be used in hardware to compute the division needed to calculate the helix parameters
0274     unsigned int dividerBitsHelix() const { return dividerBitsHelix_; }
0275     unsigned int dividerBitsHelixZ() const { return dividerBitsHelixZ_; }
0276     /// Number of bits to reduce the RPhi helix parameter denominator calculation weight
0277     unsigned int ShiftingBitsDenRPhi() const { return ShiftingBitsDenRPhi_; }
0278 
0279     /// Number of bits to reduce the RZ helix parameter denominator calculation weight
0280     unsigned int ShiftingBitsDenRZ() const { return ShiftingBitsDenRZ_; }
0281     /// Number of bits to reduce the qOverPt parameter numerator calculation weight
0282     unsigned int ShiftingBitsPt() const { return ShiftingBitsPt_; }
0283     /// Number of bits to reduce the PhiT parameter numerator calculation weight
0284     unsigned int ShiftingBitsPhi() const { return ShiftingBitsPhi_; }
0285     /// Number of bits to reduce the tanLambda parameter calculation weight
0286     unsigned int ShiftingBitsLambda() const { return ShiftingBitsLambda_; }
0287     /// Number of bits to reduce the tanLambda parameter calculation weight
0288     unsigned int ShiftingBitsZ0() const { return ShiftingBitsZ0_; }
0289     /// ChiSquare Cut
0290     double slr_chi2cut() const { return slr_chi2cut_; }
0291     /// Cut on RPhi Residual (radians)
0292     double ResidualCut() const { return residualCut_; }
0293 
0294     //--- Options for Kalman filter track fitters ---
0295 
0296     // Larger number has more debugging printout.
0297     unsigned kalmanDebugLevel() const { return kalmanDebugLevel_; }
0298     // Fit will reject fitted tracks unless it can assign at least this number of stubs to them.
0299     unsigned int kalmanMinNumStubs() const { return kalmanMinNumStubs_; }
0300     // Fit will attempt to add up to this nummber of stubs to each fitted tracks, but won't bother adding more.
0301     unsigned int kalmanMaxNumStubs() const { return kalmanMaxNumStubs_; }
0302     // For 5-param helix fits, calculate also beam-constrained helix params after fit is complete, & use them for duplicate removal if DupTrkAlgFit=1.
0303     bool kalmanAddBeamConstr() const { return kalmanAddBeamConstr_; }
0304     // Remove requirement of at least 2 PS layers per track.
0305     bool kalmanRemove2PScut() const { return kalmanRemove2PScut_; }
0306     // Allow the KF to skip this many layers in total per track for "hard" or "easy" input tracks
0307     unsigned int kalmanMaxSkipLayersHard() const { return kalmanMaxSkipLayersHard_; }
0308     unsigned int kalmanMaxSkipLayersEasy() const { return kalmanMaxSkipLayersEasy_; }
0309     // Max #stubs an input track can have to be defined "easy".
0310     unsigned int kalmanMaxStubsEasy() const { return kalmanMaxStubsEasy_; }
0311     // Enable "maybe layer"
0312     bool kfUseMaybeLayers() const { return kfUseMaybeLayers_; }
0313     // Cuts applied to KF states as a function of the last KF tracker layer they had a stub in.
0314     // (If "4" or "5" in name, cut only applies to 4 or 5 param helix fit).
0315     const std::vector<double>& kfLayerVsPtToler() const { return kfLayerVsPtToler_; }
0316     const std::vector<double>& kfLayerVsD0Cut5() const { return kfLayerVsD0Cut5_; }
0317     const std::vector<double>& kfLayerVsZ0Cut5() const { return kfLayerVsZ0Cut5_; }
0318     const std::vector<double>& kfLayerVsZ0Cut4() const { return kfLayerVsZ0Cut4_; }
0319     const std::vector<double>& kfLayerVsChiSq5() const { return kfLayerVsChiSq5_; }
0320     const std::vector<double>& kfLayerVsChiSq4() const { return kfLayerVsChiSq4_; }
0321     // KF will consider only this no. of stubs per layer.
0322     unsigned int kalmanMaxStubsPerLayer() const { return kalmanMaxStubsPerLayer_; }
0323     // Multiple scattering term - inflate hit phi errors by this divided by Pt
0324     double kalmanMultiScattTerm() const { return kalmanMultiScattTerm_; }
0325     // Scale down chi2 in r-phi plane by this factor to improve electron performance.
0326     unsigned int kalmanChi2RphiScale() const { return kalmanChi2RphiScale_; }
0327     //--- Enable Higher order corrections
0328     // Treat z uncertainty in tilted barrel modules correctly.
0329     bool kalmanHOtilted() const { return kalmanHOtilted_; }
0330     // Higher order circle explansion terms for low Pt.
0331     bool kalmanHOhelixExp() const { return kalmanHOhelixExp_; }
0332     // Alpha correction for non-radial 2S endcap strips. (0=disable correction, 1=correct with offset, 2=correct with non-diagonal stub covariance matrix).
0333     unsigned int kalmanHOalpha() const { return kalmanHOalpha_; }
0334     // Projection from (r,phi) to (z,phi) for endcap 2S modules. (0=disable correction, 1=correct with offset, 2=correct with non-diagonal stub covariance matrix).
0335     unsigned int kalmanHOprojZcorr() const { return kalmanHOprojZcorr_; }
0336     // Use approx calc to account for non-radial endcap 2S modules corresponding to current FW, with  no special treatment for tilted modules.
0337     bool kalmanHOfw() const { return kalmanHOfw_; }
0338 
0339     //=== Treatment of dead modules.
0340     //
0341     // Emulate dead/inefficient modules using the StubKiller code, with stubs killed according to the scenarios of the Stress Test group.
0342     // (0=Don't kill any stubs; 1-5 = Scenarios described in StubKiller.cc).
0343     unsigned int killScenario() const { return killScenario_; }
0344     // Modify TMTT tracking to try to recover tracking efficiency in presence of dead modules. (Does nothing if KillScenario = 0).
0345     bool killRecover() const { return killRecover_; }
0346 
0347     //=== Track fit digitisation configuration for various track fitters
0348 
0349     // These are used only for SimpleLR4 track fitter.
0350     bool slr_skipTrackDigi() const { return slr_skipTrackDigi_; }
0351     unsigned int slr_oneOver2rBits() const { return slr_oneOver2rBits_; }
0352     double slr_oneOver2rRange() const { return slr_oneOver2rRange_; }
0353     unsigned int slr_d0Bits() const { return slr_d0Bits_; }
0354     double slr_d0Range() const { return slr_d0Range_; }
0355     unsigned int slr_phi0Bits() const { return slr_phi0Bits_; }
0356     double slr_phi0Range() const { return slr_phi0Range_; }
0357     unsigned int slr_z0Bits() const { return slr_z0Bits_; }
0358     double slr_z0Range() const { return slr_z0Range_; }
0359     unsigned int slr_tanlambdaBits() const { return slr_tanlambdaBits_; }
0360     double slr_tanlambdaRange() const { return slr_tanlambdaRange_; }
0361     unsigned int slr_chisquaredBits() const { return slr_chisquaredBits_; }
0362     double slr_chisquaredRange() const { return slr_chisquaredRange_; }
0363     // These are used for KF track fitter and for all other track fitters (though are probably not right for other track fitters ...)
0364     bool kf_skipTrackDigi() const { return kf_skipTrackDigi_; }
0365     unsigned int kf_oneOver2rBits() const { return kf_oneOver2rBits_; }
0366     double kf_oneOver2rRange() const { return kf_oneOver2rRange_; }
0367     unsigned int kf_d0Bits() const { return kf_d0Bits_; }
0368     double kf_d0Range() const { return kf_d0Range_; }
0369     unsigned int kf_phi0Bits() const { return kf_phi0Bits_; }
0370     double kf_phi0Range() const { return kf_phi0Range_; }
0371     unsigned int kf_z0Bits() const { return kf_z0Bits_; }
0372     double kf_z0Range() const { return kf_z0Range_; }
0373     unsigned int kf_tanlambdaBits() const { return kf_tanlambdaBits_; }
0374     double kf_tanlambdaRange() const { return kf_tanlambdaRange_; }
0375     unsigned int kf_chisquaredBits() const { return kf_chisquaredBits_; }
0376     double kf_chisquaredRange() const { return kf_chisquaredRange_; }
0377     const std::vector<double>& kf_chisquaredBinEdges() const { return kf_chisquaredBinEdges_; }
0378     // Skip track digitisation when fitted is not SimpleLR4 or KF?
0379     bool other_skipTrackDigi() const { return other_skipTrackDigi_; }
0380 
0381     //=== Debug printout & plots
0382 
0383     // When making helix parameter resolution plots, only use particles from the physics event (True)
0384     // or also use particles from pileup (False) ?
0385     bool resPlotOpt() const { return resPlotOpt_; }
0386 
0387     // Booleain indicating if an output EDM file will be written.
0388     // N.B. This parameter does not appear inside TMTrackProducer_Defaults_cfi.py . It is created inside tmtt_tf_analysis_cfg.py .
0389     bool writeOutEdmFile() const { return writeOutEdmFile_; }
0390 
0391     //=== Hard-wired constants
0392 
0393     double cSpeed() const { return 1.0e8 * CLHEP::c_light; }  // Speed of light, with (mm/ns) to (cm/s)
0394     // B*c/1E11 - converts q/Pt to 1/radius_of_curvature
0395     double invPtToInvR() const { return (this->magneticField()) * (this->cSpeed()) / 1.0E13; }
0396     // B*c/2E11 - converts q/Pt to track angle at some radius from beamline.
0397     double invPtToDphi() const { return (this->magneticField()) * (this->cSpeed()) / 2.0E13; }
0398     //=== Set and get B-field value (mutable) in Tesla.
0399     // N.B. This must bet std::set for each run, and can't be initialized at the beginning of the job.
0400     void setMagneticField(float magneticField) const { magneticField_ = magneticField; }
0401     float magneticField() const {
0402       if (magneticField_ == 0.)
0403         throw cms::Exception("LogicError") << "Settings: You attempted to access the B field before it was initialized";
0404       return magneticField_;
0405     }
0406 
0407     //=== Settings used for HYBRID TRACKING code only.
0408     // Is hybrid tracking in use?
0409     bool hybrid() const { return hybrid_; }
0410 
0411   private:
0412     // Input tags for ES & ED data.
0413     const edm::ESInputTag magneticFieldInputTag_;
0414     const edm::ESInputTag trackerGeometryInputTag_;
0415     const edm::ESInputTag trackerTopologyInputTag_;
0416     const edm::ESInputTag ttStubAlgoInputTag_;
0417 
0418     const edm::InputTag stubInputTag_;
0419     const edm::InputTag tpInputTag_;
0420     const edm::InputTag stubTruthInputTag_;
0421     const edm::InputTag clusterTruthInputTag_;
0422     const edm::InputTag genJetInputTag_;
0423 
0424     // Parameter std::sets for differents types of configuration parameter.
0425     edm::ParameterSet genCuts_;
0426     edm::ParameterSet stubCuts_;
0427     edm::ParameterSet stubDigitize_;
0428     edm::ParameterSet trackerModuleType_;
0429     edm::ParameterSet geometricProc_;
0430     edm::ParameterSet phiSectors_;
0431     edm::ParameterSet etaSectors_;
0432     edm::ParameterSet htArraySpecRphi_;
0433     edm::ParameterSet htFillingRphi_;
0434     edm::ParameterSet rzFilterOpts_;
0435     edm::ParameterSet l1TrackDef_;
0436     edm::ParameterSet dupTrkRemoval_;
0437     edm::ParameterSet trackMatchDef_;
0438     edm::ParameterSet trackFitSettings_;
0439     edm::ParameterSet deadModuleOpts_;
0440     edm::ParameterSet trackDigi_;
0441 
0442     // General settings
0443     bool enableMCtruth_;
0444     bool enableHistos_;
0445     bool enableOutputIntermediateTTTracks_;
0446 
0447     // Cuts on truth tracking particles.
0448     double genMinPt_;
0449     double genMaxAbsEta_;
0450     double genMaxVertR_;
0451     double genMaxVertZ_;
0452     double genMaxD0_;
0453     double genMaxZ0_;
0454     std::vector<int> genPdgIds_;
0455     unsigned int genMinStubLayers_;
0456 
0457     // Cuts applied to stubs before arriving in L1 track finding board.
0458     unsigned int degradeBendRes_;
0459     double maxStubEta_;
0460     bool killLowPtStubs_;
0461     bool printStubWindows_;
0462     double bendCut_;
0463     double bendCutExtra_;
0464     bool orderStubsByBend_;
0465 
0466     // Optional stub digitization.
0467     bool enableDigitize_;
0468     unsigned int phiSectorBits_;
0469     unsigned int phiSBits_;
0470     double phiSRange_;
0471     unsigned int rtBits_;
0472     double rtRange_;
0473     unsigned int zBits_;
0474     double zRange_;
0475     unsigned int phiNBits_;
0476     double phiNRange_;
0477     unsigned int bendBits_;
0478 
0479     // Tracker module type for FW.
0480     std::vector<double> pitchVsType_;
0481     std::vector<double> spaceVsType_;
0482     std::vector<bool> barrelVsType_;
0483     std::vector<bool> psVsType_;
0484     std::vector<bool> tiltedVsType_;
0485     std::vector<unsigned int> barrelVsTypeTmp_;
0486     std::vector<unsigned int> psVsTypeTmp_;
0487     std::vector<unsigned int> tiltedVsTypeTmp_;
0488 
0489     // Configuration of Geometric Processor.
0490     bool useApproxB_;
0491     double bApprox_gradient_;
0492     double bApprox_intercept_;
0493 
0494     // Definition of phi sectors.
0495     unsigned int numPhiNonants_;
0496     unsigned int numPhiSectors_;
0497     double chosenRofPhi_;
0498     bool useStubPhi_;
0499     bool useStubPhiTrk_;
0500     double assumedPhiTrkRes_;
0501     bool calcPhiTrkRes_;
0502 
0503     // Definition of eta sectors.
0504     std::vector<double> etaRegions_;
0505     double chosenRofZ_;
0506     double beamWindowZ_;
0507     bool allowOver2EtaSecs_;
0508 
0509     // r-phi Hough transform array specifications.
0510     double houghMinPt_;
0511     unsigned int houghNbinsPt_;
0512     unsigned int houghNbinsPhi_;
0513     bool enableMerge2x2_;
0514     double maxPtToMerge2x2_;
0515     unsigned int numSubSecsEta_;
0516     unsigned int shape_;
0517     bool miniHTstage_;
0518     unsigned int miniHoughNbinsPt_;
0519     unsigned int miniHoughNbinsPhi_;
0520     double miniHoughMinPt_;
0521     bool miniHoughDontKill_;
0522     double miniHoughDontKillMinPt_;
0523     unsigned int miniHoughLoadBalance_;
0524 
0525     // Rules governing how stubs are filled into the r-phi Hough Transform array.
0526     unsigned int killSomeHTCellsRphi_;
0527     bool useBendFilter_;
0528     unsigned int maxStubsInCell_;
0529     unsigned int maxStubsInCellMiniHough_;
0530     bool busySectorKill_;
0531     unsigned int busySectorNumStubs_;
0532     std::vector<unsigned int> busySectorMbinRanges_;
0533     std::vector<unsigned int> busySectorMbinOrder_;
0534     bool busyInputSectorKill_;
0535     unsigned int busyInputSectorNumStubs_;
0536     unsigned int muxOutputsHT_;
0537     std::vector<unsigned int> etaRegWhitelist_;
0538 
0539     // Options controlling r-z track filters (or any other track filters run after the Hough transform, as opposed to inside it).
0540     std::string rzFilterName_;
0541     double seedResCut_;
0542     bool keepAllSeed_;
0543     unsigned int maxSeedCombinations_;
0544     unsigned int maxGoodSeedCombinations_;
0545     unsigned int maxSeedsPerStub_;
0546     bool zTrkSectorCheck_;
0547     unsigned int minFilterLayers_;
0548 
0549     // Rules for deciding when the track-finding has found an L1 track candidate
0550     unsigned int minStubLayers_;
0551     double minPtToReduceLayers_;
0552     std::vector<unsigned int> etaSecsReduceLayers_;
0553     bool reduceLayerID_;
0554 
0555     // Specification of algorithm to eliminate duplicate tracks
0556     unsigned int dupTrkAlgFit_;
0557 
0558     // Rules for deciding when a reconstructed L1 track matches a MC truth particle (i.e. tracking particle).
0559     double minFracMatchStubsOnReco_;
0560     double minFracMatchStubsOnTP_;
0561     unsigned int minNumMatchLayers_;
0562     unsigned int minNumMatchPSLayers_;
0563     bool stubMatchStrict_;
0564 
0565     // Track Fitting Settings
0566     std::vector<std::string> trackFitters_;
0567     std::vector<std::string> useRZfilter_;
0568     double chi2OverNdfCut_;
0569     bool detailedFitOutput_;
0570     bool trackFitCheat_;
0571     //
0572     unsigned int numTrackFitIterations_;
0573     bool killTrackFitWorstHit_;
0574     double generalResidualCut_;
0575     double killingResidualCut_;
0576     //
0577     bool digitizeSLR_;
0578     unsigned int dividerBitsHelix_;
0579     unsigned int dividerBitsHelixZ_;
0580     unsigned int ShiftingBitsDenRPhi_;
0581     unsigned int ShiftingBitsDenRZ_;
0582     unsigned int ShiftingBitsPt_;
0583     unsigned int ShiftingBitsPhi_;
0584 
0585     unsigned int ShiftingBitsLambda_;
0586     unsigned int ShiftingBitsZ0_;
0587     double slr_chi2cut_;
0588     double residualCut_;
0589     //
0590     unsigned kalmanDebugLevel_;
0591     unsigned int kalmanMinNumStubs_;
0592     unsigned int kalmanMaxNumStubs_;
0593     bool kalmanAddBeamConstr_;
0594     bool kalmanRemove2PScut_;
0595     unsigned int kalmanMaxSkipLayersHard_;
0596     unsigned int kalmanMaxSkipLayersEasy_;
0597     unsigned int kalmanMaxStubsEasy_;
0598     bool kfUseMaybeLayers_;
0599 
0600     std::vector<double> kfLayerVsPtToler_;
0601     std::vector<double> kfLayerVsD0Cut5_;
0602     std::vector<double> kfLayerVsZ0Cut5_;
0603     std::vector<double> kfLayerVsZ0Cut4_;
0604     std::vector<double> kfLayerVsChiSq5_;
0605     std::vector<double> kfLayerVsChiSq4_;
0606 
0607     unsigned int kalmanMaxStubsPerLayer_;
0608     double kalmanMultiScattTerm_;
0609     unsigned int kalmanChi2RphiScale_;
0610     bool kalmanHOtilted_;
0611     bool kalmanHOhelixExp_;
0612     unsigned int kalmanHOalpha_;
0613     unsigned int kalmanHOprojZcorr_;
0614     bool kalmanHOfw_;
0615 
0616     // Treatment of dead modules.
0617     unsigned int killScenario_;
0618     bool killRecover_;
0619 
0620     // Track digitisation configuration for various track fitters
0621     bool slr_skipTrackDigi_;
0622     unsigned int slr_oneOver2rBits_;
0623     double slr_oneOver2rRange_;
0624     double slr_oneOver2rMult_;
0625     unsigned int slr_d0Bits_;
0626     double slr_d0Range_;
0627     unsigned int slr_phi0Bits_;
0628     double slr_phi0Range_;
0629     unsigned int slr_z0Bits_;
0630     double slr_z0Range_;
0631     unsigned int slr_tanlambdaBits_;
0632     double slr_tanlambdaRange_;
0633     unsigned int slr_chisquaredBits_;
0634     double slr_chisquaredRange_;
0635     //
0636     bool kf_skipTrackDigi_;
0637     unsigned int kf_oneOver2rBits_;
0638     double kf_oneOver2rRange_;
0639     double kf_oneOver2rMult_;
0640     unsigned int kf_d0Bits_;
0641     double kf_d0Range_;
0642     unsigned int kf_phi0Bits_;
0643     double kf_phi0Range_;
0644     unsigned int kf_z0Bits_;
0645     double kf_z0Range_;
0646     unsigned int kf_tanlambdaBits_;
0647     double kf_tanlambdaRange_;
0648     unsigned int kf_chisquaredBits_;
0649     double kf_chisquaredRange_;
0650     std::vector<double> kf_chisquaredBinEdges_;
0651     //
0652     bool other_skipTrackDigi_;
0653 
0654     // Debug printout
0655     bool resPlotOpt_;
0656 
0657     // Boolean indicating an an EDM output file will be written.
0658     bool writeOutEdmFile_;
0659 
0660     // B-field in Tesla
0661     mutable std::atomic<float> magneticField_;
0662 
0663     // Hybrid tracking
0664     bool hybrid_;
0665   };
0666 
0667 }  // namespace tmtt
0668 
0669 #endif