CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
mkfit Namespace Reference

Namespaces

 Config
 
 ConfigWrapper
 
 Const
 
 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  MaterialEffects
 
class  MatriplexErrParPackerSlurpIn
 
class  MatriplexPackerSlurpIn
 
class  MatriplexTrackPackerPlexify
 
struct  MCHitInfo
 
struct  MeasurementState
 
class  MkBase
 
class  MkBuilder
 
class  MkBuilderWrapper
 
class  MkFinder
 
class  MkFitter
 
class  MkJob
 
class  Pool
 
class  PropagationConfig
 
struct  PropagationFlags
 
struct  ReducedTrack
 
struct  sortTracksByPhiStruct
 
class  SteeringParams
 
class  Track
 
class  TrackBase
 
class  TrackCand
 
class  TrackerInfo
 
class  TrackExtra
 
struct  TrackState
 
class  TTreeValidation
 
class  Validation
 
struct  WSR_Result
 

Typedefs

typedef std::map< std::string,
std::pair< cleanOpts,
std::string > > 
cleanOptsMap
 
typedef std::vector< DeadRegionDeadVec
 
typedef std::vector< EventEventVec
 
typedef std::map< int, FitValFitValLayMap
 
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, NN
MPlex22
 
typedef
Matriplex::MatriplexSym< float,
2, NN
MPlex2S
 
typedef Matriplex::Matriplex
< float, 2, 1, NN
MPlex2V
 
typedef Matriplex::Matriplex
< float, HH, HH, NN
MPlexHH
 
using MPlexHitIdx = Matriplex::Matriplex< int, MPlexHitIdxMax, 1, NN >
 
typedef Matriplex::Matriplex
< float, HH, LL, NN
MPlexHL
 
typedef
Matriplex::MatriplexSym< float,
HH, NN
MPlexHS
 
typedef Matriplex::Matriplex
< float, HH, 1, NN
MPlexHV
 
typedef Matriplex::Matriplex
< float, LL, 2, NN
MPlexL2
 
typedef Matriplex::Matriplex
< float, LL, HH, NN
MPlexLH
 
typedef Matriplex::Matriplex
< float, LL, LL, NN
MPlexLL
 
typedef
Matriplex::MatriplexSym< float,
LL, NN
MPlexLS
 
typedef Matriplex::Matriplex
< float, LL, 1, NN
MPlexLV
 
typedef Matriplex::Matriplex
< bool, 1, 1, NN
MPlexQB
 
typedef Matriplex::Matriplex
< float, 1, 1, NN
MPlexQF
 
using MPlexQHoT = Matriplex::Matriplex< HitOnTrack, 1, 1, NN >
 
typedef Matriplex::Matriplex
< int, 1, 1, NN
MPlexQI
 
typedef Matriplex::Matriplex
< unsigned int, 1, 1, NN
MPlexQUI
 
typedef std::array< int, 2 > PairIdx
 
typedef std::vector< PairIdxPairIdxVec
 
typedef std::pair< uint16_t,
uint16_t > 
PhiBinInfo_t
 
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, FitValLayMap
TkIDtoFitValLayMapMap
 
typedef std::unordered_map
< int, int > 
TkIDToTkIDMap
 
typedef std::unordered_map
< int, std::vector< int > > 
TkIDToTkIDVecMap
 
typedef std::unordered_map
< int, TSLayerPairVec
TkIDToTSLayerPairVecMap
 
typedef std::unordered_map
< int, TrackState
TkIDToTSMap
 
typedef std::vector< TSVecTkIDToTSVecVec
 
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
 
typedef std::array< bool,
Config::m_nphi
vecPhiBinDead_t
 
typedef std::array
< PhiBinInfo_t, Config::m_nphi
vecPhiBinInfo_t
 
typedef std::vector
< vecPhiBinDead_t
vecvecPhiBinDead_t
 
typedef std::vector
< vecPhiBinInfo_t
vecvecPhiBinInfo_t
 

Enumerations

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

Functions

void applyMaterialEffects (const MPlexQF &hitsRl, const MPlexQF &hitsXi, const MPlexQF &propSign, MPlexLS &outErr, MPlexLV &outPar, const int N_proc, const bool isBarrel)
 
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)
 
void createPhase1TrackerGeometry (TrackerInfo &ti, bool verbose)
 
template<typename T >
T cube (T x)
 
template<typename Matrix >
void diagonalOnly (Matrix &m)
 
double dtime ()
 
template<typename Matrix >
void dumpMatrix (Matrix m)
 
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::json &nlohmann_json_j, mkfit::LayerControl &nlohmann_json_t)
 
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::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 getScoreCalc (const int nfoundhits, const int ntailholes, const int noverlaphits, const int nmisshits, const float chi2, const float pt, const bool inFindCandidates=false)
 
float getScoreCand (const TrackCand &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
 
float getScoreCand (const Track &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
 
float getScoreStruct (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 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, const int N_proc)
 
void helixAtZ (const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLV &outPar, MPlexLL &errorProp, const int N_proc, const PropagationFlags pflags)
 
float hipo (float x, float y)
 
float hipo_sqr (float x, float y)
 
void intersectThirdLayer (const float a, const float b, const float hit1_x, const float hit1_y, float &lay2_x, float &lay2_y)
 
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 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 kalmanPropagateAndComputeChi2 (const MPlexLS &psErr, const MPlexLV &psPar, const MPlexQI &inChg, const MPlexHS &msErr, const MPlexHV &msPar, MPlexQF &outChi2, MPlexLV &propPar, 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, 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, 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, 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)
 
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 label, int itrack, const Track &trk, bool print_hits=false)
 
void print (std::string label, const TrackState &s)
 
void propagateHelixToRMPlex (const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLS &outErr, MPlexLV &outPar, 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, const int N_proc, const PropagationFlags pflags, const MPlexQI *noMatEffPtr)
 
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 sortHitsByPhiMT (const Hit &h1, const Hit &h2)
 
bool sortIDsByChi2 (const idchi2Pair &cand1, const idchi2Pair &cand2)
 
bool sortTracksByEta (const Track &track1, const Track &track2)
 
bool sortTracksByPhi (const Track &track1, const Track &track2)
 
bool sortTrksByPhiMT (const Track &t1, const Track &t2)
 
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)
 
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::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::json &nlohmann_json_j, const mkfit::IterationParams &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::IterationConfig &nlohmann_json_t)
 
void to_json (nlohmann::ordered_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)
 

Variables

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

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

Definition at line 25 of file ConfigStandalone.h.

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

Definition at line 266 of file Hit.h.

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

Definition at line 71 of file Event.h.

typedef std::map<int, FitVal> mkfit::FitValLayMap

Definition at line 24 of file TTreeValidation.h.

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

Definition at line 121 of file TrackExtra.h.

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

Definition at line 15 of file Track.h.

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

Definition at line 16 of file Track.h.

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

Definition at line 11 of file MkFitHitWrapper.h.

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

Definition at line 258 of file Hit.h.

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

Definition at line 232 of file TrackExtra.cc.

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

Definition at line 233 of file TrackExtra.cc.

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

Definition at line 37 of file TrackExtra.h.

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

Definition at line 29 of file ConfigStandalone.h.

Definition at line 136 of file MatriplexPackers.h.

Definition at line 139 of file MatriplexPackers.h.

Definition at line 137 of file MatriplexPackers.h.

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

Definition at line 118 of file Hit.h.

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

Definition at line 56 of file Matrix.h.

Definition at line 58 of file Matrix.h.

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

Definition at line 57 of file Matrix.h.

Definition at line 52 of file Matrix.h.

Definition at line 13 of file MkFitter.h.

Definition at line 61 of file Matrix.h.

Definition at line 54 of file Matrix.h.

Definition at line 53 of file Matrix.h.

Definition at line 63 of file Matrix.h.

Definition at line 60 of file Matrix.h.

Definition at line 48 of file Matrix.h.

Definition at line 50 of file Matrix.h.

Definition at line 49 of file Matrix.h.

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

Definition at line 69 of file Matrix.h.

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

Definition at line 65 of file Matrix.h.

Definition at line 14 of file MkFitter.h.

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

Definition at line 66 of file Matrix.h.

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

Definition at line 67 of file Matrix.h.

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

Definition at line 39 of file TrackExtra.h.

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

Definition at line 40 of file TrackExtra.h.

typedef std::pair<uint16_t, uint16_t> mkfit::PhiBinInfo_t

Definition at line 14 of file HitStructures.h.

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

Definition at line 35 of file TrackExtra.h.

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

Definition at line 21 of file ConfigStandalone.h.

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

Definition at line 14 of file Track.h.

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

Definition at line 16 of file MatrixSTypes.h.

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

Definition at line 23 of file MatrixSTypes.h.

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

Definition at line 12 of file MatrixSTypes.h.

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

Definition at line 20 of file MatrixSTypes.h.

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

Definition at line 24 of file MatrixSTypes.h.

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

Definition at line 21 of file MatrixSTypes.h.

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

Definition at line 9 of file MatrixSTypes.h.

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

Definition at line 17 of file MatrixSTypes.h.

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

Definition at line 13 of file MatrixSTypes.h.

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

Definition at line 8 of file MatrixSTypes.h.

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

Definition at line 18 of file MatrixSTypes.h.

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

Definition at line 14 of file MatrixSTypes.h.

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

Definition at line 10 of file MatrixSTypes.h.

typedef std::unordered_map<int, FitValLayMap> mkfit::TkIDtoFitValLayMapMap

Definition at line 25 of file TTreeValidation.h.

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

Definition at line 124 of file TrackExtra.h.

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

Definition at line 125 of file TrackExtra.h.

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

Definition at line 127 of file TrackExtra.h.

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

Definition at line 126 of file TrackExtra.h.

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

Definition at line 119 of file TrackExtra.h.

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

Definition at line 13 of file MkStandaloneSeqs.h.

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

Definition at line 8 of file MkFitOutputWrapper.h.

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

Definition at line 588 of file Track.h.

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

Definition at line 41 of file TrackExtra.h.

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

Definition at line 42 of file TrackExtra.h.

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

Definition at line 38 of file TrackExtra.h.

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

Definition at line 120 of file TrackExtra.h.

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

Definition at line 118 of file TrackExtra.h.

typedef std::array<bool, Config::m_nphi> mkfit::vecPhiBinDead_t

Definition at line 22 of file HitStructures.h.

Definition at line 18 of file HitStructures.h.

Definition at line 24 of file HitStructures.h.

Definition at line 20 of file HitStructures.h.

Enumeration Type Documentation

Enumerator
noCleaning 
cleanSeedsN2 
cleanSeedsPure 
cleanSeedsBadLabel 

Definition at line 24 of file ConfigStandalone.h.

Enumerator
KFO_Calculate_Chi2 
KFO_Update_Params 

Definition at line 11 of file KalmanUtilsMPlex.h.

Enumerator
trkParamBased 
hitBased 
labelBased 

Definition at line 28 of file ConfigStandalone.h.

Enumerator
PF_none 
PF_use_param_b_field 
PF_apply_material 

Definition at line 6 of file Config.h.

Enumerator
simSeeds 
cmsswSeeds 
findSeeds 

Definition at line 20 of file ConfigStandalone.h.

enum mkfit::TkLayout
strong
Enumerator
phase0 
phase1 

Definition at line 6 of file LayerNumberConverter.h.

Enumerator
WSR_Undef 
WSR_Inside 
WSR_Edge 
WSR_Outside 

Definition at line 13 of file TrackerInfo.h.

Function Documentation

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

Definition at line 859 of file PropagationMPlex.cc.

References funct::abs(), Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::MatriplexSym< T, D, N >::At(), HLT_FULL_cff::beta, Matriplex::Matriplex< T, D1, D2, N >::constAt(), funct::cos(), plot_hgcal_utils::dEdx, alignCSCRings::e, validate-o2o-wbm::f, Exhume::I, log, SiStripPI::max, hlt_dqm_clientPB-live_cfg::me, dqmiodumpmetadata::n, NN, AlCaHLTBitMon_ParallelJobs::p, fireworks::p2, DiDispStaMuonMonitor_cfi::pt, funct::sin(), mathSSE::sqrt(), theta(), and cms::cuda::wmax.

Referenced by propagateHelixToRMPlex(), and propagateHelixToZMPlex().

865  {
866 #pragma omp simd
867  for (int n = 0; n < NN; ++n) {
868  float radL = hitsRl.constAt(n, 0, 0);
869  if (radL < 1e-13f)
870  continue; //ugly, please fixme
871  const float theta = outPar.constAt(n, 5, 0);
872  const float pt = 1.f / outPar.constAt(n, 3, 0); //fixme, make sure it is positive?
873  const float p = pt / std::sin(theta);
874  const float p2 = p * p;
875  constexpr float mpi = 0.140; // m=140 MeV, pion
876  constexpr float mpi2 = mpi * mpi; // m=140 MeV, pion
877  const float beta2 = p2 / (p2 + mpi2);
878  const float beta = std::sqrt(beta2);
879  //radiation lenght, corrected for the crossing angle (cos alpha from dot product of radius vector and momentum)
880  const float invCos = (isBarrel ? p / pt : 1.f / std::abs(std::cos(theta)));
881  radL = radL * invCos; //fixme works only for barrel geom
882  // multiple scattering
883  //vary independently phi and theta by the rms of the planar multiple scattering angle
884  // XXX-KMD radL < 0, see your fixme above! Repeating bailout
885  if (radL < 1e-13f)
886  continue;
887  // const float thetaMSC = 0.0136f*std::sqrt(radL)*(1.f+0.038f*std::log(radL))/(beta*p);// eq 32.15
888  // const float thetaMSC2 = thetaMSC*thetaMSC;
889  const float thetaMSC = 0.0136f * (1.f + 0.038f * std::log(radL)) / (beta * p); // eq 32.15
890  const float thetaMSC2 = thetaMSC * thetaMSC * radL;
891  outErr.At(n, 4, 4) += thetaMSC2;
892  // outErr.At(n, 4, 5) += thetaMSC2;
893  outErr.At(n, 5, 5) += thetaMSC2;
894  //std::cout << "beta=" << beta << " p=" << p << std::endl;
895  //std::cout << "multiple scattering thetaMSC=" << thetaMSC << " thetaMSC2=" << thetaMSC2 << " radL=" << radL << std::endl;
896  // energy loss
897  // XXX-KMD beta2 = 1 => 1 / sqrt(0)
898  // const float gamma = 1.f/std::sqrt(1.f - std::min(beta2, 0.999999f));
899  // const float gamma2 = gamma*gamma;
900  const float gamma2 = (p2 + mpi2) / mpi2;
901  const float gamma = std::sqrt(gamma2); //1.f/std::sqrt(1.f - std::min(beta2, 0.999999f));
902  constexpr float me = 0.0005; // m=0.5 MeV, electron
903  const float wmax = 2.f * me * beta2 * gamma2 / (1.f + 2.f * gamma * me / mpi + me * me / (mpi * mpi));
904  constexpr float I = 16.0e-9 * 10.75;
905  const float deltahalf = std::log(28.816e-9f * std::sqrt(2.33f * 0.498f) / I) + std::log(beta * gamma) - 0.5f;
906  const float dEdx =
907  beta < 1.f
908  ? (2.f * (hitsXi.constAt(n, 0, 0) * invCos *
909  (0.5f * std::log(2.f * me * beta2 * gamma2 * wmax / (I * I)) - beta2 - deltahalf) / beta2))
910  : 0.f; //protect against infs and nans
911  // dEdx = dEdx*2.;//xi in cmssw is defined with an extra factor 0.5 with respect to formula 27.1 in pdg
912  //std::cout << "dEdx=" << dEdx << " delta=" << deltahalf << " wmax=" << wmax << " Xi=" << hitsXi.constAt(n,0,0) << std::endl;
913  const float dP = propSign.constAt(n, 0, 0) * dEdx / beta;
914  outPar.At(n, 3, 0) = p / (std::max(p + dP, 0.001f) * pt); //stay above 1MeV
915  //assume 100% uncertainty
916  outErr.At(n, 3, 3) += dP * dP / (p2 * pt * pt);
917  }
918  }
static std::vector< std::string > checklist log
const TString p2
Definition: fwPaths.cc:13
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
T & At(idx_t n, idx_t i, idx_t j)
Definition: MatriplexSym.h:71
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
T sqrt(T t)
Definition: SSEVec.h:19
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
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
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
__host__ __device__ V V wmax
int mkfit::calculateCharge ( const Hit hit0,
const Hit hit1,
const Hit hit2 
)
inline

Definition at line 18 of file Track.h.

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

18  {
19  return ((hit2.y() - hit0.y()) * (hit2.x() - hit1.x()) > (hit2.y() - hit1.y()) * (hit2.x() - hit0.x()) ? 1 : -1);
20  }
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 22 of file Track.h.

27  {
28  return ((hit2_y - hit0_y) * (hit2_x - hit1_x) > (hit2_y - hit1_y) * (hit2_x - hit0_x) ? 1 : -1);
29  }
float mkfit::cdist ( float  a)
inline

Definition at line 67 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(), and mkfit::MkFinder::selectHitIndices().

67 { return a > Const::PI ? Const::TwoPI - a : a; }
constexpr float TwoPI
Definition: Config.h:43
#define PI
Definition: QcdUeDQM.h:37
double a
Definition: hdecay.h:119
void mkfit::CFMap ( const MPlexHH &  A,
const MPlexHV &  B,
MPlexHV &  C 
)
inline

Definition at line 89 of file ConformalUtilsMPlex.cc.

References a, ASSUME_ALIGNED, b, 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  }
const edm::EventSetup & c
Definition: APVGainStruct.h:7
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
#define N
Definition: blowfish.cc:9
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
Definition: APVGainStruct.h:7
long double T
#define ASSUME_ALIGNED(a, b)
template<typename Vector , typename Matrix >
float mkfit::computeHelixChi2 ( const Vector simV,
const Vector recoV,
const Matrix &  recoM,
const bool  diagOnly = false 
)

Definition at line 664 of file Track.h.

References diagonalOnly(), and squashPhiGeneral().

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

664  {
665  Vector diffV = recoV - simV;
666  if (diffV.kSize > 2)
667  squashPhiGeneral(diffV);
668 
669  Matrix recoM_tmp = recoM;
670  if (diagOnly)
671  diagonalOnly(recoM_tmp);
672  int invFail(0);
673  const Matrix recoMI = recoM_tmp.InverseFast(invFail);
674 
675  return ROOT::Math::Dot(diffV * recoMI, diffV) / (diffV.kSize - 1);
676  }
void diagonalOnly(Matrix &m)
Definition: MatrixSTypes.h:27
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
CLHEP::HepMatrix Matrix
Definition: matutil.h:62
float squashPhiGeneral(float phi)
Definition: Hit.h:21
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(), Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::MatriplexSym< T, D, N >::At(), b, mkfit::Config::Bfield, gen::C, CFMap(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), Matriplex::MatriplexSym< T, D, N >::constAt(), dcall, debug, dprint, dprintf, validate-o2o-wbm::f, getPhi(), getRad2(), getTheta(), hipo(), mps_fire::i, Matriplex::invertCramer(), dqmiolumiharvest::j, isotrackApplyRegressor::k, N, dqmiodumpmetadata::n, NN, mkfit::TrackState::parameters, mkfit::Config::phierr012, mkfit::Config::phierr049, mkfit::Const::PI3Over4, mkfit::Const::PIOver4, print(), PVValHelper::pT, mkfit::Config::ptinverr012, mkfit::Config::ptinverr049, 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) {
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:52
Matriplex::Matriplex< float, HH, 1, NN > MPlexHV
Definition: Matrix.h:53
float getTheta(float r, float z)
Definition: Hit.h:35
constexpr float phierr012
float float float z
constexpr float thetaerr049
#define dcall(x)
Definition: Debug.h:92
constexpr float varZ
constexpr float varR
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
constexpr float Bfield
Definition: Config.h:88
float getRad2(float x, float y)
Definition: Hit.h:29
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
Matriplex::Matriplex< int, 1, 1, NN > MPlexQI
Definition: Matrix.h:66
constexpr float thetaerr012
#define debug
Definition: HDRShower.cc:19
constexpr float sol
Definition: Config.h:48
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:65
#define N
Definition: blowfish.cc:9
void invertCramer(MPlex< T, D, D, N > &A, double *determ=nullptr)
Definition: Matriplex.h:424
float hipo(float x, float y)
Definition: Matrix.h:9
double b
Definition: hdecay.h:118
float getPhi(float x, float y)
Definition: Hit.h:33
#define dprint(x)
Definition: Debug.h:90
constexpr float varXY
double a
Definition: hdecay.h:119
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:46
constexpr float ptinverr012
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
#define dprintf(...)
Definition: Debug.h:93
constexpr float PIOver4
Definition: Config.h:45
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 RecoTauCleanerPlugins::charge, submitPVValidationJobs::err, Exception, validate-o2o-wbm::f, edm::ProductID::id(), TrackerTopology::isStereo(), TrackerTopology::layer(), LogTrace, MkFitGeometry::mkFitLayerNumber(), DetId::rawId(), findQualityFiles::size, DetId::subdetId(), MkFitGeometry::uniqueIdInLayer(), and UNLIKELY.

Referenced by MkFitSiPixelHitConverter::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  }
unsigned int uniqueIdInLayer(int layer, unsigned int detId) const
Definition: MkFitGeometry.h:35
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
bool isStereo(const DetId &id) const
#define LogTrace(id)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
SeedingHitSet::ConstRecHitPointer Hit
Definition: DetId.h:17
int mkFitLayerNumber(DetId detId) const
unsigned int layer(const DetId &id) const
#define UNLIKELY(x)
Definition: Likely.h:21
ProductIndex id() const
Definition: ProductID.h:35
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
tuple size
Write out results.
void mkfit::createPhase1TrackerGeometry ( TrackerInfo ti,
bool  verbose 
)

Definition at line 17 of file createPhase1TrackerGeometry.cc.

References mkfit::TrackerInfo::create_layers(), cuy::ii, mkfit::TrackerInfo::layer(), mkfit::TrackerInfo::n_layers(), mkfit::LayerInfo::print_layer(), and gpuVertexFinder::printf().

Referenced by MkFitGeometryESProducer::produce().

17  {
18  ti.create_layers(18, 27, 27);
19  createPhase1TrackerGeometryAutoGen(ti);
20 
21  // TODO: replace with MessageLogger
22  if (verbose) {
23  printf("==========================================================================================\n");
24  printf("Phase1 tracker -- Create_TrackerInfo finished\n");
25  printf("==========================================================================================\n");
26  for (int ii = 0; ii < ti.n_layers(); ++ii)
27  ti.layer(ii).print_layer();
28  printf("==========================================================================================\n");
29  }
30  }
const LayerInfo & layer(int l) const
Definition: TrackerInfo.h:146
bool verbose
int ii
Definition: cuy.py:589
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void create_layers(int n_brl, int n_ec_pos, int n_ec_neg)
Definition: TrackerInfo.cc:31
void print_layer() const
Definition: TrackerInfo.h:91
int n_layers() const
Definition: TrackerInfo.h:145
template<typename T >
T mkfit::cube ( T  x)
inline

Definition at line 17 of file Hit.h.

Referenced by getInvRadErr2().

17  {
18  return x * x * x;
19  }
float x
template<typename Matrix >
void mkfit::diagonalOnly ( Matrix &  m)
inline

Definition at line 27 of file MatrixSTypes.h.

References c, and alignCSCRings::r.

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  }
const edm::EventSetup & c
double mkfit::dtime ( )
inline
template<typename Matrix >
void mkfit::dumpMatrix ( Matrix  m)

Definition at line 37 of file MatrixSTypes.h.

References c, gather_cfg::cout, and alignCSCRings::r.

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  }
const edm::EventSetup & c
tuple cout
Definition: gather_cfg.py:144
void mkfit::execTrackerInfoCreatorPlugin ( const std::string &  base,
TrackerInfo &  ti,
IterationsInfo &  ii,
bool  verbose 
)

Definition at line 92 of file ConfigStandalone.cc.

References beamvalidation::exit(), h, fed_dqm_sourceclient-live_cfg::path, gpuVertexFinder::printf(), edm_modernize_messagelogger::stat, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by initGeom().

92  {
93  std::string soname = base + ".so";
94 
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  path += soname;
107  if (stat(path.c_str(), &st) == 0) {
108  printf("mkfit::execTrackerInfoCreatorPlugin processing '%s'\n", path.c_str());
109 
110  void *h = dlopen(path.c_str(), RTLD_LAZY);
111  if (!h) {
112  perror("dlopen failed");
113  exit(2);
114  }
115 
116  long long *p2f = (long long *)dlsym(h, "TrackerInfoCrator_ptr");
117  if (!p2f) {
118  perror("dlsym failed");
119  exit(2);
120  }
121 
122  TrackerInfoCreator_foo foo = (TrackerInfoCreator_foo)(*p2f);
123  foo(ti, ii, verbose);
124 
125  return;
126  }
127 
128  ++si;
129  }
130 
131  fprintf(stderr, "TrackerInfo plugin '%s' not found in search path.\n", soname.c_str());
132  exit(2);
133  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
bool verbose
int ii
Definition: cuy.py:589
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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, funct::exp(), validate-o2o-wbm::f, getHypot(), getPhi(), getRad2(), mps_fire::i, intersectThirdLayer(), mkfit::Config::lay01angdiff, SiStripPI::max, mkfit::Config::maxCurvR, mkfit::Hit::mcTrackID(), HLTObjectMonitor_cfi::mr, mkfit::Config::numHitsPerTask, mkfit::Hit::phi(), alignCSCRings::r, mkfit::LayerOfHits::refHit(), mkfit::Config::seed_d0cut, mkfit::Config::seed_z0cut, mkfit::Config::seed_z1cut, mkfit::Event::simHitsInfo_, 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)
137  if ((r < Config::maxCurvR) || (std::abs(getHypot(a, b) - r) > Config::seed_d0cut))
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
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
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:19
float getRad2(float x, float y)
Definition: Hit.h:29
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float getHypot(float x, float y)
Definition: Hit.h:46
#define debug
Definition: HDRShower.cc:19
constexpr float seed_z1cut
double b
Definition: hdecay.h:118
float getPhi(float x, float y)
Definition: Hit.h:33
#define dprint(x)
Definition: Debug.h:90
double a
Definition: hdecay.h:119
constexpr float seed_z0cut
constexpr float maxCurvR
std::vector< TripletIdx > TripletIdxVec
Definition: TrackExtra.h:42
void mkfit::from_json ( const nlohmann::json nlohmann_json_j,
mkfit::LayerControl nlohmann_json_t 
)
inline
void mkfit::from_json ( const nlohmann::ordered_json &  nlohmann_json_j,
mkfit::LayerControl nlohmann_json_t 
)
inline

Definition at line 32 of file IterationConfig.cc.

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

Definition at line 41 of file IterationConfig.cc.

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

Definition at line 41 of file IterationConfig.cc.

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

Definition at line 59 of file IterationConfig.cc.

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

Definition at line 59 of file IterationConfig.cc.

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

Definition at line 84 of file IterationConfig.cc.

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

Definition at line 84 of file IterationConfig.cc.

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

Definition at line 103 of file IterationConfig.cc.

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

Definition at line 103 of file IterationConfig.cc.

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

Definition at line 106 of file IterationConfig.cc.

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

Definition at line 106 of file IterationConfig.cc.

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

Definition at line 39 of file Hit.h.

References validate-o2o-wbm::f, log, and funct::tan().

39 { return -1.0f * std::log(std::tan(theta / 2.0f)); }
static std::vector< std::string > checklist log
Geom::Theta< T > theta() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float mkfit::getEta ( float  x,
float  y,
float  z 
)
inline

Definition at line 41 of file Hit.h.

References validate-o2o-wbm::f, log, mathSSE::sqrt(), funct::tan(), and theta().

41  {
42  const float theta = std::atan2(std::sqrt(x * x + y * y), z);
43  return -1.0f * std::log(std::tan(theta / 2.0f));
44  }
static std::vector< std::string > checklist log
Geom::Theta< T > theta() const
float float float z
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float x
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 73 of file Hit.h.

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

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

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

Definition at line 46 of file Hit.h.

References mathSSE::sqrt().

Referenced by findSeedsByRoadSearch(), intersectThirdLayer(), mkfit::TrackState::posR(), mkfit::TrackBase::posR(), and mkfit::Track::swimPhiToR().

46 { return std::sqrt(x * x + y * y); }
T sqrt(T t)
Definition: SSEVec.h:19
float x
float mkfit::getInvRad2 ( float  x,
float  y 
)
inline

Definition at line 31 of file Hit.h.

31 { return 1.0f / (x * x + y * y); }
float x
float mkfit::getInvRadErr2 ( float  x,
float  y,
float  exx,
float  eyy,
float  exy 
)
inline

Definition at line 52 of file Hit.h.

References cube(), validate-o2o-wbm::f, and getRad2().

52  {
53  return (x * x * exx + y * y * eyy + 2.0f * x * y * exy) / cube(getRad2(x, y));
54  }
float getRad2(float x, float y)
Definition: Hit.h:29
T cube(T x)
Definition: Hit.h:17
float x
int mkfit::getMatchBin ( const float  pt)
inline

Definition at line 237 of file TrackExtra.cc.

References validate-o2o-wbm::f.

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  }
float mkfit::getPhi ( float  x,
float  y 
)
inline
float mkfit::getPhiErr2 ( float  x,
float  y,
float  exx,
float  eyy,
float  exy 
)
inline

Definition at line 56 of file Hit.h.

References validate-o2o-wbm::f, and getRad2().

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

56  {
57  const float rad2 = getRad2(x, y);
58  return (y * y * exx + x * x * eyy - 2.0f * x * y * exy) / (rad2 * rad2);
59  }
float getRad2(float x, float y)
Definition: Hit.h:29
float x
float mkfit::getPxPxErr2 ( float  ipt,
float  phi,
float  vipt,
float  vphi 
)
inline

Definition at line 82 of file Hit.h.

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

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

82  { // ipt = 1/pT, v = variance
83  const float iipt2 = 1.0f / (ipt * ipt); //iipt = 1/(1/pT) = pT
84  const float cosP = std::cos(phi);
85  const float sinP = std::sin(phi);
86  return iipt2 * (iipt2 * cosP * cosP * vipt + sinP * sinP * vphi);
87  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float mkfit::getPyPyErr2 ( float  ipt,
float  phi,
float  vipt,
float  vphi 
)
inline

Definition at line 89 of file Hit.h.

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

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

89  { // ipt = 1/pT, v = variance
90  const float iipt2 = 1.0f / (ipt * ipt); //iipt = 1/(1/pT) = pT
91  const float cosP = std::cos(phi);
92  const float sinP = std::sin(phi);
93  return iipt2 * (iipt2 * sinP * sinP * vipt + cosP * cosP * vphi);
94  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float mkfit::getPzPzErr2 ( float  ipt,
float  theta,
float  vipt,
float  vtheta 
)
inline

Definition at line 96 of file Hit.h.

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

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

Definition at line 29 of file Hit.h.

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

29 { return x * x + y * y; }
float x
float mkfit::getRadErr2 ( float  x,
float  y,
float  exx,
float  eyy,
float  exy 
)
inline

Definition at line 48 of file Hit.h.

References validate-o2o-wbm::f, and getRad2().

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

48  {
49  return (x * x * exx + y * y * eyy + 2.0f * x * y * exy) / getRad2(x, y);
50  }
float getRad2(float x, float y)
Definition: Hit.h:29
float x
float mkfit::getScoreCalc ( const int  nfoundhits,
const int  ntailholes,
const int  noverlaphits,
const int  nmisshits,
const float  chi2,
const float  pt,
const bool  inFindCandidates = false 
)
inline

Definition at line 606 of file Track.h.

References HLT_FULL_cff::chi2, validate-o2o-wbm::f, SiStripPI::min, mkfit::Config::missingHitPenalty_, mkfit::Config::overlapHitBonus_, mkfit::Config::tailMissingHitPenalty_, mkfit::Config::validHitBonus_, and mkfit::Config::validHitSlope_.

Referenced by getScoreCand(), and getScoreStruct().

612  {
614  // if(chi2<0) chi2=0.f;
615 
616  float maxBonus = 8.0;
617  float bonus = Config::validHitSlope_ * nfoundhits + Config::validHitBonus_;
618  float penalty = Config::missingHitPenalty_;
619  float tailPenalty = Config::tailMissingHitPenalty_;
620  float overlapBonus = Config::overlapHitBonus_;
621  if (pt < 0.9) {
622  penalty *= inFindCandidates ? 1.7f : 1.5f;
623  bonus = std::min(bonus * (inFindCandidates ? 0.9f : 1.0f), maxBonus);
624  }
625  float score_ =
626  bonus * nfoundhits + overlapBonus * noverlaphits - penalty * nmisshits - tailPenalty * ntailholes - chi2;
627  return score_;
628  }
constexpr float validHitSlope_
Definition: Config.h:109
constexpr float tailMissingHitPenalty_
Definition: Config.h:112
constexpr float overlapHitBonus_
Definition: Config.h:110
constexpr float validHitBonus_
Definition: Config.h:108
constexpr float missingHitPenalty_
Definition: Config.h:111
float mkfit::getScoreCand ( const TrackCand &  cand1,
bool  penalizeTailMissHits = false,
bool  inFindCandidates = false 
)
inline

Definition at line 489 of file HitStructures.h.

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

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

489  {
490  int nfoundhits = cand1.nFoundHits();
491  int noverlaphits = cand1.nOverlapHits();
492  int nmisshits = cand1.nInsideMinusOneHits();
493  int ntailmisshits = penalizeTailMissHits ? cand1.nTailMinusOneHits() : 0;
494  float pt = cand1.pT();
495  float chi2 = cand1.chi2();
496  // Do not allow for chi2<0 in score calculation
497  if (chi2 < 0)
498  chi2 = 0.f;
499  return getScoreCalc(nfoundhits, ntailmisshits, noverlaphits, nmisshits, chi2, pt, inFindCandidates);
500  }
float getScoreCalc(const int nfoundhits, const int ntailholes, const int noverlaphits, const int nmisshits, const float chi2, const float pt, const bool inFindCandidates=false)
Definition: Track.h:606
float mkfit::getScoreCand ( const Track &  cand1,
bool  penalizeTailMissHits = false,
bool  inFindCandidates = false 
)
inline

Definition at line 630 of file Track.h.

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

630  {
631  int nfoundhits = cand1.nFoundHits();
632  int noverlaphits = cand1.nOverlapHits();
633  int nmisshits = cand1.nInsideMinusOneHits();
634  float ntailmisshits = penalizeTailMissHits ? cand1.nTailMinusOneHits() : 0;
635  float pt = cand1.pT();
636  float chi2 = cand1.chi2();
637  // Do not allow for chi2<0 in score calculation
638  if (chi2 < 0)
639  chi2 = 0.f;
640  return getScoreCalc(nfoundhits, ntailmisshits, noverlaphits, nmisshits, chi2, pt, inFindCandidates);
641  }
float getScoreCalc(const int nfoundhits, const int ntailholes, const int noverlaphits, const int nmisshits, const float chi2, const float pt, const bool inFindCandidates=false)
Definition: Track.h:606
float mkfit::getScoreStruct ( const IdxChi2List &  cand1)
inline

Definition at line 643 of file Track.h.

References mkfit::IdxChi2List::chi2, HLT_FULL_cff::chi2, getScoreCalc(), mkfit::IdxChi2List::nhits, mkfit::IdxChi2List::nholes, mkfit::IdxChi2List::noverlaps, mkfit::IdxChi2List::ntailholes, DiDispStaMuonMonitor_cfi::pt, and mkfit::IdxChi2List::pt.

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

643  {
644  int nfoundhits = cand1.nhits;
645  int ntailholes = cand1.ntailholes;
646  int noverlaphits = cand1.noverlaps;
647  int nmisshits = cand1.nholes;
648  float pt = cand1.pt;
649  float chi2 = cand1.chi2;
650  // Do not allow for chi2<0 in score calculation
651  if (chi2 < 0)
652  chi2 = 0.f;
653  return getScoreCalc(nfoundhits, ntailholes, noverlaphits, nmisshits, chi2, pt, true /*inFindCandidates*/);
654  }
float getScoreCalc(const int nfoundhits, const int ntailholes, const int noverlaphits, const int nmisshits, const float chi2, const float pt, const bool inFindCandidates=false)
Definition: Track.h:606
float mkfit::getScoreWorstPossible ( )
inline

Definition at line 602 of file Track.h.

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

602  {
603  return -1e16; // somewhat arbitrary value, used for handling of best short track during finding (will try to take it out)
604  }
float mkfit::getTheta ( float  r,
float  z 
)
inline
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 61 of file Hit.h.

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

62  {
63  const float rad2 = getRad2(x, y);
64  const float rad = std::sqrt(rad2);
65  const float hypot2 = rad2 + z * z;
66  const float dthetadx = x * z / (rad * hypot2);
67  const float dthetady = y * z / (rad * hypot2);
68  const float dthetadz = -rad / hypot2;
69  return dthetadx * dthetadx * exx + dthetady * dthetady * eyy + dthetadz * dthetadz * ezz +
70  2.0f * dthetadx * dthetady * exy + 2.0f * dthetadx * dthetadz * exz + 2.0f * dthetady * dthetadz * eyz;
71  }
float float float z
T sqrt(T t)
Definition: SSEVec.h:19
float getRad2(float x, float y)
Definition: Hit.h:29
float x
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 470 of file PropagationMPlex.cc.

References validate-o2o-wbm::f, and Matriplex::Matriplex< T, D1, D2, N >::setVal().

Referenced by propagateHelixToRMPlex().

477  {
478  errorProp.setVal(0.f);
479  outFailFlag.setVal(0.f);
480 
481  helixAtRFromIterativeCCS_impl(inPar, inChg, msRad, outPar, errorProp, outFailFlag, 0, NN, N_proc, pflags);
482  }
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
void setVal(T v)
Definition: Matriplex.h:31
void mkfit::helixAtRFromIterativeCCSFullJac ( const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msRad,
MPlexLV outPar,
MPlexLL errorProp,
const int  N_proc 
)

Definition at line 288 of file PropagationMPlex.cc.

References funct::abs(), Matriplex::Matriplex< T, D1, D2, N >::At(), mkfit::Config::Bfield, Matriplex::Matriplex< T, D1, D2, N >::constAt(), funct::cos(), gather_cfg::cout, dprint_np, validate-o2o-wbm::f, hipo(), mps_fire::i, isotrackApplyRegressor::k, dqmiodumpmetadata::n, mkfit::Config::Niter, NN, gpuVertexFinder::printf(), alignCSCRings::r, Matriplex::Matriplex< T, D1, D2, N >::setVal(), funct::sin(), sincos4(), mkfit::Const::sol, mathSSE::sqrt(), funct::tan(), theta(), and mkfit::Config::useTrigApprox.

293  {
294  errorProp.setVal(0.f);
295  MPlexLL errorPropTmp(0.f); //initialize to zero
296  MPlexLL errorPropSwap(0.f); //initialize to zero
297 
298 #pragma omp simd
299  for (int n = 0; n < NN; ++n) {
300  //initialize erroProp to identity matrix
301  errorProp(n, 0, 0) = 1.f;
302  errorProp(n, 1, 1) = 1.f;
303  errorProp(n, 2, 2) = 1.f;
304  errorProp(n, 3, 3) = 1.f;
305  errorProp(n, 4, 4) = 1.f;
306  errorProp(n, 5, 5) = 1.f;
307 
308  const float k = inChg.constAt(n, 0, 0) * 100.f / (-Const::sol * Config::Bfield);
309  const float r = msRad.constAt(n, 0, 0);
310  float r0 = hipo(inPar.constAt(n, 0, 0), inPar.constAt(n, 1, 0));
311 
312  if (std::abs(r - r0) < 0.0001f) {
313  dprint_np(n, "distance less than 1mum, skip");
314  continue;
315  }
316 
317  const float ipt = inPar.constAt(n, 3, 0);
318  const float phiin = inPar.constAt(n, 4, 0);
319  const float theta = inPar.constAt(n, 5, 0);
320 
321  //set those that are 1. before iterations
322  errorPropTmp(n, 2, 2) = 1.f;
323  errorPropTmp(n, 3, 3) = 1.f;
324  errorPropTmp(n, 4, 4) = 1.f;
325  errorPropTmp(n, 5, 5) = 1.f;
326 
327  float cosah = 0., sinah = 0.;
328  //no trig approx here, phi and theta can be large
329  float cosP = std::cos(phiin), sinP = std::sin(phiin);
330  const float cosT = std::cos(theta), sinT = std::sin(theta);
331  float pxin = cosP / ipt;
332  float pyin = sinP / ipt;
333 
334  for (int i = 0; i < Config::Niter; ++i) {
335  dprint_np(n,
336  std::endl
337  << "attempt propagation from r=" << r0 << " to r=" << r << std::endl
338  << "x=" << outPar.At(n, 0, 0) << " y=" << outPar.At(n, 1, 0) << " z=" << outPar.At(n, 2, 0)
339  << " px=" << std::cos(phiin) / ipt << " py=" << std::sin(phiin) / ipt
340  << " pz=" << 1.f / (ipt * tan(theta)) << " q=" << inChg.constAt(n, 0, 0) << std::endl);
341 
342  r0 = hipo(outPar.constAt(n, 0, 0), outPar.constAt(n, 1, 0));
343  const float ialpha = (r - r0) * ipt / k;
344  //alpha+=ialpha;
345 
346  if (Config::useTrigApprox) {
347  sincos4(ialpha * 0.5f, sinah, cosah);
348  } else {
349  cosah = std::cos(ialpha * 0.5f);
350  sinah = std::sin(ialpha * 0.5f);
351  }
352  const float cosa = 1.f - 2.f * sinah * sinah;
353  const float sina = 2.f * sinah * cosah;
354 
355  //derivatives of alpha
356  const float dadx = -outPar.At(n, 0, 0) * ipt / (k * r0);
357  const float dady = -outPar.At(n, 1, 0) * ipt / (k * r0);
358  const float dadipt = (r - r0) / k;
359 
360  outPar.At(n, 0, 0) = outPar.constAt(n, 0, 0) + 2.f * k * sinah * (pxin * cosah - pyin * sinah);
361  outPar.At(n, 1, 0) = outPar.constAt(n, 1, 0) + 2.f * k * sinah * (pyin * cosah + pxin * sinah);
362  const float pxinold = pxin; //copy before overwriting
363  pxin = pxin * cosa - pyin * sina;
364  pyin = pyin * cosa + pxinold * sina;
365 
366  //need phi at origin, so this goes before redefining phi
367  //no trig approx here, phi can be large
368  cosP = std::cos(outPar.At(n, 4, 0));
369  sinP = std::sin(outPar.At(n, 4, 0));
370 
371  outPar.At(n, 2, 0) = outPar.constAt(n, 2, 0) + k * ialpha * cosT / (ipt * sinT);
372  outPar.At(n, 3, 0) = ipt;
373  outPar.At(n, 4, 0) = outPar.constAt(n, 4, 0) + ialpha;
374  outPar.At(n, 5, 0) = theta;
375 
376  errorPropTmp(n, 0, 0) = 1.f + k * (cosP * dadx * cosa - sinP * dadx * sina) / ipt;
377  errorPropTmp(n, 0, 1) = k * (cosP * dady * cosa - sinP * dady * sina) / ipt;
378  errorPropTmp(n, 0, 3) =
379  k * (cosP * (ipt * dadipt * cosa - sina) + sinP * ((1.f - cosa) - ipt * dadipt * sina)) / (ipt * ipt);
380  errorPropTmp(n, 0, 4) = -k * (sinP * sina + cosP * (1.f - cosa)) / ipt;
381 
382  errorPropTmp(n, 1, 0) = k * (sinP * dadx * cosa + cosP * dadx * sina) / ipt;
383  errorPropTmp(n, 1, 1) = 1.f + k * (sinP * dady * cosa + cosP * dady * sina) / ipt;
384  errorPropTmp(n, 1, 3) =
385  k * (sinP * (ipt * dadipt * cosa - sina) + cosP * (ipt * dadipt * sina - (1.f - cosa))) / (ipt * ipt);
386  errorPropTmp(n, 1, 4) = k * (cosP * sina - sinP * (1.f - cosa)) / ipt;
387 
388  errorPropTmp(n, 2, 0) = k * cosT * dadx / (ipt * sinT);
389  errorPropTmp(n, 2, 1) = k * cosT * dady / (ipt * sinT);
390  errorPropTmp(n, 2, 3) = k * cosT * (ipt * dadipt - ialpha) / (ipt * ipt * sinT);
391  errorPropTmp(n, 2, 5) = -k * ialpha / (ipt * sinT * sinT);
392 
393  errorPropTmp(n, 4, 0) = dadx;
394  errorPropTmp(n, 4, 1) = dady;
395  errorPropTmp(n, 4, 3) = dadipt;
396 
397  MultHelixPropTemp(errorProp, errorPropTmp, errorPropSwap, n);
398  errorProp = errorPropSwap;
399  }
400 
401  dprint_np(
402  n,
403  "propagation end, dump parameters"
404  << std::endl
405  << "pos = " << outPar.At(n, 0, 0) << " " << outPar.At(n, 1, 0) << " " << outPar.At(n, 2, 0) << std::endl
406  << "mom = " << std::cos(outPar.At(n, 4, 0)) / outPar.At(n, 3, 0) << " "
407  << std::sin(outPar.At(n, 4, 0)) / outPar.At(n, 3, 0) << " "
408  << 1. / (outPar.At(n, 3, 0) * tan(outPar.At(n, 5, 0)))
409  << " r=" << std::sqrt(outPar.At(n, 0, 0) * outPar.At(n, 0, 0) + outPar.At(n, 1, 0) * outPar.At(n, 1, 0))
410  << " pT=" << 1. / std::abs(outPar.At(n, 3, 0)) << std::endl);
411 
412 #ifdef DEBUG
413  if (n < N_proc) {
414  dmutex_guard;
415  std::cout << n << " jacobian" << std::endl;
416  printf("%5f %5f %5f %5f %5f %5f\n",
417  errorProp(n, 0, 0),
418  errorProp(n, 0, 1),
419  errorProp(n, 0, 2),
420  errorProp(n, 0, 3),
421  errorProp(n, 0, 4),
422  errorProp(n, 0, 5));
423  printf("%5f %5f %5f %5f %5f %5f\n",
424  errorProp(n, 1, 0),
425  errorProp(n, 1, 1),
426  errorProp(n, 1, 2),
427  errorProp(n, 1, 3),
428  errorProp(n, 1, 4),
429  errorProp(n, 1, 5));
430  printf("%5f %5f %5f %5f %5f %5f\n",
431  errorProp(n, 2, 0),
432  errorProp(n, 2, 1),
433  errorProp(n, 2, 2),
434  errorProp(n, 2, 3),
435  errorProp(n, 2, 4),
436  errorProp(n, 2, 5));
437  printf("%5f %5f %5f %5f %5f %5f\n",
438  errorProp(n, 3, 0),
439  errorProp(n, 3, 1),
440  errorProp(n, 3, 2),
441  errorProp(n, 3, 3),
442  errorProp(n, 3, 4),
443  errorProp(n, 3, 5));
444  printf("%5f %5f %5f %5f %5f %5f\n",
445  errorProp(n, 4, 0),
446  errorProp(n, 4, 1),
447  errorProp(n, 4, 2),
448  errorProp(n, 4, 3),
449  errorProp(n, 4, 4),
450  errorProp(n, 4, 5));
451  printf("%5f %5f %5f %5f %5f %5f\n",
452  errorProp(n, 5, 0),
453  errorProp(n, 5, 1),
454  errorProp(n, 5, 2),
455  errorProp(n, 5, 3),
456  errorProp(n, 5, 4),
457  errorProp(n, 5, 5));
458  }
459 #endif
460  }
461  }
#define dprint_np(n, x)
Definition: Debug.h:91
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
T sqrt(T t)
Definition: SSEVec.h:19
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr float Bfield
Definition: Config.h:88
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr bool useTrigApprox
Definition: Config.h:85
constexpr float sol
Definition: Config.h:48
float hipo(float x, float y)
Definition: Matrix.h:9
tuple cout
Definition: gather_cfg.py:144
void setVal(T v)
Definition: Matriplex.h:31
void sincos4(const float x, float &sin, float &cos)
Definition: Matrix.h:13
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
constexpr int Niter
Definition: Config.h:84
void mkfit::helixAtZ ( const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msZ,
MPlexLV outPar,
MPlexLL errorProp,
const int  N_proc,
const PropagationFlags  pflags 
)

Definition at line 694 of file PropagationMPlex.cc.

References funct::abs(), alpha, Matriplex::Matriplex< T, D1, D2, N >::At(), mkfit::Config::Bfield, mkfit::Config::bFieldFromZR(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), funct::cos(), gather_cfg::cout, dprint_np, validate-o2o-wbm::f, hipo(), isotrackApplyRegressor::k, dqmiodumpmetadata::n, NN, gpuVertexFinder::printf(), DiDispStaMuonMonitor_cfi::pt, Matriplex::Matriplex< T, D1, D2, N >::setVal(), funct::sin(), sincos4(), mkfit::Const::sol, mathSSE::sqrt(), funct::tan(), theta(), mkfit::PropagationFlags::use_param_b_field, and mkfit::Config::useTrigApprox.

Referenced by propagateHelixToZMPlex().

700  {
701  errorProp.setVal(0.f);
702 
703 #pragma omp simd
704  for (int n = 0; n < NN; ++n) {
705  //initialize erroProp to identity matrix, except element 2,2 which is zero
706  errorProp(n, 0, 0) = 1.f;
707  errorProp(n, 1, 1) = 1.f;
708  errorProp(n, 3, 3) = 1.f;
709  errorProp(n, 4, 4) = 1.f;
710  errorProp(n, 5, 5) = 1.f;
711 
712  const float zout = msZ.constAt(n, 0, 0);
713 
714  const float zin = inPar.constAt(n, 2, 0);
715  const float ipt = inPar.constAt(n, 3, 0);
716  const float phiin = inPar.constAt(n, 4, 0);
717  const float theta = inPar.constAt(n, 5, 0);
718 
719  const float k =
720  inChg.constAt(n, 0, 0) * 100.f /
721  (-Const::sol * (pflags.use_param_b_field
722  ? Config::bFieldFromZR(zin, hipo(inPar.constAt(n, 0, 0), inPar.constAt(n, 1, 0)))
723  : Config::Bfield));
724  const float kinv = 1.f / k;
725 
726  dprint_np(n,
727  std::endl
728  << "input parameters"
729  << " inPar.constAt(n, 0, 0)=" << std::setprecision(9) << inPar.constAt(n, 0, 0)
730  << " inPar.constAt(n, 1, 0)=" << std::setprecision(9) << inPar.constAt(n, 1, 0)
731  << " inPar.constAt(n, 2, 0)=" << std::setprecision(9) << inPar.constAt(n, 2, 0)
732  << " inPar.constAt(n, 3, 0)=" << std::setprecision(9) << inPar.constAt(n, 3, 0)
733  << " inPar.constAt(n, 4, 0)=" << std::setprecision(9) << inPar.constAt(n, 4, 0)
734  << " inPar.constAt(n, 5, 0)=" << std::setprecision(9) << inPar.constAt(n, 5, 0));
735 
736  const float pt = 1.f / ipt;
737 
738  float cosahTmp = 0., sinahTmp = 0.;
739  //no trig approx here, phi can be large
740  const float cosP = std::cos(phiin), sinP = std::sin(phiin);
741  const float cosT = std::cos(theta), sinT = std::sin(theta);
742  const float tanT = sinT / cosT;
743  const float icos2T = 1.f / (cosT * cosT);
744  const float pxin = cosP * pt;
745  const float pyin = sinP * pt;
746 
747  //fixme, make this printout useful for propagation to z
748  dprint_np(n,
749  std::endl
750  << "k=" << std::setprecision(9) << k << " pxin=" << std::setprecision(9) << pxin
751  << " pyin=" << std::setprecision(9) << pyin << " cosP=" << std::setprecision(9) << cosP
752  << " sinP=" << std::setprecision(9) << sinP << " pt=" << std::setprecision(9) << pt);
753 
754  const float deltaZ = zout - zin;
755  const float alpha = deltaZ * tanT * ipt * kinv;
756 
757  if (Config::useTrigApprox) {
758  sincos4(alpha * 0.5f, sinahTmp, cosahTmp);
759  } else {
760  cosahTmp = std::cos(alpha * 0.5f);
761  sinahTmp = std::sin(alpha * 0.5f);
762  }
763  const float cosah = cosahTmp;
764  const float sinah = sinahTmp;
765  const float cosa = 1.f - 2.f * sinah * sinah;
766  const float sina = 2.f * sinah * cosah;
767 
768  //update parameters
769  outPar.At(n, 0, 0) = outPar.At(n, 0, 0) + 2.f * k * sinah * (pxin * cosah - pyin * sinah);
770  outPar.At(n, 1, 0) = outPar.At(n, 1, 0) + 2.f * k * sinah * (pyin * cosah + pxin * sinah);
771  outPar.At(n, 2, 0) = zout;
772  outPar.At(n, 4, 0) = phiin + alpha;
773 
774  dprint_np(n,
775  std::endl
776  << "outPar.At(n, 0, 0)=" << outPar.At(n, 0, 0) << " outPar.At(n, 1, 0)=" << outPar.At(n, 1, 0)
777  << " pxin=" << pxin << " pyin=" << pyin);
778 
779  const float pxcaMpysa = pxin * cosa - pyin * sina;
780  errorProp(n, 0, 2) = -tanT * ipt * pxcaMpysa;
781  errorProp(n, 0, 3) = k * pt * pt * (cosP * (alpha * cosa - sina) + sinP * 2.f * sinah * (sinah - alpha * cosah));
782  errorProp(n, 0, 4) = -2 * k * pt * sinah * (sinP * cosah + cosP * sinah);
783  errorProp(n, 0, 5) = deltaZ * ipt * pxcaMpysa * icos2T;
784 
785  const float pycaPpxsa = pyin * cosa + pxin * sina;
786  errorProp(n, 1, 2) = -tanT * ipt * pycaPpxsa;
787  errorProp(n, 1, 3) = k * pt * pt * (sinP * (alpha * cosa - sina) - cosP * 2.f * sinah * (sinah - alpha * cosah));
788  errorProp(n, 1, 4) = 2 * k * pt * sinah * (cosP * cosah - sinP * sinah);
789  errorProp(n, 1, 5) = deltaZ * ipt * pycaPpxsa * icos2T;
790 
791  errorProp(n, 4, 2) = -ipt * tanT * kinv;
792  errorProp(n, 4, 3) = tanT * deltaZ * kinv;
793  errorProp(n, 4, 5) = ipt * deltaZ * kinv * icos2T;
794 
795  dprint_np(
796  n,
797  "propagation end, dump parameters"
798  << std::endl
799  << "pos = " << outPar.At(n, 0, 0) << " " << outPar.At(n, 1, 0) << " " << outPar.At(n, 2, 0) << std::endl
800  << "mom = " << std::cos(outPar.At(n, 4, 0)) / outPar.At(n, 3, 0) << " "
801  << std::sin(outPar.At(n, 4, 0)) / outPar.At(n, 3, 0) << " "
802  << 1. / (outPar.At(n, 3, 0) * tan(outPar.At(n, 5, 0)))
803  << " r=" << std::sqrt(outPar.At(n, 0, 0) * outPar.At(n, 0, 0) + outPar.At(n, 1, 0) * outPar.At(n, 1, 0))
804  << " pT=" << 1. / std::abs(outPar.At(n, 3, 0)) << std::endl);
805 
806 #ifdef DEBUG
807  if (n < N_proc) {
808  dmutex_guard;
809  std::cout << n << ": jacobian" << std::endl;
810  printf("%5f %5f %5f %5f %5f %5f\n",
811  errorProp(n, 0, 0),
812  errorProp(n, 0, 1),
813  errorProp(n, 0, 2),
814  errorProp(n, 0, 3),
815  errorProp(n, 0, 4),
816  errorProp(n, 0, 5));
817  printf("%5f %5f %5f %5f %5f %5f\n",
818  errorProp(n, 1, 0),
819  errorProp(n, 1, 1),
820  errorProp(n, 1, 2),
821  errorProp(n, 1, 3),
822  errorProp(n, 1, 4),
823  errorProp(n, 1, 5));
824  printf("%5f %5f %5f %5f %5f %5f\n",
825  errorProp(n, 2, 0),
826  errorProp(n, 2, 1),
827  errorProp(n, 2, 2),
828  errorProp(n, 2, 3),
829  errorProp(n, 2, 4),
830  errorProp(n, 2, 5));
831  printf("%5f %5f %5f %5f %5f %5f\n",
832  errorProp(n, 3, 0),
833  errorProp(n, 3, 1),
834  errorProp(n, 3, 2),
835  errorProp(n, 3, 3),
836  errorProp(n, 3, 4),
837  errorProp(n, 3, 5));
838  printf("%5f %5f %5f %5f %5f %5f\n",
839  errorProp(n, 4, 0),
840  errorProp(n, 4, 1),
841  errorProp(n, 4, 2),
842  errorProp(n, 4, 3),
843  errorProp(n, 4, 4),
844  errorProp(n, 4, 5));
845  printf("%5f %5f %5f %5f %5f %5f\n",
846  errorProp(n, 5, 0),
847  errorProp(n, 5, 1),
848  errorProp(n, 5, 2),
849  errorProp(n, 5, 3),
850  errorProp(n, 5, 4),
851  errorProp(n, 5, 5));
852  }
853 #endif
854  }
855  }
float alpha
Definition: AMPTWrapper.h:105
#define dprint_np(n, x)
Definition: Debug.h:91
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
T sqrt(T t)
Definition: SSEVec.h:19
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr float Bfield
Definition: Config.h:88
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr bool useTrigApprox
Definition: Config.h:85
constexpr float sol
Definition: Config.h:48
float hipo(float x, float y)
Definition: Matrix.h:9
float bFieldFromZR(const float z, const float r)
Definition: Config.h:159
tuple cout
Definition: gather_cfg.py:144
void setVal(T v)
Definition: Matriplex.h:31
void sincos4(const float x, float &sin, float &cos)
Definition: Matrix.h:13
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
tuple Config
Definition: helper.py:10
float mkfit::hipo ( float  x,
float  y 
)
inline

Definition at line 9 of file Matrix.h.

References mathSSE::sqrt().

Referenced by conformalFitMPlex(), helixAtRFromIterativeCCSFullJac(), helixAtZ(), propagateHelixToRMPlex(), and propagateLineToRMPlex().

9 { return std::sqrt(x * x + y * y); }
T sqrt(T t)
Definition: SSEVec.h:19
float x
float mkfit::hipo_sqr ( float  x,
float  y 
)
inline

Definition at line 11 of file Matrix.h.

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

11 { return x * x + y * y; }
float x
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, validate-o2o-wbm::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:19
float getHypot(float x, float y)
Definition: Hit.h:46
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
constexpr float maxCurvR
static constexpr float b2
bool mkfit::isStripQCompatible ( int  itrack,
bool  isBarrel,
const MPlexLS &  pErr,
const MPlexLV &  pPar,
const MPlexHS &  msErr,
const MPlexHV &  msPar 
)

Definition at line 854 of file MkFinder.cc.

References funct::abs(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), Matriplex::MatriplexSym< T, D, N >::constAt(), dprint, validate-o2o-wbm::f, SiStripPI::max, and mathSSE::sqrt().

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

855  {
856  //check module compatibility via long strip side = L/sqrt(12)
857  if (isBarrel) { //check z direction only
858  const float res = std::abs(msPar.constAt(itrack, 2, 0) - pPar.constAt(itrack, 2, 0));
859  const float hitHL = sqrt(msErr.constAt(itrack, 2, 2) * 3.f); //half-length
860  const float qErr = sqrt(pErr.constAt(itrack, 2, 2));
861  dprint("qCompat " << hitHL << " + " << 3.f * qErr << " vs " << res);
862  return hitHL + std::max(3.f * qErr, 0.5f) > res;
863  } else { //project on xy, assuming the strip Length >> Width
864  const float res[2]{msPar.constAt(itrack, 0, 0) - pPar.constAt(itrack, 0, 0),
865  msPar.constAt(itrack, 1, 0) - pPar.constAt(itrack, 1, 0)};
866  const float hitT2 = msErr.constAt(itrack, 0, 0) + msErr.constAt(itrack, 1, 1);
867  const float hitT2inv = 1.f / hitT2;
868  const float proj[3] = {msErr.constAt(itrack, 0, 0) * hitT2inv,
869  msErr.constAt(itrack, 0, 1) * hitT2inv,
870  msErr.constAt(itrack, 1, 1) * hitT2inv};
871  const float qErr =
872  sqrt(std::abs(pErr.constAt(itrack, 0, 0) * proj[0] + 2.f * pErr.constAt(itrack, 0, 1) * proj[1] +
873  pErr.constAt(itrack, 1, 1) * proj[2])); //take abs to avoid non-pos-def cases
874  const float resProj =
875  sqrt(res[0] * proj[0] * res[0] + 2.f * res[1] * proj[1] * res[0] + res[1] * proj[2] * res[1]);
876  dprint("qCompat " << sqrt(hitT2 * 3.f) << " + " << 3.f * qErr << " vs " << resProj);
877  return sqrt(hitT2 * 3.f) + std::max(3.f * qErr, 0.5f) > resProj;
878  }
879  }
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define dprint(x)
Definition: Debug.h:90
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 466 of file KalmanUtilsMPlex.cc.

References kalmanOperation(), and KFO_Calculate_Chi2.

472  {
473  kalmanOperation(KFO_Calculate_Chi2, psErr, psPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
474  }
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 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 717 of file KalmanUtilsMPlex.cc.

References kalmanOperationEndcap(), and KFO_Calculate_Chi2.

723  {
724  kalmanOperationEndcap(KFO_Calculate_Chi2, psErr, psPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
725  }
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 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 505 of file KalmanUtilsMPlex.cc.

References Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::MatriplexSym< T, D, N >::At(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), Matriplex::MatriplexSym< T, D, N >::constAt(), mps_fire::i, Matriplex::invertCramerSym(), dqmiolumiharvest::j, KFO_Calculate_Chi2, KFO_Update_Params, dqmiodumpmetadata::n, NN, gpuVertexFinder::printf(), alignCSCRings::r, squashPhiMPlex(), and Matriplex::MatriplexSym< T, D, N >::subtract().

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

513  {
514 #ifdef DEBUG
515  {
516  dmutex_guard;
517  printf("psPar:\n");
518  for (int i = 0; i < 6; ++i) {
519  printf("%8f ", psPar.constAt(0, 0, i));
520  printf("\n");
521  }
522  printf("\n");
523  printf("psErr:\n");
524  for (int i = 0; i < 6; ++i) {
525  for (int j = 0; j < 6; ++j)
526  printf("%8f ", psErr.constAt(0, i, j));
527  printf("\n");
528  }
529  printf("\n");
530  printf("msPar:\n");
531  for (int i = 0; i < 3; ++i) {
532  printf("%8f ", msPar.constAt(0, 0, i));
533  printf("\n");
534  }
535  printf("\n");
536  printf("msErr:\n");
537  for (int i = 0; i < 3; ++i) {
538  for (int j = 0; j < 3; ++j)
539  printf("%8f ", msErr.constAt(0, i, j));
540  printf("\n");
541  }
542  printf("\n");
543  }
544 #endif
545 
546  // Rotate global point on tangent plane to cylinder
547  // Tangent point is half way between hit and propagate position
548 
549  // Rotation matrix
550  // rotT00 0 rotT01
551  // rotT01 0 -rotT00
552  // 0 1 0
553  // Minimize temporaries: only two float are needed!
554 
555  MPlexQF rotT00;
556  MPlexQF rotT01;
557  for (int n = 0; n < NN; ++n) {
558  const float r = std::hypot(msPar.constAt(n, 0, 0), msPar.constAt(n, 1, 0));
559  rotT00.At(n, 0, 0) = -(msPar.constAt(n, 1, 0) + psPar.constAt(n, 1, 0)) / (2 * r);
560  rotT01.At(n, 0, 0) = (msPar.constAt(n, 0, 0) + psPar.constAt(n, 0, 0)) / (2 * r);
561  }
562 
563  MPlexHV res_glo; //position residual in global coordinates
564  SubtractFirst3(msPar, psPar, res_glo);
565 
566  MPlexHS resErr_glo; //covariance sum in global position coordinates
567  AddIntoUpperLeft3x3(psErr, msErr, resErr_glo);
568 
569  MPlex2V res_loc; //position residual in local coordinates
570  RotateResidualsOnTangentPlane(rotT00, rotT01, res_glo, res_loc);
571  MPlex2S resErr_loc; //covariance sum in local position coordinates
572  MPlexHH tempHH;
573  ProjectResErr(rotT00, rotT01, resErr_glo, tempHH);
574  ProjectResErrTransp(rotT00, rotT01, tempHH, resErr_loc);
575 
576 #ifdef DEBUG
577  {
578  dmutex_guard;
579  printf("resErr_loc:\n");
580  for (int i = 0; i < 2; ++i) {
581  for (int j = 0; j < 2; ++j)
582  printf("%8f ", resErr_loc.At(0, i, j));
583  printf("\n");
584  }
585  printf("\n");
586  }
587 #endif
588 
589  //invert the 2x2 matrix
590  Matriplex::invertCramerSym(resErr_loc);
591 
592  if (kfOp & KFO_Calculate_Chi2) {
593  Chi2Similarity(res_loc, resErr_loc, outChi2);
594 
595 #ifdef DEBUG
596  {
597  dmutex_guard;
598  printf("resErr_loc (Inv):\n");
599  for (int i = 0; i < 2; ++i) {
600  for (int j = 0; j < 2; ++j)
601  printf("%8f ", resErr_loc.At(0, i, j));
602  printf("\n");
603  }
604  printf("\n");
605  printf("chi2: %8f\n", outChi2.At(0, 0, 0));
606  }
607 #endif
608  }
609 
610  if (kfOp & KFO_Update_Params) {
611  MPlexLH K; // kalman gain, fixme should be L2
612  KalmanHTG(rotT00, rotT01, resErr_loc, tempHH); // intermediate term to get kalman gain (H^T*G)
613  KalmanGain(psErr, tempHH, K);
614 
615  MultResidualsAdd(K, psPar, res_loc, outPar);
616  MPlexLL tempLL;
617 
618  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
619 
620  KHMult(K, rotT00, rotT01, tempLL);
621  KHC(tempLL, psErr, outErr);
622  outErr.subtract(psErr, outErr);
623 
624 #ifdef DEBUG
625  {
626  dmutex_guard;
627  printf("res_glo:\n");
628  for (int i = 0; i < 3; ++i) {
629  printf("%8f ", res_glo.At(0, i, 0));
630  }
631  printf("\n");
632  printf("res_loc:\n");
633  for (int i = 0; i < 2; ++i) {
634  printf("%8f ", res_loc.At(0, i, 0));
635  }
636  printf("\n");
637  printf("resErr_loc (Inv):\n");
638  for (int i = 0; i < 2; ++i) {
639  for (int j = 0; j < 2; ++j)
640  printf("%8f ", resErr_loc.At(0, i, j));
641  printf("\n");
642  }
643  printf("\n");
644  printf("K:\n");
645  for (int i = 0; i < 6; ++i) {
646  for (int j = 0; j < 3; ++j)
647  printf("%8f ", K.At(0, i, j));
648  printf("\n");
649  }
650  printf("\n");
651  printf("outPar:\n");
652  for (int i = 0; i < 6; ++i) {
653  printf("%8f ", outPar.At(0, i, 0));
654  }
655  printf("\n");
656  printf("outErr:\n");
657  for (int i = 0; i < 6; ++i) {
658  for (int j = 0; j < 6; ++j)
659  printf("%8f ", outErr.At(0, i, j));
660  printf("\n");
661  }
662  printf("\n");
663  }
664 #endif
665  }
666  }
MatriplexSym & subtract(const MatriplexSym &a, const MatriplexSym &b)
Definition: MatriplexSym.h:212
T & At(idx_t n, idx_t i, idx_t j)
Definition: MatriplexSym.h:71
void squashPhiMPlex(MPlexLV &par, const int N_proc)
void invertCramerSym(MPlexSym< T, D, N > &A, double *determ=nullptr)
Definition: MatriplexSym.h:410
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: MatriplexSym.h:69
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
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 756 of file KalmanUtilsMPlex.cc.

References Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::MatriplexSym< T, D, N >::At(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), Matriplex::MatriplexSym< T, D, N >::constAt(), mps_fire::i, Matriplex::invertCramerSym(), dqmiolumiharvest::j, KFO_Calculate_Chi2, KFO_Update_Params, gpuVertexFinder::printf(), squashPhiMPlex(), and Matriplex::MatriplexSym< T, D, N >::subtract().

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

764  {
765 #ifdef DEBUG
766  {
767  dmutex_guard;
768  printf("updateParametersEndcapMPlex\n");
769  printf("psPar:\n");
770  for (int i = 0; i < 6; ++i) {
771  printf("%8f ", psPar.constAt(0, 0, i));
772  printf("\n");
773  }
774  printf("\n");
775  printf("msPar:\n");
776  for (int i = 0; i < 3; ++i) {
777  printf("%8f ", msPar.constAt(0, 0, i));
778  printf("\n");
779  }
780  printf("\n");
781  printf("psErr:\n");
782  for (int i = 0; i < 6; ++i) {
783  for (int j = 0; j < 6; ++j)
784  printf("%8f ", psErr.constAt(0, i, j));
785  printf("\n");
786  }
787  printf("\n");
788  printf("msErr:\n");
789  for (int i = 0; i < 3; ++i) {
790  for (int j = 0; j < 3; ++j)
791  printf("%8f ", msErr.constAt(0, i, j));
792  printf("\n");
793  }
794  printf("\n");
795  }
796 #endif
797 
798  MPlex2V res;
799  SubtractFirst2(msPar, psPar, res);
800 
801  MPlex2S resErr;
802  AddIntoUpperLeft2x2(psErr, msErr, resErr);
803 
804 #ifdef DEBUG
805  {
806  dmutex_guard;
807  printf("resErr:\n");
808  for (int i = 0; i < 2; ++i) {
809  for (int j = 0; j < 2; ++j)
810  printf("%8f ", resErr.At(0, i, j));
811  printf("\n");
812  }
813  printf("\n");
814  }
815 #endif
816 
817  //invert the 2x2 matrix
819 
820  if (kfOp & KFO_Calculate_Chi2) {
821  Chi2Similarity(res, resErr, outChi2);
822 
823 #ifdef DEBUG
824  {
825  dmutex_guard;
826  printf("resErr_loc (Inv):\n");
827  for (int i = 0; i < 2; ++i) {
828  for (int j = 0; j < 2; ++j)
829  printf("%8f ", resErr.At(0, i, j));
830  printf("\n");
831  }
832  printf("\n");
833  printf("chi2: %8f\n", outChi2.At(0, 0, 0));
834  }
835 #endif
836  }
837 
838  if (kfOp & KFO_Update_Params) {
839  MPlexL2 K;
840  KalmanGain(psErr, resErr, K);
841 
842  MultResidualsAdd(K, psPar, res, outPar);
843 
844  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
845 
846  KHC(K, psErr, outErr);
847 
848 #ifdef DEBUG
849  {
850  dmutex_guard;
851  printf("outErr before subtract:\n");
852  for (int i = 0; i < 6; ++i) {
853  for (int j = 0; j < 6; ++j)
854  printf("%8f ", outErr.At(0, i, j));
855  printf("\n");
856  }
857  printf("\n");
858  }
859 #endif
860 
861  outErr.subtract(psErr, outErr);
862 
863 #ifdef DEBUG
864  {
865  dmutex_guard;
866  printf("res:\n");
867  for (int i = 0; i < 2; ++i) {
868  printf("%8f ", res.At(0, i, 0));
869  }
870  printf("\n");
871  printf("resErr (Inv):\n");
872  for (int i = 0; i < 2; ++i) {
873  for (int j = 0; j < 2; ++j)
874  printf("%8f ", resErr.At(0, i, j));
875  printf("\n");
876  }
877  printf("\n");
878  printf("K:\n");
879  for (int i = 0; i < 6; ++i) {
880  for (int j = 0; j < 2; ++j)
881  printf("%8f ", K.At(0, i, j));
882  printf("\n");
883  }
884  printf("\n");
885  printf("outPar:\n");
886  for (int i = 0; i < 6; ++i) {
887  printf("%8f ", outPar.At(0, i, 0));
888  }
889  printf("\n");
890  printf("outErr:\n");
891  for (int i = 0; i < 6; ++i) {
892  for (int j = 0; j < 6; ++j)
893  printf("%8f ", outErr.At(0, i, j));
894  printf("\n");
895  }
896  printf("\n");
897  }
898 #endif
899  }
900  }
MatriplexSym & subtract(const MatriplexSym &a, const MatriplexSym &b)
Definition: MatriplexSym.h:212
T & At(idx_t n, idx_t i, idx_t j)
Definition: MatriplexSym.h:71
void squashPhiMPlex(MPlexLV &par, const int N_proc)
void invertCramerSym(MPlexSym< T, D, N > &A, double *determ=nullptr)
Definition: MatriplexSym.h:410
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: MatriplexSym.h:69
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
void mkfit::kalmanPropagateAndComputeChi2 ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexQF outChi2,
MPlexLV propPar,
const int  N_proc,
const PropagationFlags  propFlags,
const bool  propToHit 
)

Definition at line 476 of file KalmanUtilsMPlex.cc.

References Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), kalmanOperation(), KFO_Calculate_Chi2, dqmiodumpmetadata::n, NN, and propagateHelixToRMPlex().

485  {
486  propPar = psPar;
487  if (propToHit) {
488  MPlexLS propErr;
489  MPlexQF msRad;
490 #pragma omp simd
491  for (int n = 0; n < NN; ++n) {
492  msRad.At(n, 0, 0) = std::hypot(msPar.constAt(n, 0, 0), msPar.constAt(n, 1, 0));
493  }
494 
495  propagateHelixToRMPlex(psErr, psPar, inChg, msRad, propErr, propPar, N_proc, propFlags);
496 
497  kalmanOperation(KFO_Calculate_Chi2, propErr, propPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
498  } else {
499  kalmanOperation(KFO_Calculate_Chi2, psErr, psPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
500  }
501  }
void propagateHelixToRMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLS &outErr, MPlexLV &outPar, 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)
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
void mkfit::kalmanPropagateAndComputeChi2Endcap ( const MPlexLS psErr,
const MPlexLV psPar,
const MPlexQI inChg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexQF outChi2,
MPlexLV propPar,
const int  N_proc,
const PropagationFlags  propFlags,
const bool  propToHit 
)

Definition at line 727 of file KalmanUtilsMPlex.cc.

References Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), kalmanOperationEndcap(), KFO_Calculate_Chi2, dqmiodumpmetadata::n, NN, and propagateHelixToZMPlex().

736  {
737  propPar = psPar;
738  if (propToHit) {
739  MPlexLS propErr;
740  MPlexQF msZ;
741 #pragma omp simd
742  for (int n = 0; n < NN; ++n) {
743  msZ.At(n, 0, 0) = msPar.constAt(n, 2, 0);
744  }
745 
746  propagateHelixToZMPlex(psErr, psPar, inChg, msZ, propErr, propPar, N_proc, propFlags);
747 
748  kalmanOperationEndcap(KFO_Calculate_Chi2, propErr, propPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
749  } else {
750  kalmanOperationEndcap(KFO_Calculate_Chi2, psErr, psPar, msErr, msPar, dummy_err, dummy_par, outChi2, N_proc);
751  }
752  }
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)
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
void propagateHelixToZMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLS &outErr, MPlexLV &outPar, const int N_proc, const PropagationFlags pflags, const MPlexQI *noMatEffPtr)
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
void mkfit::kalmanPropagateAndUpdate ( const MPlexLS psErr,
const MPlexLV psPar,
MPlexQI Chg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc,
const PropagationFlags  propFlags,
const bool  propToHit 
)

Definition at line 431 of file KalmanUtilsMPlex.cc.

References Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), kalmanOperation(), KFO_Update_Params, dqmiodumpmetadata::n, NN, and propagateHelixToRMPlex().

440  {
441  if (propToHit) {
442  MPlexLS propErr;
443  MPlexLV propPar;
444  MPlexQF msRad;
445 #pragma omp simd
446  for (int n = 0; n < NN; ++n) {
447  msRad.At(n, 0, 0) = std::hypot(msPar.constAt(n, 0, 0), msPar.constAt(n, 1, 0));
448  }
449 
450  propagateHelixToRMPlex(psErr, psPar, Chg, msRad, propErr, propPar, N_proc, propFlags);
451 
452  kalmanOperation(KFO_Update_Params, propErr, propPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
453  } else {
454  kalmanOperation(KFO_Update_Params, psErr, psPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
455  }
456  for (int n = 0; n < NN; ++n) {
457  if (outPar.At(n, 3, 0) < 0) {
458  Chg.At(n, 0, 0) = -Chg.At(n, 0, 0);
459  outPar.At(n, 3, 0) = -outPar.At(n, 3, 0);
460  }
461  }
462  }
void propagateHelixToRMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLS &outErr, MPlexLV &outPar, 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)
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
void mkfit::kalmanPropagateAndUpdateEndcap ( const MPlexLS psErr,
const MPlexLV psPar,
MPlexQI Chg,
const MPlexHS msErr,
const MPlexHV msPar,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc,
const PropagationFlags  propFlags,
const bool  propToHit 
)

Definition at line 682 of file KalmanUtilsMPlex.cc.

References Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), kalmanOperationEndcap(), KFO_Update_Params, dqmiodumpmetadata::n, NN, and propagateHelixToZMPlex().

691  {
692  if (propToHit) {
693  MPlexLS propErr;
694  MPlexLV propPar;
695  MPlexQF msZ;
696 #pragma omp simd
697  for (int n = 0; n < NN; ++n) {
698  msZ.At(n, 0, 0) = msPar.constAt(n, 2, 0);
699  }
700 
701  propagateHelixToZMPlex(psErr, psPar, Chg, msZ, propErr, propPar, N_proc, propFlags);
702 
703  kalmanOperationEndcap(KFO_Update_Params, propErr, propPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
704  } else {
705  kalmanOperationEndcap(KFO_Update_Params, psErr, psPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
706  }
707  for (int n = 0; n < NN; ++n) {
708  if (outPar.At(n, 3, 0) < 0) {
709  Chg.At(n, 0, 0) = -Chg.At(n, 0, 0);
710  outPar.At(n, 3, 0) = -outPar.At(n, 3, 0);
711  }
712  }
713  }
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)
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
void propagateHelixToZMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLS &outErr, MPlexLV &outPar, const int N_proc, const PropagationFlags pflags, const MPlexQI *noMatEffPtr)
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
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 421 of file KalmanUtilsMPlex.cc.

References kalmanOperation(), and KFO_Update_Params.

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

427  {
428  kalmanOperation(KFO_Update_Params, psErr, psPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
429  }
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 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 672 of file KalmanUtilsMPlex.cc.

References kalmanOperationEndcap(), and KFO_Update_Params.

678  {
679  kalmanOperationEndcap(KFO_Update_Params, psErr, psPar, msErr, msPar, outErr, outPar, dummy_chi2, N_proc);
680  }
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)
template<class T , class U >
bool mkfit::operator== ( const CcAlloc< T > &  a,
const CcAlloc< U > &  b 
)

Definition at line 382 of file HitStructures.h.

References mkfit::CcAlloc< T >::pool_id().

382  {
383  return a.pool_id() == b.pool_id();
384  }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
bool mkfit::passStripChargePCMfromTrack ( int  itrack,
bool  isBarrel,
unsigned int  pcm,
unsigned int  pcmMin,
const MPlexLV &  pPar,
const MPlexHS &  msErr 
)

Definition at line 886 of file MkFinder.cc.

References funct::abs(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), Matriplex::MatriplexSym< T, D, N >::constAt(), funct::cos(), dprint, validate-o2o-wbm::f, mkfit::Hit::maxChargePerCM(), funct::sin(), and mathSSE::sqrt().

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

887  {
888  //skip the overflow case
889  if (pcm >= Hit::maxChargePerCM())
890  return true;
891 
892  float qSF;
893  if (isBarrel) { //project in x,y, assuming zero-error direction is in this plane
894  const float hitT2 = msErr.constAt(itrack, 0, 0) + msErr.constAt(itrack, 1, 1);
895  const float hitT2inv = 1.f / hitT2;
896  const float proj[3] = {msErr.constAt(itrack, 0, 0) * hitT2inv,
897  msErr.constAt(itrack, 0, 1) * hitT2inv,
898  msErr.constAt(itrack, 1, 1) * hitT2inv};
899  const bool detXY_OK =
900  std::abs(proj[0] * proj[2] - proj[1] * proj[1]) < 0.1f; //check that zero-direction is close
901  const float cosP = cos(pPar.constAt(itrack, 4, 0));
902  const float sinP = sin(pPar.constAt(itrack, 4, 0));
903  const float sinT = std::abs(sin(pPar.constAt(itrack, 5, 0)));
904  //qSF = sqrt[(px,py)*(1-proj)*(px,py)]/p = sinT*sqrt[(cosP,sinP)*(1-proj)*(cosP,sinP)].
905  qSF = detXY_OK ? sinT * std::sqrt(std::abs(1.f + cosP * cosP * proj[0] + sinP * sinP * proj[2] -
906  2.f * cosP * sinP * proj[1]))
907  : 1.f;
908  } else { //project on z
909  // p_zLocal/p = p_z/p = cosT
910  qSF = std::abs(cos(pPar.constAt(itrack, 5, 0)));
911  }
912 
913  const float qCorr = pcm * qSF;
914  dprint("pcm " << pcm << " * " << qSF << " = " << qCorr << " vs " << pcmMin);
915  return qCorr > pcmMin;
916  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define dprint(x)
Definition: Debug.h:90
void mkfit::print ( std::string_view  label,
const MeasurementState &  s 
)

Definition at line 8 of file Hit.cc.

References gather_cfg::cout, dumpMatrix(), mkfit::MeasurementState::errors(), and mkfit::MeasurementState::parameters().

Referenced by conformalFitMPlex(), print(), mkfit::MkBuilder::seed_post_cleaning(), 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
tuple cout
Definition: gather_cfg.py:144
void mkfit::print ( const TrackState &  s)

Definition at line 402 of file Track.cc.

References gather_cfg::cout, dumpMatrix(), mkfit::TrackState::errors, mkfit::TrackState::parameters, and mkfit::TrackState::valid.

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
tuple cout
Definition: gather_cfg.py:144
void mkfit::print ( std::string  label,
int  itrack,
const Track &  trk,
bool  print_hits = false 
)

Definition at line 410 of file Track.cc.

References gather_cfg::cout, mkfit::Track::getHitIdx(), mkfit::Track::getHitLyr(), mps_fire::i, mkfit::Track::nFoundHits(), mkfit::Track::nTotalHits(), print(), gpuVertexFinder::printf(), and mkfit::TrackBase::state().

410  {
411  std::cout << std::endl << label << ": " << itrack << " hits: " << trk.nFoundHits() << " State" << std::endl;
412  print(trk.state());
413  if (print_hits) {
414  for (int i = 0; i < trk.nTotalHits(); ++i)
415  printf(" %2d: lyr %2d idx %d\n", i, trk.getHitLyr(i), trk.getHitIdx(i));
416  }
417  }
char const * label
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
tuple cout
Definition: gather_cfg.py:144
void mkfit::print ( std::string  label,
const TrackState &  s 
)

Definition at line 419 of file Track.cc.

References gather_cfg::cout, and print().

419  {
420  std::cout << label << std::endl;
421  print(s);
422  }
char const * label
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
tuple cout
Definition: gather_cfg.py:144
void mkfit::propagateHelixToRMPlex ( const MPlexLS inErr,
const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msRad,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc,
const PropagationFlags  pflags,
const MPlexQI noMatEffPtr 
)

Definition at line 484 of file PropagationMPlex.cc.

References mkfit::PropagationFlags::apply_material, applyMaterialEffects(), Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::MatriplexSym< T, D, N >::At(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), Matriplex::Matriplex< T, D1, D2, N >::copySlot(), Matriplex::MatriplexSym< T, D, N >::copySlot(), dprintf, mkfit::MaterialEffects::getRbin(), mkfit::MaterialEffects::getZbin(), helixAtRFromIterativeCCS(), hipo(), mps_fire::i, dqmiolumiharvest::j, GetRecoTauVFromDQM_MC_cff::kk, mkfit::Config::materialEff, dqmiodumpmetadata::n, mkfit::Config::nBinsRME, gpuVertexFinder::printf(), alignCSCRings::r, squashPhiMPlex(), and groupFilesInBlocks::temp.

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

492  {
493  // bool debug = true;
494 
495  // This is used further down when calculating similarity with errorProp (and before in DEBUG).
496  // MT: I don't think this really needed if we use inErr where required.
497  outErr = inErr;
498  // This requirement for helixAtRFromIterativeCCS_impl() and for helixAtRFromIterativeCCSFullJac().
499  // MT: This should be properly handled in both functions (expecting input in output parameters sucks).
500  outPar = inPar;
501 
502  MPlexLL errorProp;
503  MPlexQI failFlag;
504 
505  helixAtRFromIterativeCCS(inPar, inChg, msRad, outPar, errorProp, failFlag, N_proc, pflags);
506 
507 #ifdef DEBUG
508  {
509  for (int kk = 0; kk < N_proc; ++kk) {
510  dprintf("outErr before prop %d\n", kk);
511  for (int i = 0; i < 6; ++i) {
512  for (int j = 0; j < 6; ++j)
513  dprintf("%8f ", outErr.At(kk, i, j));
514  printf("\n");
515  }
516  dprintf("\n");
517 
518  dprintf("errorProp %d\n", kk);
519  for (int i = 0; i < 6; ++i) {
520  for (int j = 0; j < 6; ++j)
521  dprintf("%8f ", errorProp.At(kk, i, j));
522  printf("\n");
523  }
524  dprintf("\n");
525  }
526  }
527 #endif
528 
529  if (pflags.apply_material) {
530  MPlexQF hitsRl;
531  MPlexQF hitsXi;
532  MPlexQF propSign;
533 #pragma omp simd
534  for (int n = 0; n < N_proc; ++n) {
535  if (failFlag(n, 0, 0) || (noMatEffPtr && noMatEffPtr->constAt(n, 0, 0))) {
536  hitsRl(n, 0, 0) = 0.f;
537  hitsXi(n, 0, 0) = 0.f;
538  } else {
539  const int zbin = Config::materialEff.getZbin(outPar(n, 2, 0));
540  const int rbin = Config::materialEff.getRbin(msRad(n, 0, 0));
541  hitsRl(n, 0, 0) = (zbin >= 0 && zbin < Config::nBinsZME && rbin >= 0 && rbin < Config::nBinsRME)
542  ? Config::materialEff.getRlVal(zbin, rbin)
543  : 0.f; // protect against crazy propagations
544  hitsXi(n, 0, 0) = (zbin >= 0 && zbin < Config::nBinsZME && rbin >= 0 && rbin < Config::nBinsRME)
545  ? Config::materialEff.getXiVal(zbin, rbin)
546  : 0.f; // protect against crazy propagations
547  }
548  const float r0 = hipo(inPar(n, 0, 0), inPar(n, 1, 0));
549  const float r = msRad(n, 0, 0);
550  propSign(n, 0, 0) = (r > r0 ? 1. : -1.);
551  }
552  applyMaterialEffects(hitsRl, hitsXi, propSign, outErr, outPar, N_proc, true);
553  }
554 
555  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
556 
557  // Matriplex version of:
558  // result.errors = ROOT::Math::Similarity(errorProp, outErr);
559 
560  // MultHelixProp can be optimized for CCS coordinates, see GenMPlexOps.pl
561  MPlexLL temp;
562  MultHelixProp(errorProp, outErr, temp);
563  MultHelixPropTransp(errorProp, temp, outErr);
564 
565  /*
566  // To be used with: MPT_DIM = 1
567  if (fabs(sqrt(outPar[0]*outPar[0]+outPar[1]*outPar[1]) - msRad[0]) > 0.0001)
568  {
569  std::cout << "DID NOT GET TO R, FailFlag=" << failFlag[0]
570  << " dR=" << msRad[0] - std::hypot(outPar[0],outPar[1])
571  << " r=" << msRad[0] << " rin=" << std::hypot(inPar[0],inPar[1]) << " rout=" << std::hypot(outPar[0],outPar[1])
572  << std::endl;
573  // std::cout << " pt=" << pt << " pz=" << inPar.At(n, 2) << std::endl;
574  }
575  */
576 
577  // FIXUP BOTCHED (low pT) propagations.
578  // For now let's enforce reseting output to input for failed cases. But:
579  // - perhaps this should be optional;
580  // - alternatively, it could also be an extra output parameter;
581  // - if we pass fail outwards, we might *not* need to also reset botched output.
582  for (int i = 0; i < N_proc; ++i) {
583  if (failFlag(i, 0, 0)) {
584  outPar.copySlot(i, inPar);
585  outErr.copySlot(i, inErr);
586  }
587  }
588  }
void copySlot(idx_t n, const MatriplexSym &m)
Definition: MatriplexSym.h:81
const MaterialEffects materialEff
T & At(idx_t n, idx_t i, idx_t j)
Definition: MatriplexSym.h:71
void squashPhiMPlex(MPlexLV &par, const int N_proc)
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
int getZbin(const float z) const
constexpr int nBinsRME
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
float hipo(float x, float y)
Definition: Matrix.h:9
void applyMaterialEffects(const MPlexQF &hitsRl, const MPlexQF &hitsXi, const MPlexQF &propSign, MPlexLS &outErr, MPlexLV &outPar, const int N_proc, const bool isBarrel)
int getRbin(const float r) const
void copySlot(idx_t n, const Matriplex &m)
Definition: Matriplex.h:64
void helixAtRFromIterativeCCS(const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLV &outPar, MPlexLL &errorProp, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags pflags)
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
#define dprintf(...)
Definition: Debug.h:93
void mkfit::propagateHelixToZMPlex ( const MPlexLS inErr,
const MPlexLV inPar,
const MPlexQI inChg,
const MPlexQF msZ,
MPlexLS outErr,
MPlexLV outPar,
const int  N_proc,
const PropagationFlags  pflags,
const MPlexQI noMatEffPtr 
)

Definition at line 592 of file PropagationMPlex.cc.

References funct::abs(), mkfit::PropagationFlags::apply_material, applyMaterialEffects(), Matriplex::Matriplex< T, D1, D2, N >::At(), Matriplex::Matriplex< T, D1, D2, N >::constAt(), Matriplex::MatriplexSym< T, D, N >::constAt(), dprintf, mkfit::MaterialEffects::getRbin(), mkfit::MaterialEffects::getZbin(), helixAtZ(), mps_fire::i, dqmiolumiharvest::j, GetRecoTauVFromDQM_MC_cff::kk, mkfit::Config::materialEff, dqmiodumpmetadata::n, mkfit::Config::nBinsRME, gpuVertexFinder::printf(), squashPhiMPlex(), and groupFilesInBlocks::temp.

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

600  {
601  // debug = true;
602 
603  outErr = inErr;
604  outPar = inPar;
605 
606  MPlexLL errorProp;
607 
608  helixAtZ(inPar, inChg, msZ, outPar, errorProp, N_proc, pflags);
609 
610 #ifdef DEBUG
611  {
612  for (int kk = 0; kk < N_proc; ++kk) {
613  dprintf("inErr %d\n", kk);
614  for (int i = 0; i < 6; ++i) {
615  for (int j = 0; j < 6; ++j)
616  dprintf("%8f ", inErr.constAt(kk, i, j));
617  printf("\n");
618  }
619  dprintf("\n");
620 
621  dprintf("errorProp %d\n", kk);
622  for (int i = 0; i < 6; ++i) {
623  for (int j = 0; j < 6; ++j)
624  dprintf("%8f ", errorProp.At(kk, i, j));
625  printf("\n");
626  }
627  dprintf("\n");
628  }
629  }
630 #endif
631 
632  if (pflags.apply_material) {
633  MPlexQF hitsRl;
634  MPlexQF hitsXi;
635  MPlexQF propSign;
636 #pragma omp simd
637  for (int n = 0; n < N_proc; ++n) {
638  if (noMatEffPtr && noMatEffPtr->constAt(n, 0, 0)) {
639  hitsRl(n, 0, 0) = 0.f;
640  hitsXi(n, 0, 0) = 0.f;
641  } else {
642  const int zbin = Config::materialEff.getZbin(msZ(n, 0, 0));
643  const int rbin = Config::materialEff.getRbin(std::hypot(outPar(n, 0, 0), outPar(n, 1, 0)));
644  hitsRl(n, 0, 0) = (zbin >= 0 && zbin < Config::nBinsZME && rbin >= 0 && rbin < Config::nBinsRME)
645  ? Config::materialEff.getRlVal(zbin, rbin)
646  : 0.f; // protect against crazy propagations
647  hitsXi(n, 0, 0) = (zbin >= 0 && zbin < Config::nBinsZME && rbin >= 0 && rbin < Config::nBinsRME)
648  ? Config::materialEff.getXiVal(zbin, rbin)
649  : 0.f; // protect against crazy propagations
650  }
651  const float zout = msZ.constAt(n, 0, 0);
652  const float zin = inPar.constAt(n, 2, 0);
653  propSign(n, 0, 0) = (std::abs(zout) > std::abs(zin) ? 1. : -1.);
654  }
655  applyMaterialEffects(hitsRl, hitsXi, propSign, outErr, outPar, N_proc, false);
656  }
657 
658  squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|
659 
660  // Matriplex version of:
661  // result.errors = ROOT::Math::Similarity(errorProp, outErr);
662  MPlexLL temp;
663  MultHelixPropEndcap(errorProp, outErr, temp);
664  MultHelixPropTranspEndcap(errorProp, temp, outErr);
665 
666  // This dump is now out of its place as similarity is done with matriplex ops.
667  /*
668 #ifdef DEBUG
669  {
670  dmutex_guard;
671  for (int kk = 0; kk < N_proc; ++kk)
672  {
673  dprintf("outErr %d\n", kk);
674  for (int i = 0; i < 6; ++i) { for (int j = 0; j < 6; ++j)
675  dprintf("%8f ", outErr.At(kk,i,j)); printf("\n");
676  } dprintf("\n");
677 
678  dprintf("outPar %d\n", kk);
679  for (int i = 0; i < 6; ++i) {
680  dprintf("%8f ", outPar.At(kk,i,0)); printf("\n");
681  } dprintf("\n");
682  if (std::abs(outPar.At(kk,2,0) - msZ.constAt(kk, 0, 0)) > 0.0001) {
683  float pt = 1.0f / inPar.constAt(kk,3,0);
684  dprint_np(kk, "DID NOT GET TO Z, dZ=" << std::abs(outPar.At(kk,2,0) - msZ.constAt(kk, 0, 0))
685  << " z=" << msZ.constAt(kk, 0, 0) << " zin=" << inPar.constAt(kk,2,0) << " zout=" << outPar.At(kk,2,0) << std::endl
686  << "pt=" << pt << " pz=" << pt/std::tan(inPar.constAt(kk,5,0)));
687  }
688  }
689  }
690 #endif
691  */
692  }
const MaterialEffects materialEff
void squashPhiMPlex(MPlexLV &par, const int N_proc)
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
int getZbin(const float z) const
constexpr int nBinsRME
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: MatriplexSym.h:69
void applyMaterialEffects(const MPlexQF &hitsRl, const MPlexQF &hitsXi, const MPlexQF &propSign, MPlexLS &outErr, MPlexLV &outPar, const int N_proc, const bool isBarrel)
int getRbin(const float r) const
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
#define dprintf(...)
Definition: Debug.h:93
void helixAtZ(const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLV &outPar, MPlexLL &errorProp, const int N_proc, const PropagationFlags pflags)
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 15 of file PropagationMPlex.cc.

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

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

References ntupleEnum::Algo, mkfit::MkBuilder::backwardFit(), mkfit::MkBuilder::begin_event(), mkfit::MkBuilder::beginBkwSearch(), mkfit::StdSeq::clean_cms_seedtracks_iter(), mkfit::MkBuilder::compactifyHitStorageForBestCand(), DetachedTripletStep_cff::detachedTripletStep, mkfit::MkBuilder::end_event(), mkfit::MkBuilder::endBkwSearch(), mkfit::MkBuilder::export_best_comb_cands(), mkfit::MkBuilder::filter_comb_cands(), mkfit::StdSeq::find_and_remove_duplicates(), 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_params, mkfit::IterationConfig::m_requires_dupclean_tight, mkfit::IterationConfig::m_requires_quality_filter, mkfit::IterationConfig::m_requires_seed_hit_sorting, mkfit::IterationConfig::m_track_algorithm, mkfit::IterationParams::minHitsQF, PixelLessStep_cff::pixelLessStep, PixelPairStep_cff::pixelPairStep, mkfit::StdSeq::qfilter_n_hits(), mkfit::StdSeq::qfilter_n_hits_pixseed(), mkfit::StdSeq::qfilter_n_layers(), mkfit::StdSeq::qfilter_nan_n_silly(), mkfit::StdSeq::qfilter_pixelLessBkwd(), mkfit::StdSeq::qfilter_pixelLessFwd(), mkfit::EventOfHits::refBeamSpot(), mkfit::MkBuilder::release_memory(), alignCSCRings::s, mkfit::MkBuilder::seed_post_cleaning(), and submitPVValidationJobs::t.

Referenced by MkFitProducer::produce().

38  {
39  IterationMaskIfcCmssw it_mask_ifc(trackerInfo, hit_masks);
40 
41  MkJob job({trackerInfo, itconf, eoh, &it_mask_ifc});
42 
43  builder.begin_event(&job, nullptr, __func__);
44 
45  if (do_seed_clean) {
46  // Seed cleaning not done on pixelLess / tobTec iters
47  if (itconf.m_requires_dupclean_tight)
48  StdSeq::clean_cms_seedtracks_iter(&seeds, itconf, eoh.refBeamSpot());
49  }
50 
51  // Check nans in seeds -- this should not be needed when Slava fixes
52  // the track parameter coordinate transformation.
53  builder.seed_post_cleaning(seeds);
54 
55  if (itconf.m_requires_seed_hit_sorting) {
56  for (auto &s : seeds)
57  s.sortHitsByLayer(); // sort seed hits for the matched hits (I hope it works here)
58  }
59 
60  builder.find_tracks_load_seeds(seeds);
61 
62  builder.findTracksCloneEngine();
63 
65  if (itconf.m_requires_quality_filter && Algo(itconf.m_track_algorithm) != Algo::detachedTripletStep) {
66  if (Algo(itconf.m_track_algorithm) == Algo::pixelPairStep) {
67  builder.filter_comb_cands([&](const TrackCand &t) { return StdSeq::qfilter_n_hits_pixseed(t, 3); });
68  } else if (Algo(itconf.m_track_algorithm) == Algo::pixelLessStep) {
69  builder.filter_comb_cands(
70  [&](const TrackCand &t) { return StdSeq::qfilter_pixelLessFwd(t, eoh.refBeamSpot(), trackerInfo); });
71  } else {
72  builder.filter_comb_cands(
73  [&](const TrackCand &t) { return StdSeq::qfilter_n_hits(t, itconf.m_params.minHitsQF); });
74  }
75  }
76 
77  if (do_backward_fit) {
78  if (itconf.m_backward_search) {
79  builder.compactifyHitStorageForBestCand(itconf.m_backward_drop_seed_hits, itconf.m_backward_fit_min_hits);
80  }
81 
82  builder.backwardFit();
83 
84  if (itconf.m_backward_search) {
85  builder.beginBkwSearch();
86  builder.findTracksCloneEngine(SteeringParams::IT_BkwSearch);
87  builder.endBkwSearch();
88  }
89 
90  if (itconf.m_requires_quality_filter && (Algo(itconf.m_track_algorithm) == Algo::detachedTripletStep ||
91  Algo(itconf.m_track_algorithm) == Algo::pixelLessStep)) {
92  if (Algo(itconf.m_track_algorithm) == Algo::detachedTripletStep) {
93  builder.filter_comb_cands(
94  [&](const TrackCand &t) { return StdSeq::qfilter_n_layers(t, eoh.refBeamSpot(), trackerInfo); });
95  } else if (Algo(itconf.m_track_algorithm) == Algo::pixelLessStep) {
96  builder.filter_comb_cands(
97  [&](const TrackCand &t) { return StdSeq::qfilter_pixelLessBkwd(t, eoh.refBeamSpot(), trackerInfo); });
98  }
99  }
100  }
101 
102  builder.filter_comb_cands([&](const TrackCand &t) { return StdSeq::qfilter_nan_n_silly(t); });
103 
104  builder.export_best_comb_cands(out_tracks, true);
105 
106  if (do_remove_duplicates) {
107  StdSeq::find_and_remove_duplicates(out_tracks, itconf);
108  }
109 
110  builder.end_event();
111  builder.release_memory();
112  }
void find_and_remove_duplicates(TrackVec &tracks, const IterationConfig &itconf)
Definition: MkStdSeqs.cc:591
bool qfilter_n_hits_pixseed(const TRACK &t, int nMinHits)
Definition: MkStdSeqs.h:50
bool qfilter_pixelLessFwd(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &tk_info)
quality filter tuned for pixelLess iteration during forward search
Definition: MkStdSeqs.h:78
bool qfilter_n_hits(const TRACK &t, int nMinHits)
Definition: MkStdSeqs.h:42
bool qfilter_n_layers(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &trk_inf)
Definition: MkStdSeqs.h:56
tuple Algo
Definition: ntupleEnum.py:25
bool qfilter_pixelLessBkwd(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &tk_info)
quality filter tuned for pixelLess iteration during backward search
Definition: MkStdSeqs.h:104
TrackBase::TrackAlgorithm TrackAlgorithm
bool qfilter_nan_n_silly(const TRACK &t)
Definition: MkStdSeqs.h:128
Definition: fakeMenu.h:6
int clean_cms_seedtracks_iter(TrackVec *seed_ptr, const IterationConfig &itrcfg, const BeamSpot &bspot)
Definition: MkStdSeqs.cc:84
std::vector< double > mkfit::runBtpCe_MultiIter ( Event ev,
const EventOfHits &  eoh,
MkBuilder &  builder,
int  n 
)

Definition at line 386 of file buildtestMPlex.cc.

References ntupleEnum::Algo, mkfit::Config::backwardFit, mkfit::MkBuilder::backwardFit(), mkfit::Config::backwardSearch, mkfit::MkBuilder::begin_event(), mkfit::MkBuilder::beginBkwSearch(), mkfit::Event::candidateTracks_, mkfit::StdSeq::clean_cms_seedtracks_iter(), mkfit::Config::cmssw_val, mkfit::MkBuilder::compactifyHitStorageForBestCand(), DetachedTripletStep_cff::detachedTripletStep, dtime(), mkfit::MkBuilder::end_event(), mkfit::MkBuilder::endBkwSearch(), mkfit::MkBuilder::export_tracks(), mkfit::Event::fill_hitmask_bool_vectors(), mkfit::MkBuilder::filter_comb_cands(), spr::find(), mkfit::StdSeq::find_and_remove_duplicates(), mkfit::MkBuilder::find_tracks_load_seeds(), mkfit::MkBuilder::findTracksCloneEngine(), mkfit::Event::fitTracks_, 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::IterationMaskIfc::m_mask_vector, mkfit::IterationConfig::m_params, mkfit::IterationConfig::m_requires_dupclean_tight, mkfit::IterationConfig::m_requires_quality_filter, mkfit::IterationConfig::m_requires_seed_hit_sorting, mkfit::IterationConfig::m_track_algorithm, mkfit::IterationParams::minHitsQF, eostools::move(), dqmiodumpmetadata::n, PixelLessStep_cff::pixelLessStep, PixelPairStep_cff::pixelPairStep, mkfit::StdSeq::prep_simtracks(), mkfit::StdSeq::qfilter_n_hits(), mkfit::StdSeq::qfilter_n_hits_pixseed(), mkfit::StdSeq::qfilter_n_layers(), mkfit::StdSeq::qfilter_nan_n_silly(), mkfit::StdSeq::qfilter_pixelLessBkwd(), mkfit::StdSeq::qfilter_pixelLessFwd(), mkfit::StdSeq::Quality::quality_val(), mkfit::Config::quality_val, mkfit::MkBuilder::ref_tracks_nc(), mkfit::EventOfHits::refBeamSpot(), mkfit::Event::relabel_bad_seedtracks(), mkfit::MkBuilder::release_memory(), mkfit::StdSeq::root_val(), alignCSCRings::s, mkfit::MkBuilder::seed_post_cleaning(), DetachedQuadStep_cff::seeds, mkfit::Event::seedTracks_, mkfit::MkBuilder::select_best_comb_cands(), mkfit::Config::sim_val, submitPVValidationJobs::t, and mkfit::Config::TrkInfo.

Referenced by test_standard().

386  {
387  std::vector<double> timevec;
388  if (n <= 0)
389  return timevec;
390  timevec.resize(n + 1, 0.0);
391 
392  const bool validation_on = (Config::sim_val || Config::quality_val);
393 
394  TrackVec seeds_used;
395  TrackVec seeds1;
396 
397  unsigned int algorithms[] = {4, 22, 23, 5, 24, 7, 8, 9, 10, 6}; //9 iterations
398 
399  if (validation_on) {
400  for (auto const &s : ev.seedTracks_) {
401  //keep seeds form the first n iterations for processing
402  if (std::find(algorithms, algorithms + n, s.algoint()) != algorithms + n)
403  seeds1.push_back(s);
404  }
405  ev.seedTracks_.swap(seeds1); //necessary for the validation - PrepareSeeds
406  ev.relabel_bad_seedtracks(); //necessary for the validation - PrepareSeeds
407  }
408 
409  IterationMaskIfc mask_ifc;
410  TrackVec seeds;
411  TrackVec tmp_tvec;
412 
413  for (int it = 0; it <= n - 1; ++it) {
414  const IterationConfig &itconf = Config::ItrInfo[it];
415 
416  // To disable hit-masks, pass nullptr in place of &mask_ifc to MkJob ctor
417  // and optionally comment out ev.fill_hitmask_bool_vectors() call.
418 
419  ev.fill_hitmask_bool_vectors(itconf.m_track_algorithm, mask_ifc.m_mask_vector);
420 
421  MkJob job({Config::TrkInfo, itconf, eoh, &mask_ifc});
422 
423  builder.begin_event(&job, &ev, __func__);
424 
425  { // We could partition seeds once, store beg, end for each iteration in a map or vector.
426  seeds.clear();
427  int nc = 0;
428  for (auto &s : ev.seedTracks_) {
429  if (s.algoint() == itconf.m_track_algorithm) {
430  if (itconf.m_requires_seed_hit_sorting) {
431  s.sortHitsByLayer();
432  }
433  seeds.push_back(s);
434  ++nc;
435  } else if (nc > 0)
436  break;
437  }
438  }
439 
440  if (itconf.m_requires_dupclean_tight)
441  StdSeq::clean_cms_seedtracks_iter(&seeds, itconf, eoh.refBeamSpot());
442 
443  builder.seed_post_cleaning(seeds);
444 
445  // Add protection in case no seeds are found for iteration
446  if (seeds.size() <= 0)
447  continue;
448 
449  builder.find_tracks_load_seeds(seeds);
450 
451  double time = dtime();
452 
453  builder.findTracksCloneEngine();
454 
455  timevec[it] = dtime() - time;
456  timevec[n] += timevec[it];
457 
458  // Print min and max size of hots vectors of CombCands.
459  // builder.find_min_max_hots_size();
460 
461  if (validation_on)
462  seeds_used.insert(seeds_used.end(), seeds.begin(), seeds.end()); //cleaned seeds need to be stored somehow
463 
465  if (itconf.m_requires_quality_filter && Algo(itconf.m_track_algorithm) != Algo::detachedTripletStep) {
466  if (Algo(itconf.m_track_algorithm) == Algo::pixelPairStep) {
467  builder.filter_comb_cands([&](const TrackCand &t) { return StdSeq::qfilter_n_hits_pixseed(t, 3); });
468  } else if (Algo(itconf.m_track_algorithm) == Algo::pixelLessStep) {
469  builder.filter_comb_cands(
470  [&](const TrackCand &t) { return StdSeq::qfilter_pixelLessFwd(t, eoh.refBeamSpot(), Config::TrkInfo); });
471  } else {
472  builder.filter_comb_cands(
473  [&](const TrackCand &t) { return StdSeq::qfilter_n_hits(t, itconf.m_params.minHitsQF); });
474  }
475  }
476 
477  builder.select_best_comb_cands();
478 
479  {
480  builder.export_tracks(tmp_tvec);
481  StdSeq::find_and_remove_duplicates(tmp_tvec, itconf);
482  ev.candidateTracks_.reserve(ev.candidateTracks_.size() + tmp_tvec.size());
483  for (auto &&t : tmp_tvec)
484  ev.candidateTracks_.emplace_back(std::move(t));
485  tmp_tvec.clear();
486  }
487 
488  // now do backwards fit... do we want to time this section?
489  if (Config::backwardFit) {
490  // a) TrackVec version:
491  // builder.backwardFitBH();
492 
493  // b) Version that runs on CombCand / TrackCand
494  const bool do_backward_search = Config::backwardSearch && itconf.m_backward_search;
495 
496  // We copy seed-hits into Candidates ... now we have to remove them so backward fit stops
497  // before reaching seeding region. Ideally, we wouldn't add them in the first place but
498  // if we want to export full tracks above we need to hold on to them (alternatively, we could
499  // have a pointer to seed track in CombCandidate and copy them from there).
500  if (do_backward_search) {
501  builder.compactifyHitStorageForBestCand(itconf.m_backward_drop_seed_hits, itconf.m_backward_fit_min_hits);
502  }
503 
504  builder.backwardFit();
505 
506  if (do_backward_search) {
507  builder.beginBkwSearch();
508  builder.findTracksCloneEngine(SteeringParams::IT_BkwSearch);
509  builder.endBkwSearch();
510  }
511 
512  if (itconf.m_requires_quality_filter && (Algo(itconf.m_track_algorithm) == Algo::detachedTripletStep ||
513  Algo(itconf.m_track_algorithm) == Algo::pixelLessStep)) {
514  if (Algo(itconf.m_track_algorithm) == Algo::detachedTripletStep) {
515  builder.filter_comb_cands(
516  [&](const TrackCand &t) { return StdSeq::qfilter_n_layers(t, eoh.refBeamSpot(), Config::TrkInfo); });
517  } else if (Algo(itconf.m_track_algorithm) == Algo::pixelLessStep) {
518  builder.filter_comb_cands([&](const TrackCand &t) {
519  return StdSeq::qfilter_pixelLessBkwd(t, eoh.refBeamSpot(), Config::TrkInfo);
520  });
521  }
522  }
523 
524  builder.filter_comb_cands([&](const TrackCand &t) { return StdSeq::qfilter_nan_n_silly(t); });
525 
526  builder.select_best_comb_cands(true); // true -> clear m_tracks as they were already filled once above
527 
528  StdSeq::find_and_remove_duplicates(builder.ref_tracks_nc(), itconf);
529  builder.export_tracks(ev.fitTracks_);
530  }
531 
532  builder.end_event();
533  }
534 
535  // MIMI - Fake back event pointer for final processing (that should be done elsewhere)
536  MkJob job({Config::TrkInfo, Config::ItrInfo[0], eoh});
537  builder.begin_event(&job, &ev, __func__);
538 
539  if (validation_on) {
541  //swap for the cleaned seeds
542  ev.seedTracks_.swap(seeds_used);
543  }
544 
545  check_nan_n_silly_candidates(ev);
546 
548  check_nan_n_silly_bkfit(ev);
549 
550  // validation section
551  if (Config::quality_val) {
552  StdSeq::Quality qval;
553  qval.quality_val(&ev);
554  } else if (Config::sim_val || Config::cmssw_val) {
555  StdSeq::root_val(&ev);
556  }
557 
558  // ev.print_tracks(ev.candidateTracks_, true);
559 
560  // MIMI Unfake.
561  builder.end_event();
562 
563  // In CMSSW runOneIter we now release memory for comb-cands:
564  builder.release_memory();
565 
566  return timevec;
567  }
void find_and_remove_duplicates(TrackVec &tracks, const IterationConfig &itconf)
Definition: MkStdSeqs.cc:591
bool qfilter_n_hits_pixseed(const TRACK &t, int nMinHits)
Definition: MkStdSeqs.h:50
bool qfilter_pixelLessFwd(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &tk_info)
quality filter tuned for pixelLess iteration during forward search
Definition: MkStdSeqs.h:78
pixelTrack::Quality Quality
bool qfilter_n_hits(const TRACK &t, int nMinHits)
Definition: MkStdSeqs.h:42
bool qfilter_n_layers(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &trk_inf)
Definition: MkStdSeqs.h:56
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)
tuple Algo
Definition: ntupleEnum.py:25
def move
Definition: eostools.py:511
bool qfilter_pixelLessBkwd(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &tk_info)
quality filter tuned for pixelLess iteration during backward search
Definition: MkStdSeqs.h:104
TrackBase::TrackAlgorithm TrackAlgorithm
TrackerInfo TrkInfo
IterationsInfo ItrInfo
std::vector< Track > TrackVec
double dtime()
bool qfilter_nan_n_silly(const TRACK &t)
Definition: MkStdSeqs.h:128
Definition: fakeMenu.h:6
int clean_cms_seedtracks_iter(TrackVec *seed_ptr, const IterationConfig &itrcfg, const BeamSpot &bspot)
Definition: MkStdSeqs.cc:84
double mkfit::runBuildingTestPlexBestHit ( Event ev,
const EventOfHits &  eoh,
MkBuilder &  builder 
)

Definition at line 108 of file buildtestMPlex.cc.

References mkfit::Config::backwardFit, mkfit::MkBuilder::backwardFitBH(), mkfit::MkBuilder::begin_event(), mkfit::Event::candidateTracks_, mkfit::Config::cmssw_val, dtime(), mkfit::MkBuilder::end_event(), mkfit::Event::fill_hitmask_bool_vectors(), spr::find(), mkfit::StdSeq::find_duplicates(), mkfit::MkBuilder::find_tracks_load_seeds_BH(), mkfit::MkBuilder::findTracksBestHit(), mkfit::Event::fitTracks_, 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::Event::relabel_bad_seedtracks(), mkfit::StdSeq::root_val(), alignCSCRings::s, mkfit::Event::seedTracks_, mkfit::Config::sim_val, and mkfit::Config::TrkInfo.

Referenced by test_standard().

108  {
109  const IterationConfig &itconf = Config::ItrInfo[0];
110 
111  const bool validation_on = (Config::sim_val || Config::quality_val);
112 
113  if (validation_on) {
114  TrackVec seeds1;
115 
116  unsigned int algorithms[] = {4}; //only initialStep
117 
118  for (auto const &s : ev.seedTracks_) {
119  //keep seeds form the first iteration for processing
120  if (std::find(algorithms, algorithms + 1, s.algoint()) != algorithms + 1)
121  seeds1.push_back(s);
122  }
123  ev.seedTracks_.swap(seeds1); //necessary for the validation - PrepareSeeds
124  ev.relabel_bad_seedtracks(); //necessary for the validation - PrepareSeeds
125  }
126 
127  IterationMaskIfc mask_ifc;
128 
129  // To disable hit-masks, pass nullptr in place of &mask_ifc to MkJob ctor
130  // and optionally comment out ev.fill_hitmask_bool_vectors() call.
131 
132  ev.fill_hitmask_bool_vectors(itconf.m_track_algorithm, mask_ifc.m_mask_vector);
133 
134  MkJob job({Config::TrkInfo, itconf, eoh, &mask_ifc});
135 
136  builder.begin_event(&job, &ev, __func__);
137 
138  // CCCC builder.PrepareSeeds();
139 
140  // EventOfCandidates event_of_cands;
141  builder.find_tracks_load_seeds_BH(ev.seedTracks_);
142 
143 #ifdef USE_VTUNE_PAUSE
144  __SSC_MARK(0x111); // use this to resume Intel SDE at the same point
145  __itt_resume();
146 #endif
147 
148  double time = dtime();
149 
150  builder.findTracksBestHit();
151 
152  time = dtime() - time;
153 
154 #ifdef USE_VTUNE_PAUSE
155  __itt_pause();
156  __SSC_MARK(0x222); // use this to pause Intel SDE at the same point
157 #endif
158 
159  // Hack, get the tracks out.
160  ev.candidateTracks_ = builder.ref_tracks();
161 
162  // For best hit, the candidateTracks_ vector is the direct input to the backward fit so only need to do find_duplicates once
164  //Mark tracks as duplicates; if within CMSSW, remove duplicate tracks before backward fit
165  if (Config::removeDuplicates) {
166  StdSeq::find_duplicates(ev.candidateTracks_);
167  }
168  }
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) {
180  StdSeq::root_val(&ev);
181  }
182 
183  builder.end_event();
184 
185  // ev.print_tracks(ev.candidateTracks_, true);
186 
187  return time;
188  }
pixelTrack::Quality Quality
void find_duplicates(TrackVec &tracks)
Definition: MkStdSeqs.cc:335
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()
double mkfit::runBuildingTestPlexCloneEngine ( Event ev,
const EventOfHits &  eoh,
MkBuilder &  builder 
)

Definition at line 280 of file buildtestMPlex.cc.

References mkfit::Config::backwardFit, mkfit::MkBuilder::backwardFitBH(), mkfit::MkBuilder::begin_event(), mkfit::Event::candidateTracks_, mkfit::Config::cmssw_val, dtime(), mkfit::MkBuilder::end_event(), mkfit::MkBuilder::export_best_comb_cands(), mkfit::Event::fill_hitmask_bool_vectors(), spr::find(), mkfit::MkBuilder::find_tracks_load_seeds(), mkfit::MkBuilder::findTracksCloneEngine(), mkfit::Event::fitTracks_, mkfit::StdSeq::handle_duplicates(), 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::Event::relabel_bad_seedtracks(), mkfit::StdSeq::root_val(), alignCSCRings::s, mkfit::Event::seedTracks_, mkfit::MkBuilder::select_best_comb_cands(), mkfit::Config::sim_val, and mkfit::Config::TrkInfo.

Referenced by test_standard().

280  {
281  const IterationConfig &itconf = Config::ItrInfo[0];
282 
283  const bool validation_on = (Config::sim_val || Config::quality_val);
284 
285  if (validation_on) {
286  TrackVec seeds1;
287 
288  unsigned int algorithms[] = {4}; //only initialStep
289 
290  for (auto const &s : ev.seedTracks_) {
291  //keep seeds form the first iteration for processing
292  if (std::find(algorithms, algorithms + 1, s.algoint()) != algorithms + 1)
293  seeds1.push_back(s);
294  }
295  ev.seedTracks_.swap(seeds1); //necessary for the validation - PrepareSeeds
296  ev.relabel_bad_seedtracks(); //necessary for the validation - PrepareSeeds
297  }
298 
299  IterationMaskIfc mask_ifc;
300 
301  // To disable hit-masks, pass nullptr in place of &mask_ifc to MkJob ctor
302  // and optionally comment out ev.fill_hitmask_bool_vectors() call.
303 
304  ev.fill_hitmask_bool_vectors(itconf.m_track_algorithm, mask_ifc.m_mask_vector);
305 
306  MkJob job({Config::TrkInfo, itconf, eoh, &mask_ifc});
307 
308  builder.begin_event(&job, &ev, __func__);
309 
310  // CCCC builder.PrepareSeeds();
311 
312  builder.find_tracks_load_seeds(ev.seedTracks_);
313 
314 #ifdef USE_VTUNE_PAUSE
315  __SSC_MARK(0x111); // use this to resume Intel SDE at the same point
316  __itt_resume();
317 #endif
318 
319  double time = dtime();
320 
321  builder.findTracksCloneEngine();
322 
323  time = dtime() - time;
324 
325 #ifdef USE_VTUNE_PAUSE
326  __itt_pause();
327  __SSC_MARK(0x222); // use this to pause Intel SDE at the same point
328 #endif
329 
330  check_nan_n_silly_candidates(ev);
331 
332  // first store candidate tracks - needed for BH backward fit and root_validation
333  builder.export_best_comb_cands(ev.candidateTracks_);
334 
335  // now do backwards fit... do we want to time this section?
336  if (Config::backwardFit) {
337  // a) TrackVec version:
338  builder.select_best_comb_cands();
339  builder.backwardFitBH();
340  ev.fitTracks_ = builder.ref_tracks();
341 
342  // b) Version that runs on CombCand / TrackCand
343  // builder.backwardFit();
344  // builder.quality_store_tracks(ev.fitTracks_);
345 
346  check_nan_n_silly_bkfit(ev);
347  }
348 
350 
351  // validation section
352  if (Config::quality_val) {
353  StdSeq::Quality qval;
354  qval.quality_val(&ev);
355  } else if (Config::sim_val || Config::cmssw_val) {
356  StdSeq::root_val(&ev);
357  }
358 
359  builder.end_event();
360 
361  // ev.print_tracks(ev.candidateTracks_, true);
362 
363  return time;
364  }
pixelTrack::Quality Quality
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()
void handle_duplicates(Event *event)
void mkfit::runBuildingTestPlexDumbCMSSW ( Event ev,
const EventOfHits &  eoh,
MkBuilder &  builder 
)

Definition at line 90 of file buildtestMPlex.cc.

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

Referenced by test_standard().

90  {
91  const IterationConfig &itconf = Config::ItrInfo[0];
92 
93  MkJob job({Config::TrkInfo, itconf, eoh});
94 
95  builder.begin_event(&job, &ev, __func__);
96 
99  }
100 
101  builder.end_event();
102  }
TrackerInfo TrkInfo
IterationsInfo ItrInfo
void root_val_dumb_cmssw(Event *event)
double mkfit::runBuildingTestPlexStandard ( Event ev,
const EventOfHits &  eoh,
MkBuilder &  builder 
)

Definition at line 194 of file buildtestMPlex.cc.

References mkfit::Config::backwardFit, mkfit::MkBuilder::backwardFitBH(), mkfit::MkBuilder::begin_event(), mkfit::Event::candidateTracks_, mkfit::Config::cmssw_val, dtime(), mkfit::MkBuilder::end_event(), mkfit::MkBuilder::export_best_comb_cands(), mkfit::Event::fill_hitmask_bool_vectors(), spr::find(), mkfit::MkBuilder::find_tracks_load_seeds(), mkfit::MkBuilder::findTracksStandard(), mkfit::Event::fitTracks_, mkfit::StdSeq::handle_duplicates(), 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::Event::relabel_bad_seedtracks(), mkfit::StdSeq::root_val(), alignCSCRings::s, mkfit::Event::seedTracks_, mkfit::MkBuilder::select_best_comb_cands(), mkfit::Config::sim_val, and mkfit::Config::TrkInfo.

Referenced by test_standard().

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

Definition at line 40 of file fittestMPlex.cc.

References submitPVResolutionJobs::count, dtime(), dataset::end, mkfit::Config::fit_val, mps_fire::i, mkfit::Event::layerHits_, SiStripPI::max, mkfit::Config::nLayers, NN, mkfit::Config::numSeedsPerTask, mkfit::Config::numThreadsFinder, mkfit::Event::simTracks_, and mkfit::Event::validate().

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 int nLayers
Definition: Config.h:73
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
ExecutionContext g_exe_ctx
Definition: MkBuilder.cc:52
constexpr int numThreadsFinder
Definition: Config.h:120
Pool< MkFitter > m_fitters
Definition: MkBuilder.cc:42
void populate(int n_thr)
Definition: MkBuilder.cc:45
double dtime()
constexpr int numSeedsPerTask
Definition: Config.h:122
string end
Definition: dataset.py:937
void mkfit::sincos4 ( const float  x,
float &  sin,
float &  cos 
)
inline

Definition at line 13 of file Matrix.h.

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
bool mkfit::sortByEta ( const Hit hit1,
const Hit hit2 
)
inline

Definition at line 25 of file buildtestMPlex.cc.

References mkfit::Hit::eta().

25 { return hit1.eta() < hit2.eta(); }
bool mkfit::sortByHitsChi2 ( const std::pair< Track, TrackState > &  cand1,
const std::pair< Track, TrackState > &  cand2 
)
inline

Definition at line 14 of file buildtestMPlex.cc.

14  {
15  if (cand1.first.nFoundHits() == cand2.first.nFoundHits())
16  return cand1.first.chi2() < cand2.first.chi2();
17 
18  return cand1.first.nFoundHits() > cand2.first.nFoundHits();
19  }
bool mkfit::sortByHitsChi2 ( const Track &  cand1,
const Track &  cand2 
)
inline

Definition at line 590 of file Track.h.

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

590  {
591  if (cand1.nFoundHits() == cand2.nFoundHits())
592  return cand1.chi2() < cand2.chi2();
593  return cand1.nFoundHits() > cand2.nFoundHits();
594  }
bool mkfit::sortByPhi ( const Hit hit1,
const Hit hit2 
)
inline

Definition at line 21 of file buildtestMPlex.cc.

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

21  {
22  return std::atan2(hit1.y(), hit1.x()) < std::atan2(hit2.y(), hit2.x());
23  }
bool mkfit::sortByScoreCand ( const Track &  cand1,
const Track &  cand2 
)
inline

Definition at line 596 of file Track.h.

References mkfit::TrackBase::score().

Referenced by mkfit::TTreeValidation::mapRefTkToRecoTks().

596 { return cand1.score() > cand2.score(); }
bool mkfit::sortByScoreStruct ( const IdxChi2List &  cand1,
const IdxChi2List &  cand2 
)
inline

Definition at line 598 of file Track.h.

References mkfit::IdxChi2List::score.

598  {
599  return cand1.score > cand2.score;
600  }
bool mkfit::sortByScoreTrackCand ( const TrackCand &  cand1,
const TrackCand &  cand2 
)
inline

Definition at line 485 of file HitStructures.h.

References mkfit::TrackBase::score().

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

485  {
486  return cand1.score() > cand2.score();
487  }
bool mkfit::sortByZ ( const Hit hit1,
const Hit hit2 
)
inline

Definition at line 43 of file buildtestMPlex.cc.

References mkfit::Hit::z().

43 { return hit1.z() < hit2.z(); }
double z
global z - AlignmentGeometry::z0, mm
Definition: HitCollection.h:27
bool mkfit::sortHitsByPhiMT ( const Hit h1,
const Hit h2 
)
inline

Definition at line 28 of file HitStructures.h.

References mkfit::Hit::position().

28  {
29  return std::atan2(h1.position()[1], h1.position()[0]) < std::atan2(h2.position()[1], h2.position()[0]);
30  }
double position
measurement position; mm
Definition: HitCollection.h:21
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; }
bool mkfit::sortTracksByEta ( const Track &  track1,
const Track &  track2 
)
inline

Definition at line 27 of file buildtestMPlex.cc.

References mkfit::TrackBase::momEta().

27 { return track1.momEta() < track2.momEta(); }
bool mkfit::sortTracksByPhi ( const Track &  track1,
const Track &  track2 
)
inline

Definition at line 29 of file buildtestMPlex.cc.

References mkfit::TrackBase::momPhi().

29 { return track1.momPhi() < track2.momPhi(); }
bool mkfit::sortTrksByPhiMT ( const Track &  t1,
const Track &  t2 
)
inline

Definition at line 32 of file HitStructures.h.

References mkfit::TrackBase::momPhi().

32 { return t1.momPhi() < t2.momPhi(); }
template<typename T >
T mkfit::sqr ( T  x)
inline

Definition at line 13 of file Hit.h.

13  {
14  return x * x;
15  }
float x
float mkfit::squashPhiGeneral ( float  phi)
inline
template<typename Vector >
void mkfit::squashPhiGeneral ( Vector v)
inline

Definition at line 657 of file Track.h.

References mps_fire::i, and squashPhiGeneral().

657  {
658  const int i = v.kSize - 2; // phi index
659  v[i] = squashPhiGeneral(v[i]);
660  }
float squashPhiGeneral(float phi)
Definition: Hit.h:21
float mkfit::squashPhiMinimal ( float  phi)
inline
void mkfit::squashPhiMPlex ( MPlexLV &  par,
const int  N_proc 
)
inline

Definition at line 8 of file PropagationMPlex.h.

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

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

8  {
9 #pragma omp simd
10  for (int n = 0; n < NN; ++n) {
11  if (par(n, 4, 0) >= Const::PI)
12  par(n, 4, 0) -= Const::TwoPI;
13  if (par(n, 4, 0) < -Const::PI)
14  par(n, 4, 0) += Const::TwoPI;
15  }
16  }
constexpr float TwoPI
Definition: Config.h:43
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
#define PI
Definition: QcdUeDQM.h:37
void mkfit::squashPhiMPlexGeneral ( MPlexLV &  par,
const int  N_proc 
)
inline

Definition at line 18 of file PropagationMPlex.h.

References validate-o2o-wbm::f, mkfit::Const::InvPI, dqmiodumpmetadata::n, NN, mkfit::Const::PI, and mkfit::Const::TwoPI.

18  {
19 #pragma omp simd
20  for (int n = 0; n < NN; ++n) {
21  par(n, 4, 0) -= std::floor(0.5f * Const::InvPI * (par(n, 4, 0) + Const::PI)) * Const::TwoPI;
22  }
23  }
constexpr float TwoPI
Definition: Config.h:43
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
#define PI
Definition: QcdUeDQM.h:37
constexpr float InvPI
Definition: Config.h:47
void mkfit::to_json ( nlohmann::json nlohmann_json_j,
const mkfit::LayerControl nlohmann_json_t 
)
inline

Definition at line 32 of file IterationConfig.cc.

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

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

Definition at line 32 of file IterationConfig.cc.

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

Definition at line 41 of file IterationConfig.cc.

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

Definition at line 41 of file IterationConfig.cc.

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

Definition at line 59 of file IterationConfig.cc.

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

Definition at line 59 of file IterationConfig.cc.

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

Definition at line 84 of file IterationConfig.cc.

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

Definition at line 84 of file IterationConfig.cc.

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

Definition at line 103 of file IterationConfig.cc.

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

Definition at line 103 of file IterationConfig.cc.

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

Definition at line 106 of file IterationConfig.cc.

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

Definition at line 106 of file IterationConfig.cc.

Variable Documentation

ExecutionContext mkfit::g_exe_ctx
constexpr Matriplex::idx_t mkfit::HH = 3

Definition at line 46 of file Matrix.h.

Referenced by L1TConfigDumper::analyze().

constexpr Matriplex::idx_t mkfit::LL = 6
constexpr int mkfit::MPlexHitIdxMax = 16
static

Definition at line 12 of file MkFitter.h.

constexpr Matriplex::idx_t mkfit::NN = 8