Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:41

0001 #include "RecoBTag/ONNXRuntime/interface/tensor_fillers.h"
0002 
0003 namespace btagbtvdeep {
0004 
0005   void jet_tensor_filler(float*& ptr, const btagbtvdeep::DeepFlavourFeatures& features) {
0006     // jet variables
0007     const auto& jet_features = features.jet_features;
0008     *ptr = jet_features.pt;
0009     *(++ptr) = jet_features.eta;
0010     // number of elements in different collections
0011     *(++ptr) = features.c_pf_features.size();
0012     *(++ptr) = features.n_pf_features.size();
0013     *(++ptr) = features.sv_features.size();
0014     *(++ptr) = features.npv;
0015     // variables from ShallowTagInfo
0016     const auto& tag_info_features = features.tag_info_features;
0017     *(++ptr) = tag_info_features.trackSumJetEtRatio;
0018     *(++ptr) = tag_info_features.trackSumJetDeltaR;
0019     *(++ptr) = tag_info_features.vertexCategory;
0020     *(++ptr) = tag_info_features.trackSip2dValAboveCharm;
0021     *(++ptr) = tag_info_features.trackSip2dSigAboveCharm;
0022     *(++ptr) = tag_info_features.trackSip3dValAboveCharm;
0023     *(++ptr) = tag_info_features.trackSip3dSigAboveCharm;
0024     *(++ptr) = tag_info_features.jetNSelectedTracks;
0025     *(++ptr) = tag_info_features.jetNTracksEtaRel;
0026   }
0027 
0028   void cpf_tensor_filler(float*& ptr, const btagbtvdeep::ChargedCandidateFeatures& c_pf_features) {
0029     *ptr = c_pf_features.btagPf_trackEtaRel;
0030     *(++ptr) = c_pf_features.btagPf_trackPtRel;
0031     *(++ptr) = c_pf_features.btagPf_trackPPar;
0032     *(++ptr) = c_pf_features.btagPf_trackDeltaR;
0033     *(++ptr) = c_pf_features.btagPf_trackPParRatio;
0034     *(++ptr) = c_pf_features.btagPf_trackSip2dVal;
0035     *(++ptr) = c_pf_features.btagPf_trackSip2dSig;
0036     *(++ptr) = c_pf_features.btagPf_trackSip3dVal;
0037     *(++ptr) = c_pf_features.btagPf_trackSip3dSig;
0038     *(++ptr) = c_pf_features.btagPf_trackJetDistVal;
0039     *(++ptr) = c_pf_features.ptrel;
0040     *(++ptr) = c_pf_features.drminsv;
0041     *(++ptr) = c_pf_features.vtx_ass;
0042     *(++ptr) = c_pf_features.puppiw;
0043     *(++ptr) = c_pf_features.chi2;
0044     *(++ptr) = c_pf_features.quality;
0045   }
0046 
0047   void npf_tensor_filler(float*& ptr, const btagbtvdeep::NeutralCandidateFeatures& n_pf_features) {
0048     *ptr = n_pf_features.ptrel;
0049     *(++ptr) = n_pf_features.deltaR;
0050     *(++ptr) = n_pf_features.isGamma;
0051     *(++ptr) = n_pf_features.hadFrac;
0052     *(++ptr) = n_pf_features.drminsv;
0053     *(++ptr) = n_pf_features.puppiw;
0054   }
0055 
0056   void sv_tensor_filler(float*& ptr, const btagbtvdeep::SecondaryVertexFeatures& sv_features) {
0057     *ptr = sv_features.pt;
0058     *(++ptr) = sv_features.deltaR;
0059     *(++ptr) = sv_features.mass;
0060     *(++ptr) = sv_features.ntracks;
0061     *(++ptr) = sv_features.chi2;
0062     *(++ptr) = sv_features.normchi2;
0063     *(++ptr) = sv_features.dxy;
0064     *(++ptr) = sv_features.dxysig;
0065     *(++ptr) = sv_features.d3d;
0066     *(++ptr) = sv_features.d3dsig;
0067     *(++ptr) = sv_features.costhetasvpv;
0068     *(++ptr) = sv_features.enratio;
0069   }
0070 
0071   void jet4vec_tensor_filler(float*& ptr, const btagbtvdeep::JetFeatures& jet_features) {
0072     *ptr = jet_features.pt;
0073     *(++ptr) = jet_features.eta;
0074     *(++ptr) = jet_features.phi;
0075     *(++ptr) = jet_features.mass;
0076   }
0077 
0078   void seedTrack_tensor_filler(float*& ptr, const btagbtvdeep::SeedingTrackFeatures& seed_features) {
0079     *ptr = seed_features.pt;
0080     *(++ptr) = seed_features.eta;
0081     *(++ptr) = seed_features.phi;
0082     *(++ptr) = seed_features.mass;
0083     *(++ptr) = seed_features.dz;
0084     *(++ptr) = seed_features.dxy;
0085     *(++ptr) = seed_features.ip3D;
0086     *(++ptr) = seed_features.sip3D;
0087     *(++ptr) = seed_features.ip2D;
0088     *(++ptr) = seed_features.sip2D;
0089     *(++ptr) = seed_features.signedIp3D;
0090     *(++ptr) = seed_features.signedSip3D;
0091     *(++ptr) = seed_features.signedIp2D;
0092     *(++ptr) = seed_features.signedSip2D;
0093     *(++ptr) = seed_features.trackProbability3D;
0094     *(++ptr) = seed_features.trackProbability2D;
0095     *(++ptr) = seed_features.chi2reduced;
0096     *(++ptr) = seed_features.nPixelHits;
0097     *(++ptr) = seed_features.nHits;
0098     *(++ptr) = seed_features.jetAxisDistance;
0099     *(++ptr) = seed_features.jetAxisDlength;
0100   }
0101 
0102   void neighbourTrack_tensor_filler(float*& ptr, const btagbtvdeep::TrackPairFeatures& neighbourTrack_features) {
0103     *ptr = neighbourTrack_features.pt;
0104     *(++ptr) = neighbourTrack_features.eta;
0105     *(++ptr) = neighbourTrack_features.phi;
0106     *(++ptr) = neighbourTrack_features.dz;
0107     *(++ptr) = neighbourTrack_features.dxy;
0108     *(++ptr) = neighbourTrack_features.mass;
0109     *(++ptr) = neighbourTrack_features.ip3D;
0110     *(++ptr) = neighbourTrack_features.sip3D;
0111     *(++ptr) = neighbourTrack_features.ip2D;
0112     *(++ptr) = neighbourTrack_features.sip2D;
0113     *(++ptr) = neighbourTrack_features.distPCA;
0114     *(++ptr) = neighbourTrack_features.dsigPCA;
0115     *(++ptr) = neighbourTrack_features.x_PCAonSeed;
0116     *(++ptr) = neighbourTrack_features.y_PCAonSeed;
0117     *(++ptr) = neighbourTrack_features.z_PCAonSeed;
0118     *(++ptr) = neighbourTrack_features.xerr_PCAonSeed;
0119     *(++ptr) = neighbourTrack_features.yerr_PCAonSeed;
0120     *(++ptr) = neighbourTrack_features.zerr_PCAonSeed;
0121     *(++ptr) = neighbourTrack_features.x_PCAonTrack;
0122     *(++ptr) = neighbourTrack_features.y_PCAonTrack;
0123     *(++ptr) = neighbourTrack_features.z_PCAonTrack;
0124     *(++ptr) = neighbourTrack_features.xerr_PCAonTrack;
0125     *(++ptr) = neighbourTrack_features.yerr_PCAonTrack;
0126     *(++ptr) = neighbourTrack_features.zerr_PCAonTrack;
0127     *(++ptr) = neighbourTrack_features.dotprodTrack;
0128     *(++ptr) = neighbourTrack_features.dotprodSeed;
0129     *(++ptr) = neighbourTrack_features.dotprodTrackSeed2D;
0130     *(++ptr) = neighbourTrack_features.dotprodTrackSeed3D;
0131     *(++ptr) = neighbourTrack_features.dotprodTrackSeedVectors2D;
0132     *(++ptr) = neighbourTrack_features.dotprodTrackSeedVectors3D;
0133     *(++ptr) = neighbourTrack_features.pvd_PCAonSeed;
0134     *(++ptr) = neighbourTrack_features.pvd_PCAonTrack;
0135     *(++ptr) = neighbourTrack_features.dist_PCAjetAxis;
0136     *(++ptr) = neighbourTrack_features.dotprod_PCAjetMomenta;
0137     *(++ptr) = neighbourTrack_features.deta_PCAjetDirs;
0138     *(++ptr) = neighbourTrack_features.dphi_PCAjetDirs;
0139   }
0140 
0141 }  // namespace btagbtvdeep