Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:33:28

0001 #ifndef L1Trigger_TrackFindingTracklet_interface_Settings_h
0002 #define L1Trigger_TrackFindingTracklet_interface_Settings_h
0003 
0004 #include <iostream>
0005 #include <string>
0006 #include <array>
0007 #include <set>
0008 #include <cassert>
0009 #include <cmath>
0010 #include <unordered_map>
0011 #include <map>
0012 #include <vector>
0013 
0014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0015 #include "FWCore/Utilities/interface/Exception.h"
0016 
0017 namespace trklet {
0018 
0019   constexpr unsigned int N_SECTOR = 9;  // # of phi sectors for L1TK processing
0020 
0021   constexpr int N_LAYER = 6;                 // # of barrel layers assumed
0022   constexpr int N_DISK = 5;                  // # of endcap disks assumed
0023   constexpr unsigned int N_PSLAYER = 3;      // # of barrel PS layers assumed
0024   constexpr unsigned int N_SEED = 12;        // # of tracklet+triplet seeds
0025   constexpr unsigned int N_SEED_PROMPT = 8;  // # of tracklet (prompt) seeds
0026 
0027   constexpr unsigned int N_DSS_MOD = 5;  // # of rings with 2S modules per disk
0028 
0029   constexpr unsigned int N_BENDBITS_PS = 3;  // Number of bend bits for PS modules
0030   constexpr unsigned int N_BENDBITS_2S = 4;  // Number of bend bits for 2S modules
0031 
0032   constexpr unsigned int NRINVBITS = 5;     //number of bit for rinv in bend match table
0033   constexpr unsigned int NFINERZBITS = 3;   //number of bit for r or z within a r/z bin
0034   constexpr unsigned int NFINEPHIBITS = 3;  //number of bits for phi within a vm bin
0035   constexpr unsigned int N_RZBITS = 3;      //number of bit for the r/z bins
0036   constexpr unsigned int N_PHIBITS = 3;     //number of bit for the phi bins
0037 
0038   constexpr unsigned int N_VMSTUBSMAX = 15;     // maximum number of stubs in VM bin
0039   constexpr unsigned int N_BITSMEMADDRESS = 7;  // Number of bits for address in memories
0040 
0041   constexpr double sixth = 1.0 / 6.0;  //Commonly used factor
0042   constexpr double third = 1.0 / 3.0;  //Commonly used factor
0043 
0044   constexpr double VMROUTERCUTZL2 = 50.0;      //Min L2 z for inner allstub
0045   constexpr double VMROUTERCUTZL1L3L5 = 95.0;  //Max z for inner barrel layers
0046   constexpr double VMROUTERCUTZL1 = 70.0;      //Max z for L1 barrel seeding
0047   constexpr double VMROUTERCUTRD1D3 = 55.0;    //Max r for disk seeds
0048 
0049   enum Seed { L1L2 = 0, L2L3, L3L4, L5L6, D1D2, D3D4, L1D1, L2D1, L2L3L4, L4L5L6, L2L3D1, D1D2L2 };
0050   enum LayerDisk { L1 = 0, L2, L3, L4, L5, L6, D1, D2, D3, D4, D5 };
0051 
0052   class Settings {
0053   public:
0054     Settings() {
0055       //Comment out to run tracklet-only algorithm
0056 #ifdef CMSSW_GIT_HASH
0057 #ifndef USEHYBRID
0058 #pragma message "USEHYBRID is undefined, so Hybrid L1 tracking disabled."
0059 #endif
0060 #endif
0061     }
0062 
0063     ~Settings() = default;
0064 
0065     // processing & memory modules, wiring, etc.
0066     std::string const& fitPatternFile() const { return fitPatternFile_; }
0067     std::string const& processingModulesFile() const { return processingModulesFile_; }
0068     std::string const& memoryModulesFile() const { return memoryModulesFile_; }
0069     std::string const& wiresFile() const { return wiresFile_; }
0070     std::string const& tableTEDFile() const { return tableTEDFile_; }
0071     std::string const& tableTREFile() const { return tableTREFile_; }
0072 
0073     void setFitPatternFile(std::string fitPatternFileName) { fitPatternFile_ = fitPatternFileName; }
0074     void setProcessingModulesFile(std::string processingModulesFileName) {
0075       processingModulesFile_ = processingModulesFileName;
0076     }
0077     void setMemoryModulesFile(std::string memoryModulesFileName) { memoryModulesFile_ = memoryModulesFileName; }
0078     void setWiresFile(std::string wiresFileName) { wiresFile_ = wiresFileName; }
0079     void setTableTEDFile(std::string tableTEDFileName) { tableTEDFile_ = tableTEDFileName; }
0080     void setTableTREFile(std::string tableTREFileName) { tableTREFile_ = tableTREFileName; }
0081 
0082     unsigned int nzbitsstub(unsigned int layerdisk) const { return nzbitsstub_[layerdisk]; }
0083     unsigned int nphibitsstub(unsigned int layerdisk) const { return nphibitsstub_[layerdisk]; }
0084     unsigned int nrbitsstub(unsigned int layerdisk) const { return nrbitsstub_[layerdisk]; }
0085 
0086     unsigned int nrbitsprojderdisk() const { return nrbitsprojderdisk_; }
0087     unsigned int nbitsphiprojderL123() const { return nbitsphiprojderL123_; }
0088     unsigned int nbitsphiprojderL456() const { return nbitsphiprojderL456_; }
0089     unsigned int nbitszprojderL123() const { return nbitszprojderL123_; }
0090     unsigned int nbitszprojderL456() const { return nbitszprojderL456_; }
0091 
0092     unsigned int nbendbitsmedisk() const { return nbendbitsmedisk_; }
0093 
0094     bool useSeed(unsigned int iSeed) const { return useseeding_.find(iSeed) != useseeding_.end(); }
0095     unsigned int nbitsvmte(unsigned int inner, unsigned int iSeed) const {
0096       if (combined_) {
0097         return nbitsvmtecm_[inner][iSeed];
0098       }
0099       return nbitsvmte_[inner][iSeed];
0100     }
0101     unsigned int nvmte(unsigned int inner, unsigned int iSeed) const { return (1 << nbitsvmte(inner, iSeed)); }
0102 
0103     unsigned int nbitsvmme(unsigned int layerdisk) const { return nbitsvmme_[layerdisk]; }
0104     unsigned int nvmme(unsigned int layerdisk) const { return (1 << nbitsvmme_[layerdisk]); }
0105 
0106     unsigned int nbitsallstubs(unsigned int layerdisk) const { return nbitsallstubs_[layerdisk]; }
0107     unsigned int nallstubs(unsigned int layerdisk) const { return (1 << nbitsallstubs_[layerdisk]); }
0108 
0109     bool writeMonitorData(std::string module) const {
0110       if (writeMonitorData_.find(module) == writeMonitorData_.end()) {
0111         throw cms::Exception("BadConfig") << "Settings::writeMonitorData module = " << module << " not known";
0112       }
0113       return writeMonitorData_.at(module);
0114     }
0115 
0116     unsigned int maxStep(std::string module) const {
0117       if (maxstep_.find(module) == maxstep_.end()) {
0118         throw cms::Exception("BadConfig")
0119             << __FILE__ << " " << __LINE__ << " maxStep module = " << module << " not known";
0120       }
0121       return maxstep_.at(module) + maxstepoffset_;
0122     }
0123 
0124     double zlength() const { return zlength_; }
0125     double rmaxdisk() const { return rmaxdisk_; }
0126     double rmindisk() const { return rmindisk_; }
0127 
0128     double drmax() const { return rmaxdisk_ / deltarzfract_; }
0129     double dzmax() const { return zlength_ / deltarzfract_; }
0130 
0131     double half2SmoduleWidth() const { return half2SmoduleWidth_; }
0132 
0133     int nfinephi(unsigned int inner, unsigned int iSeed) const { return nfinephi_[inner][iSeed]; }
0134     double nphireg(unsigned int inner, unsigned int iSeed) const {
0135       if (combined_) {
0136         return nphiregcm_[inner][iSeed];
0137       }
0138       return nphireg_[inner][iSeed];
0139     }
0140     double lutwidthtab(unsigned int inner, unsigned int iSeed) const { return lutwidthtab_[inner][iSeed]; }
0141     double lutwidthtabextended(unsigned int inner, unsigned int iSeed) const {
0142       return lutwidthtabextended_[inner][iSeed];
0143     }
0144 
0145     unsigned int seedlayers(int inner, int seed) const {
0146       int layerdisk = seedlayers_[seed][inner];
0147       assert(layerdisk >= 0);
0148       return layerdisk;
0149     }
0150 
0151     unsigned int teunits(unsigned int iSeed) const { return teunits_[iSeed]; }
0152 
0153     unsigned int NTC(int seed) const { return ntc_[seed]; }
0154 
0155     unsigned int projlayers(unsigned int iSeed, unsigned int i) const { return projlayers_[iSeed][i]; }
0156     unsigned int projdisks(unsigned int iSeed, unsigned int i) const { return projdisks_[iSeed][i]; }
0157     double rphimatchcut(unsigned int iSeed, unsigned int ilayer) const { return rphimatchcut_[ilayer][iSeed]; }
0158     double zmatchcut(unsigned int iSeed, unsigned int ilayer) const { return zmatchcut_[ilayer][iSeed]; }
0159     double rphicutPS(unsigned int iSeed, unsigned int idisk) const { return rphicutPS_[idisk][iSeed]; }
0160     double rcutPS(unsigned int iSeed, unsigned int idisk) const { return rcutPS_[idisk][iSeed]; }
0161     double rphicut2S(unsigned int iSeed, unsigned int idisk) const { return rphicut2S_[idisk][iSeed]; }
0162     double rcut2S(unsigned int iSeed, unsigned int idisk) const { return rcut2S_[idisk][iSeed]; }
0163 
0164     double rmean(unsigned int iLayer) const { return irmean_[iLayer] * rmaxdisk_ / 4096; }
0165     double rmax(unsigned int iLayer) const { return rmean(iLayer) + drmax(); }
0166     double rmin(unsigned int iLayer) const { return rmean(iLayer) - drmax(); }
0167     double zmean(unsigned int iDisk) const { return izmean_[iDisk] * zlength_ / 2048; }
0168     double zmax(unsigned int iDisk) const { return zmean(iDisk) + dzmax(); }
0169     double zmin(unsigned int iDisk) const { return zmean(iDisk) - dzmax(); }
0170 
0171     double rDSSinner(unsigned int iBin) const {
0172       return rDSSinner_mod_[iBin / 2] + halfstrip_ * ((iBin % 2 == 0) ? -1 : 1);
0173     }
0174     double rDSSouter(unsigned int iBin) const {
0175       return rDSSouter_mod_[iBin / 2] + halfstrip_ * ((iBin % 2 == 0) ? -1 : 1);
0176     }
0177 
0178     unsigned int vmrlutzbits(unsigned int layerdisk) const { return vmrlutzbits_[layerdisk]; }
0179     unsigned int vmrlutrbits(unsigned int layerdisk) const { return vmrlutrbits_[layerdisk]; }
0180 
0181     bool printDebugKF() const { return printDebugKF_; }
0182     bool debugTracklet() const { return debugTracklet_; }
0183     bool writetrace() const { return writetrace_; }
0184 
0185     bool warnNoMem() const { return warnNoMem_; }
0186     bool warnNoDer() const { return warnNoDer_; }
0187 
0188     bool writeMem() const { return writeMem_; }
0189     bool writeTable() const { return writeTable_; }
0190     bool writeConfig() const { return writeConfig_; }
0191 
0192     std::string memPath() const { return memPath_; }
0193     std::string tablePath() const { return tablePath_; }
0194 
0195     bool writeVerilog() const { return writeVerilog_; }
0196     bool writeHLS() const { return writeHLS_; }
0197     bool writeInvTable() const { return writeInvTable_; }
0198     bool writeHLSInvTable() const { return writeHLSInvTable_; }
0199 
0200     unsigned int writememsect() const { return writememsect_; }
0201 
0202     bool enableTripletTables() const { return enableTripletTables_; }
0203     bool writeTripletTables() const { return writeTripletTables_; }
0204 
0205     bool writeoutReal() const { return writeoutReal_; }
0206 
0207     bool bookHistos() const { return bookHistos_; }
0208 
0209     double ptcut() const { return ptcut_; }
0210     double rinvcut() const { return 0.01 * c_ * bfield_ / ptcut_; }  //0.01 to convert to cm-1
0211 
0212     double c() const { return c_; }
0213 
0214     double rinvmax() const { return 0.01 * c_ * bfield_ / ptmin_; }
0215 
0216     int alphashift() const { return alphashift_; }
0217     int nbitsalpha() const { return nbitsalpha_; }
0218     int alphaBitsTable() const { return alphaBitsTable_; }
0219     int nrinvBitsTable() const { return nrinvBitsTable_; }
0220 
0221     unsigned int MEBinsBits() const { return MEBinsBits_; }
0222     unsigned int MEBins() const { return 1u << MEBinsBits_; }
0223     unsigned int MEBinsDisks() const { return MEBinsDisks_; }
0224     unsigned int maxStubsPerBin() const { return maxStubsPerBin_; }
0225 
0226     std::string geomext() const {
0227       if (combined_)
0228         return "hourglassCombined";
0229       return extended_ ? "hourglassExtended" : "hourglass";
0230     }
0231 
0232     bool exactderivatives() const { return exactderivatives_; }
0233     bool exactderivativesforfloating() const { return exactderivativesforfloating_; }
0234     bool useapprox() const { return useapprox_; }
0235     bool usephicritapprox() const { return usephicritapprox_; }
0236 
0237     unsigned int minIndStubs() const { return minIndStubs_; }
0238     std::string removalType() const { return removalType_; }
0239     std::string mergeComparison() const { return mergeComparison_; }
0240     bool doKF() const { return doKF_; }
0241     bool doMultipleMatches() const { return doMultipleMatches_; }
0242     bool fakefit() const { return fakefit_; }
0243 
0244     // configurable
0245     unsigned int nHelixPar() const { return nHelixPar_; }
0246     void setNHelixPar(unsigned int nHelixPar) { nHelixPar_ = nHelixPar; }
0247 
0248     bool extended() const { return extended_; }
0249     void setExtended(bool extended) { extended_ = extended; }
0250     bool combined() const { return combined_; }
0251     void setCombined(bool combined) { combined_ = combined; }
0252 
0253     double bfield() const { return bfield_; }
0254     void setBfield(double bfield) { bfield_ = bfield; }
0255 
0256     unsigned int nStrips(bool isPSmodule) const { return isPSmodule ? nStrips_PS_ : nStrips_2S_; }
0257     void setNStrips_PS(unsigned int nStrips_PS) { nStrips_PS_ = nStrips_PS; }
0258     void setNStrips_2S(unsigned int nStrips_2S) { nStrips_2S_ = nStrips_2S; }
0259 
0260     double stripPitch(bool isPSmodule) const { return isPSmodule ? stripPitch_PS_ : stripPitch_2S_; }
0261     void setStripPitch_PS(double stripPitch_PS) { stripPitch_PS_ = stripPitch_PS; }
0262     void setStripPitch_2S(double stripPitch_2S) { stripPitch_2S_ = stripPitch_2S; }
0263 
0264     double stripLength(bool isPSmodule) const { return isPSmodule ? stripLength_PS_ : stripLength_2S_; }
0265     void setStripLength_PS(double stripLength_PS) { stripLength_PS_ = stripLength_PS; }
0266     void setStripLength_2S(double stripLength_2S) { stripLength_2S_ = stripLength_2S; }
0267 
0268     std::string skimfile() const { return skimfile_; }
0269     void setSkimfile(std::string skimfile) { skimfile_ = skimfile; }
0270 
0271     unsigned int nbitstrackletindex() const { return nbitstrackletindex_; }
0272     void setNbitstrackletindex(unsigned int nbitstrackletindex) { nbitstrackletindex_ = nbitstrackletindex; }
0273 
0274     unsigned int nbitsitc() const { return nbitsitc_; }
0275     unsigned int nbitsseed() const { return (extended_ ? nbitsseedextended_ : nbitsseed_); }
0276     unsigned int nbitstcindex() const { return nbitsseed() + nbitsitc(); }
0277     void setNbitsitc(unsigned int nbitsitc) { nbitsitc_ = nbitsitc; }
0278     void setNbitsseed(unsigned int nbitsseed) { nbitsseed_ = nbitsseed; }
0279     void setNbitsseedextended(unsigned int nbitsseed) { nbitsseedextended_ = nbitsseed; }
0280 
0281     double dphisectorHG() const {
0282       //These values are used in the DTC emulation code.
0283       double rsectmin = 21.8;
0284       double rsectmax = 112.7;
0285       return 2 * M_PI / N_SECTOR + rinvmax() * std::max(rcrit_ - rsectmin, rsectmax - rcrit_);
0286     }
0287 
0288     double rcrit() const { return rcrit_; }
0289 
0290     double dphisector() const { return 2 * M_PI / N_SECTOR; }
0291 
0292     double phicritmin() const { return 0.5 * dphisectorHG() - M_PI / N_SECTOR; }
0293     double phicritmax() const { return dphisectorHG() - 0.5 * dphisectorHG() + M_PI / N_SECTOR; }
0294 
0295     double phicritminmc() const { return phicritmin() - dphicritmc_; }
0296     double phicritmaxmc() const { return phicritmax() + dphicritmc_; }
0297 
0298     double kphi() const { return dphisectorHG() / (1 << nphibitsstub(0)); }
0299     double kphi1() const { return dphisectorHG() / (1 << nphibitsstub(N_LAYER - 1)); }
0300     double kphi(unsigned int layerdisk) const { return dphisectorHG() / (1 << nphibitsstub(layerdisk)); }
0301 
0302     double kz() const { return 2.0 * zlength_ / (1 << nzbitsstub_[0]); }
0303     double kz(unsigned int layerdisk) const { return 2.0 * zlength_ / (1 << nzbitsstub_[layerdisk]); }
0304     double kr() const { return rmaxdisk_ / (1 << nrbitsstub_[N_LAYER]); }
0305     double krbarrel() const { return 2.0 * drmax() / (1 << nrbitsstub_[0]); }
0306 
0307     double maxrinv() const { return maxrinv_; }
0308     double maxd0() const { return maxd0_; }
0309     unsigned int nbitsd0() const { return nbitsd0_; }
0310 
0311     double kd0() const { return 2 * maxd0_ / (1 << nbitsd0_); }
0312 
0313     double rinvcutte() const { return 0.01 * c_ * bfield_ / ptcutte_; }  //0.01 to convert to cm-1
0314 
0315     double rmindiskvm() const { return rmindiskvm_; }
0316     double rmaxdiskvm() const { return rmaxdiskvm_; }
0317 
0318     double rmaxdiskl1overlapvm() const { return rmaxdiskl1overlapvm_; }
0319     double rmindiskl2overlapvm() const { return rmindiskl2overlapvm_; }
0320     double rmindiskl3overlapvm() const { return rmindiskl3overlapvm_; }
0321 
0322     double rPS2S() const { return rPS2S_; }
0323 
0324     double z0cut() const { return z0cut_; }
0325 
0326     double disp_z0cut() const { return disp_z0cut_; }
0327 
0328     unsigned int NLONGVMBITS() const { return NLONGVMBITS_; }
0329     unsigned int NLONGVMBINS() const { return (1 << NLONGVMBITS_); }
0330 
0331     unsigned int ntrackletmax() const { return ((1 << nbitstrackletindex_) - 1); }
0332 
0333     //Bits used to store track parameter in tracklet
0334     int nbitsrinv() const { return nbitsrinv_; }
0335     int nbitsphi0() const { return nbitsphi0_; }
0336     int nbitst() const { return nbitst_; }
0337     int nbitsz0() const { return nbitsz0_; }
0338 
0339     //track and tracklet parameters
0340     int rinv_shift() const { return rinv_shift_; }
0341     int phi0_shift() const { return phi0_shift_; }
0342     int t_shift() const { return t_shift_; }
0343     int z0_shift() const { return z0_shift_; }
0344 
0345     //projections are coarsened from global to stub precision
0346 
0347     //projection to R parameters
0348     int SS_phiL_shift() const { return SS_phiL_shift_; }
0349     int PS_zL_shift() const { return PS_zL_shift_; }
0350 
0351     int SS_phiderL_shift() const { return SS_phiderL_shift_; }
0352     int PS_zderL_shift() const { return PS_zderL_shift_; }
0353     int SS_zderL_shift() const { return SS_zderL_shift_; }
0354 
0355     //projection to Z parameters
0356     int SS_phiD_shift() const { return SS_phiD_shift_; }
0357     int PS_rD_shift() const { return PS_rD_shift_; }
0358 
0359     int SS_phiderD_shift() const { return SS_phiderD_shift_; }
0360     int PS_rderD_shift() const { return PS_rderD_shift_; }
0361 
0362     //numbers needed for matches & fit, unclear what they are.
0363     int phi0bitshift() const { return phi0bitshift_; }
0364     int phiderbitshift() const { return phiderbitshift_; }
0365     int zderbitshift() const { return zderbitshift_; }
0366 
0367     int phiresidbits() const { return phiresidbits_; }
0368     int zresidbits() const { return zresidbits_; }
0369     int rresidbits() const { return rresidbits_; }
0370 
0371     //Trackfit
0372     int fitrinvbitshift() const { return fitrinvbitshift_; }
0373     int fitphi0bitshift() const { return fitphi0bitshift_; }
0374     int fittbitshift() const { return fittbitshift_; }
0375     int fitz0bitshift() const { return fitz0bitshift_; }
0376 
0377     //r correction bits
0378     int rcorrbits() const { return rcorrbits_; }
0379 
0380     int chisqphifactbits() const { return chisqphifactbits_; }
0381     int chisqzfactbits() const { return chisqzfactbits_; }
0382 
0383     //0.02 here is the maximum range in rinv values that can be represented
0384     double krinvpars() const {
0385       int shift = ceil(-log2(0.02 * rmaxdisk_ / ((1 << nbitsrinv_) * dphisectorHG())));
0386       return dphisectorHG() / rmaxdisk_ / (1 << shift);
0387     }
0388     double kphi0pars() const { return 2 * kphi1(); }
0389     double ktpars() const { return maxt_ / (1 << nbitst_); }
0390     double kz0pars() const { return kz(); }
0391     double kd0pars() const { return kd0(); }
0392 
0393     double kphider() const { return kphi() / kr() / 256; }
0394     double kphiderdisk() const { return kphi() / kr() / 128; }
0395     double kzder() const { return 1.0 / 64; }
0396     double krder() const { return 1.0 / 128; }
0397 
0398     //This is a 'historical accident' and should be fixed so that we don't
0399     //have the factor if 2
0400     double krprojshiftdisk() const { return 2 * kr(); }
0401 
0402     double benddecode(int ibend, int layerdisk, bool isPSmodule) const {
0403       if (layerdisk >= N_LAYER && (!isPSmodule))
0404         layerdisk += (N_LAYER - 1);
0405       double bend = benddecode_[layerdisk][ibend];
0406       assert(bend < 99.0);
0407       return bend;
0408     }
0409 
0410     double bendcut(int ibend, int layerdisk, bool isPSmodule) const {
0411       if (layerdisk >= N_LAYER && (!isPSmodule))
0412         layerdisk += (N_LAYER - 1);
0413       double bendcut = bendcut_[layerdisk][ibend];
0414       if (bendcut <= 0.0)
0415         std::cout << "bendcut : " << layerdisk << " " << ibend << " " << isPSmodule << std::endl;
0416       assert(bendcut > 0.0);
0417       return bendcut;
0418     }
0419 
0420     const std::vector<int>& dtcLayers(const std::string& dtcName) const {
0421       auto iter = dtclayers_.find(dtcName);
0422       assert(iter != dtclayers_.end());
0423       return iter->second;
0424     }
0425 
0426     double bendcutte(int ibend, int layerdisk, bool isPSmodule) const { return bendcut(ibend, layerdisk, isPSmodule); }
0427 
0428     double bendcutme(int ibend, int layerdisk, bool isPSmodule) const {
0429       //FIXME temporary fix until phiprojderdisk bits adjusted. But requires coordinatin with HLS
0430       double fact = (layerdisk < N_LAYER) ? 1.0 : 1.8;
0431       return fact * bendcut(ibend, layerdisk, isPSmodule);
0432     }
0433 
0434   private:
0435     std::string fitPatternFile_;
0436     std::string processingModulesFile_;
0437     std::string memoryModulesFile_;
0438     std::string wiresFile_;
0439     std::string tableTEDFile_;
0440     std::string tableTREFile_;
0441 
0442     double rcrit_{55.0};  // critical radius for the hourglass configuration
0443 
0444     double dphicritmc_{0.005};
0445 
0446     //fraction of full r and z range that stubs can be located within layer/disk
0447     double deltarzfract_{32.0};
0448 
0449     double maxt_{32.0};  //range in t that we must cover
0450 
0451     std::array<unsigned int, N_LAYER> irmean_{{851, 1269, 1784, 2347, 2936, 3697}};
0452     std::array<unsigned int, N_DISK> izmean_{{2239, 2645, 3163, 3782, 4523}};
0453 
0454     std::array<unsigned int, N_LAYER + N_DISK> nzbitsstub_{{12, 12, 12, 8, 8, 8, 7, 7, 7, 7, 7}};
0455     std::array<unsigned int, N_LAYER + N_DISK> nphibitsstub_{{14, 14, 14, 17, 17, 17, 14, 14, 14, 14, 14}};
0456     std::array<unsigned int, N_LAYER + N_DISK> nrbitsstub_{{7, 7, 7, 7, 7, 7, 12, 12, 12, 12, 12}};
0457 
0458     unsigned int nrbitsprojderdisk_{9};
0459     unsigned int nbitsphiprojderL123_{10};
0460     unsigned int nbitsphiprojderL456_{10};
0461     unsigned int nbitszprojderL123_{10};
0462     unsigned int nbitszprojderL456_{9};
0463 
0464     unsigned int nbendbitsmedisk_{4};  // Always 4 bits even for PS disk hits, for HLS compatibility
0465 
0466     std::set<unsigned int> useseeding_{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
0467 
0468     std::array<unsigned int, N_LAYER + N_DISK> nbitsallstubs_{{3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}};
0469     std::array<unsigned int, N_LAYER + N_DISK> nbitsvmme_{{2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2}};
0470     std::array<std::array<unsigned int, N_SEED>, 3> nbitsvmte_{
0471         {{{2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 3, 2}},  // (3 = #stubs/triplet, only row 1+2 used for tracklet)
0472          {{3, 2, 3, 3, 2, 2, 2, 2, 3, 3, 2, 2}},
0473          {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1}}}};
0474 
0475     std::array<std::array<unsigned int, N_SEED>, 3> nbitsvmtecm_{
0476         {{{2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 3, 2}},  // (3 = #stubs/triplet, only row 1+2 used for tracklet)
0477          {{3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2}},
0478          {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1}}}};
0479 
0480     std::map<std::string, std::vector<int> > dtclayers_{{"PS10G_1", {0, 6, 8, 10}},
0481                                                         {"PS10G_2", {0, 7, 9}},
0482                                                         {"PS10G_3", {1, 7}},
0483                                                         {"PS10G_4", {6, 8, 10}},
0484                                                         {"PS_1", {2, 7}},
0485                                                         {"PS_2", {2, 9}},
0486                                                         {"2S_1", {3, 4}},
0487                                                         {"2S_2", {4}},
0488                                                         {"2S_3", {5}},
0489                                                         {"2S_4", {5, 8}},
0490                                                         {"2S_5", {6, 9}},
0491                                                         {"2S_6", {7, 10}}};
0492 
0493     double rmindiskvm_{22.5};
0494     double rmaxdiskvm_{67.0};
0495 
0496     double rmaxdiskl1overlapvm_{45.0};
0497     double rmindiskl2overlapvm_{40.0};
0498     double rmindiskl3overlapvm_{50.0};
0499 
0500     double rPS2S_{60.0};
0501 
0502     double z0cut_{15.0};
0503 
0504     double disp_z0cut_{27.0};
0505 
0506     unsigned int NLONGVMBITS_{3};
0507 
0508     double zlength_{120.0};
0509     double rmaxdisk_{120.0};
0510     double rmindisk_{20.0};
0511 
0512     double half2SmoduleWidth_{4.57};
0513 
0514     double maxrinv_{0.006};
0515     double maxd0_{10.0};
0516 
0517     unsigned int nbitsd0_{13};
0518 
0519     double ptmin_{2.0};  //minumim pt for tracks
0520 
0521     double ptcutte_{1.8};  //Minimum pt in TE
0522 
0523     unsigned int nbitstrackletindex_{7};  //Bits used to store the tracklet index
0524 
0525     unsigned int nbitsitc_{4};           //Bits used to store the iTC, a unique
0526                                          //identifier assigned to each TC within a sector
0527     unsigned int nbitsseed_{3};          //Bits used to store the seed number
0528     unsigned int nbitsseedextended_{4};  //Bits used to store the seed number
0529                                          //in the extended project
0530 
0531     //Bits used to store track parameter in tracklet
0532     int nbitsrinv_{14};
0533     int nbitsphi0_{18};
0534     int nbitst_{14};
0535     int nbitsz0_{10};
0536 
0537     //track and tracklet parameters
0538     int rinv_shift_{-8};  // Krinv = 2^shift * Kphi/Kr
0539     int phi0_shift_{1};   // Kphi0 = 2^shift * Kphi
0540     int t_shift_{-10};    // Kt    = 2^shift * Kz/Kr
0541     int z0_shift_{0};     // Kz0   = 2^shift * kz
0542 
0543     //projections are coarsened from global to stub precision
0544 
0545     //projection to R parameters
0546     int SS_phiL_shift_{0};
0547     int PS_zL_shift_{0};  // z projections have global precision in ITC
0548 
0549     int SS_phiderL_shift_{-5};
0550     int PS_zderL_shift_{-7};  // Kderz = 2^shift * Kz/Kr
0551     int SS_zderL_shift_{-7};
0552 
0553     //projection to Z parameters
0554     int SS_phiD_shift_{3};
0555     int PS_rD_shift_{1};  // a bug?! coarser by a factor of two then stubs??
0556 
0557     int SS_phiderD_shift_{-4};
0558     int PS_rderD_shift_{-6};  //Kderrdisk = 2^shift * Kr/Kz
0559 
0560     //numbers needed for matches & fit, unclear what they are.
0561     int phi0bitshift_{1};
0562     int phiderbitshift_{7};
0563     int zderbitshift_{6};
0564 
0565     int phiresidbits_{12};
0566     int zresidbits_{9};
0567     int rresidbits_{7};
0568 
0569     //Trackfit
0570     int fitrinvbitshift_{9};  //6 OK?
0571     int fitphi0bitshift_{6};  //4 OK?
0572     int fittbitshift_{10};    //4 OK? //lower number gives rounding problems
0573     int fitz0bitshift_{8};    //6 OK?
0574 
0575     //r correction bits
0576     int rcorrbits_{6};
0577 
0578     int chisqphifactbits_{14};
0579     int chisqzfactbits_{14};
0580 
0581     std::array<unsigned int, N_SEED> teunits_{{5, 2, 5, 3, 3, 2, 3, 2, 0, 0, 0, 0}};  //teunits used by seed
0582 
0583     std::array<unsigned int, N_LAYER + N_DISK> vmrlutzbits_{
0584         {7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3}};  // zbits used by LUT in VMR
0585     std::array<unsigned int, N_LAYER + N_DISK> vmrlutrbits_{
0586         {4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8}};  // rbits used by LUT in VMR
0587 
0588     std::array<std::array<unsigned int, N_SEED>, 3> nfinephi_{
0589         {{{2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}},    //inner  (3 = #stubs/triplet, only row 1+2 used for tracklet)
0590          {{3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}},    //outer
0591          {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}}}};  //outermost (triplets only)
0592 
0593     //These are the number of bits used for the VM regions in the TE by seedindex
0594     //FIXME not independed nbitsvmte
0595     std::array<std::array<unsigned int, N_SEED>, 3> nphireg_{
0596         {{{5, 4, 4, 4, 4, 4, 4, 3, 4, 4, 5, 4}},    //inner
0597          {{5, 4, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4}},    //outer
0598          {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4}}}};  //outermost (triplets only)
0599 
0600     //For combined modules
0601     std::array<std::array<unsigned int, N_SEED>, 3> nphiregcm_{
0602         {{{5, 4, 4, 4, 4, 4, 4, 3, 4, 4, 5, 4}},    //inner
0603          {{5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4}},    //outer
0604          {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4}}}};  //outermost (triplets only)
0605 
0606     std::array<std::array<unsigned int, N_SEED>, 3> lutwidthtab_{{{{10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 11, 0}},
0607                                                                   {{6, 6, 6, 6, 10, 10, 10, 10, 0, 0, 6, 0}},
0608                                                                   {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6}}}};
0609 
0610     std::array<std::array<unsigned int, N_SEED>, 3> lutwidthtabextended_{
0611         {{{11, 11, 21, 21, 21, 21, 11, 11, 0, 0, 21, 0}},
0612          {{6, 6, 6, 6, 10, 10, 10, 10, 0, 0, 6, 0}},
0613          {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}}}};
0614 
0615     //layers/disks used by each seed
0616     std::array<std::array<int, 3>, N_SEED> seedlayers_{{{{0, 1, -1}},   //L1L2
0617                                                         {{1, 2, -1}},   //1 L2L3
0618                                                         {{2, 3, -1}},   //2 L3L4
0619                                                         {{4, 5, -1}},   //3 L5L6
0620                                                         {{6, 7, -1}},   //4 D1D2
0621                                                         {{8, 9, -1}},   //5 D3D4
0622                                                         {{0, 6, -1}},   //6 L1D1
0623                                                         {{1, 6, -1}},   //7 L2D1
0624                                                         {{2, 3, 1}},    //8 L2L3L4
0625                                                         {{4, 5, 3}},    //9 L4L5L6
0626                                                         {{1, 2, 6}},    //10 L2L3D1
0627                                                         {{6, 7, 1}}}};  //11 D1D2L2
0628 
0629     //Number of tracklet calculators for the prompt seeding combinations
0630     std::array<unsigned int, N_SEED> ntc_{{12, 4, 4, 4, 4, 4, 8, 4, 0, 0, 0, 0}};
0631 
0632     //projection layers by seed index. For each seeding index (row) the list of layers that we consider projections to
0633     std::array<std::array<unsigned int, N_LAYER - 2>, N_SEED> projlayers_{{{{3, 4, 5, 6}},  //0 L1L2
0634                                                                            {{1, 4, 5, 6}},  //1 L2L3
0635                                                                            {{1, 2, 5, 6}},  //2 L3L4
0636                                                                            {{1, 2, 3, 4}},  //3 L5L6
0637                                                                            {{1, 2}},        //4 D1D2
0638                                                                            {{1}},           //5 D3D4
0639                                                                            {{}},            //6 L1D1
0640                                                                            {{1}},           //7 L2D1
0641                                                                            {{1, 5, 6}},     //8 L2L3L4
0642                                                                            {{1, 2, 3}},     //9 L4L5L6
0643                                                                            {{1}},           //10 L2L3D1
0644                                                                            {{1}}}};         //11 D1D2L2
0645 
0646     //projection disks by seed index. For each seeding index (row) the list of diks that we consider projections to
0647     std::array<std::array<unsigned int, N_DISK>, N_SEED> projdisks_{{{{1, 2, 3, 4}},  //0 L1L2
0648                                                                      {{1, 2, 3, 4}},  //1 L2L3
0649                                                                      {{1, 2}},        //2 L3L4
0650                                                                      {{}},            //3 L5L6
0651                                                                      {{3, 4, 5}},     //4 D1D2
0652                                                                      {{1, 2, 5}},     //5 D3D4
0653                                                                      {{2, 3, 4, 5}},  //6 L1D1
0654                                                                      {{2, 3, 4}},     //7 L2D1
0655                                                                      {{1, 2, 3}},     //8 L2L3L4
0656                                                                      {{}},            //9 L4L5L6
0657                                                                      {{2, 3, 4}},     //10 L2L3D1
0658                                                                      {{3, 4}}}};      //11 D1D2L2
0659 
0660     //rphi cuts for layers - the column is the seedindex
0661     std::array<std::array<double, N_SEED>, N_LAYER> rphimatchcut_{
0662         {{{0.0, 0.1, 0.07, 0.08, 0.07, 0.05, 0.0, 0.05, 0.08, 0.15, 0.125, 0.15}},  //Layer 1
0663          {{0.0, 0.0, 0.06, 0.08, 0.05, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0}},         //Layer 2
0664          {{0.1, 0.0, 0.0, 0.08, 0.0, 0.0, 0.0, 0.0, 0.0, 0.08, 0.0, 0.0}},          //Layer 3
0665          {{0.19, 0.19, 0.0, 0.05, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}},         //Layer 4
0666          {{0.4, 0.4, 0.08, 0.0, 0.0, 0.0, 0.0, 0.0, 0.08, 0.0, 0.0, 0.0}},          //Layer 5
0667          {{0.5, 0.0, 0.19, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0}}}};         //Layer 6
0668 
0669     //z cuts for layers - the column is the seedindex
0670     std::array<std::array<double, N_SEED>, N_LAYER> zmatchcut_{
0671         {{{0.0, 0.7, 5.5, 15.0, 1.5, 2.0, 0.0, 1.5, 1.0, 8.0, 1.0, 1.5}},   //Layer 1
0672          {{0.0, 0.0, 3.5, 15.0, 1.25, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0}},  //Layer 2
0673          {{0.7, 0.0, 0.0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 0.0, 0.0}},    //Layer 3
0674          {{3.0, 3.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}},    //Layer 4
0675          {{3.0, 3.0, 8.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5, 0.0, 0.0, 0.0}},    //Layer 5
0676          {{4.0, 0.0, 9.5, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5, 0.0, 0.0, 0.0}}}};  //Layer 6
0677 
0678     //rphi cuts for PS modules in disks - the column is the seedindex
0679     std::array<std::array<double, N_SEED>, N_DISK> rphicutPS_{
0680         {{{0.2, 0.2, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}},     //disk 1
0681          {{0.2, 0.2, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1, 0.0, 0.0, 0.15, 0.0}},    //disk 2
0682          {{0.25, 0.2, 0.0, 0.0, 0.15, 0.0, 0.2, 0.15, 0.0, 0.0, 0.0, 0.2}},  //disk 3
0683          {{0.5, 0.2, 0.0, 0.0, 0.2, 0.0, 0.3, 0.5, 0.0, 0.0, 0.0, 0.0}},     //disk 4
0684          {{0.0, 0.0, 0.0, 0.0, 0.25, 0.1, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0}}}};  //disk 5
0685 
0686     //r cuts for PS modules in disks - the column is the seedindex
0687     std::array<std::array<double, N_SEED>, N_DISK> rcutPS_{
0688         {{{0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}},    //disk 1
0689          {{0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 0.5, 0.0}},    //disk 2
0690          {{0.5, 0.5, 0.0, 0.0, 0.5, 0.0, 0.6, 0.8, 0.0, 0.0, 0.0, 0.4}},    //disk 3
0691          {{0.5, 0.5, 0.0, 0.0, 0.8, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0}},    //disk 4
0692          {{0.0, 0.0, 0.0, 0.0, 1.0, 0.5, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0}}}};  //disk 5
0693 
0694     //rphi cuts for 2S modules in disks = the column is the seedindex
0695     std::array<std::array<double, N_SEED>, N_DISK> rphicut2S_{
0696         {{{0.5, 0.5, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0}},    //disk 1
0697          {{0.5, 0.5, 0.8, 0.0, 0.0, 0.0, 0.5, 0.15, 0.3, 0.0, 0.68, 0.0}},  //disk 2
0698          {{0.5, 0.5, 0.0, 0.0, 0.15, 0.0, 0.2, 0.25, 0.0, 0.0, 0.8, 0.1}},  //disk 3
0699          {{0.5, 0.5, 0.0, 0.0, 0.2, 0.0, 0.25, 0.5, 0.0, 0.0, 0.6, 0.4}},   //disk 4
0700          {{0.0, 0.0, 0.0, 0.0, 0.4, 0.2, 0.4, 0.0, 0.0, 0.0, 0.0, 0.8}}}};  //disk 5
0701 
0702     //r cuts for 2S modules in disks -the column is the seedindex
0703     std::array<std::array<double, N_SEED>, N_DISK> rcut2S_{
0704         {{{3.8, 3.8, 3.8, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0}},    //disk 1
0705          {{3.8, 3.8, 3.8, 0.0, 0.0, 0.0, 3.8, 3.4, 3.0, 0.0, 3.0, 0.0}},    //disk 2
0706          {{3.6, 3.8, 0.0, 0.0, 3.6, 0.0, 3.6, 3.8, 0.0, 0.0, 3.8, 3.0}},    //disk 3
0707          {{3.6, 3.8, 0.0, 0.0, 3.6, 0.0, 3.5, 3.8, 0.0, 0.0, 3.0, 3.0}},    //disk 4
0708          {{0.0, 0.0, 0.0, 0.0, 3.6, 3.4, 3.7, 0.0, 0.0, 0.0, 0.0, 3.0}}}};  //disk 5
0709 
0710     //returns the mean bend (in strips at a 1.8 mm separation) for bendcode
0711     std::array<std::array<double, 16>, 16> benddecode_{
0712         {{{0.0, 0.5, 0.7, 0.8, 89.9, -1.0, -0.9, -0.8, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9}},  //L1 PS
0713          {{0.0, 0.7, 1.0, 1.5, 89.9, -1.5, -1.0, -0.7, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9}},  //L2 PS
0714          {{0.0, 1.0, 1.8, 2.2, 89.9, -2.2, -1.8, -1.0, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9}},  //L3 PS
0715          {{0.0, 0.7, 1.2, 1.8, 2.1, 2.6, 3.2, 3.5, 89.9, -3.5, -3.2, -2.6, -2.1, -1.8, -1.2, -0.7}},      //L4 2S
0716          {{0.0, 0.8, 1.2, 1.8, 2.2, 3.2, 4.1, 4.4, 89.9, -4.4, -4.1, -3.2, -2.2, -1.8, -1.2, -0.8}},      //L5 2S
0717          {{0.0, 0.9, 1.8, 2.8, 3.8, 4.5, 5.3, 5.9, 89.9, -5.9, -5.3, -4.5, -3.8, -2.8, -1.8, -0.9}},      //L6 2S
0718          {{0.0, 0.8, 1.2, 2.0, 89.9, -2.0, -1.2, -0.8, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9}},  //D1 PS
0719          {{0.0, 1.5, 1.8, 2.4, 89.9, -2.4, -1.8, -1.4, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9}},  //D2 PS
0720          {{0.0, 1.7, 2.0, 2.2, 89.9, -2.2, -2.0, -1.7, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9}},  //D3 PS
0721          {{0.0, 1.8, 2.0, 2.4, 89.9, -2.4, -2.0, -1.8, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9}},  //D4 PS
0722          {{0.0, 2.0, 2.2, 2.4, 89.9, -2.4, -2.0, -1.8, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9}},  //D5 PS
0723          {{0.0, 1.8, 2.3, 2.5, 3.0, 3.9, 4.5, 5.2, 89.9, -5.2, -4.5, -3.9, -3.0, -2.5, -2.3, -1.8}},      //D1 2S
0724          {{0.0, 2.0, 2.4, 2.9, 3.2, 4.0, 4.8, 5.2, 89.9, -5.2, -4.8, -4.0, -3.2, -2.9, -2.4, -2.0}},      //D2 2S
0725          {{0.0, 2.0, 2.4, 2.7, 3.6, 3.7, 4.4, 4.6, 89.9, -4.6, -4.4, -3.7, -3.6, -2.7, -2.4, -2.0}},      //D3 2S
0726          {{0.0, 2.0, 2.6, 3.2, 3.8, 4.0, 4.4, 4.4, 89.9, -4.4, -4.4, -4.0, -3.8, -3.2, -2.6, -2.0}},      //D4 2S
0727          {{0.0, 2.0, 3.2, 3.4, 3.9, 3.9, 4.4, 4.4, 89.9, -4.4, -4.4, -3.9, -3.9, -3.4, -3.2, -2.0}}}};    //D5 2S
0728 
0729     //returns the bend 'cut' (in strips at a 1.8 mm separation) for bendcode
0730     std::array<std::array<double, 16>, 16> bendcut_{
0731         {{{1.5, 1.2, 0.8, 0.8, 99.9, 0.8, 0.8, 1.2, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}},  //L1 PS
0732          {{1.5, 1.3, 1.0, 1.0, 99.9, 1.0, 1.0, 1.3, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}},  //L2 PS
0733          {{1.6, 1.5, 1.0, 1.0, 99.9, 1.0, 1.0, 1.5, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}},  //L3 PS
0734          {{1.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 99.9, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}},          //L4 2S
0735          {{1.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 99.9, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}},          //L5 2S
0736          {{1.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 99.9, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}},          //L6 2S
0737          {{1.8, 1.6, 1.6, 1.6, 99.9, 1.6, 1.6, 1.6, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}},  //D1 PS
0738          {{1.8, 1.6, 1.6, 1.6, 99.9, 1.6, 1.6, 1.6, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}},  //D2 PS
0739          {{1.8, 1.6, 1.6, 1.6, 99.9, 1.6, 1.6, 1.6, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}},  //D3 PS
0740          {{2.2, 1.6, 1.6, 1.6, 99.9, 1.6, 1.6, 1.6, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}},  //D4 PS
0741          {{2.2, 1.6, 1.6, 1.6, 99.9, 1.6, 1.6, 1.6, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}},  //D5 PS
0742          {{2.0, 1.2, 1.2, 1.2, 1.5, 1.5, 1.5, 1.5, 99.9, 1.5, 1.5, 1.5, 1.5, 1.2, 1.2, 1.2}},          //D1 2S
0743          {{2.0, 1.2, 1.2, 1.2, 1.5, 1.5, 1.5, 1.5, 99.9, 1.5, 1.5, 1.5, 1.5, 1.2, 1.2, 1.2}},          //D2 2S
0744          {{2.2, 1.5, 1.5, 1.5, 2.0, 2.0, 2.0, 2.0, 99.9, 2.0, 2.0, 2.0, 2.0, 1.5, 1.5, 1.5}},          //D3 2S
0745          {{2.5, 1.5, 1.5, 2.0, 2.0, 2.0, 2.0, 2.0, 99.9, 2.0, 2.0, 2.0, 2.0, 2.0, 1.5, 1.5}},          //D4 2S
0746          {{2.5, 1.5, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 99.9, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 1.5}}}};        //D5 2S
0747 
0748     // Offset to the maximum number of steps in each processing step:
0749     // Set to 0 (default) means standard truncation
0750     // Set to large value, e.g. 10000, to disable truncation
0751     unsigned int maxstepoffset_{0};
0752 
0753     //Number of processing steps for one event (108=18TM*240MHz/40MHz)
0754     std::unordered_map<std::string, unsigned int> maxstep_{{"IR", 156},  //IR will run at a higher clock speed to handle
0755                                                                          //input links running at 25 Gbits/s
0756                                                            {"VMR", 108},
0757                                                            {"TE", 108},
0758                                                            {"TC", 108},
0759                                                            {"PR", 108},
0760                                                            {"ME", 108},
0761                                                            {"MC", 105},
0762                                                            {"MP", 108},
0763                                                            {"TP", 108},
0764                                                            {"TRE", 108}};
0765 
0766     // If set to true this will generate debub printout in text files
0767     std::unordered_map<std::string, bool> writeMonitorData_{{"IL", false},           {"TE", false},
0768                                                             {"CT", false},           {"HitPattern", false},
0769                                                             {"ChiSq", false},        {"Seeds", false},
0770                                                             {"FT", false},           {"Residuals", false},
0771                                                             {"StubBend", false},     {"MC", false},
0772                                                             {"MP", false},           {"ME", false},
0773                                                             {"AP", false},           {"VMP", false},
0774                                                             {"TrackProjOcc", false}, {"TC", false},
0775                                                             {"Pars", false},         {"TPars", false},
0776                                                             {"TPD", false},          {"TrackletPars", false},
0777                                                             {"TED", false},          {"TP", false},
0778                                                             {"TRE", false},          {"VMR", false},
0779                                                             {"StubsLayer", false},   {"StubsLayerSector", false},
0780                                                             {"HitEff", false},       {"MatchEff", false},
0781                                                             {"IFit", false},         {"AS", false}};
0782 
0783     std::array<double, N_DSS_MOD> rDSSinner_mod_{{68.9391, 78.7750, 85.4550, 96.3150, 102.3160}};
0784     std::array<double, N_DSS_MOD> rDSSouter_mod_{{66.4903, 76.7750, 84.4562, 94.9920, 102.3160}};
0785 
0786     //we want the center of the two strip positions in a module, not just the center of a module
0787     double halfstrip_{2.5};
0788 
0789     // various printouts for debugging and warnings
0790     bool printDebugKF_{false};   // if true print lots of debugging statements related to the KF fit
0791     bool debugTracklet_{false};  //Print detailed debug information about tracklet tracking
0792     bool writetrace_{false};     //Print out details about parsing configuration files
0793 
0794     bool warnNoMem_{false};  //If true will print out warnings about missing projection memories
0795     bool warnNoDer_{false};  //If true will print out warnings about missing track fit derivatives
0796 
0797     //--- These used to create files needed by HLS code.
0798     bool writeMem_{false};     //If true will print out content of memories (between algo steps) to files
0799     bool writeTable_{false};   //If true will print out content of LUTs to files
0800     bool writeConfig_{false};  //If true will print out the autogenerated configuration as files
0801     std::string memPath_{"../data/MemPrints/"};  //path for writing memories
0802     std::string tablePath_{"../data/LUTs/"};     //path for writing LUTs
0803 
0804     // Write various lookup tables and autogenerated code (from iMath)
0805     bool writeVerilog_{false};      //Write out auto-generated Verilog mudules used by TCs
0806     bool writeHLS_{false};          //Write out auto-generated HLS mudules used by TCs
0807     bool writeInvTable_{false};     //Write out tables of drinv and invt in tracklet calculator for Verilog module
0808     bool writeHLSInvTable_{false};  //Write out tables of drinv and invt in tracklet calculator for HLS module
0809 
0810     unsigned int writememsect_{3};  //writemem only for this sector (note that the files will have _4 extension)
0811 
0812     bool enableTripletTables_{false};  //Enable the application of the TED and
0813                                        //TRE tables; when this flag is false,
0814                                        //the tables will not be read from disk
0815     bool writeTripletTables_{false};   //Train and write the TED and TRE tables. N.B.: the tables
0816                                        //cannot be applied while they are being trained, i.e.,
0817                                        //this flag effectively turns off the cuts in
0818                                        //TrackletEngineDisplaced and TripletEngine
0819 
0820     bool writeoutReal_{false};
0821 
0822     //set to true/false to turn on/off histogram booking internal to the tracking (class "HistBase/HistImp", does nothing in central CMSSW)
0823     bool bookHistos_{false};
0824 
0825     // pt constants
0826     double ptcut_{1.91};  //Minimum pt cut
0827 
0828     // Parameters for bit sizes
0829     int alphashift_{12};
0830     int nbitsalpha_{4};      //bits used to store alpha
0831     int alphaBitsTable_{2};  //For number of bits in track derivative table
0832     int nrinvBitsTable_{3};  //number of bits for tabulating rinv dependence
0833 
0834     unsigned int MEBinsBits_{3};
0835     unsigned int MEBinsDisks_{8};  //on each side
0836     unsigned int maxStubsPerBin_{16};
0837 
0838     // Options for chisq fit
0839     bool exactderivatives_{false};
0840     bool exactderivativesforfloating_{true};  //only for the floating point
0841     bool useapprox_{true};          //use approximate postion based on integer representation for floating point
0842     bool usephicritapprox_{false};  //use floating point approximate version of phicrit cut if true
0843 
0844     // Duplicate Removal
0845     // "merge" (hybrid dup removal)
0846     // "ichi" (pairwise, keep track with best ichisq), "nstub" (pairwise, keep track with more stubs)
0847     // "grid" (TMTT-like removal), "" (no removal)
0848     unsigned int minIndStubs_{3};  // not used with merge removal
0849 
0850 #ifdef USEHYBRID
0851     std::string removalType_{"merge"};
0852     // "CompareBest" (recommended) Compares only the best stub in each track for each region (best = smallest phi residual)
0853     // and will merge the two tracks if stubs are shared in three or more regions
0854     // "CompareAll" Compares all stubs in a region, looking for matches, and will merge the two tracks if stubs are shared in three or more regions
0855     std::string mergeComparison_{"CompareBest"};
0856     bool doKF_{true};
0857 #endif
0858 
0859 #ifndef USEHYBRID
0860     bool doKF_{false};
0861     std::string removalType_{"ichi"};
0862     std::string mergeComparison_{""};
0863 #endif
0864 
0865     // When false, match calculator does not save multiple matches, even when doKF=true.
0866     // This is a temporary fix for compatibilty with HLS. We will need to implement multiple match
0867     // printing in emulator eventually, possibly after CMSSW-integration inspired rewrites
0868     // Use false when generating HLS files, use true when doing full hybrid tracking
0869     bool doMultipleMatches_{true};
0870 
0871     // if true, run a dummy fit, producing TTracks directly from output of tracklet pattern reco stage
0872     bool fakefit_{false};
0873 
0874     unsigned int nHelixPar_{4};  // 4 or 5 param helix fit
0875     bool extended_{false};       // turn on displaced tracking
0876     bool combined_{false};       // use combined TP (TE+TC) and MP (PR+ME+MC) configuration
0877 
0878     std::string skimfile_{""};  //if not empty events will be written out in ascii format to this file
0879 
0880     double bfield_{3.8112};  //B-field in T
0881     double c_{0.299792458};  //speed of light m/ns
0882 
0883     unsigned int nStrips_PS_{960};
0884     unsigned int nStrips_2S_{1016};
0885 
0886     double stripPitch_PS_{0.01};
0887     double stripPitch_2S_{0.009};
0888 
0889     double stripLength_PS_{0.1467};
0890     double stripLength_2S_{5.0250};
0891   };
0892 
0893   constexpr unsigned int N_TILTED_RINGS = 12;  // # of tilted rings per half-layer in TBPS layers
0894   constexpr std::array<unsigned int, N_PSLAYER> N_MOD_PLANK = {{7, 11, 15}};  // # of modules/plank in TBPS
0895 
0896   constexpr unsigned int N_TRKLSEED = 7;  // # of tracklet seeds
0897   constexpr unsigned int N_PROJ = 4;      // # of projections (beyond stubs from tracklet seed)
0898 
0899   // chi2 fitting
0900   constexpr unsigned int N_FITPARAM = 4;  // # of fit parameters for chi2 fit
0901   constexpr unsigned int N_FITSTUB = 6;   // max # of number of stubs used
0902 
0903   constexpr unsigned int N_TRACKDER_PTBIN = 4;
0904   constexpr unsigned int N_TRACKDER_INDEX = 1000;
0905 
0906 }  // namespace trklet
0907 
0908 #endif