Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-03-02 23:54:18

0001 #ifndef RecoTracker_MkFitCore_standalone_ConfigStandalone_h
0002 #define RecoTracker_MkFitCore_standalone_ConfigStandalone_h
0003 
0004 #include "RecoTracker/MkFitCore/interface/Config.h"
0005 #include "RecoTracker/MkFitCore/interface/DeadRegion.h"
0006 
0007 #include <string>
0008 #include <map>
0009 #include <vector>
0010 
0011 namespace mkfit {
0012 
0013   class TrackerInfo;
0014   class IterationsInfo;
0015 
0016   void execTrackerInfoCreatorPlugin(const std::string& base, TrackerInfo& ti, IterationsInfo& ii, bool verbose = false);
0017 
0018   //------------------------------------------------------------------------------
0019 
0020   // Enum for input seed options
0021   enum seedOpts { simSeeds, cmsswSeeds, findSeeds };
0022   typedef std::map<std::string, std::pair<seedOpts, std::string> > seedOptsMap;
0023 
0024   // Enum for seed cleaning options
0025   enum cleanOpts { noCleaning, cleanSeedsN2, cleanSeedsPure, cleanSeedsBadLabel };
0026   typedef std::map<std::string, std::pair<cleanOpts, std::string> > cleanOptsMap;
0027 
0028   // Enum for cmssw matching options
0029   enum matchOpts { trkParamBased, hitBased, labelBased };
0030   typedef std::map<std::string, std::pair<matchOpts, std::string> > matchOptsMap;
0031 
0032   //------------------------------------------------------------------------------
0033 
0034   namespace Config {
0035 
0036     extern TrackerInfo TrkInfo;
0037     extern IterationsInfo ItrInfo;
0038 
0039     extern std::string geomPlugin;
0040 
0041     // default file version
0042     constexpr int FileVersion = 1;
0043 
0044     // config on main + mkFit
0045     extern int nTracks;  //defined in Config.cc by default or when reading events from file
0046     extern int nEvents;
0047     extern int nItersCMSSW;
0048     extern bool loopOverFile;
0049     // XXXXMT: nTracks should be thrown out ... SMatrix and Event allocate some arrays on this
0050     // which can be wrong for real data or in multi-event environment
0051 
0052     // the following are only used in SMatrix version
0053     constexpr float nSigma = 3.;
0054     constexpr float minDPhi = 0.01;  // default: 0.;  cmssw tests: 0.01;
0055     constexpr float maxDPhi = Const::PI;
0056     constexpr float minDEta = 0.;
0057     constexpr float maxDEta = 1.0;
0058 
0059     // Configuration for simulation info
0060     constexpr int NiterSim = 10;  // Can make more steps due to near volume misses.
0061     // CMS beam spot width 25um in xy and 5cm in z
0062     constexpr float beamspotX = 0.1;
0063     constexpr float beamspotY = 0.1;
0064     constexpr float beamspotZ = 1.0;
0065 
0066     // XXMT4K minPt was 0.5. Figure out what is the new limit for 90cm or be
0067     // more flexible about finding fewer hits. Or postprocess looper candidates.
0068     constexpr float minSimPt = 1;
0069     constexpr float maxSimPt = 10.;
0070 
0071     // XXMT Hardhack -- transition region excluded in Simulation::setupTrackByToyMC()
0072     constexpr float minSimEta = -2.4;
0073     constexpr float maxSimEta = 2.4;
0074     // For testing separate EC-/BRL/EC+; -2.3--1.5 / -0.9-0.9 / 1.5-2.3
0075     //constexpr float minSimEta =  -0.9;
0076     //constexpr float maxSimEta =   0.9;
0077 
0078     constexpr float hitposerrXY = 0.01;  // resolution is 100um in xy --> more realistic scenario is 0.003
0079     constexpr float hitposerrZ = 0.1;    // resolution is 1mm in z
0080     constexpr float hitposerrR = Config::hitposerrXY / 10.0f;  // XXMT4K ??? I don't get this ...
0081     constexpr float varXY = Config::hitposerrXY * Config::hitposerrXY;
0082     constexpr float varZ = Config::hitposerrZ * Config::hitposerrZ;
0083     constexpr float varR = Config::hitposerrR * Config::hitposerrR;
0084 
0085     // Config for seeding
0086     constexpr int nlayers_per_seed_max = 4;  // Needed for allocation of arrays on stack.
0087     constexpr float chi2seedcut = 9.0;
0088     constexpr float lay01angdiff =
0089         0.0634888;  // analytically derived... depends on geometry of detector --> from mathematica ... d0 set to one sigma of getHypot(bsX,bsY)
0090     constexpr float lay02angdiff = 0.11537;
0091     constexpr float dEtaSeedTrip =
0092         0.06;  // for almost max efficiency --> empirically derived... depends on geometry of detector
0093     constexpr float dPhiSeedTrip =
0094         0.0458712;  // numerically+semianalytically derived... depends on geometry of detector
0095     // Recalculated in seedTest as it depends on nlayers_per_seed
0096     // static const float seed_z2cut= (nlayers_per_seed * fRadialSpacing) / std::tan(2.0f*std::atan(std::exp(-1.0f*dEtaSeedTrip)));
0097     constexpr float seed_z0cut = beamspotZ * 3.0f;   // 3cm
0098     constexpr float seed_z1cut = hitposerrZ * 3.6f;  // 3.6 mm --> to match efficiency from chi2cut
0099     constexpr float seed_d0cut = 0.5f;               // 5mm
0100     extern bool cf_seeding;
0101 
0102     // config for seeding as well... needed bfield
0103     constexpr float maxCurvR = (100 * minSimPt) / (Const::sol * Bfield);  // in cm
0104 
0105     // Config for Conformal fitter --> these change depending on inward/outward, which tracks used (MC vs reco), geometry, layers used, track params generated...
0106     // parameters for layers 0,4,9
0107     constexpr float blowupfit = 10.0;
0108     constexpr float ptinverr049 =
0109         0.0078;  // 0.0075; // errors used for MC only fit, straight from sim tracks, outward with simple geometry
0110     constexpr float phierr049 = 0.0017;    // 0.0017;
0111     constexpr float thetaerr049 = 0.0033;  // 0.0031;
0112     // parameters for layers 0,1,2 --> with "real seeding", fit is outward by definition, with poly geo
0113     constexpr float ptinverr012 = 0.12007;  // 0.1789;  -->old values from only MC seeds
0114     constexpr float phierr012 = 1.0;        // found empirically 0.00646; // 0.0071
0115     constexpr float thetaerr012 = 0.2;      // also found empirically 0.01366; // 0.0130;
0116 
0117     // config on fitting
0118     extern bool cf_fitting;
0119 
0120     extern bool mtvLikeValidation;
0121     extern bool mtvRequireSeeds;
0122     // Selection of simtracks from CMSSW. Used in Event::clean_cms_simtracks() and MkBuilder::prep_cmsswtracks()
0123     extern int cmsSelMinLayers;
0124 
0125     // config on validation
0126     extern int nMinFoundHits;
0127     constexpr float minCMSSWMatchChi2[6] = {100, 100, 50, 50, 30, 20};
0128     constexpr float minCMSSWMatchdPhi[6] = {0.2, 0.2, 0.1, 0.05, 0.01, 0.005};
0129     extern bool quality_val;
0130     extern bool sim_val_for_cmssw;
0131     extern bool sim_val;
0132     extern bool cmssw_val;
0133     extern bool fit_val;
0134     extern bool readSimTrackStates;  // need this to fill pulls
0135     extern bool inclusiveShorts;
0136     extern bool keepHitInfo;
0137     extern bool tryToSaveSimInfo;
0138     extern matchOpts cmsswMatchingFW;
0139     extern matchOpts cmsswMatchingBK;
0140 
0141     // config on dead modules
0142     extern bool useDeadModules;
0143 
0144     // number of layer1 hits for finding seeds per task
0145     extern int numHitsPerTask;
0146 
0147     // seed options
0148     extern seedOpts seedInput;
0149     extern cleanOpts seedCleaning;
0150     extern bool readCmsswTracks;
0151 
0152     extern bool dumpForPlots;
0153 
0154     extern bool backwardFit;
0155     extern bool backwardSearch;
0156 
0157     extern int numThreadsSimulation;
0158     extern int finderReportBestOutOfN;
0159 
0160     extern bool includePCA;
0161 
0162     // ================================================================
0163 
0164     extern bool silent;
0165     extern bool json_verbose;
0166     extern bool json_dump_before;
0167     extern bool json_dump_after;
0168     extern std::vector<std::string> json_patch_filenames;
0169     extern std::vector<std::string> json_load_filenames;
0170     extern std::string json_save_iters_fname_fmt;
0171     extern bool json_save_iters_include_iter_info_preamble;
0172 
0173     // ================================================================
0174 
0175     void recalculateDependentConstants();
0176 
0177   }  // end namespace Config
0178 
0179   namespace internal {
0180     extern std::vector<DeadVec> deadvectors;
0181   }
0182 
0183 }  // end namespace mkfit
0184 
0185 #endif