diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointsSeedMakerEventData.h b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointsSeedMakerEventData.h index b0cfe4ad75da4e4b83a73717ee2610ee93debea3..c94de8b1cd17103b3705bf040b449c2700627590 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointsSeedMakerEventData.h +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointsSeedMakerEventData.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////// @@ -84,6 +84,7 @@ namespace InDet { int fvNmin{0}; int zMin{0}; int nOneSeeds{0}; + int nOneSeedsQ{0}; int fillOneSeeds{0}; int nprint{0}; int nseeds{0}; @@ -152,6 +153,7 @@ namespace InDet { std::vector<InDet::SiSpacePointsSeed> OneSeeds; std::vector<InDet::SiSpacePointsProSeed> OneSeeds_Pro; std::vector<ITk::SiSpacePointsProSeed> ITkOneSeeds; + std::vector<ITk::SiSpacePointsProSeed> ITkOneSeedsQ; std::vector<std::pair<float,InDet::SiSpacePointForSeed*>> CmSp; std::vector<std::pair<float,ITk::SiSpacePointForSeed*>> ITkCmSp; @@ -160,9 +162,9 @@ namespace InDet { std::vector<std::vector<InDet::SiSpacePointForSeed*>> rf_Sorted; std::vector<std::vector<InDet::SiSpacePointForSeed*>> rfz_Sorted; ///< vector of space points in each bin of the 2D phi-z binning std::vector<std::vector<InDet::SiSpacePointForSeed*>> rfzv_Sorted; - std::vector<std::list<ITk::SiSpacePointForSeed*>> r_ITkSorted; - std::vector<std::list<ITk::SiSpacePointForSeed*>> rfz_ITkSorted; - std::vector<std::list<ITk::SiSpacePointForSeed*>> rfzv_ITkSorted; + std::vector<std::vector<ITk::SiSpacePointForSeed*>> r_ITkSorted; + std::vector<std::vector<ITk::SiSpacePointForSeed*>> rfz_ITkSorted; + std::vector<std::vector<ITk::SiSpacePointForSeed*>> rfzv_ITkSorted; std::vector<InDet::SiSpacePointsSeed> seeds; @@ -182,7 +184,7 @@ namespace InDet { std::list<ITk::SiSpacePointsProSeed>::iterator i_ITkSeedEnd; std::vector<InDet::SiSpacePointForSeed*>::iterator rMin; - std::list<ITk::SiSpacePointForSeed*>::iterator ITk_rMin; + std::vector<ITk::SiSpacePointForSeed*>::iterator ITk_rMin; std::multimap<float,InDet::SiSpacePointsSeed*> mapOneSeeds; std::multimap<float,InDet::SiSpacePointsSeed*> mapSeeds; @@ -195,6 +197,7 @@ namespace InDet { std::multimap<float,InDet::SiSpacePointsProSeed*> seeds_Pro; std::multimap<float,InDet::SiSpacePointsProSeed*>::iterator seed_Pro; std::multimap<float,ITk::SiSpacePointsProSeed*> ITkMapOneSeeds; + std::multimap<float,ITk::SiSpacePointsProSeed*> ITkMapOneSeedsQ; std::multimap<float,ITk::SiSpacePointsProSeed*> ITkSeeds; std::multimap<float,ITk::SiSpacePointsProSeed*>::iterator ITkSeedIterator; @@ -248,6 +251,7 @@ namespace InDet { OneSeeds.resize(maxOneSize); } else if (type==ToolType::ITk) { ITkOneSeeds.resize(maxOneSize); + ITkOneSeedsQ.resize(maxOneSize); } // Build radius sorted containers diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointForSeed.cxx b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointForSeed.cxx index 87240d12cd5edc28891754cd698eb2fb17a96f26..6c6a03948acdb7fd509d1fe30551564421549db6 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointForSeed.cxx +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointForSeed.cxx @@ -116,9 +116,10 @@ namespace ITk float f22 = float(v(1,1) ); float wid = float(c->width().z()); float cov = wid*wid*.08333; if(cov < f22) cov = f22; - if(de->isBarrel()) {m_covz = 9.*cov; m_covr = .06;} - else {m_covr = 9.*cov; m_covz = .06;} m_sn = nullptr; + cov*=6.; + m_covz = cov*(r[3]*r[3]+r[4]*r[4]); + m_covr = cov*(r[5]*r[5]); } else { @@ -127,9 +128,10 @@ namespace ITk if(de->isBarrel()) {m_covz = 8.*f22; m_covr = .1;} else {m_covr = 8.*f22; m_covz = .1;} m_sn = &sp->clusterList().second->detectorElement()->surface(); - - for(int i=0; i!=3; ++i) {m_b0[i]=r[3 +i]; m_b1[i]=r[6 +i]; m_dr[i]=r[9 +i]; m_r0[i]=r[12+i];} - + + for(int i=0; i!=3; ++i) { + m_b0[i]=r[3 +i]; m_b1[i]=r[6 +i]; m_dr[i]=r[9 +i]; m_r0[i]=r[12+i]; + } } m_su = &sp->clusterList().first->detectorElement()->surface(); } @@ -172,6 +174,7 @@ namespace ITk void SiSpacePointForSeed::set (const Trk::SpacePoint*const& sp,const float* r,const float* sc) { + m_sn = nullptr; spacepoint = sp ; m_x = r[0]; m_y = r[1]; @@ -183,23 +186,18 @@ namespace ITk const InDetDD::SiDetectorElement* de = c ->detectorElement(); if( de->isPixel() ) { - const Amg::MatrixX& v = c->localCovariance(); float f22 = float(v(1,1)); float wid = float(c->width().z()); float cov = wid*wid*.08333; if(cov < f22) cov = f22; - if(de->isBarrel()) {m_covz = 9.*cov*sc[0]; m_covr = .06;} - else {m_covr = 9.*cov*sc[1]; m_covz = .06;} - m_sn = nullptr; - } - else { - + cov*=6.; + m_covz = cov*(r[3]*r[3]+r[4]*r[4]); + m_covr = cov*(r[5]*r[5]); + } else { const Amg::MatrixX& v = sp->localCovariance(); float f22 = float(v(1,1)); if(de->isBarrel()) {m_covz = 8.*f22*sc[2]; m_covr = .1;} else {m_covr = 8.*f22*sc[3]; m_covz = .1;} - m_sn = &sp->clusterList().second->detectorElement()->surface(); - for(int i=0; i!=3; ++i) {m_b0[i]=r[3 +i]; m_b1[i]=r[6 +i]; m_dr[i]=r[9 +i]; m_r0[i]=r[12+i];} } m_su = &sp->clusterList().first->detectorElement()->surface(); @@ -223,14 +221,17 @@ namespace ITk bool SiSpacePointForSeed::coordinates(const float* d,float* r) { - float d0[3] = {m_b1[1]*d[2]-m_b1[2]*d[1],m_b1[2]*d[0]-m_b1[0]*d[2],m_b1[0]*d[1]-m_b1[1]*d[0]}; - float bd0 = m_b0[0]*d0[0]+m_b0[1]*d0[1]+m_b0[2]*d0[2]; if( bd0==0. ) return false; - float s0 =-(m_dr[0]*d0[0]+m_dr[1]*d0[1]+m_dr[2]*d0[2])/bd0; if(s0 < -.05 || s0 > 1.05) return false; - float d1[3] = {m_b0[1]*d[2]-m_b0[2]*d[1],m_b0[2]*d[0]-m_b0[0]*d[2],m_b0[0]*d[1]-m_b0[1]*d[0]}; - float bd1 = m_b1[0]*d1[0]+m_b1[1]*d1[1]+m_b1[2]*d1[2]; if( bd1==0. ) return false; - float s1 = (m_dr[0]*d1[0]+m_dr[1]*d1[1]+m_dr[2]*d1[2])/bd1; if(s1 < -.05 || s1 > 1.05) return false; - + float bd = m_b1[0]*d1[0]+m_b1[1]*d1[1]+m_b1[2]*d1[2]; + + if(std::abs(m_dr[0]*d1[0]+m_dr[1]*d1[1]+m_dr[2]*d1[2]) > std::abs(bd)*1.1) return false; + + float s0 = m_dr[0]*(m_b1[1]*d[2]-m_b1[2]*d[1])+ + m_dr[1]*(m_b1[2]*d[0]-m_b1[0]*d[2])+ + m_dr[2]*(m_b1[0]*d[1]-m_b1[1]*d[0]); + if(std::abs(s0) > std::abs(bd)*1.1) return false; + + s0/=bd; r[0] = m_r0[0]+m_b0[0]*s0; r[1] = m_r0[1]+m_b0[1]*s0; r[2] = m_r0[2]+m_b0[2]*s0; diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointsProSeed.cxx b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointsProSeed.cxx index 44bf3de6cbba23982161edf333bca368da5ae000..1c9d764730178244164c7ab5df751eb8d99ae34c 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointsProSeed.cxx +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointsProSeed.cxx @@ -87,11 +87,9 @@ namespace ITk bool SiSpacePointsProSeed::set3(InDet::SiSpacePointsSeed& s) { - - bool pixb = !m_s0->spacepoint->clusterList().second; bool pixt = !m_s2->spacepoint->clusterList().second; - if(pixb!=pixt) { + if(pixt) { if(m_q > m_s0->quality() && m_q > m_s1->quality() && m_q > m_s2->quality()) return false; } @@ -103,7 +101,24 @@ namespace ITk s.add(m_s0->spacepoint); s.add(m_s1->spacepoint); s.add(m_s2->spacepoint); + s.setD0(m_s2->param()); s.setZVertex(double(m_z)); + s.setEta(m_s2->eta()); + s.setX1(m_s0->x()); + s.setX2(m_s1->x()); + s.setX3(m_s2->x()); + s.setY1(m_s0->y()); + s.setY2(m_s1->y()); + s.setY3(m_s2->y()); + s.setZ1(m_s0->z()); + s.setZ2(m_s1->z()); + s.setZ3(m_s2->z()); + s.setR1(m_s0->radius()); + s.setR2(m_s1->radius()); + s.setR3(m_s2->radius()); + s.setDZDR_B(m_s0->dzdr()); + s.setDZDR_T(m_s2->dzdr()); + s.setPt(m_s2->pt()); return true; } @@ -117,7 +132,7 @@ namespace ITk bool pixb = !m_s0->spacepoint->clusterList().second; bool pixt = !m_s2->spacepoint->clusterList().second; if(pixb==pixt) { - m_s0->setQuality(q); + m_s0->setQuality(q); m_s1->setQuality(q); m_s2->setQuality(q); return true; diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ITkSiSpacePointsSeedMaker.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ITkSiSpacePointsSeedMaker.h index 6413354b06fa564f184e55efffab60e45a5a3c64..d583f5d18a787f0d8778b20deee0209cdc99a6f6 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ITkSiSpacePointsSeedMaker.h +++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ITkSiSpacePointsSeedMaker.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////// @@ -212,10 +212,10 @@ namespace ITk FloatProperty m_rmaxSSS{this, "radMaxSSS", 1000.}; BooleanProperty m_isLRT{this, "isLRT", false}; FloatProperty m_drminPPP{this, "mindRadiusPPP", 6.}; - FloatProperty m_drmaxPPP{this, "maxdRadiusPPP", 140.}; + FloatProperty m_drmaxPPP{this, "maxdRadiusPPP", 120.}; FloatProperty m_zmaxPPP{this, "maxZPPP", 2700.}; FloatProperty m_drminSSS{this, "mindRadiusSSS", 20.}; - FloatProperty m_drmaxSSS{this, "maxdRadiusSSS", 3000.}; + FloatProperty m_drmaxSSS{this, "maxdRadiusSSS", 300.}; FloatProperty m_zmaxSSS{this, "maxZSSS", 2700.}; FloatProperty m_dImpactCutSlopeUnconfirmedSSS{this, "dImpactCutSlopeUnconfirmedSSS", 1.0}; FloatProperty m_dImpactCutSlopeUnconfirmedPPP{this, "dImpactCutSlopeUnconfirmedPPP", 0.}; @@ -266,7 +266,7 @@ namespace ITk float m_dzdrmax0{0.}; float m_ipt{0.}; float m_ipt2{0.}; - float m_COF{0.}; + float m_COF{134 * .05 * 9}; float m_dzMaxFast {200.}; float m_R2MaxFast {2500.}; float m_rmaxPPP {140.}; @@ -403,6 +403,11 @@ namespace ITk SiSpacePointForSeed*&,SiSpacePointForSeed*&, SiSpacePointForSeed*&,float,float) const; + void newOneSeedQ + (EventData& data, + SiSpacePointForSeed*&,SiSpacePointForSeed*&, + SiSpacePointForSeed*&,float,float) const; + void newOneSeedWithCurvaturesComparison (EventData& data, SiSpacePointForSeed*&,SiSpacePointForSeed*&,float) const; @@ -443,27 +448,27 @@ namespace ITk **/ void production3SpSSS (EventData& data, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_bottomCands, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_endBottomCands, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_topCands, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_endTopCands, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_bottomCands, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_endBottomCands, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_topCands, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_endTopCands, const int numberBottomCells, const int numberTopCells, int& nseed) const; void production3SpPPP (EventData& data, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_bottomCands, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_endBottomCands, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_topCands, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_endTopCands, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_bottomCands, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_endBottomCands, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_topCands, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & iter_endTopCands, const int numberBottomCells, const int numberTopCells, int& nseed) const; /// as above, but for the trigger void production3SpTrigger (EventData& /*data*/, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & /*rb*/, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & /*rbe*/, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & /*rt*/, - std::array<std::list<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & /*rte*/, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & /*rb*/, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & /*rbe*/, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & /*rt*/, + std::array<std::vector<SiSpacePointForSeed*>::iterator, arraySizeNeighbourBins> & /*rte*/, const int /*numberBottomCells*/, const int /*numberTopCells*/, int& /*nseed*/) const; /** This creates all possible seeds with the passed central and bottom SP, using all top SP diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ITkSiSpacePointsSeedMaker.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ITkSiSpacePointsSeedMaker.cxx index ed579c220c7fb8fbc9132b04e23c9b88ebcd087c..727570bdba023e1508794686e05390a72f94de22 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ITkSiSpacePointsSeedMaker.cxx +++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ITkSiSpacePointsSeedMaker.cxx @@ -95,7 +95,7 @@ StatusCode SiSpacePointsSeedMaker::initialize() m_outputTree = new TTree( m_treeName.c_str() , "SeedMakerValTool"); - m_outputTree->Branch("eventNumber", &m_eventNumber); + m_outputTree->Branch("eventNumber", &m_eventNumber,"eventNumber/L"); m_outputTree->Branch("d0", &m_d0); m_outputTree->Branch("z0", &m_z0); m_outputTree->Branch("pt", &m_pt); @@ -1112,8 +1112,8 @@ void SiSpacePointsSeedMaker::buildFrameWork() if (m_maxPhiBinSSS >= nPhiBinsMax) m_maxPhiBinSSS = nPhiBinsMax - 1; /// recompute inverse bin size, taking into account rounding + truncation - m_inverseBinSizePhiPPP = m_maxPhiBinPPP / twoPi; - m_inverseBinSizePhiSSS = m_maxPhiBinSSS / twoPi; + m_inverseBinSizePhiPPP = ( m_maxPhiBinPPP + 1 ) / twoPi; + m_inverseBinSizePhiSSS = ( m_maxPhiBinSSS + 1 ) / twoPi; buildConnectionMaps(m_nNeighbourCellsBottomPPP, m_nNeighbourCellsTopPPP, m_neighbourCellsBottomPPP, m_neighbourCellsTopPPP, @@ -1424,7 +1424,7 @@ void SiSpacePointsSeedMaker::fillLists(EventData &data) const continue; // Stop when we reach strip SP in PPP iteration #1 - std::list<SiSpacePointForSeed *>::iterator SP_first = data.r_ITkSorted[radialBin].begin(); + std::vector<SiSpacePointForSeed *>::iterator SP_first = data.r_ITkSorted[radialBin].begin(); if (data.iteration && (*SP_first)->spacepoint->clusterList().second) break; @@ -1648,7 +1648,7 @@ void SiSpacePointsSeedMaker::fillListsFast(const EventContext &ctx, EventData &d { if (data.rfz_ITkSorted[twoDbin].size() > 1) { - data.rfz_ITkSorted[twoDbin].sort(SiSpacePointsComparison_R()); + std::sort(data.rfz_ITkSorted[twoDbin].begin(), data.rfz_ITkSorted[twoDbin].end(), SiSpacePointsComparison_R()); } } @@ -1758,7 +1758,7 @@ void SiSpacePointsSeedMaker::production2Sp(EventData &data) const if (data.nsazv < 2) return; - std::list<SiSpacePointForSeed *>::iterator r0, r0e, r, re; + std::vector<SiSpacePointForSeed *>::iterator r0, r0e, r, re; int nseed = 0; // Loop thorugh all azimuthal regions @@ -1909,14 +1909,15 @@ void SiSpacePointsSeedMaker::production3Sp(EventData &data) const bool isPixel = (m_fastTracking && m_pixel) || data.iteration == 1; const auto zBinIndex = isPixel ? zBinIndex_PPP : zBinIndex_SSS; - const float RTmax[11] = {80., 100., 150., 200., 250., 250., 250., 200., 150., 100., 80.}; + const float RTmax[11] = { 80., 200., 200., 200., 250., 250., 250., 200., 200., 200., 80.}; + const float RTmin[11] = { 40., 40., 70., 70., 70., 70., 70., 70., 70., 40., 40.}; /// prepare arrays to store the iterators over the SP containers for all /// neighbouring cells we wish to consider in the seed formation - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> iter_topCands; - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> iter_endTopCands; - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> iter_bottomCands; - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> iter_endBottomCands; + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> iter_topCands; + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> iter_endTopCands; + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> iter_bottomCands; + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> iter_endBottomCands; int nPhiBins; std::array<int, arraySizePhiZ> nNeighbourCellsBottom{}; @@ -1965,6 +1966,7 @@ void SiSpacePointsSeedMaker::production3Sp(EventData &data) const if (m_fastTracking && m_pixel) { data.RTmax = RTmax[ zBinIndex[z] ]; + data.RTmin = RTmin[ zBinIndex[z] ]; } int phiZbin = phiBin * arraySizeZ + zBinIndex[z]; @@ -2044,10 +2046,10 @@ void SiSpacePointsSeedMaker::production3Sp(EventData &data) const /////////////////////////////////////////////////////////////////// void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_bottomCands, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endBottomCands, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_topCands, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endTopCands, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_bottomCands, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endBottomCands, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_topCands, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endTopCands, const int numberBottomCells, const int numberTopCells, int &nseed) const { /** @@ -2057,8 +2059,7 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, **/ /// iterator across the candidates for the central space point. - std::list<SiSpacePointForSeed *>::iterator iter_centralSP = iter_bottomCands[0]; - std::list<SiSpacePointForSeed *>::iterator iter_otherSP; ///< will be used for iterating over top/bottom SP + std::vector<SiSpacePointForSeed *>::iterator iter_centralSP = iter_bottomCands[0]; /** * Next, we work out where we are within the ATLAS geometry. @@ -2111,8 +2112,9 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, float covr0 = (*iter_centralSP)->covr(); float covz0 = (*iter_centralSP)->covz(); - float ax = X / R; - float ay = Y / R; + float Ri = 1. / R; + float ax = X * Ri; + float ay = Y * Ri; float VR = maxd0cut / (R * R); size_t Ntm = 2; if (R > m_rmaxPPP) @@ -2126,27 +2128,22 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, /// Loop over all the cells where we expect to find such SP for (int cell = 0; cell < numberTopCells; ++cell) { - - if (iter_otherSP == iter_endTopCands[cell]) - continue; - + std::vector<SiSpacePointForSeed *>::iterator iter_otherSP = iter_topCands[cell], iter_otherSPend = iter_endTopCands[cell]; + if (iter_otherSP == iter_otherSPend) continue; + + for(; iter_otherSP!=iter_otherSPend; ++iter_otherSP) { + if(( (*iter_otherSP)->radius()- R ) >= m_drminPPP) break; + } + iter_topCands[cell]=iter_otherSP; + /// loop over each SP in each cell - for (iter_otherSP = iter_topCands[cell]; iter_otherSP != iter_endTopCands[cell]; ++iter_otherSP) + for (; iter_otherSP != iter_endTopCands[cell]; ++iter_otherSP) { /// evaluate the radial distance, float Rt = (*iter_otherSP)->radius(); float dR = Rt - R; - /// and continue if we are too close - if (dR < m_drminPPP) - { - iter_topCands[cell] = iter_otherSP; - continue; - } - - /// if we are too far, the next ones will be even farther, so abort - if (!m_fastTracking && dR > m_drmaxPPP) - break; + const float dz = (*iter_otherSP)->z() - Z; const float dZdR = dz / dR; @@ -2215,21 +2212,22 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, /// Loop over all the cells where we expect to find such SP for (int cell = 0; cell < numberBottomCells; ++cell) { + + std::vector<SiSpacePointForSeed*>::iterator iter_otherSP = iter_bottomCands[cell]; + + for(; iter_otherSP!=iter_endBottomCands[cell]; ++iter_otherSP) { + if( (R - (*iter_otherSP)->radius()) <= m_drmaxPPP) break; + } + iter_bottomCands[cell]=iter_otherSP; + /// in each cell, loop over the space points - for (iter_otherSP = iter_bottomCands[cell]; iter_otherSP != iter_endBottomCands[cell]; ++iter_otherSP) + for (; iter_otherSP != iter_endBottomCands[cell]; ++iter_otherSP) { /// evaluate the radial distance between the central and bottom SP const float &Rb = (*iter_otherSP)->radius(); float dR = R - Rb; - /// if the bottom SP is too far, remember this for future iterations and - /// don't bother starting from the beginning again - if (dR > m_drmaxPPP) - { - iter_bottomCands[cell] = iter_otherSP; - continue; - } /// if the points are too close in r, abort (future ones will be even closer). if (dR < m_drminPPP) break; @@ -2300,7 +2298,9 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, sort(data.Tn,Nt,Nb-Nt); data.nOneSeeds = 0; + data.nOneSeedsQ = 0; data.ITkMapOneSeeds.clear(); + data.ITkMapOneSeedsQ.clear(); /// Three space points comparison /// first, loop over the bottom point candidates @@ -2332,7 +2332,7 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, size_t Nc = 1; if (data.ITkSP[b]->radius() > m_rmaxPPP) Nc = 0; - if (data.nOneSeeds) + if (data.nOneSeedsQ) ++Nc; /// inner loop over the top point candidates @@ -2416,7 +2416,7 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, { if (Tzb - Tzt < 0.) break; - it0 = it + 1; + it0 = it; continue; } @@ -2456,6 +2456,7 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, meanOneOverTanTheta = 1e-8; if (BSquare < 1e-8) BSquare = 1e-8; + if(data.ITkSP[t]->z()<0) meanOneOverTanTheta = -meanOneOverTanTheta; float theta = std::atan(1. / std::sqrt(meanOneOverTanThetaSquare)); data.ITkSP[t]->setEta(-std::log(std::tan(0.5 * theta))); data.ITkSP[t]->setPt(std::sqrt(onePlusAsquare / BSquare) / (1000 * data.K)); @@ -2487,10 +2488,10 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, /////////////////////////////////////////////////////////////////// void SiSpacePointsSeedMaker::production3SpSSS(EventData &data, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_bottomCands, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endBottomCands, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_topCands, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endTopCands, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_bottomCands, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endBottomCands, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_topCands, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endTopCands, const int numberBottomCells, const int numberTopCells, int &nseed) const { @@ -2501,8 +2502,8 @@ void SiSpacePointsSeedMaker::production3SpSSS(EventData &data, **/ /// iterator across the candidates for the central space point. - std::list<SiSpacePointForSeed *>::iterator iter_centralSP = iter_bottomCands[0]; - std::list<SiSpacePointForSeed *>::iterator iter_otherSP; ///< will be used for iterating over top/bottom SP + std::vector<SiSpacePointForSeed *>::iterator iter_centralSP = iter_bottomCands[0]; + std::vector<SiSpacePointForSeed *>::iterator iter_otherSP; ///< will be used for iterating over top/bottom SP /** * Next, we work out where we are within the ATLAS geometry. @@ -2562,9 +2563,6 @@ void SiSpacePointsSeedMaker::production3SpSSS(EventData &data, for (int cell = 0; cell < numberTopCells; ++cell) { - if (iter_otherSP == iter_endTopCands[cell]) - continue; - for (iter_otherSP = iter_topCands[cell]; iter_otherSP != iter_endTopCands[cell]; ++iter_otherSP) { /// evaluate the radial distance, @@ -2622,21 +2620,20 @@ void SiSpacePointsSeedMaker::production3SpSSS(EventData &data, /// Loop over all the cells where we expect to find such SP for (int cell = 0; cell < numberBottomCells; ++cell) { + + for(iter_otherSP=iter_bottomCands[cell]; iter_otherSP!=iter_endBottomCands[cell]; ++iter_otherSP) { + if((R-(*iter_otherSP)->radius()) <= m_drmaxSSS) break; + } + iter_bottomCands[cell]=iter_otherSP; + /// in each cell, loop over the space points - for (iter_otherSP = iter_bottomCands[cell]; iter_otherSP != iter_endBottomCands[cell]; ++iter_otherSP) + for (; iter_otherSP != iter_endBottomCands[cell]; ++iter_otherSP) { /// evaluate the radial distance between the central and bottom SP const float &Rb = (*iter_otherSP)->radius(); float dR = R - Rb; - /// if the bottom SP is too far, remember this for future iterations and - /// don't bother starting from the beginning again - if (dR > m_drmaxSSS) - { - iter_bottomCands[cell] = iter_otherSP; - continue; - } /// if the points are too close in r, abort (future ones will be even closer). if (dR < m_drminSSS) break; @@ -2715,7 +2712,9 @@ void SiSpacePointsSeedMaker::production3SpSSS(EventData &data, } data.nOneSeeds = 0; + data.nOneSeedsQ = 0; data.ITkMapOneSeeds.clear(); + data.ITkMapOneSeedsQ.clear(); /// Three space points comparison /// first, loop over the bottom point candidates @@ -2898,13 +2897,14 @@ void SiSpacePointsSeedMaker::production3SpSSS(EventData &data, /// deviate from a straight line in r-z data.ITkSP[t]->setScorePenalty(std::abs((tb - tz) / (dr * sTzb2))); data.ITkSP[t]->setParam(d0); - float DR = xt * xt + yt * yt + zt * zt; // distance between top and central SP + float DR = std::sqrt( xt * xt + yt * yt + zt * zt ); // distance between top and central SP data.ITkSP[t]->setDR(DR); if (meanOneOverTanTheta < 1e-8) meanOneOverTanTheta = 1e-8; if (BSquare < 1e-8) BSquare = 1e-8; + if(data.ITkSP[t]->z()<0) meanOneOverTanTheta = -meanOneOverTanTheta; float theta = std::atan(1. / meanOneOverTanTheta); data.ITkSP[t]->setEta(-std::log(std::tan(0.5 * theta))); data.ITkSP[t]->setPt(std::sqrt(onePlusAsquare / BSquare) / (1000 * data.K)); @@ -2935,13 +2935,13 @@ void SiSpacePointsSeedMaker::production3SpSSS(EventData &data, /////////////////////////////////////////////////////////////////// void SiSpacePointsSeedMaker::production3SpTrigger(EventData &data, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &rb, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &rbe, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &rt, - std::array<std::list<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &rte, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &rb, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &rbe, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &rt, + std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &rte, const int numberBottomCells, const int numberTopCells, int &nseed) const { - std::list<SiSpacePointForSeed *>::iterator r0 = rb[0], r; + std::vector<SiSpacePointForSeed *>::iterator r0 = rb[0], r; if (!data.endlist) { r0 = data.ITk_rMin; @@ -3195,6 +3195,57 @@ void SiSpacePointsSeedMaker::newOneSeed(EventData &data, } } + +void SiSpacePointsSeedMaker::newOneSeedQ(EventData &data, + SiSpacePointForSeed *&p1, SiSpacePointForSeed *&p2, + SiSpacePointForSeed *&p3, float z, float seedCandidateQuality) const +{ + /// get the worst seed so far + float worstQualityInMap = std::numeric_limits<float>::min(); + SiSpacePointsProSeed *worstSeedSoFar = nullptr; + if (!data.ITkMapOneSeedsQ.empty()) + { + std::multimap<float, SiSpacePointsProSeed *>::reverse_iterator l = data.ITkMapOneSeedsQ.rbegin(); + worstQualityInMap = (*l).first; + worstSeedSoFar = (*l).second; + } + /// There are three cases where we simply add our new seed to the list and push it into the map: + /// a) we have not yet reached our max number of seeds + if (data.nOneSeedsQ < data.maxSeedsPerSP + /// b) we have reached the max number but always want to keep confirmed seeds + /// and the new seed is a confirmed one, with worse quality than the worst one so far + || (m_useSeedConfirmation && data.keepAllConfirmedSeeds && worstQualityInMap <= seedCandidateQuality && isConfirmedSeed(p1, p3, seedCandidateQuality) && data.nOneSeedsQ < data.seedPerSpCapacity) + /// c) we have reached the max number but always want to keep confirmed seeds + ///and the new seed of higher quality than the worst one so far, with the latter however being confirmed + || (m_useSeedConfirmation && data.keepAllConfirmedSeeds && worstQualityInMap > seedCandidateQuality && isConfirmedSeed(worstSeedSoFar->spacepoint0(), worstSeedSoFar->spacepoint2(), worstQualityInMap) && data.nOneSeedsQ < data.seedPerSpCapacity)) + { + data.ITkOneSeedsQ[data.nOneSeedsQ].set(p1, p2, p3, z); + data.ITkMapOneSeedsQ.insert(std::make_pair(seedCandidateQuality, &data.ITkOneSeedsQ[data.nOneSeedsQ])); + ++data.nOneSeedsQ; + } + + /// otherwise, we check if there is a poorer-quality seed that we can kick out + else if (worstQualityInMap > seedCandidateQuality) + { + /// Overwrite the parameters of the worst seed with the new one + worstSeedSoFar->set(p1, p2, p3, z); + /// re-insert it with its proper quality to make sure it ends up in the right place + std::multimap<float, SiSpacePointsProSeed *>::iterator + i = data.ITkMapOneSeedsQ.insert(std::make_pair(seedCandidateQuality, worstSeedSoFar)); + /// and remove the entry with the old quality to avoid duplicates + for (++i; i != data.ITkMapOneSeedsQ.end(); ++i) + { + if ((*i).second == worstSeedSoFar) + { + data.ITkMapOneSeedsQ.erase(i); + return; + } + } + } +} + + + /////////////////////////////////////////////////////////////////// // New 3 space points pro seeds production /////////////////////////////////////////////////////////////////// @@ -3277,6 +3328,10 @@ void SiSpacePointsSeedMaker::newOneSeedWithCurvaturesComparison(EventData &data, data.ITkCmSp.clear(); } + + + + /////////////////////////////////////////////////////////////////// // Fill seeds /////////////////////////////////////////////////////////////////// @@ -3288,6 +3343,11 @@ void SiSpacePointsSeedMaker::fillSeeds(EventData &data) std::multimap<float, SiSpacePointsProSeed *>::iterator it_seedCandidate = data.ITkMapOneSeeds.begin(); std::multimap<float, SiSpacePointsProSeed *>::iterator it_endSeedCandidates = data.ITkMapOneSeeds.end(); + if (data.nOneSeedsQ){ + it_seedCandidate = data.ITkMapOneSeedsQ.begin(); + it_endSeedCandidates = data.ITkMapOneSeedsQ.end(); + } + /// no seeds - nothing to do. if (it_seedCandidate == it_endSeedCandidates) return; @@ -3667,7 +3727,7 @@ void SiSpacePointsSeedMaker::newOneSeedWithCurvaturesComparisonPPP(EventData &da } int dN = NT - NTc; - if (dN < 0 || (data.nOneSeeds && !dN)) + if (dN < 0 || (data.nOneSeedsQ && !dN)) continue; if (Qm && !dN && seedIP > 1.) continue; @@ -3678,14 +3738,14 @@ void SiSpacePointsSeedMaker::newOneSeedWithCurvaturesComparisonPPP(EventData &da continue; if (dN) - newOneSeed(data, SPb, SP0, SPt, Zob, Q); + newOneSeedQ(data, SPb, SP0, SPt, Zob, Q); else if (Q < Qmin) { Qmin = Q; SPmin = SPt; } } ///< end of loop over top SP candidates - if (SPmin && !data.nOneSeeds) + if (SPmin && !data.nOneSeedsQ) newOneSeed(data, SPb, SP0, SPmin, Zob, Qmin); data.ITkCmSp.clear(); }