CMS 3D CMS Logo

Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
mkfit Namespace Reference

Namespaces

 Config
 
 Const
 
 internal
 
 mini_propagators
 
 StdSeq
 

Classes

struct  axis
 
struct  axis_base
 
struct  axis_pow2
 
struct  axis_pow2_base
 
struct  axis_pow2_u1
 
struct  BeamSpot
 
struct  binnor
 
class  CandCloner
 
class  CcAlloc
 
class  CcPool
 
class  CombCandidate
 
class  ConfigJson
 
class  ConfigJsonPatcher
 
struct  DataFile
 
struct  DataFileHeader
 
struct  DeadRegion
 
class  Event
 
class  EventOfCombCandidates
 
class  EventOfHits
 
struct  ExecutionContext
 
class  FindingFoos
 
struct  FitVal
 
class  Hit
 
struct  HitMatch
 
struct  HitMatchPair
 
struct  HitOnTrack
 
struct  HoTNode
 
struct  IdxChi2List
 
class  IterationConfig
 
class  IterationLayerConfig
 
struct  IterationMaskIfc
 
struct  IterationMaskIfcBase
 
struct  IterationMaskIfcCmssw
 
class  IterationParams
 
class  IterationSeedPartition
 
class  IterationsInfo
 
struct  LayerControl
 
class  LayerInfo
 
class  LayerNumberConverter
 
class  LayerOfHits
 
class  MatriplexErrParPackerSlurpIn
 
class  MatriplexPackerSlurpIn
 
class  MatriplexTrackPackerPlexify
 
struct  MCHitInfo
 
struct  MeasurementState
 
class  MkBase
 
class  MkBuilder
 
class  MkBuilderWrapper
 
class  MkFinder
 
class  MkFitter
 
class  MkJob
 
struct  ModuleInfo
 
struct  ModuleShape
 
class  Pool
 
class  PropagationConfig
 
class  PropagationFlags
 
class  radix_sort
 
class  rectvec
 
struct  ReducedTrack
 
class  Shell
 
struct  sortTracksByPhiStruct
 
class  SteeringParams
 
class  Track
 
class  TrackBase
 
class  TrackCand
 
class  TrackerInfo
 
class  TrackExtra
 
struct  TrackState
 
class  TTreeValidation
 
struct  UpdateIndices
 
class  Validation
 
struct  WSR_Result
 

Typedefs

using clean_duplicates_cf = void(TrackVec &, const IterationConfig &)
 
using clean_duplicates_func = std::function< clean_duplicates_cf >
 
using clean_seeds_cf = int(TrackVec &, const IterationConfig &, const BeamSpot &)
 
using clean_seeds_func = std::function< clean_seeds_cf >
 
typedef std::map< std::string, std::pair< cleanOpts, std::string > > cleanOptsMap
 
typedef std::vector< DeadRegionDeadVec
 
typedef std::vector< EventEventVec
 
using filter_candidates_cf = bool(const TrackCand &, const MkJob &)
 
using filter_candidates_func = std::function< filter_candidates_cf >
 
typedef std::vector< std::pair< int, float > > FltLayerPairVec
 
typedef std::vector< int > HitIdxVec
 
typedef std::map< int, std::vector< int > > HitLayerMap
 
using HitVec = std::vector< Hit >
 
typedef std::vector< HitOnTrackHoTVec
 
typedef std::pair< int, float > idchi2Pair
 
typedef std::vector< idchi2Pairidchi2PairVec
 
typedef std::map< int, std::map< int, std::vector< int > > > LayIdxIDVecMapMap
 
typedef std::map< std::string, std::pair< matchOpts, std::string > > matchOptsMap
 
using MatriplexHitPacker = MatriplexErrParPackerSlurpIn< Hit, float >
 
using MatriplexHoTPacker = MatriplexPackerSlurpIn< HitOnTrack >
 
using MatriplexTrackPacker = MatriplexErrParPackerSlurpIn< TrackBase, float >
 
typedef std::vector< MCHitInfoMCHitInfoVec
 
typedef Matriplex::Matriplex< float, 2, 2, NNMPlex22
 
typedef Matriplex::Matriplex< float, 2, HH, NNMPlex2H
 
typedef Matriplex::MatriplexSym< float, 2, NNMPlex2S
 
typedef Matriplex::Matriplex< float, 2, 1, NNMPlex2V
 
typedef Matriplex::Matriplex< float, 5, 2, NNMPlex52
 
typedef Matriplex::Matriplex< float, 5, 5, NNMPlex55
 
typedef Matriplex::Matriplex< float, 5, 6, NNMPlex56
 
typedef Matriplex::MatriplexSym< float, 5, NNMPlex5S
 
typedef Matriplex::Matriplex< float, 5, 1, NNMPlex5V
 
typedef Matriplex::Matriplex< float, 6, 5, NNMPlex65
 
typedef Matriplex::Matriplex< float, HH, 2, NNMPlexH2
 
typedef Matriplex::Matriplex< float, HH, HH, NNMPlexHH
 
using MPlexHitIdx = Matriplex::Matriplex< int, MPlexHitIdxMax, 1, NN >
 
typedef Matriplex::Matriplex< float, HH, LL, NNMPlexHL
 
typedef Matriplex::MatriplexSym< float, HH, NNMPlexHS
 
typedef Matriplex::Matriplex< float, HH, 1, NNMPlexHV
 
typedef Matriplex::Matriplex< float, LL, 2, NNMPlexL2
 
typedef Matriplex::Matriplex< float, LL, HH, NNMPlexLH
 
typedef Matriplex::Matriplex< float, LL, LL, NNMPlexLL
 
typedef Matriplex::MatriplexSym< float, LL, NNMPlexLS
 
typedef Matriplex::Matriplex< float, LL, 1, NNMPlexLV
 
typedef Matriplex::Matriplex< bool, 1, 1, NNMPlexQB
 
typedef Matriplex::Matriplex< float, 1, 1, NNMPlexQF
 
typedef Matriplex::Matriplex< short, 1, 1, NNMPlexQH
 
using MPlexQHoT = Matriplex::Matriplex< HitOnTrack, 1, 1, NN >
 
typedef Matriplex::Matriplex< int, 1, 1, NNMPlexQI
 
typedef Matriplex::Matriplex< unsigned short, 1, 1, NNMPlexQUH
 
typedef Matriplex::Matriplex< unsigned int, 1, 1, NNMPlexQUI
 
typedef std::array< int, 2 > PairIdx
 
typedef std::vector< PairIdxPairIdxVec
 
using partition_seeds_cf = void(const TrackerInfo &, const TrackVec &, const EventOfHits &, IterationSeedPartition &)
 
using partition_seeds_func = std::function< partition_seeds_cf >
 
typedef std::vector< ReducedTrackRedTrackVec
 
typedef std::map< std::string, std::pair< seedOpts, std::string > > seedOptsMap
 
typedef std::pair< int, int > SimTkIDInfo
 
typedef ROOT::Math::SMatrix< float, 2 > SMatrix22
 
typedef ROOT::Math::SMatrix< float, 2, 6 > SMatrix26
 
typedef ROOT::Math::SMatrix< float, 3 > SMatrix33
 
typedef ROOT::Math::SMatrix< float, 3, 6 > SMatrix36
 
typedef ROOT::Math::SMatrix< float, 6, 2 > SMatrix62
 
typedef ROOT::Math::SMatrix< float, 6, 3 > SMatrix63
 
typedef ROOT::Math::SMatrix< float, 6 > SMatrix66
 
typedef ROOT::Math::SMatrix< float, 2, 2, ROOT::Math::MatRepSym< float, 2 > > SMatrixSym22
 
typedef ROOT::Math::SMatrix< float, 3, 3, ROOT::Math::MatRepSym< float, 3 > > SMatrixSym33
 
typedef ROOT::Math::SMatrix< float, 6, 6, ROOT::Math::MatRepSym< float, 6 > > SMatrixSym66
 
typedef ROOT::Math::SVector< float, 2 > SVector2
 
typedef ROOT::Math::SVector< float, 3 > SVector3
 
typedef ROOT::Math::SVector< float, 6 > SVector6
 
typedef std::unordered_map< int, int > TkIDToTkIDMap
 
typedef std::unordered_map< int, std::vector< int > > TkIDToTkIDVecMap
 
typedef std::unordered_map< int, TSLayerPairVecTkIDToTSLayerPairVecMap
 
typedef std::unordered_map< int, TrackStateTkIDToTSMap
 
typedef std::vector< TSVecTkIDToTSVecVec
 
using track_score_cf = float(const int nfoundhits, const int ntailholes, const int noverlaphits, const int nmisshits, const float chi2, const float pt, const bool inFindCandidates)
 
using track_score_func = std::function< track_score_cf >
 
typedef std::vector< TrackExtraTrackExtraVec
 
using TrackVec = std::vector< Track >
 
typedef std::vector< TrackVecTrackVecVec
 
typedef std::array< int, 3 > TripletIdx
 
typedef std::vector< TripletIdxTripletIdxVec
 
typedef std::map< int, std::unordered_set< int > > TrkIDLaySetMap
 
typedef std::vector< std::pair< int, TrackState > > TSLayerPairVec
 
typedef std::vector< TrackStateTSVec
 

Enumerations

enum  cleanOpts { noCleaning, cleanSeedsN2, cleanSeedsPure, cleanSeedsBadLabel }
 
enum  KalmanFilterOperation { KFO_Calculate_Chi2 = 1, KFO_Update_Params = 2, KFO_Local_Cov = 4 }
 
enum  matchOpts { trkParamBased, hitBased, labelBased }
 
enum  PropagationFlagsEnum { PF_none = 0, PF_use_param_b_field = 0x1, PF_apply_material = 0x2, PF_copy_input_state_on_fail = 0x4 }
 
enum  seedOpts { simSeeds, cmsswSeeds, findSeeds }
 
enum  TkLayout { TkLayout::phase0 = 0, TkLayout::phase1 = 1, TkLayout::phase2 = 2 }
 
enum  WithinSensitiveRegion_e {
  WSR_Undef = -1, WSR_Inside = 0, WSR_Edge, WSR_Outside,
  WSR_Failed
}
 

Functions

void applyMaterialEffects (const MPlexQF &hitsRl, const MPlexQF &hitsXi, const MPlexQF &propSign, const MPlexHV &plNrm, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
 
int calculateCharge (const Hit &hit0, const Hit &hit1, const Hit &hit2)
 
int calculateCharge (const float hit0_x, const float hit0_y, const float hit1_x, const float hit1_y, const float hit2_x, const float hit2_y)
 
float cdist (float a)
 
void CFMap (const MPlexHH &A, const MPlexHV &B, MPlexHV &C)
 
template<typename Vector , typename Matrix >
float computeHelixChi2 (const Vector &simV, const Vector &recoV, const Matrix &recoM, const bool diagOnly=false)
 
void conformalFitMPlex (bool fitting, MPlexQI seedID, MPlexLS &outErr, MPlexLV &outPar, const MPlexHV &msPar0, const MPlexHV &msPar1, const MPlexHV &msPar2)
 
template<typename Traits , typename HitCollection >
edm::ProductID convertHits (const Traits &traits, const HitCollection &hits, mkfit::HitVec &mkFitHits, std::vector< TrackingRecHit const *> &clusterIndexToHit, std::vector< float > &clusterChargeVec, const TrackerTopology &ttopo, const TransientTrackingRecHitBuilder &ttrhBuilder, const MkFitGeometry &mkFitGeom)
 
template<typename T >
T cube (T x)
 
template<typename Matrix >
void diagonalOnly (Matrix &m)
 
double dtime ()
 
template<typename Matrix >
void dumpMatrix (Matrix m)
 
SimSeedInfo evsi2ssinfo (const Event *ev, int seed_idx)
 
void execTrackerInfoCreatorPlugin (const std::string &base, TrackerInfo &ti, IterationsInfo &ii, bool verbose)
 
void findSeedsByRoadSearch (TripletIdxConVec &seed_idcs, std::vector< LayerOfHits > &evt_lay_hits, int lay1_size, Event *&ev)
 
void from_json (const nlohmann::ordered_json &nlohmann_json_j, mkfit::LayerControl &nlohmann_json_t)
 
void from_json (const nlohmann::json &nlohmann_json_j, mkfit::LayerControl &nlohmann_json_t)
 
void from_json (const nlohmann::json &nlohmann_json_j, mkfit::SteeringParams &nlohmann_json_t)
 
void from_json (const nlohmann::ordered_json &nlohmann_json_j, mkfit::SteeringParams &nlohmann_json_t)
 
void from_json (const nlohmann::json &nlohmann_json_j, mkfit::IterationLayerConfig &nlohmann_json_t)
 
void from_json (const nlohmann::ordered_json &nlohmann_json_j, mkfit::IterationLayerConfig &nlohmann_json_t)
 
void from_json (const nlohmann::json &nlohmann_json_j, mkfit::IterationParams &nlohmann_json_t)
 
void from_json (const nlohmann::ordered_json &nlohmann_json_j, mkfit::IterationParams &nlohmann_json_t)
 
void from_json (const nlohmann::json &nlohmann_json_j, mkfit::IterationConfig &nlohmann_json_t)
 
void from_json (const nlohmann::ordered_json &nlohmann_json_j, mkfit::IterationConfig &nlohmann_json_t)
 
void from_json (const nlohmann::json &nlohmann_json_j, mkfit::IterationsInfo &nlohmann_json_t)
 
void from_json (const nlohmann::ordered_json &nlohmann_json_j, mkfit::IterationsInfo &nlohmann_json_t)
 
float getEta (float r, float z)
 
float getEta (float theta)
 
float getEta (float x, float y, float z)
 
float getEtaErr2 (float x, float y, float z, float exx, float eyy, float ezz, float exy, float exz, float eyz)
 
float getHypot (float x, float y)
 
float getInvRad2 (float x, float y)
 
float getInvRadErr2 (float x, float y, float exx, float eyy, float exy)
 
int getMatchBin (const float pt)
 
float getPhi (float x, float y)
 
float getPhiErr2 (float x, float y, float exx, float eyy, float exy)
 
float getPxPxErr2 (float ipt, float phi, float vipt, float vphi)
 
float getPyPyErr2 (float ipt, float phi, float vipt, float vphi)
 
float getPzPzErr2 (float ipt, float theta, float vipt, float vtheta)
 
float getRad2 (float x, float y)
 
float getRadErr2 (float x, float y, float exx, float eyy, float exy)
 
float getScoreCand (const track_score_func &score_func, const TrackCand &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
 
float getScoreCand (const track_score_func &score_func, const Track &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
 
float getScoreStruct (const track_score_func &score_func, const IdxChi2List &cand1)
 
float getScoreWorstPossible ()
 
float getTheta (float r, float z)
 
float getThetaErr2 (float x, float y, float z, float exx, float eyy, float ezz, float exy, float exz, float eyz)
 
void helixAtPlane (const MPlexLV &inPar, const MPlexQI &inChg, const MPlexHV &plPnt, const MPlexHV &plNrm, MPlexQF &pathL, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags)
 
void helixAtRFromIterativeCCS (const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags)
 
void helixAtRFromIterativeCCSFullJac (const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc)
 
void helixAtRFromIterativeCCSFullJac (const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLV &outPar, MPlexLL &errorProp, const int N_proc)
 
void helixAtZ (const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags)
 
float hipo (float x, float y)
 
float hipo_sqr (float x, float y)
 
RVec hit2pos (const Hit &h)
 
void intersectThirdLayer (const float a, const float b, const float hit1_x, const float hit1_y, float &lay2_x, float &lay2_y)
 
constexpr bool isFinite (float x)
 
bool isStripQCompatible (int itrack, bool isBarrel, const MPlexLS &pErr, const MPlexLV &pPar, const MPlexHS &msErr, const MPlexHV &msPar)
 
void kalmanComputeChi2 (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, MPlexQF &outChi2, const int N_proc)
 
void kalmanComputeChi2Endcap (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, MPlexQF &outChi2, const int N_proc)
 
void kalmanComputeChi2Plane (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexQF &outChi2, const int N_proc)
 
void kalmanOperation (const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
 
void kalmanOperationEndcap (const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
 
void kalmanOperationPlane (const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
 
void kalmanOperationPlaneLocal (const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
 
void kalmanPropagateAndComputeChi2 (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, MPlexQF &outChi2, MPlexLV &propPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &propFlags, const bool propToHit)
 
void kalmanPropagateAndComputeChi2Endcap (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, MPlexQF &outChi2, MPlexLV &propPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &propFlags, const bool propToHit)
 
void kalmanPropagateAndComputeChi2Plane (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexQF &outChi2, MPlexLV &propPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &propFlags, const bool propToHit)
 
void kalmanPropagateAndUpdate (const MPlexLS &psErr, const MPlexLV &psPar, MPlexQI &Chg, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &propFlags, const bool propToHit)
 
void kalmanPropagateAndUpdateEndcap (const MPlexLS &psErr, const MPlexLV &psPar, MPlexQI &Chg, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &propFlags, const bool propToHit)
 
void kalmanPropagateAndUpdatePlane (const MPlexLS &psErr, const MPlexLV &psPar, MPlexQI &Chg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &propFlags, const bool propToHit)
 
void kalmanUpdate (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
 
void kalmanUpdateEndcap (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
 
void kalmanUpdatePlane (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &Chg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
 
void MultHelixPropFull (const MPlexLL &A, const MPlexLS &B, MPlexLL &C)
 
void MultHelixPropTranspFull (const MPlexLL &A, const MPlexLL &B, MPlexLS &C)
 
template<class T , class U >
bool operator== (const CcAlloc< T > &a, const CcAlloc< U > &b)
 
bool passStripChargePCMfromTrack (int itrack, bool isBarrel, unsigned int pcm, unsigned int pcmMin, const MPlexLV &pPar, const MPlexHS &msErr)
 
void print (std::string_view label, const MeasurementState &s)
 
void print (const TrackState &s)
 
void print (std::string pfx, int itrack, const Track &trk, bool print_hits=false)
 
void print (std::string pfx, const TrackState &s)
 
void print (std::string pfx, int itrack, const Track &trk, const Event &ev)
 
void propagateHelixToPlaneMPlex (const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexHV &plPnt, const MPlexHV &plNrm, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr=nullptr)
 
void propagateHelixToRMPlex (const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr)
 
void propagateHelixToZMPlex (const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr=nullptr)
 
void propagateLineToRMPlex (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
 
void run_OneIteration (const TrackerInfo &trackerInfo, const IterationConfig &itconf, const EventOfHits &eoh, const std::vector< const std::vector< bool > *> &hit_masks, MkBuilder &builder, TrackVec &seeds, TrackVec &out_tracks, bool do_seed_clean, bool do_backward_fit, bool do_remove_duplicates)
 
std::vector< double > runBtpCe_MultiIter (Event &ev, const EventOfHits &eoh, MkBuilder &builder, int n)
 
double runBuildingTestPlexBestHit (Event &ev, const EventOfHits &eoh, MkBuilder &builder)
 
double runBuildingTestPlexCloneEngine (Event &ev, const EventOfHits &eoh, MkBuilder &builder)
 
void runBuildingTestPlexDumbCMSSW (Event &ev, const EventOfHits &eoh, MkBuilder &builder)
 
double runBuildingTestPlexStandard (Event &ev, const EventOfHits &eoh, MkBuilder &builder)
 
double runFittingTestPlex (Event &ev, std::vector< Track > &rectracks)
 
void sincos4 (const float x, float &sin, float &cos)
 
bool sortByEta (const Hit &hit1, const Hit &hit2)
 
bool sortByHitsChi2 (const std::pair< Track, TrackState > &cand1, const std::pair< Track, TrackState > &cand2)
 
bool sortByHitsChi2 (const Track &cand1, const Track &cand2)
 
bool sortByPhi (const Hit &hit1, const Hit &hit2)
 
bool sortByScoreCand (const Track &cand1, const Track &cand2)
 
bool sortByScoreStruct (const IdxChi2List &cand1, const IdxChi2List &cand2)
 
bool sortByScoreTrackCand (const TrackCand &cand1, const TrackCand &cand2)
 
bool sortByZ (const Hit &hit1, const Hit &hit2)
 
bool sortIDsByChi2 (const idchi2Pair &cand1, const idchi2Pair &cand2)
 
bool sortTracksByEta (const Track &track1, const Track &track2)
 
bool sortTracksByPhi (const Track &track1, const Track &track2)
 
template<typename T >
T sqr (T x)
 
float squashPhiGeneral (float phi)
 
template<typename Vector >
void squashPhiGeneral (Vector &v)
 
float squashPhiMinimal (float phi)
 
void squashPhiMPlex (MPlexLV &par, const int N_proc)
 
void squashPhiMPlexGeneral (MPlexLV &par, const int N_proc)
 
RVec state2mom (const miprops::State &s)
 
RVec state2pos (const miprops::State &s)
 
State state2state (const miprops::State &s)
 
RVec statep2mom (const miprops::StatePlex &s, int i)
 
RVec statep2pos (const miprops::StatePlex &s, int i)
 
PropState statep2propstate (const miprops::StatePlex &s, int i)
 
State statep2state (const miprops::StatePlex &s, int i)
 
void to_json (nlohmann::ordered_json &nlohmann_json_j, const mkfit::LayerControl &nlohmann_json_t)
 
void to_json (nlohmann::json &nlohmann_json_j, const mkfit::LayerControl &nlohmann_json_t)
 
void to_json (nlohmann::ordered_json &nlohmann_json_j, const mkfit::SteeringParams &nlohmann_json_t)
 
void to_json (nlohmann::json &nlohmann_json_j, const mkfit::SteeringParams &nlohmann_json_t)
 
void to_json (nlohmann::json &nlohmann_json_j, const mkfit::IterationLayerConfig &nlohmann_json_t)
 
void to_json (nlohmann::ordered_json &nlohmann_json_j, const mkfit::IterationLayerConfig &nlohmann_json_t)
 
void to_json (nlohmann::ordered_json &nlohmann_json_j, const mkfit::IterationParams &nlohmann_json_t)
 
void to_json (nlohmann::json &nlohmann_json_j, const mkfit::IterationParams &nlohmann_json_t)
 
void to_json (nlohmann::ordered_json &nlohmann_json_j, const mkfit::IterationConfig &nlohmann_json_t)
 
void to_json (nlohmann::json &nlohmann_json_j, const mkfit::IterationConfig &nlohmann_json_t)
 
void to_json (nlohmann::ordered_json &nlohmann_json_j, const mkfit::IterationsInfo &nlohmann_json_t)
 
void to_json (nlohmann::json &nlohmann_json_j, const mkfit::IterationsInfo &nlohmann_json_t)
 
RVec track2mom (const TrackBase &s)
 
RVec track2pos (const TrackBase &s)
 
State track2state (const TrackBase &s)
 

Variables

bool g_debug = true
 
ExecutionContext g_exe_ctx
 
constexpr Matriplex::idx_t HH = 3
 
constexpr Matriplex::idx_t LL = 6
 
static constexpr int MPlexHitIdxMax = 16
 
constexpr Matriplex::idx_t NN = 8
 

Typedef Documentation

◆ clean_duplicates_cf

using mkfit::clean_duplicates_cf = typedef void(TrackVec &, const IterationConfig &)

Definition at line 30 of file FunctionTypes.h.

◆ clean_duplicates_func

using mkfit::clean_duplicates_func = typedef std::function<clean_duplicates_cf>

Definition at line 31 of file FunctionTypes.h.

◆ clean_seeds_cf

using mkfit::clean_seeds_cf = typedef int(TrackVec &, const IterationConfig &, const BeamSpot &)

Definition at line 21 of file FunctionTypes.h.

◆ clean_seeds_func

using mkfit::clean_seeds_func = typedef std::function<clean_seeds_cf>

Definition at line 22 of file FunctionTypes.h.

◆ cleanOptsMap

typedef std::map<std::string, std::pair<cleanOpts, std::string> > mkfit::cleanOptsMap

Definition at line 26 of file ConfigStandalone.h.

◆ DeadVec

typedef std::vector<DeadRegion> mkfit::DeadVec

Definition at line 11 of file DeadRegion.h.

◆ EventVec

typedef std::vector<Event> mkfit::EventVec

Definition at line 85 of file Event.h.

◆ filter_candidates_cf

using mkfit::filter_candidates_cf = typedef bool(const TrackCand &, const MkJob &)

Definition at line 27 of file FunctionTypes.h.

◆ filter_candidates_func

using mkfit::filter_candidates_func = typedef std::function<filter_candidates_cf>

Definition at line 28 of file FunctionTypes.h.

◆ FltLayerPairVec

typedef std::vector<std::pair<int, float> > mkfit::FltLayerPairVec

Definition at line 121 of file TrackExtra.h.

◆ HitIdxVec

typedef std::vector<int> mkfit::HitIdxVec

Definition at line 18 of file Track.h.

◆ HitLayerMap

typedef std::map<int, std::vector<int> > mkfit::HitLayerMap

Definition at line 19 of file Track.h.

◆ HitVec

typedef std::vector< Hit > mkfit::HitVec

Definition at line 11 of file MkFitHitWrapper.h.

◆ HoTVec

typedef std::vector<HitOnTrack> mkfit::HoTVec

Definition at line 272 of file Hit.h.

◆ idchi2Pair

typedef std::pair<int, float> mkfit::idchi2Pair

Definition at line 232 of file TrackExtra.cc.

◆ idchi2PairVec

typedef std::vector<idchi2Pair> mkfit::idchi2PairVec

Definition at line 233 of file TrackExtra.cc.

◆ LayIdxIDVecMapMap

typedef std::map<int, std::map<int, std::vector<int> > > mkfit::LayIdxIDVecMapMap

Definition at line 37 of file TrackExtra.h.

◆ matchOptsMap

typedef std::map<std::string, std::pair<matchOpts, std::string> > mkfit::matchOptsMap

Definition at line 30 of file ConfigStandalone.h.

◆ MatriplexHitPacker

Definition at line 139 of file MatriplexPackers.h.

◆ MatriplexHoTPacker

Definition at line 142 of file MatriplexPackers.h.

◆ MatriplexTrackPacker

Definition at line 140 of file MatriplexPackers.h.

◆ MCHitInfoVec

typedef std::vector<MCHitInfo> mkfit::MCHitInfoVec

Definition at line 119 of file Hit.h.

◆ MPlex22

typedef Matriplex::Matriplex<float, 2, 2, NN> mkfit::MPlex22

Definition at line 68 of file Matrix.h.

◆ MPlex2H

typedef Matriplex::Matriplex<float, 2, HH, NN> mkfit::MPlex2H

Definition at line 78 of file Matrix.h.

◆ MPlex2S

typedef Matriplex::MatriplexSym<float, 2, NN> mkfit::MPlex2S

Definition at line 70 of file Matrix.h.

◆ MPlex2V

typedef Matriplex::Matriplex<float, 2, 1, NN> mkfit::MPlex2V

Definition at line 69 of file Matrix.h.

◆ MPlex52

typedef Matriplex::Matriplex<float, 5, 2, NN> mkfit::MPlex52

Definition at line 75 of file Matrix.h.

◆ MPlex55

typedef Matriplex::Matriplex<float, 5, 5, NN> mkfit::MPlex55

Definition at line 64 of file Matrix.h.

◆ MPlex56

typedef Matriplex::Matriplex<float, 5, 6, NN> mkfit::MPlex56

Definition at line 65 of file Matrix.h.

◆ MPlex5S

typedef Matriplex::MatriplexSym<float, 5, NN> mkfit::MPlex5S

Definition at line 62 of file Matrix.h.

◆ MPlex5V

typedef Matriplex::Matriplex<float, 5, 1, NN> mkfit::MPlex5V

Definition at line 61 of file Matrix.h.

◆ MPlex65

typedef Matriplex::Matriplex<float, 6, 5, NN> mkfit::MPlex65

Definition at line 66 of file Matrix.h.

◆ MPlexH2

typedef Matriplex::Matriplex<float, HH, 2, NN> mkfit::MPlexH2

Definition at line 77 of file Matrix.h.

◆ MPlexHH

typedef Matriplex::Matriplex<float, HH, HH, NN> mkfit::MPlexHH

Definition at line 57 of file Matrix.h.

◆ MPlexHitIdx

using mkfit::MPlexHitIdx = typedef Matriplex::Matriplex<int, MPlexHitIdxMax, 1, NN>

Definition at line 13 of file MkFitter.h.

◆ MPlexHL

typedef Matriplex::Matriplex<float, HH, LL, NN> mkfit::MPlexHL

Definition at line 73 of file Matrix.h.

◆ MPlexHS

typedef Matriplex::MatriplexSym<float, HH, NN> mkfit::MPlexHS

Definition at line 59 of file Matrix.h.

◆ MPlexHV

typedef Matriplex::Matriplex<float, HH, 1, NN> mkfit::MPlexHV

Definition at line 58 of file Matrix.h.

◆ MPlexL2

typedef Matriplex::Matriplex<float, LL, 2, NN> mkfit::MPlexL2

Definition at line 76 of file Matrix.h.

◆ MPlexLH

typedef Matriplex::Matriplex<float, LL, HH, NN> mkfit::MPlexLH

Definition at line 72 of file Matrix.h.

◆ MPlexLL

typedef Matriplex::Matriplex<float, LL, LL, NN> mkfit::MPlexLL

Definition at line 53 of file Matrix.h.

◆ MPlexLS

typedef Matriplex::MatriplexSym<float, LL, NN> mkfit::MPlexLS

Definition at line 55 of file Matrix.h.

◆ MPlexLV

typedef Matriplex::Matriplex<float, LL, 1, NN> mkfit::MPlexLV

Definition at line 54 of file Matrix.h.

◆ MPlexQB

typedef Matriplex::Matriplex<bool, 1, 1, NN> mkfit::MPlexQB

Definition at line 86 of file Matrix.h.

◆ MPlexQF

typedef Matriplex::Matriplex<float, 1, 1, NN> mkfit::MPlexQF

Definition at line 80 of file Matrix.h.

◆ MPlexQH

typedef Matriplex::Matriplex<short, 1, 1, NN> mkfit::MPlexQH

Definition at line 83 of file Matrix.h.

◆ MPlexQHoT

using mkfit::MPlexQHoT = typedef Matriplex::Matriplex<HitOnTrack, 1, 1, NN>

Definition at line 14 of file MkFitter.h.

◆ MPlexQI

typedef Matriplex::Matriplex<int, 1, 1, NN> mkfit::MPlexQI

Definition at line 81 of file Matrix.h.

◆ MPlexQUH

typedef Matriplex::Matriplex<unsigned short, 1, 1, NN> mkfit::MPlexQUH

Definition at line 84 of file Matrix.h.

◆ MPlexQUI

typedef Matriplex::Matriplex<unsigned int, 1, 1, NN> mkfit::MPlexQUI

Definition at line 82 of file Matrix.h.

◆ PairIdx

typedef std::array<int, 2> mkfit::PairIdx

Definition at line 39 of file TrackExtra.h.

◆ PairIdxVec

typedef std::vector<PairIdx> mkfit::PairIdxVec

Definition at line 40 of file TrackExtra.h.

◆ partition_seeds_cf

using mkfit::partition_seeds_cf = typedef void(const TrackerInfo &, const TrackVec &, const EventOfHits &, IterationSeedPartition &)

Definition at line 24 of file FunctionTypes.h.

◆ partition_seeds_func

using mkfit::partition_seeds_func = typedef std::function<partition_seeds_cf>

Definition at line 25 of file FunctionTypes.h.

◆ RedTrackVec

typedef std::vector<ReducedTrack> mkfit::RedTrackVec

Definition at line 35 of file TrackExtra.h.

◆ seedOptsMap

typedef std::map<std::string, std::pair<seedOpts, std::string> > mkfit::seedOptsMap

Definition at line 22 of file ConfigStandalone.h.

◆ SimTkIDInfo

typedef std::pair<int, int> mkfit::SimTkIDInfo

Definition at line 17 of file Track.h.

◆ SMatrix22

typedef ROOT::Math::SMatrix<float, 2> mkfit::SMatrix22

Definition at line 16 of file MatrixSTypes.h.

◆ SMatrix26

typedef ROOT::Math::SMatrix<float, 2, 6> mkfit::SMatrix26

Definition at line 23 of file MatrixSTypes.h.

◆ SMatrix33

typedef ROOT::Math::SMatrix<float, 3> mkfit::SMatrix33

Definition at line 12 of file MatrixSTypes.h.

◆ SMatrix36

typedef ROOT::Math::SMatrix<float, 3, 6> mkfit::SMatrix36

Definition at line 20 of file MatrixSTypes.h.

◆ SMatrix62

typedef ROOT::Math::SMatrix<float, 6, 2> mkfit::SMatrix62

Definition at line 24 of file MatrixSTypes.h.

◆ SMatrix63

typedef ROOT::Math::SMatrix<float, 6, 3> mkfit::SMatrix63

Definition at line 21 of file MatrixSTypes.h.

◆ SMatrix66

typedef ROOT::Math::SMatrix<float, 6> mkfit::SMatrix66

Definition at line 9 of file MatrixSTypes.h.

◆ SMatrixSym22

typedef ROOT::Math::SMatrix<float, 2, 2, ROOT::Math::MatRepSym<float, 2> > mkfit::SMatrixSym22

Definition at line 17 of file MatrixSTypes.h.

◆ SMatrixSym33

typedef ROOT::Math::SMatrix<float, 3, 3, ROOT::Math::MatRepSym<float, 3> > mkfit::SMatrixSym33

Definition at line 13 of file MatrixSTypes.h.

◆ SMatrixSym66

typedef ROOT::Math::SMatrix<float, 6, 6, ROOT::Math::MatRepSym<float, 6> > mkfit::SMatrixSym66

Definition at line 8 of file MatrixSTypes.h.

◆ SVector2

typedef ROOT::Math::SVector<float, 2> mkfit::SVector2

Definition at line 18 of file MatrixSTypes.h.

◆ SVector3

typedef ROOT::Math::SVector<float, 3> mkfit::SVector3

Definition at line 14 of file MatrixSTypes.h.

◆ SVector6

typedef ROOT::Math::SVector<float, 6> mkfit::SVector6

Definition at line 10 of file MatrixSTypes.h.

◆ TkIDToTkIDMap

typedef std::unordered_map<int, int> mkfit::TkIDToTkIDMap

Definition at line 124 of file TrackExtra.h.

◆ TkIDToTkIDVecMap

typedef std::unordered_map<int, std::vector<int> > mkfit::TkIDToTkIDVecMap

Definition at line 125 of file TrackExtra.h.

◆ TkIDToTSLayerPairVecMap

typedef std::unordered_map<int, TSLayerPairVec> mkfit::TkIDToTSLayerPairVecMap

Definition at line 127 of file TrackExtra.h.

◆ TkIDToTSMap

typedef std::unordered_map<int, TrackState> mkfit::TkIDToTSMap

Definition at line 126 of file TrackExtra.h.

◆ TkIDToTSVecVec

typedef std::vector<TSVec> mkfit::TkIDToTSVecVec

Definition at line 119 of file TrackExtra.h.

◆ track_score_cf

using mkfit::track_score_cf = typedef float(const int nfoundhits, const int ntailholes, const int noverlaphits, const int nmisshits, const float chi2, const float pt, const bool inFindCandidates)

Definition at line 39 of file FunctionTypes.h.

◆ track_score_func

using mkfit::track_score_func = typedef std::function<track_score_cf>

Definition at line 40 of file FunctionTypes.h.

◆ TrackExtraVec

typedef std::vector< TrackExtra > mkfit::TrackExtraVec

Definition at line 13 of file MkStandaloneSeqs.h.

◆ TrackVec

typedef std::vector< Track > mkfit::TrackVec

Definition at line 8 of file MkFitOutputWrapper.h.

◆ TrackVecVec

typedef std::vector<TrackVec> mkfit::TrackVecVec

Definition at line 583 of file Track.h.

◆ TripletIdx

typedef std::array<int, 3> mkfit::TripletIdx

Definition at line 41 of file TrackExtra.h.

◆ TripletIdxVec

typedef std::vector<TripletIdx> mkfit::TripletIdxVec

Definition at line 42 of file TrackExtra.h.

◆ TrkIDLaySetMap

typedef std::map<int, std::unordered_set<int> > mkfit::TrkIDLaySetMap

Definition at line 38 of file TrackExtra.h.

◆ TSLayerPairVec

typedef std::vector<std::pair<int, TrackState> > mkfit::TSLayerPairVec

Definition at line 120 of file TrackExtra.h.

◆ TSVec

typedef std::vector<TrackState> mkfit::TSVec

Definition at line 118 of file TrackExtra.h.

Enumeration Type Documentation

◆ cleanOpts

Enumerator
noCleaning 
cleanSeedsN2 
cleanSeedsPure 
cleanSeedsBadLabel 

Definition at line 25 of file ConfigStandalone.h.

◆ KalmanFilterOperation

Enumerator
KFO_Calculate_Chi2 
KFO_Update_Params 
KFO_Local_Cov 

Definition at line 11 of file KalmanUtilsMPlex.h.

◆ matchOpts

Enumerator
trkParamBased 
hitBased 
labelBased 

Definition at line 29 of file ConfigStandalone.h.

◆ PropagationFlagsEnum

Enumerator
PF_none 
PF_use_param_b_field 
PF_apply_material 
PF_copy_input_state_on_fail 

Definition at line 8 of file PropagationConfig.h.

◆ seedOpts

Enumerator
simSeeds 
cmsswSeeds 
findSeeds 

Definition at line 21 of file ConfigStandalone.h.

◆ TkLayout

enum mkfit::TkLayout
strong
Enumerator
phase0 
phase1 
phase2 

Definition at line 8 of file LayerNumberConverter.h.

◆ WithinSensitiveRegion_e

Enumerator
WSR_Undef 
WSR_Inside 
WSR_Edge 
WSR_Outside 
WSR_Failed 

Definition at line 17 of file TrackerInfo.h.

Function Documentation

◆ applyMaterialEffects()

void mkfit::applyMaterialEffects ( const MPlexQF hitsRl,
const MPlexQF hitsXi,
const MPlexQF propSign,
const MPlexHV plNrm,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc 
)

Definition at line 77 of file PropagationMPlexCommon.cc.

References funct::abs(), HLT_2024v14_cff::beta, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), funct::cos(), plot_hgcal_utils::dEdx, MillePedeFileConverter_cfg::e, f, CustomPhysics_cfi::gamma, Exhume::I, CrabHelper::log, WZElectronSkims53X_cff::max, hlt_dqm_clientPB-live_cfg::me, create_idmaps::n, NN, AlCaHLTBitMon_ParallelJobs::p, SiStripOfflineCRack_cfg::p2, DiDispStaMuonMonitor_cfi::pt, funct::sin(), mathSSE::sqrt(), tauSpinnerTable_cfi::theta, mkfit::Config::usePtMultScat, and cms::cuda::wmax.

Referenced by propagateHelixToPlaneMPlex(), propagateHelixToRMPlex(), and propagateHelixToZMPlex().

83  {
84 #pragma omp simd
85  for (int n = 0; n < NN; ++n) {
86  if (n >= N_proc)
87  continue;
88  float radL = hitsRl.constAt(n, 0, 0);
89  if (radL < 1e-13f)
90  continue; //ugly, please fixme
91  const float theta = outPar.constAt(n, 5, 0);
92  // const float pt = 1.f / outPar.constAt(n, 3, 0); //fixme, make sure it is positive?
93  const float ipt = outPar.constAt(n, 3, 0);
94  const float pt = 1.f / ipt; //fixme, make sure it is positive?
95  const float ipt2 = ipt * ipt;
96  const float p = pt / std::sin(theta);
97  const float pz = p * std::cos(theta);
98  const float p2 = p * p;
99  constexpr float mpi = 0.140; // m=140 MeV, pion
100  constexpr float mpi2 = mpi * mpi; // m=140 MeV, pion
101  const float beta2 = p2 / (p2 + mpi2);
102  const float beta = std::sqrt(beta2);
103  //radiation lenght, corrected for the crossing angle (cos alpha from dot product of radius vector and momentum)
104  const float invCos =
105  p / std::abs(pt * std::cos(outPar.constAt(n, 4, 0)) * plNrm.constAt(n, 0, 0) +
106  pt * std::sin(outPar.constAt(n, 4, 0)) * plNrm.constAt(n, 1, 0) + pz * plNrm.constAt(n, 2, 0));
107  radL = radL * invCos; //fixme works only for barrel geom
108  // multiple scattering
109  //vary independently phi and theta by the rms of the planar multiple scattering angle
110  // XXX-KMD radL < 0, see your fixme above! Repeating bailout
111  if (radL < 1e-13f)
112  continue;
113  // const float thetaMSC = 0.0136f*std::sqrt(radL)*(1.f+0.038f*std::log(radL))/(beta*p);// eq 32.15
114  // const float thetaMSC2 = thetaMSC*thetaMSC;
115  const float thetaMSC = 0.0136f * (1.f + 0.038f * std::log(radL)) / (beta * p); // eq 32.15
116  const float thetaMSC2 = thetaMSC * thetaMSC * radL;
117  if /*constexpr*/ (Config::usePtMultScat) {
118  outErr.At(n, 3, 3) += thetaMSC2 * pz * pz * ipt2 * ipt2;
119  outErr.At(n, 3, 5) -= thetaMSC2 * pz * ipt2;
120  outErr.At(n, 4, 4) += thetaMSC2 * p2 * ipt2;
121  outErr.At(n, 5, 5) += thetaMSC2;
122  } else {
123  outErr.At(n, 4, 4) += thetaMSC2;
124  outErr.At(n, 5, 5) += thetaMSC2;
125  }
126  //std::cout << "beta=" << beta << " p=" << p << std::endl;
127  //std::cout << "multiple scattering thetaMSC=" << thetaMSC << " thetaMSC2=" << thetaMSC2 << " radL=" << radL << std::endl;
128  //std::cout << "radL=" << hitsRl.constAt(n, 0, 0) << " beta=" << beta << " invCos=" << invCos << " radLCorr=" << radL << " thetaMSC=" << thetaMSC << " thetaMSC2=" << thetaMSC2 << std::endl;
129  // energy loss
130  // XXX-KMD beta2 = 1 => 1 / sqrt(0)
131  // const float gamma = 1.f/std::sqrt(1.f - std::min(beta2, 0.999999f));
132  // const float gamma2 = gamma*gamma;
133  const float gamma2 = (p2 + mpi2) / mpi2;
134  const float gamma = std::sqrt(gamma2); //1.f/std::sqrt(1.f - std::min(beta2, 0.999999f));
135  constexpr float me = 0.0005; // m=0.5 MeV, electron
136  const float wmax = 2.f * me * beta2 * gamma2 / (1.f + 2.f * gamma * me / mpi + me * me / (mpi * mpi));
137  constexpr float I = 16.0e-9 * 10.75;
138  const float deltahalf = std::log(28.816e-9f * std::sqrt(2.33f * 0.498f) / I) + std::log(beta * gamma) - 0.5f;
139  const float dEdx =
140  beta < 1.f
141  ? (2.f * (hitsXi.constAt(n, 0, 0) * invCos *
142  (0.5f * std::log(2.f * me * beta2 * gamma2 * wmax / (I * I)) - beta2 - deltahalf) / beta2))
143  : 0.f; //protect against infs and nans
144  // dEdx = dEdx*2.;//xi in cmssw is defined with an extra factor 0.5 with respect to formula 27.1 in pdg
145  //std::cout << "dEdx=" << dEdx << " delta=" << deltahalf << " wmax=" << wmax << " Xi=" << hitsXi.constAt(n,0,0) << std::endl;
146  const float dP = propSign.constAt(n, 0, 0) * dEdx / beta;
147  outPar.At(n, 3, 0) = p / (std::max(p - dP, 0.001f) * pt); //stay above 1MeV
148  //assume 100% uncertainty
149  outErr.At(n, 3, 3) += dP * dP / (p2 * pt * pt);
150  }
151  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:23
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const std::complex< double > I
Definition: I.h:8
double f[11][100]
bool usePtMultScat
Definition: Config.cc:8
__host__ __device__ V V wmax

◆ calculateCharge() [1/2]

int mkfit::calculateCharge ( const Hit hit0,
const Hit hit1,
const Hit hit2 
)
inline

Definition at line 21 of file Track.h.

References mkfit::Hit::x(), and mkfit::Hit::y().

21  {
22  return ((hit2.y() - hit0.y()) * (hit2.x() - hit1.x()) > (hit2.y() - hit1.y()) * (hit2.x() - hit0.x()) ? 1 : -1);
23  }

◆ calculateCharge() [2/2]

int mkfit::calculateCharge ( const float  hit0_x,
const float  hit0_y,
const float  hit1_x,
const float  hit1_y,
const float  hit2_x,
const float  hit2_y 
)
inline

Definition at line 25 of file Track.h.

30  {
31  return ((hit2_y - hit0_y) * (hit2_x - hit1_x) > (hit2_y - hit1_y) * (hit2_x - hit0_x) ? 1 : -1);
32  }

◆ cdist()

float mkfit::cdist ( float  a)
inline

Definition at line 33 of file Config.h.

References a, mkfit::Const::PI, and mkfit::Const::TwoPI.

Referenced by mkfit::Event::clean_cms_seedtracks(), mkfit::StdSeq::clean_cms_seedtracks_iter(), mkfit::MkFinder::selectHitIndices(), and mkfit::MkFinder::selectHitIndicesV2().

33 { return a > Const::PI ? Const::TwoPI - a : a; }
constexpr float TwoPI
Definition: Config.h:8
constexpr float PI
Definition: Config.h:7
double a
Definition: hdecay.h:121

◆ CFMap()

void mkfit::CFMap ( const MPlexHH A,
const MPlexHV B,
MPlexHV C 
)
inline

Definition at line 89 of file ConformalUtilsMPlex.cc.

References A, a, ASSUME_ALIGNED, B, b, correctionTermsCaloMet_cff::C, DummyCfis::c, N, and NN.

Referenced by conformalFitMPlex().

89  {
90  using idx_t = Matriplex::idx_t;
91 
92  // C = A * B, C is 3x1, A is 3x3 , B is 3x1
93 
94  typedef float T;
95  typedef float Tv;
96  const idx_t N = NN;
97 
98  const T* a = A.fArray;
99  ASSUME_ALIGNED(a, 64);
100  const Tv* b = B.fArray;
101  ASSUME_ALIGNED(b, 64);
102  Tv* c = C.fArray;
103  ASSUME_ALIGNED(c, 64);
104 
105 #include "RecoTracker/MkFitCore/standalone/CFMatrix33Vector3.ah"
106  }
Definition: APVGainStruct.h:7
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
#define N
Definition: blowfish.cc:9
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
Definition: APVGainStruct.h:7
long double T
#define ASSUME_ALIGNED(a, b)

◆ computeHelixChi2()

template<typename Vector , typename Matrix >
float mkfit::computeHelixChi2 ( const Vector simV,
const Vector recoV,
const Matrix &  recoM,
const bool  diagOnly = false 
)

Definition at line 638 of file Track.h.

References diagonalOnly(), and squashPhiGeneral().

Referenced by mkfit::TrackExtra::setCMSSWTrackIDInfoByHits(), and mkfit::TrackExtra::setCMSSWTrackIDInfoByTrkParams().

638  {
639  Vector diffV = recoV - simV;
640  if (diffV.kSize > 2)
641  squashPhiGeneral(diffV);
642 
643  Matrix recoM_tmp = recoM;
644  if (diagOnly)
645  diagonalOnly(recoM_tmp);
646  int invFail(0);
647  const Matrix recoMI = recoM_tmp.InverseFast(invFail);
648 
649  return ROOT::Math::Dot(diffV * recoMI, diffV) / (diffV.kSize - 1);
650  }
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
void squashPhiGeneral(Vector &v)
Definition: Track.h:631
portabletest::Matrix Matrix

◆ conformalFitMPlex()

void mkfit::conformalFitMPlex ( bool  fitting,
MPlexQI  seedID,
MPlexLS outErr,
MPlexLV outPar,
const MPlexHV msPar0,
const MPlexHV msPar1,
const MPlexHV msPar2 
)

Definition at line 111 of file ConformalUtilsMPlex.cc.

References A, a, funct::abs(), b, mkfit::Config::Bfield, correctionTermsCaloMet_cff::C, CFMap(), dcall, debug, dprint, dprintf, f, g_debug, getPhi(), getRad2(), getTheta(), hipo(), mps_fire::i, Matriplex::invertCramer(), dqmiolumiharvest::j, isotrackApplyRegressor::k, N, create_idmaps::n, NN, mkfit::TrackState::parameters, mkfit::Config::phierr012, mkfit::Config::phierr049, mkfit::Const::PI3Over4, mkfit::Const::PIOver4, print(), pv::pT, mkfit::Config::ptinverr012, mkfit::Config::ptinverr049, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, diffTwoXMLs::r2, mkfit::Const::sol, mkfit::Config::thetaerr012, mkfit::Config::thetaerr049, findQualityFiles::v, mkfit::Config::varR, mkfit::Config::varXY, mkfit::Config::varZ, and x.

117  {
118  bool debug(false);
119 
120  using idx_t = Matriplex::idx_t;
121  const idx_t N = NN;
122 
123  // Store positions in mplex vectors... could consider storing in a 3x3 matrix, too
124  MPlexHV x, y, z, r2;
125 #pragma omp simd
126  for (int n = 0; n < N; ++n) {
127  x.At(n, 0, 0) = msPar0.constAt(n, 0, 0);
128  x.At(n, 1, 0) = msPar1.constAt(n, 0, 0);
129  x.At(n, 2, 0) = msPar2.constAt(n, 0, 0);
130 
131  y.At(n, 0, 0) = msPar0.constAt(n, 1, 0);
132  y.At(n, 1, 0) = msPar1.constAt(n, 1, 0);
133  y.At(n, 2, 0) = msPar2.constAt(n, 1, 0);
134 
135  z.At(n, 0, 0) = msPar0.constAt(n, 2, 0);
136  z.At(n, 1, 0) = msPar1.constAt(n, 2, 0);
137  z.At(n, 2, 0) = msPar2.constAt(n, 2, 0);
138 
139  for (int i = 0; i < 3; ++i) {
140  r2.At(n, i, 0) = getRad2(x.constAt(n, i, 0), y.constAt(n, i, 0));
141  }
142  }
143 
144  // Start setting the output parameters
145 #pragma omp simd
146  for (int n = 0; n < N; ++n) {
147  outPar.At(n, 0, 0) = x.constAt(n, 0, 0);
148  outPar.At(n, 1, 0) = y.constAt(n, 0, 0);
149  outPar.At(n, 2, 0) = z.constAt(n, 0, 0);
150  }
151 
152  // Use r-phi smearing to set initial error estimation for positions
153  // trackStates already initialized to identity for seeding ... don't store off-diag 0's, zero's for fitting set outside CF
154 #pragma omp simd
155  for (int n = 0; n < N; ++n) {
156  const float varPhi = Config::varXY / r2.constAt(n, 0, 0);
157  const float invvarR2 = Config::varR / r2.constAt(n, 0, 0);
158 
159  outErr.At(n, 0, 0) =
160  x.constAt(n, 0, 0) * x.constAt(n, 0, 0) * invvarR2 + y.constAt(n, 0, 0) * y.constAt(n, 0, 0) * varPhi;
161  outErr.At(n, 0, 1) = x.constAt(n, 0, 0) * y.constAt(n, 0, 0) * (invvarR2 - varPhi);
162 
163  outErr.At(n, 1, 0) = outErr.constAt(n, 0, 1);
164  outErr.At(n, 1, 1) =
165  y.constAt(n, 0, 0) * y.constAt(n, 0, 0) * invvarR2 + x.constAt(n, 0, 0) * x.constAt(n, 0, 0) * varPhi;
166 
167  outErr.At(n, 2, 2) = Config::varZ;
168  }
169 
170  MPlexQF initPhi;
171  MPlexQI xtou; // bool to determine "split space", i.e. map x to u or v
172 #pragma omp simd
173  for (int n = 0; n < N; ++n) {
174  initPhi.At(n, 0, 0) = std::abs(getPhi(x.constAt(n, 0, 0), y.constAt(n, 0, 0)));
175  xtou.At(n, 0, 0) =
176  ((initPhi.constAt(n, 0, 0) < Const::PIOver4 || initPhi.constAt(n, 0, 0) > Const::PI3Over4) ? 1 : 0);
177  }
178 
179  MPlexHV u, v;
180 #pragma omp simd
181  for (int n = 0; n < N; ++n) {
182  if (xtou.At(n, 0, 0)) // x mapped to u
183  {
184  for (int i = 0; i < 3; ++i) {
185  u.At(n, i, 0) = x.constAt(n, i, 0) / r2.constAt(n, i, 0);
186  v.At(n, i, 0) = y.constAt(n, i, 0) / r2.constAt(n, i, 0);
187  }
188  } else // x mapped to v
189  {
190  for (int i = 0; i < 3; ++i) {
191  u.At(n, i, 0) = y.constAt(n, i, 0) / r2.constAt(n, i, 0);
192  v.At(n, i, 0) = x.constAt(n, i, 0) / r2.constAt(n, i, 0);
193  }
194  }
195  }
196 
197  MPlexHH A;
198  //#pragma omp simd // triggers an internal compiler error with icc 18.0.2!
199  for (int n = 0; n < N; ++n) {
200  for (int i = 0; i < 3; ++i) {
201  A.At(n, i, 0) = 1.0f;
202  A.At(n, i, 1) = -u.constAt(n, i, 0);
203  A.At(n, i, 2) = -u.constAt(n, i, 0) * u.constAt(n, i, 0);
204  }
205  }
207  MPlexHV C;
208  CFMap(A, v, C);
209 
210  MPlexQF a, b;
211 #pragma omp simd
212  for (int n = 0; n < N; ++n) {
213  b.At(n, 0, 0) = 1.0f / (2.0f * C.constAt(n, 0, 0));
214  a.At(n, 0, 0) = b.constAt(n, 0, 0) * C.constAt(n, 1, 0);
215  }
216 
217  // constant used throughtout
218  const float k = (Const::sol * Config::Bfield) / 100.0f;
219 
220  MPlexQF vrx, vry, pT, px, py, pz;
221 #pragma omp simd
222  for (int n = 0; n < N; ++n) {
223  vrx.At(n, 0, 0) =
224  (xtou.constAt(n, 0, 0) ? x.constAt(n, 0, 0) - a.constAt(n, 0, 0) : x.constAt(n, 0, 0) - b.constAt(n, 0, 0));
225  vry.At(n, 0, 0) =
226  (xtou.constAt(n, 0, 0) ? y.constAt(n, 0, 0) - b.constAt(n, 0, 0) : y.constAt(n, 0, 0) - a.constAt(n, 0, 0));
227  pT.At(n, 0, 0) = k * hipo(vrx.constAt(n, 0, 0), vry.constAt(n, 0, 0));
228  px.At(n, 0, 0) = std::copysign(k * vry.constAt(n, 0, 0), x.constAt(n, 2, 0) - x.constAt(n, 0, 0));
229  py.At(n, 0, 0) = std::copysign(k * vrx.constAt(n, 0, 0), y.constAt(n, 2, 0) - y.constAt(n, 0, 0));
230  pz.At(n, 0, 0) = (pT.constAt(n, 0, 0) * (z.constAt(n, 2, 0) - z.constAt(n, 0, 0))) /
231  hipo((x.constAt(n, 2, 0) - x.constAt(n, 0, 0)), (y.constAt(n, 2, 0) - y.constAt(n, 0, 0)));
232  }
233 
234 #pragma omp simd
235  for (int n = 0; n < N; ++n) {
236  outPar.At(n, 3, 0) = 1.0f / pT.constAt(n, 0, 0);
237  outPar.At(n, 4, 0) = getPhi(px.constAt(n, 0, 0), py.constAt(n, 0, 0));
238  outPar.At(n, 5, 0) = getTheta(pT.constAt(n, 0, 0), pz.constAt(n, 0, 0));
239 #ifdef INWARDFIT // arctan is odd, so pz -> -pz means theta -> -theta
240  if (fitting)
241  outPar.At(n, 5, 0) *= -1.0f;
242 #endif
243  }
244 
245 #pragma omp simd
246  for (int n = 0; n < N; ++n) {
247  outErr.At(n, 3, 3) =
249  outErr.At(n, 4, 4) = (fitting ? Config::phierr049 * Config::phierr049 : Config::phierr012 * Config::phierr012);
250  outErr.At(n, 5, 5) =
252  }
253 
254  if (debug && g_debug) {
255  for (int n = 0; n < N; ++n) {
256  dprintf("afterCF seedID: %1u \n", seedID.constAt(n, 0, 0));
257  // do a dumb copy out
258  TrackState updatedState;
259  for (int i = 0; i < 6; i++) {
260  updatedState.parameters[i] = outPar.constAt(n, i, 0);
261  for (int j = 0; j < 6; j++) {
262  updatedState.errors[i][j] = outErr.constAt(n, i, j);
263  }
264  }
265 
266  dcall(print("CCS", updatedState));
267  updatedState.convertFromCCSToCartesian();
268  dcall(print("Pol", updatedState));
269  dprint("--------------------------------");
270  }
271  }
272  }
Matriplex::Matriplex< float, HH, HH, NN > MPlexHH
Definition: Matrix.h:57
Matriplex::Matriplex< float, HH, 1, NN > MPlexHV
Definition: Matrix.h:58
float getTheta(float r, float z)
Definition: Hit.h:36
constexpr float phierr012
constexpr float thetaerr049
#define dcall(x)
Definition: Debug.h:97
bool g_debug
Definition: Debug.cc:2
constexpr float varZ
constexpr float varR
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
constexpr float Bfield
Definition: Config.h:60
float getRad2(float x, float y)
Definition: Hit.h:30
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr float ptinverr049
double f[11][100]
Matriplex::Matriplex< int, 1, 1, NN > MPlexQI
Definition: Matrix.h:81
constexpr float thetaerr012
#define debug
Definition: HDRShower.cc:19
constexpr float sol
Definition: Config.h:13
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
#define N
Definition: blowfish.cc:9
void invertCramer(MPlex< T, D, D, N > &A, double *determ=nullptr)
Definition: Matriplex.h:965
float hipo(float x, float y)
Definition: Matrix.h:9
double b
Definition: hdecay.h:120
float getPhi(float x, float y)
Definition: Hit.h:34
#define dprint(x)
Definition: Debug.h:95
constexpr float varXY
double a
Definition: hdecay.h:121
constexpr float phierr049
void CFMap(const MPlexHH &A, const MPlexHV &B, MPlexHV &C)
float x
Definition: APVGainStruct.h:7
constexpr float PI3Over4
Definition: Config.h:11
constexpr float ptinverr012
#define dprintf(...)
Definition: Debug.h:98
constexpr float PIOver4
Definition: Config.h:10

◆ convertHits()

template<typename Traits , typename HitCollection >
edm::ProductID mkfit::convertHits ( const Traits &  traits,
const HitCollection hits,
mkfit::HitVec mkFitHits,
std::vector< TrackingRecHit const *> &  clusterIndexToHit,
std::vector< float > &  clusterChargeVec,
const TrackerTopology ttopo,
const TransientTrackingRecHitBuilder ttrhBuilder,
const MkFitGeometry mkFitGeom 
)

Definition at line 25 of file convertHits.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), ALCARECOPPSCalTrackBasedSel_cff::detid, submitPVResolutionJobs::err, Exception, f, hfClusterShapes_cfi::hits, edm::ProductID::id(), TrackerTopology::isStereo(), TrackerTopology::layer(), LogTrace, MkFitGeometry::mkFitLayerNumber(), MkFitGeometry::uniqueIdInLayer(), and UNLIKELY.

Referenced by MkFitSiPixelHitConverter::produce(), MkFitPhase2HitConverter::produce(), and MkFitSiStripHitConverter::produce().

32  {
33  if (hits.empty())
34  return edm::ProductID{};
35 
36  edm::ProductID clusterID;
37  {
38  const auto& lastClusterRef = hits.data().back().firstClusterRef();
39  clusterID = lastClusterRef.id();
40  if (lastClusterRef.index() >= mkFitHits.size()) {
41  auto const size = lastClusterRef.index();
42  mkFitHits.resize(size);
43  clusterIndexToHit.resize(size, nullptr);
44  if constexpr (Traits::applyCCC()) {
45  clusterChargeVec.resize(size, -1.f);
46  }
47  }
48  }
49 
50  for (const auto& detset : hits) {
51  const DetId detid = detset.detId();
52  const auto ilay = mkFitGeom.mkFitLayerNumber(detid);
53 
54  for (const auto& hit : detset) {
55  const auto charge = traits.clusterCharge(hit, detid);
56  if (!traits.passCCC(charge))
57  continue;
58 
59  const auto& gpos = hit.globalPosition();
60  SVector3 pos(gpos.x(), gpos.y(), gpos.z());
61  const auto& gerr = hit.globalPositionError();
63  err.At(0, 0) = gerr.cxx();
64  err.At(1, 1) = gerr.cyy();
65  err.At(2, 2) = gerr.czz();
66  err.At(0, 1) = gerr.cyx();
67  err.At(0, 2) = gerr.czx();
68  err.At(1, 2) = gerr.czy();
69 
70  auto clusterRef = hit.firstClusterRef();
71  if UNLIKELY (clusterRef.id() != clusterID) {
72  throw cms::Exception("LogicError")
73  << "Input hit collection has Refs to many cluster collections. Last hit had Ref to product " << clusterID
74  << ", but encountered Ref to product " << clusterRef.id() << " on detid " << detid.rawId();
75  }
76  const auto clusterIndex = clusterRef.index();
77  LogTrace("MkFitHitConverter") << "Adding hit detid " << detid.rawId() << " subdet " << detid.subdetId()
78  << " layer " << ttopo.layer(detid) << " isStereo " << ttopo.isStereo(detid)
79  << " zplus "
80  << " index " << clusterIndex << " ilay " << ilay;
81 
82  if UNLIKELY (clusterIndex >= mkFitHits.size()) {
83  mkFitHits.resize(clusterIndex + 1);
84  clusterIndexToHit.resize(clusterIndex + 1, nullptr);
85  if constexpr (Traits::applyCCC()) {
86  clusterChargeVec.resize(clusterIndex + 1, -1.f);
87  }
88  }
89  mkFitHits[clusterIndex] = mkfit::Hit(pos, err);
90  clusterIndexToHit[clusterIndex] = &hit;
91  if constexpr (Traits::applyCCC()) {
92  clusterChargeVec[clusterIndex] = charge;
93  }
94 
95  const auto uniqueIdInLayer = mkFitGeom.uniqueIdInLayer(ilay, detid.rawId());
96  traits.setDetails(mkFitHits[clusterIndex], *(hit.cluster()), uniqueIdInLayer, charge);
97  }
98  }
99  return clusterID;
100  }
size
Write out results.
unsigned int uniqueIdInLayer(int layer, unsigned int detId) const
Definition: MkFitGeometry.h:38
bool isStereo(const DetId &id) const
unsigned int layer(const DetId &id) const
#define LogTrace(id)
double f[11][100]
SeedingHitSet::ConstRecHitPointer Hit
ProductIndex id() const
Definition: ProductID.h:35
Definition: DetId.h:17
int mkFitLayerNumber(DetId detId) const
#define UNLIKELY(x)
Definition: Likely.h:21
ROOT::Math::SVector< double, 3 > SVector3
Definition: V0Fitter.cc:47
ROOT::Math::SMatrix< float, 3, 3, ROOT::Math::MatRepSym< float, 3 > > SMatrixSym33
Definition: MatrixSTypes.h:13

◆ cube()

template<typename T >
T mkfit::cube ( T  x)
inline

Definition at line 18 of file Hit.h.

References x.

Referenced by getInvRadErr2().

18  {
19  return x * x * x;
20  }
float x

◆ diagonalOnly()

template<typename Matrix >
void mkfit::diagonalOnly ( Matrix &  m)
inline

Definition at line 27 of file MatrixSTypes.h.

References DummyCfis::c, and visualization-live-secondInstance_cfg::m.

Referenced by computeHelixChi2().

27  {
28  for (int r = 0; r < m.kRows; r++) {
29  for (int c = 0; c < m.kCols; c++) {
30  if (r != c)
31  m[r][c] = 0.f;
32  }
33  }
34  }

◆ dtime()

double mkfit::dtime ( )
inline

◆ dumpMatrix()

template<typename Matrix >
void mkfit::dumpMatrix ( Matrix  m)

Definition at line 37 of file MatrixSTypes.h.

References DummyCfis::c, gather_cfg::cout, and visualization-live-secondInstance_cfg::m.

Referenced by print().

37  {
38  for (int r = 0; r < m.kRows; ++r) {
39  for (int c = 0; c < m.kCols; ++c) {
40  std::cout << std::setw(12) << m.At(r, c) << " ";
41  }
42  std::cout << std::endl;
43  }
44  }

◆ evsi2ssinfo()

SimSeedInfo mkfit::evsi2ssinfo ( const Event ev,
int  seed_idx 
)

Definition at line 29 of file RntConversions.h.

References makeMEIFBenchmarkPlots::ev, SimSeedInfo::has_sim, mkfit::Event::SimLabelFromHits::is_set(), mkfit::Event::SimLabelFromHits::label, SimSeedInfo::n_hits, mkfit::Event::SimLabelFromHits::n_hits, SimSeedInfo::n_match, mkfit::Event::SimLabelFromHits::n_match, SimSeedInfo::s_seed, SimSeedInfo::s_sim, fileCollector::seed, SimSeedInfo::seed_idx, SimSeedInfo::seed_lbl, SimSeedInfo::sim_lbl, and track2state().

29  {
30  SimSeedInfo ssi;
31  Event::SimLabelFromHits slfh = ev->simLabelForCurrentSeed(seed_idx);
32  if (slfh.is_set()) {
33  ssi.s_sim = track2state(ev->simTracks_[slfh.label]);
34  ssi.sim_lbl = slfh.label;
35  ssi.n_hits = slfh.n_hits;
36  ssi.n_match = slfh.n_match;
37  ssi.has_sim = true;
38  }
39  auto seed = ev->currentSeed(seed_idx);
40  ssi.s_seed = track2state(seed);
41  ssi.seed_lbl = seed.label();
42  ssi.seed_idx = seed_idx;
43  return ssi;
44  }
int seed_lbl
Definition: RntStructs.h:50
bool has_sim
Definition: RntStructs.h:52
State track2state(const TrackBase &s)
State s_sim
Definition: RntStructs.h:48
int seed_idx
Definition: RntStructs.h:50
State s_seed
Definition: RntStructs.h:49

◆ execTrackerInfoCreatorPlugin()

void mkfit::execTrackerInfoCreatorPlugin ( const std::string &  base,
TrackerInfo ti,
IterationsInfo ii,
bool  verbose 
)

Definition at line 92 of file ConfigStandalone.cc.

References edmMakeDummyCfis::base, beamvalidation::exit(), custom_jme_cff::foo, h, cuy::ii, EnsembleCalibrationLA_cfg::path, mkfit::TrackerInfo::read_bin_file(), edm_modernize_messagelogger::stat, submitPVResolutionJobs::stderr, AlCaHLTBitMon_QueryRunRegistry::string, and verbose.

Referenced by initGeom().

92  {
93  const std::string soname = base + ".so";
94  const std::string binname = base + ".bin";
95  struct stat st;
96 
97  int si = 0;
98  while (search_path[si]) {
100  const char *envpath = std::getenv("MKFIT_BASE");
101  if (envpath != nullptr) {
102  path += envpath;
103  path += "/";
104  }
105  path += search_path[si];
106  std::string sopath = path + soname;
107  if (stat(sopath.c_str(), &st) == 0) {
108  printf("execTrackerInfoCreatorPlugin processing '%s'\n", sopath.c_str());
109 
110  void *h = dlopen(sopath.c_str(), RTLD_LAZY);
111  if (!h) {
112  perror("dlopen failed");
113  fprintf(stderr, "dlerror:\n%s\n", dlerror());
114  exit(2);
115  }
116 
117  long long *p2f = (long long *)dlsym(h, "TrackerInfoCreator_ptr");
118  if (!p2f) {
119  perror("dlsym failed");
120  exit(2);
121  }
122 
123  std::string binpath = path + binname;
124  int binsr = stat(binpath.c_str(), &st);
125  printf("execTrackerInfoCreatorPlugin has%s found TrackerInfo binary file '%s'\n",
126  binsr ? " NOT" : "",
127  binpath.c_str());
128  if (binsr == 0)
129  ti.read_bin_file(binpath);
130 
131  TrackerInfoCreator_foo foo = (TrackerInfoCreator_foo)(*p2f);
132  foo(ti, ii, verbose);
133 
134  // level 2: print shapes and modules, precision 8
135  // ti.print_tracker(2, 8);
136 
137  return;
138  }
139 
140  ++si;
141  }
142 
143  fprintf(stderr, "TrackerInfo plugin '%s' not found in search path.\n", soname.c_str());
144  exit(2);
145  }
bool verbose
ii
Definition: cuy.py:589
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
def exit(msg="")

◆ findSeedsByRoadSearch()

void mkfit::findSeedsByRoadSearch ( TripletIdxConVec &  seed_idcs,
std::vector< LayerOfHits > &  evt_lay_hits,
int  lay1_size,
Event *&  ev 
)

Definition at line 34 of file seedtestMPlex.cc.

References a, funct::abs(), b, debug, mkfit::Config::dEtaSeedTrip, dprint, makeMEIFBenchmarkPlots::ev, JetChargeProducer_cfi::exp, f, getHypot(), getPhi(), getRad2(), mps_fire::i, heavyIonCSV_trainingSettings::idx, intersectThirdLayer(), mkfit::Config::lay01angdiff, WZElectronSkims53X_cff::max, mkfit::Config::maxCurvR, mkfit::Hit::mcTrackID(), HLTObjectMonitor_cfi::mr, TtSemiLepEvtBuilder_cfi::mt, mkfit::Config::numHitsPerTask, mkfit::Hit::phi(), mkfit::LayerOfHits::refHit(), mkfit::Config::seed_d0cut, mkfit::Config::seed_z0cut, mkfit::Config::seed_z1cut, mathSSE::sqrt(), funct::tan(), mkfit::Hit::x(), mkfit::Hit::y(), and mkfit::Hit::z().

37  {
38 #ifdef DEBUG
39  bool debug(false);
40 #endif
41 
42  // MIMI hack: Config::nlayers_per_seed = 4
43  // const float seed_z2cut = (Config::nlayers_per_seed * Config::fRadialSpacing) / std::tan(2.0f*std::atan(std::exp(-1.0f*Config::dEtaSeedTrip)));
44 #ifdef DEBUG
45  const float seed_z2cut =
46  (4 * Config::fRadialSpacing) / std::tan(2.0f * std::atan(std::exp(-1.0f * Config::dEtaSeedTrip)));
47 #endif
48 
49  // 0 = first layer, 1 = second layer, 2 = third layer
50  const LayerOfHits& lay1_hits = evt_lay_hits[1];
51  LayerOfHits& lay0_hits = evt_lay_hits[0];
52  LayerOfHits& lay2_hits = evt_lay_hits[2];
53 
54  tbb::parallel_for(
55  tbb::blocked_range<int>(0, lay1_size, std::max(1, Config::numHitsPerTask)),
56  [&](const tbb::blocked_range<int>& i) {
57  TripletIdxVec temp_thr_seed_idcs;
58  for (int ihit1 = i.begin(); ihit1 < i.end(); ++ihit1) {
59  const Hit& hit1 = lay1_hits.refHit(ihit1);
60  const float hit1_z = hit1.z();
61 
62  dprint("ihit1: " << ihit1 << " mcTrackID: " << hit1.mcTrackID(ev->simHitsInfo_) << " phi: " << hit1.phi()
63  << " z: " << hit1.z());
64  dprint(" predphi: " << hit1.phi() << "+/-" << Config::lay01angdiff << " predz: " << hit1.z() / 2.0f << "+/-"
65  << Config::seed_z0cut / 2.0f << std::endl);
66 
67  std::vector<int> cand_hit0_indices; // pass by reference
68  // MIMI lay0_hits.selectHitIndices(hit1_z/2.0f,hit1.phi(),Config::seed_z0cut/2.0f,Config::lay01angdiff,cand_hit0_indices,true,false);
69  // loop over first layer hits
70  for (auto&& ihit0 : cand_hit0_indices) {
71  const Hit& hit0 = lay0_hits.refHit(ihit0);
72  const float hit0_z = hit0.z();
73  const float hit0_x = hit0.x();
74  const float hit0_y = hit0.y();
75  const float hit1_x = hit1.x();
76  const float hit1_y = hit1.y();
77  const float hit01_r2 = getRad2(hit0_x - hit1_x, hit0_y - hit1_y);
78 
79  const float quad = std::sqrt((4.0f * Config::maxCurvR * Config::maxCurvR - hit01_r2) / hit01_r2);
80 
81  // center of negative curved track
82  const float aneg = 0.5f * ((hit0_x + hit1_x) - (hit0_y - hit1_y) * quad);
83  const float bneg = 0.5f * ((hit0_y + hit1_y) + (hit0_x - hit1_x) * quad);
84 
85  // negative points of intersection with third layer
86  float lay2_negx = 0.0f, lay2_negy = 0.0f;
87  intersectThirdLayer(aneg, bneg, hit1_x, hit1_y, lay2_negx, lay2_negy);
88 #ifdef DEBUG
89  const float lay2_negphi = getPhi(lay2_negx, lay2_negy);
90 #endif
91 
92  // center of positive curved track
93  const float apos = 0.5f * ((hit0_x + hit1_x) + (hit0_y - hit1_y) * quad);
94  const float bpos = 0.5f * ((hit0_y + hit1_y) - (hit0_x - hit1_x) * quad);
95 
96  // positive points of intersection with third layer
97  float lay2_posx = 0.0f, lay2_posy = 0.0f;
98  intersectThirdLayer(apos, bpos, hit1_x, hit1_y, lay2_posx, lay2_posy);
99 #ifdef DEBUG
100  const float lay2_posphi = getPhi(lay2_posx, lay2_posy);
101 #endif
102 
103  std::vector<int> cand_hit2_indices;
104  // MIMI lay2_hits.selectHitIndices((2.0f*hit1_z-hit0_z),(lay2_posphi+lay2_negphi)/2.0f,
105  // MIMI seed_z2cut,(lay2_posphi-lay2_negphi)/2.0f,
106  // MIMI cand_hit2_indices,true,false);
107 
108  dprint(" ihit0: " << ihit0 << " mcTrackID: " << hit0.mcTrackID(ev->simHitsInfo_) << " phi: " << hit0.phi()
109  << " z: " << hit0.z());
110  dprint(" predphi: " << (lay2_posphi + lay2_negphi) / 2.0f << "+/-" << (lay2_posphi - lay2_negphi) / 2.0f
111  << " predz: " << 2.0f * hit1_z - hit0_z << "+/-" << seed_z2cut << std::endl);
112 
113  // loop over candidate third layer hits
114  //temp_thr_seed_idcs.reserve(temp_thr_seed_idcs.size()+cand_hit2_indices.size());
115 #pragma omp simd
116  for (size_t idx = 0; idx < cand_hit2_indices.size(); ++idx) {
117  const int ihit2 = cand_hit2_indices[idx];
118  const Hit& hit2 = lay2_hits.refHit(ihit2);
119 
120  const float lay1_predz = (hit0_z + hit2.z()) / 2.0f;
121  // filter by residual of second layer hit
122  if (std::abs(lay1_predz - hit1_z) > Config::seed_z1cut)
123  continue;
124 
125  const float hit2_x = hit2.x();
126  const float hit2_y = hit2.y();
127 
128  // now fit a circle, extract pT and d0 from center and radius
129  const float mr = (hit1_y - hit0_y) / (hit1_x - hit0_x);
130  const float mt = (hit2_y - hit1_y) / (hit2_x - hit1_x);
131  const float a = (mr * mt * (hit2_y - hit0_y) + mr * (hit1_x + hit2_x) - mt * (hit0_x + hit1_x)) /
132  (2.0f * (mr - mt));
133  const float b = -1.0f * (a - (hit0_x + hit1_x) / 2.0f) / mr + (hit0_y + hit1_y) / 2.0f;
134  const float r = getHypot(hit0_x - a, hit0_y - b);
135 
136  // filter by d0 cut 5mm, pT cut 0.5 GeV (radius of 0.5 GeV track)
138  continue;
139 
140  dprint(" ihit2: " << ihit2 << " mcTrackID: " << hit2.mcTrackID(ev->simHitsInfo_)
141  << " phi: " << hit2.phi() << " z: " << hit2.z());
142 
143  temp_thr_seed_idcs.emplace_back(TripletIdx{{ihit0, ihit1, ihit2}});
144  } // end loop over third layer matches
145  } // end loop over first layer matches
146  } // end chunk of hits for parallel for
147  seed_idcs.grow_by(temp_thr_seed_idcs.begin(), temp_thr_seed_idcs.end());
148  }); // end parallel for loop over second layer hits
149  }
constexpr float dEtaSeedTrip
double z
global z - AlignmentGeometry::z0, mm
Definition: HitCollection.h:27
constexpr float lay01angdiff
void intersectThirdLayer(const float a, const float b, const float hit1_x, const float hit1_y, float &lay2_x, float &lay2_y)
Definition: seedtestMPlex.cc:9
std::array< int, 3 > TripletIdx
Definition: TrackExtra.h:41
constexpr float seed_d0cut
T sqrt(T t)
Definition: SSEVec.h:23
float getRad2(float x, float y)
Definition: Hit.h:30
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
float getHypot(float x, float y)
Definition: Hit.h:47
#define debug
Definition: HDRShower.cc:19
constexpr float seed_z1cut
double b
Definition: hdecay.h:120
float getPhi(float x, float y)
Definition: Hit.h:34
#define dprint(x)
Definition: Debug.h:95
double a
Definition: hdecay.h:121
constexpr float seed_z0cut
constexpr float maxCurvR
std::vector< TripletIdx > TripletIdxVec
Definition: TrackExtra.h:42

◆ from_json() [1/12]

void mkfit::from_json ( const nlohmann::ordered_json &  nlohmann_json_j,
mkfit::LayerControl nlohmann_json_t 
)
inline

Definition at line 37 of file IterationConfig.cc.

◆ from_json() [2/12]

void mkfit::from_json ( const nlohmann::json nlohmann_json_j,
mkfit::LayerControl nlohmann_json_t 
)
inline

◆ from_json() [3/12]

void mkfit::from_json ( const nlohmann::json nlohmann_json_j,
mkfit::SteeringParams nlohmann_json_t 
)
inline

Definition at line 45 of file IterationConfig.cc.

◆ from_json() [4/12]

void mkfit::from_json ( const nlohmann::ordered_json &  nlohmann_json_j,
mkfit::SteeringParams nlohmann_json_t 
)
inline

Definition at line 45 of file IterationConfig.cc.

◆ from_json() [5/12]

void mkfit::from_json ( const nlohmann::json nlohmann_json_j,
mkfit::IterationLayerConfig nlohmann_json_t 
)
inline

Definition at line 54 of file IterationConfig.cc.

◆ from_json() [6/12]

void mkfit::from_json ( const nlohmann::ordered_json &  nlohmann_json_j,
mkfit::IterationLayerConfig nlohmann_json_t 
)
inline

Definition at line 54 of file IterationConfig.cc.

◆ from_json() [7/12]

void mkfit::from_json ( const nlohmann::json nlohmann_json_j,
mkfit::IterationParams nlohmann_json_t 
)
inline

Definition at line 68 of file IterationConfig.cc.

◆ from_json() [8/12]

void mkfit::from_json ( const nlohmann::ordered_json &  nlohmann_json_j,
mkfit::IterationParams nlohmann_json_t 
)
inline

Definition at line 68 of file IterationConfig.cc.

◆ from_json() [9/12]

void mkfit::from_json ( const nlohmann::json nlohmann_json_j,
mkfit::IterationConfig nlohmann_json_t 
)
inline

Definition at line 101 of file IterationConfig.cc.

◆ from_json() [10/12]

void mkfit::from_json ( const nlohmann::ordered_json &  nlohmann_json_j,
mkfit::IterationConfig nlohmann_json_t 
)
inline

Definition at line 101 of file IterationConfig.cc.

◆ from_json() [11/12]

void mkfit::from_json ( const nlohmann::json nlohmann_json_j,
mkfit::IterationsInfo nlohmann_json_t 
)
inline

Definition at line 104 of file IterationConfig.cc.

110 {

◆ from_json() [12/12]

void mkfit::from_json ( const nlohmann::ordered_json &  nlohmann_json_j,
mkfit::IterationsInfo nlohmann_json_t 
)
inline

Definition at line 104 of file IterationConfig.cc.

110 {

◆ getEta() [1/3]

float mkfit::getEta ( float  r,
float  z 
)
inline

◆ getEta() [2/3]

float mkfit::getEta ( float  theta)
inline

Definition at line 40 of file Hit.h.

References f, CrabHelper::log, funct::tan(), and tauSpinnerTable_cfi::theta.

40 { return -1.0f * std::log(std::tan(theta / 2.0f)); }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double f[11][100]

◆ getEta() [3/3]

float mkfit::getEta ( float  x,
float  y,
float  z 
)
inline

Definition at line 42 of file Hit.h.

References Matriplex::atan2(), f, CrabHelper::log, mathSSE::sqrt(), funct::tan(), tauSpinnerTable_cfi::theta, and x.

42  {
43  const float theta = std::atan2(std::sqrt(x * x + y * y), z);
44  return -1.0f * std::log(std::tan(theta / 2.0f));
45  }
T sqrt(T t)
Definition: SSEVec.h:23
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double f[11][100]
float x
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648

◆ getEtaErr2()

float mkfit::getEtaErr2 ( float  x,
float  y,
float  z,
float  exx,
float  eyy,
float  ezz,
float  exy,
float  exz,
float  eyz 
)
inline

Definition at line 74 of file Hit.h.

References getRad2(), mathSSE::sqrt(), and x.

Referenced by mkfit::Hit::eeta(), and mkfit::TrackState::eposEta().

74  {
75  const float rad2 = getRad2(x, y);
76  const float detadx = -x / (rad2 * std::sqrt(1 + rad2 / (z * z)));
77  const float detady = -y / (rad2 * std::sqrt(1 + rad2 / (z * z)));
78  const float detadz = 1.0f / (z * std::sqrt(1 + rad2 / (z * z)));
79  return detadx * detadx * exx + detady * detady * eyy + detadz * detadz * ezz + 2.0f * detadx * detady * exy +
80  2.0f * detadx * detadz * exz + 2.0f * detady * detadz * eyz;
81  }
T sqrt(T t)
Definition: SSEVec.h:23
float getRad2(float x, float y)
Definition: Hit.h:30
float x

◆ getHypot()

float mkfit::getHypot ( float  x,
float  y 
)
inline

◆ getInvRad2()

float mkfit::getInvRad2 ( float  x,
float  y 
)
inline

Definition at line 32 of file Hit.h.

References x.

32 { return 1.0f / (x * x + y * y); }
float x

◆ getInvRadErr2()

float mkfit::getInvRadErr2 ( float  x,
float  y,
float  exx,
float  eyy,
float  exy 
)
inline

Definition at line 53 of file Hit.h.

References cube(), f, getRad2(), and x.

53  {
54  return (x * x * exx + y * y * eyy + 2.0f * x * y * exy) / cube(getRad2(x, y));
55  }
float getRad2(float x, float y)
Definition: Hit.h:30
double f[11][100]
T cube(T x)
Definition: Hit.h:18
float x

◆ getMatchBin()

int mkfit::getMatchBin ( const float  pt)
inline

Definition at line 237 of file TrackExtra.cc.

References f, and DiDispStaMuonMonitor_cfi::pt.

Referenced by mkfit::TrackExtra::setCMSSWTrackIDInfoByTrkParams().

237  {
238  if (pt < 0.75f)
239  return 0;
240  else if (pt < 1.f)
241  return 1;
242  else if (pt < 2.f)
243  return 2;
244  else if (pt < 5.f)
245  return 3;
246  else if (pt < 10.f)
247  return 4;
248  else
249  return 5;
250  }
double f[11][100]

◆ getPhi()

float mkfit::getPhi ( float  x,
float  y 
)
inline

◆ getPhiErr2()

float mkfit::getPhiErr2 ( float  x,
float  y,
float  exx,
float  eyy,
float  exy 
)
inline

Definition at line 57 of file Hit.h.

References f, getRad2(), and x.

Referenced by mkfit::Hit::ephi(), and mkfit::TrackState::eposPhi().

57  {
58  const float rad2 = getRad2(x, y);
59  return (y * y * exx + x * x * eyy - 2.0f * x * y * exy) / (rad2 * rad2);
60  }
float getRad2(float x, float y)
Definition: Hit.h:30
double f[11][100]
float x

◆ getPxPxErr2()

float mkfit::getPxPxErr2 ( float  ipt,
float  phi,
float  vipt,
float  vphi 
)
inline

Definition at line 83 of file Hit.h.

References funct::cos(), and funct::sin().

Referenced by mkfit::TrackState::epxpx().

83  { // ipt = 1/pT, v = variance
84  const float iipt2 = 1.0f / (ipt * ipt); //iipt = 1/(1/pT) = pT
85  const float cosP = std::cos(phi);
86  const float sinP = std::sin(phi);
87  return iipt2 * (iipt2 * cosP * cosP * vipt + sinP * sinP * vphi);
88  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE float phi(TAcc const &acc, float x, float y)
Definition: Hit.h:29
Cos< T >::type cos(const T &t)
Definition: Cos.h:22

◆ getPyPyErr2()

float mkfit::getPyPyErr2 ( float  ipt,
float  phi,
float  vipt,
float  vphi 
)
inline

Definition at line 90 of file Hit.h.

References funct::cos(), and funct::sin().

Referenced by mkfit::TrackState::epypy(), and mkfit::TrackState::epzpz().

90  { // ipt = 1/pT, v = variance
91  const float iipt2 = 1.0f / (ipt * ipt); //iipt = 1/(1/pT) = pT
92  const float cosP = std::cos(phi);
93  const float sinP = std::sin(phi);
94  return iipt2 * (iipt2 * sinP * sinP * vipt + cosP * cosP * vphi);
95  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE float phi(TAcc const &acc, float x, float y)
Definition: Hit.h:29
Cos< T >::type cos(const T &t)
Definition: Cos.h:22

◆ getPzPzErr2()

float mkfit::getPzPzErr2 ( float  ipt,
float  theta,
float  vipt,
float  vtheta 
)
inline

Definition at line 97 of file Hit.h.

References funct::sin(), funct::tan(), and tauSpinnerTable_cfi::theta.

97  { // ipt = 1/pT, v = variance
98  const float iipt2 = 1.0f / (ipt * ipt); //iipt = 1/(1/pT) = pT
99  const float cotT = 1.0f / std::tan(theta);
100  const float cscT = 1.0f / std::sin(theta);
101  return iipt2 * (iipt2 * cotT * cotT * vipt + cscT * cscT * cscT * cscT * vtheta);
102  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22

◆ getRad2()

float mkfit::getRad2 ( float  x,
float  y 
)
inline

Definition at line 30 of file Hit.h.

References x.

Referenced by conformalFitMPlex(), findSeedsByRoadSearch(), getEtaErr2(), getInvRadErr2(), getPhiErr2(), getRadErr2(), and getThetaErr2().

30 { return x * x + y * y; }
float x

◆ getRadErr2()

float mkfit::getRadErr2 ( float  x,
float  y,
float  exx,
float  eyy,
float  exy 
)
inline

Definition at line 49 of file Hit.h.

References f, getRad2(), and x.

Referenced by mkfit::TrackState::eposR().

49  {
50  return (x * x * exx + y * y * eyy + 2.0f * x * y * exy) / getRad2(x, y);
51  }
float getRad2(float x, float y)
Definition: Hit.h:30
double f[11][100]
float x

◆ getScoreCand() [1/2]

float mkfit::getScoreCand ( const track_score_func score_func,
const TrackCand cand1,
bool  penalizeTailMissHits = false,
bool  inFindCandidates = false 
)
inline

Definition at line 259 of file TrackStructures.h.

References isoTrack_cff::chi2, mkfit::TrackBase::chi2(), mkfit::TrackCand::nFoundHits(), mkfit::TrackCand::nInsideMinusOneHits(), mkfit::TrackCand::nOverlapHits(), mkfit::TrackCand::nTailMinusOneHits(), DiDispStaMuonMonitor_cfi::pt, and mkfit::TrackBase::pT().

262  {
263  int nfoundhits = cand1.nFoundHits();
264  int noverlaphits = cand1.nOverlapHits();
265  int nmisshits = cand1.nInsideMinusOneHits();
266  int ntailmisshits = penalizeTailMissHits ? cand1.nTailMinusOneHits() : 0;
267  float pt = cand1.pT();
268  float chi2 = cand1.chi2();
269  // Do not allow for chi2<0 in score calculation
270  if (chi2 < 0)
271  chi2 = 0.f;
272  return score_func(nfoundhits, ntailmisshits, noverlaphits, nmisshits, chi2, pt, inFindCandidates);
273  }

◆ getScoreCand() [2/2]

float mkfit::getScoreCand ( const track_score_func score_func,
const Track cand1,
bool  penalizeTailMissHits = false,
bool  inFindCandidates = false 
)
inline

Definition at line 601 of file Track.h.

References isoTrack_cff::chi2, mkfit::TrackBase::chi2(), mkfit::Track::nFoundHits(), mkfit::Track::nInsideMinusOneHits(), mkfit::Track::nOverlapHits(), mkfit::Track::nTailMinusOneHits(), DiDispStaMuonMonitor_cfi::pt, and mkfit::TrackBase::pT().

Referenced by mkfit::MkFinder::bkFitOutputTracks(), mkfit::MkBuilder::find_tracks_in_layers(), mkfit::MkFinder::findCandidates(), mkfit::CombCandidate::importSeed(), mkfit::CombCandidate::mergeCandsAndBestShortOne(), mkfit::Event::print_tracks(), and mkfit::StdSeq::score_tracks().

604  {
605  int nfoundhits = cand1.nFoundHits();
606  int noverlaphits = cand1.nOverlapHits();
607  int nmisshits = cand1.nInsideMinusOneHits();
608  float ntailmisshits = penalizeTailMissHits ? cand1.nTailMinusOneHits() : 0;
609  float pt = cand1.pT();
610  float chi2 = cand1.chi2();
611  // Do not allow for chi2<0 in score calculation
612  if (chi2 < 0)
613  chi2 = 0.f;
614  return score_func(nfoundhits, ntailmisshits, noverlaphits, nmisshits, chi2, pt, inFindCandidates);
615  }

◆ getScoreStruct()

float mkfit::getScoreStruct ( const track_score_func score_func,
const IdxChi2List cand1 
)
inline

Definition at line 617 of file Track.h.

References mkfit::IdxChi2List::chi2, isoTrack_cff::chi2, mkfit::IdxChi2List::nhits, mkfit::IdxChi2List::nholes, mkfit::IdxChi2List::noverlaps, mkfit::IdxChi2List::ntailholes, mkfit::IdxChi2List::pt, and DiDispStaMuonMonitor_cfi::pt.

Referenced by mkfit::MkFinder::findCandidatesCloneEngine().

617  {
618  int nfoundhits = cand1.nhits;
619  int ntailholes = cand1.ntailholes;
620  int noverlaphits = cand1.noverlaps;
621  int nmisshits = cand1.nholes;
622  float pt = cand1.pt;
623  float chi2 = cand1.chi2;
624  // Do not allow for chi2<0 in score calculation
625  if (chi2 < 0)
626  chi2 = 0.f;
627  return score_func(nfoundhits, ntailholes, noverlaphits, nmisshits, chi2, pt, true /*inFindCandidates*/);
628  }

◆ getScoreWorstPossible()

float mkfit::getScoreWorstPossible ( )
inline

Definition at line 597 of file Track.h.

References WZElectronSkims53X_cff::max.

Referenced by mkfit::CombCandidate::reset(), and mkfit::TrackCand::resetShortTrack().

597  {
598  return -std::numeric_limits<float>::max(); // used for handling of best short track during finding
599  }

◆ getTheta()

float mkfit::getTheta ( float  r,
float  z 
)
inline

Definition at line 36 of file Hit.h.

References Matriplex::atan2().

Referenced by conformalFitMPlex(), mkfit::TrackState::convertFromCartesianToCCS(), mkfit::TrackState::convertFromGlbCurvilinearToCCS(), getEta(), and kalmanOperationPlaneLocal().

36 { return std::atan2(r, z); }
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648

◆ getThetaErr2()

float mkfit::getThetaErr2 ( float  x,
float  y,
float  z,
float  exx,
float  eyy,
float  ezz,
float  exy,
float  exz,
float  eyz 
)
inline

Definition at line 62 of file Hit.h.

References getRad2(), mathSSE::sqrt(), and x.

63  {
64  const float rad2 = getRad2(x, y);
65  const float rad = std::sqrt(rad2);
66  const float hypot2 = rad2 + z * z;
67  const float dthetadx = x * z / (rad * hypot2);
68  const float dthetady = y * z / (rad * hypot2);
69  const float dthetadz = -rad / hypot2;
70  return dthetadx * dthetadx * exx + dthetady * dthetady * eyy + dthetadz * dthetadz * ezz +
71  2.0f * dthetadx * dthetady * exy + 2.0f * dthetadx * dthetadz * exz + 2.0f * dthetady * dthetadz * eyz;
72  }
T sqrt(T t)
Definition: SSEVec.h:23
float getRad2(float x, float y)
Definition: Hit.h:30
float x

◆ helixAtPlane()

void mkfit::helixAtPlane ( const MPlexLV inPar,
const MPlexQI inChg,
const MPlexHV plPnt,
const MPlexHV plNrm,
MPlexQF pathL,
MPlexLV outPar,
MPlexLL errorProp,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags pflags 
)

Definition at line 509 of file PropagationMPlexPlane.cc.

References f.

Referenced by propagateHelixToPlaneMPlex().

518  {
519  errorProp.setVal(0.f);
520  outFailFlag.setVal(0.f);
521 
522  helixAtPlane_impl(inPar, inChg, plPnt, plNrm, pathL, outPar, errorProp, outFailFlag, N_proc, pflags);
523  }
double f[11][100]

◆ helixAtRFromIterativeCCS()

void mkfit::helixAtRFromIterativeCCS ( const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msRad,
MPlexLV outPar,
MPlexLL errorProp,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags pflags 
)

Definition at line 918 of file PropagationMPlex.cc.

References f, and NN.

Referenced by propagateHelixToRMPlex().

925  {
926  errorProp.setVal(0.f);
927  outFailFlag.setVal(0.f);
928 
929  helixAtRFromIterativeCCS_impl(inPar, inChg, msRad, outPar, errorProp, outFailFlag, 0, NN, N_proc, pflags);
930  }
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
double f[11][100]

◆ helixAtRFromIterativeCCSFullJac() [1/2]

void mkfit::helixAtRFromIterativeCCSFullJac ( const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msRad,
MPlexLV outPar,
MPlexLL errorProp,
MPlexQI outFailFlag,
const int  N_proc 
)

◆ helixAtRFromIterativeCCSFullJac() [2/2]

void mkfit::helixAtRFromIterativeCCSFullJac ( const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msRad,
MPlexLV outPar,
MPlexLL errorProp,
const int  N_proc 
)

Definition at line 201 of file PropagationMPlex.cc.

References funct::abs(), mkfit::Config::Bfield, CMS_UNROLL_LOOP_COUNT, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), funct::cos(), gather_cfg::cout, debug, dprint_np, f, g_debug, hipo(), mps_fire::i, isotrackApplyRegressor::k, create_idmaps::n, mkfit::Config::Niter, NN, funct::sin(), sincos4(), mkfit::Const::sol, mathSSE::sqrt(), funct::tan(), tauSpinnerTable_cfi::theta, and mkfit::Config::useTrigApprox.

206  {
207  errorProp.setVal(0.f);
208  MPlexLL errorPropTmp(0.f); //initialize to zero
209  MPlexLL errorPropSwap(0.f); //initialize to zero
210 
211  // loop does not vectorize with llvm16, and it issues a warning
212  // that apparently can't be suppressed with a pragma. Needs to
213  // be rechecked if future llvm versions improve vectorization.
214 #if !defined(__clang__)
215 #pragma omp simd
216 #endif
217  for (int n = 0; n < NN; ++n) {
218  //initialize erroProp to identity matrix
219  errorProp(n, 0, 0) = 1.f;
220  errorProp(n, 1, 1) = 1.f;
221  errorProp(n, 2, 2) = 1.f;
222  errorProp(n, 3, 3) = 1.f;
223  errorProp(n, 4, 4) = 1.f;
224  errorProp(n, 5, 5) = 1.f;
225 
226  const float k = inChg.constAt(n, 0, 0) * 100.f / (-Const::sol * Config::Bfield);
227  const float r = msRad.constAt(n, 0, 0);
228  float r0 = hipo(inPar.constAt(n, 0, 0), inPar.constAt(n, 1, 0));
229 
230  if (std::abs(r - r0) < 0.0001f) {
231  dprint_np(n, "distance less than 1mum, skip");
232  continue;
233  }
234 
235  const float ipt = inPar.constAt(n, 3, 0);
236  const float phiin = inPar.constAt(n, 4, 0);
237  const float theta = inPar.constAt(n, 5, 0);
238 
239  //set those that are 1. before iterations
240  errorPropTmp(n, 2, 2) = 1.f;
241  errorPropTmp(n, 3, 3) = 1.f;
242  errorPropTmp(n, 4, 4) = 1.f;
243  errorPropTmp(n, 5, 5) = 1.f;
244 
245  float cosah = 0., sinah = 0.;
246  //no trig approx here, phi and theta can be large
247  float cosP = std::cos(phiin), sinP = std::sin(phiin);
248  const float cosT = std::cos(theta), sinT = std::sin(theta);
249  float pxin = cosP / ipt;
250  float pyin = sinP / ipt;
251 
253  for (int i = 0; i < Config::Niter; ++i) {
254  dprint_np(n,
255  std::endl
256  << "attempt propagation from r=" << r0 << " to r=" << r << std::endl
257  << "x=" << outPar.At(n, 0, 0) << " y=" << outPar.At(n, 1, 0) << " z=" << outPar.At(n, 2, 0)
258  << " px=" << std::cos(phiin) / ipt << " py=" << std::sin(phiin) / ipt
259  << " pz=" << 1.f / (ipt * tan(theta)) << " q=" << inChg.constAt(n, 0, 0) << std::endl);
260 
261  r0 = hipo(outPar.constAt(n, 0, 0), outPar.constAt(n, 1, 0));
262  const float ialpha = (r - r0) * ipt / k;
263  //alpha+=ialpha;
264 
266  sincos4(ialpha * 0.5f, sinah, cosah);
267  } else {
268  cosah = std::cos(ialpha * 0.5f);
269  sinah = std::sin(ialpha * 0.5f);
270  }
271  const float cosa = 1.f - 2.f * sinah * sinah;
272  const float sina = 2.f * sinah * cosah;
273 
274  //derivatives of alpha
275  const float dadx = -outPar.At(n, 0, 0) * ipt / (k * r0);
276  const float dady = -outPar.At(n, 1, 0) * ipt / (k * r0);
277  const float dadipt = (r - r0) / k;
278 
279  outPar.At(n, 0, 0) = outPar.constAt(n, 0, 0) + 2.f * k * sinah * (pxin * cosah - pyin * sinah);
280  outPar.At(n, 1, 0) = outPar.constAt(n, 1, 0) + 2.f * k * sinah * (pyin * cosah + pxin * sinah);
281  const float pxinold = pxin; //copy before overwriting
282  pxin = pxin * cosa - pyin * sina;
283  pyin = pyin * cosa + pxinold * sina;
284 
285  //need phi at origin, so this goes before redefining phi
286  //no trig approx here, phi can be large
287  cosP = std::cos(outPar.At(n, 4, 0));
288  sinP = std::sin(outPar.At(n, 4, 0));
289 
290  outPar.At(n, 2, 0) = outPar.constAt(n, 2, 0) + k * ialpha * cosT / (ipt * sinT);
291  outPar.At(n, 3, 0) = ipt;
292  outPar.At(n, 4, 0) = outPar.constAt(n, 4, 0) + ialpha;
293  outPar.At(n, 5, 0) = theta;
294 
295  errorPropTmp(n, 0, 0) = 1.f + k * (cosP * dadx * cosa - sinP * dadx * sina) / ipt;
296  errorPropTmp(n, 0, 1) = k * (cosP * dady * cosa - sinP * dady * sina) / ipt;
297  errorPropTmp(n, 0, 3) =
298  k * (cosP * (ipt * dadipt * cosa - sina) + sinP * ((1.f - cosa) - ipt * dadipt * sina)) / (ipt * ipt);
299  errorPropTmp(n, 0, 4) = -k * (sinP * sina + cosP * (1.f - cosa)) / ipt;
300 
301  errorPropTmp(n, 1, 0) = k * (sinP * dadx * cosa + cosP * dadx * sina) / ipt;
302  errorPropTmp(n, 1, 1) = 1.f + k * (sinP * dady * cosa + cosP * dady * sina) / ipt;
303  errorPropTmp(n, 1, 3) =
304  k * (sinP * (ipt * dadipt * cosa - sina) + cosP * (ipt * dadipt * sina - (1.f - cosa))) / (ipt * ipt);
305  errorPropTmp(n, 1, 4) = k * (cosP * sina - sinP * (1.f - cosa)) / ipt;
306 
307  errorPropTmp(n, 2, 0) = k * cosT * dadx / (ipt * sinT);
308  errorPropTmp(n, 2, 1) = k * cosT * dady / (ipt * sinT);
309  errorPropTmp(n, 2, 3) = k * cosT * (ipt * dadipt - ialpha) / (ipt * ipt * sinT);
310  errorPropTmp(n, 2, 5) = -k * ialpha / (ipt * sinT * sinT);
311 
312  errorPropTmp(n, 4, 0) = dadx;
313  errorPropTmp(n, 4, 1) = dady;
314  errorPropTmp(n, 4, 3) = dadipt;
315 
316  MultHelixPropTemp(errorProp, errorPropTmp, errorPropSwap, n);
317  errorProp = errorPropSwap;
318  }
319 
320  dprint_np(
321  n,
322  "propagation end, dump parameters"
323  << std::endl
324  << "pos = " << outPar.At(n, 0, 0) << " " << outPar.At(n, 1, 0) << " " << outPar.At(n, 2, 0) << std::endl
325  << "mom = " << std::cos(outPar.At(n, 4, 0)) / outPar.At(n, 3, 0) << " "
326  << std::sin(outPar.At(n, 4, 0)) / outPar.At(n, 3, 0) << " "
327  << 1. / (outPar.At(n, 3, 0) * tan(outPar.At(n, 5, 0)))
328  << " r=" << std::sqrt(outPar.At(n, 0, 0) * outPar.At(n, 0, 0) + outPar.At(n, 1, 0) * outPar.At(n, 1, 0))
329  << " pT=" << 1. / std::abs(outPar.At(n, 3, 0)) << std::endl);
330 
331 #ifdef DEBUG
332  if (debug && g_debug && n < N_proc) {
333  dmutex_guard;
334  std::cout << n << " jacobian" << std::endl;
335  printf("%5f %5f %5f %5f %5f %5f\n",
336  errorProp(n, 0, 0),
337  errorProp(n, 0, 1),
338  errorProp(n, 0, 2),
339  errorProp(n, 0, 3),
340  errorProp(n, 0, 4),
341  errorProp(n, 0, 5));
342  printf("%5f %5f %5f %5f %5f %5f\n",
343  errorProp(n, 1, 0),
344  errorProp(n, 1, 1),
345  errorProp(n, 1, 2),
346  errorProp(n, 1, 3),
347  errorProp(n, 1, 4),
348  errorProp(n, 1, 5));
349  printf("%5f %5f %5f %5f %5f %5f\n",
350  errorProp(n, 2, 0),
351  errorProp(n, 2, 1),
352  errorProp(n, 2, 2),
353  errorProp(n, 2, 3),
354  errorProp(n, 2, 4),
355  errorProp(n, 2, 5));
356  printf("%5f %5f %5f %5f %5f %5f\n",
357  errorProp(n, 3, 0),
358  errorProp(n, 3, 1),
359  errorProp(n, 3, 2),
360  errorProp(n, 3, 3),
361  errorProp(n, 3, 4),
362  errorProp(n, 3, 5));
363  printf("%5f %5f %5f %5f %5f %5f\n",
364  errorProp(n, 4, 0),
365  errorProp(n, 4, 1),
366  errorProp(n, 4, 2),
367  errorProp(n, 4, 3),
368  errorProp(n, 4, 4),
369  errorProp(n, 4, 5));
370  printf("%5f %5f %5f %5f %5f %5f\n",
371  errorProp(n, 5, 0),
372  errorProp(n, 5, 1),
373  errorProp(n, 5, 2),
374  errorProp(n, 5, 3),
375  errorProp(n, 5, 4),
376  errorProp(n, 5, 5));
377  }
378 #endif
379  }
380  }
void sincos4(const MPlex< T, D1, D2, N > &a, MPlex< T, D1, D2, N > &s, MPlex< T, D1, D2, N > &c)
Definition: Matriplex.h:696
Matriplex::Matriplex< float, LL, LL, NN > MPlexLL
Definition: Matrix.h:53
#define dprint_np(n, x)
Definition: Debug.h:96
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define CMS_UNROLL_LOOP_COUNT(N)
Definition: CMSUnrollLoop.h:48
bool g_debug
Definition: Debug.cc:2
T sqrt(T t)
Definition: SSEVec.h:23
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr float Bfield
Definition: Config.h:60
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
constexpr bool useTrigApprox
Definition: Config.h:51
#define debug
Definition: HDRShower.cc:19
constexpr float sol
Definition: Config.h:13
float hipo(float x, float y)
Definition: Matrix.h:9
constexpr int Niter
Definition: Config.h:50

◆ helixAtZ()

void mkfit::helixAtZ ( const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msZ,
MPlexLV outPar,
MPlexLL errorProp,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags pflags 
)

Definition at line 196 of file PropagationMPlexEndcap.cc.

References funct::abs(), isotrackApplyRegressor::alpha, mkfit::Config::Bfield, mkfit::Config::bFieldFromZR(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), funct::cos(), gather_cfg::cout, debug, l1tTrackerHTMiss_cfi::deltaZ, dprint_np, f, g_debug, hipo(), isotrackApplyRegressor::k, create_idmaps::n, NN, DiDispStaMuonMonitor_cfi::pt, funct::sin(), sincos4(), mkfit::Const::sol, mathSSE::sqrt(), funct::tan(), tauSpinnerTable_cfi::theta, mkfit::PropagationFlags::use_param_b_field, and mkfit::Config::useTrigApprox.

Referenced by propagateHelixToZMPlex().

203  {
204  errorProp.setVal(0.f);
205  outFailFlag.setVal(0.f);
206 
207  // debug = true;
208 #pragma omp simd
209  for (int n = 0; n < NN; ++n) {
210  //initialize erroProp to identity matrix, except element 2,2 which is zero
211  errorProp(n, 0, 0) = 1.f;
212  errorProp(n, 1, 1) = 1.f;
213  errorProp(n, 3, 3) = 1.f;
214  errorProp(n, 4, 4) = 1.f;
215  errorProp(n, 5, 5) = 1.f;
216  }
217  float zout[NN];
218  float zin[NN];
219  float ipt[NN];
220  float phiin[NN];
221  float theta[NN];
222 #pragma omp simd
223  for (int n = 0; n < NN; ++n) {
224  //initialize erroProp to identity matrix, except element 2,2 which is zero
225  zout[n] = msZ.constAt(n, 0, 0);
226  zin[n] = inPar.constAt(n, 2, 0);
227  ipt[n] = inPar.constAt(n, 3, 0);
228  phiin[n] = inPar.constAt(n, 4, 0);
229  theta[n] = inPar.constAt(n, 5, 0);
230  }
231 
232  float k[NN];
233  if (pflags.use_param_b_field) {
234 #pragma omp simd
235  for (int n = 0; n < NN; ++n) {
236  k[n] = inChg.constAt(n, 0, 0) * 100.f /
237  (-Const::sol * Config::bFieldFromZR(zin[n], hipo(inPar.constAt(n, 0, 0), inPar.constAt(n, 1, 0))));
238  }
239  } else {
240 #pragma omp simd
241  for (int n = 0; n < NN; ++n) {
242  k[n] = inChg.constAt(n, 0, 0) * 100.f / (-Const::sol * Config::Bfield);
243  }
244  }
245 
246  float kinv[NN];
247 #pragma omp simd
248  for (int n = 0; n < NN; ++n) {
249  kinv[n] = 1.f / k[n];
250  }
251 
252 #pragma omp simd
253  for (int n = 0; n < NN; ++n) {
254  dprint_np(n,
255  std::endl
256  << "input parameters"
257  << " inPar.constAt(n, 0, 0)=" << std::setprecision(9) << inPar.constAt(n, 0, 0)
258  << " inPar.constAt(n, 1, 0)=" << std::setprecision(9) << inPar.constAt(n, 1, 0)
259  << " inPar.constAt(n, 2, 0)=" << std::setprecision(9) << inPar.constAt(n, 2, 0)
260  << " inPar.constAt(n, 3, 0)=" << std::setprecision(9) << inPar.constAt(n, 3, 0)
261  << " inPar.constAt(n, 4, 0)=" << std::setprecision(9) << inPar.constAt(n, 4, 0)
262  << " inPar.constAt(n, 5, 0)=" << std::setprecision(9) << inPar.constAt(n, 5, 0)
263  << " inChg.constAt(n, 0, 0)=" << std::setprecision(9) << inChg.constAt(n, 0, 0));
264  }
265 #pragma omp simd
266  for (int n = 0; n < NN; ++n) {
267  dprint_np(n,
268  "propagation start, dump parameters"
269  << std::endl
270  << "pos = " << inPar.constAt(n, 0, 0) << " " << inPar.constAt(n, 1, 0) << " "
271  << inPar.constAt(n, 2, 0) << std::endl
272  << "mom (cart) = " << std::cos(inPar.constAt(n, 4, 0)) / inPar.constAt(n, 3, 0) << " "
273  << std::sin(inPar.constAt(n, 4, 0)) / inPar.constAt(n, 3, 0) << " "
274  << 1. / (inPar.constAt(n, 3, 0) * tan(inPar.constAt(n, 5, 0))) << " r="
275  << std::sqrt(inPar.constAt(n, 0, 0) * inPar.constAt(n, 0, 0) +
276  inPar.constAt(n, 1, 0) * inPar.constAt(n, 1, 0))
277  << " pT=" << 1. / std::abs(inPar.constAt(n, 3, 0)) << " q=" << inChg.constAt(n, 0, 0)
278  << " targetZ=" << msZ.constAt(n, 0, 0) << std::endl);
279  }
280 
281  float pt[NN];
282 #pragma omp simd
283  for (int n = 0; n < NN; ++n) {
284  pt[n] = 1.f / ipt[n];
285  }
286 
287  //no trig approx here, phi can be large
288  float cosP[NN];
289  float sinP[NN];
290 #pragma omp simd
291  for (int n = 0; n < NN; ++n) {
292  cosP[n] = std::cos(phiin[n]);
293  }
294 
295 #pragma omp simd
296  for (int n = 0; n < NN; ++n) {
297  sinP[n] = std::sin(phiin[n]);
298  }
299 
300  float cosT[NN];
301  float sinT[NN];
302 #pragma omp simd
303  for (int n = 0; n < NN; ++n) {
304  cosT[n] = std::cos(theta[n]);
305  }
306 
307 #pragma omp simd
308  for (int n = 0; n < NN; ++n) {
309  sinT[n] = std::sin(theta[n]);
310  }
311 
312  float tanT[NN];
313  float icos2T[NN];
314  float pxin[NN];
315  float pyin[NN];
316 #pragma omp simd
317  for (int n = 0; n < NN; ++n) {
318  tanT[n] = sinT[n] / cosT[n];
319  icos2T[n] = 1.f / (cosT[n] * cosT[n]);
320  pxin[n] = cosP[n] * pt[n];
321  pyin[n] = sinP[n] * pt[n];
322  }
323 
324  float deltaZ[NN];
325  float alpha[NN];
326 #pragma omp simd
327  for (int n = 0; n < NN; ++n) {
328  deltaZ[n] = zout[n] - zin[n];
329  alpha[n] = deltaZ[n] * tanT[n] * ipt[n] * kinv[n];
330  }
331 
332  float cosahTmp[NN];
333  float sinahTmp[NN];
335 #if !defined(__INTEL_COMPILER)
336 #pragma omp simd
337 #endif
338  for (int n = 0; n < NN; ++n) {
339  sincos4(alpha[n] * 0.5f, sinahTmp[n], cosahTmp[n]);
340  }
341  } else {
342 #if !defined(__INTEL_COMPILER)
343 #pragma omp simd
344 #endif
345  for (int n = 0; n < NN; ++n) {
346  cosahTmp[n] = std::cos(alpha[n] * 0.5f);
347  }
348 #if !defined(__INTEL_COMPILER)
349 #pragma omp simd
350 #endif
351  for (int n = 0; n < NN; ++n) {
352  sinahTmp[n] = std::sin(alpha[n] * 0.5f);
353  }
354  }
355 
356  float cosah[NN];
357  float sinah[NN];
358  float cosa[NN];
359  float sina[NN];
360 #pragma omp simd
361  for (int n = 0; n < NN; ++n) {
362  cosah[n] = cosahTmp[n];
363  sinah[n] = sinahTmp[n];
364  cosa[n] = 1.f - 2.f * sinah[n] * sinah[n];
365  sina[n] = 2.f * sinah[n] * cosah[n];
366  }
367 
368 //update parameters
369 #pragma omp simd
370  for (int n = 0; n < NN; ++n) {
371  outPar.At(n, 0, 0) = outPar.At(n, 0, 0) + 2.f * k[n] * sinah[n] * (pxin[n] * cosah[n] - pyin[n] * sinah[n]);
372  outPar.At(n, 1, 0) = outPar.At(n, 1, 0) + 2.f * k[n] * sinah[n] * (pyin[n] * cosah[n] + pxin[n] * sinah[n]);
373  outPar.At(n, 2, 0) = zout[n];
374  outPar.At(n, 4, 0) = phiin[n] + alpha[n];
375  }
376 
377 #pragma omp simd
378  for (int n = 0; n < NN; ++n) {
379  dprint_np(n,
380  "propagation to Z end (OLD), dump parameters\n"
381  << " pos = " << outPar(n, 0, 0) << " " << outPar(n, 1, 0) << " " << outPar(n, 2, 0) << "\t\t r="
382  << std::sqrt(outPar(n, 0, 0) * outPar(n, 0, 0) + outPar(n, 1, 0) * outPar(n, 1, 0)) << std::endl
383  << " mom = " << outPar(n, 3, 0) << " " << outPar(n, 4, 0) << " " << outPar(n, 5, 0) << std::endl
384  << " cart= " << std::cos(outPar(n, 4, 0)) / outPar(n, 3, 0) << " "
385  << std::sin(outPar(n, 4, 0)) / outPar(n, 3, 0) << " "
386  << 1. / (outPar(n, 3, 0) * tan(outPar(n, 5, 0))) << "\t\tpT=" << 1. / std::abs(outPar(n, 3, 0))
387  << std::endl);
388  }
389 
390  float pxcaMpysa[NN];
391 #pragma omp simd
392  for (int n = 0; n < NN; ++n) {
393  pxcaMpysa[n] = pxin[n] * cosa[n] - pyin[n] * sina[n];
394  }
395 
396 #pragma omp simd
397  for (int n = 0; n < NN; ++n) {
398  errorProp(n, 0, 2) = -tanT[n] * ipt[n] * pxcaMpysa[n];
399  errorProp(n, 0, 3) =
400  k[n] * pt[n] * pt[n] *
401  (cosP[n] * (alpha[n] * cosa[n] - sina[n]) + sinP[n] * 2.f * sinah[n] * (sinah[n] - alpha[n] * cosah[n]));
402  errorProp(n, 0, 4) = -2.f * k[n] * pt[n] * sinah[n] * (sinP[n] * cosah[n] + cosP[n] * sinah[n]);
403  errorProp(n, 0, 5) = deltaZ[n] * ipt[n] * pxcaMpysa[n] * icos2T[n];
404  }
405 
406  float pycaPpxsa[NN];
407 #pragma omp simd
408  for (int n = 0; n < NN; ++n) {
409  pycaPpxsa[n] = pyin[n] * cosa[n] + pxin[n] * sina[n];
410  }
411 
412 #pragma omp simd
413  for (int n = 0; n < NN; ++n) {
414  errorProp(n, 1, 2) = -tanT[n] * ipt[n] * pycaPpxsa[n];
415  errorProp(n, 1, 3) =
416  k[n] * pt[n] * pt[n] *
417  (sinP[n] * (alpha[n] * cosa[n] - sina[n]) - cosP[n] * 2.f * sinah[n] * (sinah[n] - alpha[n] * cosah[n]));
418  errorProp(n, 1, 4) = 2.f * k[n] * pt[n] * sinah[n] * (cosP[n] * cosah[n] - sinP[n] * sinah[n]);
419  errorProp(n, 1, 5) = deltaZ[n] * ipt[n] * pycaPpxsa[n] * icos2T[n];
420  }
421 
422 #pragma omp simd
423  for (int n = 0; n < NN; ++n) {
424  errorProp(n, 4, 2) = -ipt[n] * tanT[n] * kinv[n];
425  errorProp(n, 4, 3) = tanT[n] * deltaZ[n] * kinv[n];
426  errorProp(n, 4, 5) = ipt[n] * deltaZ[n] * kinv[n] * icos2T[n];
427  }
428 
429 #pragma omp simd
430  for (int n = 0; n < NN; ++n) {
431  dprint_np(
432  n,
433  "propagation end, dump parameters"
434  << std::endl
435  << "pos = " << outPar.At(n, 0, 0) << " " << outPar.At(n, 1, 0) << " " << outPar.At(n, 2, 0) << std::endl
436  << "mom (cart) = " << std::cos(outPar.At(n, 4, 0)) / outPar.At(n, 3, 0) << " "
437  << std::sin(outPar.At(n, 4, 0)) / outPar.At(n, 3, 0) << " "
438  << 1. / (outPar.At(n, 3, 0) * tan(outPar.At(n, 5, 0)))
439  << " r=" << std::sqrt(outPar.At(n, 0, 0) * outPar.At(n, 0, 0) + outPar.At(n, 1, 0) * outPar.At(n, 1, 0))
440  << " pT=" << 1. / std::abs(outPar.At(n, 3, 0)) << std::endl);
441  }
442 
443  // PROP-FAIL-ENABLE Disabled to keep physics changes minimal.
444  // To be reviewed, enabled and processed accordingly elsewhere.
445  /*
446  // Check for errors, set fail-flag.
447  for (int n = 0; n < NN; ++n) {
448  // We propagate for alpha: mark fail when prop angle more than pi/2
449  if (std::abs(alpha[n]) > 1.57) {
450  dprintf("helixAtZ: more than quarter turn, alpha = %f\n", alpha[n]);
451  outFailFlag[n] = 1;
452  } else {
453  // Have we reached desired z? We can't know, we copy desired z to actual z.
454  // Are we close to apex? Same condition as in propToR, 12.5 deg, cos(78.5deg) = 0.2
455  float dotp = (outPar.At(n, 0, 0) * std::cos(outPar.At(n, 4, 0)) +
456  outPar.At(n, 1, 0) * std::sin(outPar.At(n, 4, 0))) /
457  std::hypot(outPar.At(n, 0, 0), outPar.At(n, 1, 0));
458  if (dotp < 0.2 || dotp < 0) {
459  dprintf("helixAtZ: dot product bad, dotp = %f\n", dotp);
460  outFailFlag[n] = 1;
461  }
462  }
463  }
464  */
465 
466 #ifdef DEBUG
467  if (debug && g_debug) {
468  for (int n = 0; n < N_proc; ++n) {
469  dmutex_guard;
470  std::cout << n << ": jacobian" << std::endl;
471  printf("%5f %5f %5f %5f %5f %5f\n",
472  errorProp(n, 0, 0),
473  errorProp(n, 0, 1),
474  errorProp(n, 0, 2),
475  errorProp(n, 0, 3),
476  errorProp(n, 0, 4),
477  errorProp(n, 0, 5));
478  printf("%5f %5f %5f %5f %5f %5f\n",
479  errorProp(n, 1, 0),
480  errorProp(n, 1, 1),
481  errorProp(n, 1, 2),
482  errorProp(n, 1, 3),
483  errorProp(n, 1, 4),
484  errorProp(n, 1, 5));
485  printf("%5f %5f %5f %5f %5f %5f\n",
486  errorProp(n, 2, 0),
487  errorProp(n, 2, 1),
488  errorProp(n, 2, 2),
489  errorProp(n, 2, 3),
490  errorProp(n, 2, 4),
491  errorProp(n, 2, 5));
492  printf("%5f %5f %5f %5f %5f %5f\n",
493  errorProp(n, 3, 0),
494  errorProp(n, 3, 1),
495  errorProp(n, 3, 2),
496  errorProp(n, 3, 3),
497  errorProp(n, 3, 4),
498  errorProp(n, 3, 5));
499  printf("%5f %5f %5f %5f %5f %5f\n",
500  errorProp(n, 4, 0),
501  errorProp(n, 4, 1),
502  errorProp(n, 4, 2),
503  errorProp(n, 4, 3),
504  errorProp(n, 4, 4),
505  errorProp(n, 4, 5));
506  printf("%5f %5f %5f %5f %5f %5f\n",
507  errorProp(n, 5, 0),
508  errorProp(n, 5, 1),
509  errorProp(n, 5, 2),
510  errorProp(n, 5, 3),
511  errorProp(n, 5, 4),
512  errorProp(n, 5, 5));
513  }
514  }
515 #endif
516  }
void sincos4(const MPlex< T, D1, D2, N > &a, MPlex< T, D1, D2, N > &s, MPlex< T, D1, D2, N > &c)
Definition: Matriplex.h:696
#define dprint_np(n, x)
Definition: Debug.h:96
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
bool g_debug
Definition: Debug.cc:2
T sqrt(T t)
Definition: SSEVec.h:23
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr float Bfield
Definition: Config.h:60
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
constexpr bool useTrigApprox
Definition: Config.h:51
#define debug
Definition: HDRShower.cc:19
constexpr float sol
Definition: Config.h:13
float hipo(float x, float y)
Definition: Matrix.h:9
float bFieldFromZR(const float z, const float r)
Definition: Config.h:131

◆ hipo()

float mkfit::hipo ( float  x,
float  y 
)
inline

◆ hipo_sqr()

float mkfit::hipo_sqr ( float  x,
float  y 
)
inline

Definition at line 11 of file Matrix.h.

References x.

Referenced by mkfit::MkBase::radiusSqr().

11 { return x * x + y * y; }
float x

◆ hit2pos()

RVec mkfit::hit2pos ( const Hit h)

Definition at line 24 of file RntConversions.h.

References h.

Referenced by mkfit::MkFinder::selectHitIndicesV2().

24 { return {h.x(), h.y(), h.z()}; }
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ intersectThirdLayer()

void mkfit::intersectThirdLayer ( const float  a,
const float  b,
const float  hit1_x,
const float  hit1_y,
float &  lay2_x,
float &  lay2_y 
)
inline

Definition at line 9 of file seedtestMPlex.cc.

References a, isotrackTrainRegressor::a2, b, b2, f, getHypot(), mkfit::Config::maxCurvR, and mathSSE::sqrt().

Referenced by findSeedsByRoadSearch().

10  {
11  const float a2 = a * a;
12  const float b2 = b * b;
13  const float a2b2 = a2 + b2;
14  const float lay2rad2 = (Config::fRadialSpacing * Config::fRadialSpacing) * 9.0f; // average third radius squared
15  const float maxCurvR2 = Config::maxCurvR * Config::maxCurvR;
16 
17  const float quad =
18  std::sqrt(2.0f * maxCurvR2 * (a2b2 + lay2rad2) - (a2b2 - lay2rad2) * (a2b2 - lay2rad2) - maxCurvR2 * maxCurvR2);
19  const float pos[2] = {(a2 * a + a * (b2 + lay2rad2 - maxCurvR2) - b * quad) / a2b2,
20  (b2 * b + b * (a2 + lay2rad2 - maxCurvR2) + a * quad) / a2b2};
21  const float neg[2] = {(a2 * a + a * (b2 + lay2rad2 - maxCurvR2) + b * quad) / a2b2,
22  (b2 * b + b * (a2 + lay2rad2 - maxCurvR2) - a * quad) / a2b2};
23 
24  // since we have two intersection points, arbitrate which one is closer to layer2 hit
25  if (getHypot(pos[0] - hit1_x, pos[1] - hit1_y) < getHypot(neg[0] - hit1_x, neg[1] - hit1_y)) {
26  lay2_x = pos[0];
27  lay2_y = pos[1];
28  } else {
29  lay2_x = neg[0];
30  lay2_y = neg[1];
31  }
32  }
T sqrt(T t)
Definition: SSEVec.h:23
double f[11][100]
float getHypot(float x, float y)
Definition: Hit.h:47
bias2_t b2[25]
Definition: b2.h:9
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
constexpr float maxCurvR

◆ isFinite()

constexpr bool mkfit::isFinite ( float  x)

Definition at line 13 of file cms_common_macros.h.

References ztail::d, edm::isFinite(), MainPageGenerator::l, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, findQualityFiles::v, and x.

Referenced by mkfit::MkFinder::bkFitOutputTracks(), mkfit::TrackBase::hasNanNSillyValues(), mkfit::TrackBase::hasSillyValues(), and mkfit::MkFinder::selectHitIndices().

13  {
14 #ifdef MKFIT_STANDALONE
15  const unsigned int mask = 0x7f800000;
16  union {
17  unsigned int l;
18  float d;
19  } v = {.d = x};
20  return (v.l & mask) != mask;
21 #else
22  return edm::isFinite(x);
23 #endif
24  }
constexpr bool isFinite(T x)
d
Definition: ztail.py:151
float x

◆ isStripQCompatible()

bool mkfit::isStripQCompatible ( int  itrack,
bool  isBarrel,
const MPlexLS pErr,
const MPlexLV pPar,
const MPlexHS msErr,
const MPlexHV msPar 
)

Definition at line 1303 of file MkFinder.cc.

References funct::abs(), dprint, f, PixelPluginsPhase0_cfi::isBarrel, WZElectronSkims53X_cff::max, amptDefault_cfi::proj, and mathSSE::sqrt().

Referenced by mkfit::MkFinder::findCandidates(), and mkfit::MkFinder::findCandidatesCloneEngine().

1304  {
1305  //check module compatibility via long strip side = L/sqrt(12)
1306  if (isBarrel) { //check z direction only
1307  const float res = std::abs(msPar.constAt(itrack, 2, 0) - pPar.constAt(itrack, 2, 0));
1308  const float hitHL = sqrt(msErr.constAt(itrack, 2, 2) * 3.f); //half-length
1309  const float qErr = sqrt(pErr.constAt(itrack, 2, 2));
1310  dprint("qCompat " << hitHL << " + " << 3.f * qErr << " vs " << res);
1311  return hitHL + std::max(3.f * qErr, 0.5f) > res;
1312  } else { //project on xy, assuming the strip Length >> Width
1313  const float res[2]{msPar.constAt(itrack, 0, 0) - pPar.constAt(itrack, 0, 0),
1314  msPar.constAt(itrack, 1, 0) - pPar.constAt(itrack, 1, 0)};
1315  const float hitT2 = msErr.constAt(itrack, 0, 0) + msErr.constAt(itrack, 1, 1);
1316  const float hitT2inv = 1.f / hitT2;
1317  const float proj[3] = {msErr.constAt(itrack, 0, 0) * hitT2inv,
1318  msErr.constAt(itrack, 0, 1) * hitT2inv,
1319  msErr.constAt(itrack, 1, 1) * hitT2inv};
1320  const float qErr =
1321  sqrt(std::abs(pErr.constAt(itrack, 0, 0) * proj[0] + 2.f * pErr.constAt(itrack, 0, 1) * proj[1] +
1322  pErr.constAt(itrack, 1, 1) * proj[2])); //take abs to avoid non-pos-def cases
1323  const float resProj =
1324  sqrt(res[0] * proj[0] * res[0] + 2.f * res[1] * proj[1] * res[0] + res[1] * proj[2] * res[1]);
1325  dprint("qCompat " << sqrt(hitT2 * 3.f) << " + " << 3.f * qErr << " vs " << resProj);
1326  return sqrt(hitT2 * 3.f) + std::max(3.f * qErr, 0.5f) > resProj;
1327  }
1328  }
Definition: Electron.h:6
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
#define dprint(x)
Definition: Debug.h:95

◆ kalmanComputeChi2()

void mkfit::kalmanComputeChi2 ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexQF outChi2,
const int  N_proc 
)

Definition at line 958 of file KalmanUtilsMPlex.cc.

References kalmanOperation(), and KFO_Calculate_Chi2.

964  {
965  kalmanOperation(KFO_Calculate_Chi2, psErr, psPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
966  }
void kalmanOperation(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)

◆ kalmanComputeChi2Endcap()

void mkfit::kalmanComputeChi2Endcap ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexQF outChi2,
const int  N_proc 
)

Definition at line 2226 of file KalmanUtilsMPlex.cc.

References kalmanOperationEndcap(), and KFO_Calculate_Chi2.

2232  {
2233  kalmanOperationEndcap(KFO_Calculate_Chi2, psErr, psPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
2234  }
void kalmanOperationEndcap(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)

◆ kalmanComputeChi2Plane()

void mkfit::kalmanComputeChi2Plane ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
const MPlexHV plNrm,
const MPlexHV plDir,
const MPlexHV plPnt,
MPlexQF outChi2,
const int  N_proc 
)

Definition at line 1298 of file KalmanUtilsMPlex.cc.

References kalmanOperationPlaneLocal(), and KFO_Calculate_Chi2.

1307  {
1309  psErr,
1310  psPar,
1311  inChg,
1312  msErr,
1313  msPar,
1314  plNrm,
1315  plDir,
1316  plPnt,
1317  dummy_err,
1318  dummy_par,
1319  outChi2,
1320  N_proc);
1321  }
void kalmanOperationPlaneLocal(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)

◆ kalmanOperation()

void mkfit::kalmanOperation ( const int  kfOp,
const MPlexLS psErr,
const MPlexLV psPar,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
MPlexQF outChi2,
const int  N_proc 
)

Definition at line 1002 of file KalmanUtilsMPlex.cc.

References Matriplex::hypot(), mps_fire::i, Matriplex::invertCramerSym(), dqmiolumiharvest::j, KFO_Calculate_Chi2, KFO_Local_Cov, KFO_Update_Params, create_idmaps::n, NN, and squashPhiMPlex().

Referenced by mkfit::MkFinder::bkFitFitTracks(), mkfit::MkFinder::bkFitFitTracksBH(), kalmanComputeChi2(), kalmanPropagateAndComputeChi2(), kalmanPropagateAndUpdate(), and kalmanUpdate().

1010  {
1011 #ifdef DEBUG
1012  {
1013  dmutex_guard;
1014  printf("psPar:\n");
1015  for (int i = 0; i < 6; ++i) {
1016  printf("%8f ", psPar.constAt(0, 0, i));
1017  printf("\n");
1018  }
1019  printf("\n");
1020  printf("psErr:\n");
1021  for (int i = 0; i < 6; ++i) {
1022  for (int j = 0; j < 6; ++j)
1023  printf("%8f ", psErr.constAt(0, i, j));
1024  printf("\n");
1025  }
1026  printf("\n");
1027  printf("msPar:\n");
1028  for (int i = 0; i < 3; ++i) {
1029  printf("%8f ", msPar.constAt(0, 0, i));
1030  printf("\n");
1031  }
1032  printf("\n");
1033  printf("msErr:\n");
1034  for (int i = 0; i < 3; ++i) {
1035  for (int j = 0; j < 3; ++j)
1036  printf("%8f ", msErr.constAt(0, i, j));
1037  printf("\n");
1038  }
1039  printf("\n");
1040  }
1041 #endif
1042 
1043  // Rotate global point on tangent plane to cylinder
1044  // Tangent point is half way between hit and propagate position
1045 
1046  // Rotation matrix
1047  // rotT00 0 rotT01
1048  // rotT01 0 -rotT00
1049  // 0 1 0
1050  // Minimize temporaries: only two float are needed!
1051 
1052  MPlexQF rotT00;
1053  MPlexQF rotT01;
1054  for (int n = 0; n < NN; ++n) {
1055  if (n < N_proc) {
1056  const float r = std::hypot(msPar.constAt(n, 0, 0), msPar.constAt(n, 1, 0));
1057  rotT00.At(n, 0, 0) = -(msPar.constAt(n, 1, 0) + psPar.constAt(n, 1, 0)) / (2 * r);
1058  rotT01.At(n, 0, 0) = (msPar.constAt(n, 0, 0) + psPar.constAt(n, 0, 0)) / (2 * r);
1059  } else {
1060  rotT00.At(n, 0, 0) = 0.0f;
1061  rotT01.At(n, 0, 0) = 0.0f;
1062  }
1063  }
1064 
1065  MPlexHV res_glo; //position residual in global coordinates
1066  SubtractFirst3(msPar, psPar, res_glo);
1067 
1068  MPlexHS resErr_glo; //covariance sum in global position coordinates
1069  AddIntoUpperLeft3x3(psErr, msErr, resErr_glo);
1070 
1071  MPlex2V res_loc; //position residual in local coordinates
1072  RotateResidualsOnTangentPlane(rotT00, rotT01, res_glo, res_loc);
1073  MPlex2S resErr_loc; //covariance sum in local position coordinates
1074  MPlexHH tempHH;
1075  ProjectResErr(rotT00, rotT01, resErr_glo, tempHH);
1076  ProjectResErrTransp(rotT00, rotT01, tempHH, resErr_loc);
1077 
1078 #ifdef DEBUG
1079  {
1080  dmutex_guard;
1081  printf("res_glo:\n");
1082  for (int i = 0; i < 3; ++i) {
1083  printf("%8f ", res_glo.At(0, i, 0));
1084  }
1085  printf("\n");
1086  printf("resErr_glo:\n");
1087  for (int i = 0; i < 3; ++i) {
1088  for (int j = 0; j < 3; ++j)
1089  printf("%8f ", resErr_glo.At(0, i, j));
1090  printf("\n");
1091  }
1092  printf("\n");
1093  printf("res_loc:\n");
1094  for (int i = 0; i < 2; ++i) {
1095  printf("%8f ", res_loc.At(0, i, 0));
1096  }
1097  printf("\n");
1098  printf("tempHH:\n");
1099  for (int i = 0; i < 3; ++i) {
1100  for (int j = 0; j < 3; ++j)
1101  printf("%8f ", tempHH.At(0, i, j));
1102  printf("\n");
1103  }
1104  printf("\n");
1105  printf("resErr_loc:\n");
1106  for (int i = 0; i < 2; ++i) {
1107  for (int j = 0; j < 2; ++j)
1108  printf("%8f ", resErr_loc.At(0, i, j));
1109  printf("\n");
1110  }
1111  printf("\n");
1112  }
1113 #endif
1114 
1115  //invert the 2x2 matrix
1116  Matriplex::invertCramerSym(resErr_loc);
1117 
1118  if (kfOp & KFO_Calculate_Chi2) {
1119  Chi2Similarity(res_loc, resErr_loc, outChi2);
1120 
1121 #ifdef DEBUG
1122  {
1123  dmutex_guard;
1124  printf("resErr_loc (Inv):\n");
1125  for (int i = 0; i < 2; ++i) {
1126  for (int j = 0; j < 2; ++j)
1127  printf("%8f ", resErr_loc.At(0, i, j));
1128  printf("\n");
1129  }
1130  printf("\n");
1131  printf("chi2: %8f\n", outChi2.At(0, 0, 0));
1132  }
1133 #endif
1134  }
1135 
1136  if (kfOp & KFO_Update_Params) {
1137  MPlexLS psErrLoc = psErr;
1138  if (kfOp & KFO_Local_Cov)
1139  CovXYconstrain(rotT00, rotT01, psErr, psErrLoc);
1140 
1141  MPlexLH K; // kalman gain, fixme should be L2
1142  KalmanHTG(rotT00, rotT01, resErr_loc, tempHH); // intermediate term to get kalman gain (H^T*G)
1143  KalmanGain(psErrLoc, tempHH, K);
1144 
1145  MultResidualsAdd(K, psPar, res_loc, outPar);
1146 
1147  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
1148 
1149  MPlexLL tempLL;
1150  KHMult(K, rotT00, rotT01, tempLL);
1151  KHC(tempLL, psErrLoc, outErr);
1152  outErr.subtract(psErrLoc, outErr);
1153 
1154 #ifdef DEBUG
1155  {
1156  dmutex_guard;
1157  if (kfOp & KFO_Local_Cov) {
1158  printf("psErrLoc:\n");
1159  for (int i = 0; i < 6; ++i) {
1160  for (int j = 0; j < 6; ++j)
1161  printf("% 8e ", psErrLoc.At(0, i, j));
1162  printf("\n");
1163  }
1164  printf("\n");
1165  }
1166  printf("resErr_loc (Inv):\n");
1167  for (int i = 0; i < 2; ++i) {
1168  for (int j = 0; j < 2; ++j)
1169  printf("%8f ", resErr_loc.At(0, i, j));
1170  printf("\n");
1171  }
1172  printf("\n");
1173  printf("tempHH:\n");
1174  for (int i = 0; i < 3; ++i) {
1175  for (int j = 0; j < 3; ++j)
1176  printf("%8f ", tempHH.At(0, i, j));
1177  printf("\n");
1178  }
1179  printf("\n");
1180  printf("K:\n");
1181  for (int i = 0; i < 6; ++i) {
1182  for (int j = 0; j < 3; ++j)
1183  printf("%8f ", K.At(0, i, j));
1184  printf("\n");
1185  }
1186  printf("\n");
1187  printf("tempLL:\n");
1188  for (int i = 0; i < 6; ++i) {
1189  for (int j = 0; j < 6; ++j)
1190  printf("%8f ", tempLL.At(0, i, j));
1191  printf("\n");
1192  }
1193  printf("\n");
1194  printf("outPar:\n");
1195  for (int i = 0; i < 6; ++i) {
1196  printf("%8f ", outPar.At(0, i, 0));
1197  }
1198  printf("\n");
1199  printf("outErr:\n");
1200  for (int i = 0; i < 6; ++i) {
1201  for (int j = 0; j < 6; ++j)
1202  printf("%8f ", outErr.At(0, i, j));
1203  printf("\n");
1204  }
1205  printf("\n");
1206  }
1207 #endif
1208  }
1209  }
Matriplex::Matriplex< float, HH, HH, NN > MPlexHH
Definition: Matrix.h:57
Matriplex::Matriplex< float, LL, LL, NN > MPlexLL
Definition: Matrix.h:53
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:616
Matriplex::Matriplex< float, HH, 1, NN > MPlexHV
Definition: Matrix.h:58
void squashPhiMPlex(MPlexLV &par, const int N_proc)
void invertCramerSym(MPlexSym< T, D, N > &A, double *determ=nullptr)
Definition: MatriplexSym.h:421
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
Matriplex::MatriplexSym< float, 2, NN > MPlex2S
Definition: Matrix.h:70
Matriplex::MatriplexSym< float, HH, NN > MPlexHS
Definition: Matrix.h:59
Matriplex::Matriplex< float, LL, HH, NN > MPlexLH
Definition: Matrix.h:72
Matriplex::Matriplex< float, 2, 1, NN > MPlex2V
Definition: Matrix.h:69
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55

◆ kalmanOperationEndcap()

void mkfit::kalmanOperationEndcap ( const int  kfOp,
const MPlexLS psErr,
const MPlexLV psPar,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
MPlexQF outChi2,
const int  N_proc 
)

Definition at line 2266 of file KalmanUtilsMPlex.cc.

References mps_fire::i, Matriplex::invertCramerSym(), dqmiolumiharvest::j, KFO_Calculate_Chi2, KFO_Update_Params, and squashPhiMPlex().

Referenced by mkfit::MkFinder::bkFitFitTracks(), mkfit::MkFinder::bkFitFitTracksBH(), kalmanComputeChi2Endcap(), kalmanPropagateAndComputeChi2Endcap(), kalmanPropagateAndUpdateEndcap(), and kalmanUpdateEndcap().

2274  {
2275 #ifdef DEBUG
2276  {
2277  dmutex_guard;
2278  printf("updateParametersEndcapMPlex\n");
2279  printf("psPar:\n");
2280  for (int i = 0; i < 6; ++i) {
2281  printf("%8f ", psPar.constAt(0, 0, i));
2282  printf("\n");
2283  }
2284  printf("\n");
2285  printf("msPar:\n");
2286  for (int i = 0; i < 3; ++i) {
2287  printf("%8f ", msPar.constAt(0, 0, i));
2288  printf("\n");
2289  }
2290  printf("\n");
2291  printf("psErr:\n");
2292  for (int i = 0; i < 6; ++i) {
2293  for (int j = 0; j < 6; ++j)
2294  printf("%8f ", psErr.constAt(0, i, j));
2295  printf("\n");
2296  }
2297  printf("\n");
2298  printf("msErr:\n");
2299  for (int i = 0; i < 3; ++i) {
2300  for (int j = 0; j < 3; ++j)
2301  printf("%8f ", msErr.constAt(0, i, j));
2302  printf("\n");
2303  }
2304  printf("\n");
2305  }
2306 #endif
2307 
2308  MPlex2V res;
2309  SubtractFirst2(msPar, psPar, res);
2310 
2311  MPlex2S resErr;
2312  AddIntoUpperLeft2x2(psErr, msErr, resErr);
2313 
2314 #ifdef DEBUG
2315  {
2316  dmutex_guard;
2317  printf("resErr:\n");
2318  for (int i = 0; i < 2; ++i) {
2319  for (int j = 0; j < 2; ++j)
2320  printf("%8f ", resErr.At(0, i, j));
2321  printf("\n");
2322  }
2323  printf("\n");
2324  }
2325 #endif
2326 
2327  //invert the 2x2 matrix
2329 
2330  if (kfOp & KFO_Calculate_Chi2) {
2331  Chi2Similarity(res, resErr, outChi2);
2332 
2333 #ifdef DEBUG
2334  {
2335  dmutex_guard;
2336  printf("resErr_loc (Inv):\n");
2337  for (int i = 0; i < 2; ++i) {
2338  for (int j = 0; j < 2; ++j)
2339  printf("%8f ", resErr.At(0, i, j));
2340  printf("\n");
2341  }
2342  printf("\n");
2343  printf("chi2: %8f\n", outChi2.At(0, 0, 0));
2344  }
2345 #endif
2346  }
2347 
2348  if (kfOp & KFO_Update_Params) {
2349  MPlexL2 K;
2350  KalmanGain(psErr, resErr, K);
2351 
2352  MultResidualsAdd(K, psPar, res, outPar);
2353 
2354  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
2355 
2356  KHC(K, psErr, outErr);
2357 
2358 #ifdef DEBUG
2359  {
2360  dmutex_guard;
2361  printf("outErr before subtract:\n");
2362  for (int i = 0; i < 6; ++i) {
2363  for (int j = 0; j < 6; ++j)
2364  printf("%8f ", outErr.At(0, i, j));
2365  printf("\n");
2366  }
2367  printf("\n");
2368  }
2369 #endif
2370 
2371  outErr.subtract(psErr, outErr);
2372 
2373 #ifdef DEBUG
2374  {
2375  dmutex_guard;
2376  printf("res:\n");
2377  for (int i = 0; i < 2; ++i) {
2378  printf("%8f ", res.At(0, i, 0));
2379  }
2380  printf("\n");
2381  printf("resErr (Inv):\n");
2382  for (int i = 0; i < 2; ++i) {
2383  for (int j = 0; j < 2; ++j)
2384  printf("%8f ", resErr.At(0, i, j));
2385  printf("\n");
2386  }
2387  printf("\n");
2388  printf("K:\n");
2389  for (int i = 0; i < 6; ++i) {
2390  for (int j = 0; j < 2; ++j)
2391  printf("%8f ", K.At(0, i, j));
2392  printf("\n");
2393  }
2394  printf("\n");
2395  printf("outPar:\n");
2396  for (int i = 0; i < 6; ++i) {
2397  printf("%8f ", outPar.At(0, i, 0));
2398  }
2399  printf("\n");
2400  printf("outErr:\n");
2401  for (int i = 0; i < 6; ++i) {
2402  for (int j = 0; j < 6; ++j)
2403  printf("%8f ", outErr.At(0, i, j));
2404  printf("\n");
2405  }
2406  printf("\n");
2407  }
2408 #endif
2409  }
2410  }
Matriplex::Matriplex< float, LL, 2, NN > MPlexL2
Definition: Matrix.h:76
Definition: Electron.h:6
void squashPhiMPlex(MPlexLV &par, const int N_proc)
void invertCramerSym(MPlexSym< T, D, N > &A, double *determ=nullptr)
Definition: MatriplexSym.h:421
Matriplex::MatriplexSym< float, 2, NN > MPlex2S
Definition: Matrix.h:70
Matriplex::Matriplex< float, 2, 1, NN > MPlex2V
Definition: Matrix.h:69

◆ kalmanOperationPlane()

void mkfit::kalmanOperationPlane ( const int  kfOp,
const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
const MPlexHV plNrm,
const MPlexHV plDir,
const MPlexHV plPnt,
MPlexLS outErr,
MPlexLV outPar,
MPlexQF outChi2,
const int  N_proc 
)

Definition at line 1961 of file KalmanUtilsMPlex.cc.

References mps_fire::i, Matriplex::invertCramerSym(), dqmiolumiharvest::j, KFO_Calculate_Chi2, KFO_Local_Cov, KFO_Update_Params, create_idmaps::n, NN, and squashPhiMPlex().

1973  {
1974 #ifdef DEBUG
1975  {
1976  dmutex_guard;
1977  printf("psPar:\n");
1978  for (int i = 0; i < 6; ++i) {
1979  printf("%8f ", psPar.constAt(0, 0, i));
1980  printf("\n");
1981  }
1982  printf("\n");
1983  printf("psErr:\n");
1984  for (int i = 0; i < 6; ++i) {
1985  for (int j = 0; j < 6; ++j)
1986  printf("%8f ", psErr.constAt(0, i, j));
1987  printf("\n");
1988  }
1989  printf("\n");
1990  printf("msPar:\n");
1991  for (int i = 0; i < 3; ++i) {
1992  printf("%8f ", msPar.constAt(0, 0, i));
1993  printf("\n");
1994  }
1995  printf("\n");
1996  printf("msErr:\n");
1997  for (int i = 0; i < 3; ++i) {
1998  for (int j = 0; j < 3; ++j)
1999  printf("%8f ", msErr.constAt(0, i, j));
2000  printf("\n");
2001  }
2002  printf("\n");
2003  }
2004 #endif
2005 
2006  // Rotate global point on local plane
2007 
2008  // Rotation matrix
2009  // D0 D1 D2
2010  // X0 X1 X2
2011  // N0 N1 N2
2012  // where D is the strip direction vector plDir, N is the normal plNrm, and X is the cross product between the two
2013 
2014  MPlex2H prj;
2015  for (int n = 0; n < NN; ++n) {
2016  prj(n, 0, 0) = plDir(n, 0, 0);
2017  prj(n, 0, 1) = plDir(n, 1, 0);
2018  prj(n, 0, 2) = plDir(n, 2, 0);
2019  prj(n, 1, 0) = plNrm(n, 1, 0) * plDir(n, 2, 0) - plNrm(n, 2, 0) * plDir(n, 1, 0);
2020  prj(n, 1, 1) = plNrm(n, 2, 0) * plDir(n, 0, 0) - plNrm(n, 0, 0) * plDir(n, 2, 0);
2021  prj(n, 1, 2) = plNrm(n, 0, 0) * plDir(n, 1, 0) - plNrm(n, 1, 0) * plDir(n, 0, 0);
2022  }
2023 
2024  MPlexHV res_glo; //position residual in global coordinates
2025  SubtractFirst3(msPar, psPar, res_glo);
2026 
2027  MPlexHS resErr_glo; //covariance sum in global position coordinates
2028  AddIntoUpperLeft3x3(psErr, msErr, resErr_glo);
2029 
2030  MPlex2V res_loc; //position residual in local coordinates
2031  RotateResidualsOnPlane(prj, res_glo, res_loc);
2032  MPlex2S resErr_loc; //covariance sum in local position coordinates
2033  MPlex2H temp2H;
2034  ProjectResErr(prj, resErr_glo, temp2H);
2035  ProjectResErrTransp(prj, temp2H, resErr_loc);
2036 
2037 #ifdef DEBUG
2038  {
2039  dmutex_guard;
2040  printf("prj:\n");
2041  for (int i = 0; i < 2; ++i) {
2042  for (int j = 0; j < 3; ++j)
2043  printf("%8f ", prj.At(0, i, j));
2044  printf("\n");
2045  }
2046  printf("\n");
2047  printf("res_glo:\n");
2048  for (int i = 0; i < 3; ++i) {
2049  printf("%8f ", res_glo.At(0, i, 0));
2050  }
2051  printf("\n");
2052  printf("resErr_glo:\n");
2053  for (int i = 0; i < 3; ++i) {
2054  for (int j = 0; j < 3; ++j)
2055  printf("%8f ", resErr_glo.At(0, i, j));
2056  printf("\n");
2057  }
2058  printf("\n");
2059  printf("res_loc:\n");
2060  for (int i = 0; i < 2; ++i) {
2061  printf("%8f ", res_loc.At(0, i, 0));
2062  }
2063  printf("\n");
2064  printf("temp2H:\n");
2065  for (int i = 0; i < 2; ++i) {
2066  for (int j = 0; j < 3; ++j)
2067  printf("%8f ", temp2H.At(0, i, j));
2068  printf("\n");
2069  }
2070  printf("\n");
2071  printf("resErr_loc:\n");
2072  for (int i = 0; i < 2; ++i) {
2073  for (int j = 0; j < 2; ++j)
2074  printf("%8f ", resErr_loc.At(0, i, j));
2075  printf("\n");
2076  }
2077  printf("\n");
2078  }
2079 #endif
2080 
2081  //invert the 2x2 matrix
2082  Matriplex::invertCramerSym(resErr_loc);
2083 
2084  if (kfOp & KFO_Calculate_Chi2) {
2085  Chi2Similarity(res_loc, resErr_loc, outChi2);
2086 
2087 #ifdef DEBUG
2088  {
2089  dmutex_guard;
2090  printf("resErr_loc (Inv):\n");
2091  for (int i = 0; i < 2; ++i) {
2092  for (int j = 0; j < 2; ++j)
2093  printf("%8f ", resErr_loc.At(0, i, j));
2094  printf("\n");
2095  }
2096  printf("\n");
2097  printf("chi2: %8f\n", outChi2.At(0, 0, 0));
2098  }
2099 #endif
2100  }
2101 
2102  if (kfOp & KFO_Update_Params) {
2103  MPlexLS psErrLoc = psErr;
2104 
2105  MPlexH2 tempH2;
2106  MPlexL2 K; // kalman gain
2107  KalmanHTG(prj, resErr_loc, tempH2); // intermediate term to get kalman gain (H^T*G)
2108  KalmanGain(psErrLoc, tempH2, K);
2109 
2110  MultResidualsAdd(K, psPar, res_loc, outPar);
2111 
2112  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
2113 
2114  MPlexLL tempLL;
2115  KHMult(K, prj, tempLL);
2116  KHC(tempLL, psErrLoc, outErr);
2117  outErr.subtract(psErrLoc, outErr);
2118 
2119 #ifdef DEBUG
2120  {
2121  dmutex_guard;
2122  if (kfOp & KFO_Local_Cov) {
2123  printf("psErrLoc:\n");
2124  for (int i = 0; i < 6; ++i) {
2125  for (int j = 0; j < 6; ++j)
2126  printf("% 8e ", psErrLoc.At(0, i, j));
2127  printf("\n");
2128  }
2129  printf("\n");
2130  }
2131  printf("resErr_loc (Inv):\n");
2132  for (int i = 0; i < 2; ++i) {
2133  for (int j = 0; j < 2; ++j)
2134  printf("%8f ", resErr_loc.At(0, i, j));
2135  printf("\n");
2136  }
2137  printf("\n");
2138  printf("tempH2:\n");
2139  for (int i = 0; i < 3; ++i) {
2140  for (int j = 0; j < 2; ++j)
2141  printf("%8f ", tempH2.At(0, i, j));
2142  printf("\n");
2143  }
2144  printf("\n");
2145  printf("K:\n");
2146  for (int i = 0; i < 6; ++i) {
2147  for (int j = 0; j < 2; ++j)
2148  printf("%8f ", K.At(0, i, j));
2149  printf("\n");
2150  }
2151  printf("\n");
2152  printf("tempLL:\n");
2153  for (int i = 0; i < 6; ++i) {
2154  for (int j = 0; j < 6; ++j)
2155  printf("%8f ", tempLL.At(0, i, j));
2156  printf("\n");
2157  }
2158  printf("\n");
2159  printf("outPar:\n");
2160  for (int i = 0; i < 6; ++i) {
2161  printf("%8f ", outPar.At(0, i, 0));
2162  }
2163  printf("\n");
2164  printf("outErr:\n");
2165  for (int i = 0; i < 6; ++i) {
2166  for (int j = 0; j < 6; ++j)
2167  printf("%8f ", outErr.At(0, i, j));
2168  printf("\n");
2169  }
2170  printf("\n");
2171  }
2172 #endif
2173  }
2174  }
Matriplex::Matriplex< float, LL, LL, NN > MPlexLL
Definition: Matrix.h:53
Matriplex::Matriplex< float, HH, 1, NN > MPlexHV
Definition: Matrix.h:58
Matriplex::Matriplex< float, LL, 2, NN > MPlexL2
Definition: Matrix.h:76
void squashPhiMPlex(MPlexLV &par, const int N_proc)
void invertCramerSym(MPlexSym< T, D, N > &A, double *determ=nullptr)
Definition: MatriplexSym.h:421
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Matriplex::Matriplex< float, HH, 2, NN > MPlexH2
Definition: Matrix.h:77
Matriplex::Matriplex< float, 2, HH, NN > MPlex2H
Definition: Matrix.h:78
Matriplex::MatriplexSym< float, 2, NN > MPlex2S
Definition: Matrix.h:70
Matriplex::MatriplexSym< float, HH, NN > MPlexHS
Definition: Matrix.h:59
Matriplex::Matriplex< float, 2, 1, NN > MPlex2V
Definition: Matrix.h:69
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55

◆ kalmanOperationPlaneLocal()

void mkfit::kalmanOperationPlaneLocal ( const int  kfOp,
const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
const MPlexHV plNrm,
const MPlexHV plDir,
const MPlexHV plPnt,
MPlexLS outErr,
MPlexLV outPar,
MPlexQF outChi2,
const int  N_proc 
)

Definition at line 1374 of file KalmanUtilsMPlex.cc.

References funct::abs(), mkfit::Config::Bfield, funct::cos(), MillePedeFileConverter_cfg::e, f, getPhi(), getTheta(), gpu_cff::gpu, mps_fire::i, Matriplex::invertCramerSym(), dqmiolumiharvest::j, KFO_Calculate_Chi2, KFO_Local_Cov, KFO_Update_Params, WZElectronSkims53X_cff::max, create_idmaps::n, NN, AlCaHLTBitMon_ParallelJobs::p, DiDispStaMuonMonitor_cfi::pt, makeMuonMisalignmentScenario::rot, funct::sin(), mkfit::Const::sol, mathSSE::sqrt(), interactiveExample::ui, and findQualityFiles::v.

Referenced by kalmanComputeChi2Plane(), kalmanPropagateAndComputeChi2Plane(), kalmanPropagateAndUpdatePlane(), and kalmanUpdatePlane().

1386  {
1387 #ifdef DEBUG
1388  {
1389  dmutex_guard;
1390  printf("psPar:\n");
1391  for (int i = 0; i < 6; ++i) {
1392  printf("%8f ", psPar.constAt(0, 0, i));
1393  printf("\n");
1394  }
1395  printf("\n");
1396  printf("psErr:\n");
1397  for (int i = 0; i < 6; ++i) {
1398  for (int j = 0; j < 6; ++j)
1399  printf("%8f ", psErr.constAt(0, i, j));
1400  printf("\n");
1401  }
1402  printf("\n");
1403  printf("msPar:\n");
1404  for (int i = 0; i < 3; ++i) {
1405  printf("%8f ", msPar.constAt(0, 0, i));
1406  printf("\n");
1407  }
1408  printf("\n");
1409  printf("msErr:\n");
1410  for (int i = 0; i < 3; ++i) {
1411  for (int j = 0; j < 3; ++j)
1412  printf("%8f ", msErr.constAt(0, i, j));
1413  printf("\n");
1414  }
1415  printf("\n");
1416  }
1417 #endif
1418 
1419  MPlexHH rot;
1420 #pragma omp simd
1421  for (int n = 0; n < NN; ++n) {
1422  rot(n, 0, 0) = plDir(n, 0, 0);
1423  rot(n, 0, 1) = plDir(n, 1, 0);
1424  rot(n, 0, 2) = plDir(n, 2, 0);
1425  rot(n, 1, 0) = plNrm(n, 1, 0) * plDir(n, 2, 0) - plNrm(n, 2, 0) * plDir(n, 1, 0);
1426  rot(n, 1, 1) = plNrm(n, 2, 0) * plDir(n, 0, 0) - plNrm(n, 0, 0) * plDir(n, 2, 0);
1427  rot(n, 1, 2) = plNrm(n, 0, 0) * plDir(n, 1, 0) - plNrm(n, 1, 0) * plDir(n, 0, 0);
1428  rot(n, 2, 0) = plNrm(n, 0, 0);
1429  rot(n, 2, 1) = plNrm(n, 1, 0);
1430  rot(n, 2, 2) = plNrm(n, 2, 0);
1431  }
1432 
1433  // get local parameters
1434  MPlexHV xd;
1435 #pragma omp simd
1436  for (int n = 0; n < NN; ++n) {
1437  xd(n, 0, 0) = psPar(n, 0, 0) - plPnt(n, 0, 0);
1438  xd(n, 0, 1) = psPar(n, 0, 1) - plPnt(n, 0, 1);
1439  xd(n, 0, 2) = psPar(n, 0, 2) - plPnt(n, 0, 2);
1440  }
1441  MPlex2V xlo;
1442  RotateResidualsOnPlane(rot, xd, xlo);
1443 
1444  MPlexQF sinP, sinT, cosP, cosT, pt; //fixme VDT or something?
1445 #pragma omp simd
1446  for (int n = 0; n < NN; ++n) {
1447  pt(n, 0, 0) = 1.f / psPar(n, 3, 0);
1448  sinP(n, 0, 0) = std::sin(psPar(n, 4, 0));
1449  cosP(n, 0, 0) = std::cos(psPar(n, 4, 0));
1450  sinT(n, 0, 0) = std::sin(psPar(n, 5, 0));
1451  cosT(n, 0, 0) = std::cos(psPar(n, 5, 0));
1452  }
1453 
1454  MPlexHV pgl;
1455 #pragma omp simd
1456  for (int n = 0; n < NN; ++n) {
1457  pgl(n, 0, 0) = cosP(n, 0, 0) * pt(n, 0, 0);
1458  pgl(n, 0, 1) = sinP(n, 0, 0) * pt(n, 0, 0);
1459  pgl(n, 0, 2) = cosT(n, 0, 0) * pt(n, 0, 0) / sinT(n, 0, 0);
1460  }
1461 
1462  MPlexHV plo;
1463  RotateVectorOnPlane(rot, pgl, plo);
1464  MPlex5V lp;
1465 #pragma omp simd
1466  for (int n = 0; n < NN; ++n) {
1467  lp(n, 0, 0) = inChg(n, 0, 0) * psPar(n, 3, 0) * sinT(n, 0, 0);
1468  lp(n, 0, 1) = plo(n, 0, 0) / plo(n, 0, 2);
1469  lp(n, 0, 2) = plo(n, 0, 1) / plo(n, 0, 2);
1470  lp(n, 0, 3) = xlo(n, 0, 0);
1471  lp(n, 0, 4) = xlo(n, 0, 1);
1472  }
1473  MPlexQI pzSign;
1474 #pragma omp simd
1475  for (int n = 0; n < NN; ++n) {
1476  pzSign(n, 0, 0) = plo(n, 0, 2) > 0.f ? 1 : -1;
1477  }
1478 
1479  /*
1480  printf("rot:\n");
1481  for (int i = 0; i < 3; ++i) {
1482  for (int j = 0; j < 3; ++j)
1483  printf("%8f ", rot.At(0, i, j));
1484  printf("\n");
1485  }
1486  printf("\n");
1487  printf("plPnt:\n");
1488  for (int i = 0; i < 3; ++i) {
1489  printf("%8f ", plPnt.constAt(0, 0, i));
1490  }
1491  printf("\n");
1492  printf("xlo:\n");
1493  for (int i = 0; i < 2; ++i) {
1494  printf("%8f ", xlo.At(0, i, 0));
1495  }
1496  printf("\n");
1497  printf("pgl:\n");
1498  for (int i = 0; i < 3; ++i) {
1499  printf("%8f ", pgl.At(0, i, 0));
1500  }
1501  printf("\n");
1502  printf("plo:\n");
1503  for (int i = 0; i < 3; ++i) {
1504  printf("%8f ", plo.At(0, i, 0));
1505  }
1506  printf("\n");
1507  printf("lp:\n");
1508  for (int i = 0; i < 5; ++i) {
1509  printf("%8f ", lp.At(0, i, 0));
1510  }
1511  printf("\n");
1512  */
1513 
1514  //now we need the jacobian to convert from CCS to curvilinear
1515  // code from TrackState::jacobianCCSToCurvilinear
1516  MPlex56 jacCCS2Curv(0.f);
1517 #pragma omp simd
1518  for (int n = 0; n < NN; ++n) {
1519  jacCCS2Curv(n, 0, 3) = inChg(n, 0, 0) * sinT(n, 0, 0);
1520  jacCCS2Curv(n, 0, 5) = inChg(n, 0, 0) * cosT(n, 0, 0) * psPar(n, 3, 0);
1521  jacCCS2Curv(n, 1, 5) = -1.f;
1522  jacCCS2Curv(n, 2, 4) = 1.f;
1523  jacCCS2Curv(n, 3, 0) = -sinP(n, 0, 0);
1524  jacCCS2Curv(n, 3, 1) = cosP(n, 0, 0);
1525  jacCCS2Curv(n, 4, 0) = -cosP(n, 0, 0) * cosT(n, 0, 0);
1526  jacCCS2Curv(n, 4, 1) = -sinP(n, 0, 0) * cosT(n, 0, 0);
1527  jacCCS2Curv(n, 4, 2) = sinT(n, 0, 0);
1528  }
1529 
1530  //now we need the jacobian from curv to local
1531  // code from TrackingTools/AnalyticalJacobians/src/JacobianCurvilinearToLocal.cc
1532  MPlexHV un;
1533  MPlexHV vn;
1534 #pragma omp simd
1535  for (int n = 0; n < NN; ++n) {
1536  const float abslp00 = std::abs(lp(n, 0, 0));
1537  vn(n, 0, 2) = std::max(1.e-30f, abslp00 * pt(n, 0, 0));
1538  un(n, 0, 0) = -pgl(n, 0, 1) * abslp00 / vn(n, 0, 2);
1539  un(n, 0, 1) = pgl(n, 0, 0) * abslp00 / vn(n, 0, 2);
1540  un(n, 0, 2) = 0.f;
1541  vn(n, 0, 0) = -pgl(n, 0, 2) * abslp00 * un(n, 0, 1);
1542  vn(n, 0, 1) = pgl(n, 0, 2) * abslp00 * un(n, 0, 0);
1543  }
1544  MPlexHV u;
1545  RotateVectorOnPlane(rot, un, u);
1546  MPlexHV v;
1547  RotateVectorOnPlane(rot, vn, v);
1548  MPlex55 jacCurv2Loc(0.f);
1549 #pragma omp simd
1550  for (int n = 0; n < NN; ++n) {
1551  // fixme? //(pf.use_param_b_field ? 0.01f * Const::sol * Config::bFieldFromZR(psPar(n, 2, 0), hipo(psPar(n, 0, 0), psPar(n, 1, 0))) : 0.01f * Const::sol * Config::Bfield);
1552  const float bF = 0.01f * Const::sol * Config::Bfield;
1553  const float qh2 = bF * lp(n, 0, 0);
1554  const float t1r = std::sqrt(1.f + lp(n, 0, 1) * lp(n, 0, 1) + lp(n, 0, 2) * lp(n, 0, 2)) * pzSign(n, 0, 0);
1555  const float t2r = t1r * t1r;
1556  const float t3r = t1r * t2r;
1557  jacCurv2Loc(n, 0, 0) = 1.f;
1558  jacCurv2Loc(n, 1, 1) = -u(n, 0, 1) * t2r;
1559  jacCurv2Loc(n, 1, 2) = v(n, 0, 1) * vn(n, 0, 2) * t2r;
1560  jacCurv2Loc(n, 2, 1) = u(n, 0, 0) * t2r;
1561  jacCurv2Loc(n, 2, 2) = -v(n, 0, 0) * vn(n, 0, 2) * t2r;
1562  jacCurv2Loc(n, 3, 3) = v(n, 0, 1) * t1r;
1563  jacCurv2Loc(n, 3, 4) = -u(n, 0, 1) * t1r;
1564  jacCurv2Loc(n, 4, 3) = -v(n, 0, 0) * t1r;
1565  jacCurv2Loc(n, 4, 4) = u(n, 0, 0) * t1r;
1566  const float cosz = -vn(n, 0, 2) * qh2;
1567  const float ui = u(n, 0, 2) * t3r;
1568  const float vi = v(n, 0, 2) * t3r;
1569  jacCurv2Loc(n, 1, 3) = -ui * v(n, 0, 1) * cosz;
1570  jacCurv2Loc(n, 1, 4) = -vi * v(n, 0, 1) * cosz;
1571  jacCurv2Loc(n, 2, 3) = ui * v(n, 0, 0) * cosz;
1572  jacCurv2Loc(n, 2, 4) = vi * v(n, 0, 0) * cosz;
1573  //
1574  }
1575 
1576  // jacobian for converting from CCS to Loc (via Curv)
1577  MPlex56 jacCCS2Loc;
1578  JacCCS2Loc(jacCurv2Loc, jacCCS2Curv, jacCCS2Loc);
1579 
1580  // local error!
1581  MPlex5S psErrLoc;
1582  MPlex56 temp56;
1583  PsErrLoc(jacCCS2Loc, psErr, temp56);
1584  PsErrLocTransp(temp56, jacCCS2Loc, psErrLoc);
1585 
1586  MPlexHV md;
1587 #pragma omp simd
1588  for (int n = 0; n < NN; ++n) {
1589  md(n, 0, 0) = msPar(n, 0, 0) - plPnt(n, 0, 0);
1590  md(n, 0, 1) = msPar(n, 0, 1) - plPnt(n, 0, 1);
1591  md(n, 0, 2) = msPar(n, 0, 2) - plPnt(n, 0, 2);
1592  }
1593  MPlex2V mslo;
1594  RotateResidualsOnPlane(rot, md, mslo);
1595 
1596  MPlex2V res_loc; //position residual in local coordinates
1597 #pragma omp simd
1598  for (int n = 0; n < NN; ++n) {
1599  res_loc(n, 0, 0) = mslo(n, 0, 0) - xlo(n, 0, 0);
1600  res_loc(n, 0, 1) = mslo(n, 0, 1) - xlo(n, 0, 1);
1601  }
1602 
1603  MPlex2S msErr_loc;
1604  MPlex2H temp2Hmsl;
1605  ProjectResErr(rot, msErr, temp2Hmsl);
1606  ProjectResErrTransp(rot, temp2Hmsl, msErr_loc);
1607 
1608  MPlex2S resErr_loc; //covariance sum in local position coordinates
1609 #pragma omp simd
1610  for (int n = 0; n < NN; ++n) {
1611  resErr_loc(n, 0, 0) = psErrLoc(n, 3, 3) + msErr_loc(n, 0, 0);
1612  resErr_loc(n, 0, 1) = psErrLoc(n, 3, 4) + msErr_loc(n, 0, 1);
1613  resErr_loc(n, 1, 1) = psErrLoc(n, 4, 4) + msErr_loc(n, 1, 1);
1614  }
1615  /*
1616  printf("jacCCS2Curv:\n");
1617  for (int i = 0; i < 5; ++i) {
1618  for (int j = 0; j < 6; ++j)
1619  printf("%8f ", jacCCS2Curv.At(0, i, j));
1620  printf("\n");
1621  }
1622  printf("un:\n");
1623  for (int i = 0; i < 3; ++i) {
1624  printf("%8f ", un.At(0, i, 0));
1625  }
1626  printf("\n");
1627  printf("u:\n");
1628  for (int i = 0; i < 3; ++i) {
1629  printf("%8f ", u.At(0, i, 0));
1630  }
1631  printf("\n");
1632  printf("\n");
1633  printf("jacCurv2Loc:\n");
1634  for (int i = 0; i < 5; ++i) {
1635  for (int j = 0; j < 5; ++j)
1636  printf("%8f ", jacCurv2Loc.At(0, i, j));
1637  printf("\n");
1638  }
1639  printf("\n");
1640  printf("jacCCS2Loc:\n");
1641  for (int i = 0; i < 5; ++i) {
1642  for (int j = 0; j < 6; ++j)
1643  printf("%8f ", jacCCS2Loc.At(0, i, j));
1644  printf("\n");
1645  }
1646  printf("\n");
1647  printf("temp56:\n");
1648  for (int i = 0; i < 5; ++i) {
1649  for (int j = 0; j < 6; ++j)
1650  printf("%8f ", temp56.At(0, i, j));
1651  printf("\n");
1652  }
1653  printf("\n");
1654  printf("psErrLoc:\n");
1655  for (int i = 0; i < 5; ++i) {
1656  for (int j = 0; j < 5; ++j)
1657  printf("%8f ", psErrLoc.At(0, i, j));
1658  printf("\n");
1659  }
1660  printf("\n");
1661  printf("res_loc:\n");
1662  for (int i = 0; i < 2; ++i) {
1663  printf("%8f ", res_loc.At(0, i, 0));
1664  }
1665  printf("\n");
1666  printf("resErr_loc:\n");
1667  for (int i = 0; i < 2; ++i) {
1668  for (int j = 0; j < 2; ++j)
1669  printf("%8f ", resErr_loc.At(0, i, j));
1670  printf("\n");
1671  }
1672  printf("\n");
1673  */
1674  //invert the 2x2 matrix
1675  Matriplex::invertCramerSym(resErr_loc);
1676 
1677  if (kfOp & KFO_Calculate_Chi2) {
1678  Chi2Similarity(res_loc, resErr_loc, outChi2);
1679 
1680 #ifdef DEBUG
1681  {
1682  dmutex_guard;
1683  printf("resErr_loc (Inv):\n");
1684  for (int i = 0; i < 2; ++i) {
1685  for (int j = 0; j < 2; ++j)
1686  printf("%8f ", resErr_loc.At(0, i, j));
1687  printf("\n");
1688  }
1689  printf("\n");
1690  printf("chi2: %8f\n", outChi2.At(0, 0, 0));
1691  }
1692 #endif
1693  }
1694 
1695  if (kfOp & KFO_Update_Params) {
1696  MPlex52 K; // kalman gain
1697 #pragma omp simd
1698  for (int n = 0; n < NN; ++n) {
1699 #pragma GCC unroll 5
1700  for (int j = 0; j < 5; ++j) {
1701  K(n, j, 0) = resErr_loc(n, 0, 0) * psErrLoc(n, j, 3) + resErr_loc(n, 0, 1) * psErrLoc(n, j, 4);
1702  K(n, j, 1) = resErr_loc(n, 0, 1) * psErrLoc(n, j, 3) + resErr_loc(n, 1, 1) * psErrLoc(n, j, 4);
1703  }
1704  }
1705 
1706  MPlex5V lp_upd;
1707  MultResidualsAdd(K, lp, res_loc, lp_upd);
1708 
1709  MPlex55 ImKH(0.f);
1710 #pragma omp simd
1711  for (int n = 0; n < NN; ++n) {
1712 #pragma GCC unroll 5
1713  for (int j = 0; j < 5; ++j) {
1714  ImKH(n, j, j) = 1.f;
1715  ImKH(n, j, 3) -= K(n, j, 0);
1716  ImKH(n, j, 4) -= K(n, j, 1);
1717  }
1718  }
1719  MPlex5S psErrLoc_upd;
1720  PsErrLocUpd(ImKH, psErrLoc, psErrLoc_upd);
1721 
1722  //convert local updated parameters into CCS
1723  MPlexHV lxu;
1724  MPlexHV lpu;
1725 #pragma omp simd
1726  for (int n = 0; n < NN; ++n) {
1727  lxu(n, 0, 0) = lp_upd(n, 0, 3);
1728  lxu(n, 0, 1) = lp_upd(n, 0, 4);
1729  lxu(n, 0, 2) = 0.f;
1730  lpu(n, 0, 2) =
1731  pzSign(n, 0, 0) / (std::max(std::abs(lp_upd(n, 0, 0)), 1.e-9f) *
1732  std::sqrt(1.f + lp_upd(n, 0, 1) * lp_upd(n, 0, 1) + lp_upd(n, 0, 2) * lp_upd(n, 0, 2)));
1733  lpu(n, 0, 0) = lpu(n, 0, 2) * lp_upd(n, 0, 1);
1734  lpu(n, 0, 1) = lpu(n, 0, 2) * lp_upd(n, 0, 2);
1735  }
1736  MPlexHV gxu;
1737  RotateVectorOnPlaneTransp(rot, lxu, gxu);
1738 #pragma omp simd
1739  for (int n = 0; n < NN; ++n) {
1740  gxu(n, 0, 0) += plPnt(n, 0, 0);
1741  gxu(n, 0, 1) += plPnt(n, 0, 1);
1742  gxu(n, 0, 2) += plPnt(n, 0, 2);
1743  }
1744  MPlexHV gpu;
1745  RotateVectorOnPlaneTransp(rot, lpu, gpu);
1746 
1747  MPlexQF p;
1748 #pragma omp simd
1749  for (int n = 0; n < NN; ++n) {
1750  pt(n, 0, 0) = std::sqrt(gpu.At(n, 0, 0) * gpu.At(n, 0, 0) + gpu.At(n, 0, 1) * gpu.At(n, 0, 1));
1751  p(n, 0, 0) = std::sqrt(pt.At(n, 0, 0) * pt.At(n, 0, 0) + gpu.At(n, 0, 2) * gpu.At(n, 0, 2));
1752  sinP(n, 0, 0) = gpu.At(n, 0, 1) / pt(n, 0, 0);
1753  cosP(n, 0, 0) = gpu.At(n, 0, 0) / pt(n, 0, 0);
1754  sinT(n, 0, 0) = pt(n, 0, 0) / p(n, 0, 0);
1755  cosT(n, 0, 0) = gpu.At(n, 0, 2) / p(n, 0, 0);
1756  }
1757 
1758 #pragma omp simd
1759  for (int n = 0; n < NN; ++n) {
1760  outPar(n, 0, 0) = gxu.At(n, 0, 0);
1761  outPar(n, 0, 1) = gxu.At(n, 0, 1);
1762  outPar(n, 0, 2) = gxu.At(n, 0, 2);
1763  outPar(n, 0, 3) = 1.f / pt(n, 0, 0);
1764  outPar(n, 0, 4) = getPhi(gpu.At(n, 0, 0), gpu.At(n, 0, 1)); //fixme VDT or something?
1765  outPar(n, 0, 5) = getTheta(pt(n, 0, 0), gpu.At(n, 0, 2));
1766  }
1767 
1768  //now we need the jacobian to convert from curvilinear to CCS
1769  // code from TrackState::jacobianCurvilinearToCCS
1770  MPlex65 jacCurv2CCS(0.f);
1771 #pragma omp simd
1772  for (int n = 0; n < NN; ++n) {
1773  jacCurv2CCS(n, 0, 3) = -sinP(n, 0, 0);
1774  jacCurv2CCS(n, 0, 4) = -cosT(n, 0, 0) * cosP(n, 0, 0);
1775  jacCurv2CCS(n, 1, 3) = cosP(n, 0, 0);
1776  jacCurv2CCS(n, 1, 4) = -cosT(n, 0, 0) * sinP(n, 0, 0);
1777  jacCurv2CCS(n, 2, 4) = sinT(n, 0, 0);
1778  jacCurv2CCS(n, 3, 0) = inChg(n, 0, 0) / sinT(n, 0, 0);
1779  jacCurv2CCS(n, 3, 1) = outPar(n, 3, 0) * cosT(n, 0, 0) / sinT(n, 0, 0);
1780  jacCurv2CCS(n, 4, 2) = 1.f;
1781  jacCurv2CCS(n, 5, 1) = -1.f;
1782  }
1783 
1784  //now we need the jacobian from local to curv
1785  // code from TrackingTools/AnalyticalJacobians/src/JacobianLocalToCurvilinear.cc
1786  MPlexHV tnl;
1787 #pragma omp simd
1788  for (int n = 0; n < NN; ++n) {
1789  const float abslpupd00 = std::max(std::abs(lp_upd(n, 0, 0)), 1.e-9f);
1790  tnl(n, 0, 0) = lpu(n, 0, 0) * abslpupd00;
1791  tnl(n, 0, 1) = lpu(n, 0, 1) * abslpupd00;
1792  tnl(n, 0, 2) = lpu(n, 0, 2) * abslpupd00;
1793  }
1794  MPlexHV tn;
1795  RotateVectorOnPlaneTransp(rot, tnl, tn);
1796 #pragma omp simd
1797  for (int n = 0; n < NN; ++n) {
1798  vn(n, 0, 2) = std::max(1.e-30f, std::sqrt(tn(n, 0, 0) * tn(n, 0, 0) + tn(n, 0, 1) * tn(n, 0, 1)));
1799  un(n, 0, 0) = -tn(n, 0, 1) / vn(n, 0, 2);
1800  un(n, 0, 1) = tn(n, 0, 0) / vn(n, 0, 2);
1801  un(n, 0, 2) = 0.f;
1802  vn(n, 0, 0) = -tn(n, 0, 2) * un(n, 0, 1);
1803  vn(n, 0, 1) = tn(n, 0, 2) * un(n, 0, 0);
1804  }
1805  MPlex55 jacLoc2Curv(0.f);
1806 #pragma omp simd
1807  for (int n = 0; n < NN; ++n) {
1808  // fixme? //(pf.use_param_b_field ? 0.01f * Const::sol * Config::bFieldFromZR(psPar(n, 2, 0), hipo(psPar(n, 0, 0), psPar(n, 1, 0))) : 0.01f * Const::sol * Config::Bfield);
1809  const float bF = 0.01f * Const::sol * Config::Bfield; //fixme: cache?
1810  const float qh2 = bF * lp_upd(n, 0, 0);
1811  const float cosl1 = 1.f / vn(n, 0, 2);
1812  const float uj = un(n, 0, 0) * rot(n, 0, 0) + un(n, 0, 1) * rot(n, 0, 1);
1813  const float uk = un(n, 0, 0) * rot(n, 1, 0) + un(n, 0, 1) * rot(n, 1, 1);
1814  const float vj = vn(n, 0, 0) * rot(n, 0, 0) + vn(n, 0, 1) * rot(n, 0, 1) + vn(n, 0, 2) * rot(n, 0, 2);
1815  const float vk = vn(n, 0, 0) * rot(n, 1, 0) + vn(n, 0, 1) * rot(n, 1, 1) + vn(n, 0, 2) * rot(n, 1, 2);
1816  const float cosz = vn(n, 0, 2) * qh2;
1817  jacLoc2Curv(n, 0, 0) = 1.f;
1818  jacLoc2Curv(n, 1, 1) = tnl(n, 0, 2) * vj;
1819  jacLoc2Curv(n, 1, 2) = tnl(n, 0, 2) * vk;
1820  jacLoc2Curv(n, 2, 1) = tnl(n, 0, 2) * uj * cosl1;
1821  jacLoc2Curv(n, 2, 2) = tnl(n, 0, 2) * uk * cosl1;
1822  jacLoc2Curv(n, 3, 3) = uj;
1823  jacLoc2Curv(n, 3, 4) = uk;
1824  jacLoc2Curv(n, 4, 3) = vj;
1825  jacLoc2Curv(n, 4, 4) = vk;
1826  jacLoc2Curv(n, 2, 3) = tnl(n, 0, 0) * (cosz * cosl1);
1827  jacLoc2Curv(n, 2, 4) = tnl(n, 0, 1) * (cosz * cosl1);
1828  }
1829 
1830  // jacobian for converting from Loc to CCS (via Curv)
1831  MPlex65 jacLoc2CCS;
1832  JacLoc2CCS(jacCurv2CCS, jacLoc2Curv, jacLoc2CCS);
1833 
1834  // CCS error!
1835  MPlex65 temp65;
1836  OutErrCCS(jacLoc2CCS, psErrLoc_upd, temp65);
1837  OutErrCCSTransp(temp65, jacLoc2CCS, outErr);
1838 
1839  /*
1840  printf("\n");
1841  printf("lp_upd:\n");
1842  for (int i = 0; i < 5; ++i) {
1843  printf("%8f ", lp_upd.At(0, i, 0));
1844  }
1845  printf("\n");
1846  printf("psErrLoc_upd:\n");
1847  for (int i = 0; i < 5; ++i) {
1848  for (int j = 0; j < 5; ++j)
1849  printf("%8f ", psErrLoc_upd.At(0, i, j));
1850  printf("\n");
1851  }
1852  printf("\n");
1853  printf("lxu:\n");
1854  for (int i = 0; i < 3; ++i) {
1855  printf("%8f ", lxu.At(0, i, 0));
1856  }
1857  printf("\n");
1858  printf("lpu:\n");
1859  for (int i = 0; i < 3; ++i) {
1860  printf("%8f ", lpu.At(0, i, 0));
1861  }
1862  printf("\n");
1863  printf("gxu:\n");
1864  for (int i = 0; i < 3; ++i) {
1865  printf("%8f ", gxu.At(0, i, 0));
1866  }
1867  printf("\n");
1868  printf("gpu:\n");
1869  for (int i = 0; i < 3; ++i) {
1870  printf("%8f ", gpu.At(0, i, 0));
1871  }
1872  printf("\n");
1873  printf("outPar:\n");
1874  for (int i = 0; i < 6; ++i) {
1875  printf("%8f ", outPar.At(0, i, 0));
1876  }
1877  printf("\n");
1878  printf("tnl:\n");
1879  for (int i = 0; i < 3; ++i) {
1880  printf("%8f ", tnl.At(0, i, 0));
1881  }
1882  printf("\n");
1883  printf("tn:\n");
1884  for (int i = 0; i < 3; ++i) {
1885  printf("%8f ", tn.At(0, i, 0));
1886  }
1887  printf("\n");
1888  printf("un:\n");
1889  for (int i = 0; i < 3; ++i) {
1890  printf("%8f ", un.At(0, i, 0));
1891  }
1892  printf("\n");
1893  printf("vn:\n");
1894  for (int i = 0; i < 3; ++i) {
1895  printf("%8f ", vn.At(0, i, 0));
1896  }
1897  printf("\n");
1898  printf("jacLoc2Curv:\n");
1899  for (int i = 0; i < 5; ++i) {
1900  for (int j = 0; j < 5; ++j)
1901  printf("%8f ", jacLoc2Curv.At(0, i, j));
1902  printf("\n");
1903  }
1904  printf("\n");
1905  printf("outErr:\n");
1906  for (int i = 0; i < 6; ++i) {
1907  for (int j = 0; j < 6; ++j)
1908  printf("%8f ", outErr.At(0, i, j));
1909  printf("\n");
1910  }
1911  printf("\n");
1912  */
1913 
1914 #ifdef DEBUG
1915  {
1916  dmutex_guard;
1917  if (kfOp & KFO_Local_Cov) {
1918  printf("psErrLoc_upd:\n");
1919  for (int i = 0; i < 5; ++i) {
1920  for (int j = 0; j < 5; ++j)
1921  printf("% 8e ", psErrLoc_upd.At(0, i, j));
1922  printf("\n");
1923  }
1924  printf("\n");
1925  }
1926  printf("resErr_loc (Inv):\n");
1927  for (int i = 0; i < 2; ++i) {
1928  for (int j = 0; j < 2; ++j)
1929  printf("%8f ", resErr_loc.At(0, i, j));
1930  printf("\n");
1931  }
1932  printf("\n");
1933  printf("K:\n");
1934  for (int i = 0; i < 6; ++i) {
1935  for (int j = 0; j < 2; ++j)
1936  printf("%8f ", K.At(0, i, j));
1937  printf("\n");
1938  }
1939  printf("\n");
1940  printf("outPar:\n");
1941  for (int i = 0; i < 6; ++i) {
1942  printf("%8f ", outPar.At(0, i, 0));
1943  }
1944  printf("\n");
1945  printf("outErr:\n");
1946  for (int i = 0; i < 6; ++i) {
1947  for (int j = 0; j < 6; ++j)
1948  printf("%8f ", outErr.At(0, i, j));
1949  printf("\n");
1950  }
1951  printf("\n");
1952  }
1953 #endif
1954  }
1955 
1956  return;
1957  }
Matriplex::Matriplex< float, HH, HH, NN > MPlexHH
Definition: Matrix.h:57
Matriplex::MatriplexSym< float, 5, NN > MPlex5S
Definition: Matrix.h:62
Matriplex::Matriplex< float, HH, 1, NN > MPlexHV
Definition: Matrix.h:58
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float getTheta(float r, float z)
Definition: Hit.h:36
Matriplex::Matriplex< float, 5, 5, NN > MPlex55
Definition: Matrix.h:64
void invertCramerSym(MPlexSym< T, D, N > &A, double *determ=nullptr)
Definition: MatriplexSym.h:421
T sqrt(T t)
Definition: SSEVec.h:23
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr float Bfield
Definition: Config.h:60
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
Matriplex::Matriplex< int, 1, 1, NN > MPlexQI
Definition: Matrix.h:81
Matriplex::Matriplex< float, 5, 6, NN > MPlex56
Definition: Matrix.h:65
Matriplex::Matriplex< float, 2, HH, NN > MPlex2H
Definition: Matrix.h:78
constexpr float sol
Definition: Config.h:13
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
Matriplex::MatriplexSym< float, 2, NN > MPlex2S
Definition: Matrix.h:70
Matriplex::Matriplex< float, 5, 2, NN > MPlex52
Definition: Matrix.h:75
float getPhi(float x, float y)
Definition: Hit.h:34
Matriplex::Matriplex< float, 2, 1, NN > MPlex2V
Definition: Matrix.h:69
Matriplex::Matriplex< float, 5, 1, NN > MPlex5V
Definition: Matrix.h:61
Matriplex::Matriplex< float, 6, 5, NN > MPlex65
Definition: Matrix.h:66

◆ kalmanPropagateAndComputeChi2()

void mkfit::kalmanPropagateAndComputeChi2 ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexQF outChi2,
MPlexLV propPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags propFlags,
const bool  propToHit 
)

Definition at line 968 of file KalmanUtilsMPlex.cc.

References Matriplex::hypot(), kalmanOperation(), KFO_Calculate_Chi2, create_idmaps::n, NN, and propagateHelixToRMPlex().

978  {
979  propPar = psPar;
980  if (propToHit) {
981  MPlexLS propErr;
982  MPlexQF msRad;
983 #pragma omp simd
984  for (int n = 0; n < NN; ++n) {
985  if (n < N_proc) {
986  msRad.At(n, 0, 0) = std::hypot(msPar.constAt(n, 0, 0), msPar.constAt(n, 1, 0));
987  } else {
988  msRad.At(n, 0, 0) = 0.0f;
989  }
990  }
991 
992  propagateHelixToRMPlex(psErr, psPar, inChg, msRad, propErr, propPar, outFailFlag, N_proc, propFlags);
993 
994  kalmanOperation(KFO_Calculate_Chi2, propErr, propPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
995  } else {
996  kalmanOperation(KFO_Calculate_Chi2, psErr, psPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
997  }
998  }
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:616
void propagateHelixToRMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr)
void kalmanOperation(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55

◆ kalmanPropagateAndComputeChi2Endcap()

void mkfit::kalmanPropagateAndComputeChi2Endcap ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexQF outChi2,
MPlexLV propPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags propFlags,
const bool  propToHit 
)

Definition at line 2236 of file KalmanUtilsMPlex.cc.

References kalmanOperationEndcap(), KFO_Calculate_Chi2, create_idmaps::n, NN, and propagateHelixToZMPlex().

2246  {
2247  propPar = psPar;
2248  if (propToHit) {
2249  MPlexLS propErr;
2250  MPlexQF msZ;
2251 #pragma omp simd
2252  for (int n = 0; n < NN; ++n) {
2253  msZ.At(n, 0, 0) = msPar.constAt(n, 2, 0);
2254  }
2255 
2256  propagateHelixToZMPlex(psErr, psPar, inChg, msZ, propErr, propPar, outFailFlag, N_proc, propFlags);
2257 
2258  kalmanOperationEndcap(KFO_Calculate_Chi2, propErr, propPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
2259  } else {
2260  kalmanOperationEndcap(KFO_Calculate_Chi2, psErr, psPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
2261  }
2262  }
void kalmanOperationEndcap(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
void propagateHelixToZMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr=nullptr)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55

◆ kalmanPropagateAndComputeChi2Plane()

void mkfit::kalmanPropagateAndComputeChi2Plane ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
const MPlexHV plNrm,
const MPlexHV plDir,
const MPlexHV plPnt,
MPlexQF outChi2,
MPlexLV propPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags propFlags,
const bool  propToHit 
)

Definition at line 1323 of file KalmanUtilsMPlex.cc.

References kalmanOperationPlaneLocal(), KFO_Calculate_Chi2, and propagateHelixToPlaneMPlex().

Referenced by mkfit::MkFinder::findCandidates(), and mkfit::MkFinder::findCandidatesCloneEngine().

1336  {
1337  propPar = psPar;
1338  if (propToHit) {
1339  MPlexLS propErr;
1340  propagateHelixToPlaneMPlex(psErr, psPar, inChg, msPar, plNrm, propErr, propPar, outFailFlag, N_proc, propFlags);
1341 
1343  propErr,
1344  propPar,
1345  inChg,
1346  msErr,
1347  msPar,
1348  plNrm,
1349  plDir,
1350  plPnt,
1351  dummy_err,
1352  dummy_par,
1353  outChi2,
1354  N_proc);
1355  } else {
1357  psErr,
1358  psPar,
1359  inChg,
1360  msErr,
1361  msPar,
1362  plNrm,
1363  plDir,
1364  plPnt,
1365  dummy_err,
1366  dummy_par,
1367  outChi2,
1368  N_proc);
1369  }
1370  }
void propagateHelixToPlaneMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexHV &plPnt, const MPlexHV &plNrm, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr=nullptr)
void kalmanOperationPlaneLocal(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55

◆ kalmanPropagateAndUpdate()

void mkfit::kalmanPropagateAndUpdate ( const MPlexLS psErr,
const MPlexLV psPar,
MPlexQI Chg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags propFlags,
const bool  propToHit 
)

Definition at line 920 of file KalmanUtilsMPlex.cc.

References Matriplex::hypot(), kalmanOperation(), KFO_Local_Cov, KFO_Update_Params, create_idmaps::n, NN, and propagateHelixToRMPlex().

930  {
931  if (propToHit) {
932  MPlexLS propErr;
933  MPlexLV propPar;
934  MPlexQF msRad;
935 #pragma omp simd
936  for (int n = 0; n < NN; ++n) {
937  msRad.At(n, 0, 0) = std::hypot(msPar.constAt(n, 0, 0), msPar.constAt(n, 1, 0));
938  }
939 
940  propagateHelixToRMPlex(psErr, psPar, Chg, msRad, propErr, propPar, outFailFlag, N_proc, propFlags);
941 
943  KFO_Update_Params | KFO_Local_Cov, propErr, propPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
944  } else {
946  KFO_Update_Params | KFO_Local_Cov, psErr, psPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
947  }
948  for (int n = 0; n < NN; ++n) {
949  if (n < N_proc && outPar.At(n, 3, 0) < 0) {
950  Chg.At(n, 0, 0) = -Chg.At(n, 0, 0);
951  outPar.At(n, 3, 0) = -outPar.At(n, 3, 0);
952  }
953  }
954  }
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:616
void propagateHelixToRMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr)
Matriplex::Matriplex< float, LL, 1, NN > MPlexLV
Definition: Matrix.h:54
void kalmanOperation(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55

◆ kalmanPropagateAndUpdateEndcap()

void mkfit::kalmanPropagateAndUpdateEndcap ( const MPlexLS psErr,
const MPlexLV psPar,
MPlexQI Chg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags propFlags,
const bool  propToHit 
)

Definition at line 2190 of file KalmanUtilsMPlex.cc.

References kalmanOperationEndcap(), KFO_Update_Params, create_idmaps::n, NN, and propagateHelixToZMPlex().

2200  {
2201  if (propToHit) {
2202  MPlexLS propErr;
2203  MPlexLV propPar;
2204  MPlexQF msZ;
2205 #pragma omp simd
2206  for (int n = 0; n < NN; ++n) {
2207  msZ.At(n, 0, 0) = msPar.constAt(n, 2, 0);
2208  }
2209 
2210  propagateHelixToZMPlex(psErr, psPar, Chg, msZ, propErr, propPar, outFailFlag, N_proc, propFlags);
2211 
2212  kalmanOperationEndcap(KFO_Update_Params, propErr, propPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
2213  } else {
2214  kalmanOperationEndcap(KFO_Update_Params, psErr, psPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
2215  }
2216  for (int n = 0; n < NN; ++n) {
2217  if (n < N_proc && outPar.At(n, 3, 0) < 0) {
2218  Chg.At(n, 0, 0) = -Chg.At(n, 0, 0);
2219  outPar.At(n, 3, 0) = -outPar.At(n, 3, 0);
2220  }
2221  }
2222  }
void kalmanOperationEndcap(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
Matriplex::Matriplex< float, LL, 1, NN > MPlexLV
Definition: Matrix.h:54
void propagateHelixToZMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr=nullptr)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55

◆ kalmanPropagateAndUpdatePlane()

void mkfit::kalmanPropagateAndUpdatePlane ( const MPlexLS psErr,
const MPlexLV psPar,
MPlexQI Chg,
const MPlexHS msErr,
const MPlexHV msPar,
const MPlexHV plNrm,
const MPlexHV plDir,
const MPlexHV plPnt,
MPlexLS outErr,
MPlexLV outPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags propFlags,
const bool  propToHit 
)

Definition at line 1241 of file KalmanUtilsMPlex.cc.

References kalmanOperationPlaneLocal(), KFO_Local_Cov, KFO_Update_Params, create_idmaps::n, NN, and propagateHelixToPlaneMPlex().

Referenced by mkfit::MkFinder::updateWithLoadedHit().

1254  {
1255  if (propToHit) {
1256  MPlexLS propErr;
1257  MPlexLV propPar;
1258  propagateHelixToPlaneMPlex(psErr, psPar, Chg, msPar, plNrm, propErr, propPar, outFailFlag, N_proc, propFlags);
1259 
1261  propErr,
1262  propPar,
1263  Chg,
1264  msErr,
1265  msPar,
1266  plNrm,
1267  plDir,
1268  plPnt,
1269  outErr,
1270  outPar,
1271  dummy_chi2,
1272  N_proc);
1273  } else {
1275  psErr,
1276  psPar,
1277  Chg,
1278  msErr,
1279  msPar,
1280  plNrm,
1281  plDir,
1282  plPnt,
1283  outErr,
1284  outPar,
1285  dummy_chi2,
1286  N_proc);
1287  }
1288  for (int n = 0; n < NN; ++n) {
1289  if (outPar.At(n, 3, 0) < 0) {
1290  Chg.At(n, 0, 0) = -Chg.At(n, 0, 0);
1291  outPar.At(n, 3, 0) = -outPar.At(n, 3, 0);
1292  }
1293  }
1294  }
Matriplex::Matriplex< float, LL, 1, NN > MPlexLV
Definition: Matrix.h:54
void propagateHelixToPlaneMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexHV &plPnt, const MPlexHV &plNrm, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr=nullptr)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
void kalmanOperationPlaneLocal(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55

◆ kalmanUpdate()

void mkfit::kalmanUpdate ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc 
)

Definition at line 910 of file KalmanUtilsMPlex.cc.

References kalmanOperation(), KFO_Local_Cov, and KFO_Update_Params.

Referenced by mkfit::MkFitter::fitTracksWithInterSlurp().

916  {
917  kalmanOperation(KFO_Update_Params | KFO_Local_Cov, psErr, psPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
918  }
void kalmanOperation(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)

◆ kalmanUpdateEndcap()

void mkfit::kalmanUpdateEndcap ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc 
)

Definition at line 2180 of file KalmanUtilsMPlex.cc.

References kalmanOperationEndcap(), and KFO_Update_Params.

2186  {
2187  kalmanOperationEndcap(KFO_Update_Params, psErr, psPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
2188  }
void kalmanOperationEndcap(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)

◆ kalmanUpdatePlane()

void mkfit::kalmanUpdatePlane ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI Chg,
const MPlexHS msErr,
const MPlexHV msPar,
const MPlexHV plNrm,
const MPlexHV plDir,
const MPlexHV plPnt,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc 
)

Definition at line 1215 of file KalmanUtilsMPlex.cc.

References kalmanOperationPlaneLocal(), KFO_Local_Cov, and KFO_Update_Params.

1225  {
1227  psErr,
1228  psPar,
1229  Chg,
1230  msErr,
1231  msPar,
1232  plNrm,
1233  plDir,
1234  plPnt,
1235  outErr,
1236  outPar,
1237  dummy_chi2,
1238  N_proc);
1239  }
void kalmanOperationPlaneLocal(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, const MPlexHV &plNrm, const MPlexHV &plDir, const MPlexHV &plPnt, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)

◆ MultHelixPropFull()

void mkfit::MultHelixPropFull ( const MPlexLL A,
const MPlexLS B,
MPlexLL C 
)

Definition at line 14 of file PropagationMPlexCommon.cc.

References A, B, correctionTermsCaloMet_cff::C, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, create_idmaps::n, and NN.

14  {
15  for (int n = 0; n < NN; ++n) {
16  for (int i = 0; i < 6; ++i) {
17 // optimization reports indicate only the inner two loops are good
18 // candidates for vectorization
19 #pragma omp simd
20  for (int j = 0; j < 6; ++j) {
21  C(n, i, j) = 0.;
22  for (int k = 0; k < 6; ++k)
23  C(n, i, j) += A.constAt(n, i, k) * B.constAt(n, k, j);
24  }
25  }
26  }
27  }
Definition: APVGainStruct.h:7
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Definition: APVGainStruct.h:7

◆ MultHelixPropTranspFull()

void mkfit::MultHelixPropTranspFull ( const MPlexLL A,
const MPlexLL B,
MPlexLS C 
)

Definition at line 30 of file PropagationMPlexCommon.cc.

References A, B, correctionTermsCaloMet_cff::C, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, create_idmaps::n, and NN.

30  {
31  for (int n = 0; n < NN; ++n) {
32  for (int i = 0; i < 6; ++i) {
33 // optimization reports indicate only the inner two loops are good
34 // candidates for vectorization
35 #pragma omp simd
36  for (int j = 0; j < 6; ++j) {
37  C(n, i, j) = 0.;
38  for (int k = 0; k < 6; ++k)
39  C(n, i, j) += B.constAt(n, i, k) * A.constAt(n, j, k);
40  }
41  }
42  }
43  }
Definition: APVGainStruct.h:7
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Definition: APVGainStruct.h:7

◆ operator==()

template<class T , class U >
bool mkfit::operator== ( const CcAlloc< T > &  a,
const CcAlloc< U > &  b 
)

Definition at line 151 of file TrackStructures.h.

References a, and b.

151  {
152  return a.pool_id() == b.pool_id();
153  }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ passStripChargePCMfromTrack()

bool mkfit::passStripChargePCMfromTrack ( int  itrack,
bool  isBarrel,
unsigned int  pcm,
unsigned int  pcmMin,
const MPlexLV pPar,
const MPlexHS msErr 
)

Definition at line 1335 of file MkFinder.cc.

References funct::abs(), funct::cos(), dprint, f, PixelPluginsPhase0_cfi::isBarrel, mkfit::Hit::maxChargePerCM(), amptDefault_cfi::proj, funct::sin(), and mathSSE::sqrt().

Referenced by mkfit::MkFinder::findCandidates(), and mkfit::MkFinder::findCandidatesCloneEngine().

1336  {
1337  //skip the overflow case
1338  if (pcm >= Hit::maxChargePerCM())
1339  return true;
1340 
1341  float qSF;
1342  if (isBarrel) { //project in x,y, assuming zero-error direction is in this plane
1343  const float hitT2 = msErr.constAt(itrack, 0, 0) + msErr.constAt(itrack, 1, 1);
1344  const float hitT2inv = 1.f / hitT2;
1345  const float proj[3] = {msErr.constAt(itrack, 0, 0) * hitT2inv,
1346  msErr.constAt(itrack, 0, 1) * hitT2inv,
1347  msErr.constAt(itrack, 1, 1) * hitT2inv};
1348  const bool detXY_OK =
1349  std::abs(proj[0] * proj[2] - proj[1] * proj[1]) < 0.1f; //check that zero-direction is close
1350  const float cosP = cos(pPar.constAt(itrack, 4, 0));
1351  const float sinP = sin(pPar.constAt(itrack, 4, 0));
1352  const float sinT = std::abs(sin(pPar.constAt(itrack, 5, 0)));
1353  //qSF = sqrt[(px,py)*(1-proj)*(px,py)]/p = sinT*sqrt[(cosP,sinP)*(1-proj)*(cosP,sinP)].
1354  qSF = detXY_OK ? sinT * std::sqrt(std::abs(1.f + cosP * cosP * proj[0] + sinP * sinP * proj[2] -
1355  2.f * cosP * sinP * proj[1]))
1356  : 1.f;
1357  } else { //project on z
1358  // p_zLocal/p = p_z/p = cosT
1359  qSF = std::abs(cos(pPar.constAt(itrack, 5, 0)));
1360  }
1361 
1362  const float qCorr = pcm * qSF;
1363  dprint("pcm " << pcm << " * " << qSF << " = " << qCorr << " vs " << pcmMin);
1364  return qCorr > pcmMin;
1365  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
#define dprint(x)
Definition: Debug.h:95

◆ print() [1/5]

void mkfit::print ( std::string_view  label,
const MeasurementState s 
)

Definition at line 8 of file Hit.cc.

References gather_cfg::cout, dumpMatrix(), label, and alignCSCRings::s.

Referenced by mkfit::Shell::Compare(), conformalFitMPlex(), print(), and mkfit::StdSeq::track_print().

8  {
9  std::cout << label << std::endl;
10  std::cout << "x: " << s.parameters()[0] << " y: " << s.parameters()[1] << " z: " << s.parameters()[2] << std::endl
11  << "errors: " << std::endl;
12  dumpMatrix(s.errors());
13  std::cout << std::endl;
14  }
char const * label
void dumpMatrix(Matrix m)
Definition: MatrixSTypes.h:37

◆ print() [2/5]

void mkfit::print ( const TrackState s)

Definition at line 402 of file Track.cc.

References gather_cfg::cout, dumpMatrix(), and alignCSCRings::s.

402  {
403  std::cout << " x: " << s.parameters[0] << " y: " << s.parameters[1] << " z: " << s.parameters[2] << std::endl
404  << " px: " << s.parameters[3] << " py: " << s.parameters[4] << " pz: " << s.parameters[5] << std::endl
405  << "valid: " << s.valid << " errors: " << std::endl;
406  dumpMatrix(s.errors);
407  std::cout << std::endl;
408  }
void dumpMatrix(Matrix m)
Definition: MatrixSTypes.h:37

◆ print() [3/5]

void mkfit::print ( std::string  pfx,
int  itrack,
const Track trk,
bool  print_hits = false 
)

Definition at line 410 of file Track.cc.

References gather_cfg::cout, mps_fire::i, geometryDiffVisualizer::pfx, print(), and trk.

410  {
411  std::cout << std::endl
412  << pfx << ": " << itrack << " hits: " << trk.nFoundHits() << " label: " << trk.label() << " State"
413  << std::endl;
414  print(trk.state());
415  if (print_hits) {
416  for (int i = 0; i < trk.nTotalHits(); ++i)
417  printf(" %2d: lyr %2d idx %d\n", i, trk.getHitLyr(i), trk.getHitIdx(i));
418  }
419  }
Trktree trk
Definition: Trktree.cc:2
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ print() [4/5]

void mkfit::print ( std::string  pfx,
const TrackState s 
)

Definition at line 421 of file Track.cc.

References gather_cfg::cout, geometryDiffVisualizer::pfx, print(), and alignCSCRings::s.

421  {
422  std::cout << pfx << std::endl;
423  print(s);
424  }
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ print() [5/5]

void mkfit::print ( std::string  pfx,
int  itrack,
const Track trk,
const Event ev 
)

Definition at line 1068 of file Event.cc.

References gather_cfg::cout, makeMEIFBenchmarkPlots::ev, h, mps_fire::i, geometryDiffVisualizer::pfx, print(), and trk.

1068  {
1069  std::cout << std::endl
1070  << pfx << ": " << itrack << " hits: " << trk.nFoundHits() << " label: " << trk.label()
1071  << " State:" << std::endl;
1072  print(trk.state());
1073 
1074  for (int i = 0; i < trk.nTotalHits(); ++i) {
1075  auto hot = trk.getHitOnTrack(i);
1076  printf(" %2d: lyr %2d idx %5d", i, hot.layer, hot.index);
1077  if (hot.index >= 0) {
1078  auto &h = ev.layerHits_[hot.layer][hot.index];
1079  int hl = ev.simHitsInfo_[h.mcHitID()].mcTrackID_;
1080  printf(" %4d %8.3f %8.3f %8.3f r=%.3f\n", hl, h.x(), h.y(), h.z(), h.r());
1081  } else {
1082  printf("\n");
1083  }
1084  }
1085  }
Trktree trk
Definition: Trktree.cc:2
void print(std::string pfx, int itrack, const Track &trk, const Event &ev)
Definition: Event.cc:1068
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ propagateHelixToPlaneMPlex()

void mkfit::propagateHelixToPlaneMPlex ( const MPlexLS inErr,
const MPlexLV inPar,
const MPlexQI inChg,
const MPlexHV plPnt,
const MPlexHV plNrm,
MPlexLS outErr,
MPlexLV outPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags pflags,
const MPlexQI noMatEffPtr = nullptr 
)

Definition at line 525 of file PropagationMPlexPlane.cc.

References funct::abs(), mkfit::PropagationFlags::apply_material, applyMaterialEffects(), funct::cos(), debug, dprint_np, dprintf, g_debug, helixAtPlane(), Matriplex::hypot(), mps_fire::i, dqmiolumiharvest::j, GetRecoTauVFromDQM_MC_cff::kk, mkfit::TrackerInfo::material_checked(), create_idmaps::n, NN, mkfit::TrackerInfo::Material::radl, funct::sin(), mathSSE::sqrt(), squashPhiMPlex(), funct::tan(), groupFilesInBlocks::temp, and mkfit::PropagationFlags::tracker_info.

Referenced by kalmanPropagateAndComputeChi2Plane(), and kalmanPropagateAndUpdatePlane().

535  {
536  // debug = true;
537 
538  outErr = inErr;
539  outPar = inPar;
540 
541  MPlexQF pathL;
542  MPlexLL errorProp;
543 
544  helixAtPlane(inPar, inChg, plPnt, plNrm, pathL, outPar, errorProp, outFailFlag, N_proc, pflags);
545 
546 #ifdef DEBUG
547  for (int n = 0; n < N_proc; ++n) {
548  dprint_np(
549  n,
550  "propagation to plane end, dump parameters\n"
551  //<< " D = " << s[n] << " alpha = " << s[n] * std::sin(inPar(n, 5, 0)) * inPar(n, 3, 0) * kinv[n] << " kinv = " << kinv[n] << std::endl
552  << " pos = " << outPar(n, 0, 0) << " " << outPar(n, 1, 0) << " " << outPar(n, 2, 0) << "\t\t r="
553  << std::sqrt(outPar(n, 0, 0) * outPar(n, 0, 0) + outPar(n, 1, 0) * outPar(n, 1, 0)) << std::endl
554  << " mom = " << outPar(n, 3, 0) << " " << outPar(n, 4, 0) << " " << outPar(n, 5, 0) << std::endl
555  << " charge = " << inChg(n, 0, 0) << std::endl
556  << " cart= " << std::cos(outPar(n, 4, 0)) / outPar(n, 3, 0) << " "
557  << std::sin(outPar(n, 4, 0)) / outPar(n, 3, 0) << " " << 1. / (outPar(n, 3, 0) * tan(outPar(n, 5, 0)))
558  << "\t\tpT=" << 1. / std::abs(outPar(n, 3, 0)) << std::endl);
559  }
560 
561  if (debug && g_debug) {
562  for (int kk = 0; kk < N_proc; ++kk) {
563  dprintf("inPar %d\n", kk);
564  for (int i = 0; i < 6; ++i) {
565  dprintf("%8f ", inPar.constAt(kk, i, 0));
566  }
567  dprintf("\n");
568  dprintf("inErr %d\n", kk);
569  for (int i = 0; i < 6; ++i) {
570  for (int j = 0; j < 6; ++j)
571  dprintf("%8f ", inErr.constAt(kk, i, j));
572  dprintf("\n");
573  }
574  dprintf("\n");
575 
576  for (int kk = 0; kk < N_proc; ++kk) {
577  dprintf("plNrm %d\n", kk);
578  for (int j = 0; j < 3; ++j)
579  dprintf("%8f ", plNrm.constAt(kk, 0, j));
580  }
581  dprintf("\n");
582 
583  for (int kk = 0; kk < N_proc; ++kk) {
584  dprintf("pathL %d\n", kk);
585  for (int j = 0; j < 1; ++j)
586  dprintf("%8f ", pathL.constAt(kk, 0, j));
587  }
588  dprintf("\n");
589 
590  dprintf("errorProp %d\n", kk);
591  for (int i = 0; i < 6; ++i) {
592  for (int j = 0; j < 6; ++j)
593  dprintf("%8f ", errorProp.At(kk, i, j));
594  dprintf("\n");
595  }
596  dprintf("\n");
597  }
598  }
599 #endif
600 
601  // Matriplex version of:
602  // result.errors = ROOT::Math::Similarity(errorProp, outErr);
603  MPlexLL temp;
604  MultHelixPlaneProp(errorProp, outErr, temp);
605  MultHelixPlanePropTransp(errorProp, temp, outErr);
606  // MultHelixPropFull(errorProp, outErr, temp);
607  // for (int kk = 0; kk < 1; ++kk) {
608  // std::cout << "errorProp" << std::endl;
609  // for (int i = 0; i < 6; ++i) {
610  // for (int j = 0; j < 6; ++j)
611  // std::cout << errorProp.constAt(kk, i, j) << " ";
612  // std::cout << std::endl;;
613  // }
614  // std::cout << std::endl;;
615  // std::cout << "outErr" << std::endl;
616  // for (int i = 0; i < 6; ++i) {
617  // for (int j = 0; j < 6; ++j)
618  // std::cout << outErr.constAt(kk, i, j) << " ";
619  // std::cout << std::endl;;
620  // }
621  // std::cout << std::endl;;
622  // std::cout << "temp" << std::endl;
623  // for (int i = 0; i < 6; ++i) {
624  // for (int j = 0; j < 6; ++j)
625  // std::cout << temp.constAt(kk, i, j) << " ";
626  // std::cout << std::endl;;
627  // }
628  // std::cout << std::endl;;
629  // }
630  // MultHelixPropTranspFull(errorProp, temp, outErr);
631 
632 #ifdef DEBUG
633  if (debug && g_debug) {
634  for (int kk = 0; kk < N_proc; ++kk) {
635  dprintf("outErr %d\n", kk);
636  for (int i = 0; i < 6; ++i) {
637  for (int j = 0; j < 6; ++j)
638  dprintf("%8f ", outErr.constAt(kk, i, j));
639  dprintf("\n");
640  }
641  dprintf("\n");
642  }
643  }
644 #endif
645 
646  if (pflags.apply_material) {
647  MPlexQF hitsRl;
648  MPlexQF hitsXi;
649  MPlexQF propSign;
650 
651  const TrackerInfo& tinfo = *pflags.tracker_info;
652 
653 #pragma omp simd
654  for (int n = 0; n < NN; ++n) {
655  if (n >= N_proc || (noMatEffPtr && noMatEffPtr->constAt(n, 0, 0))) {
656  hitsRl(n, 0, 0) = 0.f;
657  hitsXi(n, 0, 0) = 0.f;
658  } else {
659  const float hypo = std::hypot(outPar(n, 0, 0), outPar(n, 1, 0));
660  auto mat = tinfo.material_checked(std::abs(outPar(n, 2, 0)), hypo);
661  hitsRl(n, 0, 0) = mat.radl;
662  hitsXi(n, 0, 0) = mat.bbxi;
663  }
664  propSign(n, 0, 0) = (pathL(n, 0, 0) > 0.f ? 1.f : -1.f);
665  }
666  applyMaterialEffects(hitsRl, hitsXi, propSign, plNrm, outErr, outPar, N_proc);
667 #ifdef DEBUG
668  if (debug && g_debug) {
669  for (int kk = 0; kk < N_proc; ++kk) {
670  dprintf("propSign %d\n", kk);
671  for (int i = 0; i < 1; ++i) {
672  dprintf("%8f ", propSign.constAt(kk, i, 0));
673  }
674  dprintf("\n");
675  dprintf("plNrm %d\n", kk);
676  for (int i = 0; i < 3; ++i) {
677  dprintf("%8f ", plNrm.constAt(kk, i, 0));
678  }
679  dprintf("\n");
680  dprintf("outErr(after material) %d\n", kk);
681  for (int i = 0; i < 6; ++i) {
682  for (int j = 0; j < 6; ++j)
683  dprintf("%8f ", outErr.constAt(kk, i, j));
684  dprintf("\n");
685  }
686  dprintf("\n");
687  }
688  }
689 #endif
690  }
691 
692  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
693 
694  // PROP-FAIL-ENABLE To keep physics changes minimal, we always restore the
695  // state to input when propagation fails -- as was the default before.
696  // if (pflags.copy_input_state_on_fail) {
697  for (int i = 0; i < N_proc; ++i) {
698  if (outFailFlag(i, 0, 0)) {
699  outPar.copySlot(i, inPar);
700  outErr.copySlot(i, inErr);
701  }
702  }
703  // }
704  }
Matriplex::Matriplex< float, LL, LL, NN > MPlexLL
Definition: Matrix.h:53
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:616
#define dprint_np(n, x)
Definition: Debug.h:96
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const TrackerInfo * tracker_info
void applyMaterialEffects(const MPlexQF &hitsRl, const MPlexQF &hitsXi, const MPlexQF &propSign, const MPlexHV &plNrm, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
void squashPhiMPlex(MPlexLV &par, const int N_proc)
bool g_debug
Definition: Debug.cc:2
T sqrt(T t)
Definition: SSEVec.h:23
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define debug
Definition: HDRShower.cc:19
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
void helixAtPlane(const MPlexLV &inPar, const MPlexQI &inChg, const MPlexHV &plPnt, const MPlexHV &plNrm, MPlexQF &pathL, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags)
Material material_checked(float z, float r) const
Definition: TrackerInfo.h:275
#define dprintf(...)
Definition: Debug.h:98

◆ propagateHelixToRMPlex()

void mkfit::propagateHelixToRMPlex ( const MPlexLS inErr,
const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msRad,
MPlexLS outErr,
MPlexLV outPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags pflags,
const MPlexQI noMatEffPtr 
)

Definition at line 932 of file PropagationMPlex.cc.

References funct::abs(), mkfit::PropagationFlags::apply_material, applyMaterialEffects(), funct::cos(), debug, dprintf, g_debug, helixAtRFromIterativeCCS(), hipo(), mps_fire::i, dqmiolumiharvest::j, GetRecoTauVFromDQM_MC_cff::kk, mkfit::TrackerInfo::material_checked(), create_idmaps::n, NN, mkfit::TrackerInfo::Material::radl, funct::sin(), squashPhiMPlex(), groupFilesInBlocks::temp, and mkfit::PropagationFlags::tracker_info.

Referenced by kalmanPropagateAndComputeChi2(), kalmanPropagateAndUpdate(), mkfit::MkBase::propagateTracksToHitR(), and mkfit::MkBase::propagateTracksToR().

941  {
942  // bool debug = true;
943 
944  // This is used further down when calculating similarity with errorProp (and before in DEBUG).
945  // MT: I don't think this really needed if we use inErr where required.
946  outErr = inErr;
947  // This requirement for helixAtRFromIterativeCCS_impl() and for helixAtRFromIterativeCCSFullJac().
948  // MT: This should be properly handled in both functions (expecting input in output parameters sucks).
949  outPar = inPar;
950 
951  MPlexLL errorProp;
952 
953  helixAtRFromIterativeCCS(inPar, inChg, msRad, outPar, errorProp, outFailFlag, N_proc, pflags);
954 
955 #ifdef DEBUG
956  if (debug && g_debug) {
957  for (int kk = 0; kk < N_proc; ++kk) {
958  dprintf("outErr before prop %d\n", kk);
959  for (int i = 0; i < 6; ++i) {
960  for (int j = 0; j < 6; ++j)
961  dprintf("%8f ", outErr.At(kk, i, j));
962  dprintf("\n");
963  }
964  dprintf("\n");
965 
966  dprintf("errorProp %d\n", kk);
967  for (int i = 0; i < 6; ++i) {
968  for (int j = 0; j < 6; ++j)
969  dprintf("%8f ", errorProp.At(kk, i, j));
970  dprintf("\n");
971  }
972  dprintf("\n");
973  }
974  }
975 #endif
976 
977  // MultHelixProp can be optimized for CCS coordinates, see GenMPlexOps.pl
978  MPlexLL temp;
979  MultHelixProp(errorProp, outErr, temp);
980  MultHelixPropTransp(errorProp, temp, outErr);
981  // can replace with: MultHelixPropFull(errorProp, outErr, temp); MultHelixPropTranspFull(errorProp, temp, outErr);
982 
983 #ifdef DEBUG
984  if (debug && g_debug) {
985  for (int kk = 0; kk < N_proc; ++kk) {
986  dprintf("outErr %d\n", kk);
987  for (int i = 0; i < 6; ++i) {
988  for (int j = 0; j < 6; ++j)
989  dprintf("%8f ", outErr.constAt(kk, i, j));
990  dprintf("\n");
991  }
992  dprintf("\n");
993  }
994  }
995 #endif
996 
997  if (pflags.apply_material) {
998  MPlexQF hitsRl;
999  MPlexQF hitsXi;
1000  MPlexQF propSign;
1001 
1002  const TrackerInfo& tinfo = *pflags.tracker_info;
1003 
1004 #pragma omp simd
1005  for (int n = 0; n < NN; ++n) {
1006  if (n < N_proc) {
1007  if (outFailFlag(n, 0, 0) || (noMatEffPtr && noMatEffPtr->constAt(n, 0, 0))) {
1008  hitsRl(n, 0, 0) = 0.f;
1009  hitsXi(n, 0, 0) = 0.f;
1010  } else {
1011  auto mat = tinfo.material_checked(std::abs(outPar(n, 2, 0)), msRad(n, 0, 0));
1012  hitsRl(n, 0, 0) = mat.radl;
1013  hitsXi(n, 0, 0) = mat.bbxi;
1014  }
1015  const float r0 = hipo(inPar(n, 0, 0), inPar(n, 1, 0));
1016  const float r = msRad(n, 0, 0);
1017  propSign(n, 0, 0) = (r > r0 ? 1. : -1.);
1018  }
1019  }
1020  MPlexHV plNrm;
1021 #pragma omp simd
1022  for (int n = 0; n < NN; ++n) {
1023  plNrm(n, 0, 0) = std::cos(outPar.constAt(n, 4, 0));
1024  plNrm(n, 1, 0) = std::sin(outPar.constAt(n, 4, 0));
1025  plNrm(n, 2, 0) = 0.f;
1026  }
1027  applyMaterialEffects(hitsRl, hitsXi, propSign, plNrm, outErr, outPar, N_proc);
1028 #ifdef DEBUG
1029  if (debug && g_debug) {
1030  for (int kk = 0; kk < N_proc; ++kk) {
1031  dprintf("propSign %d\n", kk);
1032  for (int i = 0; i < 1; ++i) {
1033  dprintf("%8f ", propSign.constAt(kk, i, 0));
1034  }
1035  dprintf("\n");
1036  dprintf("plNrm %d\n", kk);
1037  for (int i = 0; i < 3; ++i) {
1038  dprintf("%8f ", plNrm.constAt(kk, i, 0));
1039  }
1040  dprintf("\n");
1041  dprintf("outErr(after material) %d\n", kk);
1042  for (int i = 0; i < 6; ++i) {
1043  for (int j = 0; j < 6; ++j)
1044  dprintf("%8f ", outErr.constAt(kk, i, j));
1045  dprintf("\n");
1046  }
1047  dprintf("\n");
1048  }
1049  }
1050 #endif
1051  }
1052 
1053  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
1054 
1055  // Matriplex version of:
1056  // result.errors = ROOT::Math::Similarity(errorProp, outErr);
1057 
1058  /*
1059  // To be used with: MPT_DIM = 1
1060  if (fabs(sqrt(outPar[0]*outPar[0]+outPar[1]*outPar[1]) - msRad[0]) > 0.0001)
1061  {
1062  std::cout << "DID NOT GET TO R, FailFlag=" << failFlag[0]
1063  << " dR=" << msRad[0] - std::hypot(outPar[0],outPar[1])
1064  << " r=" << msRad[0] << " rin=" << std::hypot(inPar[0],inPar[1]) << " rout=" << std::hypot(outPar[0],outPar[1])
1065  << std::endl;
1066  // std::cout << " pt=" << pt << " pz=" << inPar.At(n, 2) << std::endl;
1067  }
1068  */
1069 
1070  // PROP-FAIL-ENABLE To keep physics changes minimal, we always restore the
1071  // state to input when propagation fails -- as was the default before.
1072  // if (pflags.copy_input_state_on_fail) {
1073  for (int i = 0; i < N_proc; ++i) {
1074  if (outFailFlag(i, 0, 0)) {
1075  outPar.copySlot(i, inPar);
1076  outErr.copySlot(i, inErr);
1077  }
1078  }
1079  // }
1080  }
Matriplex::Matriplex< float, LL, LL, NN > MPlexLL
Definition: Matrix.h:53
Matriplex::Matriplex< float, HH, 1, NN > MPlexHV
Definition: Matrix.h:58
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const TrackerInfo * tracker_info
void applyMaterialEffects(const MPlexQF &hitsRl, const MPlexQF &hitsXi, const MPlexQF &propSign, const MPlexHV &plNrm, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
void squashPhiMPlex(MPlexLV &par, const int N_proc)
bool g_debug
Definition: Debug.cc:2
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define debug
Definition: HDRShower.cc:19
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
float hipo(float x, float y)
Definition: Matrix.h:9
Material material_checked(float z, float r) const
Definition: TrackerInfo.h:275
void helixAtRFromIterativeCCS(const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags)
#define dprintf(...)
Definition: Debug.h:98

◆ propagateHelixToZMPlex()

void mkfit::propagateHelixToZMPlex ( const MPlexLS inErr,
const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msZ,
MPlexLS outErr,
MPlexLV outPar,
MPlexQI outFailFlag,
const int  N_proc,
const PropagationFlags pflags,
const MPlexQI noMatEffPtr = nullptr 
)

Definition at line 57 of file PropagationMPlexEndcap.cc.

References funct::abs(), mkfit::PropagationFlags::apply_material, applyMaterialEffects(), debug, dprintf, g_debug, helixAtZ(), Matriplex::hypot(), mps_fire::i, dqmiolumiharvest::j, GetRecoTauVFromDQM_MC_cff::kk, mkfit::TrackerInfo::material_checked(), create_idmaps::n, NN, mkfit::TrackerInfo::Material::radl, squashPhiMPlex(), groupFilesInBlocks::temp, and mkfit::PropagationFlags::tracker_info.

Referenced by kalmanPropagateAndComputeChi2Endcap(), kalmanPropagateAndUpdateEndcap(), mkfit::MkBase::propagateTracksToHitZ(), mkfit::MkBase::propagateTracksToPCAZ(), and mkfit::MkBase::propagateTracksToZ().

66  {
67  // debug = true;
68 
69  outErr = inErr;
70  outPar = inPar;
71 
72  MPlexLL errorProp;
73 
74  //helixAtZ_new(inPar, inChg, msZ, outPar, errorProp, outFailFlag, N_proc, pflags);
75  helixAtZ(inPar, inChg, msZ, outPar, errorProp, outFailFlag, N_proc, pflags);
76 
77 #ifdef DEBUG
78  if (debug && g_debug) {
79  for (int kk = 0; kk < N_proc; ++kk) {
80  dprintf("inPar %d\n", kk);
81  for (int i = 0; i < 6; ++i) {
82  dprintf("%8f ", inPar.constAt(kk, i, 0));
83  }
84  dprintf("\n");
85 
86  dprintf("inErr %d\n", kk);
87  for (int i = 0; i < 6; ++i) {
88  for (int j = 0; j < 6; ++j)
89  dprintf("%8f ", inErr.constAt(kk, i, j));
90  dprintf("\n");
91  }
92  dprintf("\n");
93 
94  dprintf("errorProp %d\n", kk);
95  for (int i = 0; i < 6; ++i) {
96  for (int j = 0; j < 6; ++j)
97  dprintf("%8f ", errorProp.At(kk, i, j));
98  dprintf("\n");
99  }
100  dprintf("\n");
101  }
102  }
103 #endif
104 
105 #ifdef DEBUG
106  if (debug && g_debug) {
107  for (int kk = 0; kk < N_proc; ++kk) {
108  dprintf("outErr %d\n", kk);
109  for (int i = 0; i < 6; ++i) {
110  for (int j = 0; j < 6; ++j)
111  dprintf("%8f ", outErr.constAt(kk, i, j));
112  dprintf("\n");
113  }
114  dprintf("\n");
115  }
116  }
117 #endif
118 
119  // Matriplex version of: result.errors = ROOT::Math::Similarity(errorProp, outErr);
120  MPlexLL temp;
121  MultHelixPropEndcap(errorProp, outErr, temp);
122  MultHelixPropTranspEndcap(errorProp, temp, outErr);
123  // can replace with: MultHelixPropFull(errorProp, outErr, temp); MultHelixPropTranspFull(errorProp, temp, outErr);
124 
125  if (pflags.apply_material) {
126  MPlexQF hitsRl;
127  MPlexQF hitsXi;
128  MPlexQF propSign;
129 
130  const TrackerInfo& tinfo = *pflags.tracker_info;
131 
132 #pragma omp simd
133  for (int n = 0; n < NN; ++n) {
134  if (n >= N_proc || (noMatEffPtr && noMatEffPtr->constAt(n, 0, 0))) {
135  hitsRl(n, 0, 0) = 0.f;
136  hitsXi(n, 0, 0) = 0.f;
137  } else {
138  const float hypo = std::hypot(outPar(n, 0, 0), outPar(n, 1, 0));
139  auto mat = tinfo.material_checked(std::abs(msZ(n, 0, 0)), hypo);
140  hitsRl(n, 0, 0) = mat.radl;
141  hitsXi(n, 0, 0) = mat.bbxi;
142  }
143  if (n < N_proc) {
144  const float zout = msZ.constAt(n, 0, 0);
145  const float zin = inPar.constAt(n, 2, 0);
146  propSign(n, 0, 0) = (std::abs(zout) > std::abs(zin) ? 1.f : -1.f);
147  }
148  }
149  MPlexHV plNrm;
150 #pragma omp simd
151  for (int n = 0; n < NN; ++n) {
152  plNrm(n, 0, 0) = 0.f;
153  plNrm(n, 1, 0) = 0.f;
154  plNrm(n, 2, 0) = 1.f;
155  }
156  applyMaterialEffects(hitsRl, hitsXi, propSign, plNrm, outErr, outPar, N_proc);
157 #ifdef DEBUG
158  if (debug && g_debug) {
159  for (int kk = 0; kk < N_proc; ++kk) {
160  dprintf("propSign %d\n", kk);
161  for (int i = 0; i < 1; ++i) {
162  dprintf("%8f ", propSign.constAt(kk, i, 0));
163  }
164  dprintf("\n");
165  dprintf("plNrm %d\n", kk);
166  for (int i = 0; i < 3; ++i) {
167  dprintf("%8f ", plNrm.constAt(kk, i, 0));
168  }
169  dprintf("\n");
170  dprintf("outErr(after material) %d\n", kk);
171  for (int i = 0; i < 6; ++i) {
172  for (int j = 0; j < 6; ++j)
173  dprintf("%8f ", outErr.constAt(kk, i, j));
174  dprintf("\n");
175  }
176  dprintf("\n");
177  }
178  }
179 #endif
180  }
181 
182  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
183 
184  // PROP-FAIL-ENABLE To keep physics changes minimal, we always restore the
185  // state to input when propagation fails -- as was the default before.
186  // if (pflags.copy_input_state_on_fail) {
187  for (int i = 0; i < N_proc; ++i) {
188  if (outFailFlag(i, 0, 0)) {
189  outPar.copySlot(i, inPar);
190  outErr.copySlot(i, inErr);
191  }
192  }
193  // }
194  }
Matriplex::Matriplex< float, LL, LL, NN > MPlexLL
Definition: Matrix.h:53
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:616
Matriplex::Matriplex< float, HH, 1, NN > MPlexHV
Definition: Matrix.h:58
const TrackerInfo * tracker_info
void applyMaterialEffects(const MPlexQF &hitsRl, const MPlexQF &hitsXi, const MPlexQF &propSign, const MPlexHV &plNrm, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
void squashPhiMPlex(MPlexLV &par, const int N_proc)
bool g_debug
Definition: Debug.cc:2
void helixAtZ(const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define debug
Definition: HDRShower.cc:19
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
Material material_checked(float z, float r) const
Definition: TrackerInfo.h:275
#define dprintf(...)
Definition: Debug.h:98

◆ propagateLineToRMPlex()

void mkfit::propagateLineToRMPlex ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc 
)

Definition at line 17 of file PropagationMPlex.cc.

References A, B, dprint_np, hipo(), N, create_idmaps::n, NN, AlCaHLTBitMon_ParallelJobs::p, DiDispStaMuonMonitor_cfi::pt, and mathSSE::sqrt().

23  {
24  // XXX Regenerate parts below with a script.
25 
26  const Matriplex::idx_t N = NN;
27 
28 #pragma omp simd
29  for (int n = 0; n < NN; ++n) {
30  const float cosA = (psPar[0 * N + n] * psPar[3 * N + n] + psPar[1 * N + n] * psPar[4 * N + n]) /
31  (std::sqrt((psPar[0 * N + n] * psPar[0 * N + n] + psPar[1 * N + n] * psPar[1 * N + n]) *
32  (psPar[3 * N + n] * psPar[3 * N + n] + psPar[4 * N + n] * psPar[4 * N + n])));
33  const float dr = (hipo(msPar[0 * N + n], msPar[1 * N + n]) - hipo(psPar[0 * N + n], psPar[1 * N + n])) / cosA;
34 
35  dprint_np(n, "propagateLineToRMPlex dr=" << dr);
36 
37  const float pt = hipo(psPar[3 * N + n], psPar[4 * N + n]);
38  const float p = dr / pt; // path
39  const float psq = p * p;
40 
41  outPar[0 * N + n] = psPar[0 * N + n] + p * psPar[3 * N + n];
42  outPar[1 * N + n] = psPar[1 * N + n] + p * psPar[4 * N + n];
43  outPar[2 * N + n] = psPar[2 * N + n] + p * psPar[5 * N + n];
44  outPar[3 * N + n] = psPar[3 * N + n];
45  outPar[4 * N + n] = psPar[4 * N + n];
46  outPar[5 * N + n] = psPar[5 * N + n];
47 
48  {
49  const MPlexLS& A = psErr;
50  MPlexLS& B = outErr;
51 
52  B.fArray[0 * N + n] = A.fArray[0 * N + n];
53  B.fArray[1 * N + n] = A.fArray[1 * N + n];
54  B.fArray[2 * N + n] = A.fArray[2 * N + n];
55  B.fArray[3 * N + n] = A.fArray[3 * N + n];
56  B.fArray[4 * N + n] = A.fArray[4 * N + n];
57  B.fArray[5 * N + n] = A.fArray[5 * N + n];
58  B.fArray[6 * N + n] = A.fArray[6 * N + n] + p * A.fArray[0 * N + n];
59  B.fArray[7 * N + n] = A.fArray[7 * N + n] + p * A.fArray[1 * N + n];
60  B.fArray[8 * N + n] = A.fArray[8 * N + n] + p * A.fArray[3 * N + n];
61  B.fArray[9 * N + n] =
62  A.fArray[9 * N + n] + p * (A.fArray[6 * N + n] + A.fArray[6 * N + n]) + psq * A.fArray[0 * N + n];
63  B.fArray[10 * N + n] = A.fArray[10 * N + n] + p * A.fArray[1 * N + n];
64  B.fArray[11 * N + n] = A.fArray[11 * N + n] + p * A.fArray[2 * N + n];
65  B.fArray[12 * N + n] = A.fArray[12 * N + n] + p * A.fArray[4 * N + n];
66  B.fArray[13 * N + n] =
67  A.fArray[13 * N + n] + p * (A.fArray[7 * N + n] + A.fArray[10 * N + n]) + psq * A.fArray[1 * N + n];
68  B.fArray[14 * N + n] =
69  A.fArray[14 * N + n] + p * (A.fArray[11 * N + n] + A.fArray[11 * N + n]) + psq * A.fArray[2 * N + n];
70  B.fArray[15 * N + n] = A.fArray[15 * N + n] + p * A.fArray[3 * N + n];
71  B.fArray[16 * N + n] = A.fArray[16 * N + n] + p * A.fArray[4 * N + n];
72  B.fArray[17 * N + n] = A.fArray[17 * N + n] + p * A.fArray[5 * N + n];
73  B.fArray[18 * N + n] =
74  A.fArray[18 * N + n] + p * (A.fArray[8 * N + n] + A.fArray[15 * N + n]) + psq * A.fArray[3 * N + n];
75  B.fArray[19 * N + n] =
76  A.fArray[19 * N + n] + p * (A.fArray[12 * N + n] + A.fArray[16 * N + n]) + psq * A.fArray[4 * N + n];
77  B.fArray[20 * N + n] =
78  A.fArray[20 * N + n] + p * (A.fArray[17 * N + n] + A.fArray[17 * N + n]) + psq * A.fArray[5 * N + n];
79  }
80 
81  dprint_np(n, "propagateLineToRMPlex arrive at r=" << hipo(outPar[0 * N + n], outPar[1 * N + n]));
82  }
83  }
Definition: APVGainStruct.h:7
#define dprint_np(n, x)
Definition: Debug.h:96
T sqrt(T t)
Definition: SSEVec.h:23
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
#define N
Definition: blowfish.cc:9
float hipo(float x, float y)
Definition: Matrix.h:9
Matriplex::MatriplexSym< float, LL, NN > MPlexLS
Definition: Matrix.h:55
Definition: APVGainStruct.h:7

◆ run_OneIteration()

void mkfit::run_OneIteration ( const TrackerInfo trackerInfo,
const IterationConfig itconf,
const EventOfHits eoh,
const std::vector< const std::vector< bool > *> &  hit_masks,
MkBuilder builder,
TrackVec seeds,
TrackVec out_tracks,
bool  do_seed_clean,
bool  do_backward_fit,
bool  do_remove_duplicates 
)

Definition at line 27 of file runFunctions.cc.

References mkfit::MkBuilder::backwardFit(), mkfit::MkBuilder::begin_event(), mkfit::MkBuilder::beginBkwSearch(), mkfit::MkBuilder::compactifyHitStorageForBestCand(), mkfit::MkBuilder::end_event(), mkfit::MkBuilder::endBkwSearch(), mkfit::MkBuilder::export_best_comb_cands(), mkfit::MkBuilder::filter_comb_cands(), mkfit::MkBuilder::find_tracks_load_seeds(), mkfit::MkBuilder::findTracksCloneEngine(), mkfit::SteeringParams::IT_BkwSearch, mkfit::IterationConfig::m_backward_drop_seed_hits, mkfit::IterationConfig::m_backward_fit_min_hits, mkfit::IterationConfig::m_backward_search, mkfit::IterationConfig::m_duplicate_cleaner, mkfit::IterationConfig::m_post_bkfit_filter, mkfit::IterationConfig::m_pre_bkfit_filter, mkfit::IterationConfig::m_requires_seed_hit_sorting, mkfit::IterationConfig::m_seed_cleaner, mkfit::EventOfHits::refBeamSpot(), mkfit::MkBuilder::release_memory(), alignCSCRings::s, mkfit::MkBuilder::seed_post_cleaning(), and HLT_2024v14_cff::seeds.

Referenced by MkFitProducer::produce().

36  {
37  IterationMaskIfcCmssw it_mask_ifc(trackerInfo, hit_masks);
38 
39  MkJob job({trackerInfo, itconf, eoh, eoh.refBeamSpot(), &it_mask_ifc});
40 
41  builder.begin_event(&job, nullptr, __func__);
42 
43  // Seed cleaning not done on all iterations.
44  do_seed_clean = do_seed_clean && itconf.m_seed_cleaner;
45 
46  if (do_seed_clean)
47  itconf.m_seed_cleaner(seeds, itconf, eoh.refBeamSpot());
48 
49  // Check nans in seeds -- this should not be needed when Slava fixes
50  // the track parameter coordinate transformation.
51  builder.seed_post_cleaning(seeds);
52 
53  if (itconf.m_requires_seed_hit_sorting) {
54  for (auto &s : seeds)
55  s.sortHitsByLayer(); // sort seed hits for the matched hits (I hope it works here)
56  }
57 
58  builder.find_tracks_load_seeds(seeds, do_seed_clean);
59 
60  builder.findTracksCloneEngine();
61 
62  // Pre backward-fit filtering.
63  filter_candidates_func pre_filter;
64  if (do_backward_fit && itconf.m_pre_bkfit_filter)
65  pre_filter = [&](const TrackCand &tc, const MkJob &jb) -> bool {
66  return itconf.m_pre_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
67  };
68  else if (itconf.m_pre_bkfit_filter)
69  pre_filter = itconf.m_pre_bkfit_filter;
70  else if (do_backward_fit)
71  pre_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
72  // pre_filter can be null if we are not doing backward fit as nan_n_silly will be run below.
73  if (pre_filter)
74  builder.filter_comb_cands(pre_filter, true);
75 
76  job.switch_to_backward();
77 
78  if (do_backward_fit) {
79  if (itconf.m_backward_search) {
80  builder.compactifyHitStorageForBestCand(itconf.m_backward_drop_seed_hits, itconf.m_backward_fit_min_hits);
81  }
82 
83  builder.backwardFit();
84 
85  if (itconf.m_backward_search) {
86  builder.beginBkwSearch();
87  builder.findTracksCloneEngine(SteeringParams::IT_BkwSearch);
88  }
89  }
90 
91  // Post backward-fit filtering.
92  filter_candidates_func post_filter;
93  if (do_backward_fit && itconf.m_post_bkfit_filter)
94  post_filter = [&](const TrackCand &tc, const MkJob &jb) -> bool {
95  return itconf.m_post_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
96  };
97  else
98  post_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
99  // post_filter is always at least doing nan_n_silly filter.
100  builder.filter_comb_cands(post_filter, true);
101 
102  if (do_backward_fit && itconf.m_backward_search)
103  builder.endBkwSearch();
104 
105  builder.export_best_comb_cands(out_tracks, true);
106 
107  if (do_remove_duplicates && itconf.m_duplicate_cleaner) {
108  itconf.m_duplicate_cleaner(out_tracks, itconf);
109  }
110 
111  builder.end_event();
112  builder.release_memory();
113  }
std::function< filter_candidates_cf > filter_candidates_func
Definition: FunctionTypes.h:28

◆ runBtpCe_MultiIter()

std::vector< double > mkfit::runBtpCe_MultiIter ( Event ev,
const EventOfHits eoh,
MkBuilder builder,
int  n 
)

Definition at line 414 of file buildtestMPlex.cc.

References ppsStraightTrackAligner_cfi::algorithms, mkfit::Config::backwardFit, mkfit::MkBuilder::backwardFit(), mkfit::Config::backwardSearch, mkfit::MkBuilder::begin_event(), mkfit::MkBuilder::beginBkwSearch(), nano_mu_local_reco_cff::bool, mkfit::Config::cmssw_val, mkfit::MkBuilder::compactifyHitStorageForBestCand(), dtime(), mkfit::MkBuilder::end_event(), mkfit::MkBuilder::endBkwSearch(), makeMEIFBenchmarkPlots::ev, mkfit::MkBuilder::export_tracks(), mkfit::MkBuilder::filter_comb_cands(), spr::find(), mkfit::MkBuilder::find_tracks_load_seeds(), mkfit::MkBuilder::findTracksCloneEngine(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, mkfit::SteeringParams::IT_BkwSearch, mkfit::Config::ItrInfo, mkfit::IterationConfig::m_backward_drop_seed_hits, mkfit::IterationConfig::m_backward_fit_min_hits, mkfit::IterationConfig::m_backward_search, mkfit::IterationConfig::m_duplicate_cleaner, mkfit::IterationMaskIfc::m_mask_vector, mkfit::IterationConfig::m_post_bkfit_filter, mkfit::IterationConfig::m_pre_bkfit_filter, mkfit::IterationConfig::m_requires_seed_hit_sorting, mkfit::IterationConfig::m_seed_cleaner, mkfit::IterationConfig::m_track_algorithm, eostools::move(), create_idmaps::n, mkfit::StdSeq::prep_simtracks(), mkfit::StdSeq::Quality::quality_val(), mkfit::Config::quality_val, mkfit::MkBuilder::ref_tracks_nc(), mkfit::EventOfHits::refBeamSpot(), mkfit::MkBuilder::release_memory(), mkfit::StdSeq::root_val(), alignCSCRings::s, mkfit::MkBuilder::seed_post_cleaning(), HLT_2024v14_cff::seeds, mkfit::MkBuilder::select_best_comb_cands(), mkfit::Config::sim_val, submitPVValidationJobs::t, hcalRecHitTable_cff::time, and mkfit::Config::TrkInfo.

Referenced by test_standard().

414  {
415  std::vector<double> timevec;
416  if (n <= 0)
417  return timevec;
418  timevec.resize(n + 1, 0.0);
419 
420  const bool validation_on = (Config::sim_val || Config::quality_val);
421 
422  TrackVec seeds_used;
423  TrackVec seeds1;
424 
425  if (validation_on) {
426  for (auto const &s : ev.seedTracks_) {
427  //keep seeds form the first n iterations for processing
428  if (std::find(algorithms, algorithms + n, s.algoint()) != algorithms + n)
429  seeds1.push_back(s);
430  }
431  ev.seedTracks_.swap(seeds1); //necessary for the validation - PrepareSeeds
432  ev.relabel_bad_seedtracks(); //necessary for the validation - PrepareSeeds
433  }
434 
435  IterationMaskIfc mask_ifc;
436  TrackVec seeds;
437  TrackVec tmp_tvec;
438 
439  for (int it = 0; it <= n - 1; ++it) {
440  const IterationConfig &itconf = Config::ItrInfo[it];
441 
442  // To disable hit-masks, pass nullptr in place of &mask_ifc to MkJob ctor
443  // and optionally comment out ev.fill_hitmask_bool_vectors() call.
444 
445  ev.fill_hitmask_bool_vectors(itconf.m_track_algorithm, mask_ifc.m_mask_vector);
446 
447  MkJob job({Config::TrkInfo, itconf, eoh, eoh.refBeamSpot(), &mask_ifc});
448 
449  builder.begin_event(&job, &ev, __func__);
450 
451  { // We could partition seeds once, store beg, end for each iteration in a map or vector.
452  seeds.clear();
453  int nc = 0;
454  for (auto &s : ev.seedTracks_) {
455  if (s.algoint() == itconf.m_track_algorithm) {
456  if (itconf.m_requires_seed_hit_sorting) {
457  s.sortHitsByLayer();
458  }
459  seeds.push_back(s);
460  ++nc;
461  } else if (nc > 0)
462  break;
463  }
464  }
465 
466  bool do_seed_clean = bool(itconf.m_seed_cleaner);
467 
468  if (do_seed_clean)
469  itconf.m_seed_cleaner(seeds, itconf, eoh.refBeamSpot());
470 
471  builder.seed_post_cleaning(seeds);
472 
473  // Add protection in case no seeds are found for iteration
474  if (seeds.size() <= 0)
475  continue;
476  ev.setCurrentSeedTracks(seeds);
477 
478  builder.find_tracks_load_seeds(seeds, do_seed_clean);
479 
480  double time = dtime();
481 
482  builder.findTracksCloneEngine();
483 
484  timevec[it] = dtime() - time;
485  timevec[n] += timevec[it];
486 
487  // Print min and max size of hots vectors of CombCands.
488  // builder.find_min_max_hots_size();
489 
490  if (validation_on)
491  seeds_used.insert(seeds_used.end(), seeds.begin(), seeds.end()); //cleaned seeds need to be stored somehow
492 
493  // Pre backward-fit filtering.
494  // Note -- slightly different logic than run_OneIteration as we always do nan filters for
495  // export for validation.
496  filter_candidates_func pre_filter;
497  if (itconf.m_pre_bkfit_filter)
498  pre_filter = [&](const TrackCand &tc, const MkJob &jb) -> bool {
499  return itconf.m_pre_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
500  };
501  else
502  pre_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
503  // pre_filter is always at least doing nan_n_silly filter.
504  builder.filter_comb_cands(pre_filter, true);
505 
506  builder.select_best_comb_cands();
507 
508  {
509  builder.export_tracks(tmp_tvec);
510  if (itconf.m_duplicate_cleaner)
511  itconf.m_duplicate_cleaner(builder.ref_tracks_nc(), itconf);
512  ev.candidateTracks_.reserve(ev.candidateTracks_.size() + tmp_tvec.size());
513  for (auto &&t : tmp_tvec)
514  ev.candidateTracks_.emplace_back(std::move(t));
515  tmp_tvec.clear();
516  }
517 
518  job.switch_to_backward();
519 
520  // now do backwards fit... do we want to time this section?
521  if (Config::backwardFit) {
522  // a) TrackVec version:
523  // builder.backwardFitBH();
524 
525  // b) Version that runs on CombCand / TrackCand
526  const bool do_backward_search = Config::backwardSearch && itconf.m_backward_search;
527 
528  // We copy seed-hits into Candidates ... now we have to remove them so backward fit stops
529  // before reaching seeding region. Ideally, we wouldn't add them in the first place but
530  // if we want to export full tracks above we need to hold on to them (alternatively, we could
531  // have a pointer to seed track in CombCandidate and copy them from there).
532  if (do_backward_search)
533  builder.compactifyHitStorageForBestCand(itconf.m_backward_drop_seed_hits, itconf.m_backward_fit_min_hits);
534 
535  builder.backwardFit();
536 
537  if (do_backward_search) {
538  builder.beginBkwSearch();
539  builder.findTracksCloneEngine(SteeringParams::IT_BkwSearch);
540  }
541 
542  // Post backward-fit filtering.
543  // Note -- slightly different logic than run_OneIteration as we export both pre and post
544  // backward-fit tracks.
545  filter_candidates_func post_filter;
546  if (itconf.m_post_bkfit_filter)
547  post_filter = [&](const TrackCand &tc, const MkJob &jb) -> bool {
548  return itconf.m_post_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
549  };
550  else
551  post_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
552  // post_filter is always at least doing nan_n_silly filter.
553  builder.filter_comb_cands(post_filter, true);
554 
555  if (do_backward_search)
556  builder.endBkwSearch();
557 
558  builder.select_best_comb_cands(true); // true -> clear m_tracks as they were already filled once above
559 
560  if (itconf.m_duplicate_cleaner)
561  itconf.m_duplicate_cleaner(builder.ref_tracks_nc(), itconf);
562 
563  builder.export_tracks(ev.fitTracks_);
564  }
565  ev.resetCurrentSeedTracks();
566 
567  builder.end_event();
568  }
569 
570  // MIMI - Fake back event pointer for final processing (that should be done elsewhere)
571  MkJob job({Config::TrkInfo, Config::ItrInfo[0], eoh, eoh.refBeamSpot()});
572  builder.begin_event(&job, &ev, __func__);
573 
574  if (validation_on) {
576  //swap for the cleaned seeds
577  ev.seedTracks_.swap(seeds_used);
578  }
579 
580  check_nan_n_silly_candidates(ev);
581 
583  check_nan_n_silly_bkfit(ev);
584 
585  // validation section
586  if (Config::quality_val) {
587  StdSeq::Quality qval;
588  qval.quality_val(&ev);
589  } else if (Config::sim_val || Config::cmssw_val) {
591  }
592 
593  // ev.print_tracks(ev.candidateTracks_, true);
594 
595  // MIMI Unfake.
596  builder.end_event();
597 
598  // In CMSSW runOneIter we now release memory for comb-cands:
599  builder.release_memory();
600 
601  return timevec;
602  }
void root_val(Event *event)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void prep_simtracks(Event *event)
std::function< filter_candidates_cf > filter_candidates_func
Definition: FunctionTypes.h:28
TrackerInfo TrkInfo
IterationsInfo ItrInfo
std::vector< Track > TrackVec
double dtime()
def move(src, dest)
Definition: eostools.py:511

◆ runBuildingTestPlexBestHit()

double mkfit::runBuildingTestPlexBestHit ( Event ev,
const EventOfHits eoh,
MkBuilder builder 
)

Definition at line 106 of file buildtestMPlex.cc.

References ppsStraightTrackAligner_cfi::algorithms, mkfit::Config::backwardFit, mkfit::MkBuilder::backwardFitBH(), mkfit::MkBuilder::begin_event(), mkfit::Config::cmssw_val, dtime(), mkfit::MkBuilder::end_event(), makeMEIFBenchmarkPlots::ev, spr::find(), mkfit::MkBuilder::find_tracks_load_seeds_BH(), mkfit::MkBuilder::findTracksBestHit(), mkfit::Config::ItrInfo, mkfit::IterationMaskIfc::m_mask_vector, mkfit::IterationConfig::m_track_algorithm, mkfit::StdSeq::Quality::quality_val(), mkfit::Config::quality_val, mkfit::MkBuilder::ref_tracks(), mkfit::EventOfHits::refBeamSpot(), mkfit::StdSeq::root_val(), alignCSCRings::s, mkfit::Config::sim_val, hcalRecHitTable_cff::time, and mkfit::Config::TrkInfo.

Referenced by test_standard().

106  {
107  const IterationConfig &itconf = Config::ItrInfo[0];
108 
109  const bool validation_on = (Config::sim_val || Config::quality_val);
110 
111  TrackVec seeds1;
112  if (validation_on) {
113  unsigned int algorithms[] = {4}; //only initialStep
114 
115  for (auto const &s : ev.seedTracks_) {
116  //keep seeds form the first iteration for processing
117  if (std::find(algorithms, algorithms + 1, s.algoint()) != algorithms + 1)
118  seeds1.push_back(s);
119  }
120  ev.seedTracks_.swap(seeds1); //necessary for the validation - PrepareSeeds
121  ev.relabel_bad_seedtracks(); //necessary for the validation - PrepareSeeds
122  }
123 
124  IterationMaskIfc mask_ifc;
125 
126  // To disable hit-masks, pass nullptr in place of &mask_ifc to MkJob ctor
127  // and optionally comment out ev.fill_hitmask_bool_vectors() call.
128 
129  ev.fill_hitmask_bool_vectors(itconf.m_track_algorithm, mask_ifc.m_mask_vector);
130 
131  MkJob job({Config::TrkInfo, itconf, eoh, eoh.refBeamSpot(), &mask_ifc});
132 
133  builder.begin_event(&job, &ev, __func__);
134 
135  bool seeds_sorted = false;
136  // CCCC builder.PrepareSeeds();
137 
138  // EventOfCandidates event_of_cands;
139  builder.find_tracks_load_seeds_BH(ev.seedTracks_, seeds_sorted);
140 
141 #ifdef USE_VTUNE_PAUSE
142  __SSC_MARK(0x111); // use this to resume Intel SDE at the same point
143  __itt_resume();
144 #endif
145 
146  double time = dtime();
147 
148  builder.findTracksBestHit();
149 
150  time = dtime() - time;
151 
152 #ifdef USE_VTUNE_PAUSE
153  __itt_pause();
154  __SSC_MARK(0x222); // use this to pause Intel SDE at the same point
155 #endif
156 
157  // Hack, get the tracks out.
158  ev.candidateTracks_ = builder.ref_tracks();
159 
160  // For best hit, the candidateTracks_ vector is the direct input to the backward fit so only need to do clean_duplicates once
162  //Mark tracks as duplicates; if within CMSSW, remove duplicate tracks before backward fit
163  // CCCC if (Config::removeDuplicates) {
164  // CCCC StdSeq::clean_duplicates(ev.candidateTracks_);
165  // CCCC }
166  }
167 
168  job.switch_to_backward();
169 
170  // now do backwards fit... do we want to time this section?
171  if (Config::backwardFit) {
172  builder.backwardFitBH();
173  ev.fitTracks_ = builder.ref_tracks();
174  }
175 
176  if (Config::quality_val) {
177  StdSeq::Quality qval;
178  qval.quality_val(&ev);
179  } else if (Config::sim_val || Config::cmssw_val) {
181  }
182 
183  builder.end_event();
184 
185  // ev.print_tracks(ev.candidateTracks_, true);
186 
187  if (validation_on) {
188  ev.seedTracks_.swap(seeds1);
189  }
190 
191  return time;
192  }
void root_val(Event *event)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
TrackerInfo TrkInfo
IterationsInfo ItrInfo
std::vector< Track > TrackVec
double dtime()

◆ runBuildingTestPlexCloneEngine()

double mkfit::runBuildingTestPlexCloneEngine ( Event ev,
const EventOfHits eoh,
MkBuilder builder 
)

Definition at line 294 of file buildtestMPlex.cc.

References ppsStraightTrackAligner_cfi::algorithms, mkfit::Config::backwardFit, mkfit::MkBuilder::backwardFitBH(), mkfit::MkBuilder::begin_event(), mkfit::Config::cmssw_val, dtime(), mkfit::MkBuilder::end_event(), makeMEIFBenchmarkPlots::ev, mkfit::MkBuilder::export_best_comb_cands(), spr::find(), mkfit::MkBuilder::find_tracks_load_seeds(), mkfit::MkBuilder::findTracksCloneEngine(), mkfit::Config::ItrInfo, mkfit::IterationMaskIfc::m_mask_vector, mkfit::IterationConfig::m_track_algorithm, mkfit::StdSeq::Quality::quality_val(), mkfit::Config::quality_val, mkfit::MkBuilder::ref_tracks(), mkfit::EventOfHits::refBeamSpot(), mkfit::StdSeq::root_val(), alignCSCRings::s, mkfit::MkBuilder::select_best_comb_cands(), mkfit::Config::sim_val, hcalRecHitTable_cff::time, and mkfit::Config::TrkInfo.

Referenced by test_standard().

294  {
295  const IterationConfig &itconf = Config::ItrInfo[0];
296 
297  const bool validation_on = (Config::sim_val || Config::quality_val);
298 
299  TrackVec seeds1;
300  if (validation_on) {
301  unsigned int algorithms[] = {4}; //only initialStep
302 
303  for (auto const &s : ev.seedTracks_) {
304  //keep seeds form the first iteration for processing
305  if (std::find(algorithms, algorithms + 1, s.algoint()) != algorithms + 1)
306  seeds1.push_back(s);
307  }
308  ev.seedTracks_.swap(seeds1); //necessary for the validation - PrepareSeeds
309  ev.relabel_bad_seedtracks(); //necessary for the validation - PrepareSeeds
310  }
311 
312  IterationMaskIfc mask_ifc;
313 
314  // To disable hit-masks, pass nullptr in place of &mask_ifc to MkJob ctor
315  // and optionally comment out ev.fill_hitmask_bool_vectors() call.
316 
317  ev.fill_hitmask_bool_vectors(itconf.m_track_algorithm, mask_ifc.m_mask_vector);
318 
319  MkJob job({Config::TrkInfo, itconf, eoh, eoh.refBeamSpot(), &mask_ifc});
320 
321  builder.begin_event(&job, &ev, __func__);
322 
323  bool seeds_sorted = false;
324  // CCCC builder.PrepareSeeds();
325  ev.setCurrentSeedTracks(ev.seedTracks_);
326 
327  builder.find_tracks_load_seeds(ev.seedTracks_, seeds_sorted);
328 
329 #ifdef USE_VTUNE_PAUSE
330  __SSC_MARK(0x111); // use this to resume Intel SDE at the same point
331  __itt_resume();
332 #endif
333 
334  double time = dtime();
335 
336  builder.findTracksCloneEngine();
337 
338  time = dtime() - time;
339 
340 #ifdef USE_VTUNE_PAUSE
341  __itt_pause();
342  __SSC_MARK(0x222); // use this to pause Intel SDE at the same point
343 #endif
344 
345  check_nan_n_silly_candidates(ev);
346 
347  // first store candidate tracks - needed for BH backward fit and root_validation
348  ev.candidateTracks_.clear();
349  builder.export_best_comb_cands(ev.candidateTracks_);
350 
351  job.switch_to_backward();
352 
353  // now do backwards fit... do we want to time this section?
354  if (Config::backwardFit) {
355  // a) TrackVec version:
356  builder.select_best_comb_cands();
357  builder.backwardFitBH();
358  ev.fitTracks_ = builder.ref_tracks();
359 
360  // b) Version that runs on CombCand / TrackCand
361  // builder.backwardFit();
362  // builder.quality_store_tracks(ev.fitTracks_);
363 
364  check_nan_n_silly_bkfit(ev);
365  }
366 
367  // CCCC StdSeq::handle_duplicates(&ev);
368 
369  // validation section
370  if (Config::quality_val) {
371  StdSeq::Quality qval;
372  qval.quality_val(&ev);
373  } else if (Config::sim_val || Config::cmssw_val) {
375  }
376 
377  ev.resetCurrentSeedTracks();
378 
379  builder.end_event();
380 
381  // ev.print_tracks(ev.candidateTracks_, true);
382 
383  if (validation_on) {
384  ev.seedTracks_.swap(seeds1);
385  }
386 
387  return time;
388  }
void root_val(Event *event)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
TrackerInfo TrkInfo
IterationsInfo ItrInfo
std::vector< Track > TrackVec
double dtime()

◆ runBuildingTestPlexDumbCMSSW()

void mkfit::runBuildingTestPlexDumbCMSSW ( Event ev,
const EventOfHits eoh,
MkBuilder builder 
)

Definition at line 88 of file buildtestMPlex.cc.

References mkfit::MkBuilder::begin_event(), mkfit::MkBuilder::end_event(), makeMEIFBenchmarkPlots::ev, mkfit::Config::ItrInfo, mkfit::EventOfHits::refBeamSpot(), mkfit::StdSeq::root_val_dumb_cmssw(), mkfit::Config::sim_val_for_cmssw, and mkfit::Config::TrkInfo.

Referenced by test_standard().

88  {
89  const IterationConfig &itconf = Config::ItrInfo[0];
90 
91  MkJob job({Config::TrkInfo, itconf, eoh, eoh.refBeamSpot()});
92 
93  builder.begin_event(&job, &ev, __func__);
94 
97  }
98 
99  builder.end_event();
100  }
TrackerInfo TrkInfo
IterationsInfo ItrInfo
void root_val_dumb_cmssw(Event *event)

◆ runBuildingTestPlexStandard()

double mkfit::runBuildingTestPlexStandard ( Event ev,
const EventOfHits eoh,
MkBuilder builder 
)

Definition at line 198 of file buildtestMPlex.cc.

References ppsStraightTrackAligner_cfi::algorithms, mkfit::Config::backwardFit, mkfit::MkBuilder::backwardFitBH(), mkfit::MkBuilder::begin_event(), mkfit::Config::cmssw_val, dtime(), mkfit::MkBuilder::end_event(), makeMEIFBenchmarkPlots::ev, mkfit::MkBuilder::export_best_comb_cands(), spr::find(), mkfit::MkBuilder::find_tracks_load_seeds(), mkfit::MkBuilder::findTracksStandard(), mkfit::Config::ItrInfo, mkfit::IterationMaskIfc::m_mask_vector, mkfit::IterationConfig::m_track_algorithm, mkfit::StdSeq::Quality::quality_val(), mkfit::Config::quality_val, mkfit::MkBuilder::ref_tracks(), mkfit::EventOfHits::refBeamSpot(), mkfit::StdSeq::root_val(), alignCSCRings::s, mkfit::MkBuilder::select_best_comb_cands(), mkfit::Config::sim_val, hcalRecHitTable_cff::time, and mkfit::Config::TrkInfo.

Referenced by test_standard().

198  {
199  const IterationConfig &itconf = Config::ItrInfo[0];
200 
201  const bool validation_on = (Config::sim_val || Config::quality_val);
202 
203  TrackVec seeds1;
204  if (validation_on) {
205  unsigned int algorithms[] = {4}; //only initialStep
206 
207  for (auto const &s : ev.seedTracks_) {
208  //keep seeds form the first iteration for processing
209  if (std::find(algorithms, algorithms + 1, s.algoint()) != algorithms + 1)
210  seeds1.push_back(s);
211  }
212  ev.seedTracks_.swap(seeds1); //necessary for the validation - PrepareSeeds
213  ev.relabel_bad_seedtracks(); //necessary for the validation - PrepareSeeds
214  }
215 
216  IterationMaskIfc mask_ifc;
217 
218  // To disable hit-masks, pass nullptr in place of &mask_ifc to MkJob ctor
219  // and optionally comment out ev.fill_hitmask_bool_vectors() call.
220 
221  ev.fill_hitmask_bool_vectors(itconf.m_track_algorithm, mask_ifc.m_mask_vector);
222 
223  MkJob job({Config::TrkInfo, itconf, eoh, eoh.refBeamSpot(), &mask_ifc});
224 
225  builder.begin_event(&job, &ev, __func__);
226 
227  bool seeds_sorted = false;
228  // CCCC builder.PrepareSeeds();
229  ev.setCurrentSeedTracks(ev.seedTracks_);
230 
231  builder.find_tracks_load_seeds(ev.seedTracks_, seeds_sorted);
232 
233 #ifdef USE_VTUNE_PAUSE
234  __SSC_MARK(0x111); // use this to resume Intel SDE at the same point
235  __itt_resume();
236 #endif
237 
238  double time = dtime();
239 
240  builder.findTracksStandard();
241 
242  time = dtime() - time;
243 
244 #ifdef USE_VTUNE_PAUSE
245  __itt_pause();
246  __SSC_MARK(0x222); // use this to pause Intel SDE at the same point
247 #endif
248 
249  check_nan_n_silly_candidates(ev);
250 
251  // first store candidate tracks
252  ev.candidateTracks_.clear();
253  builder.export_best_comb_cands(ev.candidateTracks_);
254 
255  job.switch_to_backward();
256 
257  // now do backwards fit... do we want to time this section?
258  if (Config::backwardFit) {
259  // Using the TrackVec version until we home in on THE backward fit etc.
260  // builder.backwardFit();
261  builder.select_best_comb_cands();
262  builder.backwardFitBH();
263  ev.fitTracks_ = builder.ref_tracks();
264 
265  check_nan_n_silly_bkfit(ev);
266  }
267 
268  // CCCC StdSeq::handle_duplicates(&ev);
269 
270  if (Config::quality_val) {
271  StdSeq::Quality qval;
272  qval.quality_val(&ev);
273  } else if (Config::sim_val || Config::cmssw_val) {
275  }
276 
277  ev.resetCurrentSeedTracks();
278 
279  builder.end_event();
280 
281  // ev.print_tracks(ev.candidateTracks_, true);
282 
283  if (validation_on) {
284  ev.seedTracks_.swap(seeds1);
285  }
286 
287  return time;
288  }
void root_val(Event *event)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
TrackerInfo TrkInfo
IterationsInfo ItrInfo
std::vector< Track > TrackVec
double dtime()

◆ runFittingTestPlex()

double mkfit::runFittingTestPlex ( Event ev,
std::vector< Track > &  rectracks 
)

Definition at line 40 of file fittestMPlex.cc.

References submitPVResolutionJobs::count, dtime(), makeMEIFBenchmarkPlots::ev, mkfit::Config::fit_val, g_exe_ctx, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, mkfit::ExecutionContext::m_fitters, WZElectronSkims53X_cff::max, mkfit::Config::nLayers, NN, mkfit::Config::numSeedsPerTask, mkfit::Config::numThreadsFinder, mkfit::ExecutionContext::populate(), and hcalRecHitTable_cff::time.

40  {
42  std::vector<Track>& simtracks = ev.simTracks_;
43 
44  const int Nhits = Config::nLayers;
45  // XXX What if there's a missing / double layer?
46  // Eventually, should sort track vector by number of hits!
47  // And pass the number in on each "setup" call.
48  // Reserves should be made for maximum possible number (but this is just
49  // measurments errors, params).
50 
51  int theEnd = simtracks.size();
52  int count = (theEnd + NN - 1) / NN;
53 
54 #ifdef USE_VTUNE_PAUSE
55  __SSC_MARK(0x111); // use this to resume Intel SDE at the same point
56  __itt_resume();
57 #endif
58 
59  double time = dtime();
60 
61  tbb::parallel_for(tbb::blocked_range<int>(0, count, std::max(1, Config::numSeedsPerTask / NN)),
62  [&](const tbb::blocked_range<int>& i) {
63  std::unique_ptr<MkFitter, decltype(retfitr)> mkfp(g_exe_ctx.m_fitters.GetFromPool(), retfitr);
64  mkfp->setNhits(Nhits);
65  for (int it = i.begin(); it < i.end(); ++it) {
66  int itrack = it * NN;
67  int end = itrack + NN;
68  /*
69  * MT, trying to slurp and fit at the same time ...
70  if (theEnd < end) {
71  end = theEnd;
72  mkfp->inputTracksAndHits(simtracks, ev.layerHits_, itrack, end);
73  } else {
74  mkfp->slurpInTracksAndHits(simtracks, ev.layerHits_, itrack, end); // only safe for a full matriplex
75  }
76 
77  if (Config::cf_fitting) mkfp->ConformalFitTracks(true, itrack, end);
78  mkfp->FitTracks(end - itrack, &ev, true);
79  */
80 
81  mkfp->inputTracksForFit(simtracks, itrack, end);
82 
83  // XXXX MT - for this need 3 points in ... right
84  // XXXX if (Config::cf_fitting) mkfp->ConformalFitTracks(true, itrack, end);
85 
86  mkfp->fitTracksWithInterSlurp(ev.layerHits_, end - itrack);
87 
88  mkfp->outputFittedTracks(rectracks, itrack, end);
89  }
90  });
91 
92  time = dtime() - time;
93 
94 #ifdef USE_VTUNE_PAUSE
95  __itt_pause();
96  __SSC_MARK(0x222); // use this to pause Intel SDE at the same point
97 #endif
98 
99  if (Config::fit_val)
100  ev.validate();
101 
102  return time;
103  }
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
ExecutionContext g_exe_ctx
Definition: MkBuilder.cc:55
constexpr int numThreadsFinder
Definition: Config.h:92
Pool< MkFitter > m_fitters
Definition: MkBuilder.cc:39
void populate(int n_thr)
Definition: MkBuilder.cc:42
double dtime()
constexpr int numSeedsPerTask
Definition: Config.h:94

◆ sincos4()

void mkfit::sincos4 ( const float  x,
float &  sin,
float &  cos 
)
inline

Definition at line 13 of file Matrix.h.

References funct::cos(), funct::sin(), and x.

Referenced by helixAtRFromIterativeCCSFullJac(), and helixAtZ().

13  {
14  // Had this writen with explicit division by factorial.
15  // The *whole* fitting test ran like 2.5% slower on MIC, sigh.
16 
17  const float x2 = x * x;
18  cos = 1.f - 0.5f * x2 + 0.04166667f * x2 * x2;
19  sin = x - 0.16666667f * x * x2;
20  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float x

◆ sortByEta()

bool mkfit::sortByEta ( const Hit hit1,
const Hit hit2 
)
inline

Definition at line 23 of file buildtestMPlex.cc.

References mkfit::Hit::eta().

23 { return hit1.eta() < hit2.eta(); }

◆ sortByHitsChi2() [1/2]

bool mkfit::sortByHitsChi2 ( const std::pair< Track, TrackState > &  cand1,
const std::pair< Track, TrackState > &  cand2 
)
inline

Definition at line 12 of file buildtestMPlex.cc.

12  {
13  if (cand1.first.nFoundHits() == cand2.first.nFoundHits())
14  return cand1.first.chi2() < cand2.first.chi2();
15 
16  return cand1.first.nFoundHits() > cand2.first.nFoundHits();
17  }

◆ sortByHitsChi2() [2/2]

bool mkfit::sortByHitsChi2 ( const Track cand1,
const Track cand2 
)
inline

Definition at line 585 of file Track.h.

References mkfit::TrackBase::chi2(), and mkfit::Track::nFoundHits().

585  {
586  if (cand1.nFoundHits() == cand2.nFoundHits())
587  return cand1.chi2() < cand2.chi2();
588  return cand1.nFoundHits() > cand2.nFoundHits();
589  }

◆ sortByPhi()

bool mkfit::sortByPhi ( const Hit hit1,
const Hit hit2 
)
inline

Definition at line 19 of file buildtestMPlex.cc.

References Matriplex::atan2(), mkfit::Hit::x(), and mkfit::Hit::y().

19  {
20  return std::atan2(hit1.y(), hit1.x()) < std::atan2(hit2.y(), hit2.x());
21  }
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648

◆ sortByScoreCand()

bool mkfit::sortByScoreCand ( const Track cand1,
const Track cand2 
)
inline

Definition at line 591 of file Track.h.

References mkfit::TrackBase::score().

591 { return cand1.score() > cand2.score(); }

◆ sortByScoreStruct()

bool mkfit::sortByScoreStruct ( const IdxChi2List cand1,
const IdxChi2List cand2 
)
inline

Definition at line 593 of file Track.h.

References mkfit::IdxChi2List::score.

593  {
594  return cand1.score > cand2.score;
595  }

◆ sortByScoreTrackCand()

bool mkfit::sortByScoreTrackCand ( const TrackCand cand1,
const TrackCand cand2 
)
inline

Definition at line 255 of file TrackStructures.h.

References mkfit::TrackBase::score().

Referenced by mkfit::CombCandidate::mergeCandsAndBestShortOne(), and mkfit::CandCloner::processSeedRange().

255  {
256  return cand1.score() > cand2.score();
257  }

◆ sortByZ()

bool mkfit::sortByZ ( const Hit hit1,
const Hit hit2 
)
inline

Definition at line 41 of file buildtestMPlex.cc.

References mkfit::Hit::z().

41 { return hit1.z() < hit2.z(); }
double z
global z - AlignmentGeometry::z0, mm
Definition: HitCollection.h:27

◆ sortIDsByChi2()

bool mkfit::sortIDsByChi2 ( const idchi2Pair cand1,
const idchi2Pair cand2 
)
inline

Definition at line 235 of file TrackExtra.cc.

Referenced by mkfit::TrackExtra::setCMSSWTrackIDInfoByTrkParams().

235 { return cand1.second < cand2.second; }

◆ sortTracksByEta()

bool mkfit::sortTracksByEta ( const Track track1,
const Track track2 
)
inline

Definition at line 25 of file buildtestMPlex.cc.

References mkfit::TrackBase::momEta().

25 { return track1.momEta() < track2.momEta(); }

◆ sortTracksByPhi()

bool mkfit::sortTracksByPhi ( const Track track1,
const Track track2 
)
inline

Definition at line 27 of file buildtestMPlex.cc.

References mkfit::TrackBase::momPhi().

27 { return track1.momPhi() < track2.momPhi(); }

◆ sqr()

template<typename T >
T mkfit::sqr ( T  x)
inline

Definition at line 14 of file Hit.h.

References x.

14  {
15  return x * x;
16  }
float x

◆ squashPhiGeneral() [1/2]

float mkfit::squashPhiGeneral ( float  phi)
inline

Definition at line 22 of file Hit.h.

References mkfit::Const::InvPI, mkfit::Const::PI, and mkfit::Const::TwoPI.

Referenced by computeHelixChi2(), mkfit::TrackExtra::setCMSSWTrackIDInfoByHits(), mkfit::TrackExtra::setCMSSWTrackIDInfoByTrkParams(), mkfit::TrackExtra::setMCTrackIDInfo(), squashPhiGeneral(), and mkfit::TrackBase::swimPhiToR().

22  {
23  return phi - floor(0.5 * Const::InvPI * (phi + Const::PI)) * Const::TwoPI;
24  }
constexpr float TwoPI
Definition: Config.h:8
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE float phi(TAcc const &acc, float x, float y)
Definition: Hit.h:29
#define PI
Definition: QcdUeDQM.h:37
constexpr float InvPI
Definition: Config.h:12

◆ squashPhiGeneral() [2/2]

template<typename Vector >
void mkfit::squashPhiGeneral ( Vector v)
inline

Definition at line 631 of file Track.h.

References mps_fire::i, squashPhiGeneral(), and findQualityFiles::v.

631  {
632  const int i = v.kSize - 2; // phi index
633  v[i] = squashPhiGeneral(v[i]);
634  }
void squashPhiGeneral(Vector &v)
Definition: Track.h:631

◆ squashPhiMinimal()

float mkfit::squashPhiMinimal ( float  phi)
inline

Definition at line 26 of file Hit.h.

References mkfit::Const::PI, and mkfit::Const::TwoPI.

Referenced by mkfit::StdSeq::clean_duplicates(), mkfit::StdSeq::clean_duplicates_sharedhits(), and mkfit::StdSeq::clean_duplicates_sharedhits_pixelseed().

26  {
27  return phi >= Const::PI ? phi - Const::TwoPI : (phi < -Const::PI ? phi + Const::TwoPI : phi);
28  }
constexpr float TwoPI
Definition: Config.h:8
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE float phi(TAcc const &acc, float x, float y)
Definition: Hit.h:29
#define PI
Definition: QcdUeDQM.h:37

◆ squashPhiMPlex()

void mkfit::squashPhiMPlex ( MPlexLV par,
const int  N_proc 
)
inline

Definition at line 10 of file PropagationMPlex.h.

References create_idmaps::n, NN, mkfit::Const::PI, and mkfit::Const::TwoPI.

Referenced by kalmanOperation(), kalmanOperationEndcap(), kalmanOperationPlane(), propagateHelixToPlaneMPlex(), propagateHelixToRMPlex(), and propagateHelixToZMPlex().

10  {
11 #pragma omp simd
12  for (int n = 0; n < NN; ++n) {
13  if (n < N_proc) {
14  if (par(n, 4, 0) >= Const::PI)
15  par(n, 4, 0) -= Const::TwoPI;
16  if (par(n, 4, 0) < -Const::PI)
17  par(n, 4, 0) += Const::TwoPI;
18  }
19  }
20  }
constexpr float TwoPI
Definition: Config.h:8
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
#define PI
Definition: QcdUeDQM.h:37

◆ squashPhiMPlexGeneral()

void mkfit::squashPhiMPlexGeneral ( MPlexLV par,
const int  N_proc 
)
inline

Definition at line 22 of file PropagationMPlex.h.

References f, mkfit::Const::InvPI, create_idmaps::n, NN, mkfit::Const::PI, and mkfit::Const::TwoPI.

22  {
23 #pragma omp simd
24  for (int n = 0; n < NN; ++n) {
25  par(n, 4, 0) -= std::floor(0.5f * Const::InvPI * (par(n, 4, 0) + Const::PI)) * Const::TwoPI;
26  }
27  }
constexpr float TwoPI
Definition: Config.h:8
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
double f[11][100]
#define PI
Definition: QcdUeDQM.h:37
constexpr float InvPI
Definition: Config.h:12

◆ state2mom()

RVec mkfit::state2mom ( const miprops::State s)

Definition at line 14 of file RntConversions.h.

References alignCSCRings::s.

Referenced by mkfit::MkFinder::selectHitIndicesV2(), and state2state().

14 { return {s.px, s.py, s.pz}; }

◆ state2pos()

RVec mkfit::state2pos ( const miprops::State s)

Definition at line 13 of file RntConversions.h.

References alignCSCRings::s.

Referenced by mkfit::MkFinder::selectHitIndicesV2(), and state2state().

13 { return {s.x, s.y, s.z}; }

◆ state2state()

State mkfit::state2state ( const miprops::State s)

Definition at line 15 of file RntConversions.h.

References alignCSCRings::s, state2mom(), and state2pos().

15 { return {state2pos(s), state2mom(s)}; }
RVec state2mom(const miprops::State &s)
RVec state2pos(const miprops::State &s)

◆ statep2mom()

RVec mkfit::statep2mom ( const miprops::StatePlex s,
int  i 
)

Definition at line 18 of file RntConversions.h.

References mps_fire::i, and alignCSCRings::s.

Referenced by statep2state().

18 { return {s.px[i], s.py[i], s.pz[i]}; }

◆ statep2pos()

RVec mkfit::statep2pos ( const miprops::StatePlex s,
int  i 
)

Definition at line 17 of file RntConversions.h.

References mps_fire::i, and alignCSCRings::s.

Referenced by statep2state().

17 { return {s.x[i], s.y[i], s.z[i]}; }

◆ statep2propstate()

PropState mkfit::statep2propstate ( const miprops::StatePlex s,
int  i 
)

Definition at line 20 of file RntConversions.h.

References mps_fire::i, alignCSCRings::s, and statep2state().

Referenced by mkfit::MkFinder::selectHitIndicesV2().

20  {
21  return {statep2state(s, i), s.dalpha[i], s.fail_flag[i]};
22  }
State statep2state(const miprops::StatePlex &s, int i)

◆ statep2state()

State mkfit::statep2state ( const miprops::StatePlex s,
int  i 
)

Definition at line 19 of file RntConversions.h.

References mps_fire::i, alignCSCRings::s, statep2mom(), and statep2pos().

Referenced by statep2propstate().

19 { return {statep2pos(s, i), statep2mom(s, i)}; }
RVec statep2mom(const miprops::StatePlex &s, int i)
RVec statep2pos(const miprops::StatePlex &s, int i)

◆ to_json() [1/12]

void mkfit::to_json ( nlohmann::ordered_json &  nlohmann_json_j,
const mkfit::LayerControl nlohmann_json_t 
)
inline

Definition at line 37 of file IterationConfig.cc.

◆ to_json() [2/12]

void mkfit::to_json ( nlohmann::json nlohmann_json_j,
const mkfit::LayerControl nlohmann_json_t 
)
inline

Definition at line 37 of file IterationConfig.cc.

Referenced by mkfit::ConfigJson::save_Iterations().

◆ to_json() [3/12]

void mkfit::to_json ( nlohmann::ordered_json &  nlohmann_json_j,
const mkfit::SteeringParams nlohmann_json_t 
)
inline

Definition at line 45 of file IterationConfig.cc.

◆ to_json() [4/12]

void mkfit::to_json ( nlohmann::json nlohmann_json_j,
const mkfit::SteeringParams nlohmann_json_t 
)
inline

Definition at line 45 of file IterationConfig.cc.

◆ to_json() [5/12]

void mkfit::to_json ( nlohmann::json nlohmann_json_j,
const mkfit::IterationLayerConfig nlohmann_json_t 
)
inline

Definition at line 54 of file IterationConfig.cc.

◆ to_json() [6/12]

void mkfit::to_json ( nlohmann::ordered_json &  nlohmann_json_j,
const mkfit::IterationLayerConfig nlohmann_json_t 
)
inline

Definition at line 54 of file IterationConfig.cc.

◆ to_json() [7/12]

void mkfit::to_json ( nlohmann::ordered_json &  nlohmann_json_j,
const mkfit::IterationParams nlohmann_json_t 
)
inline

Definition at line 68 of file IterationConfig.cc.

◆ to_json() [8/12]

void mkfit::to_json ( nlohmann::json nlohmann_json_j,
const mkfit::IterationParams nlohmann_json_t 
)
inline

Definition at line 68 of file IterationConfig.cc.

◆ to_json() [9/12]

void mkfit::to_json ( nlohmann::ordered_json &  nlohmann_json_j,
const mkfit::IterationConfig nlohmann_json_t 
)
inline

Definition at line 101 of file IterationConfig.cc.

◆ to_json() [10/12]

void mkfit::to_json ( nlohmann::json nlohmann_json_j,
const mkfit::IterationConfig nlohmann_json_t 
)
inline

Definition at line 101 of file IterationConfig.cc.

◆ to_json() [11/12]

void mkfit::to_json ( nlohmann::ordered_json &  nlohmann_json_j,
const mkfit::IterationsInfo nlohmann_json_t 
)
inline

Definition at line 104 of file IterationConfig.cc.

References CMS_SA_ALLOW, and mutex.

110 {

◆ to_json() [12/12]

void mkfit::to_json ( nlohmann::json nlohmann_json_j,
const mkfit::IterationsInfo nlohmann_json_t 
)
inline

Definition at line 104 of file IterationConfig.cc.

110 {

◆ track2mom()

RVec mkfit::track2mom ( const TrackBase s)

Definition at line 26 of file RntConversions.h.

References alignCSCRings::s.

Referenced by track2state().

26 { return {s.px(), s.py(), s.pz()}; }

◆ track2pos()

RVec mkfit::track2pos ( const TrackBase s)

Definition at line 25 of file RntConversions.h.

References alignCSCRings::s.

Referenced by track2state().

25 { return {s.x(), s.y(), s.z()}; }

◆ track2state()

State mkfit::track2state ( const TrackBase s)

Definition at line 27 of file RntConversions.h.

References alignCSCRings::s, track2mom(), and track2pos().

Referenced by evsi2ssinfo().

27 { return {track2pos(s), track2mom(s)}; }
RVec track2pos(const TrackBase &s)
RVec track2mom(const TrackBase &s)

Variable Documentation

◆ g_debug

bool mkfit::g_debug = true

◆ g_exe_ctx

ExecutionContext mkfit::g_exe_ctx

◆ HH

constexpr Matriplex::idx_t mkfit::HH = 3

Definition at line 51 of file Matrix.h.

Referenced by L1TConfigDumper::analyze().

◆ LL

constexpr Matriplex::idx_t mkfit::LL = 6

◆ MPlexHitIdxMax

constexpr int mkfit::MPlexHitIdxMax = 16
static

Definition at line 12 of file MkFitter.h.

◆ NN

constexpr Matriplex::idx_t mkfit::NN = 8

Definition at line 48 of file Matrix.h.

Referenced by mkfit::MkFinder::addBestHit(), L1NNTauProducer::addTau(), L1TConfigDumper::analyze(), applyMaterialEffects(), mkfit::MkFinder::bkFitFitTracks(), mkfit::MkFinder::bkFitFitTracksBH(), CFMap(), conformalFitMPlex(), mkfit::MkFinder::copyOutParErr(), mkfit::MkBuilder::find_tracks_in_layers(), mkfit::MkFinder::findCandidates(), mkfit::MkFinder::findCandidatesCloneEngine(), mkfit::MkBuilder::findTracksBestHit(), mkfit::MkBuilder::findTracksStandard(), mkfit::MkBuilder::fit_cands(), mkfit::MkBuilder::fit_cands_BH(), helixAtRFromIterativeCCS(), helixAtRFromIterativeCCSFullJac(), helixAtZ(), kalmanOperation(), kalmanOperationPlane(), kalmanOperationPlaneLocal(), kalmanPropagateAndComputeChi2(), kalmanPropagateAndComputeChi2Endcap(), kalmanPropagateAndUpdate(), kalmanPropagateAndUpdateEndcap(), kalmanPropagateAndUpdatePlane(), MultHelixPropFull(), MultHelixPropTranspFull(), mkfit::MatriplexPackerSlurpIn< D >::pack(), mkfit::MatriplexErrParPackerSlurpIn< T, D >::pack(), mkfit::MkFinder::packModuleNormDirPnt(), mkfit::MkFitter::printPt(), L1BJetProducer::produce(), propagateHelixToPlaneMPlex(), propagateHelixToRMPlex(), propagateHelixToZMPlex(), propagateLineToRMPlex(), mkfit::MkBase::propagateTracksToHitR(), mkfit::MkBase::propagateTracksToHitZ(), mkfit::MkBase::propagateTracksToPCAZ(), mkfit::MkBase::propagateTracksToR(), mkfit::MkBase::propagateTracksToZ(), runFittingTestPlex(), gen::TauolappInterface::selectHadronic(), mkfit::MkFinder::selectHitIndices(), mkfit::MkFinder::selectHitIndicesV2(), squashPhiMPlex(), and squashPhiMPlexGeneral().