From 1c23b82beaa646504f5d5241c627f636ef8e7a13 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Mon, 30 Aug 2021 19:00:40 +0800 Subject: [PATCH 1/3] Remove unused headers in DataFormats package. --- .../BTauReco/interface/PFCombinedTauTagInfo.h | 192 ------- .../BTauReco/interface/PFIsolatedTauTagInfo.h | 147 ----- DataFormats/BTauReco/interface/TrackIPData.h | 23 - DataFormats/Common/interface/NewPolicy.h | 13 - DataFormats/Common/interface/OwnArray.h | 506 ------------------ .../Common/interface/TransientDataFrame.h | 51 -- .../Common/interface/debugging_allocator.h | 80 --- DataFormats/Common/test/OwnArray_t.cpp | 188 ------- DataFormats/Common/test/testOwnArray.cc | 139 ----- .../interface/private/extTkRotation.h | 366 ------------- .../interface/private/newTkRotation.h | 366 ------------- .../GeometryVector/interface/OnePiRange.h | 133 ----- .../interface/private/extBasic2DVector.h | 264 --------- .../interface/PFClusterMETCollection.h | 23 - DataFormats/Math/interface/SSEArray.h | 111 ---- DataFormats/Math/interface/private/AVXVec.h | 187 ------- .../interface/PFBlockElementFwd.h | 15 - .../interface/PFBlockElementSuperClusterFwd.h | 11 - .../interface/PFClusterShapeAssociation.h | 31 -- .../interface/PFParticleFwd.h | 27 - .../interface/PFSuperClusterFwd.h | 27 - .../interface/PFTrajectoryPointFwd.h | 27 - .../interface/BranchDescriptionIndex.h | 31 -- .../Provenance/interface/TypeInBranchType.h | 62 --- .../RPCDigi/interface/RPCDigiL1Linkfwd.h | 4 - .../interface/PixelDigiCollectionfwd.h | 4 - .../interface/ConstantsForSummaryPlots.h | 10 - .../SiStripDigi/interface/SiStripDigifwd.h | 4 - .../interface/SiPixelRecHitfwd.h | 4 - .../interface/BasicTrajectorySeed.h | 9 - 30 files changed, 3055 deletions(-) delete mode 100644 DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h delete mode 100644 DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h delete mode 100644 DataFormats/BTauReco/interface/TrackIPData.h delete mode 100644 DataFormats/Common/interface/NewPolicy.h delete mode 100644 DataFormats/Common/interface/OwnArray.h delete mode 100644 DataFormats/Common/interface/TransientDataFrame.h delete mode 100644 DataFormats/Common/interface/debugging_allocator.h delete mode 100644 DataFormats/Common/test/OwnArray_t.cpp delete mode 100644 DataFormats/Common/test/testOwnArray.cc delete mode 100644 DataFormats/GeometrySurface/interface/private/extTkRotation.h delete mode 100644 DataFormats/GeometrySurface/interface/private/newTkRotation.h delete mode 100644 DataFormats/GeometryVector/interface/OnePiRange.h delete mode 100644 DataFormats/GeometryVector/interface/private/extBasic2DVector.h delete mode 100644 DataFormats/METReco/interface/PFClusterMETCollection.h delete mode 100644 DataFormats/Math/interface/SSEArray.h delete mode 100644 DataFormats/Math/interface/private/AVXVec.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFParticleFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h delete mode 100644 DataFormats/Provenance/interface/BranchDescriptionIndex.h delete mode 100644 DataFormats/Provenance/interface/TypeInBranchType.h delete mode 100644 DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h delete mode 100644 DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h delete mode 100644 DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h delete mode 100644 DataFormats/SiStripDigi/interface/SiStripDigifwd.h delete mode 100644 DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h delete mode 100644 DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h diff --git a/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h b/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h deleted file mode 100644 index aa7354fb2659e..0000000000000 --- a/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef DataFormats_BTauReco_PFCombinedTauTagInfo_h -#define DataFormats_BTauReco_PFCombinedTauTagInfo_h - -/* class PFCombinedTauTagInfo - * Extended object for the Particle Flow Tau Combination algorithm, - * created: Apr 21 2007, - * revised: Jun 23 2007, - * author: Ludovic Houchu. - */ - -#include -#include - -#include "DataFormats/BTauReco/interface/RefMacros.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/BTauReco/interface/BaseTagInfo.h" -#include "DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h" - - - - -namespace reco { - class PFCombinedTauTagInfo : public BaseTagInfo{ - public: - PFCombinedTauTagInfo() { - candidate_selectedByPFChargedHadrCands_=false; - electronTagged_=false; - muonTagged_=false; - PFChargedHadrCands_.clear(); - selectedPFChargedHadrCands_.clear(); - signalPFChargedHadrCands_.clear(); - isolPFChargedHadrCands_.clear(); - leadPFChargedHadrCandsignedSipt_=NAN; - leadPFChargedHadrCandsignedSip3D_=NAN; - signedSflightpath_=NAN; - PFChargedHadrCandsEtJetEtRatio_=NAN; - PFNeutrHadrCandsE_=NAN; - PFNeutrHadrCandsN_=std::numeric_limits::quiet_NaN(); - PFNeutrHadrCandsRadius_=NAN; - PFGammaCandsE_=NAN; - isolPFGammaCandsE_=NAN; - PFGammaCandsN_=std::numeric_limits::quiet_NaN(); - PFGammaCandsRadius_=NAN; - PFGammaCandsEJetalternatERatio_=NAN; - isolPFGammaCandsEJetalternatERatio_=NAN; - PFGammaCandsERatio_=NAN; - alternatLorentzVect_.SetPx(NAN); - alternatLorentzVect_.SetPy(NAN); - alternatLorentzVect_.SetPz(NAN); - alternatLorentzVect_.SetE(NAN); - ECALEtleadPFChargedHadrCandPtRatio_=NAN; - HCALEtleadPFChargedHadrCandPtRatio_=NAN; - } - virtual ~PFCombinedTauTagInfo() {}; - - //the reference to the PFJet; - const PFJetRef& pfjetRef()const{return PFJetRef_;} - void setpfjetRef(const PFJetRef x){PFJetRef_=x;} - - //the reference to the PFIsolatedTauTagInfo; - const PFIsolatedTauTagInfoRef& isolatedtautaginfoRef()const{return PFIsolatedTauTagInfoRef_;} - void setisolatedtautaginfoRef(const PFIsolatedTauTagInfoRef x) {PFIsolatedTauTagInfoRef_=x;} - - //the PF charged hadron candidates contained in the PF Jet; - const PFCandidateRefVector& PFChargedHadrCands()const{return PFChargedHadrCands_;} - void setPFChargedHadrCands(const PFCandidateRefVector& x) {PFChargedHadrCands_=x;} - - //the PF charged hadron candidates considered in the isolation strip and signal cone selections; - const PFCandidateRefVector& selectedPFChargedHadrCands()const{return selectedPFChargedHadrCands_;} - void setselectedPFChargedHadrCands(const PFCandidateRefVector& x) {selectedPFChargedHadrCands_=x;} - - //the PF charged hadron candidates inside signal cone; - const PFCandidateRefVector& signalPFChargedHadrCands()const{return signalPFChargedHadrCands_;} - void setsignalPFChargedHadrCands(const PFCandidateRefVector& x) {signalPFChargedHadrCands_=x;} - - //the PF charged hadron candidates inside isolation band; - const PFCandidateRefVector& isolPFChargedHadrCands()const{return isolPFChargedHadrCands_;} - void setisolPFChargedHadrCands(const PFCandidateRefVector& x) {isolPFChargedHadrCands_=x;} - - virtual PFCombinedTauTagInfo* clone() const{return new PFCombinedTauTagInfo(*this );} - - // float JetTag::discriminator() returns 0. if candidate did not pass PF charged hadron candidates selection, - // 1. if candidate passed PF charged hadron candidates selection and did not contain PF gamma candidate(s), - // 0<= <=1 if candidate passed PF charged hadron candidates selection, contained PF gamma candidate(s) and went through the likelihood ratio mechanism, - // NaN the values of the likelihood functions PDFs are 0 (test the result of discriminator() with bool isnan(.)); - //computed with the parameters taken from the RecoTauTag/PFCombinedTauTag/data/ .cfi files - - bool selectedByPFChargedHadrCands()const{return(candidate_selectedByPFChargedHadrCands_);} - void setselectedByPFChargedHadrCands(bool x){candidate_selectedByPFChargedHadrCands_=x;} - - bool electronTagged()const{return(electronTagged_);} // true : passed PF charged hadron candidates sel., contains 1 signal charged hadron candidate, e-identified through (ECALEtleadPFChargedHadrCandPtRatio(),HCALEtleadPFChargedHadrCandPtRatio()) space; - void setelectronTagged(bool x){electronTagged_=x;} - - bool muonTagged()const{return(muonTagged_);} // true : passed PF charged hadron candidates sel., contains 1 signal charged hadron candidate, mu-identified through (ECALEtleadPFChargedHadrCandPtRatio(),HCALEtleadPFChargedHadrCandPtRatio()) space; - void setmuonTagged(bool x){muonTagged_=x;} - - double leadPFChargedHadrCandsignedSipt()const{return (leadPFChargedHadrCandsignedSipt_);} // NaN : failure; - void setleadPFChargedHadrCandsignedSipt(double x){leadPFChargedHadrCandsignedSipt_=x;} - - double leadPFChargedHadrCandsignedSip3D()const{return(leadPFChargedHadrCandsignedSip3D_);} // NaN : failure; - void setleadPFChargedHadrCandsignedSip3D(double x){leadPFChargedHadrCandsignedSip3D_=x;} - - double signedSflightpath()const{return (signedSflightpath_);} // NaN : failure, did not build a SV.; - void setsignedSflightpath(double x){signedSflightpath_=x;} - - // Et_PFchargedhadrcands/Etjet; - double PFChargedHadrCandsEtJetEtRatio()const{return(PFChargedHadrCandsEtJetEtRatio_);} - void setPFChargedHadrCandsEtJetEtRatio(double x){PFChargedHadrCandsEtJetEtRatio_=x;} - - // PF neutral hadron candidates E sum; - double PFNeutrHadrCandsE()const{return(PFNeutrHadrCandsE_);} - void setPFNeutrHadrCandsE(double x){PFNeutrHadrCandsE_=x;} - - int PFNeutrHadrCandsN()const{return(PFNeutrHadrCandsN_);} - void setPFNeutrHadrCandsN(int x){PFNeutrHadrCandsN_=x;} - - //mean DR_PFNeutrHadrcands-lead.PFcand.; - double PFNeutrHadrCandsRadius()const{return(PFNeutrHadrCandsRadius_);} // NaN : PFNeutrHadrCandsN()=0; - void setPFNeutrHadrCandsRadius(double x){PFNeutrHadrCandsRadius_=x;} - - // PF gamma candidates E sum; - double PFGammaCandsE()const{return(PFGammaCandsE_);} - void setPFGammaCandsE(double x){PFGammaCandsE_=x;} - - // isol. band PF gamma candidates E sum; - double isolPFGammaCandsE()const{return(isolPFGammaCandsE_);} - void setisolPFGammaCandsE(double x){isolPFGammaCandsE_=x;} - - int PFGammaCandsN()const{return(PFGammaCandsN_);} - void setPFGammaCandsN(int x){PFGammaCandsN_=x;} - - //mean DR_PFgammacands-lead.PFcand.; - double PFGammaCandsRadius()const{return(PFGammaCandsRadius_);} // NaN : PFGammaCandsN()=0; - void setPFGammaCandsRadius(double x){PFGammaCandsRadius_=x;} - - // E_PFgammacands / (E_PFgammacands + E_PFchargedhadrcands); - double PFGammaCandsEJetalternatERatio()const{return(PFGammaCandsEJetalternatERatio_);} - void setPFGammaCandsEJetalternatERatio(double x){PFGammaCandsEJetalternatERatio_=x;} - - // E_PFgammacands,isol.band / (E_PFgammacands + E_PFchargedhadrcands); - double isolPFGammaCandsEJetalternatERatio()const{return(isolPFGammaCandsEJetalternatERatio_);} - void setisolPFGammaCandsEJetalternatERatio(double x){isolPFGammaCandsEJetalternatERatio_=x;} - - // E_PFgammacands,isol.band / E_PFgammacands; - double PFGammaCandsERatio()const{return(PFGammaCandsERatio_);} // NaN : PFGammaCandsN()=0; - void setPFGammaCandsERatio(double x){PFGammaCandsERatio_=x;} - - math::XYZTLorentzVector alternatLorentzVect()const{return(alternatLorentzVect_);} // rec. charged hadr. candidates + rec. gamma candidates combined; - void setalternatLorentzVect(math::XYZTLorentzVector x){alternatLorentzVect_=x;} - - // EtECAL*/Pt_lead.PFcand. *using ECAL cell hits inside a DR cone around lead. charged hadr. candidate ECAL impact point direction; - double ECALEtleadPFChargedHadrCandPtRatio()const{return(ECALEtleadPFChargedHadrCandPtRatio_);} // NaN : failure when trying to find the lead. charged hadr. candidate contact on ECAL surface point; - void setECALEtleadPFChargedHadrCandPtRatio(double x){ECALEtleadPFChargedHadrCandPtRatio_=x;} - - // EtHCAL**/Pt_lead.PFcand.; **using HCAL tower hits inside a DR cone around lead. charged hadr. candidate ECAL impact point direction; - double HCALEtleadPFChargedHadrCandPtRatio()const{return(HCALEtleadPFChargedHadrCandPtRatio_);} // NaN : failure when trying to find the lead. charged hadr. candidate contact on ECAL surface point; - void setHCALEtleadPFChargedHadrCandPtRatio(double x){HCALEtleadPFChargedHadrCandPtRatio_=x;} - private: - PFJetRef PFJetRef_; - PFIsolatedTauTagInfoRef PFIsolatedTauTagInfoRef_; - PFCandidateRefVector PFChargedHadrCands_; - PFCandidateRefVector selectedPFChargedHadrCands_; - PFCandidateRefVector signalPFChargedHadrCands_; - PFCandidateRefVector isolPFChargedHadrCands_; - bool candidate_selectedByPFChargedHadrCands_; - bool electronTagged_; - bool muonTagged_; - double leadPFChargedHadrCandsignedSipt_; - double leadPFChargedHadrCandsignedSip3D_; - double signedSflightpath_; - double PFChargedHadrCandsEtJetEtRatio_; - double PFNeutrHadrCandsE_; - int PFNeutrHadrCandsN_; - double PFNeutrHadrCandsRadius_; - double PFGammaCandsE_; - double isolPFGammaCandsE_; - int PFGammaCandsN_; - double PFGammaCandsRadius_; - double PFGammaCandsEJetalternatERatio_; - double isolPFGammaCandsEJetalternatERatio_; - double PFGammaCandsERatio_; - math::XYZTLorentzVector alternatLorentzVect_; - double ECALEtleadPFChargedHadrCandPtRatio_; - double HCALEtleadPFChargedHadrCandPtRatio_; - }; - - DECLARE_EDM_REFS( PFCombinedTauTagInfo ) - -} - -#endif // DataFormats_BTauReco_PFCombinedTauTagInfo_h diff --git a/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h b/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h deleted file mode 100644 index 1a279e21e2ee3..0000000000000 --- a/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef DataFormats_BTauReco_PFIsolatedTauTagInfo_h -#define DataFormats_BTauReco_PFIsolatedTauTagInfo_h - -/* class PFIsolatedTauTagInfo - * Extended object for the Particle Flow Tau Isolation algorithm, - * contains the result and the methods used in the PFConeIsolation Algorithm - * created: Apr 21 2007, - * revised: Jun 23 2007, - * authors: Simone Gennai, Ludovic Houchu - */ - -#include - -#include "DataFormats/BTauReco/interface/RefMacros.h" - -#include "Math/GenVector/PxPyPzE4D.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" -#include "DataFormats/BTauReco/interface/BaseTagInfo.h" - - - - - - -const int PFChargedHadrCand_codenumber=1; -const int PFNeutrHadrCand_codenumber=5; -const int PFGammaCand_codenumber=4; - -const int PFRecTrack_codenumber=1; -const int PFRecECALClus_codenumber=4; -const int PFRecHCALClus_codenumber=5; - -namespace reco{ - class PFIsolatedTauTagInfo : public BaseTagInfo{ - public: - PFIsolatedTauTagInfo() {} - PFIsolatedTauTagInfo(PFCandidateRefVector PFCands){ - initialPFCands_=PFCands; - PFCands_=PFCands; - for(PFCandidateRefVector::const_iterator iPFCand=PFCands_.begin();iPFCand!=PFCands_.end();iPFCand++){ - if ((**iPFCand).particleId()==PFChargedHadrCand_codenumber) initialPFChargedHadrCands_.push_back(*iPFCand); - if ((**iPFCand).particleId()==PFNeutrHadrCand_codenumber) initialPFNeutrHadrCands_.push_back(*iPFCand); - if ((**iPFCand).particleId()==PFGammaCand_codenumber) initialPFGammaCands_.push_back(*iPFCand); - } - PFChargedHadrCands_=initialPFChargedHadrCands_; - PFNeutrHadrCands_=initialPFNeutrHadrCands_; - PFGammaCands_=initialPFGammaCands_; - alternatLorentzVect_.SetPx(NAN); - alternatLorentzVect_.SetPy(NAN); - alternatLorentzVect_.SetPz(NAN); - alternatLorentzVect_.SetE(NAN); - passedtrackerisolation_=false; - passedECALisolation_=false; - } - virtual ~PFIsolatedTauTagInfo(){}; - virtual PFIsolatedTauTagInfo* clone()const{return new PFIsolatedTauTagInfo(*this);} - - //get the PFCandidates's which compose the PF jet and may be have been filtered by filterPFChargedHadrCands(.,.,.,.,.,.), filterPFNeutrHadrCands(.), filterPFGammaCands(.) member functions - const PFCandidateRefVector& PFCands() const {return PFCands_;} - const PFCandidateRefVector& PFChargedHadrCands() const {return PFChargedHadrCands_;} - const PFCandidateRefVector& PFNeutrHadrCands() const {return PFNeutrHadrCands_;} - const PFCandidateRefVector& PFGammaCands() const {return PFGammaCands_;} - - // rec. jet Lorentz-vector combining charged hadr. PFCandidate's and gamma PFCandidate's - math::XYZTLorentzVector alternatLorentzVect()const{return(alternatLorentzVect_);} - void setalternatLorentzVect(math::XYZTLorentzVector x){alternatLorentzVect_=x;} - - //the reference to the PFJet - const PFJetRef& pfjetRef()const{return PFJetRef_;} - void setpfjetRef(const PFJetRef x){PFJetRef_=x;} - - //JetTag::discriminator() computed with the parameters taken from the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - - // true if a lead. PFCandidate exists and no charged hadron PFCandidate was found in an DR isolation ring around it (DR isolation ring limits defined in the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - bool passedtrackerisolation()const{return passedtrackerisolation_;} - void setpassedtrackerisolation(bool x){passedtrackerisolation_=x;} - - // true if a lead. PFCandidate exists and no gamma PFCandidate was found in an DR isolation ring around it (DR isolation ring limits defined in the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - bool passedECALisolation()const{return passedECALisolation_;} - void setpassedECALisolation(bool x){passedECALisolation_=x;} - - //methods to be used to recompute the isolation with a new set of parameters - double discriminatorByIsolPFCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFChargedHadrCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFChargedHadrCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFNeutrHadrCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFNeutrHadrCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFGammaCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFGammaCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFChargedHadrCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFChargedHadrCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFNeutrHadrCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFNeutrHadrCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFGammaCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFGammaCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - - // return all PFCandidate's in a cone of size "conesize" around a direction "myVector" - const PFCandidateRefVector PFCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFChargedHadrCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFNeutrHadrCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFGammaCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - - // return all PFCandidate's in a band defined by inner(size "innercone_size") and outer(size "outercone_size") cones around a direction "myVector" - const PFCandidateRefVector PFCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFChargedHadrCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFNeutrHadrCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFGammaCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - - //return the leading PFCandidate in a given cone around the jet axis or a given direction - const PFCandidateRef leadPFCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFChargedHadrCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFChargedHadrCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFNeutrHadrCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFNeutrHadrCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFGammaCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFGammaCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - - void filterPFChargedHadrCands(double ChargedHadrCand_tkminPt,int ChargedHadrCand_tkminPixelHitsn,int ChargedHadrCand_tkminTrackerHitsn,double ChargedHadrCand_tkmaxipt,double ChargedHadrCand_tkmaxChi2,double ChargedHadrCand_tktorefpointDZ,bool UsePVconstraint,double PVtx_Z,bool UseOnlyChargedHadr_for_LeadCand,double LeadChargedHadrCandtoJet_MatchingConeSize,double LeadChargedHadrCand_minPt); - void filterPFNeutrHadrCands(double NeutrHadrCand_HcalclusminEt); - void filterPFGammaCands(double GammaCand_EcalclusminEt); - void removefilters(); - private: - PFJetRef PFJetRef_; - PFCandidateRefVector initialPFCands_; - PFCandidateRefVector PFCands_; - PFCandidateRefVector initialPFChargedHadrCands_; - PFCandidateRefVector PFChargedHadrCands_; - PFCandidateRefVector initialPFNeutrHadrCands_; - PFCandidateRefVector PFNeutrHadrCands_; - PFCandidateRefVector initialPFGammaCands_; - PFCandidateRefVector PFGammaCands_; - math::XYZTLorentzVector alternatLorentzVect_; - bool passedtrackerisolation_; - bool passedECALisolation_; - }; - - DECLARE_EDM_REFS( PFIsolatedTauTagInfo ) - -} - -#endif // DataFormats_BTauReco_PFIsolatedTauTagInfo_h diff --git a/DataFormats/BTauReco/interface/TrackIPData.h b/DataFormats/BTauReco/interface/TrackIPData.h deleted file mode 100644 index 4ac87ce7eb346..0000000000000 --- a/DataFormats/BTauReco/interface/TrackIPData.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef TrackIPData_h -#define TrackIPData_h - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" -#include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h" - -#include "DataFormats/JetReco/interface/JetTracksAssociation.h" - -namespace reco { - - -struct TrackIPData -{ - Measurement1D impactParameter3D; - Measurement1D impactParameter2D; - //float decayLen; - //float decayLenError; -}; - -} -#endif - diff --git a/DataFormats/Common/interface/NewPolicy.h b/DataFormats/Common/interface/NewPolicy.h deleted file mode 100644 index d66ae410ee192..0000000000000 --- a/DataFormats/Common/interface/NewPolicy.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef DataFormats_Common_NewPolicy_h -#define DataFormats_Common_NewPolicy_h - -namespace edm { - template - struct NewPolicy{ - static T * clone(const T & t) { - return new T(t); - } - }; -} - -#endif diff --git a/DataFormats/Common/interface/OwnArray.h b/DataFormats/Common/interface/OwnArray.h deleted file mode 100644 index 73976f87bf97e..0000000000000 --- a/DataFormats/Common/interface/OwnArray.h +++ /dev/null @@ -1,506 +0,0 @@ -#ifndef DataFormats_Common_OwnArray_h -#define DataFormats_Common_OwnArray_h - -#include "DataFormats/Common/interface/CMS_CLASS_VERSION.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/fillPtrVector.h" -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/setPtr.h" -#include "DataFormats/Common/interface/traits.h" - -#if defined CMS_USE_DEBUGGING_ALLOCATOR -#include "DataFormats/Common/interface/debugging_allocator.h" -#endif -#include "FWCore/Utilities/interface/EDMException.h" - -#include -#include -#include -#include - -namespace edm { - class ProductID; - template > - class OwnArray { - private: - typedef OwnArray self; - typedef std::vector base; - public: - typedef unsigned int size_type; - typedef T value_type; - typedef T* pointer; - typedef T& reference; - typedef T const& const_reference; - typedef P policy_type; - - class iterator; - class const_iterator { - public: - typedef T value_type; - typedef T* pointer; - typedef T const& reference; - typedef ptrdiff_t difference_type; - typedef typename base::const_iterator::iterator_category iterator_category; - const_iterator(pointer const * it) : i(it) { } - const_iterator(iterator const& it) : i(it.i) { } - const_iterator() {} - const_iterator& operator++() { ++i; return *this; } - const_iterator operator++(int) { const_iterator ci = *this; ++i; return ci; } - const_iterator& operator--() { --i; return *this; } - const_iterator operator--(int) { const_iterator ci = *this; --i; return ci; } - difference_type operator-(const_iterator const& o) const { return i - o.i; } - const_iterator operator+(difference_type n) const { return const_iterator(i + n); } - const_iterator operator-(difference_type n) const { return const_iterator(i - n); } - bool operator<(const_iterator const& o) const { return i < o.i; } - bool operator==(const_iterator const& ci) const { return i == ci.i; } - bool operator!=(const_iterator const& ci) const { return i != ci.i; } - T const& operator *() const { return **i; } - // operator T const*() const { return & **i; } - T const* operator->() const { return & (operator*()); } - const_iterator & operator +=(difference_type d) { i += d; return *this; } - const_iterator & operator -=(difference_type d) { i -= d; return *this; } - reference operator[](difference_type d) const { return *const_iterator(i+d); } // for boost::iterator_range [] - private: - pointer const * i; - }; - class iterator { - public: - typedef T value_type; - typedef T * pointer; - typedef T & reference; - typedef ptrdiff_t difference_type; - typedef typename base::iterator::iterator_category iterator_category; - iterator(pointer * it) : i(it) { } - iterator() {} - iterator& operator++() { ++i; return *this; } - iterator operator++(int) { iterator ci = *this; ++i; return ci; } - iterator& operator--() { --i; return *this; } - iterator operator--(int) { iterator ci = *this; --i; return ci; } - difference_type operator-(iterator const& o) const { return i - o.i; } - iterator operator+(difference_type n) const { return iterator(i + n); } - iterator operator-(difference_type n) const { return iterator(i - n); } - bool operator<(iterator const& o) const { return i < o.i; } - bool operator==(iterator const& ci) const { return i == ci.i; } - bool operator!=(iterator const& ci) const { return i != ci.i; } - T & operator *() const { return **i; } - // operator T *() const { return & **i; } - //T *& get() { return *i; } - T * operator->() const { return & (operator*()); } - iterator & operator +=(difference_type d) { i += d; return *this; } - iterator & operator -=(difference_type d) { i -= d; return *this; } - reference operator[](difference_type d) const { return *iterator(i+d); } // for boost::iterator_range [] - private: - pointer * i; - friend class const_iterator; - friend class OwnArray; - }; - - - OwnArray(); - OwnArray(size_type); - OwnArray(OwnArray const&); -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - OwnArray(OwnArray&&); -#endif - - ~OwnArray(); - - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - size_type size() const; - bool empty() const; - reference operator[](size_type); - const_reference operator[](size_type) const; - - self& operator=(self const&); -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - self& operator=(self&&); -#endif - - - void reserve(size_t){} - size_type capacity() const { return MAX_SIZE;} - template void push_back(D*& d); - template void push_back(D* const& d); - template void push_back(std::unique_ptr d); - void push_back(T const& valueToCopy); - bool is_back_safe() const; - void pop_back(); - reference back(); - const_reference back() const; - reference front(); - const_reference front() const; - pointer const * data() const; - void clear(); - iterator erase(iterator pos); - iterator erase(iterator first, iterator last); - template - void sort(S s); - void sort(); - - void swap(self& other); - - void fillView(ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) const; - - void setPtr(std::type_info const& toType, - unsigned long index, - void const*& ptr) const; - - void fillPtrVector(std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) const; - - - //Used by ROOT storage - CMS_CLASS_VERSION(11) - - private: - void destroy(); - template - struct Ordering { - Ordering(O const& c) : comp(c) { } - bool operator()(T const* t1, T const* t2) const { - return comp(*t1, *t2); - } - private: - O comp; - }; - template - static Ordering ordering(O const& comp) { - return Ordering(comp); - } - pointer data_[MAX_SIZE]; - size_type size_; - }; - - template - inline OwnArray::OwnArray() : data_{{0}}, size_(0) { - } - - template - inline OwnArray::OwnArray(size_type n) : data_{{0}}, size_(n) { - } - - template - inline OwnArray::OwnArray(OwnArray const& o) : size_(o.size()) { - size_type current = 0; - for (const_iterator i = o.begin(), e = o.end(); i != e; ++i,++current) - data_[current] = policy_type::clone(*i); - } - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - template - inline OwnArray::OwnArray(OwnArray&& o) { - std::swap_ranges(data_,data_+M, o.data_); - } -#endif - - template - inline OwnArray::~OwnArray() { - destroy(); - } - - template - inline OwnArray& OwnArray::operator=(OwnArray const& o) { - OwnArray temp(o); - swap(temp); - return *this; - } - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - template - inline OwnArray& OwnArray::operator=(OwnArray&& o) { - std::swap_ranges(data_,data_+M, o.data_); - return *this; - } -#endif - - - template - inline typename OwnArray::iterator OwnArray::begin() { - return iterator(data_); - } - - template - inline typename OwnArray::iterator OwnArray::end() { - return iterator(data_+size()); - } - - template - inline typename OwnArray::const_iterator OwnArray::begin() const { - return const_iterator(data_); - } - - template - inline typename OwnArray::const_iterator OwnArray::end() const { - return const_iterator(data_+size()); - } - - template - inline typename OwnArray::size_type OwnArray::size() const { - return size_; - } - - template - inline bool OwnArray::empty() const { - return 0==size_; - } - - template - inline typename OwnArray::reference OwnArray::operator[](size_type n) { - return *data_[n]; - } - - template - inline typename OwnArray::const_reference OwnArray::operator[](size_type n) const { - return *data_[n]; - } - - template - template - inline void OwnArray::push_back(D*& d) { - // C++ does not yet support rvalue references, so d should only be - // able to bind to an lvalue. - // This should be called only for lvalues. - data_[size_++]=d; - d = 0; - } - - template - template - inline void OwnArray::push_back(D* const& d) { - - // C++ allows d to be bound to an lvalue or rvalue. But the other - // signature should be a better match for an lvalue (because it - // does not require an lvalue->rvalue conversion). Thus this - // signature should only be chosen for rvalues. - data_[size_++]=d; - } - - - template - template - inline void OwnArray::push_back(std::unique_ptr d) { - data_[size_++]=d.release(); - } - - - template - inline void OwnArray::push_back(T const& d) { - data_[size_++]=policy_type::clone(d); - } - - - template - inline void OwnArray::pop_back() { - // We have to delete the pointed-to thing, before we squeeze it - // out of the vector... - delete data_[--size_]; - } - - template - inline bool OwnArray::is_back_safe() const { - return data_[size_-1] != 0; - } - - template - inline typename OwnArray::reference OwnArray::back() { - pointer result = data_[size_-1]; - if (result == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n" - "Since OwnArray is allowed to contain null pointers, you much assure that the\n" - "pointer at the end of the collection is not null before calling back()\n" - "if you wish to avoid this exception.\n" - "Consider using OwnArray::is_back_safe()\n"); - } - return *result; - } - - template - inline typename OwnArray::const_reference OwnArray::back() const { - pointer const * result = data_[size_-1]; - if (result == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n" - "Since OwnArray is allowed to contain null pointers, you much assure that the\n" - "pointer at the end of the collection is not null before calling back()\n" - "if you wish to avoid this exception.\n" - "Consider using OwnArray::is_back_safe()\n"); - } - return *result; - } - - template - inline typename OwnArray::reference OwnArray::front() { - return *data_[0]; - } - - template - inline typename OwnArray::const_reference OwnArray::front() const { - return *data_[0]; - } - - template - inline void OwnArray::destroy() { - pointer * b = data_, * e = data_+size(); - for(pointer * i = b; i != e; ++ i) - delete * i; - } - - template - inline typename OwnArray::pointer const * OwnArray::data() const { - return data_; - } - - template - inline void OwnArray::clear() { - destroy(); - size_=0; - } - - template - typename OwnArray::iterator OwnArray::erase(iterator pos) { - pointer * b = pos.i; - delete *b; - pointer * e = data_+size(); - for(pointer * i = b; i != e-1; ++ i) *i = *(i+1); - size_--; - return iterator(b); - } - - template - typename OwnArray::iterator OwnArray::erase(iterator first, iterator last) { - pointer * b = first.i, * e = last.i; - for(pointer * i = b; i != e; ++ i) delete * i; - pointer * l = data_+size(); - auto ib=b; - for(pointer * i = e; i != l; ++i) *(ib++) = *i; - size_ -= (e-b); - return iterator(b); - } - - template template - void OwnArray::sort(S comp) { - std::sort(data_, data_+size(), ordering(comp)); - } - - template - void OwnArray::sort() { - std::sort(data_, data_+size(), ordering(std::less())); - } - - template - inline void OwnArray::swap(OwnArray& other) { - std::swap_ranges(data_,data_+M, other.data_); - } - - template - void OwnArray::fillView(ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) const { - typedef Ref ref_type ; - typedef reftobase::RefHolder holder_type; - - size_type numElements = this->size(); - pointers.reserve(numElements); - helpers.reserve(numElements); - size_type key = 0; - for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) { - - if (*i == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::fillView() we have intercepted an attempt to put a null pointer\n" - "into a View and that is not allowed. It is probably an error that the null\n" - "pointer was in the OwnArray in the first place.\n"); - } - else { - pointers.push_back(*i); - holder_type h(ref_type(id, *i, key,this)); - helpers.push_back(&h); - } - } - } - - template - inline void swap(OwnArray& a, OwnArray& b) { - a.swap(b); - } - - //---------------------------------------------------------------------- - // - // Free function template to support creation of Views. - - template - inline - void - fillView(OwnArray const& obj, - ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) { - obj.fillView(id, pointers, helpers); - } - - - template - struct has_fillView > { - static bool const value = true; - }; - - - // Free function templates to support the use of edm::Ptr. - - template - inline - void - OwnArray::setPtr(std::type_info const& toType, - unsigned long index, - void const*& ptr) const { - detail::reallySetPtr >(*this, toType, index, ptr); - } - - template - inline - void - setPtr(OwnArray const& obj, - std::type_info const& toType, - unsigned long index, - void const*& ptr) { - obj.setPtr(toType, index, ptr); - } - - template - inline - void - OwnArray::fillPtrVector(std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) const { - detail::reallyfillPtrVector(*this, toType, indices, ptrs); - } - - - template - inline - void - fillPtrVector(OwnArray const& obj, - std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) { - obj.fillPtrVector(toType, indices, ptrs); - } - - - template - struct has_setPtr > { - static bool const value = true; - }; - - -} - - -#endif diff --git a/DataFormats/Common/interface/TransientDataFrame.h b/DataFormats/Common/interface/TransientDataFrame.h deleted file mode 100644 index bc77c8df6cb16..0000000000000 --- a/DataFormats/Common/interface/TransientDataFrame.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef DataFormats_Common_TransientDataFrame_h -#define DataFormats_Common_TransientDataFrame_h - -#include "DataFormats/Common/interface/DataFrame.h" -#include - -namespace edm { - - /* a fixed size array of 16bit words belonging to - * a "channel" identified by an 32bit id - * - * FIXME interface to be finalized once use-cases fully identified - * - */ - template - class TransientDataFrame { - public: - - typedef DataFrame::data_type data_type; - typedef DataFrame::id_type id_type; - - TransientDataFrame() {} - TransientDataFrame( id_type i) : m_id(i) {} - TransientDataFrame(DataFrame const & iframe) : - m_id(iframe.id()) - { - data_type const * p = iframe.begin(); - std::copy(p,p+SIZE,m_data); - } - - int size() const { return SIZE;} - - data_type operator[](size_t i) const { - return m_data[i]; - } - - data_type & operator[](size_t i) { - return m_data[i]; - } - - id_type id() const { return m_id; } - - private: - id_type m_id; - data_type m_data[SIZE]; - - }; - -} - -#endif // DataFormats_Common_TransientDataFrame_h diff --git a/DataFormats/Common/interface/debugging_allocator.h b/DataFormats/Common/interface/debugging_allocator.h deleted file mode 100644 index 528386613f77b..0000000000000 --- a/DataFormats/Common/interface/debugging_allocator.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef DataFormatsCommonDebuggingAllocator -#define DataFormatsCommonDebuggingAllocator - -//--------------------------------------------------------------------- -// -// This file declares and defines an allocator class template. -// This allocator is intended for use with the memory checking tool -// valgrind. It is a minimum conformant implementation which makes sure -// not use use any unitialized memory, and so it causes no spurious error -// reports from valgrind. -// -// The intended use is in the declarations of objects from STL templates, -// e.g. -// typedef vector > vint; -// etc. -// -//--------------------------------------------------------------------- - -#include -#include - -namespace edm -{ - template - class debugging_allocator - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T const* const_pointer; - typedef T& reference; - typedef T const& const_reference; - typedef T value_type; - - template struct rebind { typedef debugging_allocator other; }; - - - debugging_allocator() noexcept : dummy('x') { } - - debugging_allocator(debugging_allocator const&) noexcept : dummy('c') { } - - template debugging_allocator(debugging_allocator const&) noexcept : dummy('u') { } - - ~debugging_allocator() noexcept { }; - - pointer address(reference value) const {return &value;} - - const_pointer address(const_reference value) const {return &value; } - - size_type max_size() const noexcept { return std::numeric_limits::max()/sizeof(T); } - - pointer allocate(size_type num, void const* hint = 0) - { - // allocate objects with global new - return (pointer)(::operator new(num*sizeof(T))); - } - - void construct(pointer p, T const& value) { new((void*)p)T(value); } - - void destroy(pointer p) { p->~T(); } - - void deallocate(pointer p, size_type num) { ::operator delete((void*)p); } - - private: - char dummy; - - }; - - // instances of all specializations of this allocator are equal - template - bool operator== (debugging_allocator const&, debugging_allocator const&) noexcept { return true; } - - template - bool operator!= (debugging_allocator const&, debugging_allocator const&) noexcept { return false; } - -} //namespace edm - - -#endif diff --git a/DataFormats/Common/test/OwnArray_t.cpp b/DataFormats/Common/test/OwnArray_t.cpp deleted file mode 100644 index 14afce3c5f1d7..0000000000000 --- a/DataFormats/Common/test/OwnArray_t.cpp +++ /dev/null @@ -1,188 +0,0 @@ -#include -#include -#include - -#include "DataFormats/Common/interface/OwnArray.h" -#include "FWCore/Utilities/interface/propagate_const.h" - - -struct Base -{ - virtual ~Base(); - virtual Base* clone() const = 0; -}; - -Base::~Base() {} - -struct Derived : Base -{ - explicit Derived(int n); - Derived(Derived const& other); - Derived& operator=(Derived const& other); - virtual ~Derived(); - void swap(Derived& other); - virtual Derived* clone() const; - - edm::propagate_const pointer; -}; - -Derived::Derived(int n) : pointer(new int(n)) { } - -Derived::Derived(Derived const& other) : pointer(new int(*other.pointer)) { } - -Derived& Derived::operator=(Derived const& other) -{ - Derived temp(other); - swap(temp); - return *this; -} - -void Derived::swap(Derived& other) -{ - std::swap(pointer, other.pointer); -} - -void swap(Derived& a, Derived& b) -{ - a.swap(b); -} - -Derived::~Derived() -{ - delete pointer.get(); -} - -Derived* -Derived::clone() const -{ - return new Derived(*this); -} - - - -void same_guy_twice() -{ - edm::OwnArray vec; - Base* p = new Derived(1); - - vec.push_back(p); - vec.push_back(p); -} - -void two_different_owners() -{ - edm::OwnArray v1,v2; - Base* p = new Derived(1); - v1.push_back(p); - v2.push_back(p); -} - -// void guy_on_stack() -// { -// edm::OwnArray v; -// Derived d(10); -// v.push_back(&d); -// } - -void copy_good_vec() -{ - // v1 is perfectly fine... - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - //v1.push_back(new Derived(100)); - - // But what if we copy him? - edm::OwnArray v2(v1); -} - -void assign_to_other() -{ - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - - edm::OwnArray v2; - v2 = v1; -} - -void assign_to_self() -{ - // Self-assignment happens, often by accident... - edm::OwnArray v1; - v1.push_back(new Derived(100)); - v1 = v1; -} - -void pop_one() -{ - edm::OwnArray v1; - v1.push_back(new Derived(100)); - v1.pop_back(); -} - -void back_with_null_pointer() -{ - edm::OwnArray v; - Base* p = 0; - v.push_back(p); - try - { - v.back(); - assert("Failed to throw a required exception in OwnArray_t"==0); - } - catch (edm::Exception& x) - { - // this is expected. - } - catch (...) - { - throw; - } -} - -void take_an_rvalue() -{ - edm::OwnArray v; - v.push_back(new Derived(101)); - Derived d(102); - v.push_back(d.clone()); -} - -void take_an_lvalue() -{ - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - - assert(p == 0); -} - -void take_an_auto_ptr() -{ - edm::OwnArray v1; - std::unique_ptr p = std::make_unique(100); - v1.push_back(p); - assert(p.get() == 0); -} - -int main() -{ - edm::OwnArray vec; - vec.push_back(new Derived(100)); - edm::OwnArray* p = new edm::OwnArray; - p->push_back(new Derived(2)); - delete p; - // same_guy_twice(); - // two_different_owners(); - // guy_on_stack(); - copy_good_vec(); - assign_to_other(); - assign_to_self(); - pop_one(); - back_with_null_pointer(); - - take_an_rvalue(); - take_an_lvalue(); - take_an_auto_ptr(); -} diff --git a/DataFormats/Common/test/testOwnArray.cc b/DataFormats/Common/test/testOwnArray.cc deleted file mode 100644 index 498a76f77e4ad..0000000000000 --- a/DataFormats/Common/test/testOwnArray.cc +++ /dev/null @@ -1,139 +0,0 @@ -// -#include "cppunit/extensions/HelperMacros.h" -#include -#include -#include -#include "DataFormats/Common/interface/OwnArray.h" -#include "FWCore/Utilities/interface/propagate_const.h" - -class testOwnArray : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(testOwnArray); - CPPUNIT_TEST(checkAll); - CPPUNIT_TEST_SUITE_END(); -public: - void setUp() {} - void tearDown() {} - void checkAll(); -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(testOwnArray); - -namespace testOA { - struct Dummy { - Dummy(int n, bool * r) : value(n), ref(r) { } - ~Dummy() { * ref = true; } - int value; - bool operator<(const Dummy & o) const { - return value < o.value; - } - private: - edm::propagate_const ref; - }; - - struct DummyComp { - bool operator()(const Dummy& d1, const Dummy& d2) const { - return d1.value < d2.value; - } - }; - - class a { - public: - virtual ~a() {} - virtual int f() const = 0; - }; - - class ClassB : public a { - public: - ClassB(int i) : ii(i) {memset(&waste, 0, sizeof(waste));} - virtual ~ClassB() {} - virtual int f() const { return ii; } - int ii; - private: - char waste[1024*1024]; - }; - - class ss { - public: - bool operator() (const a & a1, const a & a2) const { - return (a1.f() > a2.f()); - } - }; - - inline std::ostream& operator<<(std::ostream& os, const a & aa) { - os << aa.f(); - return os; - } -} - -void testOwnArray::checkAll() { - edm::OwnArray v; - CPPUNIT_ASSERT(v.size() == 0); - CPPUNIT_ASSERT(v.empty()); - bool deleted[4] = { false, false, false, false }; - v.push_back(new testOA::Dummy(0, deleted + 0)); - v.push_back(new testOA::Dummy(1, deleted + 1)); - v.push_back(new testOA::Dummy(2, deleted + 2)); - v.push_back(new testOA::Dummy(3, deleted + 3)); - CPPUNIT_ASSERT(v.size() == 4); - auto i = v.begin(); - auto ci = i; - * ci; - v.sort(); - v.sort(testOA::DummyComp()); - CPPUNIT_ASSERT(!v.empty()); - CPPUNIT_ASSERT(v[0].value == 0); - CPPUNIT_ASSERT(v[1].value == 1); - CPPUNIT_ASSERT(v[2].value == 2); - CPPUNIT_ASSERT(v[3].value == 3); - i = v.begin() + 1; - v.erase( i ); - CPPUNIT_ASSERT(!deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(!deleted[2]); - CPPUNIT_ASSERT(!deleted[3]); - CPPUNIT_ASSERT(v.size() == 3); - CPPUNIT_ASSERT(v[0].value == 0); - CPPUNIT_ASSERT(v[1].value == 2); - CPPUNIT_ASSERT(v[2].value == 3); - auto b = v.begin(), e = b + 1; - v.erase(b, e); - CPPUNIT_ASSERT(v.size() == 2); - CPPUNIT_ASSERT(deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(!deleted[2]); - CPPUNIT_ASSERT(!deleted[3]); - v.clear(); - CPPUNIT_ASSERT(v.size() == 0); - CPPUNIT_ASSERT(v.empty()); - CPPUNIT_ASSERT(deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(deleted[2]); - CPPUNIT_ASSERT(deleted[3]); - { - edm::OwnArray v; - testOA::a * aa = new testOA::ClassB(2); - v.push_back(aa); - aa = new testOA::ClassB(1); - v.push_back(aa); - aa = new testOA::ClassB(3); - v.push_back(aa); - v.sort(testOA::ss()); - std::cout << "OwnArray : dumping contents" << std::endl; - std::copy(v.begin(), - v.end(), - std::ostream_iterator(std::cout, "\t")); - - edm::Ptr ptr_v; - unsigned long index(0); - void const * data = &v[0]; - v.setPtr( typeid(testOA::a), index, data ); - testOA::a const * data_a = static_cast(data); - testOA::ClassB const * data_b = dynamic_cast(data_a); - CPPUNIT_ASSERT( data != 0); - CPPUNIT_ASSERT( data_a != 0); - CPPUNIT_ASSERT( data_b != 0); - if(data_b != 0) { // To silence Coverity - CPPUNIT_ASSERT( data_b->f() == 3); - } - } -} diff --git a/DataFormats/GeometrySurface/interface/private/extTkRotation.h b/DataFormats/GeometrySurface/interface/private/extTkRotation.h deleted file mode 100644 index f1c2aa2a67aeb..0000000000000 --- a/DataFormats/GeometrySurface/interface/private/extTkRotation.h +++ /dev/null @@ -1,366 +0,0 @@ -#ifndef Geom_newTkRotation_H -#define Geom_newTkRotation_H - -#include "DataFormats/GeometryVector/interface/Basic2DVector.h" -#include "DataFormats/GeometryVector/interface/Basic3DVector.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" - -#include "DataFormats/Math/interface/ExtVec.h" - - -#include - -template class TkRotation; -template class TkRotation2D; - -template -std::ostream & operator<<( std::ostream& s, const TkRotation& r); -template -std::ostream & operator<<( std::ostream& s, const TkRotation2D& r); - -namespace geometryDetails { - void TkRotationErr1(); - void TkRotationErr2(); - -} - - -/** Rotaion matrix used by Surface. - */ - -template -class TkRotation { -public: - - typedef Vector3DBase< T, GlobalTag> GlobalVector; - typedef Basic3DVector BasicVector; - - TkRotation( ){} - TkRotation( Rot3 const & irot ) : rot(irot){} - - TkRotation( T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : - rot(xx,xy,xz, yx,yy,yz, zx, zy,zz){} - - TkRotation( const T* p) : - rot(p[0],p[1],p[2], - p[3],p[4],p[5], - p[6],p[7],p[8]) {} - - TkRotation( const GlobalVector & aX, const GlobalVector & aY) { - - GlobalVector uX = aX.unit(); - GlobalVector uY = aY.unit(); - GlobalVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - - } - - TkRotation( const BasicVector & aX, const BasicVector & aY) { - - BasicVector uX = aX.unit(); - BasicVector uY = aY.unit(); - BasicVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - - } - - - /** Construct from global vectors of the x, y and z axes. - * The axes are assumed to be unit vectors forming - * a right-handed orthonormal basis. No checks are performed! - */ - TkRotation( const GlobalVector & uX, const GlobalVector & uY, - const GlobalVector & uZ) { - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - } - - TkRotation( const BasicVector & uX, const BasicVector & uY, - const BasicVector & uZ) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - } - - - /** rotation around abritrary axis by the amount of phi: - * its constructed by O^-1(z<->axis) rot_z(phi) O(z<->axis) - * the frame is rotated such that the z-asis corresponds to the rotation - * axis desired. THen it's rotated round the "new" z-axis, and then - * the initial transformation is "taken back" again. - * unfortuately I'm too stupid to describe such thing directly by 3 Euler - * angles.. hence I have to construckt it this way...by brute force - */ - TkRotation( const Basic3DVector& axis, T phi) : - rot( cos(phi), sin(phi), 0, - -sin(phi), cos(phi), 0, - 0, 0, 1) { - - //rotation around the z-axis by phi - TkRotation tmpRotz ( cos(axis.phi()), sin(axis.phi()), 0., - -sin(axis.phi()), cos(axis.phi()), 0., - 0., 0., 1. ); - //rotation around y-axis by theta - TkRotation tmpRoty ( cos(axis.theta()), 0.,-sin(axis.theta()), - 0., 1., 0., - sin(axis.theta()), 0., cos(axis.theta()) ); - (*this)*=tmpRoty; - (*this)*=tmpRotz; // = this * tmpRoty * tmpRotz - - // (tmpRoty * tmpRotz)^-1 * this * tmpRoty * tmpRotz - - *this = (tmpRoty*tmpRotz).multiplyInverse(*this); - - } - /* this is the same thing...derived from the CLHEP ... it gives the - same results MODULO the sign of the rotation.... but I don't want - that... had - TkRotation (const Basic3DVector& axis, float phi) { - T cx = axis.x(); - T cy = axis.y(); - T cz = axis.z(); - - T ll = axis.mag(); - if (ll == 0) { - geometryDetails::TkRotationErr1(); - }else{ - - float cosa = cos(phi), sina = sin(phi); - cx /= ll; cy /= ll; cz /= ll; - - R11 = cosa + (1-cosa)*cx*cx; - R12 = (1-cosa)*cx*cy - sina*cz; - R13 = (1-cosa)*cx*cz + sina*cy; - - R21 = (1-cosa)*cy*cx + sina*cz; - R22 = cosa + (1-cosa)*cy*cy; - R23 = (1-cosa)*cy*cz - sina*cx; - - R31 = (1-cosa)*cz*cx - sina*cy; - R32 = (1-cosa)*cz*cy + sina*cx; - R33 = cosa + (1-cosa)*cz*cz; - - } - - } - */ - - template - TkRotation( const TkRotation& a) : - rot (a.xx(), a.xy(), a.xz(), - a.yx(), a.yy(), a.yz(), - a.zx(), a.zy(), a.zz()) {} - - TkRotation transposed() const { - return rot.transpose(); - } - - Basic3DVector rotate( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector rotateBack( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - - Basic3DVector operator*( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - template - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y() + zx()*v.z(), - xy()*v.x() + yy()*v.y() + zy()*v.z(), - xz()*v.x() + yz()*v.y() + zz()*v.z()); - } - - Basic3DVector operator*( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + xy()*v.y(), - yx()*v.x() + yy()*v.y(), - zx()*v.x() + zy()*v.y()); - } - Basic3DVector multiplyInverse( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y(), - xy()*v.x() + yy()*v.y(), - xz()*v.x() + yz()*v.y()); - } - - - - TkRotation operator*( const TkRotation& b) const { - return rot*b.rot; - } - TkRotation multiplyInverse( const TkRotation& b) const { - return rot.transpose()*b.rot; - } - - TkRotation& operator*=( const TkRotation& b) { - return *this = operator * (b); - } - - // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; - TkRotation& transform(const TkRotation& b) { - return *this = b.operator * (*this); - } - - TkRotation & rotateAxes(const Basic3DVector& newX, - const Basic3DVector& newY, - const Basic3DVector& newZ) { - T del = 0.001; - - if ( - - // the check for right-handedness is not needed since - // we want to change the handedness when it's left in cmsim - // - // fabs(newZ.x()-w.x()) > del || - // fabs(newZ.y()-w.y()) > del || - // fabs(newZ.z()-w.z()) > del || - fabs(newX.mag2()-1.) > del || - fabs(newY.mag2()-1.) > del || - fabs(newZ.mag2()-1.) > del || - fabs(newX.dot(newY)) > del || - fabs(newY.dot(newZ)) > del || - fabs(newZ.dot(newX)) > del) { - geometryDetails::TkRotationErr2(); - return *this; - } else { - return transform(TkRotation(newX.x(), newY.x(), newZ.x(), - newX.y(), newY.y(), newZ.y(), - newX.z(), newY.z(), newZ.z())); - } - } - - - Basic3DVector x() const { return rot.axis[0];} - Basic3DVector y() const { return rot.axis[1];} - Basic3DVector z() const { return rot.axis[2];} - - T xx() const { return rot.axis[0][0];} - T xy() const { return rot.axis[0][1];} - T xz() const { return rot.axis[0][2];} - T yx() const { return rot.axis[1][0];} - T yy() const { return rot.axis[1][1];} - T yz() const { return rot.axis[1][2];} - T zx() const { return rot.axis[2][0];} - T zy() const { return rot.axis[2][1];} - T zz() const { return rot.axis[2][2];} - -private: - - Rot3 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - - -template -inline Basic3DVector operator*( const TkRotation& r, const Basic3DVector& v) { - return Basic3DVector( r.xx()*v.x() + r.xy()*v.y() + r.xz()*v.z(), - r.yx()*v.x() + r.yy()*v.y() + r.yz()*v.z(), - r.zx()*v.x() + r.zy()*v.y() + r.zz()*v.z()); -} - -template -inline TkRotation::Type> -operator*( const TkRotation& a, const TkRotation& b) { - typedef TkRotation::Type> RT; - return RT( a.xx()*b.xx() + a.xy()*b.yx() + a.xz()*b.zx(), - a.xx()*b.xy() + a.xy()*b.yy() + a.xz()*b.zy(), - a.xx()*b.xz() + a.xy()*b.yz() + a.xz()*b.zz(), - a.yx()*b.xx() + a.yy()*b.yx() + a.yz()*b.zx(), - a.yx()*b.xy() + a.yy()*b.yy() + a.yz()*b.zy(), - a.yx()*b.xz() + a.yy()*b.yz() + a.yz()*b.zz(), - a.zx()*b.xx() + a.zy()*b.yx() + a.zz()*b.zx(), - a.zx()*b.xy() + a.zy()*b.yy() + a.zz()*b.zy(), - a.zx()*b.xz() + a.zy()*b.yz() + a.zz()*b.zz()); -} - - -template -class TkRotation2D { -public: - - typedef Basic2DVector BasicVector; - - TkRotation2D( ){} - TkRotation2D( Rot2 const & irot ) : rot(irot){} - - TkRotation2D( T xx, T xy, T yx, T yy) : - rot(xx,xy, yx,yy){} - - TkRotation2D( const T* p) : - rot(p[0],p[1], - p[2],p[3]) {} - - TkRotation2D( const BasicVector & aX) { - - BasicVector uX = aX.unit(); - BasicVector uY(-uX.y(),uX.x()); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - - } - - - TkRotation2D( const BasicVector & uX, const BasicVector & uY) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - } - - BasicVector x() const { return rot.axis[0];} - BasicVector y() const { return rot.axis[1];} - - - TkRotation2D transposed() const { - return rot.transpose(); - } - - BasicVector rotate( const BasicVector& v) const { - return rot.rotate(v.v); - } - - BasicVector rotateBack( const BasicVector& v) const { - return rot.rotateBack(v.v); - } - - - - private: - - Rot2 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - - -#endif - - - - diff --git a/DataFormats/GeometrySurface/interface/private/newTkRotation.h b/DataFormats/GeometrySurface/interface/private/newTkRotation.h deleted file mode 100644 index f12a7b1ebe118..0000000000000 --- a/DataFormats/GeometrySurface/interface/private/newTkRotation.h +++ /dev/null @@ -1,366 +0,0 @@ -#ifndef Geom_newTkRotation_H -#define Geom_newTkRotation_H - -#include "DataFormats/GeometryVector/interface/Basic2DVector.h" -#include "DataFormats/GeometryVector/interface/Basic3DVector.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" - -#include "DataFormats/Math/interface/SSERot.h" - - -#include - -template class TkRotation; -template class TkRotation2D; - -template -std::ostream & operator<<( std::ostream& s, const TkRotation& r); -template -std::ostream & operator<<( std::ostream& s, const TkRotation2D& r); - -namespace geometryDetails { - void TkRotationErr1(); - void TkRotationErr2(); - -} - - -/** Rotaion matrix used by Surface. - */ - -template -class TkRotation { -public: - - typedef Vector3DBase< T, GlobalTag> GlobalVector; - typedef Basic3DVector BasicVector; - - TkRotation( ){} - TkRotation( mathSSE::Rot3 const & irot ) : rot(irot){} - - TkRotation( T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : - rot(xx,xy,xz, yx,yy,yz, zx, zy,zz){} - - TkRotation( const T* p) : - rot(p[0],p[1],p[2], - p[3],p[4],p[5], - p[6],p[7],p[8]) {} - - TkRotation( const GlobalVector & aX, const GlobalVector & aY) { - - GlobalVector uX = aX.unit(); - GlobalVector uY = aY.unit(); - GlobalVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - - } - - TkRotation( const BasicVector & aX, const BasicVector & aY) { - - BasicVector uX = aX.unit(); - BasicVector uY = aY.unit(); - BasicVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - - } - - - /** Construct from global vectors of the x, y and z axes. - * The axes are assumed to be unit vectors forming - * a right-handed orthonormal basis. No checks are performed! - */ - TkRotation( const GlobalVector & uX, const GlobalVector & uY, - const GlobalVector & uZ) { - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - } - - TkRotation( const BasicVector & uX, const BasicVector & uY, - const BasicVector & uZ) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - } - - - /** rotation around abritrary axis by the amount of phi: - * its constructed by O^-1(z<->axis) rot_z(phi) O(z<->axis) - * the frame is rotated such that the z-asis corresponds to the rotation - * axis desired. THen it's rotated round the "new" z-axis, and then - * the initial transformation is "taken back" again. - * unfortuately I'm too stupid to describe such thing directly by 3 Euler - * angles.. hence I have to construckt it this way...by brute force - */ - TkRotation( const Basic3DVector& axis, T phi) : - rot( cos(phi), sin(phi), 0, - -sin(phi), cos(phi), 0, - 0, 0, 1) { - - //rotation around the z-axis by phi - TkRotation tmpRotz ( cos(axis.phi()), sin(axis.phi()), 0., - -sin(axis.phi()), cos(axis.phi()), 0., - 0., 0., 1. ); - //rotation around y-axis by theta - TkRotation tmpRoty ( cos(axis.theta()), 0.,-sin(axis.theta()), - 0., 1., 0., - sin(axis.theta()), 0., cos(axis.theta()) ); - (*this)*=tmpRoty; - (*this)*=tmpRotz; // = this * tmpRoty * tmpRotz - - // (tmpRoty * tmpRotz)^-1 * this * tmpRoty * tmpRotz - - *this = (tmpRoty*tmpRotz).multiplyInverse(*this); - - } - /* this is the same thing...derived from the CLHEP ... it gives the - same results MODULO the sign of the rotation.... but I don't want - that... had - TkRotation (const Basic3DVector& axis, float phi) { - T cx = axis.x(); - T cy = axis.y(); - T cz = axis.z(); - - T ll = axis.mag(); - if (ll == 0) { - geometryDetails::TkRotationErr1(); - }else{ - - float cosa = cos(phi), sina = sin(phi); - cx /= ll; cy /= ll; cz /= ll; - - R11 = cosa + (1-cosa)*cx*cx; - R12 = (1-cosa)*cx*cy - sina*cz; - R13 = (1-cosa)*cx*cz + sina*cy; - - R21 = (1-cosa)*cy*cx + sina*cz; - R22 = cosa + (1-cosa)*cy*cy; - R23 = (1-cosa)*cy*cz - sina*cx; - - R31 = (1-cosa)*cz*cx - sina*cy; - R32 = (1-cosa)*cz*cy + sina*cx; - R33 = cosa + (1-cosa)*cz*cz; - - } - - } - */ - - template - TkRotation( const TkRotation& a) : - rot (a.xx(), a.xy(), a.xz(), - a.yx(), a.yy(), a.yz(), - a.zx(), a.zy(), a.zz()) {} - - TkRotation transposed() const { - return rot.transpose(); - } - - Basic3DVector rotate( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector rotateBack( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - - Basic3DVector operator*( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - template - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y() + zx()*v.z(), - xy()*v.x() + yy()*v.y() + zy()*v.z(), - xz()*v.x() + yz()*v.y() + zz()*v.z()); - } - - Basic3DVector operator*( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + xy()*v.y(), - yx()*v.x() + yy()*v.y(), - zx()*v.x() + zy()*v.y()); - } - Basic3DVector multiplyInverse( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y(), - xy()*v.x() + yy()*v.y(), - xz()*v.x() + yz()*v.y()); - } - - - - TkRotation operator*( const TkRotation& b) const { - return rot*b.rot; - } - TkRotation multiplyInverse( const TkRotation& b) const { - return rot.transpose()*b.rot; - } - - TkRotation& operator*=( const TkRotation& b) { - return *this = operator * (b); - } - - // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; - TkRotation& transform(const TkRotation& b) { - return *this = b.operator * (*this); - } - - TkRotation & rotateAxes(const Basic3DVector& newX, - const Basic3DVector& newY, - const Basic3DVector& newZ) { - T del = 0.001; - - if ( - - // the check for right-handedness is not needed since - // we want to change the handedness when it's left in cmsim - // - // fabs(newZ.x()-w.x()) > del || - // fabs(newZ.y()-w.y()) > del || - // fabs(newZ.z()-w.z()) > del || - fabs(newX.mag2()-1.) > del || - fabs(newY.mag2()-1.) > del || - fabs(newZ.mag2()-1.) > del || - fabs(newX.dot(newY)) > del || - fabs(newY.dot(newZ)) > del || - fabs(newZ.dot(newX)) > del) { - geometryDetails::TkRotationErr2(); - return *this; - } else { - return transform(TkRotation(newX.x(), newY.x(), newZ.x(), - newX.y(), newY.y(), newZ.y(), - newX.z(), newY.z(), newZ.z())); - } - } - - - Basic3DVector x() const { return rot.axis[0];} - Basic3DVector y() const { return rot.axis[1];} - Basic3DVector z() const { return rot.axis[2];} - - T xx() const { return rot.axis[0].arr[0];} - T xy() const { return rot.axis[0].arr[1];} - T xz() const { return rot.axis[0].arr[2];} - T yx() const { return rot.axis[1].arr[0];} - T yy() const { return rot.axis[1].arr[1];} - T yz() const { return rot.axis[1].arr[2];} - T zx() const { return rot.axis[2].arr[0];} - T zy() const { return rot.axis[2].arr[1];} - T zz() const { return rot.axis[2].arr[2];} - -private: - - mathSSE::Rot3 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - - -template -inline Basic3DVector operator*( const TkRotation& r, const Basic3DVector& v) { - return Basic3DVector( r.xx()*v.x() + r.xy()*v.y() + r.xz()*v.z(), - r.yx()*v.x() + r.yy()*v.y() + r.yz()*v.z(), - r.zx()*v.x() + r.zy()*v.y() + r.zz()*v.z()); -} - -template -inline TkRotation::Type> -operator*( const TkRotation& a, const TkRotation& b) { - typedef TkRotation::Type> RT; - return RT( a.xx()*b.xx() + a.xy()*b.yx() + a.xz()*b.zx(), - a.xx()*b.xy() + a.xy()*b.yy() + a.xz()*b.zy(), - a.xx()*b.xz() + a.xy()*b.yz() + a.xz()*b.zz(), - a.yx()*b.xx() + a.yy()*b.yx() + a.yz()*b.zx(), - a.yx()*b.xy() + a.yy()*b.yy() + a.yz()*b.zy(), - a.yx()*b.xz() + a.yy()*b.yz() + a.yz()*b.zz(), - a.zx()*b.xx() + a.zy()*b.yx() + a.zz()*b.zx(), - a.zx()*b.xy() + a.zy()*b.yy() + a.zz()*b.zy(), - a.zx()*b.xz() + a.zy()*b.yz() + a.zz()*b.zz()); -} - - -template -class TkRotation2D { -public: - - typedef Basic2DVector BasicVector; - - TkRotation2D( ){} - TkRotation2D( mathSSE::Rot2 const & irot ) : rot(irot){} - - TkRotation2D( T xx, T xy, T yx, T yy) : - rot(xx,xy, yx,yy){} - - TkRotation2D( const T* p) : - rot(p[0],p[1], - p[2],p[3]) {} - - TkRotation2D( const BasicVector & aX) { - - BasicVector uX = aX.unit(); - BasicVector uY(-uX.y(),uX.x()); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - - } - - - TkRotation2D( const BasicVector & uX, const BasicVector & uY) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - } - - BasicVector x() const { return rot.axis[0];} - BasicVector y() const { return rot.axis[1];} - - - TkRotation2D transposed() const { - return rot.transpose(); - } - - BasicVector rotate( const BasicVector& v) const { - return rot.rotate(v.v); - } - - BasicVector rotateBack( const BasicVector& v) const { - return rot.rotateBack(v.v); - } - - - - private: - - mathSSE::Rot2 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - - -#endif - - - - diff --git a/DataFormats/GeometryVector/interface/OnePiRange.h b/DataFormats/GeometryVector/interface/OnePiRange.h deleted file mode 100644 index 1983da64af506..0000000000000 --- a/DataFormats/GeometryVector/interface/OnePiRange.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef GeometryVector_Geom_OnePiRange_h -#define GeometryVector_Geom_OnePiRange_h - -#include -#include - -namespace Geom { - -/** \class OnePiRange - * A class for polar angle represantation. - * The use of OnePiRange is tranparant due to the implicit conversion to T - * Constructs like cos(theta) work as with float or double. - * The difference with respect to built-in types is that - * OnePiRange is kept in the range [0, pi], and this is consistently - * implemented in aritmetic operations. In other words, OnePiRange implements - * "modulo(pi)" arithmetics. - */ - - template - class OnePiRange { - public: - - /// Default constructor does not initialise - just as double. - OnePiRange() {} - - /// Constructor from T, does not provide automatic conversion. - explicit OnePiRange( const T& val) : theValue(val) { normalize(); } - - /// conversion operator makes transparent use possible. - operator T() const { return theValue;} - - /// Template argument conversion - template operator OnePiRange() { return OnePiRange(theValue);} - - /// Explicit access to value in case implicit conversion not OK - T value() const { return theValue;} - - // Standard arithmetics - OnePiRange& operator+=(const T& a) {theValue+=a; normalize(); return *this;} - OnePiRange& operator+=(const OnePiRange& a) {return operator+=(a.value());} - - OnePiRange& operator-=(const T& a) {theValue-=a; normalize(); return *this;} - OnePiRange& operator-=(const OnePiRange& a) {return operator-=(a.value());} - - OnePiRange& operator*=(const T& a) {theValue*=a; normalize(); return *this;} - - OnePiRange& operator/=(const T& a) {theValue/=a; normalize(); return *this;} - - T degrees() const { return theValue*180./pi();} - - /// Return the pseudorapidity. - // No need to handle 0 or pi; in this case "inf" is returned. - T eta() const { return -log(tan(theValue/2.)); } - - - private: - - T theValue; - - void normalize() { - if( theValue > (T) pi() || theValue < 0) { - theValue = fmod( theValue, (T) pi()); - } - if (theValue < 0.) theValue += pi(); - } - - }; - - /// - operator - template - inline OnePiRange operator-(const OnePiRange& a) {return OnePiRange(-a.value());} - - - /// Addition - template - inline OnePiRange operator+(const OnePiRange& a, const OnePiRange& b) { - return OnePiRange(a) += b; - } - /// Addition with scalar, does not change the precision - template - inline OnePiRange operator+(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) += b; - } - /// Addition with scalar, does not change the precision - template - inline OnePiRange operator+(const Scalar& a, const OnePiRange& b) { - return OnePiRange(b) += a; - } - - /// Subtraction - template - inline OnePiRange operator-(const OnePiRange& a, const OnePiRange& b) { - return OnePiRange(a) -= b; - } - - /// Subtraction with scalar, does not change the precision - template - inline OnePiRange operator-(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) -= b; - } - - /// Subtraction with scalar, does not change the precision - template - inline OnePiRange operator-(const Scalar& a, const OnePiRange& b) { - return OnePiRange(a - b.value()); // use of unary operators would normalize twice - } - - /// Multiplication with scalar, does not change the precision - template - inline OnePiRange operator*(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) *= b; - } - - /// Multiplication with scalar - template - inline OnePiRange operator*(double a, const OnePiRange& b) { - return OnePiRange(b) *= a; - } - - /// Division - template - inline T operator/(const OnePiRange& a, const OnePiRange& b) { - return a.value() / b.value(); - } - - /// Division by scalar - template - inline OnePiRange operator/(const OnePiRange& a, double b) { - return OnePiRange(a) /= b; - } - -} -#endif diff --git a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h deleted file mode 100644 index 7d6a871576de7..0000000000000 --- a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h +++ /dev/null @@ -1,264 +0,0 @@ -#ifndef GeometryVector_newBasic2DVector_h -#define GeometryVector_newBasic2DVector_h - -#include "DataFormats/GeometryVector/interface/Phi.h" -#include "DataFormats/GeometryVector/interface/PreciseFloatType.h" -#include "DataFormats/GeometryVector/interface/CoordinateSets.h" -#include "DataFormats/Math/interface/ExtVec.h" - - -#include -#include - - -template < class T> -class Basic2DVector { -public: - - typedef T ScalarType; - typedef Vec2 VectorType; - typedef Vec2 MathVector; - typedef Geom::Polar2Cartesian Polar; - - /** default constructor uses default constructor of T to initialize the - * components. For built-in floating-point types this means initialization - * to zero - */ - Basic2DVector() : v{0,0} {} - - /// Copy constructor from same type. Should not be needed but for gcc bug 12685 - Basic2DVector( const Basic2DVector & p) : v(p.v) {} - - template - Basic2DVector( const Basic2DVector & p) : v{T(p.v[0]),T(p.v[1])} {} - - - /** Explicit constructor from other (possibly unrelated) vector classes - * The only constraint on the argument type is that it has methods - * x() and y(), and that these methods return a type convertible to T. - * Examples of use are - *
construction from a Basic2DVector with different precision - *
construction from a coordinate system converter - */ - template - explicit Basic2DVector( const Other& p) : v{T(p.x()),T(p.y())} {} - - /// construct from cartesian coordinates - Basic2DVector( const T& x, const T& y) : v{x,y} {} - - // constructor from Vec2 or vec4 - Basic2DVector(MathVector const& iv) : v(iv){} - template - Basic2DVector(Vec2 const& iv) : v{iv[0],iv[1]}{} - template - Basic2DVector(Vec4 const& iv) : v{iv[0],iv[1]}{} - - MathVector const & mathVector() const { return v;} - MathVector & mathVector() { return v;} - - T operator[](int i) const { return v[i];} - T & operator[](int i) { return v[i];} - - - /// Cartesian x coordinate - T x() const { return v[0];} - - /// Cartesian y coordinate - T y() const { return v[1];} - - /// The vector magnitude squared. Equivalent to vec.dot(vec) - T mag2() const { return ::dot(v,v);} - - /// The vector magnitude. Equivalent to sqrt(vec.mag2()) - T mag() const { return std::sqrt( mag2());} - - /// Radius, same as mag() - T r() const { return mag();} - - /** Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. - * Same precision as the system atan2(x,y) function. - * The return type is Geom::Phi, see it's documentation. - */ - T barePhi() const {return std::atan2(y(),x());} - Geom::Phi phi() const {return Geom::Phi(atan2(y(),x()));} - - /** Unit vector parallel to this. - * If mag() is zero, a zero vector is returned. - */ - Basic2DVector unit() const { - T my_mag = mag(); - return my_mag == 0 ? *this : *this / my_mag; - } - - /** Operator += with a Basic2DVector of possibly different precision. - */ - template - Basic2DVector& operator+= ( const Basic2DVector& p) { - v = v + p.v; - return *this; - } - - /** Operator -= with a Basic2DVector of possibly different precision. - */ - template - Basic2DVector& operator-= ( const Basic2DVector& p) { - v = v - p.v; - return *this; - } - - /// Unary minus, returns a vector with components (-x(),-y(),-z()) - Basic2DVector operator-() const { return Basic2DVector(-v);} - - /// Scaling by a scalar value (multiplication) - Basic2DVector& operator*= ( T t) { - v = v*t; - return *this; - } - - /// Scaling by a scalar value (division) - Basic2DVector& operator/= ( T t) { - t = T(1)/t; - v = v*t; - return *this; - } - - /// Scalar product, or "dot" product, with a vector of same type. - T dot( const Basic2DVector& lh) const { return ::dot(v,lh.v);} - - /** Scalar (or dot) product with a vector of different precision. - * The product is computed without loss of precision. The type - * of the returned scalar is the more precise of the scalar types - * of the two vectors. - */ - template - typename PreciseFloatType::Type dot( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .dot(Basic2DVector::Type>(lh)); - } - - /// Vector product, or "cross" product, with a vector of same type. - T cross( const Basic2DVector& lh) const { return ::cross2(v,lh.v);} - - /** Vector (or cross) product with a vector of different precision. - * The product is computed without loss of precision. The type - * of the returned scalar is the more precise of the scalar types - * of the two vectors. - */ - template - typename PreciseFloatType::Type cross( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .cross(Basic2DVector::Type>(lh)); - } - - -public: - - Vec2 v; - -}; - - -namespace geometryDetails { - std::ostream & print2D(std::ostream& s, double x, double y); - -} - -/// simple text output to standard streams -template -inline std::ostream & operator<<( std::ostream& s, const Basic2DVector& v) { - return geometryDetails::print2D(s, v.x(),v.y()); -} - - -/// vector sum and subtraction of vectors of possibly different precision -template -inline Basic2DVector -operator+( const Basic2DVector& a, const Basic2DVector& b) { - return a.v+b.v; -} -template -inline Basic2DVector -operator-( const Basic2DVector& a, const Basic2DVector& b) { - return a.v-b.v; -} - -template -inline Basic2DVector::Type> -operator+( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; - return RT(a) + RT(b); -} - -template -inline Basic2DVector::Type> -operator-( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; - return RT(a)-RT(b); -} - - - - -// scalar product of vectors of same precision -template -inline T operator*( const Basic2DVector& v1, const Basic2DVector& v2) { - return v1.dot(v2); -} - -/// scalar product of vectors of different precision -template -inline typename PreciseFloatType::Type operator*( const Basic2DVector& v1, - const Basic2DVector& v2) { - return v1.dot(v2); -} - - -/** Multiplication by scalar, does not change the precision of the vector. - * The return type is the same as the type of the vector argument. - */ -template -inline Basic2DVector operator*( const Basic2DVector& v, T t) { - return v.v*t; -} - -/// Same as operator*( Vector, Scalar) -template -inline Basic2DVector operator*(T t, const Basic2DVector& v) { - return v.v*t; -} - - - -template -inline Basic2DVector operator*( const Basic2DVector& v, const Scalar& s) { - T t = static_cast(s); - return v*t; -} - -/// Same as operator*( Vector, Scalar) -template -inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { - T t = static_cast(s); - return v*t; -} - -/** Division by scalar, does not change the precision of the vector. - * The return type is the same as the type of the vector argument. - */ -template -inline Basic2DVector operator/(const Basic2DVector& v, T t) { - return v.v/t; -} - -template -inline Basic2DVector operator/( const Basic2DVector& v, const Scalar& s) { - // T t = static_cast(Scalar(1)/s); return v*t; - T t = static_cast(s); - return v/t; -} - -typedef Basic2DVector Basic2DVectorF; -typedef Basic2DVector Basic2DVectorD; - - -#endif // GeometryVector_Basic2DVector_h diff --git a/DataFormats/METReco/interface/PFClusterMETCollection.h b/DataFormats/METReco/interface/PFClusterMETCollection.h deleted file mode 100644 index 1a02b783450ae..0000000000000 --- a/DataFormats/METReco/interface/PFClusterMETCollection.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef METRECO_PFClusterMETCOLLECTION_H -#define METRECO_PFClusterMETCOLLECTION_H - -/** \class PFClusterMETCollection - * - * \short Collection of PFCluster MET - * - * PFClusterMETCollection is a collection of PFClusterMET objects - * - * \author Salvatore Rappoccio, JHU - * - * \version 1st Version Dec, 2010 - * - ************************************************************/ - -#include -#include "DataFormats/METReco/interface/PFClusterMETFwd.h" - -namespace reco -{ - typedef std::vector PFClusterMETCollection; -} -#endif // METRECO_PFClusterMETCOLLECTION_H diff --git a/DataFormats/Math/interface/SSEArray.h b/DataFormats/Math/interface/SSEArray.h deleted file mode 100644 index 778100e291007..0000000000000 --- a/DataFormats/Math/interface/SSEArray.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef DataFormat_Math_SSEArray_H -#define DataFormat_Math_SSEArray_H - - -#include "DataFormats/Math/interface/SSEVec.h" -#include - -#ifdef CMS_USE_SSE -namespace mathSSE { - -// "vertical array" - template - struct ArrayTraits { - }; - - template - struct ArrayMask { - }; - - //FIXME avoid punning... - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0x0, 0x0, 0x0); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0x0, 0x0); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0xffffffff, 0x0); - return v; - } - }; - - template <> - struct ArrayMask { - static inline Vec2 value() { - Vec2 v; v.setMask(0xffffffffffffffffLL, 0xffffffffffffffffLL); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec2 value() { - Vec2 v; v.setMask(0xffffffffffffffffLL, 0x0LL); - return v; - } - }; - - - template - struct ArrayTraits { - typedef float Scalar; - typedef Vec4 Vec; - static const size_t size = S; - static const size_t ssesize = (S+3)/4; - static const size_t arrsize = 4*ssesize; - static inline Vec maskLast() { return ArrayMask::value(); } - static inline Vec __attribute__((__always_inline__)) mask(Vec v, size_t i) { - return (i==ssesize-1) ? maskLast()&v : v; - } - template - static void loop(F f) { - for (size_t i=0; i!=ssesize-1;++i) - f(i, ArrayMask::value()); - f(ssesize-1,maskLast()); - } - }; - - template - struct ArrayTraits { - typedef double Scalar; - typedef Vec2 Vec; - static const size_t size = S; - static const size_t ssesize = (S+1)/2; - static const size_t arrsize = 2*ssesize; - static inline Vec maskLast() { return ArrayMask::value();} - }; - - template - union Array { - typedef ArrayTraits Traits; - typedef typename Traits::Vec Vec; - typename Vec::nativeType vec[Traits::ssesize]; - T __attribute__ ((aligned(16))) arr[Traits::arrsize]; - - Vec operator[]( size_t i) { return vec[i];} - Vec const & operator[]( size_t i) const{ return reinterpret_cast(vec[i]);} - - }; - - -} - -#endif // CMS_USE_SSE -#endif // DataFormat_Math_SSEArray_H diff --git a/DataFormats/Math/interface/private/AVXVec.h b/DataFormats/Math/interface/private/AVXVec.h deleted file mode 100644 index 9fe33e8c3d1fd..0000000000000 --- a/DataFormats/Math/interface/private/AVXVec.h +++ /dev/null @@ -1,187 +0,0 @@ -#ifndef DataFormat_Math_AVXVec_H -#define DataFormat_Math_AVXVec_H - -// in principle it should not be used alone -// only as part of SSEVec -namespace mathSSE { - - template<> - union Vec4 { - typedef __m256d nativeType; - __m256d vec; - double __attribute__ ((aligned(32))) arr[4]; - OldVec o; - - Vec4(__m256d ivec) : vec(ivec) {} - - Vec4(OldVec const & ivec) : o(ivec) {} - - Vec4() { - vec = _mm256_setzero_pd(); - } - - - inline Vec4(Vec4 ivec) { - vec = _mm256_cvtps_pd(ivec.vec); - } - - explicit Vec4(double f1) { - set1(f1); - } - - Vec4(double f1, double f2, double f3, double f4=0) { - arr[0] = f1; arr[1] = f2; arr[2] = f3; arr[3]=f4; - } - - - Vec4( Vec2 ivec0, Vec2 ivec1) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - vec = _mm256_insertf128_pd(vec,ivec1.vec,1); - - } - - Vec4( Vec2 ivec0, double f3, double f4=0) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - arr[2] = f3; arr[3] = f4; - } - - Vec4( Vec2 ivec0) { - vec = _mm256_setzero_pd(); - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - } - - - // for masking - void setMask(unsigned int m1, unsigned int m2, unsigned int m3, unsigned int m4) { - Mask4 mask(m1,m2,m3,m4); vec=mask.vec; - } - - void set(double f1, double f2, double f3, double f4=0) { - vec = _mm256_set_pd(f4, f3, f2, f1); - } - - void set1(double f1) { - vec = _mm256_set1_pd(f1); - } - - template - Vec4 get1() const { - return _mm256_set1_pd(arr[N]); //FIXME - } - /* - Vec4 get1(unsigned int n) const { - return _mm256_set1_pd(arr[n]); //FIXME - } - */ - double & operator[](unsigned int n) { - return arr[n]; - } - - double operator[](unsigned int n) const { - return arr[n]; - } - - Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec));} - Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec,vec,1)));} - - }; - - inline Vec4::Vec4(Vec4 ivec) { - vec = _mm256_cvtpd_ps(ivec.vec); - } -} // namespace mathSSE - - - -inline bool operator==(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_movemask_pd(_mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS))==0xf; -} - -inline mathSSE::Vec4 cmpeq(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS); -} - -inline mathSSE::Vec4 cmpgt(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_GT_OS); -} - -inline mathSSE::Vec4 hadd(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_hadd_pd(a.vec,b.vec); -} - - - -inline mathSSE::Vec4 operator-(mathSSE::Vec4 a) { - const __m256d neg = _mm256_set_pd ( -0.0 , -0.0 , -0.0, -0.0); - return _mm256_xor_pd(a.vec,neg); -} - -inline mathSSE::Vec4 operator&(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_and_pd(a.vec,b.vec); -} -inline mathSSE::Vec4 operator|(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_or_pd(a.vec,b.vec); -} -inline mathSSE::Vec4 operator^(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_xor_pd(a.vec,b.vec); -} -inline mathSSE::Vec4 andnot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_andnot_pd(a.vec,b.vec); -} - - -inline mathSSE::Vec4 operator+(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_add_pd(a.vec,b.vec); -} - -inline mathSSE::Vec4 operator-(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_sub_pd(a.vec,b.vec); -} - -inline mathSSE::Vec4 operator*(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_mul_pd(a.vec,b.vec); -} - -inline mathSSE::Vec4 operator/(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_div_pd(a.vec,b.vec); -} - -inline mathSSE::Vec4 operator*(double a, mathSSE::Vec4 b) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); -} - -inline mathSSE::Vec4 operator*(mathSSE::Vec4 b,double a) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); -} - -inline mathSSE::Vec4 operator/(mathSSE::Vec4 b,double a) { - return _mm256_div_pd(b.vec,_mm256_set1_pd(a)); -} - - -inline double -__attribute__((always_inline)) __attribute__ ((pure)) -dot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_dot_pd; - mathSSE::Vec4 ret; - ret.vec = _mm256_dot_pd(a.vec,b.vec); - return ret.arr[0]; -} - -inline mathSSE::Vec4 -__attribute__((always_inline)) __attribute__ ((pure)) -cross(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_cross_pd; - return _mm256_cross_pd(a.vec,b.vec); -} - -inline double -__attribute__((always_inline)) __attribute__ ((pure)) -dotxy(mathSSE::Vec4 a, mathSSE::Vec4 b) { - mathSSE::Vec4 mul = a*b; - mul = hadd(mul,mul); - return mul.arr[0]; -} - - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h deleted file mode 100644 index 1ec4e68460ee2..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFBlockElementFwd_h -#define DataFormats_ParticleFlowReco_PFBlockElementFwd_h - -/* #include */ - -/* #include "DataFormats/Common/interface/RefProd.h" */ -/* #include "DataFormats/Common/interface/RefVector.h" */ - -namespace reco { - class PFBlockElement; - class PFBlockElementCluster; - class PFBlockElementTrack; -} // namespace reco - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h deleted file mode 100644 index f185ddc2b8f96..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PFBlockElementSuperClusterFwd_H -#define PFBlockElementSuperClusterFwd_H -#include -#include "DataFormats/Common/interface/Ref.h" -namespace reco { - class PFBlockElementSuperCluster; - typedef std::vector PFBlockElementSuperClusterCollection; - typedef edm::Ref PFBlockElementSuperClusterRef; -} // namespace reco - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h b/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h deleted file mode 100644 index d6dccf9c9c476..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef ParticleFlowReco_PFClusterShapeAssociation_h_ -#define ParticleFlowReco_PFClusterShapeAssociation_h_ -// \class PFClusterShapeAssociation -// -// \association of ClusterShape to PFCluster -// -// -// -#include "DataFormats/EgammaReco/interface/ClusterShapeFwd.h" -#include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h" -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/AssociationMap.h" -#include - -namespace reco -{ - typedef - edm::AssociationMap > - PFClusterShapeAssociationCollection; - typedef - PFClusterShapeAssociationCollection::value_type PFClusterShapeAssociation; - typedef - edm::Ref PFClusterShapeAssociationRef; - typedef - edm::RefProd PFClusterShapeAssociationRefProd; - typedef - edm::RefVector PFClusterShapeAssociationRefVector; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h b/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h deleted file mode 100644 index ae63ca1682f2b..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFParticleFwd_h -#define DataFormats_ParticleFlowReco_PFParticleFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFParticle; - - /// collection of PFParticle objects - typedef std::vector PFParticleCollection; - - /// persistent reference to PFParticle objects - typedef edm::Ref PFParticleRef; - - /// reference to PFParticle collection - typedef edm::RefProd PFParticleRefProd; - - /// vector of references to PFParticle objects all in the same collection - typedef edm::RefVector PFParticleRefVector; - - /// iterator over a vector of references to PFParticle objects - typedef PFParticleRefVector::iterator pfParticle_iterator; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h b/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h deleted file mode 100644 index 4710147743e4e..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef ParticleFlowReco_PFSuperClusterFwd_h -#define ParticleFlowReco_PFSuperClusterFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFSuperCluster; - - /// collection of PFSuperCluster objects - typedef std::vector PFSuperClusterCollection; - - /// persistent reference to PFSuperCluster objects - typedef edm::Ref PFSuperClusterRef; - - /// reference to PFSuperCluster collection - typedef edm::RefProd PFSuperClusterRefProd; - - /// vector of references to PFSuperCluster objects all in the same collection - typedef edm::RefVector PFSuperClusterRefVector; - - /// iterator over a vector of references to PFSuperCluster objects - typedef PFSuperClusterRefVector::iterator PFSuperCluster_iterator; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h b/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h deleted file mode 100644 index fa2645f21f5df..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFTrajectoryPointFwd_h -#define DataFormats_ParticleFlowReco_PFTrajectoryPointFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFTrajectoryPoint; - - /// collection of PFTrajectoryPoint objects - typedef std::vector PFTrajectoryPointCollection; - - /// persistent reference to PFTrajectoryPoint objects - typedef edm::Ref PFTrajectoryPointRef; - - /// reference to PFTrajectoryPoint collection - typedef edm::RefProd PFTrajectoryPointRefProd; - - /// vector of references to PFTrajectoryPoint objects all in the same collection - typedef edm::RefVector PFTrajectoryPointRefVector; - - /// iterator over a vector of references to PFTrajectoryPoint objects - typedef PFTrajectoryPointRefVector::iterator trajectoryPoint_iterator; -} - -#endif diff --git a/DataFormats/Provenance/interface/BranchDescriptionIndex.h b/DataFormats/Provenance/interface/BranchDescriptionIndex.h deleted file mode 100644 index 23a6da64024b2..0000000000000 --- a/DataFormats/Provenance/interface/BranchDescriptionIndex.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef DataFormats_Provenance_BranchDescriptionIndex_h -#define DataFormats_Provenance_BranchDescriptionIndex_h -// -*- C++ -*- -// -// Package: Provenance -// Class : BranchDescriptionIndex -// -/**\class BranchDescriptionIndex BranchDescriptionIndex.h DataFormats/Provenance/interface/BranchDescriptionIndex.h - - Description: Index into BranchDescription vector - - Usage: - Internally used by ProductRegistry and by Principal to quickly find data - -*/ -// -// Original Author: Chris Jones -// Created: Thu Apr 30 15:46:09 CDT 2009 -// - -// system include files - -// user include files - -// forward declarations - -namespace edm { - typedef unsigned int BranchDescriptionIndex; -} - -#endif diff --git a/DataFormats/Provenance/interface/TypeInBranchType.h b/DataFormats/Provenance/interface/TypeInBranchType.h deleted file mode 100644 index 8dd5c6a262e52..0000000000000 --- a/DataFormats/Provenance/interface/TypeInBranchType.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef DataFormats_Provenance_TypeInBranchType_h -#define DataFormats_Provenance_TypeInBranchType_h -// -*- C++ -*- -// -// Package: Provenance -// Class : TypeInBranchType -// -/**\class TypeInBranchType TypeInBranchType.h DataFormats/Provenance/interface/TypeInBranchType.h - - Description: Pairs C++ class type and edm::BranchType - - Usage: - Used internally to ProductRegistry and for quickly finding data in Principals - -*/ -// -// Original Author: Chris Jones -// Created: Thu Apr 30 15:50:17 CDT 2009 -// - -// system include files - -// user include files -#include "DataFormats/Provenance/interface/BranchType.h" -#include "FWCore/Utilities/interface/TypeID.h" - -// forward declarations - -namespace edm { - class TypeInBranchType { - - public: - TypeInBranchType(TypeID const& iID, - BranchType const& iBranch) : - id_(iID), - branch_(iBranch) {} - - TypeID const& typeID() const { - return id_; - } - - BranchType const& branchType() const { - return branch_; - } - - bool operator<(TypeInBranchType const& iRHS) const { - if(branch_ < iRHS.branch_) { - return true; - } - if(iRHS.branch_ < branch_) { - return false; - } - return id_ < iRHS.id_; - } - private: - TypeID id_; - BranchType branch_; - }; - -} - -#endif diff --git a/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h b/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h deleted file mode 100644 index 429c7ab205921..0000000000000 --- a/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef RPCOBJECTS_RPCDIGIL1LINKFWD_H -#define RPCOBJECTS_RPCDIGIL1LINKFWD_H -class RPCDigiL1Link; -#endif // RPCOBJECTS_RPCDIGIL1LINKFWD_H diff --git a/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h b/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h deleted file mode 100644 index 9e5062017f007..0000000000000 --- a/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H -#define TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H -class PixelDigiCollection; -#endif // TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H diff --git a/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h b/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h deleted file mode 100644 index 7a0bd46627698..0000000000000 --- a/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef DataFormats_SiStripCommon_ConstantsForSummaryPlots_H -#define DataFormats_SiStripCommon_ConstantsForSummaryPlots_H - -#include "DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h" -#include "DataFormats/SiStripCommon/interface/ConstantsForPresentation.h" - -#endif // DataFormats_SiStripCommon_ConstantsForSummaryPlots_H - - diff --git a/DataFormats/SiStripDigi/interface/SiStripDigifwd.h b/DataFormats/SiStripDigi/interface/SiStripDigifwd.h deleted file mode 100644 index 5287a400d6d3b..0000000000000 --- a/DataFormats/SiStripDigi/interface/SiStripDigifwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TRACKINGOBJECTS_SISTRIPDIGIFWD_H -#define TRACKINGOBJECTS_SISTRIPDIGIFWD_H -class SiStripDigi; -#endif // TRACKINGOBJECTS_SISTRIPDIGIFWD_H diff --git a/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h b/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h deleted file mode 100644 index 1e5b57c035863..0000000000000 --- a/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef DataFormats_SiPixelRecHitFWD_H -#define DataFormats_SiPixelRecHitFWD_H -class SiPixelRecHit; -#endif // diff --git a/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h b/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h deleted file mode 100644 index 12c0a9bf9db97..0000000000000 --- a/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef DATAFORMATS_TRAJECTORYSEED_BASICTRAJECTORYSEED_h -#define DATAFORMATS_TRAJECTORYSEED_BASICTRAJECTORYSEED_h - - -#include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h" -typedef TrajectorySeed BasicTrajectorySeed; - - -#endif From 5618cd0965e11858be07de4c71b734294eb99881 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Wed, 1 Sep 2021 19:42:38 +0800 Subject: [PATCH 2/3] restore AVXVec.h and extBasic2DVector.h --- .../interface/private/extBasic2DVector.h | 264 ++++++++++++++++++ DataFormats/Math/interface/private/AVXVec.h | 187 +++++++++++++ 2 files changed, 451 insertions(+) create mode 100644 DataFormats/GeometryVector/interface/private/extBasic2DVector.h create mode 100644 DataFormats/Math/interface/private/AVXVec.h diff --git a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h new file mode 100644 index 0000000000000..7d6a871576de7 --- /dev/null +++ b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h @@ -0,0 +1,264 @@ +#ifndef GeometryVector_newBasic2DVector_h +#define GeometryVector_newBasic2DVector_h + +#include "DataFormats/GeometryVector/interface/Phi.h" +#include "DataFormats/GeometryVector/interface/PreciseFloatType.h" +#include "DataFormats/GeometryVector/interface/CoordinateSets.h" +#include "DataFormats/Math/interface/ExtVec.h" + + +#include +#include + + +template < class T> +class Basic2DVector { +public: + + typedef T ScalarType; + typedef Vec2 VectorType; + typedef Vec2 MathVector; + typedef Geom::Polar2Cartesian Polar; + + /** default constructor uses default constructor of T to initialize the + * components. For built-in floating-point types this means initialization + * to zero + */ + Basic2DVector() : v{0,0} {} + + /// Copy constructor from same type. Should not be needed but for gcc bug 12685 + Basic2DVector( const Basic2DVector & p) : v(p.v) {} + + template + Basic2DVector( const Basic2DVector & p) : v{T(p.v[0]),T(p.v[1])} {} + + + /** Explicit constructor from other (possibly unrelated) vector classes + * The only constraint on the argument type is that it has methods + * x() and y(), and that these methods return a type convertible to T. + * Examples of use are + *
construction from a Basic2DVector with different precision + *
construction from a coordinate system converter + */ + template + explicit Basic2DVector( const Other& p) : v{T(p.x()),T(p.y())} {} + + /// construct from cartesian coordinates + Basic2DVector( const T& x, const T& y) : v{x,y} {} + + // constructor from Vec2 or vec4 + Basic2DVector(MathVector const& iv) : v(iv){} + template + Basic2DVector(Vec2 const& iv) : v{iv[0],iv[1]}{} + template + Basic2DVector(Vec4 const& iv) : v{iv[0],iv[1]}{} + + MathVector const & mathVector() const { return v;} + MathVector & mathVector() { return v;} + + T operator[](int i) const { return v[i];} + T & operator[](int i) { return v[i];} + + + /// Cartesian x coordinate + T x() const { return v[0];} + + /// Cartesian y coordinate + T y() const { return v[1];} + + /// The vector magnitude squared. Equivalent to vec.dot(vec) + T mag2() const { return ::dot(v,v);} + + /// The vector magnitude. Equivalent to sqrt(vec.mag2()) + T mag() const { return std::sqrt( mag2());} + + /// Radius, same as mag() + T r() const { return mag();} + + /** Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. + * Same precision as the system atan2(x,y) function. + * The return type is Geom::Phi, see it's documentation. + */ + T barePhi() const {return std::atan2(y(),x());} + Geom::Phi phi() const {return Geom::Phi(atan2(y(),x()));} + + /** Unit vector parallel to this. + * If mag() is zero, a zero vector is returned. + */ + Basic2DVector unit() const { + T my_mag = mag(); + return my_mag == 0 ? *this : *this / my_mag; + } + + /** Operator += with a Basic2DVector of possibly different precision. + */ + template + Basic2DVector& operator+= ( const Basic2DVector& p) { + v = v + p.v; + return *this; + } + + /** Operator -= with a Basic2DVector of possibly different precision. + */ + template + Basic2DVector& operator-= ( const Basic2DVector& p) { + v = v - p.v; + return *this; + } + + /// Unary minus, returns a vector with components (-x(),-y(),-z()) + Basic2DVector operator-() const { return Basic2DVector(-v);} + + /// Scaling by a scalar value (multiplication) + Basic2DVector& operator*= ( T t) { + v = v*t; + return *this; + } + + /// Scaling by a scalar value (division) + Basic2DVector& operator/= ( T t) { + t = T(1)/t; + v = v*t; + return *this; + } + + /// Scalar product, or "dot" product, with a vector of same type. + T dot( const Basic2DVector& lh) const { return ::dot(v,lh.v);} + + /** Scalar (or dot) product with a vector of different precision. + * The product is computed without loss of precision. The type + * of the returned scalar is the more precise of the scalar types + * of the two vectors. + */ + template + typename PreciseFloatType::Type dot( const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this) + .dot(Basic2DVector::Type>(lh)); + } + + /// Vector product, or "cross" product, with a vector of same type. + T cross( const Basic2DVector& lh) const { return ::cross2(v,lh.v);} + + /** Vector (or cross) product with a vector of different precision. + * The product is computed without loss of precision. The type + * of the returned scalar is the more precise of the scalar types + * of the two vectors. + */ + template + typename PreciseFloatType::Type cross( const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this) + .cross(Basic2DVector::Type>(lh)); + } + + +public: + + Vec2 v; + +}; + + +namespace geometryDetails { + std::ostream & print2D(std::ostream& s, double x, double y); + +} + +/// simple text output to standard streams +template +inline std::ostream & operator<<( std::ostream& s, const Basic2DVector& v) { + return geometryDetails::print2D(s, v.x(),v.y()); +} + + +/// vector sum and subtraction of vectors of possibly different precision +template +inline Basic2DVector +operator+( const Basic2DVector& a, const Basic2DVector& b) { + return a.v+b.v; +} +template +inline Basic2DVector +operator-( const Basic2DVector& a, const Basic2DVector& b) { + return a.v-b.v; +} + +template +inline Basic2DVector::Type> +operator+( const Basic2DVector& a, const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; + return RT(a) + RT(b); +} + +template +inline Basic2DVector::Type> +operator-( const Basic2DVector& a, const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; + return RT(a)-RT(b); +} + + + + +// scalar product of vectors of same precision +template +inline T operator*( const Basic2DVector& v1, const Basic2DVector& v2) { + return v1.dot(v2); +} + +/// scalar product of vectors of different precision +template +inline typename PreciseFloatType::Type operator*( const Basic2DVector& v1, + const Basic2DVector& v2) { + return v1.dot(v2); +} + + +/** Multiplication by scalar, does not change the precision of the vector. + * The return type is the same as the type of the vector argument. + */ +template +inline Basic2DVector operator*( const Basic2DVector& v, T t) { + return v.v*t; +} + +/// Same as operator*( Vector, Scalar) +template +inline Basic2DVector operator*(T t, const Basic2DVector& v) { + return v.v*t; +} + + + +template +inline Basic2DVector operator*( const Basic2DVector& v, const Scalar& s) { + T t = static_cast(s); + return v*t; +} + +/// Same as operator*( Vector, Scalar) +template +inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { + T t = static_cast(s); + return v*t; +} + +/** Division by scalar, does not change the precision of the vector. + * The return type is the same as the type of the vector argument. + */ +template +inline Basic2DVector operator/(const Basic2DVector& v, T t) { + return v.v/t; +} + +template +inline Basic2DVector operator/( const Basic2DVector& v, const Scalar& s) { + // T t = static_cast(Scalar(1)/s); return v*t; + T t = static_cast(s); + return v/t; +} + +typedef Basic2DVector Basic2DVectorF; +typedef Basic2DVector Basic2DVectorD; + + +#endif // GeometryVector_Basic2DVector_h diff --git a/DataFormats/Math/interface/private/AVXVec.h b/DataFormats/Math/interface/private/AVXVec.h new file mode 100644 index 0000000000000..9fe33e8c3d1fd --- /dev/null +++ b/DataFormats/Math/interface/private/AVXVec.h @@ -0,0 +1,187 @@ +#ifndef DataFormat_Math_AVXVec_H +#define DataFormat_Math_AVXVec_H + +// in principle it should not be used alone +// only as part of SSEVec +namespace mathSSE { + + template<> + union Vec4 { + typedef __m256d nativeType; + __m256d vec; + double __attribute__ ((aligned(32))) arr[4]; + OldVec o; + + Vec4(__m256d ivec) : vec(ivec) {} + + Vec4(OldVec const & ivec) : o(ivec) {} + + Vec4() { + vec = _mm256_setzero_pd(); + } + + + inline Vec4(Vec4 ivec) { + vec = _mm256_cvtps_pd(ivec.vec); + } + + explicit Vec4(double f1) { + set1(f1); + } + + Vec4(double f1, double f2, double f3, double f4=0) { + arr[0] = f1; arr[1] = f2; arr[2] = f3; arr[3]=f4; + } + + + Vec4( Vec2 ivec0, Vec2 ivec1) { + vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + vec = _mm256_insertf128_pd(vec,ivec1.vec,1); + + } + + Vec4( Vec2 ivec0, double f3, double f4=0) { + vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + arr[2] = f3; arr[3] = f4; + } + + Vec4( Vec2 ivec0) { + vec = _mm256_setzero_pd(); + vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + } + + + // for masking + void setMask(unsigned int m1, unsigned int m2, unsigned int m3, unsigned int m4) { + Mask4 mask(m1,m2,m3,m4); vec=mask.vec; + } + + void set(double f1, double f2, double f3, double f4=0) { + vec = _mm256_set_pd(f4, f3, f2, f1); + } + + void set1(double f1) { + vec = _mm256_set1_pd(f1); + } + + template + Vec4 get1() const { + return _mm256_set1_pd(arr[N]); //FIXME + } + /* + Vec4 get1(unsigned int n) const { + return _mm256_set1_pd(arr[n]); //FIXME + } + */ + double & operator[](unsigned int n) { + return arr[n]; + } + + double operator[](unsigned int n) const { + return arr[n]; + } + + Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec));} + Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec,vec,1)));} + + }; + + inline Vec4::Vec4(Vec4 ivec) { + vec = _mm256_cvtpd_ps(ivec.vec); + } +} // namespace mathSSE + + + +inline bool operator==(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_movemask_pd(_mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS))==0xf; +} + +inline mathSSE::Vec4 cmpeq(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS); +} + +inline mathSSE::Vec4 cmpgt(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_cmp_pd(a.vec,b.vec,_CMP_GT_OS); +} + +inline mathSSE::Vec4 hadd(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_hadd_pd(a.vec,b.vec); +} + + + +inline mathSSE::Vec4 operator-(mathSSE::Vec4 a) { + const __m256d neg = _mm256_set_pd ( -0.0 , -0.0 , -0.0, -0.0); + return _mm256_xor_pd(a.vec,neg); +} + +inline mathSSE::Vec4 operator&(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_and_pd(a.vec,b.vec); +} +inline mathSSE::Vec4 operator|(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_or_pd(a.vec,b.vec); +} +inline mathSSE::Vec4 operator^(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_xor_pd(a.vec,b.vec); +} +inline mathSSE::Vec4 andnot(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_andnot_pd(a.vec,b.vec); +} + + +inline mathSSE::Vec4 operator+(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_add_pd(a.vec,b.vec); +} + +inline mathSSE::Vec4 operator-(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_sub_pd(a.vec,b.vec); +} + +inline mathSSE::Vec4 operator*(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_mul_pd(a.vec,b.vec); +} + +inline mathSSE::Vec4 operator/(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_div_pd(a.vec,b.vec); +} + +inline mathSSE::Vec4 operator*(double a, mathSSE::Vec4 b) { + return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); +} + +inline mathSSE::Vec4 operator*(mathSSE::Vec4 b,double a) { + return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); +} + +inline mathSSE::Vec4 operator/(mathSSE::Vec4 b,double a) { + return _mm256_div_pd(b.vec,_mm256_set1_pd(a)); +} + + +inline double +__attribute__((always_inline)) __attribute__ ((pure)) +dot(mathSSE::Vec4 a, mathSSE::Vec4 b) { + using mathSSE::_mm256_dot_pd; + mathSSE::Vec4 ret; + ret.vec = _mm256_dot_pd(a.vec,b.vec); + return ret.arr[0]; +} + +inline mathSSE::Vec4 +__attribute__((always_inline)) __attribute__ ((pure)) +cross(mathSSE::Vec4 a, mathSSE::Vec4 b) { + using mathSSE::_mm256_cross_pd; + return _mm256_cross_pd(a.vec,b.vec); +} + +inline double +__attribute__((always_inline)) __attribute__ ((pure)) +dotxy(mathSSE::Vec4 a, mathSSE::Vec4 b) { + mathSSE::Vec4 mul = a*b; + mul = hadd(mul,mul); + return mul.arr[0]; +} + + +#endif From 2c3e3e84cb714e866e295092db423809454dff12 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Wed, 1 Sep 2021 21:26:12 +0800 Subject: [PATCH 3/3] fixed code check error --- .../interface/private/extBasic2DVector.h | 178 ++++++++---------- DataFormats/Math/interface/private/AVXVec.h | 156 +++++++-------- 2 files changed, 144 insertions(+), 190 deletions(-) diff --git a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h index 7d6a871576de7..68e6c69d56d81 100644 --- a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h +++ b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h @@ -6,32 +6,28 @@ #include "DataFormats/GeometryVector/interface/CoordinateSets.h" #include "DataFormats/Math/interface/ExtVec.h" - #include #include - -template < class T> +template class Basic2DVector { public: - - typedef T ScalarType; + typedef T ScalarType; typedef Vec2 VectorType; typedef Vec2 MathVector; - typedef Geom::Polar2Cartesian Polar; + typedef Geom::Polar2Cartesian Polar; /** default constructor uses default constructor of T to initialize the * components. For built-in floating-point types this means initialization * to zero */ - Basic2DVector() : v{0,0} {} + Basic2DVector() : v{0, 0} {} /// Copy constructor from same type. Should not be needed but for gcc bug 12685 - Basic2DVector( const Basic2DVector & p) : v(p.v) {} - - template - Basic2DVector( const Basic2DVector & p) : v{T(p.v[0]),T(p.v[1])} {} + Basic2DVector(const Basic2DVector& p) : v(p.v) {} + template + Basic2DVector(const Basic2DVector& p) : v{T(p.v[0]), T(p.v[1])} {} /** Explicit constructor from other (possibly unrelated) vector classes * The only constraint on the argument type is that it has methods @@ -40,47 +36,46 @@ class Basic2DVector { *
construction from a Basic2DVector with different precision *
construction from a coordinate system converter */ - template - explicit Basic2DVector( const Other& p) : v{T(p.x()),T(p.y())} {} + template + explicit Basic2DVector(const Other& p) : v{T(p.x()), T(p.y())} {} /// construct from cartesian coordinates - Basic2DVector( const T& x, const T& y) : v{x,y} {} + Basic2DVector(const T& x, const T& y) : v{x, y} {} // constructor from Vec2 or vec4 - Basic2DVector(MathVector const& iv) : v(iv){} - template - Basic2DVector(Vec2 const& iv) : v{iv[0],iv[1]}{} - template - Basic2DVector(Vec4 const& iv) : v{iv[0],iv[1]}{} - - MathVector const & mathVector() const { return v;} - MathVector & mathVector() { return v;} + Basic2DVector(MathVector const& iv) : v(iv) {} + template + Basic2DVector(Vec2 const& iv) : v{iv[0], iv[1]} {} + template + Basic2DVector(Vec4 const& iv) : v{iv[0], iv[1]} {} - T operator[](int i) const { return v[i];} - T & operator[](int i) { return v[i];} + MathVector const& mathVector() const { return v; } + MathVector& mathVector() { return v; } + T operator[](int i) const { return v[i]; } + T& operator[](int i) { return v[i]; } /// Cartesian x coordinate - T x() const { return v[0];} + T x() const { return v[0]; } /// Cartesian y coordinate - T y() const { return v[1];} + T y() const { return v[1]; } /// The vector magnitude squared. Equivalent to vec.dot(vec) - T mag2() const { return ::dot(v,v);} + T mag2() const { return ::dot(v, v); } /// The vector magnitude. Equivalent to sqrt(vec.mag2()) - T mag() const { return std::sqrt( mag2());} + T mag() const { return std::sqrt(mag2()); } /// Radius, same as mag() - T r() const { return mag();} + T r() const { return mag(); } /** Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. * Same precision as the system atan2(x,y) function. * The return type is Geom::Phi, see it's documentation. - */ - T barePhi() const {return std::atan2(y(),x());} - Geom::Phi phi() const {return Geom::Phi(atan2(y(),x()));} + */ + T barePhi() const { return std::atan2(y(), x()); } + Geom::Phi phi() const { return Geom::Phi(atan2(y(), x())); } /** Unit vector parallel to this. * If mag() is zero, a zero vector is returned. @@ -92,154 +87,140 @@ class Basic2DVector { /** Operator += with a Basic2DVector of possibly different precision. */ - template - Basic2DVector& operator+= ( const Basic2DVector& p) { + template + Basic2DVector& operator+=(const Basic2DVector& p) { v = v + p.v; return *this; - } + } /** Operator -= with a Basic2DVector of possibly different precision. */ - template - Basic2DVector& operator-= ( const Basic2DVector& p) { + template + Basic2DVector& operator-=(const Basic2DVector& p) { v = v - p.v; return *this; - } + } /// Unary minus, returns a vector with components (-x(),-y(),-z()) - Basic2DVector operator-() const { return Basic2DVector(-v);} + Basic2DVector operator-() const { return Basic2DVector(-v); } /// Scaling by a scalar value (multiplication) - Basic2DVector& operator*= ( T t) { - v = v*t; + Basic2DVector& operator*=(T t) { + v = v * t; return *this; - } + } /// Scaling by a scalar value (division) - Basic2DVector& operator/= ( T t) { - t = T(1)/t; - v = v*t; + Basic2DVector& operator/=(T t) { + t = T(1) / t; + v = v * t; return *this; - } + } /// Scalar product, or "dot" product, with a vector of same type. - T dot( const Basic2DVector& lh) const { return ::dot(v,lh.v);} + T dot(const Basic2DVector& lh) const { return ::dot(v, lh.v); } /** Scalar (or dot) product with a vector of different precision. * The product is computed without loss of precision. The type * of the returned scalar is the more precise of the scalar types * of the two vectors. */ - template - typename PreciseFloatType::Type dot( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .dot(Basic2DVector::Type>(lh)); + template + typename PreciseFloatType::Type dot(const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this).dot( + Basic2DVector::Type>(lh)); } /// Vector product, or "cross" product, with a vector of same type. - T cross( const Basic2DVector& lh) const { return ::cross2(v,lh.v);} + T cross(const Basic2DVector& lh) const { return ::cross2(v, lh.v); } /** Vector (or cross) product with a vector of different precision. * The product is computed without loss of precision. The type * of the returned scalar is the more precise of the scalar types * of the two vectors. */ - template - typename PreciseFloatType::Type cross( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .cross(Basic2DVector::Type>(lh)); + template + typename PreciseFloatType::Type cross(const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this).cross( + Basic2DVector::Type>(lh)); } - public: - Vec2 v; - }; - namespace geometryDetails { - std::ostream & print2D(std::ostream& s, double x, double y); + std::ostream& print2D(std::ostream& s, double x, double y); } /// simple text output to standard streams template -inline std::ostream & operator<<( std::ostream& s, const Basic2DVector& v) { - return geometryDetails::print2D(s, v.x(),v.y()); +inline std::ostream& operator<<(std::ostream& s, const Basic2DVector& v) { + return geometryDetails::print2D(s, v.x(), v.y()); } - /// vector sum and subtraction of vectors of possibly different precision template -inline Basic2DVector -operator+( const Basic2DVector& a, const Basic2DVector& b) { - return a.v+b.v; +inline Basic2DVector operator+(const Basic2DVector& a, const Basic2DVector& b) { + return a.v + b.v; } template -inline Basic2DVector -operator-( const Basic2DVector& a, const Basic2DVector& b) { - return a.v-b.v; +inline Basic2DVector operator-(const Basic2DVector& a, const Basic2DVector& b) { + return a.v - b.v; } template -inline Basic2DVector::Type> -operator+( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; +inline Basic2DVector::Type> operator+(const Basic2DVector& a, + const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; return RT(a) + RT(b); } template -inline Basic2DVector::Type> -operator-( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; - return RT(a)-RT(b); +inline Basic2DVector::Type> operator-(const Basic2DVector& a, + const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; + return RT(a) - RT(b); } - - - // scalar product of vectors of same precision template -inline T operator*( const Basic2DVector& v1, const Basic2DVector& v2) { +inline T operator*(const Basic2DVector& v1, const Basic2DVector& v2) { return v1.dot(v2); } /// scalar product of vectors of different precision template -inline typename PreciseFloatType::Type operator*( const Basic2DVector& v1, - const Basic2DVector& v2) { +inline typename PreciseFloatType::Type operator*(const Basic2DVector& v1, const Basic2DVector& v2) { return v1.dot(v2); } - /** Multiplication by scalar, does not change the precision of the vector. * The return type is the same as the type of the vector argument. */ template -inline Basic2DVector operator*( const Basic2DVector& v, T t) { - return v.v*t; +inline Basic2DVector operator*(const Basic2DVector& v, T t) { + return v.v * t; } /// Same as operator*( Vector, Scalar) template inline Basic2DVector operator*(T t, const Basic2DVector& v) { - return v.v*t; + return v.v * t; } - - template -inline Basic2DVector operator*( const Basic2DVector& v, const Scalar& s) { +inline Basic2DVector operator*(const Basic2DVector& v, const Scalar& s) { T t = static_cast(s); - return v*t; + return v * t; } /// Same as operator*( Vector, Scalar) template -inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { +inline Basic2DVector operator*(const Scalar& s, const Basic2DVector& v) { T t = static_cast(s); - return v*t; + return v * t; } /** Division by scalar, does not change the precision of the vector. @@ -247,18 +228,17 @@ inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { */ template inline Basic2DVector operator/(const Basic2DVector& v, T t) { - return v.v/t; + return v.v / t; } template -inline Basic2DVector operator/( const Basic2DVector& v, const Scalar& s) { +inline Basic2DVector operator/(const Basic2DVector& v, const Scalar& s) { // T t = static_cast(Scalar(1)/s); return v*t; - T t = static_cast(s); - return v/t; + T t = static_cast(s); + return v / t; } typedef Basic2DVector Basic2DVectorF; typedef Basic2DVector Basic2DVectorD; - -#endif // GeometryVector_Basic2DVector_h +#endif // GeometryVector_Basic2DVector_h diff --git a/DataFormats/Math/interface/private/AVXVec.h b/DataFormats/Math/interface/private/AVXVec.h index 9fe33e8c3d1fd..78850716bba21 100644 --- a/DataFormats/Math/interface/private/AVXVec.h +++ b/DataFormats/Math/interface/private/AVXVec.h @@ -5,183 +5,157 @@ // only as part of SSEVec namespace mathSSE { - template<> + template <> union Vec4 { - typedef __m256d nativeType; + typedef __m256d nativeType; __m256d vec; - double __attribute__ ((aligned(32))) arr[4]; + double __attribute__((aligned(32))) arr[4]; OldVec o; - + Vec4(__m256d ivec) : vec(ivec) {} - Vec4(OldVec const & ivec) : o(ivec) {} - - Vec4() { - vec = _mm256_setzero_pd(); - } + Vec4(OldVec const& ivec) : o(ivec) {} + Vec4() { vec = _mm256_setzero_pd(); } - inline Vec4(Vec4 ivec) { - vec = _mm256_cvtps_pd(ivec.vec); - } + inline Vec4(Vec4 ivec) { vec = _mm256_cvtps_pd(ivec.vec); } - explicit Vec4(double f1) { - set1(f1); - } + explicit Vec4(double f1) { set1(f1); } - Vec4(double f1, double f2, double f3, double f4=0) { - arr[0] = f1; arr[1] = f2; arr[2] = f3; arr[3]=f4; + Vec4(double f1, double f2, double f3, double f4 = 0) { + arr[0] = f1; + arr[1] = f2; + arr[2] = f3; + arr[3] = f4; } - - Vec4( Vec2 ivec0, Vec2 ivec1) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - vec = _mm256_insertf128_pd(vec,ivec1.vec,1); - - } - - Vec4( Vec2 ivec0, double f3, double f4=0) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - arr[2] = f3; arr[3] = f4; + Vec4(Vec2 ivec0, Vec2 ivec1) { + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + vec = _mm256_insertf128_pd(vec, ivec1.vec, 1); } - Vec4( Vec2 ivec0) { - vec = _mm256_setzero_pd(); - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + Vec4(Vec2 ivec0, double f3, double f4 = 0) { + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + arr[2] = f3; + arr[3] = f4; } + Vec4(Vec2 ivec0) { + vec = _mm256_setzero_pd(); + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + } // for masking void setMask(unsigned int m1, unsigned int m2, unsigned int m3, unsigned int m4) { - Mask4 mask(m1,m2,m3,m4); vec=mask.vec; + Mask4 mask(m1, m2, m3, m4); + vec = mask.vec; } - void set(double f1, double f2, double f3, double f4=0) { - vec = _mm256_set_pd(f4, f3, f2, f1); - } + void set(double f1, double f2, double f3, double f4 = 0) { vec = _mm256_set_pd(f4, f3, f2, f1); } - void set1(double f1) { - vec = _mm256_set1_pd(f1); - } + void set1(double f1) { vec = _mm256_set1_pd(f1); } - template + template Vec4 get1() const { - return _mm256_set1_pd(arr[N]); //FIXME + return _mm256_set1_pd(arr[N]); //FIXME } /* Vec4 get1(unsigned int n) const { return _mm256_set1_pd(arr[n]); //FIXME } */ - double & operator[](unsigned int n) { - return arr[n]; - } + double& operator[](unsigned int n) { return arr[n]; } - double operator[](unsigned int n) const { - return arr[n]; - } - - Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec));} - Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec,vec,1)));} + double operator[](unsigned int n) const { return arr[n]; } + Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec)); } + Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec, vec, 1))); } }; - - inline Vec4::Vec4(Vec4 ivec) { - vec = _mm256_cvtpd_ps(ivec.vec); - } -} // namespace mathSSE - + inline Vec4::Vec4(Vec4 ivec) { vec = _mm256_cvtpd_ps(ivec.vec); } +} // namespace mathSSE inline bool operator==(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_movemask_pd(_mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS))==0xf; + return _mm256_movemask_pd(_mm256_cmp_pd(a.vec, b.vec, _CMP_EQ_OS)) == 0xf; } - + inline mathSSE::Vec4 cmpeq(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS); + return _mm256_cmp_pd(a.vec, b.vec, _CMP_EQ_OS); } inline mathSSE::Vec4 cmpgt(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_GT_OS); + return _mm256_cmp_pd(a.vec, b.vec, _CMP_GT_OS); } inline mathSSE::Vec4 hadd(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_hadd_pd(a.vec,b.vec); + return _mm256_hadd_pd(a.vec, b.vec); } - - inline mathSSE::Vec4 operator-(mathSSE::Vec4 a) { - const __m256d neg = _mm256_set_pd ( -0.0 , -0.0 , -0.0, -0.0); - return _mm256_xor_pd(a.vec,neg); + const __m256d neg = _mm256_set_pd(-0.0, -0.0, -0.0, -0.0); + return _mm256_xor_pd(a.vec, neg); } inline mathSSE::Vec4 operator&(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_and_pd(a.vec,b.vec); + return _mm256_and_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator|(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_or_pd(a.vec,b.vec); + return _mm256_or_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator^(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_xor_pd(a.vec,b.vec); + return _mm256_xor_pd(a.vec, b.vec); } inline mathSSE::Vec4 andnot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_andnot_pd(a.vec,b.vec); + return _mm256_andnot_pd(a.vec, b.vec); } - inline mathSSE::Vec4 operator+(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_add_pd(a.vec,b.vec); + return _mm256_add_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator-(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_sub_pd(a.vec,b.vec); + return _mm256_sub_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator*(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_mul_pd(a.vec,b.vec); + return _mm256_mul_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator/(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_div_pd(a.vec,b.vec); + return _mm256_div_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator*(double a, mathSSE::Vec4 b) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); + return _mm256_mul_pd(_mm256_set1_pd(a), b.vec); } -inline mathSSE::Vec4 operator*(mathSSE::Vec4 b,double a) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); +inline mathSSE::Vec4 operator*(mathSSE::Vec4 b, double a) { + return _mm256_mul_pd(_mm256_set1_pd(a), b.vec); } -inline mathSSE::Vec4 operator/(mathSSE::Vec4 b,double a) { - return _mm256_div_pd(b.vec,_mm256_set1_pd(a)); +inline mathSSE::Vec4 operator/(mathSSE::Vec4 b, double a) { + return _mm256_div_pd(b.vec, _mm256_set1_pd(a)); } - -inline double -__attribute__((always_inline)) __attribute__ ((pure)) +inline double __attribute__((always_inline)) __attribute__((pure)) dot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_dot_pd; + using mathSSE::_mm256_dot_pd; mathSSE::Vec4 ret; - ret.vec = _mm256_dot_pd(a.vec,b.vec); + ret.vec = _mm256_dot_pd(a.vec, b.vec); return ret.arr[0]; } -inline mathSSE::Vec4 -__attribute__((always_inline)) __attribute__ ((pure)) +inline mathSSE::Vec4 __attribute__((always_inline)) __attribute__((pure)) cross(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_cross_pd; - return _mm256_cross_pd(a.vec,b.vec); + using mathSSE::_mm256_cross_pd; + return _mm256_cross_pd(a.vec, b.vec); } -inline double -__attribute__((always_inline)) __attribute__ ((pure)) +inline double __attribute__((always_inline)) __attribute__((pure)) dotxy(mathSSE::Vec4 a, mathSSE::Vec4 b) { - mathSSE::Vec4 mul = a*b; - mul = hadd(mul,mul); + mathSSE::Vec4 mul = a * b; + mul = hadd(mul, mul); return mul.arr[0]; } - #endif