Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-21 23:14: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     // scattering simulation
0085     constexpr float X0 =
0086         9.370;  // cm, from http://pdg.lbl.gov/2014/AtomicNuclearProperties/HTML/silicon_Si.html // Pb = 0.5612 cm
0087     constexpr float xr =
0088         0.1;  //  -assumes radial impact. This is bigger than what we have in main --> shouldn't it be the parameter below??? if radial impact??
0089     //const     float xr = std::sqrt(Config::beamspotX*Config::beamspotX + Config::beamspotY*Config::beamspotY);
0090 
0091     // Config for seeding
0092     constexpr int nlayers_per_seed_max = 4;  // Needed for allocation of arrays on stack.
0093     constexpr float chi2seedcut = 9.0;
0094     constexpr float lay01angdiff =
0095         0.0634888;  // analytically derived... depends on geometry of detector --> from mathematica ... d0 set to one sigma of getHypot(bsX,bsY)
0096     constexpr float lay02angdiff = 0.11537;
0097     constexpr float dEtaSeedTrip =
0098         0.06;  // for almost max efficiency --> empirically derived... depends on geometry of detector
0099     constexpr float dPhiSeedTrip =
0100         0.0458712;  // numerically+semianalytically derived... depends on geometry of detector
0101     // Recalculated in seedTest as it depends on nlayers_per_seed
0102     // static const float seed_z2cut= (nlayers_per_seed * fRadialSpacing) / std::tan(2.0f*std::atan(std::exp(-1.0f*dEtaSeedTrip)));
0103     constexpr float seed_z0cut = beamspotZ * 3.0f;   // 3cm
0104     constexpr float seed_z1cut = hitposerrZ * 3.6f;  // 3.6 mm --> to match efficiency from chi2cut
0105     constexpr float seed_d0cut = 0.5f;               // 5mm
0106     extern bool cf_seeding;
0107 
0108     // config for seeding as well... needed bfield
0109     constexpr float maxCurvR = (100 * minSimPt) / (Const::sol * Bfield);  // in cm
0110 
0111     // Config for Conformal fitter --> these change depending on inward/outward, which tracks used (MC vs reco), geometry, layers used, track params generated...
0112     // parameters for layers 0,4,9
0113     constexpr float blowupfit = 10.0;
0114     constexpr float ptinverr049 =
0115         0.0078;  // 0.0075; // errors used for MC only fit, straight from sim tracks, outward with simple geometry
0116     constexpr float phierr049 = 0.0017;    // 0.0017;
0117     constexpr float thetaerr049 = 0.0033;  // 0.0031;
0118     // parameters for layers 0,1,2 // --> ENDTOEND with "real seeding", fit is outward by definition, with poly geo
0119     constexpr float ptinverr012 = 0.12007;  // 0.1789;  -->old values from only MC seeds
0120     constexpr float phierr012 = 1.0;        // found empirically 0.00646; // 0.0071
0121     constexpr float thetaerr012 = 0.2;      // also found empirically 0.01366; // 0.0130;
0122 
0123     // config on fitting
0124     extern bool cf_fitting;
0125 
0126     extern bool mtvLikeValidation;
0127     extern bool mtvRequireSeeds;
0128     // Selection of simtracks from CMSSW. Used in Event::clean_cms_simtracks() and MkBuilder::prep_cmsswtracks()
0129     extern int cmsSelMinLayers;
0130 
0131     // config on validation
0132     extern int nMinFoundHits;
0133     constexpr float minCMSSWMatchChi2[6] = {100, 100, 50, 50, 30, 20};
0134     constexpr float minCMSSWMatchdPhi[6] = {0.2, 0.2, 0.1, 0.05, 0.01, 0.005};
0135     extern bool quality_val;
0136     extern bool sim_val_for_cmssw;
0137     extern bool sim_val;
0138     extern bool cmssw_val;
0139     extern bool fit_val;
0140     extern bool readSimTrackStates;  // need this to fill pulls
0141     extern bool inclusiveShorts;
0142     extern bool keepHitInfo;
0143     extern bool tryToSaveSimInfo;
0144     extern matchOpts cmsswMatchingFW;
0145     extern matchOpts cmsswMatchingBK;
0146 
0147     // config on dead modules
0148     extern bool useDeadModules;
0149 
0150     // number of layer1 hits for finding seeds per task
0151     extern int numHitsPerTask;
0152 
0153     // seed options
0154     extern seedOpts seedInput;
0155     extern cleanOpts seedCleaning;
0156     extern bool readCmsswTracks;
0157 
0158     extern bool dumpForPlots;
0159 
0160     extern bool kludgeCmsHitErrors;
0161     extern bool backwardFit;
0162     extern bool backwardSearch;
0163 
0164     extern int numThreadsSimulation;
0165     extern int finderReportBestOutOfN;
0166 
0167     extern bool includePCA;
0168 
0169     // ================================================================
0170 
0171     extern bool silent;
0172     extern bool json_verbose;
0173     extern bool json_dump_before;
0174     extern bool json_dump_after;
0175     extern std::vector<std::string> json_patch_filenames;
0176     extern std::vector<std::string> json_load_filenames;
0177     extern std::string json_save_iters_fname_fmt;
0178     extern bool json_save_iters_include_iter_info_preamble;
0179 
0180     // ================================================================
0181 
0182     void recalculateDependentConstants();
0183 
0184   }  // end namespace Config
0185 
0186 }  // end namespace mkfit
0187 
0188 #endif