Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:25

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