diff --git a/Trigger/TrigTools/TrigInDetRecoTools/CMakeLists.txt b/Trigger/TrigTools/TrigInDetRecoTools/CMakeLists.txt deleted file mode 100644 index e081a34027f8d85b9c2a0fecd015ab6625557d8f..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -################################################################################ -# Package: TrigInDetRecoTools -################################################################################ - -# Declare the package name: -atlas_subdir( TrigInDetRecoTools ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - GaudiKernel - InnerDetector/InDetRecEvent/InDetPrepRawData - InnerDetector/InDetRecEvent/SiSpacePoint - InnerDetector/InDetRecTools/InDetRecToolInterfaces - Tracking/TrkEvent/TrkSpacePoint - Tracking/TrkEvent/TrkTrack - Tracking/TrkEvent/TrkEventUtils - Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigEvent/TrigInDetPattRecoEvent - Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigTools/TrigInDetToolInterfaces - InnerDetector/InDetConditions/BeamSpotConditionsData - PRIVATE - Control/AthenaKernel - DetectorDescription/GeoPrimitives - DetectorDescription/IRegionSelector - Event/ByteStreamCnvSvcBase - Event/EventInfo - InnerDetector/InDetConditions/InDetBeamSpotService - InnerDetector/InDetDetDescr/InDetIdentifier - InnerDetector/InDetDetDescr/InDetReadoutGeometry - InnerDetector/InDetDetDescr/PixelReadoutGeometry - InnerDetector/InDetDetDescr/SCT_ReadoutGeometry - InnerDetector/InDetRecEvent/InDetRIO_OnTrack - InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData - Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkEvent/TrkEventPrimitives - Tracking/TrkEvent/TrkParameters - Tracking/TrkEvent/TrkRIO_OnTrack - Tracking/TrkEvent/TrkSegment - Trigger/TrigTools/TrigTimeAlgs ) - -# External dependencies: -find_package( Eigen ) -find_package( tdaq-common ) - -# Component(s) in the package: -atlas_add_component( TrigInDetRecoTools - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData SiSpacePoint InDetRecToolInterfaces TrkSpacePoint TrkTrack TrigInDetEvent TrigInDetPattRecoEvent TrigSteeringEvent AthenaKernel GeoPrimitives IRegionSelector ByteStreamCnvSvcBaseLib EventInfo InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry InDetRIO_OnTrack SiSPSeededTrackFinderData TrkSurfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkSegment TrigTimeAlgsLib TrkEventUtils) - -# Install files from the package: -atlas_install_headers( TrigInDetRecoTools ) -atlas_install_python_modules( python/*.py ) - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2DupTrackRemovalTool.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2DupTrackRemovalTool.h deleted file mode 100644 index f0118b61eac4de0285b07553f21f6ca68ee98ef6..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2DupTrackRemovalTool.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __ITRIG_L2_DUP_TRACK_REMOVAL_TOOL_H__ -#define __ITRIG_L2_DUP_TRACK_REMOVAL_TOOL_H__ - -#include<vector> -#include<algorithm> -#include<iterator> - -#include "GaudiKernel/IAlgTool.h" -//#include "TrigInDetPattRecoEvent/TrigFTK_TrackSeed.h" -//#include "TrigSteeringEvent/Enums.h" - -class TrigInDetTrackCollection; - -static const InterfaceID IID_ITrigL2DupTrackRemovalTool("ITrigL2DupTrackRemovalTool",1,0); - -class ITrigL2DupTrackRemovalTool: virtual public IAlgTool { - public: - static const InterfaceID& interfaceID() { - return IID_ITrigL2DupTrackRemovalTool; - } - virtual void removeDupTracks(TrigInDetTrackCollection* trackColl, std::vector<unsigned int> placeHolder) = 0; - - //protected: - - //std::vector<float> m_zVertices;// vector of z-vertex coordinates for monitoring -}; - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2LayerSetPredictorTool.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2LayerSetPredictorTool.h deleted file mode 100644 index eb2138aeedd9728986afba4af0b1226d895503b9..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2LayerSetPredictorTool.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __ITRIG_L2_LAYER_SET_PREDICTOR_TOOL_H__ -#define __ITRIG_L2_LAYER_SET_PREDICTOR_TOOL_H__ - -#include "GaudiKernel/IAlgTool.h" -#include "TrigInDetPattRecoEvent/TrigL2LayerSetLUT.h" - -static const InterfaceID IID_ITrigL2LayerSetPredictorTool("ITrigL2LayerSetPredictorTool",1,0); - -class ITrigL2LayerSetPredictorTool: virtual public IAlgTool { - public: - static const InterfaceID& interfaceID() { - return IID_ITrigL2LayerSetPredictorTool; - } - virtual StatusCode createLUT() = 0; - virtual const TrigL2LayerSetLUT* getLUT() = 0; -}; - -#endif diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2PattRecoStrategy.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2PattRecoStrategy.h deleted file mode 100644 index 034dfe8dc0baf54534ba858804cbfa96b531d673..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2PattRecoStrategy.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __ITRIG_L2_PATT_RECO_STRATEGY_H__ -#define __ITRIG_L2_PATT_RECO_STRATEGY_H__ - -#include<vector> -#include<algorithm> -#include<iterator> - -#include "GaudiKernel/IAlgTool.h" -#include "TrigSteeringEvent/Enums.h" - -class TrigSiSpacePoint; -class IRoiDescriptor; -class TrigInDetTrackCollection; -class TrigVertexCollection; - -static const InterfaceID IID_ITrigL2PattRecoStrategy("ITrigL2PattRecoStrategy",1,0); - -class ITrigL2PattRecoStrategy: virtual public IAlgTool { - public: - static const InterfaceID& interfaceID() { - return IID_ITrigL2PattRecoStrategy; - } - virtual HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>&, - const IRoiDescriptor&, - TrigInDetTrackCollection*) = 0; - - virtual HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>&, - TrigInDetTrackCollection*) = 0; - - virtual HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>& sp, - const IRoiDescriptor& roi, - const TrigVertexCollection*, - TrigInDetTrackCollection* trk) { - return findTracks(sp,roi,trk); - } - - virtual HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>& sp, - const TrigVertexCollection*, - TrigInDetTrackCollection* trk) { - return findTracks(sp,trk); - } - - virtual double getTimingA() const = 0; - void getZvertices(std::vector<float>& v) { - v.clear(); - v.reserve(m_zVertices.size()); - std::copy(m_zVertices.begin(),m_zVertices.end(),std::back_inserter(v)); - } - - protected: - - std::vector<float> m_zVertices;// vector of z-vertex coordinates for monitoring -}; - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2SeededPattRecoStrategy.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2SeededPattRecoStrategy.h deleted file mode 100644 index a2cc31965ec1cd38301a4a1d8a26efc00be1b532..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/ITrigL2SeededPattRecoStrategy.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __ITRIG_L2_SEEDED_PATT_RECO_STRATEGY_H__ -#define __ITRIG_L2_SEEDED_PATT_RECO_STRATEGY_H__ - -#include<vector> -#include<algorithm> -#include<iterator> - -#include "GaudiKernel/IAlgTool.h" -#include "TrigSteeringEvent/Enums.h" - -class TrigSiSpacePoint; -class IRoiDescriptor; -class TrigInDetTrackCollection; - -static const InterfaceID IID_ITrigL2SeededPattRecoStrategy("ITrigL2SeededPattRecoStrategy",1,0); - -class ITrigL2SeededPattRecoStrategy: virtual public IAlgTool { - public: - static const InterfaceID& interfaceID() { - return IID_ITrigL2SeededPattRecoStrategy; - } - virtual HLT::ErrorCode findTracks(const TrigInDetTrackCollection&, - const std::vector<const TrigSiSpacePoint*>&, - const IRoiDescriptor&, - TrigInDetTrackCollection*) = 0; - - virtual HLT::ErrorCode findTracks(const TrigInDetTrackCollection&, - const std::vector<const TrigSiSpacePoint*>&, - TrigInDetTrackCollection*) = 0; - - virtual double getTimingA() const = 0; - void getZvertices(std::vector<float>& v) { - v.clear(); - v.reserve(m_zVertices.size()); - std::copy(m_zVertices.begin(),m_zVertices.end(),std::back_inserter(v)); - } - - protected: - - std::vector<float> m_zVertices;// vector of z-vertex coordinates for monitoring -}; - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/StrBTrack.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/StrBTrack.h deleted file mode 100644 index b77c232530c325fa542e6a33ffbca345842f027e..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/StrBTrack.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef STRBTRACK_H -#define STRBTRACK_H - -#include <vector> -#include <set> -#include <map> -#include <list> -#include <functional> - -class TrigSiSpacePoint; - - - -/****************************************************************/ -/****************************************************************/ -/** class StrBRoad **/ -/****************************************************************/ -/****************************************************************/ - -class StrBRoad { - - public: - - StrBRoad() : lay1(100), lay2(100) {} - - // StrBRoad() {} - - ~StrBRoad() {} - - - public: - - int lay1, lay2; - - std::set<int> lay3; - -}; - - - -/****************************************************************/ -/****************************************************************/ -/** class StrBSeed **/ -/****************************************************************/ -/****************************************************************/ - -class StrBSeed { - - public: - - StrBSeed() : deleted(false) { - for(unsigned int i=0; i<20; i++) {layer[i]=false; phiext[i]=1000;} - } - ~StrBSeed() {} - - public: - - // Track parameters - float eta, phi, d02, z; - bool deleted; - - // Space points - const TrigSiSpacePoint *sp1, *sp2; - - // Seed cut quantities - float dr; // m_seedingPreCutRZ - float z0; // m_vertexingCutRZ - float z12; - float dphi; // m_seedingPreCutPhi - float phi0; // m_seedingPreCutRPhi - - // Cached selection information - float costheta; - float deltax12; - float deltay12; - float deltaz12; - float deltar12; - - // Extrapolation information - bool layer[20]; - float xext[20]; - float yext[20]; - float zext[20]; - float rext[20]; - float dzext[20]; - float drext[20]; - float phiext[20]; - float dphiext[20]; -}; - - - -/****************************************************************/ -/****************************************************************/ -/** class StrBTriplet **/ -/****************************************************************/ -/****************************************************************/ - -class StrBTriplet { - - public: - - StrBTriplet() : deleted(false) {} - ~StrBTriplet() {} - - public: - - // Track parameters - float eta, phi, d0, pt, z0; - float chi2; - bool deleted; - - // Space points - const TrigSiSpacePoint *sp1, *sp2, *sp3; - - // Seed cut quantities - float dr; // m_seedingPreCutRZ - float dphi; // m_seedingPreCutPhi - float phi0; // m_seedingPreCutRPhi - float drz; - float drp; -}; - - - -/****************************************************************/ -/****************************************************************/ -/** class StrBTrack **/ -/****************************************************************/ -/****************************************************************/ - -class StrBTrack { - - public: - - StrBTrack() : deleted(false), merged(false), removed(false) { - sp.resize(m_maxLay,0); - sp2.resize(m_maxLay,0); - tr.resize(m_maxLay,0); - tr2.resize(m_maxLay,0); - spRej.resize(m_maxLay,0); - spRej2.resize(m_maxLay,0); - spShared.resize(m_maxLay,0); - spDistance.resize(m_maxLay,1000); - chi2=0; - } - - ~StrBTrack() { - sp.clear(); - sp2.clear(); - tr.clear(); - tr2.clear(); - spRej.clear(); - spRej2.clear(); - spShared.clear(); - spDistance.clear(); - } - - public: - - // Track parameters - float eta, phi; - float chi2; - bool deleted, merged, removed; - - // Space points - std::vector<const TrigSiSpacePoint*> sp; - std::vector<const TrigSiSpacePoint*> sp2; - std::vector<const StrBTriplet*> tr; - std::vector<const StrBTriplet*> tr2; - std::vector<int> spRej; - std::vector<int> spRej2; - - std::vector<int> spShared; - int sumSp; - int sumSpAll; - - // Distances - std::vector<float> spDistance; - float sumSpDistance; - - private: - - static int m_maxLay; - - public: - - static void setMaxLay(int maxLay) {m_maxLay=maxLay;} - int getMaxLay() const {return m_maxLay;} - - public: - - void evaluateSum() { - sumSp=0; sumSpAll=0; sumSpDistance=0.0; - for(int i=0; i<m_maxLay; i++) { - if(sp[i]!=0) { - sumSp++; - sumSpAll++; - sumSpDistance += spDistance[i]; - } - if(sp2[i]!=0) { - sumSpAll++; - } - } - } - - - float evaluateSharedFraction() { - int total=0, shared=0; - for(int i=0; i<m_maxLay; i++) { - if(sp[i]!=0) { - total++; - shared += spShared[i]; - } - } - return ((float)shared/total); - } - - - void resetDistance() { - for(int i=0; i<m_maxLay; i++) {spDistance[i]=0;} - } - - - friend bool operator<(const StrBTrack &t1, const StrBTrack &t2) { - - // Count space points - int sp1=0, sp2=0; - int lay1=0, lay2=0; - for(int i=0; i<t1.getMaxLay(); i++) { - if(t1.sp[i]!=0) {sp1++; lay1++;} - if(t2.sp[i]!=0) {sp2++; lay2++;} - if(t1.sp2[i]!=0) sp1++; - if(t2.sp2[i]!=0) sp2++; - } - if(t1.deleted) lay1=0; - if(t2.deleted) lay2=0; - - // Evaluate bool relations - bool isLayBetter = (lay1 > lay2); - bool isLayEqual = (lay1 == lay2); - bool isSpBetter = (sp1 > sp2); - bool isSpEqual = (sp1 == sp2); - bool isChi2Better = (t1.chi2 < t2.chi2); - - // Check if first track is better - return (isLayBetter || (isLayEqual&&isSpBetter)|| (isLayEqual&&isSpEqual&&isChi2Better)); - } - -}; - - - - - -/****************************************************************/ -/****************************************************************/ -/** class StrBPattern **/ -/****************************************************************/ -/****************************************************************/ - -class StrBPattern { - - public: - - StrBPattern() {} - ~StrBPattern() {} - - public: - - StrBRoad* road; - StrBSeed* seed; - std::list<StrBTriplet*> triplets; - StrBTrack* track; - - - friend bool operator<(const StrBPattern &t1, const StrBPattern &t2) { - return ((*(t1.track))<(*(t2.track))); - } - -}; - - -/****************************************************************/ -/****************************************************************/ -/** class StrBTrk **/ -/****************************************************************/ -/****************************************************************/ - -class StrBTrk { - - public: - - StrBTrk() : triplet_num(0), deleted(false) {} - ~StrBTrk() {} - - public: - - // General parameters - float z0; - - // Seed parameters - const TrigSiSpacePoint *seed_sp1, *seed_sp2; - float seed_z0, seed_eta, seed_phi; - - // Triplet parameters - unsigned int triplet_num; - std::vector<const TrigSiSpacePoint*> triplet_sp3; - std::vector<float> triplet_eta; - std::vector<float> triplet_phi; - std::vector<float> triplet_chi2; - std::vector<float> triplet_pt; - std::vector<float> triplet_d0; - - // Track parameters - StrBTrack *track; - - // Processing parameters - bool deleted; - -}; - -#endif // TrigSiTrack_StrBTrack_H diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigInDetRoadMakerTool.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigInDetRoadMakerTool.h deleted file mode 100644 index a858d8a0216d5679fdee29205f0c6da465a96753..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigInDetRoadMakerTool.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __TRIGINDETROADMAKERTOOL_H__ -#define __TRIGINDETROADMAKERTOOL_H__ - -#include "GaudiKernel/IAlgTool.h" -#include "TrigInDetToolInterfaces/ITrigL2LayerNumberTool.h" -#include "TrigInDetToolInterfaces/ITrigInDetRoadMakerTool.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -class IRoiDescriptor; -class IRegSelSvc; - - -class TrigInDetRoadMakerTool: public AthAlgTool, virtual public ITrigInDetRoadMakerTool { - - public: - - TrigInDetRoadMakerTool(const std::string&, const std::string&, const IInterface*); - virtual ~TrigInDetRoadMakerTool(); - - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - virtual StatusCode makeRoads(std::vector<TrigInDetRoad>&, const IRoiDescriptor* ); - - private: - - virtual StatusCode getRoadLayersRS( const IRoiDescriptor& roi, std::set<unsigned int>& l); - virtual StatusCode getRoadLayersLUT(float etaMin, float etaMax, std::set<unsigned int>& l); - - private: - - // SERVICES - ToolHandle<ITrigL2LayerNumberTool> m_numberingTool; - ServiceHandle<IRegSelSvc> m_regionSelector; - - // PROPERTIES - bool m_useRegSel; - - int m_layerOneDepth; - int m_layerTwoDepth; - - float m_minPt; - float m_maxD0; - - bool m_etaBin; - bool m_phiBin; - bool m_zedBin; - float m_etaBinWidth; - float m_phiBinWidth; - float m_zedBinWidth; - -}; - - - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2DataConversionUtils.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2DataConversionUtils.h deleted file mode 100644 index 01b5d3b0928c7b592044bdf6c420ea78d8a66b3d..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2DataConversionUtils.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __TRIG_L2_DATA_CONVERSION_UTILS_H__ -#define __TRIG_L2_DATA_CONVERSION_UTILS_H__ - -//#include "VxVertex/Vertex.h" -#include "TrigInDetEvent/TrigVertex.h" -#include "TrkSpacePoint/SpacePoint.h" -#include "SiSpacePoint/PixelSpacePoint.h" -#include "SiSpacePoint/SCT_SpacePoint.h" - -namespace Trk { - class Vertex; -} - - -class TrigL2PixelSpacePointConverter { - public: - TrigL2PixelSpacePointConverter(SpacePointCollection* p) : m_outputCollection(p) {}; - ~TrigL2PixelSpacePointConverter() {}; - void operator() (const TrigSiSpacePoint* p) { - const IdentContIndex ici1 = p->clusters().first->getHashAndIndex(); - Trk::SpacePoint* sp = new InDet::PixelSpacePoint(ici1.collHash(), p->clusters().first); - m_outputCollection->push_back(sp); - } - private: - SpacePointCollection* m_outputCollection; -}; - -class TrigL2SCT_SpacePointConverter { - public: - TrigL2SCT_SpacePointConverter(SpacePointCollection* p) : m_outputCollection(p) {}; - ~TrigL2SCT_SpacePointConverter() {}; - void operator() (const TrigSiSpacePoint* p) { - - // 1. test if LVL2 spacepoint is on surface - Amg::Vector3D glPos(p->original_x(), p->original_y(), p->z()); - const Amg::Vector2D *locpos = p->clusters().first->detectorElement()->surface().globalToLocal(glPos) ; - if(locpos==NULL) return; - delete locpos; - // 2. SP is OK - converting into offline one - Amg::Vector3D* point = new Amg::Vector3D(p->original_x(), p->original_y(), p->z() ); - const IdentContIndex ici1 = p->clusters().first->getHashAndIndex(); - const IdentContIndex ici2 = p->clusters().second->getHashAndIndex(); - const std::pair<IdentifierHash,IdentifierHash> elementIdList(ici1.collHash() , ici2.collHash() ); - const std::pair<const Trk::PrepRawData*,const Trk::PrepRawData*>* clusList = - new std::pair<const Trk::PrepRawData*,const Trk::PrepRawData*>(p->clusters().first,p->clusters().second); - Trk::SpacePoint* sp = new InDet::SCT_SpacePoint(elementIdList,point,clusList); - m_outputCollection->push_back(sp); - } - private: - SpacePointCollection* m_outputCollection; -}; - -template<class T> -class TrigL2SpacePointCollectionConverter { - public: - TrigL2SpacePointCollectionConverter(SpacePointContainer* pO, const TrigSiSpacePointContainer* pI) : m_outputContainer(pO), m_inputContainer(pI) {}; - ~TrigL2SpacePointCollectionConverter() {}; - void operator() (const TrigSiSpacePointCollection* pColl) { - if(pColl->empty()) return; - IdentifierHash idHash = pColl->identifyHash(); - if(m_outputContainer->end() != m_outputContainer->indexFind(idHash)) return; - Identifier elementID = pColl->identify(); - SpacePointCollection* spacepointCollection = new SpacePointCollection(idHash); - spacepointCollection->setIdentifier(elementID); - spacepointCollection->reserve(pColl->size()); - T spConverter(spacepointCollection); - std::for_each(pColl->begin(),pColl->end(),spConverter); - if (spacepointCollection->size() == 0){ - delete spacepointCollection; - return; - } - StatusCode sc= m_outputContainer->addCollection( spacepointCollection, spacepointCollection->identifyHash() ); - if (sc.isSuccess()){ - // athenaLog << MSG::INFO << spacepointCollection->size() <<" SCT SpacePoints successfully added to Container ! " <<(*idIt) << endmsg; - } - else{ - //athenaLog << MSG::WARNING << "Failed to add SCT SpacePoints to container" << endmsg; - delete spacepointCollection; - } - } - void operator() (IdentifierHash id) { - TrigSiSpacePointContainer::const_iterator it = m_inputContainer->indexFind(id); - if(it!=m_inputContainer->end()) { - (*this)((*it)); - } - } - private: - SpacePointContainer* m_outputContainer; - const TrigSiSpacePointContainer* m_inputContainer; -}; - - -class ZVertexCopyFunctor { - public: - ZVertexCopyFunctor(std::vector<float>& v) : m_vec(v) { - m_vec.clear(); - } - void operator()(const Trk::Vertex& v) { - m_vec.push_back(v.position().z()); - } - void operator()(const TrigVertex& v) { - m_vec.push_back(v.z()); - } - private: - std::vector<float>& m_vec; -}; - - - -#endif diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2DupTrackRemovalTool.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2DupTrackRemovalTool.h deleted file mode 100644 index 3d3f793009ee820df82a56ba7e7945bfca74f0a0..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2DupTrackRemovalTool.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGINDETRECOTOOLS_TRIGL2DUPTRACKREMOVALTOOL_H -#define TRIGINDETRECOTOOLS_TRIGL2DUPTRACKREMOVALTOOL_H - -#include<vector> - -#include "GaudiKernel/IAlgTool.h" -#include "TrigInDetRecoTools/ITrigL2DupTrackRemovalTool.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -class TrigInDetTrackCollection; - - - -class TrigL2DupTrackRemovalTool: public AthAlgTool, virtual public ITrigL2DupTrackRemovalTool { - - public: - TrigL2DupTrackRemovalTool(const std::string&, const std::string&, const IInterface* ); - virtual ~TrigL2DupTrackRemovalTool(); - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - virtual void removeDupTracks(TrigInDetTrackCollection* trackColl, std::vector<unsigned int> placeHolder) override; - - private: - int m_mode; // mode 1: use all tracks & DR criterion - // mode 2: use tracks from different z vertices & SP criterion -- default - -}; - - - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyA.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyA.h deleted file mode 100644 index 89eebb8a4019c5dcd2bd9cbd5b02b22f97b5bee1..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyA.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __TRIG_L2_PATT_RECO_STRATEGY_A_H__ -#define __TRIG_L2_PATT_RECO_STRATEGY_A_H__ - -#include<vector> - -#include "GaudiKernel/IAlgTool.h" -#include "TrigSteeringEvent/Enums.h" -#include "TrigInDetRecoTools/ITrigL2PattRecoStrategy.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "BeamSpotConditionsData/BeamSpotData.h" - -class TrigTimer; -class IRegSelSvc; -class ITrigRun1ZFinder; -class ITrigHitFilter; -class ITrigL2DupTrackRemovalTool; -class EventID; - -//#include "EventInfo/EventID.h" - - -class TrigL2PattRecoStrategyA: public AthAlgTool, virtual public ITrigL2PattRecoStrategy { - - public: - TrigL2PattRecoStrategyA(const std::string&, const std::string&, const IInterface* ); - virtual ~TrigL2PattRecoStrategyA(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - using ITrigL2PattRecoStrategy::findTracks; - - HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>& vsp, - const IRoiDescriptor& roi, - TrigInDetTrackCollection* trackColl); - - HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>& vsp, - TrigInDetTrackCollection* trackColl); - - inline double getTimingA() const { - return m_pattRecoTiming; - } - - private: - // fill the detector mask - BooleanProperty m_check_detector_mask; - BooleanProperty m_detector_mask_on_event; - bool m_detector_mask_not_checked; - void setup_detector_mask(const EventID* eventId); - - // check missing layers - bool m_hasPixelBarrel, m_hasPixelDisk, m_hasPixelBLayer; - bool m_hasSCTBarrelA, m_hasSCTEndcapA; - bool m_hasSCTBarrelC, m_hasSCTEndcapC; - // adjust threshold accordingly - bool m_adjustLayerThreshold; - - ServiceHandle<IRegSelSvc> m_regionSelector; //!< region selector service - - // z-finder stuff - ToolHandle<ITrigRun1ZFinder> m_zFinder; - long m_zFinderMode; // 0: run zfinder, 1:use z0 from MC truth, 2:use z0=m_zVertexValue (not implemented?) - bool m_findMultipleZ; // false: only take tracks from one vertex, true: use tracks from all verticies - std::string m_TrueVertexLocation; - int m_nZvertices; - - // beamspot stuff - bool m_useBeamSpot; - - bool m_doZF_Only; - - SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; - - // patt rec. stuff - ToolHandle<ITrigHitFilter> m_hitFilter; - ToolHandle<ITrigL2DupTrackRemovalTool> m_dupTrkRemoval; - - bool m_timers; - TrigTimer* m_totalTimer; - TrigTimer* m_ZFinderTimer; - TrigTimer* m_HitFilterTimer; - double m_pattRecoTiming; - -}; - - - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyB.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyB.h deleted file mode 100644 index 3c666f63eb2083aae77980106283e6f62d40b8b2..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyB.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGINDETRECOTOOLS_TRIGL2PATTRECOSTRATEGY_B_H -#define TRIGINDETRECOTOOLS_TRIGL2PATTRECOSTRATEGY_B_H - -#include "GaudiKernel/IAlgTool.h" -#include "TrigSteeringEvent/Enums.h" -#include "TrigInDetToolInterfaces/ITrigL2LayerNumberTool.h" -#include "TrigInDetRecoTools/ITrigL2PattRecoStrategy.h" -#include "TrigInDetRecoTools/StrBTrack.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -#include "TrigInDetEvent/TrigInDetTrackCollection.h" -#include "TrigInDetEvent/TrigVertexCollection.h" - -class TrigTimer; -class TrigSiSpacePoint; -class IRoiDescriptor; -class IRegSelSvc; - - - -class TrigL2PattRecoStrategyB: public AthAlgTool, virtual public ITrigL2PattRecoStrategy { - - public: - TrigL2PattRecoStrategyB(const std::string&, const std::string&, const IInterface* ); - virtual ~TrigL2PattRecoStrategyB(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>&, const IRoiDescriptor&, TrigInDetTrackCollection*); - HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>&, TrigInDetTrackCollection*); - HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>&, const IRoiDescriptor&, const TrigVertexCollection*, TrigInDetTrackCollection*); - HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>&, const TrigVertexCollection*, TrigInDetTrackCollection*); - - inline double getTimingA() const { - return m_pattRecoTiming; - } - - private: - - double m_pattRecoTiming; - - ServiceHandle<IRegSelSvc> m_regionSelector; - - void executeSeedRoads(float, float, float, float); - void executeSeedDataSorting(const std::vector<const TrigSiSpacePoint*>&); - HLT::ErrorCode executeSeedMaking(); - HLT::ErrorCode executeSeedMakingVertex(std::vector<float>&); - void executeSeedFilter_Vertex(); - - void executeTripletDataSorting(const std::vector<const TrigSiSpacePoint*>&); - HLT::ErrorCode executeTripletMaking(); - void executeTripletAmbiguity(); - - void executeTrackAmbiguity(); - void executeTrackMaking(TrigInDetTrackCollection*&); - - void executeSetup(); - void executeCleanup(); - - /************************************/ - /** TRIPLET UTILITIES **************/ - /************************************/ - float tripletAmbiguityDistance(StrBTriplet* t1, StrBTriplet* t2); - float tripletAmbiguityDistance(StrBTrack* t1, StrBTrack* t2); - void tripletMergeAmbiguity(StrBTrack* t1, StrBTrack* t2); - - - /************************************/ - /** TRACK UTILITIES *****************/ - /************************************/ - void trackFit(StrBTrack* t); - float trackAmbiguityFraction(StrBTrack* t1, StrBTrack* t2); - float trackAmbiguityDistance(StrBTrack* t1, StrBTrack* t2); - void trackMergeAmbiguity(StrBTrack* t1, StrBTrack* t2); - void trackRemoveAmbiguity(StrBTrack* t1, StrBTrack* t2); - void trackAmbiguityShared(StrBTrack* t1, StrBTrack* t2); - bool trackSort(StrBTrack* t1, StrBTrack* t2); - bool patternSort(StrBPattern* t1, StrBPattern* t2); - - /************************************/ - /** FITTING UTILITIES ***************/ - /************************************/ - bool fit(TrigInDetTrack* t); - void circlefitRPhi(TrigInDetTrack* t, float &xc, float &yc, float &rc, float &phic, float &q, float &pt); - void fitRZ(TrigInDetTrack* t, float &xc, float &yc, float &rc, float &phic, float &q, float &pt); - bool fitRPhi(TrigInDetTrack* t, float &xc, float &yc); - void shiftRPhi(TrigInDetTrack* t); - - float m_roiEta; - float m_roiPhi; - - float m_roiPhiMin, m_roiPhiMax, m_phiHalfWidth; - float m_roiEtaMin, m_roiEtaMax, m_etaHalfWidth; - - /************************************/ - /** LAYERS **************************/ - /************************************/ - float *m_geoR, *m_geoRmin, *m_geoRmax, *m_geoZ, *m_geoZmin, *m_geoZmax; - - std::vector< std::list<int> > m_layerGroups; - - std::set<int> m_mapSetLayersFailure; - std::set<int> m_mapSetLayersRemove; - std::set<int> m_mapSetPixelModulesNoisy; - std::set<int> m_mapSetSCTModulesNoisy; - - std::vector< std::vector<const TrigSiSpacePoint*> > m_spSeed; - std::vector<const TrigSiSpacePoint*>* m_spTriplet; - unsigned int m_spTripletZ0Steps; - unsigned int m_spTripletEtaSteps; - - bool m_detector_mask_not_checked; - bool m_hasPixelBarrel, m_hasPixelDisk, m_hasPixelBLayer; - bool m_hasSCTBarrelA, m_hasSCTEndcapA; - bool m_hasSCTBarrelC, m_hasSCTEndcapC; - - int m_laySctB; - int m_layPixEC; - int m_laySctEC; - int m_layMax; - - - /************************************/ - /** VERTEXING ***********************/ - /************************************/ - std::vector<float> m_preZv; - - int m_vtxMaxBin; - int* m_vtxHisto; - std::vector<float> m_recZv; - - TrigVertexCollection* m_vtxCollection; - - /************************************/ - /** TRACKS **************************/ - /************************************/ - static StrBTrk* m_trks; - unsigned int m_trks_num; - unsigned int m_trks_num_active; - - static StrBTrack* m_full_trks; - unsigned int m_full_trks_num; - unsigned int m_full_trks_num_active; - - /************************************/ - /** EVENT ***************************/ - /************************************/ - float m_xc; - float m_yc; - - std::vector<StrBRoad*> m_roads; - typedef std::vector<StrBRoad*>::iterator StrBRoadIterator; - - /************************************/ - /** HISTOGRAMS **********************/ - /************************************/ - std::vector<int> m_dataErrors; - std::vector<int> m_pixelDataErrors; - std::vector<int> m_sctDataErrors; - std::vector<int> m_trtDataErrors; - - /************************************/ - /** COMMON TOOLS ********************/ - /************************************/ - ToolHandle<ITrigL2LayerNumberTool> m_numberingTool; - - /************************************/ - /** PROPERTIES **********************/ - /************************************/ - int m_mapLayerOneMultiplicity; - int m_mapLayerTwoMultiplicity; - std::vector<int> m_mapForcedInefficientLayers; - std::vector<int> m_mapForcedTurnedOffLayers; - float m_mapMaxLayerFailureFraction; - float m_mapMaxTotalFailureFraction; - - bool m_newCuts; - bool m_newCutsRZ; - - float m_recoPtMinSeedDiff; - float m_recoD0MaxSeedDiff; - float m_recoPtMinTripletDiff; - float m_recoD0MaxTripletDiff; - float m_recoPtMin; - float m_recoD0Max; - float m_recoTimingFactor; - float m_recoAlignmentScaling; - bool m_recoOutlierRemoval; - float m_recoOutlierRemovalCut; - int m_recoOutlierRemovalLayers; - float m_recoOutlierRemovalD0; - float m_recoOutlierRemovalPt; - int m_recoMaxSeeds; - int m_recoMaxTracks; - float m_recoZ0Bin; - float m_recoEtaBin; - - bool m_preVertexingEnable; - std::string m_preVertexingVtxName; - float m_preVertexingZCut; - - float m_seedingPreCutRZ; - float m_seedingPreCutPhi; - float m_seedingPreCutRPhi; - float m_seedingCutRZ; - - bool m_vertexingEnable; - float m_vertexingCutRZ; - float m_vertexingCutRPhi; - int m_vertexingMaxVertices; - float m_vertexingWindowSize; - int m_vertexingWindowSegments; - - float m_extensionPreCutRZ; - float m_extensionPreCutPhi; - float m_extensionPreCutRPhi; - float m_extensionPreCutRPhiDiff; - float m_extensionCutRZPixel; - float m_extensionCutRZ; - float m_extensionCutRPhi; - int m_extensionCutSpacePoints; - int m_extensionCutSpacePointsMiss1; - int m_extensionCutSpacePointsMiss2; - bool m_extensionSolveTriplets; - float m_extensionSolveTripletsDRCut; - float m_extensionSolveTripletsPhiScale; - float m_extensionSolveTripletsEtaScale; - bool m_extensionSolveTracks; - bool m_extensionSolveV0Tracks; - float m_extensionSolveTracksDRCut; - float m_extensionSolveTracksPhiScale; - float m_extensionSolveTracksEtaScale; - bool m_extensionSolveShared; - int m_extensionMaxMissingLayers; - bool m_extensionRefit; - int m_extensionSpacePoints; - int m_extensionSpacePointsMiss1; - int m_extensionSpacePointsMiss2; - bool m_extensionTRTExtension; - - int m_dynamic_extensionCutSpacePoints; - int m_dynamic_extensionSpacePoints; - - bool m_debugTuning; - bool m_debugTuningGoodSeeds; - bool m_debugTuningBadSeeds; - bool m_debugTuningGoodTriplets; - bool m_debugTuningBadTriplets; - - bool m_outputTrkEnable; - std::string m_outputTrkName; - bool m_outputHistoEnable; - std::string m_outputHistoDir; - int m_outputHistoName; - - // dinamically modified properties - float m_dynamicalSeedingPreCutRZ; - float m_dynamicalSeedingPreCutPhi; - float m_dynamicalSeedingPreCutRPhi; - float m_dynamicalSeedingCutRZ; - float m_dynamicalExtensionPreCutRZ; - float m_dynamicalExtensionPreCutPhi; - float m_dynamicalExtensionPreCutRPhi; - float m_dynamicalExtensionPreCutRPhiDiff; - float m_dynamicalExtensionCutRZPixel; - float m_dynamicalExtensionCutRZ; - float m_dynamicalExtensionCutRPhi; - - //tracking quantities to be monitored - int m_nSP; - - int m_nTracks; - int m_nPixelSP; - int m_nSctSP; - int m_lastStep; - int m_nSeeds; - int m_nExtended; - std::string m_attachedFeatureName; - std::string m_outputCollectionSuffix; - - std::vector<double> m_a0beam; - std::vector<double> m_trkdPhi0, m_trkdEta; - - std::vector<double> m_pixResPhiBarrel; - std::vector<double> m_pixResEtaBarrel; - std::vector<double> m_pixPullPhiBarrel; - std::vector<double> m_pixPullEtaBarrel; - std::vector<double> m_sctResBarrel; - std::vector<double> m_sctPullBarrel; - std::vector<double> m_pixResPhiEC; - std::vector<double> m_pixResEtaEC; - std::vector<double> m_pixPullPhiEC; - std::vector<double> m_pixPullEtaEC; - std::vector<double> m_sctResEC; - std::vector<double> m_sctPullEC; - - //timers - bool m_timers; - TrigTimer* m_timer[10]; -}; - - - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyC.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyC.h deleted file mode 100644 index 5ca2b29149b756c113c89746c4e02e24a2c7bba5..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyC.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __TRIG_L2_PATT_RECO_STRATEGY_C_H__ -#define __TRIG_L2_PATT_RECO_STRATEGY_C_H__ - -#include<vector> - -#include "GaudiKernel/IAlgTool.h" -#include "TrigSteeringEvent/Enums.h" -#include "TrigInDetRecoTools/ITrigL2PattRecoStrategy.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "TrkEventUtils/PRDtoTrackMap.h" - - - -class TrigSiSpacePoint; -class IRoiDescriptor; -class TrigInDetTrackCollection; - -class SpacePointCollection; -class SpacePointContainer; - -class IRegSelSvc; - - -class SCT_ID; -class PixelID; - -#include "TrigInDetEvent/TrigSiSpacePointCollection.h" -#include "TrkTrack/TrackCollection.h" - - -class TrigTimer; -//class IRegSelSvc; - -namespace InDet { - class ISiSpacePointsSeedMaker; - class ISiZvertexMaker; - class ISiTrackMaker; -} - -class TrigL2PattRecoStrategyC: public AthAlgTool, virtual public ITrigL2PattRecoStrategy { - - public: - TrigL2PattRecoStrategyC(const std::string&, const std::string&, const IInterface* ); - virtual ~TrigL2PattRecoStrategyC(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - using ITrigL2PattRecoStrategy::findTracks; - - HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>&, - const IRoiDescriptor&, - TrigInDetTrackCollection*); - - HLT::ErrorCode findTracks(const std::vector<const TrigSiSpacePoint*>&, - TrigInDetTrackCollection*); - - inline double getTimingA() const { - return m_pattRecoTiming; - } - - private: - bool m_useZvertexTool; - int m_nseeds; //!< Number seeds - int m_ntracks; //!< Number found tracks - int m_nfreeCut; // Min number free clusters - - ToolHandle< InDet::ISiSpacePointsSeedMaker > m_seedsmaker; // Space poins seed maker - ToolHandle< InDet::ISiZvertexMaker > m_zvertexmaker; // Space poins z-vertex maker - ToolHandle< InDet::ISiTrackMaker > m_trackmaker; // Track maker - - ServiceHandle<IRegSelSvc> m_regionSelector; //!< region selector service - - SG::ReadHandleKey<Trk::PRDtoTrackMap> m_prdToTrackMap - {this,"PRDtoTrackMap",""}; - - std::string m_sctSpacePointsName; - std::string m_pixelSpacePointsName; - - std::string m_sctOnlineSpacePointsName; - std::string m_pixelOnlineSpacePointsName; - - - SpacePointContainer* m_sctSpacePointsContainer; - SpacePointContainer* m_pixelSpacePointsContainer; - const TrigSiSpacePointContainer* m_sctOnlineSpacePointsContainer; - const TrigSiSpacePointContainer* m_pixelOnlineSpacePointsContainer; - - double trackQuality(const Trk::Track*); - void filterSharedTracks(std::multimap<double,Trk::Track*>&); - - StatusCode convertInputData( const std::vector<IdentifierHash>&, const std::vector<IdentifierHash>&); - StatusCode convertInputData(); - StatusCode getIDCs(); - - TrigInDetTrack* convertOutputTracks(Trk::Track*); - - const SCT_ID* m_sctId; - const PixelID* m_pixelId; - - bool m_timers; - TrigTimer* m_timer[10]; - - double m_pattRecoTiming; - -}; - - - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyT.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyT.h deleted file mode 100644 index 628663aec4bc1f309b2bc603e75209c70c433111..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/TrigL2PattRecoStrategyT.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGINDETRECOTOOLS_TRIGL2PATTRECOSTRATEGYT_H -#define TRIGINDETRECOTOOLS_TRIGL2PATTRECOSTRATEGYT_H - -#include<vector> - -//#include "GaudiKernel/IAlgTool.h" -#include "TrigSteeringEvent/Enums.h" -#include "TrigInDetRecoTools/ITrigL2SeededPattRecoStrategy.h" -#include "InDetRecToolInterfaces/ITRT_TrackSegmentsMaker.h" -#include "TrigInDetToolInterfaces/ITrigTRT_DriftCircleProvider.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -class IRegSelSvc; -class IROBDataProviderSvc; - - -class IRoiDescriptor; - - -class SCT_ID; -class PixelID; -class TRT_ID; - -#include "TrigInDetEvent/TrigSiSpacePointCollection.h" - -#include "TrkEventUtils/PRDtoTrackMap.h" - -class TrigTimer; - -//#include "EventInfo/EventID.h" - -namespace InDet { - class ITRT_SeededTrackFinder; -} - -//#include "InDetPrepRawData/SiClusterContainer.h" -//#include "InDetPrepRawData/PixelClusterContainer.h" -//#include "InDetPrepRawData/SCT_ClusterContainer.h" -//#include "InDetPrepRawData/PixelClusterCollection.h" -//#include "InDetPrepRawData/SCT_ClusterCollection.h" -#include "InDetPrepRawData/TRT_DriftCircleContainer.h" -//#include "InDetPrepRawData/TRT_DriftCircleCollection.h" - -class TrigL2PattRecoStrategyT: public AthAlgTool, virtual public ITrigL2SeededPattRecoStrategy { - - public: - TrigL2PattRecoStrategyT(const std::string&, const std::string&, const IInterface* ); - virtual ~TrigL2PattRecoStrategyT(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - HLT::ErrorCode findTracks(const TrigInDetTrackCollection& inputTrackColl, - const std::vector<const TrigSiSpacePoint*>& vsp, - const IRoiDescriptor& roi, - TrigInDetTrackCollection* trackColl); - - HLT::ErrorCode findTracks(const TrigInDetTrackCollection& inputTrackColl, - const std::vector<const TrigSiSpacePoint*>& vsp, - TrigInDetTrackCollection* trackColl); - - inline double getTimingA() const { - return m_pattRecoTiming; - } - - private: - - - StatusCode getFilteredTRT_Hits(const TrigInDetTrackCollection& inputTrackColl, const IRoiDescriptor& roi, - std::vector<IdentifierHash>& ); - StatusCode getFilteredTRT_Hits(const TrigInDetTrackCollection& inputTrackColl, - std::vector<IdentifierHash>& ); - - void createTriggerTrack(const Trk::Track&,const Trk::TrackSegment&, TrigInDetTrackCollection*); - StatusCode getIDCs(); - - //TrigTimer* m_totalTimer; - double m_pattRecoTiming; - - //int m_nseeds; //!< Number seeds - //int m_ntracks; //!< Number found tracks - int m_nfreeCut; // Min number free clusters - - int m_minTrtHits; - - ToolHandle<InDet::ITRT_SeededTrackFinder> m_trackmaker; // Track maker ; - ServiceHandle<IRegSelSvc> m_regionSelector; //!< region selector service - ToolHandle<ITrigTRT_DriftCircleProviderTool> m_trtDataProvider; - ServiceHandle<IROBDataProviderSvc> m_robDataProvider; - - ToolHandle<InDet::ITRT_TrackSegmentsMaker> m_segmentsmaker ; - - SG::ReadHandleKey<Trk::PRDtoTrackMap> m_prdToTrackMap - {this,"PRDtoTrackMap",""}; - - InDet::TRT_DriftCircleContainer* m_filteredDriftCircleContainer; - std::string m_trtFilteredContName; - std::string m_trtContName; - - - std::string m_sctOnlineSpacePointsName; - std::string m_pixelOnlineSpacePointsName; - const TrigSiSpacePointContainer* m_sctOnlineSpacePointsContainer; - const TrigSiSpacePointContainer* m_pixelOnlineSpacePointsContainer; - - const SCT_ID* m_sctId; - const PixelID* m_pixelId; - const TRT_ID* m_trtId; - - std::vector<const ROBF*> m_vROBF; - - bool m_timers; - TrigTimer* m_timer[10]; -}; - - - -#endif // not TRIGINDETRECOTOOLS_TRIGL2PATTRECOSTRATEGYT_H - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/python/ConfiguredSettings.py b/Trigger/TrigTools/TrigInDetRecoTools/python/ConfiguredSettings.py deleted file mode 100644 index 17f04c55bf337137b1903b4cdb918666f8a6516b..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/python/ConfiguredSettings.py +++ /dev/null @@ -1,618 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.SystemOfUnits import * - -class CommonSettings() : - def __init__(self): - self.allowedInstanceNames = ['Muon', 'eGamma', 'muonIso', 'Tau', 'TauCore', 'TauIso', - 'Jet', 'Bphysics', 'FullScan', 'BeamSpot', 'Tile', 'FullScan_ZF_Only'] - self.db = {} - ptmin = {} - for i in self.allowedInstanceNames : - ptmin[i] = 1.*GeV # in MeV - ptmin['Muon']= 1.0 * GeV - self.db['pTmin']=ptmin - - def __getitem__(self, (quantity, slice)): - v = None - try: - q = self.db[quantity] - try: - v = q[slice] - except: - print 'Settings has no instance %s ' % slice - except: - print 'Settings has no setting %s ' % quantity - return v - - def __setitem__(self, (quantity, slice), value): - try: - q = self.db[quantity] - try: - q[slice] = value - except: - print 'Settings has no instance %s ' % slice - except: - print 'Settings has no setting %s ' % quantity - - - -class SettingsForStrategyB(CommonSettings) : - def __init__(self): - CommonSettings.__init__(self) - # strategy-specific settings defined below - extension_SpacePoints = {} - extension_SpacePointsMiss1 = {} - extension_SpacePointsMiss2 = {} - extension_TRTExtension = {} - map_LayerOneMultiplicity = {} - map_LayerTwoMultiplicity = {} - reco_D0Max = {} - vertexing_CutRPhi = {} - vertexing_CutRZ = {} - vertexing_Enable = {} - vertexing_WindowSize = {} - - from InDetTrigRecExample.ConfiguredNewTrackingTrigCuts import L2IDTrackingCuts - - for i in self.allowedInstanceNames : - extension_SpacePoints[i] = 5 - extension_SpacePointsMiss1[i] = 5 - extension_SpacePointsMiss2[i] = 5 - extension_TRTExtension[i] = True - map_LayerOneMultiplicity[i] = 3 - map_LayerTwoMultiplicity[i] = 3 - reco_D0Max[i] = 3.0*mm - vertexing_CutRPhi[i] = 0.5 - vertexing_Enable[i] = False - vertexing_WindowSize[i] = 3.0 - - # customize setting here for BeamSpot instance - vertexing_Enable['BeamSpot'] = True - vertexing_CutRPhi['BeamSpot'] = 0.00025 - vertexing_WindowSize['BeamSpot'] = 2.0 - - # customize setting here for Bphysics instance - vertexing_Enable['Bphysics'] = True - vertexing_CutRPhi['Bphysics'] = 0.00025 - vertexing_WindowSize['Bphysics'] = 2.0 - - # customize setting here for FullScan instance - vertexing_Enable['FullScan'] = True - vertexing_CutRPhi['FullScan'] = 0.00025 - vertexing_WindowSize['FullScan'] = 2.0 - - # customize setting here for Jet instance - extension_SpacePoints['Jet'] = 4 - extension_TRTExtension['Jet'] = False - - # customize setting here for Tau instance - map_LayerOneMultiplicity['Tau'] = 2 - map_LayerTwoMultiplicity['Tau'] = 2 - - # extend settings database - self.db['Extension_SpacePoints'] = extension_SpacePoints - self.db['Extension_SpacePointsMiss1'] = extension_SpacePointsMiss1 - self.db['Extension_SpacePointsMiss2'] = extension_SpacePointsMiss2 - self.db['Extension_TRTExtension'] = extension_TRTExtension - self.db['Map_LayerOneMultiplicity'] = map_LayerOneMultiplicity - self.db['Map_LayerTwoMultiplicity'] = map_LayerTwoMultiplicity - self.db['Reco_D0Max'] = reco_D0Max - self.db['Vertexing_CutRPhi'] = vertexing_CutRPhi - self.db['Vertexing_CutRZ'] = vertexing_CutRZ - self.db['Vertexing_Enable'] = vertexing_Enable - self.db['Vertexing_WindowSize'] = vertexing_WindowSize - - - -class SettingsForStrategyC(CommonSettings) : - def __init__(self): - CommonSettings.__init__(self) - - # strategy-specific settings defined below - width = {} - usezvtool = {} - nclustersmin = {} - nholesmax = {} - nholesgapmax = {} - - for i in self.allowedInstanceNames : - width[i] = 10.0 - usezvtool[i] = True - nclustersmin[i] = 7 - nholesmax[i] = 2 - nholesgapmax[i] = 2 - - - - # customize setting here: for example width['Tau'] = 20. - usezvtool['Tau'] = False - # extend settings database - self.db['RoadWidth']=width - self.db['useZvertexTool'] = usezvtool - self.db['nClustersMin'] = nclustersmin - self.db['nHolesMax'] = nholesmax - self.db['nHolesGapMax'] = nholesgapmax - -class SettingsForStrategyA(CommonSettings) : - def __init__(self): - CommonSettings.__init__(self) - - # strategy-specific settings defined below - - FindMultipleZ = {} - - phihalfwidth = {} - - etahalfwidth = {} - minhits = {} - # z-finder parameters - namezf = {} - fullscanmode = {} - roiphiwidth = {} - numberofpeaks = {} - - phibinsizez = {} - useonlypixel = {} - minzbinsize = {} - zbinsizeetacoeff = {} - dphideta = {} - chargeaware = {} - zhistoperphi = {} - maxz = {} - prefercentralz = {} - vrtxdistcut = {} - nvrtxseparation = {} - tripletmode = {} - neighbormultiplier = {} - vrtxmixing = {} - tripletdz = {} - tripletdk = {} - tripletdp = {} - zfindermode = {} - useroidescriptorwidths = {} - nfirstlayers = {} - dozfonly = {} - weightthreshold = {} - - from InDetTrigRecExample.ConfiguredNewTrackingTrigCuts import L2IDTrackingCuts - - for i in self.allowedInstanceNames : - - FindMultipleZ[i] = True - phihalfwidth[i] = 0.2 - etahalfwidth[i] = 0.2 - minhits[i] = 5 - namezf[i] ="unknown" - fullscanmode[i] = False - roiphiwidth[i] = 0.2 - numberofpeaks[i] = 1 - phibinsizez[i] = 0.2 - useonlypixel[i] = False - minzbinsize[i] = 0.2 - zbinsizeetacoeff[i] = 0.1 - dphideta[i] = -0.02 - chargeaware[i] = True - zhistoperphi[i] = True - prefercentralz[i] = False - vrtxdistcut[i] = 0. - nvrtxseparation[i] = 0 - tripletmode[i] = 0 - neighbormultiplier[i] = 1 - vrtxmixing[i] = 0. - tripletdz[i] = 25 - tripletdk[i] = 0.005 - tripletdp[i] = 0.05 - zfindermode[i] = 0 - useroidescriptorwidths[i] = False - nfirstlayers[i] = 3 - dozfonly[i] = False - weightthreshold[i] = 0. - - - - # customize setting here for BeamSpot instance - etahalfwidth['BeamSpot'] = 0.3 - phihalfwidth['BeamSpot'] = 3.14159265358 - - namezf['BeamSpot'] ="IDScanZFinderA_BeamSpot" - fullscanmode['BeamSpot'] = True - numberofpeaks['BeamSpot'] = 3 - phibinsizez['BeamSpot'] = 1.0 - minzbinsize['BeamSpot'] = 0.4 - zbinsizeetacoeff['BeamSpot'] = 0.2 - dphideta['BeamSpot'] = -0.025 - chargeaware['BeamSpot'] = False - zhistoperphi['BeamSpot'] = False - prefercentralz['BeamSpot'] = True - - # customize setting here for Bphysics instance - etahalfwidth['Bphysics'] = 0.75 - phihalfwidth['Bphysics'] = 0.75 - - namezf['Bphysics'] ="IDScanZFinderA_Bphysics" - numberofpeaks['Bphysics'] = 3 - phibinsizez['Bphysics'] = 1.0 - dphideta['Bphysics'] = -0.025 - chargeaware['Bphysics'] = False - zhistoperphi['Bphysics'] = False - nfirstlayers['Bphysics'] = 4 - - #customize setting here for FullScan instance - FindMultipleZ['FullScan'] = True - etahalfwidth['FullScan'] = 3.0 - phihalfwidth['FullScan'] = 3.14159265358 - namezf['FullScan'] ="IDScanZFinderA_FullScan" - fullscanmode['FullScan'] = True - numberofpeaks['FullScan'] = 3 - phibinsizez['FullScan'] = 1.0 - useonlypixel['FullScan'] = False - minzbinsize['FullScan'] = 0.4 - zbinsizeetacoeff['FullScan'] = 0.2 - dphideta['FullScan'] = -0.025 - chargeaware['FullScan'] = False - zhistoperphi['FullScan'] = False - prefercentralz['FullScan'] = True - - - FindMultipleZ['FullScan_ZF_Only'] = True - etahalfwidth['FullScan_ZF_Only'] = 3.0 - phihalfwidth['FullScan_ZF_Only'] = 3.14159265358 - namezf['FullScan_ZF_Only'] = "IDScanZFinderA_FullScan_ZF_Only" - fullscanmode['FullScan_ZF_Only'] = True - numberofpeaks['FullScan_ZF_Only'] = 4 - phibinsizez['FullScan_ZF_Only'] = 1.0 - useonlypixel['FullScan_ZF_Only'] = False - minzbinsize['FullScan_ZF_Only'] = 2.0 - zbinsizeetacoeff['FullScan_ZF_Only'] = 0.2 - dphideta['FullScan_ZF_Only'] = -0.025 - chargeaware['FullScan_ZF_Only'] = False - zhistoperphi['FullScan_ZF_Only'] = False - prefercentralz['FullScan_ZF_Only'] = True - weightthreshold['FullScan_ZF_Only'] = 500. - dozfonly['FullScan_ZF_Only'] = True - - - # customize setting here for Jet instance - etahalfwidth['Jet'] = 0.2 - phihalfwidth['Jet'] = 0.2 - - namezf['Jet'] ="IDScanZFinderA_Jet" - numberofpeaks['Jet'] = 3 - phibinsizez['Jet'] = 0.8 - useonlypixel['Jet'] = False - minzbinsize['Jet'] = 0.4 - zbinsizeetacoeff['Jet'] = 0.1 - dphideta['Jet'] = -0.02 - chargeaware['Jet'] = False - zhistoperphi['Jet'] = False - vrtxdistcut['Jet'] = 0.01 - tripletmode['Jet'] = 1 - neighbormultiplier['Jet'] = 1 - tripletdz['Jet'] = 6 - tripletdk['Jet'] = 0.00005 - tripletdp['Jet'] = 0.005 - - # customize setting here for eGamma instance - etahalfwidth['eGamma'] = 0.1 - phihalfwidth['eGamma'] = 0.1 - - namezf['eGamma'] ="IDScanZFinderA_eGamma" - numberofpeaks['eGamma'] = 4 - phibinsizez['eGamma'] = 0.1 - useonlypixel['eGamma'] = False - minzbinsize['eGamma'] = 0.3 - zbinsizeetacoeff['eGamma'] = 0.15 - dphideta['eGamma'] = -0.035 - chargeaware['eGamma'] = True - zhistoperphi['eGamma'] = False - prefercentralz['eGamma'] = True - vrtxdistcut['eGamma'] = 0.02 - nvrtxseparation['eGamma'] = 5 - tripletmode['eGamma'] = 1 - neighbormultiplier['eGamma'] = 1 - tripletdz['eGamma'] = 10 - tripletdk['eGamma'] = 0.00001 - tripletdp['eGamma'] = 0.05 - nfirstlayers['eGamma'] = 4 - - # customize setting here for Muon instance - etahalfwidth['Muon'] = 0.1 - phihalfwidth['Muon'] = 0.1 - - namezf['Muon'] ="IDScanZFinderA_Muon" - numberofpeaks['Muon'] = 4 - phibinsizez['Muon'] = 0.15 - useonlypixel['Muon'] = False - minzbinsize['Muon'] = 0.3 - zbinsizeetacoeff['Muon'] = 0.15 - dphideta['Muon'] = -0.045 - chargeaware['Muon'] = True - zhistoperphi['Muon'] = False - prefercentralz['Muon'] = True - vrtxdistcut['Muon'] = 0.1 - nvrtxseparation['Muon'] = 5 - tripletmode['Muon'] = 1 - neighbormultiplier['Muon'] = 1 - tripletdz['Muon'] = 15 - tripletdk['Muon'] = 0.0001 - tripletdp['Muon'] = 0.1 - nfirstlayers['Muon'] = 4 - # useroidescriptorwidths['Muon'] = True - # customize setting here for muonIso instance - etahalfwidth['muonIso'] = 0.2 - phihalfwidth['muonIso'] = 0.2 - - namezf['muonIso'] ="IDScanZFinderA_muonIso" - numberofpeaks['muonIso'] = 4 - phibinsizez['muonIso'] = 0.1 - useonlypixel['muonIso'] = False - minzbinsize['muonIso'] = 0.3 - zbinsizeetacoeff['muonIso'] = 0.15 - dphideta['muonIso'] = -0.035 - chargeaware['muonIso'] = True - zhistoperphi['muonIso'] = False - prefercentralz['muonIso'] = True - vrtxdistcut['muonIso'] = 0.05 - nvrtxseparation['muonIso'] = 5 - tripletmode['muonIso'] = 1 - neighbormultiplier['muonIso'] = 1 - tripletdz['muonIso'] = 10 - tripletdk['muonIso'] = 0.00005 - tripletdp['muonIso'] = 0.005 - # useroidescriptorwidths['muonIso'] = True - - # customize setting here for Tau instance - etahalfwidth['Tau'] = 0.3 - phihalfwidth['Tau'] = 0.3 - - namezf['Tau'] ="IDScanZFinderA_Tau" - numberofpeaks['Tau'] = 4 - phibinsizez['Tau'] = 0.3 - useonlypixel['Tau'] = False - minzbinsize['Tau'] = 0.2 - zbinsizeetacoeff['Tau'] = 0.2 - dphideta['Tau'] = -0.035 - chargeaware['Tau'] = True - zhistoperphi['Tau'] = False - prefercentralz['Tau'] = True - vrtxdistcut['Tau'] = 0.01 - nvrtxseparation['Tau'] = 5 - tripletmode['Tau'] = 1 - neighbormultiplier['Tau'] = 1 - vrtxmixing['Tau'] = 0 - tripletdz['Tau'] = 10 - tripletdk['Tau'] = 0.00005 - tripletdp['Tau'] = 0.05 - - - # customize setting here for Tile instance - etahalfwidth['Tile'] = 0.1 - phihalfwidth['Tile'] = 0.2 - - namezf['Tile'] ="IDScanZFinderA_Tile" - numberofpeaks['Tile'] = 4 - phibinsizez['Tile'] = 0.3 - useonlypixel['Tile'] = False - minzbinsize['Tile'] = 0.4 - zbinsizeetacoeff['Tile'] = 0.2 - dphideta['Tile'] = -0.025 - chargeaware['Tile'] = False - zhistoperphi['Tile'] = False - - # extend settings database - - self.db['namezf'] = namezf - self.db['FullScanMode'] = fullscanmode - self.db['NumberOfPeaks'] = numberofpeaks - self.db['PhiBinSizeZ'] = phibinsizez - self.db['UseOnlyPixels'] = useonlypixel - self.db['MinZBinSize'] = minzbinsize - self.db['ZBinSizeEtaCoeff'] = zbinsizeetacoeff - self.db['DPhiDEta'] = dphideta - self.db['ChargeAware'] = chargeaware - self.db['ZHistoPerPhi'] = zhistoperphi - self.db['MaxZ'] = maxz - self.db['PreferCentralZ'] = prefercentralz - self.db['VrtxDistCut'] = vrtxdistcut - self.db['nVrtxSeparation'] = nvrtxseparation - self.db['TripletMode'] = tripletmode - self.db['NeighborMultiplier'] = neighbormultiplier - self.db['VrtxMixing'] = vrtxmixing - self.db['TripletDZ'] = tripletdz - self.db['TripletDK'] = tripletdk - self.db['TripletDP'] = tripletdp - self.db['ZFinderMode'] = zfindermode - self.db['nFirstLayers'] = nfirstlayers - self.db['phiHalfWidth'] = phihalfwidth - self.db['etaHalfWidth'] = etahalfwidth - self.db['MinHits'] = minhits - self.db['FindMultipleZ'] = FindMultipleZ - self.db['DoZF_Only'] = dozfonly - self.db['WeightThreshold'] = weightthreshold - - # hit-filter parameters - - namehit = {} - phihalfwidth = {} - etahalfwidth = {} - phibinsize = {} - etabinsize = {} - layerthreshold = {} - loosetightboundary = {} - enhancelayer0 = {} - removeduplicates = {} - cloneremovalcut = {} - useptsign = {} - d0cut_loose = {} - d0cut_tight = {} - dphidrbinsize_tight = {} - dphidrbinsize_loose = {} - etacutouter_tight = {} - etacutinner_tight = {} - etacutouter_loose = {} - etacutinner_loose = {} - phi0bins_tight = {} - phi0bins_loose = {} - deltadzdrcut_tight = {} - deltadzdrcut_loose = {} - #ptcutinmev = {} - - for i in self.allowedInstanceNames : - namehit[i] = "unknown" - phihalfwidth[i] = 0.1 - etahalfwidth[i] = 0.1 - phibinsize[i] = 2.4 - etabinsize[i] = 0.005 - layerthreshold[i] = 3.5 - loosetightboundary[i] = 10.5 - enhancelayer0[i] = True - removeduplicates[i] = True - cloneremovalcut[i] = 3 - useptsign[i] = True - d0cut_loose[i] = 4.0 - d0cut_tight[i] = 1.0 - dphidrbinsize_tight[i] = 0.0000024 - dphidrbinsize_loose[i] = 0.0000030 - etacutouter_tight[i] = 0.01 - etacutinner_tight[i] = 0.004 - etacutouter_loose[i] = 0.02 - etacutinner_loose[i] = 0.008 - phi0bins_tight[i] = 20000 - phi0bins_loose[i] = 16000 - deltadzdrcut_tight[i] = 0.12 - deltadzdrcut_loose[i] = 0.12 - #ptcutinmev[i] = 1000.0 - - # customize setting here for BeamSpot instance - - namehit['BeamSpot'] = "IDScanHitFilterA_BeamSpot" - phibinsize['BeamSpot'] = 3.5 - etabinsize['BeamSpot'] = 0.02 - cloneremovalcut['BeamSpot'] = 2 - d0cut_loose['BeamSpot'] = 4.0 - d0cut_tight['BeamSpot'] = 4.0 - dphidrbinsize_tight['BeamSpot'] = 0.00000300 - dphidrbinsize_loose['BeamSpot'] = 0.00000375 - etacutouter_tight['BeamSpot'] = 0.02 - etacutinner_tight['BeamSpot'] = 0.04 - etacutouter_loose['BeamSpot'] = 0.05 - etacutinner_loose['BeamSpot'] = 0.1 - layerthreshold['BeamSpot'] = 4.5 - #ptcutinmev['BeamSpot'] = 500.0 - - - # customize setting here for Bphysics instance - - namehit['Bphysics'] = "IDScanHitFilterA_Bphysics" - phibinsize['Bphysics'] = 3.5 - etabinsize['Bphysics'] = 0.02 - cloneremovalcut['Bphysics'] = 2 - d0cut_tight['Bphysics'] = 4.0 - dphidrbinsize_tight['Bphysics'] = 0.00000300 - dphidrbinsize_loose['Bphysics'] = 0.00000375 - etacutouter_tight['Bphysics'] = 0.02 - etacutinner_tight['Bphysics'] = 0.04 - etacutouter_loose['Bphysics'] = 0.05 - etacutinner_loose['Bphysics'] = 0.1 - layerthreshold['Bphysics'] = 4.5 - - # customize setting here for FullScan instance - - namehit['FullScan'] = "IDScanHitFilterA_FullScan" - phibinsize['FullScan'] = 3.5 - etabinsize['FullScan'] = 0.02 - cloneremovalcut['FullScan'] = 2 - d0cut_loose['FullScan'] = 4.0 - d0cut_tight['FullScan'] = 4.0 - dphidrbinsize_tight['FullScan'] = 0.00000300 - dphidrbinsize_loose['FullScan'] = 0.00000375 - etacutouter_tight['FullScan'] = 0.02 - etacutinner_tight['FullScan'] = 0.04 - etacutouter_loose['FullScan'] = 0.05 - etacutinner_loose['FullScan'] = 0.1 - layerthreshold['FullScan'] = 4.5 - - # customize setting here for Jet instance - - namehit['Jet'] = "IDScanHitFilterA_Jet" - phibinsize['Jet'] = 2.0 - etabinsize['Jet'] = 0.02 - cloneremovalcut['Jet'] = 2 - useptsign['Jet'] = False - dphidrbinsize_loose['Jet'] = 0.00000375 - etacutouter_loose['Jet'] = 0.05 - etacutinner_loose['Jet'] = 0.1 - etacutouter_tight['Jet'] = 0.004 - d0cut_tight['Jet'] = 0.4 - - # customize setting here for Tau instance - - namehit['Tau'] = "IDScanHitFilterA_Tau" - phibinsize['Tau'] = 2.4 - etabinsize['Tau'] = 0.005 - cloneremovalcut['Tau'] = 2 - - # customize setting here for eGamma instance - - namehit['eGamma'] = "IDScanHitFilterA_eGamma" - phibinsize['eGamma'] = 2.4 - etabinsize['eGamma'] = 0.005 - cloneremovalcut['eGamma'] = 3 - useptsign['eGamma'] = False - dphidrbinsize_tight['eGamma'] = 0.00000300 - d0cut_loose['eGamma'] = 10 - d0cut_tight['eGamma'] = 10 - - # customize setting here for Muon instance - - namehit['Muon'] = "IDScanHitFilterA_Muon" - phibinsize['Muon'] = 2.4 - etabinsize['Muon'] = 0.005 - cloneremovalcut['Muon'] = 3 - useptsign['Muon'] = False - d0cut_loose['Muon'] = 10 - d0cut_tight['Muon'] = 10 - - # customize setting here for muonIso instance - - namehit['muonIso'] = "IDScanHitFilterA_muonIso" - phibinsize['muonIso'] = 2.4 - etabinsize['muonIso'] = 0.005 - cloneremovalcut['muonIso'] = 3 - d0cut_loose['muonIso'] = 10 - d0cut_tight['muonIso'] = 10 - - - # customize setting here for Tile instance - - namehit['Tile'] = "IDScanHitFilterA_Tile" - phibinsize['Tile'] = 2.4 - etabinsize['Tile'] = 0.005 - cloneremovalcut['Tile'] = 3 - - # extend settings database - - self.db['namehit'] = namehit - self.db['PhiBinSize'] = phibinsize - self.db['EtaBinSize'] = etabinsize - self.db['LayerThreshold'] = layerthreshold - self.db['LooseTightBoundary'] = loosetightboundary - self.db['EnhanceLayer0'] = enhancelayer0 - self.db['RemoveDuplicates'] = removeduplicates - self.db['CloneRemovalCut'] = cloneremovalcut - self.db['UsePtSign'] = useptsign - self.db['d0Cut_loose'] = d0cut_loose - self.db['d0Cut_tight'] = d0cut_tight - self.db['dPhidRBinSize_tight'] = dphidrbinsize_tight - self.db['dPhidRBinSize_loose'] = dphidrbinsize_loose - self.db['etaCutOuter_tight'] = etacutouter_tight - self.db['etaCutInner_tight'] = etacutinner_tight - self.db['etaCutOuter_loose'] = etacutouter_loose - self.db['etaCutInner_loose'] = etacutinner_loose - self.db['phi0Bins_tight'] = phi0bins_tight - self.db['phi0Bins_loose'] = phi0bins_loose - self.db['deltadzdrCut_tight'] = deltadzdrcut_tight - self.db['deltadzdrCut_loose'] = deltadzdrcut_loose - #self.db['pTcutInMeV'] = ptcutinmev - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_Config.py b/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_Config.py deleted file mode 100644 index 38e810fc8c6beecb3e2c913ce8b0d095ba345430..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_Config.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from TrigInDetRecoTools.ConfiguredSettings import CommonSettings -from TrigInDetRecoTools.TrigInDetRecoTools_ConfigB import FactoryForStrategyB -from TrigInDetRecoTools.TrigInDetRecoTools_ConfigC import FactoryForStrategyC -from TrigInDetRecoTools.TrigInDetRecoTools_ConfigA import FactoryForStrategyA - -class TrigL2PattRecoStrategyFactory() : - __slots__=[] - def __init__(self, name = 'TrigL2PattRecoStrategyFactory') : - self.allowedStrNames = ['A', 'B', 'C', 'F'] - - self.commonSettings = CommonSettings() - self.factoryForStrB = FactoryForStrategyB() - self.factoryForStrC = FactoryForStrategyC() - self.factoryForStrA = FactoryForStrategyA() - def createStrategy(self, instName, strName, roiPhi=0.1, roiEta=0.1, ptCut = 2500.0) : - if strName in self.allowedStrNames : - if instName in self.commonSettings.allowedInstanceNames : - if strName=='B' : - configuredStrB = self.factoryForStrB.createStrategy(instName) - return configuredStrB - - if strName=='A' : - configuredStrA = self.factoryForStrA.createStrategy(instName) - return configuredStrA - - - if strName=='C' : - configuredStrC = self.factoryForStrC.createStrategy(instName) - return configuredStrC - - else : - print "Instance "+instName+" of the Strategy"+strName+" is not supported !" - return None - else : - print "Strategy"+strName+" is not supported !" - return None - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigA.py b/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigA.py deleted file mode 100644 index 7b945a02e12ce6e49629f34a794ae8e3f28e9868..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigA.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from TrigInDetRecoTools.TrigInDetRecoToolsConf import TrigL2PattRecoStrategyA -from TrigInDetRecoTools.ConfiguredSettings import SettingsForStrategyA - -from IDScanZFinder.IDScanZFinderConf import IDScanZFinder -from IDScanHitFilter.IDScanHitFilterConf import IDScanHitFilter -from TrigInDetRecoTools.TrigInDetRecoToolsConf import TrigL2DupTrackRemovalTool - -from AthenaCommon.Logging import logging -log = logging.getLogger("FactoryForStrategyA") - - -class FactoryForStrategyA() : - __slots__=[] - def __init__(self, name = 'FactoryForStrategyA') : - self.strategy = None - self.settings = SettingsForStrategyA() - - def createStrategy(self, instName) : - if instName in self.settings.allowedInstanceNames : - - self.strategy = TrigL2PattRecoStrategyA("StrategyA_"+instName) - from AthenaCommon.AppMgr import ToolSvc - - self.strategy.ZFinderMode = self.settings[('ZFinderMode',instName)] - self.strategy.TrueVertexLocation = "TrueTrigVertexColl" - self.strategy.FindMultipleZ = self.settings[('FindMultipleZ',instName)] - self.strategy.DoZF_Only = self.settings[('DoZF_Only',instName)] - - zfinderTool = IDScanZFinder(name = self.settings[('namezf',instName)], - FullScanMode = self.settings[('FullScanMode',instName)] , - NumberOfPeaks = self.settings[('NumberOfPeaks',instName)], - PhiBinSize = self.settings[('PhiBinSizeZ',instName)] , - UseOnlyPixels = self.settings[('UseOnlyPixels',instName)], - MinZBinSize = self.settings[('MinZBinSize',instName)], - ZBinSizeEtaCoeff = self.settings[('ZBinSizeEtaCoeff',instName)], - DPhiDEta = self.settings[('DPhiDEta',instName)], - ChargeAware = self.settings[('ChargeAware',instName)], - ZHistoPerPhi = self.settings[('ZHistoPerPhi',instName)], - PreferCentralZ = self.settings[('PreferCentralZ',instName)], - VrtxDistCut = self.settings[('VrtxDistCut',instName)] , - NeighborMultiplier = self.settings[('NeighborMultiplier',instName)] , - nVrtxSeparation = self.settings[('nVrtxSeparation',instName)], - VrtxMixing = self.settings[('VrtxMixing',instName)], - TripletMode = self.settings[('TripletMode',instName)], - nFirstLayers = self.settings[('nFirstLayers',instName)], - WeightThreshold = self.settings[('WeightThreshold',instName)] - ) - - zfinderTool.TripletDZ = self.settings[('TripletDZ',instName)] - zfinderTool.TripletDK = self.settings[('TripletDK',instName)] - zfinderTool.TripletDP = self.settings[('TripletDP',instName)] - #zfinderTool.useRoiDescriptorWidths = self.settings[('useRoiDescriptorWidths',instName)] - - - - hitfilterTool = IDScanHitFilter(name= self.settings[('namehit',instName)], - fullScan = self.settings[('FullScanMode',instName)] , - phiHalfWidth = self.settings[('phiHalfWidth',instName)], - etaHalfWidth = self.settings[('etaHalfWidth',instName)], - PhiBinSize = self.settings[('PhiBinSize',instName)], - EtaBinSize = self.settings[('EtaBinSize',instName)], - LayerThreshold = self.settings[('LayerThreshold',instName)], - LooseTightBoundary = self.settings[('LooseTightBoundary',instName)], - EnhanceLayer0 = self.settings[('EnhanceLayer0',instName)], - RemoveDuplicates = self.settings[('RemoveDuplicates',instName)], - CloneRemovalCut = self.settings[('CloneRemovalCut',instName)], - UsePtSign = self.settings[('UsePtSign',instName)],) - - hitfilterTool.dPhidRBinSize_tight = self.settings[('dPhidRBinSize_tight',instName)] - hitfilterTool.phi0Bins_tight = self.settings[('phi0Bins_tight',instName)] - hitfilterTool.etaCutInner_tight = self.settings[('etaCutInner_tight',instName)] - hitfilterTool.etaCutOuter_tight = self.settings[('etaCutOuter_tight',instName)] - hitfilterTool.d0Cut_tight = self.settings[('d0Cut_tight',instName)] - hitfilterTool.d0Cut_loose = self.settings[('d0Cut_loose',instName)] - hitfilterTool.etaCutInner_loose = self.settings[('etaCutInner_loose',instName)] - hitfilterTool.etaCutOuter_loose = self.settings[('etaCutOuter_loose',instName)] - hitfilterTool.dPhidRBinSize_loose = self.settings[('dPhidRBinSize_loose',instName)] - hitfilterTool.phi0Bins_loose = self.settings[('phi0Bins_loose',instName)] - hitfilterTool.deltadzdrCut_loose = self.settings[('deltadzdrCut_loose',instName)] - hitfilterTool.deltadzdrCut_tight = self.settings[('deltadzdrCut_tight',instName)] - hitfilterTool.pTcutInMeV = self.settings[('pTmin',instName)] - - - duptrkremovalTool = TrigL2DupTrackRemovalTool(name="DupTrackRemovalTool", mode = 2) - - ToolSvc += zfinderTool - self.strategy.TrigZFinder=zfinderTool - ToolSvc += hitfilterTool - self.strategy.TrigHitFilter = hitfilterTool - ToolSvc += duptrkremovalTool - self.strategy.DupTrackRemovalTool = duptrkremovalTool - - self.strategy.AdjustLayerThreshold = False - self.strategy.DetMaskCheck = True - self.strategy.DetMaskCheckOnEvent = False - self.strategy.UseBeamSpot = True - - return self.strategy - else : - print "Instance "+instName+" of the Strategy A is not supported !" - return None diff --git a/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigB.py b/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigB.py deleted file mode 100644 index bff2ea83bac5e288eacf4c73afeaf56a76273428..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigB.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from TrigInDetRecoTools.TrigInDetRecoToolsConf import TrigL2PattRecoStrategyB -from TrigInDetRecoTools.ConfiguredSettings import SettingsForStrategyB - -from AthenaCommon.Logging import logging -log = logging.getLogger("FactoryForStrategyB") - -class FactoryForStrategyB() : - __slots__=[] - def __init__(self, name = 'FactoryForStrategyB') : - self.strategy = None - self.settings = SettingsForStrategyB() - - def createStrategy(self, instName) : - if instName in self.settings.allowedInstanceNames : - self.strategy = TrigL2PattRecoStrategyB("StrategyB_"+instName) - - ## Layer properties ## - self.strategy.Map_LayerOneMultiplicity = self.settings[('Map_LayerOneMultiplicity',instName)] - self.strategy.Map_LayerTwoMultiplicity = self.settings[('Map_LayerTwoMultiplicity',instName)] - self.strategy.Map_MaxLayerFailureFraction = 0.001 - self.strategy.Map_MaxTotalFailureFraction = 0.00001 - - ## New cut properties ## - self.strategy.Reco_NewCuts = False - self.strategy.Reco_NewCutsRZ = False - self.strategy.Reco_PtMinSeedDiff = 0.0 - self.strategy.Reco_D0MaxSeedDiff = 2.0 - self.strategy.Reco_PtMinTripletDiff = 0.0 - self.strategy.Reco_D0MaxTripletDiff = 1.0 - self.strategy.Reco_PtMin = self.settings[('pTmin',instName)] - self.strategy.Reco_D0Max = self.settings[('Reco_D0Max',instName)] - self.strategy.Reco_TimingFactor = 3.0 - self.strategy.Reco_AlignmentScaling = 1.0 - self.strategy.Reco_OutlierRemoval = False - self.strategy.Reco_OutlierRemovalCut = 0.9 - self.strategy.Reco_OutlierRemovalLayers = 4 - self.strategy.Reco_OutlierRemovalD0 = 0.005 - self.strategy.Reco_OutlierRemovalPt = 40 - self.strategy.Reco_MaxSeeds = 30000 - self.strategy.Reco_MaxTracks = 3000 - self.strategy.Reco_Z0Bin = 20 - self.strategy.Reco_EtaBin = 0.1 - - ## Preliminary vertexing properties ## - self.strategy.PreVertexing_Enable = False - self.strategy.PreVertexing_VtxName = "TrueTrigVertexColl" - self.strategy.PreVertexing_ZCut = 5 - - ## Seeding properties ## - self.strategy.Seeding_PreCutRZ = 10000 - self.strategy.Seeding_PreCutPhi = 3.15 - self.strategy.Seeding_PreCutRPhi = 0.001 - self.strategy.Seeding_CutRZ = 1.5 - - ## Vertexing properties ## - self.strategy.Vertexing_Enable = self.settings[('Vertexing_Enable',instName)] - self.strategy.Vertexing_CutRPhi = self.settings[('Vertexing_CutRPhi',instName)] - self.strategy.Vertexing_MaxVertices = 3 - self.strategy.Vertexing_WindowSize = self.settings[('Vertexing_WindowSize',instName)] - self.strategy.Vertexing_WindowSegments = 4 - - ## Extension properties ## - self.strategy.Extension_PreCutRZ = 10000 - self.strategy.Extension_PreCutPhi = 3.15 - self.strategy.Extension_PreCutRPhi = 0.0006 - self.strategy.Extension_PreCutRPhiDiff = 0.0006 - self.strategy.Extension_CutRZPixel = 0.8 - self.strategy.Extension_CutRZ = 4.5 - self.strategy.Extension_CutRPhi = 0.0035 - self.strategy.Extension_CutSpacePoints = 4 - self.strategy.Extension_CutSpacePointsMiss1 = 4 - self.strategy.Extension_CutSpacePointsMiss2 = 4 - self.strategy.Extension_SolveTriplets = True - self.strategy.Extension_SolveTripletsDRCut = 9.0 - self.strategy.Extension_SolveTripletsPhiScale = 0.0006 - self.strategy.Extension_SolveTripletsEtaScale = 0.0022 - self.strategy.Extension_SolveTracks = True - self.strategy.Extension_SolveV0Tracks = True - self.strategy.Extension_SolveTracksDRCut = 9.0 - self.strategy.Extension_SolveTracksPhiScale = 0.0006 - self.strategy.Extension_SolveTracksEtaScale = 0.0022 - self.strategy.Extension_SolveShared = True - self.strategy.Extension_MaxMissingLayers = 20 - self.strategy.Extension_Refit = True - self.strategy.Extension_SpacePoints = self.settings[('Extension_SpacePoints',instName)] - self.strategy.Extension_SpacePointsMiss1 = self.settings[('Extension_SpacePointsMiss1',instName)] - self.strategy.Extension_SpacePointsMiss2 = self.settings[('Extension_SpacePointsMiss2',instName)] - self.strategy.Extension_TRTExtension = self.settings[('Extension_TRTExtension',instName)] - - ## Debug properties ## - self.strategy.Debug_Tuning = False - self.strategy.Debug_TuningGoodSeeds = False - self.strategy.Debug_TuningBadSeeds = False - self.strategy.Debug_TuningGoodTriplets = False - self.strategy.Debug_TuningBadTriplets = False - - return self.strategy - else : - print "Instance "+instName+" of the Strategy B is not supported !" - return None - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigC.py b/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigC.py deleted file mode 100644 index bf3ca7a1885f5680340966f2ddf0187c83ebf0d9..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/python/TrigInDetRecoTools_ConfigC.py +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -from TrigInDetRecoTools.TrigInDetRecoToolsConf import TrigL2PattRecoStrategyC -from TrigInDetRecoTools.ConfiguredSettings import SettingsForStrategyC -from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPixelConditionsSummaryTool - -from AthenaCommon.Logging import logging -log = logging.getLogger("FactoryForStrategyC") - -class FactoryForStrategyC() : - __slots__=[] - def __init__(self, name = 'FactoryForStrategyC') : - self.strategy = None - self.settings = SettingsForStrategyC() - - def createStrategy(self, instName) : - if instName in self.settings.allowedInstanceNames : - self.strategy = TrigL2PattRecoStrategyC("StrategyC_"+instName) - from AthenaCommon.DetFlags import DetFlags - from AthenaCommon.AppMgr import ToolSvc - from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags - from InDetTrigRecExample.ConfiguredNewTrackingTrigCuts import EFIDTrackingCuts - InDetTrigCutValues = EFIDTrackingCuts - from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_Trigger - SeedMaker_C = InDet__SiSpacePointsSeedMaker_Trigger( name = 'InDetTrigSiSpacePointsSeedMaker_C_'+instName, - pTmin = self.settings[('pTmin',instName)], - maxdImpact = 5.0, - maxZ = InDetTrigCutValues.maxZImpact(), - minZ = -InDetTrigCutValues.maxZImpact(), - useOverlapSpCollection = False, - #useOverlapSpCollection = InDetTrigFlags.doOverlapSP(), #testing - usePixel = DetFlags.haveRIO.pixel_on(), - useSCT = DetFlags.haveRIO.SCT_on(), - SpacePointsSCTName = 'SCT_TempSpacePoints', - SpacePointsPixelName = 'PixelTempSpacePoints', - radMax = InDetTrigCutValues.radMax(), - #maxNumberVertices=5, #not fully tested - ) - ToolSvc += SeedMaker_C - print SeedMaker_C - from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk - ZvertexMaker_C = InDet__SiZvertexMaker_xk( name = 'InDetTrigZvertexMaker_C_'+instName, - Zmax = InDetTrigCutValues.maxZImpact(), - Zmin = -InDetTrigCutValues.maxZImpact(), - #SeedSize = 3, - #minContent = 10, - minRatio = 0.17 # not default - ) - ZvertexMaker_C.SeedMakerTool = SeedMaker_C - ToolSvc += ZvertexMaker_C - - print ZvertexMaker_C - - # SCT and Pixel detector elements road builder - from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPixelConditionsSummaryTool, InDetTrigSCTConditionsSummaryTool - from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigSiDetElementsRoadMaker - InDetTrigSiDetElementsRoadMaker_C = InDetTrigSiDetElementsRoadMaker.clone('InDetTrigSiDetElementsRoadMaker_C') - InDetTrigSiDetElementsRoadMaker_C.RoadWidth = self.settings[('RoadWidth',instName)] - - if DetFlags.haveRIO.SCT_on(): - from InDetTrigRecExample.InDetTrigConditionsAccess import SCT_ConditionsSetup - from SCT_ConditionsTools.SCT_ConditionsToolsConf import SCT_ConditionsSummaryTool - InDetTrigSCTConditionsSummaryTool = SCT_ConditionsSummaryTool(SCT_ConditionsSetup.instanceName("InDetSCT_ConditionsSummaryTool")) - else: - InDetTrigSCTConditionsSummaryTool = None - from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiCombinatorialTrackFinder_xk - from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPrdAssociationTool, InDetTrigPatternPropagator - from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPatternUpdator, InDetTrigRotCreator - - TrackFinder_C = InDet__SiCombinatorialTrackFinder_xk(name = 'InDetTrigSiComTrackFinder_C_'+instName, - PropagatorTool = InDetTrigPatternPropagator, - UpdatorTool = InDetTrigPatternUpdator, - RIOonTrackTool = InDetTrigRotCreator, - usePixel = DetFlags.haveRIO.pixel_on(), - useSCT = DetFlags.haveRIO.SCT_on(), - PixelClusterContainer = 'PixelClusterCache', - SCT_ClusterContainer = 'SCT_ClusterCache', - PixelSummaryTool = InDetTrigPixelConditionsSummaryTool, - SctSummaryTool = InDetTrigSCTConditionsSummaryTool) - if DetFlags.haveRIO.pixel_on(): - # Condition algorithm for SiCombinatorialTrackFinder_xk - from AthenaCommon.AlgSequence import AthSequencer - condSeq = AthSequencer("AthCondSeq") - if not hasattr(condSeq, "InDetSiDetElementBoundaryLinksPixelCondAlg"): - from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk - condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(name = "InDetSiDetElementBoundaryLinksPixelCondAlg", - ReadKey = "PixelDetectorElementCollection", - WriteKey = "PixelDetElementBoundaryLinks_xk") - if DetFlags.haveRIO.SCT_on(): - # Condition algorithm for SiCombinatorialTrackFinder_xk - from AthenaCommon.AlgSequence import AthSequencer - condSeq = AthSequencer("AthCondSeq") - if not hasattr(condSeq, "InDetSiDetElementBoundaryLinksSCTCondAlg"): - from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk - condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(name = "InDetSiDetElementBoundaryLinksSCTCondAlg", - ReadKey = "SCT_DetectorElementCollection", - WriteKey = "SCT_DetElementBoundaryLinks_xk") - - from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk - - TrackMaker_C = InDet__SiTrackMaker_xk( name = 'InDetTrigSiTrackMaker_C_'+instName, - RoadTool = InDetTrigSiDetElementsRoadMaker_C, - CombinatorialTrackFinder = TrackFinder_C, - pTmin = self.settings[('pTmin',instName)], - nClustersMin = self.settings[('nClustersMin',instName)], - nHolesMax = self.settings[('nHolesMax',instName)], - nHolesGapMax = self.settings[('nHolesGapMax',instName)], - SeedsFilterLevel = InDetTrigCutValues.seedFilterLevel(), - Xi2max = 15.0, - Xi2maxNoAdd = 15.0, - nWeightedClustersMin= 8, - UseAssociationTool = False) - ToolSvc += TrackMaker_C - print TrackMaker_C - self.strategy.SeedsTool = SeedMaker_C - self.strategy.ZvertexTool = ZvertexMaker_C - #strategy.useZvertexTool = InDetTrigFlags.useZvertexTool() - self.strategy.useZvertexTool = self.settings[('useZvertexTool',instName)] - #self.useZvertexTool = False - self.strategy.TrackTool = TrackMaker_C - return self.strategy - else : - print "Instance "+instName+" of the Strategy C is not supported !" - return None - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/StrBTrack.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/StrBTrack.cxx deleted file mode 100644 index 156ce0d12ac77d3c4a525926fdd4b0d5b6996b15..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/StrBTrack.cxx +++ /dev/null @@ -1,10 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigInDetRecoTools/StrBTrack.h" - -/** static member init **/ -int StrBTrack::m_maxLay=19; - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigInDetRoadMakerTool.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigInDetRoadMakerTool.cxx deleted file mode 100644 index 6cadf1a62aeacef7f98c939272d6c11d6f861157..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigInDetRoadMakerTool.cxx +++ /dev/null @@ -1,375 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <cmath> -#include <iostream> -#include <list> -#include "IRegionSelector/IRoiDescriptor.h" -//#include "InDetIdentifier/PixelID.h" -//#include "InDetIdentifier/SCT_ID.h" -#include "IRegionSelector/IRegSelSvc.h" -#include "TrigInDetPattRecoEvent/TrigInDetRoad.h" -#include "TrigInDetRecoTools/TrigInDetRoadMakerTool.h" - - - -TrigInDetRoadMakerTool::TrigInDetRoadMakerTool(const std::string& t, const std::string& n, const IInterface* p) : - AthAlgTool(t,n,p), - m_numberingTool("TrigL2LayerNumberTool"), - m_regionSelector("RegSelSvc", n) -{ - - declareInterface< ITrigInDetRoadMakerTool >( this ); - - // Region Selector usage property - declareProperty("UseRegSel", m_useRegSel = true); - - // Layer properties - declareProperty("LayerOneDepth", m_layerOneDepth = 2); - declareProperty("LayerTwoDepth", m_layerTwoDepth = 1); - - // Kinematic properties - declareProperty("MinPt", m_minPt = 2000.0); - declareProperty("MaxD0", m_maxD0 = 3.0); - - // Binning properties - declareProperty("EtaBin", m_etaBin = true); - declareProperty("ZedBin", m_zedBin = false); - declareProperty("PhiBin", m_phiBin = false); - declareProperty("EtaBinWidth", m_etaBinWidth = 0.2); - declareProperty("ZedBinWidth", m_zedBinWidth = 100.0); - declareProperty("PhiBinWidth", m_phiBinWidth = 0.2); - -} - - - -TrigInDetRoadMakerTool::~TrigInDetRoadMakerTool() { - -} - - - -StatusCode TrigInDetRoadMakerTool::initialize() { - - StatusCode sc = AthAlgTool::initialize(); - MsgStream athenaLog(msgSvc(), name()); - //int outputLevel = msgSvc()->outputLevel( name() ); - - sc = m_regionSelector.retrieve(); - if(sc.isFailure()) { - athenaLog << MSG::FATAL << "Unable to retrieve RegionSelector tool " << m_regionSelector.type() << endmsg; - return sc; - } - - athenaLog << MSG::INFO << "TrigInDetRoadMakerTool initialized" << endmsg; - - return sc; - -} - - - -StatusCode TrigInDetRoadMakerTool::finalize() { - - StatusCode sc = AthAlgTool::finalize(); - return sc; - -} - - - -StatusCode TrigInDetRoadMakerTool::makeRoads(std::vector<TrigInDetRoad>& roads, const IRoiDescriptor* roi) { - - //roads should be empty - check - // Get log service - MsgStream athenaLog(msgSvc(), name()); - if (!roads.empty()) { - athenaLog << MSG::DEBUG << "TrigInDetRoadMakerTool: roads not empty, roads.size() " << roads.size() << endmsg; - roads.clear(); - } - - // Statuscode - StatusCode sc; - - //int outputLevel = msgSvc()->outputLevel(name()); - - // Get minimum and maximum eta from RoI descriptor - float etaMin, etaMax, phiMin, phiMax, zedMin, zedMax; - if(roi!=nullptr) { - etaMin = roi->etaMinus(); - etaMax = roi->etaPlus(); - phiMin = roi->phiMinus(); - phiMax = roi->phiPlus(); - zedMin = roi->zedMinus(); - zedMax = roi->zedPlus(); - } else { - etaMin = -2.5; - etaMax = 2.5; - phiMin = -M_PI; - phiMax = M_PI; - zedMin = -300.0; - zedMax = 300.0; - } - - // LOOP OVER POSSIBLE BINS - unsigned int roadId=0; - - // Calculate eta bin parameters and default values if no binning has to be applied - unsigned int nEtaBins=1; - float etaBinWidth=etaMax-etaMin; - if(m_etaBin) { - // Bin parameters - nEtaBins = ceil((etaMax - etaMin) / m_etaBinWidth); - etaBinWidth = m_etaBinWidth; - // Adjusted range (possibly exceeding the original one) - float newEtaHalfWidth = nEtaBins*m_etaBinWidth/2.0; - etaMin = (etaMax+etaMin)/2.0 - newEtaHalfWidth; - etaMax = etaMin + 2.0*newEtaHalfWidth; - } - - // Calculate zed bin parameters and default values if no binning has to be applied - unsigned int nZedBins=1; - float zedBinWidth=zedMax-zedMin; - if(m_zedBin && m_useRegSel) { - // Bin parameters - nZedBins = ceil((zedMax - zedMin) / m_zedBinWidth); - zedBinWidth = m_zedBinWidth; - // Adjusted range (possibly exceeding the original one) - float newZedHalfWidth = nZedBins*m_zedBinWidth/2.0; - zedMin = (zedMax+zedMin)/2.0 - newZedHalfWidth; - zedMax = zedMin + 2.0*newZedHalfWidth; - } - - // Loop over zed bins - for(unsigned int loopZed=0; loopZed<nZedBins; loopZed++) { - - // Calculate zed bin boundaries - float loopZedMin = zedMin + loopZed*zedBinWidth; - float loopZedMax = zedMin + (loopZed+1)*zedBinWidth; - - // Loop over eta bins - for(unsigned int loopEta=0; loopEta<nEtaBins; loopEta++) { - - // Calculate bin boundaries - float loopEtaMin = etaMin + loopEta*etaBinWidth; - float loopEtaMax = etaMin + (loopEta+1)*etaBinWidth; - - // Create roads - int bcount1, bcount2; // Barrel layer counters - int ecount1, ecount2; // Endcap layer counters - - // Get list of layers to be used - std::set<unsigned int> l; - - - if(m_useRegSel) { - sc = getRoadLayersRS( TrigRoiDescriptor( 0.5*(loopEtaMin+loopEtaMax), loopEtaMin, loopEtaMax, - 0, -0.4, 0.4, - 0.5*(loopZedMin+loopZedMax), loopZedMin, loopZedMax ), l); - } - else sc = getRoadLayersLUT(loopEtaMin, loopEtaMax, l); - if(sc.isFailure()) athenaLog << MSG::ERROR << "TrigInDetRoadMakerTool: error retrieving layer set"; - - // Debug print - athenaLog << MSG::DEBUG << "TrigInDetRoadMakerTool: starting from layer set "; - std::set<unsigned int>::iterator lay, layEnd=l.end(); - for(lay=l.begin(); lay!=layEnd; lay++) { - athenaLog << MSG::DEBUG << (*lay) << " "; - } - athenaLog << MSG::DEBUG << endmsg; - - // Loop on first layer - unsigned int roadSubId=0; - std::set<unsigned int>::iterator lay1, lay2, lay3; - for(bcount1=0, ecount1=0, lay1=l.begin(); (lay1!=l.end())&&(bcount1<m_layerOneDepth||ecount1<m_layerOneDepth); lay1++) { - if(*lay1<7) if(bcount1<m_layerOneDepth) bcount1++; else continue; - else if(ecount1<m_layerOneDepth) ecount1++; else continue; - - // Loop on second layer - for(bcount2=0, ecount2=0,lay2=lay1,lay2++; (lay2!=l.end())&&(bcount2<m_layerTwoDepth||ecount2<m_layerTwoDepth); lay2++) { - if(*lay2<*lay1) continue; - if(*lay2<7) if(bcount2<m_layerTwoDepth) bcount2++; else continue; - else if(ecount2<m_layerTwoDepth) ecount2++; else continue; - - // Create ROAD - TrigInDetRoad road(1, m_minPt, m_maxD0); - road.m_roadId=roadId; - road.m_roadSubId=roadSubId; - road.m_eta=(loopEtaMin+loopEtaMax)/2.0; road.m_etaMin=loopEtaMin; road.m_etaMax=loopEtaMax; - road.m_phi=(phiMin+phiMax)/2.0; road.m_phiMin=phiMin; road.m_phiMax=phiMax; - road.m_z0=(loopZedMin+loopZedMax)/2.0; road.m_z0Min=loopZedMin; road.m_z0Max=loopZedMax; - road.m_firstLayer.insert(*lay1); - road.m_secondLayer.insert(*lay2); - - // Third layer - for(lay3=lay2, lay3++; lay3!=l.end(); lay3++) { - if(*lay3<*lay2) continue; - - // Insert third layer - road.m_thirdLayer.insert(*lay3); - - } - - // Save ROAD - if(road.m_thirdLayer.size() > 0) { - roads.push_back(road); - roadSubId++; - // Debug print - athenaLog << MSG::DEBUG << "TrigInDetRoadMakerTool: road eta/phi/z0/id/subid " << - road.m_eta << " " << road.m_phi << " " << road.m_z0 << " " << road.m_roadId << " " << road.m_roadSubId << ": " << - (*(road.m_firstLayer.begin())) << " --> " << (*(road.m_secondLayer.begin())) << " --> "; - std::set<unsigned int>::iterator it, itEnd=road.m_thirdLayer.end(); - for(it=road.m_thirdLayer.begin(); it!=itEnd; it++) { - athenaLog << MSG::DEBUG << (*it) << " "; - } - athenaLog << MSG::DEBUG << endmsg; - } - - } - } - - // Increase RoI Id counter - roadId++; - - } - } - - return sc; - -} - - - -StatusCode TrigInDetRoadMakerTool::getRoadLayersRS( const IRoiDescriptor& roi, std::set<unsigned int>& l) { - - // Get log service - MsgStream athenaLog(msgSvc(), name()); - - athenaLog << MSG::DEBUG << "Created RoI with eta/min/max " << roi << endmsg; - - for(long i=0; i<m_numberingTool->offsetBarrelSCT(); i++) { - std::vector<IdentifierHash> idList; - m_regionSelector->DetHashIDList(PIXEL, 1000+i, roi, idList); - //athenaLog << MSG::DEBUG << "Size for layer " << i << " is " << idList.size() << endmsg; - if(idList.size()) l.insert(i); - } - - for(long i=0; i<m_numberingTool->offsetEndcapSCT()-m_numberingTool->offsetEndcapPixels(); i++) { - std::vector<IdentifierHash> idList; - m_regionSelector->DetHashIDList(PIXEL, 1200+i, roi, idList); - //athenaLog << MSG::DEBUG << "Size for layer " << i+7 << " is " << idList.size() << endmsg; - if(idList.size()) l.insert(i+m_numberingTool->offsetEndcapPixels()); - } - - for(long i=0; i<m_numberingTool->offsetEndcapPixels()-m_numberingTool->offsetBarrelSCT(); i++) { - std::vector<IdentifierHash> idList; - m_regionSelector->DetHashIDList(SCT, 1000+i, roi, idList); - //athenaLog << MSG::DEBUG << "Size for layer " << i+3 << " is " << idList.size() << endmsg; - if(idList.size()) l.insert(i+m_numberingTool->offsetBarrelSCT()); - } - - for(long i=0; i<m_numberingTool->maxSiliconLayerNum()-m_numberingTool->offsetEndcapSCT(); i++) { - std::vector<IdentifierHash> idList; - m_regionSelector->DetHashIDList(SCT, 1200+i, roi, idList); - //athenaLog << MSG::DEBUG << "Size for layer " << i+10 << " is " << idList.size() << endmsg; - if(idList.size()) l.insert(i+m_numberingTool->offsetEndcapSCT()); - } - - return StatusCode::SUCCESS; - -} - - - -StatusCode TrigInDetRoadMakerTool::getRoadLayersLUT(float etaMin, float etaMax, std::set<unsigned int>& l) { - - // Fill layer groups - std::vector< std::list<unsigned int> > layerGroups; - std::list<unsigned int> gr1,gr2,gr3,gr4,gr5,gr6,gr7,gr8,gr9; // layer groups as a function of eta - - /* Group definitions - gr1: eta<1 0 1 2 3 4 5 6 - gr2: 1<=eta<1.5 0 1 2 3 4 5 6 10 11 12 13 - gr3: 1.5<=eta<1.7 0 1 2 3 4 5 7 10 12 12 13 14 - gr4: 1.7<=eta<1.8 0 1 2 3 4 7 10 11 12 13 14 15 - gr5: 1.8<=eta<1.9 0 1 2 3 7 8 11 12 13 14 15 16 - gr6: 1.9<=eta<2.1 0 1 2 3 7 8 9 11 12 13 14 15 16 17 - gr7: 2.1<=eta<2.2 0 1 2 7 8 9 11 12 13 14 15 16 17 - gr8: 2.2<=eta<2.4 0 1 2 7 8 9 13 14 15 16 17 18 - gr9: eta>=2.4 0 9 15 16 17 18 - */ - - gr1.push_back(0); gr1.push_back(1); gr1.push_back(2); gr1.push_back(3); gr1.push_back(4); gr1.push_back(5); gr1.push_back(6); - - gr2.push_back(0); gr2.push_back(1); gr2.push_back(2); gr2.push_back(3); gr2.push_back(4); gr2.push_back(5); gr2.push_back(6); - gr2.push_back(10); gr2.push_back(11); gr2.push_back(12); gr2.push_back(13); - - gr3.push_back(0); gr3.push_back(7); gr3.push_back(1); gr3.push_back(2); - gr3.push_back(3); gr3.push_back(4); gr3.push_back(5); gr3.push_back(10); gr3.push_back(11); gr3.push_back(12); gr3.push_back(13); gr3.push_back(14); - - gr4.push_back(0); gr4.push_back(7); gr4.push_back(1); gr4.push_back(2); - gr4.push_back(3); gr4.push_back(4); gr4.push_back(10); gr4.push_back(11); gr4.push_back(12); gr4.push_back(13); gr4.push_back(14); gr4.push_back(15); - - gr5.push_back(0); gr5.push_back(7); gr5.push_back(1); gr5.push_back(8); gr5.push_back(2); - gr5.push_back(3); gr5.push_back(11); gr5.push_back(12); gr5.push_back(13); gr5.push_back(14); gr5.push_back(15); gr5.push_back(16); - - gr6.push_back(0); gr6.push_back(7); gr6.push_back(1); gr6.push_back(8); gr6.push_back(2); gr6.push_back(9); - gr6.push_back(3); gr6.push_back(11); gr6.push_back(12); gr6.push_back(13); gr6.push_back(14); gr6.push_back(15); gr6.push_back(16); gr6.push_back(17); - - gr7.push_back(0); gr7.push_back(7); gr7.push_back(1); gr7.push_back(8); gr7.push_back(2); gr7.push_back(9); - gr7.push_back(11); gr7.push_back(12); gr7.push_back(13); gr7.push_back(14); gr7.push_back(15); gr7.push_back(16); gr7.push_back(17); - - gr8.push_back(0); gr8.push_back(7); gr8.push_back(1); gr8.push_back(8); gr8.push_back(2); gr8.push_back(9); - gr8.push_back(13); gr8.push_back(14); gr8.push_back(15); gr8.push_back(16); gr8.push_back(17); gr8.push_back(18); - - gr9.push_back(0); gr9.push_back(9); - gr9.push_back(15); gr9.push_back(16); gr9.push_back(17); gr9.push_back(18); - - layerGroups.push_back(gr1); - layerGroups.push_back(gr2); - layerGroups.push_back(gr3); - layerGroups.push_back(gr4); - layerGroups.push_back(gr5); - layerGroups.push_back(gr6); - layerGroups.push_back(gr7); - layerGroups.push_back(gr8); - layerGroups.push_back(gr9); - - float absetaMin=0, absetaMax=2.5; - if(etaMin>0) {absetaMin = etaMin; absetaMax = etaMax;} - if(etaMin<=0&&etaMax>0) {absetaMin = 0; absetaMax = (etaMax>-etaMin) ? etaMax : -etaMin;} - if(etaMax<=0) {absetaMin = -etaMax; absetaMax = -etaMin;} - - int imin=1,imax=9; - if (absetaMin<1.) imin=1; - if (absetaMin>=1. && absetaMin<1.5) imin=2; - if (absetaMin>=1.5 && absetaMin<1.7) imin=3; - if (absetaMin>=1.7 && absetaMin<1.8) imin=4; - if (absetaMin>=1.8 && absetaMin<1.9) imin=5; - if (absetaMin>=1.9 && absetaMin<2.1) imin=6; - if (absetaMin>=2.1 && absetaMin<2.2) imin=7; - if (absetaMin>=2.2 && absetaMin<2.4) imin=8; - if (absetaMin>=2.4) imin=9; - if (absetaMax<1.) imax=1; - if (absetaMax>=1. && absetaMax<1.5) imax=2; - if (absetaMax>=1.5 && absetaMax<1.7) imax=3; - if (absetaMax>=1.7 && absetaMax<1.8) imax=4; - if (absetaMax>=1.8 && absetaMax<1.9) imax=5; - if (absetaMax>=1.9 && absetaMax<2.1) imax=6; - if (absetaMax>=2.1 && absetaMax<2.2) imax=7; - if (absetaMax>=2.2 && absetaMax<2.4) imax=8; - if (absetaMax>=2.4) imax=9; - - // Build list of layers to be combined - for(int i=imin-1; i<imax;i++) { - std::list<unsigned int>::iterator it, itEnd=layerGroups[i].end(); - for(it=layerGroups[i].begin(); it!=itEnd; it++) - l.insert(*it); - } - - return StatusCode::SUCCESS; - -} - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2DupTrackRemovalTool.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2DupTrackRemovalTool.cxx deleted file mode 100644 index 356e90c877c79d077c9b148e8016369fb1a6db88..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2DupTrackRemovalTool.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//#include <iostream> - -// general Atlas classes -//#include "GaudiKernel/PropertyMgr.h" -//#include "GaudiKernel/MsgStream.h" - -//#include "AthenaKernel/Timeout.h" - -/*#include "EventInfo/EventInfo.h" - #include "EventInfo/EventID.h" - #include "eformat/DetectorMask.h" - - #include "TrigTimeAlgs/TrigTimerSvc.h" - #include "TrigInDetEvent/TrigSiSpacePoint.h" - #include "TrigInDetEvent/TrigSiSpacePointCollection.h" - #include "TrigInDetEvent/TrigVertex.h" - #include "TrigInDetEvent/TrigVertexCollection.h" - #include "TrigInDetEvent/TrigInDetTrack.h" - #include "TrigInDetEvent/TrigInDetTrackFitPar.h" - #include "TrigSiSpacePointTool/ISpacePointProvider.h" - - #include "TrigInDetToolInterfaces/ITrigZFinder.h" - #include "TrigInDetToolInterfaces/ITrigHitFilter.h" - #include "TrigInDetToolInterfaces/ITrigInDetTrackFitter.h" - #include "TrigInDetToolInterfaces/ITrigTRT_TrackExtensionTool.h" - #include "TrigInDetToolInterfaces/TrigL2HitResidual.h" - #include "TrigInDetToolInterfaces/ITrigL2ResidualCalculator.h" - - #include "TrkTrack/TrackCollection.h" - #include "TrkTrack/Track.h" - - #include<sstream>*/ - -#include "TrigInDetEvent/TrigInDetTrackCollection.h" -#include "TrigInDetRecoTools/ITrigL2DupTrackRemovalTool.h" -#include "TrigInDetRecoTools/TrigL2DupTrackRemovalTool.h" - -//using namespace std; - - -TrigL2DupTrackRemovalTool::TrigL2DupTrackRemovalTool(const std::string& t, const std::string& n, const IInterface* p ): - AthAlgTool(t,n,p) -{ - declareInterface< ITrigL2DupTrackRemovalTool >( this ); - - declareProperty( "mode", m_mode = 2 ); -} - - -TrigL2DupTrackRemovalTool::~TrigL2DupTrackRemovalTool() { - -} - - -StatusCode TrigL2DupTrackRemovalTool::initialize() -{ - StatusCode sc = AthAlgTool::initialize(); - MsgStream athenaLog(msgSvc(), name()); - - athenaLog << MSG::INFO << "TrigL2DupTrackRemovalTool initialized "<< endmsg; - return sc; -} - - -StatusCode TrigL2DupTrackRemovalTool::finalize() { - - StatusCode sc = AthAlgTool::finalize(); - - //athenaLog << MSG::INFO << "TrigL2DupTrackRemovalTool finalized "<< endmsg; - return sc; -} - - -void TrigL2DupTrackRemovalTool::removeDupTracks(TrigInDetTrackCollection* trackColl,std::vector<unsigned int> placeHolder) -{ - TrigInDetTrack * deleteMe; - if (m_mode==1) { - /////////////////////////////////////////// - /////// DupTrackRemovalTool mode 1 //////// - // Deleting duplicate tracks based on DR // - /////////////////////////////////////////// - TrigInDetTrackCollection::iterator track = trackColl->begin(); - TrigInDetTrackCollection::iterator lastTrack = trackColl->end(); - int trackNum2(0); - double R(0.); - TrigInDetTrackCollection::iterator track2 = trackColl->begin(); - for(int trackNum=0; track !=lastTrack; track++, trackNum++){ - for(trackNum2=trackNum, track2 = track; track2 !=lastTrack; trackNum2++, track2++){ - if(track != track2){ - R = sqrt( pow((*track)->param()->phi0()-(*track2)->param()->phi0(),2) + - pow((*track)->param()->eta() -(*track2)->param()->eta(),2) ); - if(R < 0.01){ - //delete closeby tracks and keep the one with more spacepoints or a lower chi2 - //should I be using overall number of spacepoints? - if((*track)->NPixelSpacePoints() > (*track2)->NPixelSpacePoints()){ - trackColl->swapElement(trackNum2, 0, deleteMe); - trackColl->erase(track2); - delete deleteMe; - deleteMe = NULL; - lastTrack = trackColl->end(); - }else if((*track2)->NPixelSpacePoints() > (*track)->NPixelSpacePoints()){ - trackColl->swapElement(trackNum, 0, deleteMe); - trackColl->erase(track); - delete deleteMe; - deleteMe = NULL; - lastTrack = trackColl->end(); - track--; - trackNum -=1; - break; - }else if((*track)->NSCT_SpacePoints() > (*track2)->NSCT_SpacePoints()){ - trackColl->swapElement(trackNum2, 0, deleteMe); - trackColl->erase(track2); - delete deleteMe; - deleteMe = NULL; - lastTrack = trackColl->end(); - }else if((*track2)->NSCT_SpacePoints() > (*track)->NSCT_SpacePoints()){ - trackColl->swapElement(trackNum, 0, deleteMe); - trackColl->erase(track); - delete deleteMe; - deleteMe = NULL; - lastTrack = trackColl->end(); - track--; - trackNum -=1; - break; - }else if((*track)->chi2() < (*track2)->chi2()){ - trackColl->swapElement(trackNum2, 0, deleteMe); - trackColl->erase(track2); - delete deleteMe; - deleteMe = NULL; - lastTrack = trackColl->end(); - }else{ - trackColl->swapElement(trackNum, 0, deleteMe); - trackColl->erase(track); - delete deleteMe; - deleteMe = NULL; - lastTrack = trackColl->end(); - track--; - trackNum -=1; - break; - } - track2--; - trackNum2 -=1; - } - } - } - } - } - - if (m_mode==2) { - /////////////////////////////////////////////////////////////////////////// - /////////////////////// DupTrackRemovalTool mode 2 //////////////////////// - // Deleting duplicate tracks from multiple z vertices based on shared SP // - /////////////////////////////////////////////////////////////////////////// - unsigned int nZvertices = placeHolder.size(); - if (nZvertices==1) return; - unsigned int trackNum2(0), numPointsShared(0); - std::vector<const TrigSiSpacePoint*>* trackPoints1; - std::vector<const TrigSiSpacePoint*>* trackPoints2; - for(int trackNum1=0; trackNum1 < int (placeHolder[nZvertices - 1]); trackNum1++){ - //only loop through tracks from other vertices - for(unsigned int i=0;i<placeHolder.size();i++){ - if(trackNum1 < int (placeHolder[i])){ - trackNum2 = placeHolder[i]; - break; - } - } - trackPoints1 = trackColl->at(trackNum1)->siSpacePoints(); - for(; trackNum2 < trackColl->size(); trackNum2++){ - trackPoints2 = trackColl->at(trackNum2)->siSpacePoints(); - numPointsShared = 0; - //check if the two tracks share any spacpoints - for(unsigned int k=0;k<trackPoints1->size(); k++){ - for(unsigned int j=0;j < trackPoints2->size(); j++){ - if(trackPoints1->at(k) == trackPoints2->at(j)){ - numPointsShared +=1; - } - } - if(numPointsShared > 2) break; - } - if(numPointsShared > 2){ - //delete one of the duplicate tracks, keeping the one with more spacepoints or a lower chi2 - if(trackColl->at(trackNum1)->NPixelSpacePoints() > trackColl->at(trackNum2)->NPixelSpacePoints()){ - trackColl->swapElement(trackNum2, 0, deleteMe); - trackColl->erase(trackColl->begin() + trackNum2); - delete deleteMe; - deleteMe = NULL; - }else if(trackColl->at(trackNum2)->NPixelSpacePoints() > trackColl->at(trackNum1)->NPixelSpacePoints()){ - trackColl->swapElement(trackNum1, 0, deleteMe); - trackColl->erase(trackColl->begin() + trackNum1); - delete deleteMe; - deleteMe = NULL; - for(unsigned int l = 0;l<placeHolder.size();l++){ - if(trackNum1 < int (placeHolder[l])) placeHolder[l] -= 1; - } - trackNum1 -=1; - break; - }else if(trackColl->at(trackNum1)->NSCT_SpacePoints() > trackColl->at(trackNum2)->NSCT_SpacePoints()){ - trackColl->swapElement(trackNum2, 0, deleteMe); - trackColl->erase(trackColl->begin() + trackNum2); - delete deleteMe; - deleteMe = NULL; - }else if(trackColl->at(trackNum2)->NSCT_SpacePoints() > trackColl->at(trackNum1)->NSCT_SpacePoints()){ - trackColl->swapElement(trackNum1, 0, deleteMe); - trackColl->erase(trackColl->begin() + trackNum1); - delete deleteMe; - deleteMe = NULL; - for(unsigned int l = 0;l<placeHolder.size();l++){ - if(trackNum1 < int (placeHolder[l])) placeHolder[l] -= 1; - } - trackNum1 -=1; - break; - }else if(trackColl->at(trackNum1)->chi2() < trackColl->at(trackNum2)->chi2()){ - trackColl->swapElement(trackNum2, 0, deleteMe); - trackColl->erase(trackColl->begin() + trackNum2); - delete deleteMe; - deleteMe = NULL; - }else{ - trackColl->swapElement(trackNum1, 0, deleteMe); - trackColl->erase(trackColl->begin() + trackNum1); - delete deleteMe; - deleteMe = NULL; - for(unsigned int l = 0;l<placeHolder.size();l++){ - if(trackNum1 < int (placeHolder[l])) placeHolder[l] -= 1; - } - trackNum1 -=1; - break; - } - for(unsigned int l = 0;l<placeHolder.size();l++){ - if(trackNum2 < placeHolder[l]) placeHolder[l] -= 1; - } - trackNum2 -=1; - } - } - } - } - -} diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.cxx deleted file mode 100644 index 0e225416e8bd5521df7d6ecb8035bb997a4232c3..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.cxx +++ /dev/null @@ -1,362 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <cmath> -#include <iostream> -#include "InDetIdentifier/SCT_ID.h" -#include "InDetIdentifier/PixelID.h" - -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "PixelReadoutGeometry/PixelDetectorManager.h" -#include "SCT_ReadoutGeometry/SCT_DetectorManager.h" - -#include "TrigL2LayerSetPredictorTool.h" -#include "TrigInDetToolInterfaces/ITrigL2LayerNumberTool.h" - -TrigL2LayerSetPredictorTool::TrigL2LayerSetPredictorTool(const std::string& t, - const std::string& n, - const IInterface* p ): - AthAlgTool(t,n,p), - //m_regionSelector("RegSelSvc", n), - m_numberingTool("TrigL2LayerNumberTool"), - m_pLUT(NULL) { - - declareInterface< ITrigL2LayerSetPredictorTool >( this ); - declareProperty( "LayerNumberTool", m_numberingTool ); - declareProperty( "MaxEta", m_maxEta = 2.6 ); - declareProperty( "MaxZ0", m_maxZ0 = 230.0 ); - declareProperty( "NBinsZ0", m_nBinsZ = 101 ); - declareProperty( "NBinsTheta", m_nBinsTheta = 101 ); -} - -StatusCode TrigL2LayerSetPredictorTool::initialize() { - - StatusCode sc = AthAlgTool::initialize(); - MsgStream athenaLog(msgSvc(), name()); - - sc=m_numberingTool.retrieve(); - - if(sc.isFailure()) { - athenaLog << MSG::FATAL << "Could not retrieve "<<m_numberingTool<<endmsg; - return StatusCode::FAILURE; - } - /* - sc = m_regionSelector.retrieve(); - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL << "Could not retrieve "<<m_regionSelector.type()<<endmsg; - return StatusCode::FAILURE; - } - */ - //Get ID helpers - if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) { - athenaLog << MSG::FATAL << "Could not get AtlasDetectorID helper AtlasID"<<endmsg; - return StatusCode::FAILURE; - } - - if (detStore()->retrieve(m_pixelId, "PixelID").isFailure()) { - athenaLog << MSG::FATAL << "Could not get Pixel ID helper"<<endmsg; - return StatusCode::FAILURE; - } - - if (detStore()->retrieve(m_sctId, "SCT_ID").isFailure()) { - athenaLog << MSG::FATAL << "Could not get Pixel ID helper"<<endmsg; - return StatusCode::FAILURE; - } - - sc = detStore()->retrieve(m_pixelManager); - if( sc.isFailure() ) { - athenaLog << MSG::FATAL << "Could not retrieve Pixel DetectorManager from detStore."<<endmsg; - return sc; - } - - sc = detStore()->retrieve(m_SCT_Manager); - if( sc.isFailure() ) { - athenaLog << MSG::ERROR << "Could not retrieve SCT DetectorManager from detStore." << endmsg; - return sc; - } - - athenaLog << MSG::INFO << "TrigL2LayerSetPredictorTool initialized "<< endmsg; - return sc; -} - - -StatusCode TrigL2LayerSetPredictorTool::finalize() { - - StatusCode sc = AthAlgTool::finalize(); - delete m_pLUT; - return sc; -} - -StatusCode TrigL2LayerSetPredictorTool::createLUT() { - - StatusCode sc(StatusCode::SUCCESS); - MsgStream athenaLog(msgSvc(), name()); - - athenaLog << MSG::INFO <<"creating LUT for layer set prediction"<<endmsg; - - int maxLayer = m_numberingTool->maxSiliconLayerNum(); - - std::map<int, TRIG_L2_LAYER_DESCRIPTOR> layerMap; - - for(int layerId=0;layerId<maxLayer;layerId++) { - int type = (layerId>=m_numberingTool->offsetEndcapPixels()) ? 1 : 0; - layerMap.insert(std::pair<int,TRIG_L2_LAYER_DESCRIPTOR>(layerId,TRIG_L2_LAYER_DESCRIPTOR(type))); - if(type==1) { - layerMap.insert(std::pair<int,TRIG_L2_LAYER_DESCRIPTOR>(-layerId,TRIG_L2_LAYER_DESCRIPTOR(type))); - } - } - - for(int SubDetId=0;SubDetId<2;SubDetId++) { - - const InDetDD::SiNumerology& siNumerology = (SubDetId==0) ? m_pixelManager->numerology() : m_SCT_Manager->numerology(); - int nSides = 1; - if(SubDetId==1) nSides = 2; - - for (int iBarrelIndex = 0; iBarrelIndex < siNumerology.numBarrels(); iBarrelIndex++) { - int iBarrel = siNumerology.barrelId(iBarrelIndex); - for (int iLayer = 0; iLayer < siNumerology.numLayers(); iLayer++) { - for (int iPhi = 0; iPhi < siNumerology.numPhiModulesForLayer(iLayer); iPhi++) { - for (int iEta = siNumerology.beginEtaModuleForLayer(iLayer); iEta < siNumerology.endEtaModuleForLayer(iLayer); iEta++) { - if (!iEta && siNumerology.skipEtaZeroForLayer(iLayer)) continue; - for (int iSide = 0; iSide < nSides; iSide++) { - Identifier id = (SubDetId==0) ? m_pixelId->wafer_id(iBarrel,iLayer,iPhi,iEta) : - m_sctId->wafer_id(iBarrel,iLayer,iPhi,iEta,iSide); - const InDetDD::SiDetectorElement* element = (SubDetId==0) ? m_pixelManager->getDetectorElement(id) : m_SCT_Manager->getDetectorElement(id); - - if(element==0) { - athenaLog << MSG::INFO<<"Barrel element not found: DetId="<<SubDetId<<" iB="<<iBarrel<<" iL="<<iLayer<<" iPhi="<<iPhi<<" iEta="<<iEta<<endmsg; - if (SubDetId==0) athenaLog << MSG::INFO<<"element id="<<id<<" : "<<m_pixelId->print_to_string(id)<<endmsg; - continue; - } - int layerId = (SubDetId==0) ? iLayer : iLayer+m_numberingTool->offsetBarrelSCT(); - - if(layerMap.find(layerId)==layerMap.end()) { - std::cout<<"ERROR: layer Id="<<layerId<<" not found in the map"<<std::endl; - } - else { - (*layerMap.find(layerId)).second.m_nElements++; - (*layerMap.find(layerId)).second.m_refCoordinate += element->rMin(); - (*layerMap.find(layerId)).second.m_refCoordinate += element->rMax(); - double& lMin = (*layerMap.find(layerId)).second.m_minCoordinate; - if(lMin>element->zMin()) lMin=element->zMin(); - double& lMax = (*layerMap.find(layerId)).second.m_maxCoordinate; - if(lMax<element->zMax()) lMax=element->zMax(); - } - // For extra safety in case some strip modules do not have two sides (eg in future geometries) one could add. - if (!element->otherSide()) iSide++; - } // iSide - } // iEta - } //iPhi - } //iLayer - } // Barrel - // Endcap - for (int iEndcapIndex = 0; iEndcapIndex < siNumerology.numEndcaps(); iEndcapIndex++) { - int iEndcap = siNumerology.endcapId(iEndcapIndex); - for (int iDisk = 0; iDisk < siNumerology.numDisks(); iDisk++) { - for (int iEta = 0; iEta < siNumerology.numRingsForDisk(iDisk); iEta++) { - for (int iPhi = 0; iPhi < siNumerology.numPhiModulesForDiskRing(iDisk,iEta); iPhi++) { - for (int iSide = 0; iSide < nSides; iSide++) { - Identifier id = (SubDetId==0) ? m_pixelId->wafer_id(iEndcap,iDisk,iPhi,iEta) : - m_sctId->wafer_id(iEndcap,iDisk,iPhi,iEta,iSide); - const InDetDD::SiDetectorElement* element = (SubDetId==0) ? m_pixelManager->getDetectorElement(id) : m_SCT_Manager->getDetectorElement(id); - - if(element==0) { - continue; - } - - int layerId = (SubDetId==0) ? iDisk+m_numberingTool->offsetEndcapPixels() : iDisk+m_numberingTool->offsetEndcapSCT(); - if(iEndcap<0) layerId=-layerId; - if(layerMap.find(layerId)==layerMap.end()) { - std::cout<<"ERROR: layer Id="<<layerId<<" not found in the map"<<std::endl; - } - else { - (*layerMap.find(layerId)).second.m_nElements++; - (*layerMap.find(layerId)).second.m_refCoordinate += element->zMin(); - (*layerMap.find(layerId)).second.m_refCoordinate += element->zMax(); - double& lMin = (*layerMap.find(layerId)).second.m_minCoordinate; - if(lMin>element->rMin()) lMin=element->rMin(); - double& lMax = (*layerMap.find(layerId)).second.m_maxCoordinate; - if(lMax<element->rMax()) lMax=element->rMax(); - } - // For extra safety in case some strip modules do not have two sides (eg in future geometries) one could add. - if (!element->otherSide()) iSide++; - } // iSide - } // iEta - } //iPhi - } //iDisk - } // Endcap; - } - - for(int layerId=-maxLayer+1;layerId<maxLayer;layerId++) { - if(layerMap.find(layerId) == layerMap.end()) continue; - (*layerMap.find(layerId)).second.m_refCoordinate/=2.0*(*layerMap.find(layerId)).second.m_nElements; - //std::cout<<"Layer "<<layerId<<" has "<<(*layerMap.find(layerId)).second.m_nElements<<" elements"<<std::endl; - //std::cout<<"ref coord="<<(*layerMap.find(layerId)).second.m_refCoordinate<<" min="<<(*layerMap.find(layerId)).second.m_minCoordinate<< - // " max="<<(*layerMap.find(layerId)).second.m_maxCoordinate<<std::endl; - } - - //now building the LUT - - double thetaMax = 2.0*atan(exp(-m_maxEta)); - double tauMax = cos(thetaMax)/sin(thetaMax); - int nbT = (m_nBinsTheta-1)/2; - double dTau = 2*tauMax/m_nBinsTheta; - - int nbZ = (m_nBinsZ-1)/2; - double dZ = 2*m_maxZ0/m_nBinsZ; - - std::vector<LAYER_IMPACT_POINT>* vArray = new std::vector<LAYER_IMPACT_POINT>[m_nBinsZ*m_nBinsTheta]; - for(int i=0;i<m_nBinsZ;i++) { - for(int j=0;j<m_nBinsTheta;j++) { - int idx = j + i*m_nBinsTheta; - vArray[idx].clear(); - } - } - - for(int layerId=-maxLayer+1;layerId<maxLayer;layerId++) { - const std::map<int, TRIG_L2_LAYER_DESCRIPTOR>::iterator lIt = layerMap.find(layerId); - if(lIt == layerMap.end()) continue; - - if((*lIt).second.m_type==0) { // barrel - for(int j=-nbT;j<=nbT;j++) { - double tau = j*dTau; - double lx = (*lIt).second.m_refCoordinate*sqrt(1.0+tau*tau); - double z0max = (*lIt).second.m_maxCoordinate - tau*(*lIt).second.m_refCoordinate; - double z0min = (*lIt).second.m_minCoordinate - tau*(*lIt).second.m_refCoordinate; - int maxBin = (fabs(z0max)<=dZ) ? 0 : 1+(int)(fabs(z0max)/dZ-0.5); - if(z0max<0.0) maxBin = -maxBin; - int minBin = (fabs(z0min)<=dZ) ? 0 : 1+(int)(fabs(z0min)/dZ-0.5); - if(z0min<0.0) minBin = -minBin; - if(maxBin>nbZ) maxBin = nbZ; - if(minBin<-nbZ) minBin = -nbZ; - for(int i=minBin;i<=maxBin;i++) { - int idx = (j+nbT) + (i+nbZ)*m_nBinsTheta; - vArray[idx].push_back(LAYER_IMPACT_POINT(layerId,lx)); - } - } - } - else { //endcap - for(int i=-nbZ;i<=nbZ;i++) { - double z0 = i*dZ; - double tauMin = ((*lIt).second.m_refCoordinate-z0)/(*lIt).second.m_maxCoordinate; - double tauMax = ((*lIt).second.m_refCoordinate-z0)/(*lIt).second.m_minCoordinate; - if(tauMin>tauMax) { - double tmp=tauMin;tauMin=tauMax;tauMax=tmp; - } - int maxBin = (fabs(tauMax)<=dTau) ? 0 : 1+(int)(fabs(tauMax)/dTau-0.5); - if (tauMax<0.0) maxBin = -maxBin; - int minBin = (fabs(tauMin)<=dTau) ? 0 : 1+(int)(fabs(tauMin)/dTau-0.5); - if (tauMin<0.0) minBin = -minBin; - if(maxBin>nbT) maxBin = nbT; - if(minBin<-nbT) minBin = -nbT; - for(int j=minBin;j<=maxBin;j++) { - int idx = (j+nbT) + (i+nbZ)*m_nBinsTheta; - double tau = j*dTau; - if(j==0) { - std::cout<<"layer zk="<<(*lIt).second.m_refCoordinate<<" z0="<<z0<<" zero tau !"<<std::endl; - } - double lx = sqrt(1.0+tau*tau)*((*lIt).second.m_refCoordinate-z0)/tau; - vArray[idx].push_back(LAYER_IMPACT_POINT(layerId,lx)); - } - } - } - } - - unsigned int nLmax=0; - - for(int i=0;i<m_nBinsZ;i++) { - for(int j=0;j<m_nBinsTheta;j++) { - int idx = j + i*m_nBinsTheta; - std::sort(vArray[idx].begin(), vArray[idx].end(), LAYER_IMPACT_POINT::compare()); - if(nLmax<vArray[idx].size()) nLmax = vArray[idx].size(); - } - } - - //quick test - /* - const std::vector<LAYER_IMPACT_POINT>& v0 = vArray[nbT + nbZ*m_nBinsTheta]; - - for(std::vector<LAYER_IMPACT_POINT>::const_iterator lIt = v0.begin();lIt!= v0.end();++lIt) { - std::cout<<"L"<<(*lIt).m_layerId<<" l="<<(*lIt).m_L<<std::endl; - } - - int D=4; - - const std::vector<LAYER_IMPACT_POINT>& vm = vArray[D + nbZ*m_nBinsTheta]; - std::cout<<"tau="<<(dTau*(-nbT+D))<<std::endl; - - for(std::vector<LAYER_IMPACT_POINT>::const_iterator lIt = vm.begin();lIt!= vm.end();++lIt) { - std::cout<<"L"<<(*lIt).m_layerId<<" l="<<(*lIt).m_L<<std::endl; - } - - const std::vector<LAYER_IMPACT_POINT>& vp = vArray[m_nBinsTheta-1-D + nbZ*m_nBinsTheta]; - std::cout<<"tau="<<(dTau*(nbT-D))<<std::endl; - - for(std::vector<LAYER_IMPACT_POINT>::const_iterator lIt = vp.begin();lIt!= vp.end();++lIt) { - std::cout<<"L"<<(*lIt).m_layerId<<" l="<<(*lIt).m_L<<std::endl; - } - */ - - // filling LUT structure - - m_pLUT = new TrigL2LayerSetLUT(m_maxZ0, tauMax, m_nBinsZ, m_nBinsTheta, nLmax); - - short* stack = new short[nLmax]; - - for(int i=-nbZ;i<=nbZ;i++) { - double z0 = i*dZ; - for(int j=-nbT;j<=nbT;j++) { - double tau = j*dTau; - int idx = (j+nbT) + (i+nbZ)*m_nBinsTheta; - const std::vector<LAYER_IMPACT_POINT>& v = vArray[idx]; - int k=0; - for(std::vector<LAYER_IMPACT_POINT>::const_iterator lIt = v.begin();lIt!= v.end();++lIt) { - stack[k++] = (*lIt).m_layerId; - } - for(;k<(int)nLmax;k++) stack[k]=999;//guard value - if(!m_pLUT->addSet(stack[0],z0,tau)) { - std::cout<<"cannot add z0="<<z0<<" tau="<<tau<<" to Layer LUT"<<std::endl; - } - } - } - - delete[] stack; - - delete[] vArray; - - //repeat quick test - /* - double z0 = 0.0; - double tau = 0.0; - - const short* pS = m_pLUT->getSet(z0,tau); - if(pS!=NULL) { - for(int i=0;i<m_pLUT->m_nLayers;i++) { - std::cout<<pS[i]<<" "; - } - std::cout<<std::endl; - } - - tau = dTau*(-nbT+D); - - pS = m_pLUT->getSet(z0,tau); - if(pS!=NULL) { - for(int i=0;i<m_pLUT->m_nLayers;i++) { - std::cout<<pS[i]<<" "; - } - std::cout<<std::endl; - } - - tau = dTau*(nbT-D); - - pS = m_pLUT->getSet(z0,tau); - if(pS!=NULL) { - for(int i=0;i<m_pLUT->m_nLayers;i++) { - std::cout<<pS[i]<<" "; - } - std::cout<<std::endl; - } - */ - return sc; -} diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.h b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.h deleted file mode 100644 index 0270d3c662a567ba38bba722cceb8ccf42619d43..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __TRIG_L2_LAYER_SET_PREDICTOR_TOOL_H__ -#define __TRIG_L2_LAYER_SET_PREDICTOR_TOOL_H__ - -#include "GaudiKernel/IAlgTool.h" -#include "TrigInDetRecoTools/ITrigL2LayerSetPredictorTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -//#include "GaudiKernel/ServiceHandle.h" - -//class TrigTimer; -//class IRegSelSvc; -class PixelID; -class SCT_ID; -class AtlasDetectorID; -class ITrigL2LayerNumberTool; - -namespace InDetDD { - class PixelDetectorManager; - class SCT_DetectorManager; -} - -typedef struct TrigL2LayerDescriptor { -public: -TrigL2LayerDescriptor(int t) : m_type(t), m_nElements(0), m_refCoordinate(0.0), - m_maxCoordinate(-10000.0), m_minCoordinate(10000.0) {}; - int m_type, m_nElements; - double m_refCoordinate, m_maxCoordinate, m_minCoordinate; -private: - TrigL2LayerDescriptor(){}; -} TRIG_L2_LAYER_DESCRIPTOR; - -typedef struct LayerImpactPoint { -public: - struct compare { - bool operator()(const struct LayerImpactPoint& p1, const struct LayerImpactPoint& p2) { - return (p1.m_L < p2.m_L); - } - }; -LayerImpactPoint(int lId, double l) : m_layerId(lId), m_L(l) {}; - int m_layerId; - double m_L; -private: -LayerImpactPoint() : m_layerId(-100), m_L(0.0){}; -} LAYER_IMPACT_POINT; - -class TrigL2LayerSetPredictorTool: public AthAlgTool, virtual public ITrigL2LayerSetPredictorTool { - - public: - TrigL2LayerSetPredictorTool(const std::string&, const std::string&, const IInterface* ); - virtual ~TrigL2LayerSetPredictorTool() {}; - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - virtual StatusCode createLUT(); - virtual const TrigL2LayerSetLUT* getLUT() {return m_pLUT;} - - private: - - //ServiceHandle<IRegSelSvc> m_regionSelector; - ToolHandle<ITrigL2LayerNumberTool> m_numberingTool; - TrigL2LayerSetLUT* m_pLUT; - - double m_maxEta, m_maxZ0; - int m_nBinsZ, m_nBinsTheta; - const PixelID* m_pixelId; - const SCT_ID* m_sctId; - const AtlasDetectorID* m_idHelper; - const InDetDD::PixelDetectorManager* m_pixelManager; - const InDetDD::SCT_DetectorManager* m_SCT_Manager; -}; - - - -#endif - - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyA.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyA.cxx deleted file mode 100644 index e914c43d0f3d5d90ee7a9f84a1300df35298c86b..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyA.cxx +++ /dev/null @@ -1,401 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//////////////////////////////////////////////////////////////////////////////// -// TrigL2PattRecoStrategyA -// ------------------------------- -// ATLAS Collaboration -// -// 15.04.2011 Package created -// -// Author: Ilektra A. Christidi, UCL -// e-mail: Electra.Christidi@cern.ch -// -// implements IDSCAN algorithm -// -//////////////////////////////////////////////////////////////////////////////// - -#include <cmath> -//#include <iostream> -//#include <list> -//#include "StoreGate/DataHandle.h" -#include "AthenaKernel/Timeout.h" - -#include "TrigInDetEvent/TrigInDetTrack.h" -#include "TrigInDetEvent/TrigInDetTrackCollection.h" -#include "TrigSteeringEvent/TrigRoiDescriptor.h" - -#include "TrigInDetRecoTools/ITrigL2PattRecoStrategy.h" - -#include "TrigTimeAlgs/TrigTimerSvc.h" - -#include "IRegionSelector/IRegSelSvc.h" -#include "TrigInDetRecoTools/TrigL2PattRecoStrategyA.h" - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "eformat/DetectorMask.h" -#include "TrigInDetToolInterfaces/ITrigRun1ZFinder.h" -#include "TrigInDetToolInterfaces/ITrigHitFilter.h" -#include "TrigInDetRecoTools/ITrigL2DupTrackRemovalTool.h" - -TrigL2PattRecoStrategyA::TrigL2PattRecoStrategyA(const std::string& t, - const std::string& n, - const IInterface* p ): - AthAlgTool(t,n,p), - m_regionSelector("RegSelSvc", n), - m_zFinder("IDScanZFinder",this), - m_findMultipleZ(false), - m_nZvertices(0), - m_hitFilter("IDScanHitFilter",this), - m_dupTrkRemoval("DupTrackRemovalTool",this) -{ - declareInterface< ITrigL2PattRecoStrategy >( this ); - - declareProperty( "AdjustLayerThreshold", m_adjustLayerThreshold = false ); - declareProperty( "DetMaskCheck", m_check_detector_mask = false); - declareProperty( "DetMaskCheckOnEvent", m_detector_mask_on_event = false); - declareProperty( "TrigZFinder", m_zFinder); - declareProperty( "ZFinderMode", m_zFinderMode = 0 ); - declareProperty( "FindMultipleZ", m_findMultipleZ = false ); - declareProperty( "TrueVertexLocation", m_TrueVertexLocation = "TrueTrigVertexColl" ); - declareProperty( "TrigHitFilter", m_hitFilter); - declareProperty( "DupTrackRemovalTool", m_dupTrkRemoval); - declareProperty( "UseBeamSpot", m_useBeamSpot = true); - declareProperty( "DoZF_Only", m_doZF_Only = false); -} - - -StatusCode TrigL2PattRecoStrategyA::initialize() -{ - StatusCode sc = AthAlgTool::initialize(); - MsgStream athenaLog(msgSvc(), name()); - - if ( m_adjustLayerThreshold ) { - athenaLog << MSG::INFO << "will adjust layer threshold depending on disabled modules" << endmsg; - sc = m_regionSelector.retrieve(); - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL<< "Unable to retrieve RegionSelector tool "<< m_regionSelector.type() << endmsg; - return sc; - } - } - - m_detector_mask_not_checked = m_check_detector_mask; - - m_hasPixelBLayer = true; - m_hasPixelBarrel = true; m_hasPixelDisk = true; - m_hasSCTBarrelA = true; m_hasSCTEndcapA = true; - m_hasSCTBarrelC = true; m_hasSCTEndcapC = true; - - /* - if(m_detector_mask_not_checked) { - const EventInfo* pEventInfo(0); - if ( evtStore()->retrieve(pEventInfo).isFailure() ) { - athenaLog << MSG::FATAL << "Failed to get EventInfo for detector mask info in BeginRun()" << endmsg; - return StatusCode::FAILURE; - } - setup_detector_mask(pEventInfo->event_ID()); - } - */ - if( m_zFinderMode ==1 ){ - athenaLog << MSG::WARNING << " You have chosen to use the MC z0 position!" << endmsg; - } - else { - sc = m_zFinder.retrieve(); - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL << "Unable to retrieve ZFinder " << m_zFinder << endmsg; - return StatusCode::FAILURE; - } - } - - if(m_doZF_Only) { - athenaLog << MSG::INFO << "ZFinder-only mode, HitFilter will not be run !"<< endmsg; - } - else { - athenaLog << MSG::INFO << "Normal mode, HitFilter will be run"<< endmsg; - } - - if (m_useBeamSpot) { - ATH_CHECK(m_beamSpotKey.initialize()); - } - - sc = m_hitFilter.retrieve(); - if ( sc.isFailure() ){ - athenaLog << MSG::FATAL << "Unable to retrieve HitFilter " << m_hitFilter <<endmsg; - return StatusCode::FAILURE; - } - - sc = m_dupTrkRemoval.retrieve(); - if ( sc.isFailure() ){ - athenaLog << MSG::FATAL << "Unable to retrieve DuplicateTrackRemovalTool " << m_dupTrkRemoval <<endmsg; - return StatusCode::FAILURE; - } - - ITrigTimerSvc* timerSvc; - sc = service( "TrigTimerSvc", timerSvc); - if( sc.isFailure() ) { - athenaLog << MSG::INFO<< "Unable to locate Service TrigTimerSvc " << endmsg; - m_timers = false; - } - else{ - m_timers = true; - } - if ( m_timers ) { - m_totalTimer = timerSvc->addItem("StrA_PattReco"); - m_ZFinderTimer = timerSvc->addItem("ZFinder"); - m_ZFinderTimer->propName("nSP"); - m_HitFilterTimer = timerSvc->addItem("HitFilter"); - m_HitFilterTimer->propName("nTracks"); - } - - athenaLog << MSG::INFO << "TrigL2PattRecoStrategyA initialized "<< endmsg; - return sc; -} - - -StatusCode TrigL2PattRecoStrategyA::finalize() { - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - - -TrigL2PattRecoStrategyA::~TrigL2PattRecoStrategyA() { - -} - - -HLT::ErrorCode TrigL2PattRecoStrategyA::findTracks(const std::vector<const TrigSiSpacePoint*>& vsp, - const IRoiDescriptor& roi, - TrigInDetTrackCollection* trackColl) { - - if ( m_timers ) m_totalTimer->start(); - - m_pattRecoTiming=0.0; - m_zVertices.clear(); - m_nZvertices=0; - int nHits = vsp.size(); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - if (outputLevel <= MSG::DEBUG) { - if ( roi.isFullscan() ) // || roi==nullptr) - athenaLog<< MSG::DEBUG<<"TrigL2PattRecoStrategyA called in FullScan mode "<<endmsg; - else - athenaLog<< MSG::DEBUG<<"TrigL2PattRecoStrategyA called in RoI-based mode "<<endmsg; - } - - // 1. z-finder - /* - double zfPhiWidth = m_zFinder->RoI_PhiWidth(); - if(fabs(zfPhiWidth - 2.0*(roi.phiHalfWidth()))>0.0001) - { - athenaLog << MSG::WARNING << "ZFinder ROIPhiWidth does not match input RoI phiHalfWidth"<<endmsg; - athenaLog << MSG::WARNING << "ZFinder ROIPhiWidth = "<<zfPhiWidth<<endmsg; - athenaLog << MSG::WARNING << "Input RoI phiHalfWidth x 2 = "<<2.0*(roi.phiHalfWidth())<<endmsg; - athenaLog << MSG::WARNING << "Wrong instance configuration - quitting"<<endmsg; - return HLT::BAD_JOB_SETUP; - }*/ - //unsigned int zVertexFailOrSucceed=0; - TrigVertexCollection* zTrueVertexColl=NULL; - - if ( m_timers ) m_ZFinderTimer->start(); - if ( m_zFinderMode == 1 ){ // true Z - if ( evtStore()->retrieve(zTrueVertexColl, m_TrueVertexLocation).isFailure() ) { - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << "Failed to get trueZvCollection" << endmsg; - m_nZvertices = 0; - } - else { - TrigVertex* trueVertex = zTrueVertexColl->front(); - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << " True z position " << (trueVertex->position()).z() << endmsg; - m_nZvertices = 1; - m_zVertices.push_back((trueVertex->position()).z()); - } - } - else { - /*if(m_doShift) - // zVertexColl = m_zFinder->findZ( spacePoints->spVec(), roi ); - zVertexColl = m_zFinder->findZ( m_shifterTool->spVec(), roi ); - else - zVertexColl = m_zFinder->findZ( commonSPs, roi );*/ - TrigVertexCollection* zVertexColl = m_zFinder->findZ( vsp,roi ); - if ( zVertexColl ) { - for(TrigVertexCollection::iterator ivx=zVertexColl->begin(); ivx != zVertexColl->end(); ivx++) - m_zVertices.push_back( (*ivx)->position().z() ); - m_nZvertices = m_zVertices.size(); - delete zVertexColl; - } - } - - if ( m_timers ) { - m_ZFinderTimer->propVal( nHits ); - m_ZFinderTimer->stop(); - } - - if (m_nZvertices==0) { - m_zVertices.push_back(-9999.0); - if ( m_timers ) { - m_totalTimer->stop(); - m_pattRecoTiming=m_totalTimer->elapsed(); - } - return HLT::OK; - } - - if(m_doZF_Only) { - trackColl->clear(); - if ( m_timers ) { - m_totalTimer->stop(); - m_pattRecoTiming=m_totalTimer->elapsed(); - } - return HLT::OK; - } - - // 2. Event information, masking update - // get the run and event no. - const EventInfo* pEventInfo; - unsigned int IdRun=0; - unsigned int IdEvent=0; - if ( evtStore()->retrieve(pEventInfo).isFailure() ) { - if(m_detector_mask_not_checked && m_detector_mask_on_event) { - athenaLog << MSG::ERROR << "Could not find EventInfo object for detector mask info" << endmsg; - return HLT::SG_ERROR; - } - // if we are not interested in the detector mask, this is a minor problem. - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << "Failed to get EventInfo " << endmsg; - } - else { - IdRun = pEventInfo->event_ID()->run_number(); - IdEvent = pEventInfo->event_ID()->event_number(); - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << " Run " << IdRun << " Event " << IdEvent << endmsg; - if(m_detector_mask_not_checked && m_detector_mask_on_event) - setup_detector_mask(pEventInfo->event_ID()); - } - - // Extract the beamspot shift - double shiftx(0), shifty(0); - if (m_useBeamSpot) { - SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; - const Amg::Vector3D &vertex = beamSpotHandle->beamPos(); - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << "Beam spot position " << vertex << endmsg; - double xVTX = vertex.x(); - double yVTX = vertex.y(); - double zVTX = vertex.z(); - double tiltXZ = beamSpotHandle->beamTilt(0); - double tiltYZ = beamSpotHandle->beamTilt(1); - shiftx = xVTX - tiltXZ*zVTX;//correction for tilt - shifty = yVTX - tiltYZ*zVTX;//correction for tilt - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << "Center position: " << shiftx <<" "<< shifty << endmsg; - } - - // 4. HitFilter - if ( m_timers ) m_HitFilterTimer->start(); - std::vector<unsigned int> placeHolder; - for ( int iz=0; iz<m_nZvertices; ++iz ) { - double zPosition = m_zVertices[iz]; - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << "REGTEST / z found = " << zPosition << endmsg; - /*if(m_doShift) { - //m_hitFilter->findTracks( spacePoints->spVec(), *m_recoTracks, roi, zPosition, spacePoints->get_xshift()); - m_hitFilter->findTracks( m_shifterTool->spVec(), *m_recoTracks, roi, zPosition, - m_shifterTool->get_xshift(), 0, missing_layers ); - } - else{ */ - //m_hitFilter->findTracks(vsp, *m_recoTracks, &roi, zPosition, shiftx, shifty, missing_layers ); - m_hitFilter->findTracks(vsp, *trackColl, &roi, zPosition, shiftx, shifty, 0); - placeHolder.push_back(trackColl->size()); - if ( !trackColl->empty() && m_findMultipleZ == false ) break; - } - if ( m_timers ) { - m_HitFilterTimer->propVal( trackColl->size() ); - m_HitFilterTimer->stop(); - } - - // protection against timeouts - if (Athena::Timeout::instance().reached()) { - if(outputLevel<=MSG::DEBUG) - athenaLog << MSG::DEBUG << "Timeout reached. Aborting sequence." << endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::TIMEOUT); - } - - if ( trackColl->empty() ) - { - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << "REGTEST / No groups found - No tracks reconstructed" << endmsg; - } - else - { - //m_currentStage = 5; - //monitor number of tracks - //m_ntracks=m_recoTracks->size(); - if (outputLevel <= MSG::DEBUG) athenaLog << MSG::DEBUG << "REGTEST / Made " << trackColl->size() << " IdScanGroups" << endmsg; - //m_countRoIwithGroups[zVertexFailOrSucceed]++; - - //Deleting duplicate tracks from multiple z vertices - m_dupTrkRemoval->removeDupTracks(trackColl,placeHolder); - for(TrigInDetTrackCollection::iterator it = trackColl->begin(); it!=trackColl->end();++it) { - (*it)->algorithmId(TrigInDetTrack::STRATEGY_A_ID); - } - } - - if ( m_timers ) { - m_totalTimer->stop(); - m_pattRecoTiming=m_totalTimer->elapsed(); - } - - return HLT::OK; -} - - -HLT::ErrorCode TrigL2PattRecoStrategyA::findTracks(const std::vector<const TrigSiSpacePoint*>& vsp, - TrigInDetTrackCollection* trackColl) { - - findTracks(vsp, TrigRoiDescriptor(true), trackColl); - - return HLT::OK; - -} - - - -void TrigL2PattRecoStrategyA::setup_detector_mask(const EventID* eventId) { - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - uint64_t dmask = eventId->detector_mask(); - - if(outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG << "Retrieved the detector mask = 0x" - << MSG::hex << dmask << MSG::dec << endmsg; - } - - if( dmask==0 ) { - if(outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG << "detector mask == 0: do nothing!" << endmsg; - } - return; - } - - eformat::helper::DetectorMask dm(dmask); - m_hasPixelBLayer = dm.is_set(eformat::PIXEL_B_LAYER); - m_hasPixelBarrel = dm.is_set(eformat::PIXEL_BARREL); - m_hasPixelDisk = dm.is_set(eformat::PIXEL_DISK); - m_hasSCTBarrelA = dm.is_set(eformat::SCT_BARREL_A_SIDE); - m_hasSCTBarrelC = dm.is_set(eformat::SCT_BARREL_C_SIDE); - m_hasSCTEndcapA = dm.is_set(eformat::SCT_ENDCAP_A_SIDE); - m_hasSCTEndcapC = dm.is_set(eformat::SCT_ENDCAP_C_SIDE); - - if(outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG << " ==== Detector Mask settings ==== " << endmsg; - athenaLog << MSG::DEBUG << " ---> Pixel B-Layer: " << ((m_hasPixelBLayer)? "ON" : "OFF") << endmsg; - athenaLog << MSG::DEBUG << " ---> Pixel Barrel: " << ((m_hasPixelBarrel)? "ON" : "OFF") << endmsg; - athenaLog << MSG::DEBUG << " ---> Pixel Disk: " << ((m_hasPixelDisk) ? "ON" : "OFF") << endmsg; - athenaLog << MSG::DEBUG << " ---> SCT Barrel side A: " << ((m_hasSCTBarrelA)? "ON" : "OFF") << endmsg; - athenaLog << MSG::DEBUG << " ---> SCT Barrel side C: " << ((m_hasSCTBarrelC)? "ON" : "OFF") << endmsg; - athenaLog << MSG::DEBUG << " ---> SCT Endcap side A: " << ((m_hasSCTEndcapA)? "ON" : "OFF") << endmsg; - athenaLog << MSG::DEBUG << " ---> SCT Endcap side C: " << ((m_hasSCTEndcapC)? "ON" : "OFF") << endmsg; - } - - if (!m_detector_mask_on_event) m_detector_mask_not_checked = false; -} - - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyB.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyB.cxx deleted file mode 100644 index 51651bbc557f7f8b4b33251098d1d4bc8c9edcdc..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyB.cxx +++ /dev/null @@ -1,2850 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//////////////////////////////////////////////////////////////////////////////// -// TrigL2PattRecoStrategyB -// ------------------------------- -// ATLAS Collaboration -// -// 16.01.2011 Package created -// -// Author: Andrea Coccaro -// e-mail: Andrea.Coccaro AT cern.ch -// -// implements SiTrack algorithm -// -//////////////////////////////////////////////////////////////////////////////// - -#include <cmath> -#include <iostream> -#include <list> -#include <algorithm> -#include <iterator> - -#include "TrigInDetEvent/TrigInDetTrack.h" -#include "TrigInDetEvent/TrigInDetTrackCollection.h" - -#include "TrigInDetRecoTools/ITrigL2PattRecoStrategy.h" - -#include "TrigSteeringEvent/TrigRoiDescriptor.h" - -//#include "SiSpacePoint/SCT_SpacePoint.h" -//#include "SiSpacePoint/PixelSpacePoint.h" - -//#include "InDetIdentifier/PixelID.h" -//#include "InDetIdentifier/SCT_ID.h" - -#include "IRegionSelector/IRegSelSvc.h" -#include "TrigInDetRecoTools/TrigL2PattRecoStrategyB.h" - -#include "AthenaKernel/Timeout.h" -#include "TrigTimeAlgs/TrigTimerSvc.h" - -/** static members **/ -StrBTrk* TrigL2PattRecoStrategyB::m_trks=0; -StrBTrack* TrigL2PattRecoStrategyB::m_full_trks=0; - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -TrigL2PattRecoStrategyB::TrigL2PattRecoStrategyB(const std::string& t, const std::string& n, const IInterface* p) : - AthAlgTool(t,n,p), - m_regionSelector("RegSelSvc", n), - m_numberingTool("TrigL2LayerNumberTool") -{ - declareInterface< ITrigL2PattRecoStrategy >( this ); - - /** Layer properties. */ - declareProperty("Map_LayerOneMultiplicity", m_mapLayerOneMultiplicity = 2); - declareProperty("Map_LayerTwoMultiplicity", m_mapLayerTwoMultiplicity = 2); - declareProperty("Map_ForcedInefficientLayers", m_mapForcedInefficientLayers); - declareProperty("Map_ForcedTurnedOffLayers", m_mapForcedTurnedOffLayers); - declareProperty("Map_MaxLayerFailureFraction", m_mapMaxLayerFailureFraction = 0.001); - declareProperty("Map_MaxTotalFailureFraction", m_mapMaxTotalFailureFraction = 0.00001); - - /** New cut properties*/ - declareProperty("Reco_NewCuts", m_newCuts = false); - declareProperty("Reco_NewCutsRZ", m_newCutsRZ = false); - declareProperty("Reco_PtMinSeedDiff", m_recoPtMinSeedDiff = 0.0); - declareProperty("Reco_D0MaxSeedDiff", m_recoD0MaxSeedDiff = 2.0); - declareProperty("Reco_PtMinTripletDiff", m_recoPtMinTripletDiff = 0.0); - declareProperty("Reco_D0MaxTripletDiff", m_recoD0MaxTripletDiff = 1.0); - declareProperty("Reco_PtMin", m_recoPtMin = 1000.0); - declareProperty("Reco_D0Max", m_recoD0Max = 3.0); - declareProperty("Reco_TimingFactor", m_recoTimingFactor = 3.0); - declareProperty("Reco_AlignmentScaling", m_recoAlignmentScaling = 1.0); - declareProperty("Reco_OutlierRemoval", m_recoOutlierRemoval = false); - declareProperty("Reco_OutlierRemovalCut", m_recoOutlierRemovalCut = 0.9); - declareProperty("Reco_OutlierRemovalLayers", m_recoOutlierRemovalLayers = 4); - declareProperty("Reco_OutlierRemovalD0", m_recoOutlierRemovalD0 = 0.005); - declareProperty("Reco_OutlierRemovalPt", m_recoOutlierRemovalPt = 40); - declareProperty("Reco_MaxSeeds", m_recoMaxSeeds = 30000); - declareProperty("Reco_MaxTracks", m_recoMaxTracks = 3000); - declareProperty("Reco_Z0Bin", m_recoZ0Bin = 20); - declareProperty("Reco_EtaBin", m_recoEtaBin = 0.1); - - /** Preliminary vertexing properties. */ - declareProperty("PreVertexing_Enable", m_preVertexingEnable = false); - declareProperty("PreVertexing_VtxName", m_preVertexingVtxName = "TrueTrigVertexColl"); - declareProperty("PreVertexing_ZCut", m_preVertexingZCut = 5); - - /** Seeding properties. */ - declareProperty("Seeding_PreCutRZ", m_seedingPreCutRZ = 10000); - declareProperty("Seeding_PreCutPhi", m_seedingPreCutPhi = 3.15); - declareProperty("Seeding_PreCutRPhi", m_seedingPreCutRPhi = 0.001); - declareProperty("Seeding_CutRZ", m_seedingCutRZ = 1.5); - - /** Vertexing properties. */ - declareProperty("Vertexing_Enable", m_vertexingEnable = false); - declareProperty("Vertexing_CutRPhi", m_vertexingCutRPhi = 0.00025); - //declareProperty("Vertexing_CutRZ", m_vertexingCutRZ = 1000); - m_vertexingCutRZ = 1000; - declareProperty("Vertexing_MaxVertices", m_vertexingMaxVertices = 3); - declareProperty("Vertexing_WindowSize", m_vertexingWindowSize = 2.0); - declareProperty("Vertexing_WindowSegments", m_vertexingWindowSegments = 4); - - /** Extension properties. */ - declareProperty("Extension_PreCutRZ", m_extensionPreCutRZ = 10000); - declareProperty("Extension_PreCutPhi", m_extensionPreCutPhi = 3.15); - declareProperty("Extension_PreCutRPhi", m_extensionPreCutRPhi = 0.0006); - declareProperty("Extension_PreCutRPhiDiff", m_extensionPreCutRPhiDiff = 0.0006); - declareProperty("Extension_CutRZPixel", m_extensionCutRZPixel = 0.8); - declareProperty("Extension_CutRZ", m_extensionCutRZ = 4.5); - declareProperty("Extension_CutRPhi", m_extensionCutRPhi = 0.0035); - declareProperty("Extension_CutSpacePoints", m_extensionCutSpacePoints = 4); - declareProperty("Extension_CutSpacePointsMiss1", m_extensionCutSpacePointsMiss1 = 4); - declareProperty("Extension_CutSpacePointsMiss2", m_extensionCutSpacePointsMiss2 = 4); - declareProperty("Extension_SolveTriplets", m_extensionSolveTriplets = true); - declareProperty("Extension_SolveTripletsDRCut", m_extensionSolveTripletsDRCut = 9.0); - declareProperty("Extension_SolveTripletsPhiScale", m_extensionSolveTripletsPhiScale = 0.0006); - declareProperty("Extension_SolveTripletsEtaScale", m_extensionSolveTripletsEtaScale = 0.0022); - declareProperty("Extension_SolveTracks", m_extensionSolveTracks = true); - declareProperty("Extension_SolveV0Tracks", m_extensionSolveV0Tracks = true); - declareProperty("Extension_SolveTracksDRCut", m_extensionSolveTracksDRCut = 9.0); - declareProperty("Extension_SolveTracksPhiScale", m_extensionSolveTracksPhiScale = 0.0006); - declareProperty("Extension_SolveTracksEtaScale", m_extensionSolveTracksEtaScale = 0.0022); - declareProperty("Extension_SolveShared", m_extensionSolveShared = true); - declareProperty("Extension_MaxMissingLayers", m_extensionMaxMissingLayers = 20); - declareProperty("Extension_Refit", m_extensionRefit = true); - declareProperty("Extension_SpacePoints", m_extensionSpacePoints = 5); - declareProperty("Extension_SpacePointsMiss1", m_extensionSpacePointsMiss1 = 5); - declareProperty("Extension_SpacePointsMiss2", m_extensionSpacePointsMiss2 = 5); - declareProperty("Extension_TRTExtension", m_extensionTRTExtension = true); - - /** Debug properties. */ - declareProperty("Debug_Tuning", m_debugTuning = false); - declareProperty("Debug_TuningGoodSeeds", m_debugTuningGoodSeeds = false); - declareProperty("Debug_TuningBadSeeds", m_debugTuningBadSeeds = false); - declareProperty("Debug_TuningGoodTriplets", m_debugTuningGoodTriplets = false); - declareProperty("Debug_TuningBadTriplets", m_debugTuningBadTriplets = false); - -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -StatusCode TrigL2PattRecoStrategyB::initialize() { - - StatusCode sc = AthAlgTool::initialize(); - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - sc = m_numberingTool.retrieve(); - if (sc.isFailure()) { - athenaLog << MSG::FATAL << "Tool " << m_numberingTool << " not found " << endmsg; - return sc; - } - m_laySctB = m_numberingTool->offsetBarrelSCT(); - m_layPixEC = m_numberingTool->offsetEndcapPixels(); - m_laySctEC = m_numberingTool->offsetEndcapSCT(); - m_layMax = m_numberingTool->maxSiliconLayerNum(); - StrBTrack::setMaxLay(m_layMax); - - athenaLog << MSG::INFO << "set m_layMax to " << m_layMax << endmsg; - athenaLog << MSG::INFO << "set m_laySctB to " << m_laySctB << endmsg; - - sc = m_regionSelector.retrieve(); - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL << "Unable to retrieve RegionSelector tool " << m_regionSelector.type() << endmsg; - return sc; - } - - //Set vertexing RZ cut to max z-width of fullscan RoI - TrigRoiDescriptor fs_roi(true); - m_vertexingCutRZ = fs_roi.zedPlus() + 30;//z-width should be symmetric - - - /************************************/ - /** FILL LAYERS *********************/ - /************************************/ - - /** Define geometry. */ - m_geoR = new float[19]; m_geoRmin = new float[19]; m_geoRmax = new float[19]; - m_geoZ = new float[19]; m_geoZmin = new float[19]; m_geoZmax = new float[19]; - - m_geoR[0] =50.5; m_geoZmin[0] =-405; m_geoZmax[0]=405; - m_geoR[1] =88.5; m_geoZmin[1] =-405; m_geoZmax[1]=405; - m_geoR[2] =122.5; m_geoZmin[2] =-405; m_geoZmax[2]=405; - m_geoR[3] =299; m_geoZmin[3] =-755; m_geoZmax[3]=755; - m_geoR[4] =371; m_geoZmin[4] =-755; m_geoZmax[4]=755; - m_geoR[5] =443; m_geoZmin[5] =-755; m_geoZmax[5]=755; - m_geoR[6] =514; m_geoZmin[6] =-755; m_geoZmax[6]=755; - - m_geoZ[7] =496; m_geoRmin[7] =88; m_geoRmax[7] =185; - m_geoZ[8] =581; m_geoRmin[8] =88; m_geoRmax[8] =185; - m_geoZ[9] =651; m_geoRmin[9] =88; m_geoRmax[9] =185; - m_geoZ[10]=861.5; m_geoRmin[10]=330; m_geoRmax[10]=565; - m_geoZ[11]=940; m_geoRmin[11]=270; m_geoRmax[11]=565; - m_geoZ[12]=1098.5; m_geoRmin[12]=270; m_geoRmax[12]=565; - m_geoZ[13]=1306; m_geoRmin[13]=270; m_geoRmax[13]=565; - m_geoZ[14]=1408; m_geoRmin[14]=270; m_geoRmax[14]=565; - m_geoZ[15]=1778; m_geoRmin[15]=270; m_geoRmax[15]=565; - m_geoZ[16]=2122.5; m_geoRmin[16]=330; m_geoRmax[16]=565; - m_geoZ[17]=2511.5; m_geoRmin[17]=400; m_geoRmax[17]=565; - m_geoZ[18]=2742.5; m_geoRmin[18]=430; m_geoRmax[18]=565; - - - /** Fill layer groups. */ - std::list<int> gr1,gr2,gr3,gr4,gr5,gr6,gr7,gr8,gr9; // layer groups as a function of eta - - if(m_layMax==19) { - - /* Group definitions - gr1: eta<1 0 1 2 3 4 5 6 - gr2: 1<=eta<1.5 0 1 2 3 4 5 6 10 11 12 13 - gr3: 1.5<=eta<1.7 0 1 2 3 4 5 7 10 12 12 13 14 - gr4: 1.7<=eta<1.8 0 1 2 3 4 7 10 11 12 13 14 15 - gr5: 1.8<=eta<1.9 0 1 2 3 7 8 11 12 13 14 15 16 - gr6: 1.9<=eta<2.1 0 1 2 3 7 8 9 11 12 13 14 15 16 17 - gr7: 2.1<=eta<2.2 0 1 2 7 8 9 11 12 13 14 15 16 17 - gr8: 2.2<=eta<2.4 0 1 2 7 8 9 13 14 15 16 17 18 - gr9: eta>=2.4 0 9 15 16 17 18 - */ - - gr1.push_back(0); gr1.push_back(1); gr1.push_back(2); gr1.push_back(3); gr1.push_back(4); gr1.push_back(5); gr1.push_back(6); - - gr2.push_back(0); gr2.push_back(1); gr2.push_back(2); gr2.push_back(3); gr2.push_back(4); gr2.push_back(5); gr2.push_back(6); - gr2.push_back(10); gr2.push_back(11); gr2.push_back(12); gr2.push_back(13); - - gr3.push_back(0); gr3.push_back(7); gr3.push_back(1); gr3.push_back(2); - gr3.push_back(3); gr3.push_back(4); gr3.push_back(5); gr3.push_back(10); gr3.push_back(11); gr3.push_back(12); gr3.push_back(13); gr3.push_back(14); - - gr4.push_back(0); gr4.push_back(7); gr4.push_back(1); gr4.push_back(2); - gr4.push_back(3); gr4.push_back(4); gr4.push_back(10); gr4.push_back(11); gr4.push_back(12); gr4.push_back(13); gr4.push_back(14); gr4.push_back(15); - - gr5.push_back(0); gr5.push_back(7); gr5.push_back(1); gr5.push_back(8); gr5.push_back(2); - gr5.push_back(3); gr5.push_back(11); gr5.push_back(12); gr5.push_back(13); gr5.push_back(14); gr5.push_back(15); gr5.push_back(16); - - gr6.push_back(0); gr6.push_back(7); gr6.push_back(1); gr6.push_back(8); gr6.push_back(2); gr6.push_back(9); - gr6.push_back(3); gr6.push_back(11); gr6.push_back(12); gr6.push_back(13); gr6.push_back(14); gr6.push_back(15); gr6.push_back(16); gr6.push_back(17); - - gr7.push_back(0); gr7.push_back(7); gr7.push_back(1); gr7.push_back(8); gr7.push_back(2); gr7.push_back(9); - gr7.push_back(11); gr7.push_back(12); gr7.push_back(13); gr7.push_back(14); gr7.push_back(15); gr7.push_back(16); gr7.push_back(17); - - gr8.push_back(0); gr8.push_back(7); gr8.push_back(1); gr8.push_back(8); gr8.push_back(2); gr8.push_back(9); - gr8.push_back(13); gr8.push_back(14); gr8.push_back(15); gr8.push_back(16); gr8.push_back(17); gr8.push_back(18); - - gr9.push_back(0); gr9.push_back(9); - gr9.push_back(15); gr9.push_back(16); gr9.push_back(17); gr9.push_back(18); - - } else { - - /* Group definitions - gr1: eta<1 0 1 2 3 4 5 6 7 - gr2: 1<=eta<1.5 0 1 2 3 4 5 6 7 11 12 13 14 - gr3: 1.5<=eta<1.7 0 1 2 3 4 5 6 8 11 12 13 14 15 - gr4: 1.7<=eta<1.8 0 1 2 3 4 5 8 11 12 13 14 15 16 - gr5: 1.8<=eta<1.9 0 1 2 3 4 8 9 12 13 14 15 16 17 - gr6: 1.9<=eta<2.1 0 1 2 3 4 8 9 10 12 13 14 15 16 17 18 - gr7: 2.1<=eta<2.2 0 1 2 3 8 9 10 12 13 14 15 16 17 18 - gr8: 2.2<=eta<2.4 0 1 2 3 8 9 10 14 15 16 17 18 19 - gr9: eta>=2.4 0 1 10 16 17 18 19 - */ - - gr1.push_back(0); gr1.push_back(1); gr1.push_back(2); gr1.push_back(3); gr1.push_back(4); gr1.push_back(5); gr1.push_back(6); gr1.push_back(7); - - gr2.push_back(0); gr2.push_back(1); gr2.push_back(2); gr2.push_back(3); gr2.push_back(4); gr2.push_back(5); gr2.push_back(6); gr2.push_back(7); - gr2.push_back(11); gr2.push_back(12); gr2.push_back(13); gr2.push_back(14); - - gr3.push_back(0); gr3.push_back(1); gr3.push_back(8); gr3.push_back(2); gr3.push_back(3); - gr3.push_back(4); gr3.push_back(5); gr3.push_back(6); gr3.push_back(11); gr3.push_back(12); gr3.push_back(13); gr3.push_back(14); gr3.push_back(15); - - gr4.push_back(0); gr4.push_back(1); gr4.push_back(8); gr4.push_back(2); gr4.push_back(3); - gr4.push_back(4); gr4.push_back(5); gr4.push_back(11); gr4.push_back(12); gr4.push_back(13); gr4.push_back(14); gr4.push_back(15); gr4.push_back(16); - - gr5.push_back(0); gr5.push_back(1); gr5.push_back(8); gr5.push_back(2); gr5.push_back(9); gr5.push_back(3); - gr5.push_back(4); gr5.push_back(12); gr5.push_back(13); gr5.push_back(14); gr5.push_back(15); gr5.push_back(16); gr5.push_back(17); - - gr6.push_back(0); gr6.push_back(1); gr6.push_back(8); gr6.push_back(2); gr6.push_back(9); gr6.push_back(3); gr6.push_back(10); - gr6.push_back(4); gr6.push_back(12); gr6.push_back(13); gr6.push_back(14); gr6.push_back(15); gr6.push_back(16); gr6.push_back(17); gr6.push_back(18); - - gr7.push_back(0); gr7.push_back(1); gr7.push_back(8); gr7.push_back(2); gr7.push_back(9); gr7.push_back(3); gr7.push_back(10); - gr7.push_back(12); gr7.push_back(13); gr7.push_back(14); gr7.push_back(15); gr7.push_back(16); gr7.push_back(17); gr7.push_back(18); - - gr8.push_back(0); gr8.push_back(1); gr8.push_back(8); gr8.push_back(2); gr8.push_back(9); gr8.push_back(3); gr8.push_back(10); - gr8.push_back(14); gr8.push_back(15); gr8.push_back(16); gr8.push_back(17); gr8.push_back(18); gr8.push_back(19); - - gr9.push_back(0); gr9.push_back(1); gr9.push_back(10); - gr9.push_back(16); gr9.push_back(17); gr9.push_back(18); gr9.push_back(19); - - } - - - /** Vector of groups (from 0 -> 8). */ - m_layerGroups.push_back(gr1); - m_layerGroups.push_back(gr2); - m_layerGroups.push_back(gr3); - m_layerGroups.push_back(gr4); - m_layerGroups.push_back(gr5); - m_layerGroups.push_back(gr6); - m_layerGroups.push_back(gr7); - m_layerGroups.push_back(gr8); - m_layerGroups.push_back(gr9); - - /* Save content of Failure/Remove lists from vector to set */ - std::vector<int>::iterator it; - for(it=m_mapForcedInefficientLayers.begin();it!=m_mapForcedInefficientLayers.end();it++){ - m_mapSetLayersFailure.insert(*it); - } - for(it=m_mapForcedTurnedOffLayers.begin();it!=m_mapForcedTurnedOffLayers.end();it++){ - m_mapSetLayersRemove.insert(*it); - } - - /* Initialize sp triplet container array to zero */ - m_spTriplet=0; - - - /************************************/ - /** SETUP PT-DEPENDENT CUTS *********/ - /************************************/ - - m_dynamicalSeedingPreCutRZ = m_seedingPreCutRZ; - m_dynamicalSeedingPreCutPhi = m_seedingPreCutPhi; - m_dynamicalSeedingPreCutRPhi = m_seedingPreCutRPhi; - m_dynamicalSeedingCutRZ = m_seedingCutRZ; - m_dynamicalExtensionPreCutRZ = m_extensionPreCutRZ; - m_dynamicalExtensionPreCutPhi = m_extensionPreCutPhi; - m_dynamicalExtensionPreCutRPhi = m_extensionPreCutRPhi; - m_dynamicalExtensionPreCutRPhiDiff = m_extensionPreCutRPhiDiff; - m_dynamicalExtensionCutRZPixel = m_extensionCutRZPixel; - m_dynamicalExtensionCutRZ = m_extensionCutRZ; - m_dynamicalExtensionCutRPhi = m_extensionCutRPhi; - - double extensionPtMin = m_recoPtMin + m_recoPtMinTripletDiff; - - if(extensionPtMin<2000.0 && extensionPtMin>0.1) { - m_dynamicalExtensionPreCutRPhi = m_extensionPreCutRPhi * (2000.0/extensionPtMin); - m_dynamicalExtensionPreCutRPhiDiff = m_extensionPreCutRPhiDiff * (2000.0/extensionPtMin); - m_dynamicalExtensionCutRPhi = m_extensionCutRPhi * (2000.0/extensionPtMin); - } - - if(extensionPtMin<1000.0 && extensionPtMin>0.1) { - m_dynamicalExtensionCutRZ = m_extensionCutRZ * (1000.0/extensionPtMin); - } - - - /************************************/ - /** SETUP TRACK DATA ****************/ - /************************************/ - - /** Create pre-dimensioned arrays for data structures. */ - m_trks_num = 0; - if(m_trks==0) m_trks = new StrBTrk[m_recoMaxSeeds]; - - m_full_trks_num = 0; - if(m_full_trks==0) m_full_trks = new StrBTrack[m_recoMaxTracks]; - - - /************************************/ - /** SETUP VERTEXING *****************/ - /************************************/ - - /** Create fine vertexing histogram. */ - if(m_vertexingEnable) { - m_vtxMaxBin = (int)ceil(2*m_vertexingCutRZ/(m_vertexingWindowSize/m_vertexingWindowSegments)); - m_vtxHisto = new int[m_vtxMaxBin]; - if(!m_vtxHisto) { - athenaLog << MSG::FATAL << "could not create Z vertexing histogram" << endmsg; - return StatusCode::FAILURE; - } - } - - - /************************************/ - /** SETUP TUNING ********************/ - /************************************/ - - /** Relax cuts. **/ - if(m_debugTuning) { - m_dynamicalSeedingPreCutRZ = 10000; - m_dynamicalSeedingPreCutPhi *= 3; - m_dynamicalSeedingPreCutRPhi = 10000; - m_dynamicalSeedingCutRZ = 10000; - m_dynamicalExtensionPreCutRZ = 10000; - m_dynamicalExtensionPreCutPhi *= 3; - m_dynamicalExtensionPreCutRPhi = 10000; - m_dynamicalExtensionPreCutRPhiDiff = 10000; - m_dynamicalExtensionCutRZPixel = 10000; - m_dynamicalExtensionCutRZ = 10000; - m_dynamicalExtensionCutRPhi = 10000; - } - - ITrigTimerSvc* timerSvc; - StatusCode scTime = service( "TrigTimerSvc", timerSvc); - if( scTime.isFailure() ) { - athenaLog << MSG::INFO << "Unable to locate Service TrigTimerSvc" << endmsg; - m_timers = false; - } - else{ - m_timers = true; - } - if ( m_timers ) { - m_timer[0] = timerSvc->addItem("StrB_PattReco"); - } - - - /************************************/ - /** PROPERTY REVIEW *****************/ - /************************************/ - - if (outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG << "declareProperty review:" << endmsg; - - /** Layer properties. */ - athenaLog << MSG::DEBUG << "Map_LayerOneMultiplicity = " << m_mapLayerOneMultiplicity << endmsg; - athenaLog << MSG::DEBUG << "Map_LayerTwoMultiplicity = " << m_mapLayerTwoMultiplicity << endmsg; - athenaLog << MSG::DEBUG << "Map_ForcedInefficientLayers = " << m_mapForcedInefficientLayers << endmsg; - athenaLog << MSG::DEBUG << "Map_ForcedTurnedOffLayers = " << m_mapForcedTurnedOffLayers << endmsg; - athenaLog << MSG::DEBUG << "Map_MaxLayerFailureFraction = " << m_mapMaxLayerFailureFraction << endmsg; - athenaLog << MSG::DEBUG << "Map_MaxTotalFailureFraction = " << m_mapMaxTotalFailureFraction << endmsg; - - /** New cut properties*/ - athenaLog << MSG::DEBUG << "Reco_NewCuts = " << m_newCuts << endmsg; - athenaLog << MSG::DEBUG << "Reco_NewCutsRZ = " << m_newCutsRZ << endmsg; - athenaLog << MSG::DEBUG << "Reco_PtMinSeedDiff = " << m_recoPtMinSeedDiff << endmsg; - athenaLog << MSG::DEBUG << "Reco_D0MaxSeedDiff = " << m_recoD0MaxSeedDiff << endmsg; - athenaLog << MSG::DEBUG << "Reco_PtMinTripletDiff = " << m_recoPtMinTripletDiff << endmsg; - athenaLog << MSG::DEBUG << "Reco_D0MaxTripletDiff = " << m_recoD0MaxTripletDiff << endmsg; - athenaLog << MSG::DEBUG << "Reco_PtMin = " << m_recoPtMin << endmsg; - athenaLog << MSG::DEBUG << "Reco_D0Max = " << m_recoD0Max << endmsg; - athenaLog << MSG::DEBUG << "Reco_TimingFactor = " << m_recoTimingFactor << endmsg; - athenaLog << MSG::DEBUG << "Reco_AlignmentScaling = " << m_recoAlignmentScaling << endmsg; - athenaLog << MSG::DEBUG << "Reco_OutlierRemoval = " << m_recoOutlierRemoval << endmsg; - athenaLog << MSG::DEBUG << "Reco_OutlierRemovalCut = " << m_recoOutlierRemovalCut << endmsg; - athenaLog << MSG::DEBUG << "Reco_OutlierRemovalLayers = " << m_recoOutlierRemovalLayers << endmsg; - athenaLog << MSG::DEBUG << "Reco_OutlierRemovalD0 = " << m_recoOutlierRemovalD0 << endmsg; - athenaLog << MSG::DEBUG << "Reco_OutlierRemovalPt = " << m_recoOutlierRemovalPt << endmsg; - athenaLog << MSG::DEBUG << "Reco_MaxSeeds = " << m_recoMaxSeeds << endmsg; - athenaLog << MSG::DEBUG << "Reco_MaxTracks = " << m_recoMaxTracks << endmsg; - athenaLog << MSG::DEBUG << "Reco_Z0Bin = " << m_recoZ0Bin << endmsg; - athenaLog << MSG::DEBUG << "Reco_EtaBin = " << m_recoEtaBin << endmsg; - - /** Preliminary vertexing properties. */ - athenaLog << MSG::DEBUG << "PreVertexing_Enable = " << m_preVertexingEnable << endmsg; - athenaLog << MSG::DEBUG << "PreVertexing_VtxName = " << m_preVertexingVtxName << endmsg; - athenaLog << MSG::DEBUG << "PreVertexing_ZCut = " << m_preVertexingZCut << endmsg; - - /** Seeding properties. */ - athenaLog << MSG::DEBUG << "Seeding_PreCutRZ = " << m_seedingPreCutRZ << endmsg; - athenaLog << MSG::DEBUG << "Seeding_PreCutPhi = " << m_seedingPreCutPhi << endmsg; - athenaLog << MSG::DEBUG << "Seeding_PreCutRPhi = " << m_seedingPreCutRPhi << endmsg; - athenaLog << MSG::DEBUG << "Seeding_CutRZ = " << m_seedingCutRZ << endmsg; - - /** Vertexing properties. */ - athenaLog << MSG::DEBUG << "Vertexing_Enable = " << m_vertexingEnable << endmsg; - athenaLog << MSG::DEBUG << "Vertexing_CutRZ = " << m_vertexingCutRZ << endmsg; - athenaLog << MSG::DEBUG << "Vertexing_CutRPhi = " << m_vertexingCutRPhi << endmsg; - athenaLog << MSG::DEBUG << "Vertexing_MaxVertices = " << m_vertexingMaxVertices << endmsg; - athenaLog << MSG::DEBUG << "Vertexing_WindowSize = " << m_vertexingWindowSize << endmsg; - athenaLog << MSG::DEBUG << "Vertexing_WindowSegments = " << m_vertexingWindowSegments << endmsg; - - /** Extension properties. */ - athenaLog << MSG::DEBUG << "Extension_PreCutRZ = " << m_extensionPreCutRZ << endmsg; - athenaLog << MSG::DEBUG << "Extension_PreCutPhi = " << m_extensionPreCutPhi << endmsg; - athenaLog << MSG::DEBUG << "Extension_PreCutRPhi = " << m_extensionPreCutRPhi << endmsg; - athenaLog << MSG::DEBUG << "Extension_PreCutRPhiDiff = " << m_extensionPreCutRPhiDiff << endmsg; - athenaLog << MSG::DEBUG << "Extension_CutRZPixel = " << m_extensionCutRZPixel << endmsg; - athenaLog << MSG::DEBUG << "Extension_CutRZ = " << m_extensionCutRZ << endmsg; - athenaLog << MSG::DEBUG << "Extension_CutRPhi = " << m_extensionCutRPhi << endmsg; - athenaLog << MSG::DEBUG << "Extension_CutSpacePoints = " << m_extensionCutSpacePoints << endmsg; - athenaLog << MSG::DEBUG << "Extension_CutSpacePointsMiss1 = " << m_extensionCutSpacePointsMiss1 << endmsg; - athenaLog << MSG::DEBUG << "Extension_CutSpacePointsMiss2 = " << m_extensionCutSpacePointsMiss2 << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveTriplets = " << m_extensionSolveTriplets << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveTripletsDRCut = " << m_extensionSolveTripletsDRCut << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveTripletsPhiScale = " << m_extensionSolveTripletsPhiScale << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveTripletsEtaScale = " << m_extensionSolveTripletsEtaScale << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveTracks = " << m_extensionSolveTracks << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveV0Tracks = " << m_extensionSolveV0Tracks << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveTracksDRCut = " << m_extensionSolveTracksDRCut << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveTracksPhiScale = " << m_extensionSolveTracksPhiScale << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveTracksEtaScale = " << m_extensionSolveTracksEtaScale << endmsg; - athenaLog << MSG::DEBUG << "Extension_SolveShared = " << m_extensionSolveShared << endmsg; - athenaLog << MSG::DEBUG << "Extension_MaxMissingLayers = " << m_extensionMaxMissingLayers << endmsg; - athenaLog << MSG::DEBUG << "Extension_Refit = " << m_extensionRefit << endmsg; - athenaLog << MSG::DEBUG << "Extension_SpacePoints = " << m_extensionSpacePoints << endmsg; - athenaLog << MSG::DEBUG << "Extension_SpacePointsMiss1 = " << m_extensionSpacePointsMiss1 << endmsg; - athenaLog << MSG::DEBUG << "Extension_SpacePointsMiss2 = " << m_extensionSpacePointsMiss2 << endmsg; - athenaLog << MSG::DEBUG << "Extension_TRTExtension = " << m_extensionTRTExtension << endmsg; - - /** Debug properties. */ - athenaLog << MSG::DEBUG << "Debug_Tuning = " << m_debugTuning << endmsg; - athenaLog << MSG::DEBUG << "Debug_TuningGoodSeeds = " << m_debugTuningGoodSeeds << endmsg; - athenaLog << MSG::DEBUG << "Debug_TuningBadSeeds = " << m_debugTuningBadSeeds << endmsg; - athenaLog << MSG::DEBUG << "Debug_TuningGoodTriplets = " << m_debugTuningGoodTriplets << endmsg; - athenaLog << MSG::DEBUG << "Debug_TuningBadTriplets = " << m_debugTuningBadTriplets << endmsg; - } - - - /************************************/ - /** FINAL MESSAGE *******************/ - /************************************/ - - /** Initialization report message. */ - athenaLog << MSG::INFO << "TrigL2PattRecoStrategyB initialized" << endmsg; - - return sc; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -StatusCode TrigL2PattRecoStrategyB::finalize() { - - /** Delete pre-dimensioned arrays for track data. */ - if(m_trks!=0) {delete[] m_trks; m_trks=0;} - if(m_full_trks!=0) {delete[] m_full_trks; m_full_trks=0;} - m_trks_num = 0; - m_full_trks_num = 0; - - /** Delete and clear processing structures. */ - if(m_vertexingEnable) delete[] m_vtxHisto; - - /** Delete geometry vectors. */ - delete [] m_geoR; delete [] m_geoRmin; delete [] m_geoRmax; - delete [] m_geoZ; delete [] m_geoZmin; delete [] m_geoZmax; - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -TrigL2PattRecoStrategyB::~TrigL2PattRecoStrategyB() { - -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -HLT::ErrorCode TrigL2PattRecoStrategyB::findTracks(const std::vector<const TrigSiSpacePoint*>& vsp, const IRoiDescriptor& roi, TrigInDetTrackCollection* trackColl) { - - /** Cleanup and setup. */ - executeCleanup(); - - HLT::ErrorCode rc=HLT::OK; - - m_zVertices.clear(); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - if (outputLevel <= MSG::DEBUG) - athenaLog << MSG::DEBUG << "TrigL2PattRecoStrategyB called in RoI-based mode" << endmsg; - - m_roiEta = roi.eta(); - m_roiPhi = roi.phi(); - - m_etaHalfWidth = 0.5*fabs(roi.etaPlus()-roi.etaMinus()); - m_phiHalfWidth = 0.5*fabs(roi.phiPlus()-roi.phiMinus()); - - m_roiPhiMin = roi.phiMinus(); - m_roiPhiMax = roi.phiPlus(); - m_roiEtaMin = roi.etaMinus(); - m_roiEtaMax = roi.etaPlus(); - - executeSetup(); - - if(m_timers) m_timer[0]->start(); - - - /************************************************************************************************************/ - /************************************************************************************************************/ - /** SEEDING BLOCK *******************************************************************************************/ - /************************************************************************************************************/ - /************************************************************************************************************/ - - - /************************************/ - /** EXECUTE SEED ROADS **************/ - /************************************/ - - /** Perform seed road making. */ - executeSeedRoads(m_roiEtaMin, m_roiEtaMax, m_roiPhiMin, m_roiPhiMax); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "SEED ROAD MAKING: found " << m_roads.size() << " roads" << endmsg; - StrBRoadIterator road, roadEnd=m_roads.end(); - for(road=m_roads.begin(); road!=roadEnd; road++) { - athenaLog << MSG::DEBUG << "SEED ROAD MAKING: road " << (*road)->lay1 << " --> " << (*road)->lay2 << " --> "; - std::set<int>::iterator it, itEnd=(*road)->lay3.end(); - for(it=(*road)->lay3.begin(); it!=itEnd; it++) { - athenaLog << MSG::DEBUG << (*it) << " "; - } - athenaLog << MSG::DEBUG << endmsg; - } - } - - /************************************/ - /** EXECUTE SEED DATA SORTING *******/ - /************************************/ - - /** Perform sorting. */ - executeSeedDataSorting(vsp); - m_nSP = vsp.size(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - for(int i=0; i<m_layMax; i++){ - athenaLog << MSG::DEBUG << "SEED DATA SORTING: found " << m_spSeed[i].size() << " space points on layer " << i << endmsg; - } - } - - /************************************/ - /** EXECUTE SEED MAKING *************/ - /************************************/ - - /** Perform track seeding. */ - executeSeedMaking(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "SEED MAKING: found " << m_trks_num_active << " seeds" << endmsg; - } - - - /************************************/ - /** EXECUTE SEED VERTEXING **********/ - /************************************/ - - /** Perform seed vertexing. */ - if(m_vertexingEnable) { - executeSeedFilter_Vertex(); - } - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - if(m_vertexingEnable) { - athenaLog << MSG::DEBUG << "SEED FILTER VERTEX: found " << m_recZv.size() << " vertices" << endmsg; - } - } - - - /************************************************************************************************************/ - /************************************************************************************************************/ - /** TRIPLET BLOCK *******************************************************************************************/ - /************************************************************************************************************/ - /************************************************************************************************************/ - - - /************************************/ - /** EXECUTE TRIPLET DATA SORTING ****/ - /************************************/ - - /** Perform sorting. */ - executeTripletDataSorting(vsp); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - for(int i=0; i<m_layMax; i++) { - athenaLog << MSG::DEBUG << "TRIPLET DATA SORTING: found "; - for(unsigned int loopz0=0; loopz0<m_spTripletZ0Steps; loopz0++) { - for(unsigned int loopeta=0; loopeta<m_spTripletEtaSteps; loopeta++) - athenaLog << MSG::DEBUG << m_spTriplet[i*m_spTripletZ0Steps*m_spTripletEtaSteps+loopz0*m_spTripletEtaSteps+loopeta].size() << " "; - athenaLog << MSG::DEBUG << endmsg << " "; - } - athenaLog << " space points on layer " << i << endmsg; - } - } - - - /************************************/ - /** EXECUTE TRIPLET MAKING **********/ - /************************************/ - - /** Perform triplet making. */ - executeTripletMaking(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "TRIPLET MAKING: found " << m_trks_num_active << " patterns" << endmsg; - } - - - /************************************/ - /** EXECUTE TRIPLET AMBIGUITY *******/ - /************************************/ - - /** Perform triplet ambiguity. */ - executeTripletAmbiguity(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "TRIPLET AMBIGUITY: retained " << m_full_trks_num << " patterns" << endmsg; - } - - - /************************************************************************************************************/ - /************************************************************************************************************/ - /** TRACK BLOCK *********************************************************************************************/ - /************************************************************************************************************/ - /************************************************************************************************************/ - - - /************************************/ - /** EXECUTE TRACK AMBIGUITY *********/ - /************************************/ - - /** Perform track ambiguity. */ - executeTrackAmbiguity(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "TRACK AMBIGUITY: retained " << m_full_trks_num_active << " patterns" << endmsg; - } - - - /************************************/ - /** EXECUTE TRACK MAKING ************/ - /************************************/ - - /** Perform track ambiguity. */ - executeTrackMaking(trackColl); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "TRACK MAKING: created " << trackColl->size() << " tracks" << endmsg; - } - - /** Perform cleanup. */ - executeCleanup(); - - if(m_timers) { - m_timer[0]->stop(); - m_pattRecoTiming=m_timer[0]->elapsed(); - } - - return rc; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -HLT::ErrorCode TrigL2PattRecoStrategyB::findTracks(const std::vector<const TrigSiSpacePoint*>& vsp, const IRoiDescriptor& roi, const TrigVertexCollection* vtx, TrigInDetTrackCollection* trackColl) { - - /** Cleanup. */ - executeCleanup(); - - HLT::ErrorCode rc=HLT::OK; - - m_zVertices.clear(); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - if (outputLevel <= MSG::DEBUG) - athenaLog << MSG::DEBUG << "TrigL2PattRecoStrategyB called in RoI-based mode" << endmsg; - - m_roiEta = roi.eta(); - m_roiPhi = roi.phi(); - - m_etaHalfWidth = 0.5*fabs(roi.etaPlus()-roi.etaMinus()); - m_phiHalfWidth = 0.5*fabs(roi.phiPlus()-roi.phiMinus()); - - m_roiPhiMin = roi.phiMinus(); - m_roiPhiMax = roi.phiPlus(); - m_roiEtaMin = roi.etaMinus(); - m_roiEtaMax = roi.etaPlus(); - - executeSetup(); - - if(m_timers) m_timer[0]->start(); - - - /************************************************************************************************************/ - /************************************************************************************************************/ - /** SEEDING BLOCK *******************************************************************************************/ - /************************************************************************************************************/ - /************************************************************************************************************/ - - - /************************************/ - /** EXECUTE SEED ROADS **************/ - /************************************/ - - /** Perform seed road making. */ - executeSeedRoads(m_roiEtaMin, m_roiEtaMax, m_roiPhiMin, m_roiPhiMax); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "SEED ROAD MAKING: found " << m_roads.size() << " roads" << endmsg; - StrBRoadIterator road, roadEnd=m_roads.end(); - for(road=m_roads.begin(); road!=roadEnd; road++) { - athenaLog << MSG::DEBUG << "SEED ROAD MAKING: road " << (*road)->lay1 << " --> " << (*road)->lay2 << " --> "; - std::set<int>::iterator it, itEnd=(*road)->lay3.end(); - for(it=(*road)->lay3.begin(); it!=itEnd; it++) { - athenaLog << MSG::DEBUG << (*it) << " "; - } - athenaLog << MSG::DEBUG << endmsg; - } - } - - /************************************/ - /** EXECUTE SEED DATA SORTING *******/ - /************************************/ - - /** Perform sorting. */ - executeSeedDataSorting(vsp); - m_nSP = vsp.size(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - for(int i=0; i<m_layMax; i++){ - athenaLog << MSG::DEBUG << "SEED DATA SORTING: found " << m_spSeed[i].size() << " space points on layer " << i << endmsg; - } - } - - /************************************/ - /** EXECUTE SEED MAKING *************/ - /************************************/ - - /** Perform track seeding. */ - if(vtx==NULL) - executeSeedMaking(); - else { - std::vector<float> vtxpos; - TrigVertexCollection::const_iterator v, vEnd=vtx->end(); - for(v=vtx->begin(); v!=vEnd; v++) vtxpos.push_back((*v)->z()); - executeSeedMakingVertex(vtxpos); - } - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "SEED MAKING: found " << m_trks_num_active << " seeds" << endmsg; - } - - - /************************************/ - /** EXECUTE SEED VERTEXING **********/ - /************************************/ - - /** Perform seed vertexing. */ - if(m_vertexingEnable) { - executeSeedFilter_Vertex(); - } - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - if(m_vertexingEnable) { - athenaLog << MSG::DEBUG << "SEED FILTER VERTEX: found " << m_recZv.size() << " vertices" << endmsg; - } - } - - - /************************************************************************************************************/ - /************************************************************************************************************/ - /** TRIPLET BLOCK *******************************************************************************************/ - /************************************************************************************************************/ - /************************************************************************************************************/ - - - /************************************/ - /** EXECUTE TRIPLET DATA SORTING ****/ - /************************************/ - - /** Perform sorting. */ - executeTripletDataSorting(vsp); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - for(int i=0; i<m_layMax; i++) { - athenaLog << MSG::DEBUG << "TRIPLET DATA SORTING: found "; - for(unsigned int loopz0=0; loopz0<m_spTripletZ0Steps; loopz0++) { - for(unsigned int loopeta=0; loopeta<m_spTripletEtaSteps; loopeta++) - athenaLog << MSG::DEBUG << m_spTriplet[i*m_spTripletZ0Steps*m_spTripletEtaSteps+loopz0*m_spTripletEtaSteps+loopeta].size() << " "; - athenaLog << MSG::DEBUG << endmsg << " "; - } - athenaLog << " space points on layer " << i << endmsg; - } - } - - - /************************************/ - /** EXECUTE TRIPLET MAKING **********/ - /************************************/ - - /** Perform triplet making. */ - executeTripletMaking(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "TRIPLET MAKING: found " << m_trks_num_active << " patterns" << endmsg; - } - - - /************************************/ - /** EXECUTE TRIPLET AMBIGUITY *******/ - /************************************/ - - /** Perform triplet ambiguity. */ - executeTripletAmbiguity(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "TRIPLET AMBIGUITY: retained " << m_full_trks_num << " patterns" << endmsg; - } - - - /************************************************************************************************************/ - /************************************************************************************************************/ - /** TRACK BLOCK *********************************************************************************************/ - /************************************************************************************************************/ - /************************************************************************************************************/ - - - /************************************/ - /** EXECUTE TRACK AMBIGUITY *********/ - /************************************/ - - /** Perform track ambiguity. */ - executeTrackAmbiguity(); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "TRACK AMBIGUITY: retained " << m_full_trks_num_active << " patterns" << endmsg; - } - - - /************************************/ - /** EXECUTE TRACK MAKING ************/ - /************************************/ - - /** Perform track ambiguity. */ - executeTrackMaking(trackColl); - - /** Debug info. */ - if(outputLevel<=MSG::DEBUG) { - athenaLog << MSG::DEBUG << "TRACK MAKING: created " << trackColl->size() << " tracks" << endmsg; - } - - /** Perform cleanup. */ - executeCleanup(); - - if(m_timers) { - m_timer[0]->stop(); - m_pattRecoTiming=m_timer[0]->elapsed(); - } - - return rc; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -HLT::ErrorCode TrigL2PattRecoStrategyB::findTracks(const std::vector<const TrigSiSpacePoint*>& vsp, const TrigVertexCollection* vtx, TrigInDetTrackCollection* trackColl) { - findTracks(vsp,TrigRoiDescriptor(true),vtx,trackColl); - return HLT::OK; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -HLT::ErrorCode TrigL2PattRecoStrategyB::findTracks(const std::vector<const TrigSiSpacePoint*>& vsp, TrigInDetTrackCollection* trackColl) { - findTracks(vsp,TrigRoiDescriptor(true),trackColl); - return HLT::OK; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeSeedRoads(float etaMin, float etaMax, float /*phiMin*/, float /*phiMax*/) { - - - /*************************************/ - /** CREATE ROADS *********************/ - /*************************************/ - - int bcount1, bcount2; - int ecount1, ecount2; - - std::vector<int> bad,good; - std::vector<float> perc; - - for(int i=0;i<m_layMax;i++){ - bad.push_back(0); - good.push_back(0); - perc.push_back(0.0); - } - - // NEWCODE - int nMissingBarrel=0, nMissingEndcap=0; - for(int i=0; i<m_layMax; i++) { - if(m_mapSetLayersRemove.find(i)!=m_mapSetLayersRemove.end()) { - perc[i]=1.0; - } - if(perc[i]==1.0) { - if(i<=6) nMissingBarrel++; - else nMissingEndcap++; - } - } - m_dynamic_extensionCutSpacePoints = m_extensionCutSpacePoints; - m_dynamic_extensionSpacePoints = m_extensionSpacePoints; - if(nMissingBarrel>0||nMissingEndcap>0) { - if(m_extensionCutSpacePointsMiss1 < m_dynamic_extensionCutSpacePoints) m_dynamic_extensionCutSpacePoints = m_extensionCutSpacePointsMiss1; - if(m_extensionSpacePointsMiss1 < m_dynamic_extensionSpacePoints) m_dynamic_extensionSpacePoints = m_extensionSpacePointsMiss1; - } - if(nMissingBarrel>1||nMissingEndcap>1) { - if(m_extensionCutSpacePointsMiss2 < m_dynamic_extensionCutSpacePoints) m_dynamic_extensionCutSpacePoints = m_extensionCutSpacePointsMiss2; - if(m_extensionSpacePointsMiss2 < m_dynamic_extensionSpacePoints) m_dynamic_extensionSpacePoints = m_extensionSpacePointsMiss2; - } - // NEWCODE - - - /** Layers to be used in barrel and endcap. */ - float absetaMin=0, absetaMax=2.5; - if(etaMin>0) {absetaMin = etaMin; absetaMax = etaMax;} - if(etaMin<=0&&etaMax>0) {absetaMin = 0; absetaMax = (etaMax>-etaMin) ? etaMax : -etaMin;} - if(etaMax<=0) {absetaMin = -etaMax; absetaMax = -etaMin;} - - int imin=1,imax=9; - if (absetaMin<1.) imin=1; - if (absetaMin>=1. && absetaMin<1.5) imin=2; - if (absetaMin>=1.5 && absetaMin<1.7) imin=3; - if (absetaMin>=1.7 && absetaMin<1.8) imin=4; - if (absetaMin>=1.8 && absetaMin<1.9) imin=5; - if (absetaMin>=1.9 && absetaMin<2.1) imin=6; - if (absetaMin>=2.1 && absetaMin<2.2) imin=7; - if (absetaMin>=2.2 && absetaMin<2.4) imin=8; - if (absetaMin>=2.4) imin=9; - if (absetaMax<1.) imax=1; - if (absetaMax>=1. && absetaMax<1.5) imax=2; - if (absetaMax>=1.5 && absetaMax<1.7) imax=3; - if (absetaMax>=1.7 && absetaMax<1.8) imax=4; - if (absetaMax>=1.8 && absetaMax<1.9) imax=5; - if (absetaMax>=1.9 && absetaMax<2.1) imax=6; - if (absetaMax>=2.1 && absetaMax<2.2) imax=7; - if (absetaMax>=2.2 && absetaMax<2.4) imax=8; - if (absetaMax>=2.4) imax=9; - - for(int i=imin-1; i<imax;i++) { - - // Layers - std::list<int> l = m_layerGroups[i]; - float perctot1,perctot2; - - /** Start from first layer. */ - std::list<int>::iterator lay1, lay2, lay3; - for(bcount1=0, ecount1=0, perctot1=1.0, lay1=l.begin(); (lay1!=l.end())&&(bcount1<m_mapLayerOneMultiplicity&&ecount1<m_mapLayerOneMultiplicity); lay1++) { - if(perc[*lay1]==1.0) continue; - if(perc[*lay1]<m_mapMaxLayerFailureFraction) {if(*lay1<m_layPixEC) bcount1++; else ecount1++;} - else { - perctot1 *= perc[*lay1]; - if(perctot1 < m_mapMaxTotalFailureFraction) {if(*lay1<m_layPixEC) bcount1++; else ecount1++;}; - } - - // Second layer - for(bcount2=0, ecount2=0, perctot2=1.0,lay2=lay1,lay2++; (lay2!=l.end())&&(bcount2<m_mapLayerTwoMultiplicity&&ecount2<m_mapLayerTwoMultiplicity); lay2++) { - if(*lay2<*lay1) continue; - if(perc[*lay2]==1.0) continue; - if(perc[*lay2]<m_mapMaxLayerFailureFraction) {if(*lay2<m_layPixEC) bcount2++; else ecount2++;} - else { - perctot2 *= perc[*lay2]; - if(perctot2 < m_mapMaxTotalFailureFraction) {if(*lay2<m_layPixEC) bcount2++; else ecount2++;}; - } - - StrBRoad* road = new StrBRoad; - road->lay1 = *lay1; - road->lay2 = *lay2; - - // Third layer - for(lay3=lay2, lay3++; lay3!=l.end(); lay3++) { - if(*lay3<*lay2) continue; - if(perc[*lay3]==1.0) continue; - - road->lay3.insert(*lay3); - } - - m_roads.push_back(road); - StrBRoadIterator r, rEnd=m_roads.end(); - std::set<int>::iterator it, itEnd=road->lay3.end(); - for(r=m_roads.begin(); r!=rEnd-1; r++){ - if((*r)->lay1==*lay1 && (*r)->lay2==*lay2){ - for(it=road->lay3.begin(); it!=itEnd; it++){ - (*r)->lay3.insert(*it); - } - delete (m_roads.back()); - m_roads.pop_back(); - } - } - } - } - } - - // Sort roads - std::multimap<int,StrBRoad*> sortRoads; - StrBRoadIterator r, rEnd=m_roads.end(); - for(r=m_roads.begin(); r!=rEnd; r++) { - - int layerSum=0; - - if((*r)->lay1<m_layPixEC) layerSum+=(*r)->lay1; - else layerSum+=((*r)->lay1-m_layPixEC); - - if((*r)->lay2<m_layPixEC) layerSum+=(*r)->lay2; - else if((*r)->lay1<m_layPixEC) layerSum+=((*r)->lay2-6); - else layerSum+=(*r)->lay2; - - sortRoads.insert(std::make_pair(layerSum, (*r))); - - } - - m_roads.clear(); - - std::map<int,StrBRoad*>::iterator sr, srEnd=sortRoads.end(); - for(sr=sortRoads.begin(); sr!=srEnd; sr++) - m_roads.push_back(sr->second); - - sortRoads.clear(); -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeSeedDataSorting(const std::vector<const TrigSiSpacePoint*>& spacePointData) { - - /** Loop on space points. */ - std::vector<const TrigSiSpacePoint*>::const_iterator sp, spEnd=spacePointData.end(); - for(sp=spacePointData.begin(); sp!=spEnd; sp++) { - long layer = (*sp)->layer(); - m_spSeed[layer].push_back(*sp); - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -HLT::ErrorCode TrigL2PattRecoStrategyB::executeSeedMaking() { - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - float seedMakingLimit=m_recoTimingFactor*2000.0*(sqrt(m_nSP/500.0))*m_mapLayerOneMultiplicity*m_mapLayerTwoMultiplicity; - if(seedMakingLimit>m_recoMaxSeeds) seedMakingLimit=m_recoMaxSeeds; - bool limit = false; - int seedMakingCount = 0; - m_trks_num = 0; - - /** Pointers to array positions. */ - StrBTrk* pSeed=m_trks; - const TrigSiSpacePoint *s1, *s2; - - /** Perform combinations. */ - float phi1, r1, z1; - float dphi; - long lay1, lay2; - float cutd02 = (m_recoD0Max+m_recoD0MaxSeedDiff)*(m_recoD0Max+m_recoD0MaxSeedDiff); - float ptMin = m_recoPtMin+m_recoPtMinSeedDiff; if(ptMin<1.0) ptMin=1.0; - float cuteta = 0.0325 + 490.0/ptMin; if(cuteta<m_etaHalfWidth)cuteta=m_etaHalfWidth; if(cuteta>10)cuteta=10; - float mintheta = 2*atan(exp(-(m_roiEta-cuteta))); - float maxtheta = 2*atan(exp(-(m_roiEta+cuteta))); - float mindzdr = cos(mintheta)/sin(mintheta); - float maxdzdr = cos(maxtheta)/sin(maxtheta); - - StrBRoadIterator r, rEnd=m_roads.end(); - std::vector<const TrigSiSpacePoint*>::iterator sp1, sp1End, sp2, sp2End; - - // Loop on Roads - for(r=m_roads.begin(); r!=rEnd && !limit; r++){ - - lay1 = (*r)->lay1; - lay2 = (*r)->lay2; - - if(m_spSeed[lay1].size()!=0 && m_spSeed[lay2].size()!=0) { - - // Loop on SP container of layer1 - sp1End=m_spSeed[lay1].end(); - for(sp1=m_spSeed[lay1].begin(); sp1!=sp1End && !limit; sp1++) { - - // Check if event timeout was reached - if (Athena::Timeout::instance().reached()) { - if(outputLevel<=MSG::DEBUG) - athenaLog << MSG::DEBUG << "Timeout reached. Aborting sequence." << endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::TIMEOUT); - } - - // Get sp1 info - s1 = (*sp1); - phi1 = s1->phi(); - r1 = s1->r(); - z1 = s1->z(); - - // Loop on layer2 - sp2End=m_spSeed[lay2].end(); - for(sp2=m_spSeed[lay2].begin(); sp2!=sp2End && !limit; sp2++) { - - // Get sp2 info - s2 = (*sp2); - - // Cut on d0 - //a = s2->y() - s1->y(); - //b = s1->x() - s2->x(); - //c = b*s1->y() + a*s1->x(); - //d02 = c*c; - //cut = cutd02*(a*a+b*b); - //if(d02>cut) continue; - if(((s1->x()-s2->x())*s1->y()+(s2->y()-s1->y())*s1->x())*((s1->x()-s2->x())*s1->y()+(s2->y()-s1->y())*s1->x()) > - cutd02*((s2->y()-s1->y())*(s2->y()-s1->y())+(s1->x()-s2->x())*(s1->x()-s2->x()))) continue; - - // Cut on phi/r - //cut = m_dynamicalSeedingPreCutRPhi*dr; - //dphi = s2->phi() - phi1; - //if(dphi>M_PI) dphi=dphi-2*M_PI; else if(dphi<-M_PI) dphi=dphi+2*M_PI; - //if(dphi>cut || dphi<-cut) continue; - dphi = s2->phi()-phi1; - if(dphi>M_PI) dphi=dphi-2*M_PI; else if(dphi<-M_PI) dphi=dphi+2*M_PI; - if(dphi>m_dynamicalSeedingPreCutRPhi*(s2->r()-r1) || dphi<-m_dynamicalSeedingPreCutRPhi*(s2->r()-r1)) continue; - - // Cut on z - //cut = m_vertexingCutRZ*dr; - //z0 = z1*dr - dz*r1; - //if(z0>cut || z0<-cut) continue; - if((z1*(s2->r()-r1)-(s2->z()-z1)*r1)>m_vertexingCutRZ*(s2->r()-r1) || (z1*(s2->r()-r1)-(s2->z()-z1)*r1)<-m_vertexingCutRZ*(s2->r()-r1)) continue; - - // Cut on eta - // dr = (s2->r()-r1); - // dz = (s2->z()-z1); - // if(dz<mindzr*dr || dz>maxdzr*dr) continue; - if((s2->z()-z1)<mindzdr*(s2->r()-r1) || (s2->z()-z1)>maxdzdr*(s2->r()-r1)) continue; - - // Cut on dr - if(s2->r()<=r1) continue; - - // Create and save StrBSeed - pSeed->deleted = false; - pSeed->seed_sp1 = s1; - pSeed->seed_sp2 = s2; - pSeed->z0 = (z1*(s2->r()-r1)-(s2->z()-z1)*r1)/(s2->r()-r1); - - // Increase pointers - pSeed++; - - // Increase counters - m_trks_num++; - - seedMakingCount++; - if(seedMakingCount>=seedMakingLimit) limit=true; - - } - } - } - } - - m_trks_num_active = m_trks_num; - return HLT::OK; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -HLT::ErrorCode TrigL2PattRecoStrategyB::executeSeedMakingVertex(std::vector<float>& preZv) { - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - float seedMakingLimit=m_recoTimingFactor*2000.0*(sqrt(m_nSP/500.0))*m_mapLayerOneMultiplicity*m_mapLayerTwoMultiplicity; - if(seedMakingLimit>m_recoMaxSeeds) seedMakingLimit=m_recoMaxSeeds; - bool limit = false; - int seedMakingCount = 0; - m_trks_num = 0; - - /** Pointers to array positions. */ - StrBTrk* pSeed=m_trks; - const TrigSiSpacePoint *s1, *s2; - - /** Vertex iterators. */ - std::vector<float>::iterator zv, zvEnd; - bool matchZV; - - /** Perform combinations. */ - float phi1, r1, z1; - float dphi; - long lay1, lay2; - float cutd02 = (m_recoD0Max+m_recoD0MaxSeedDiff)*(m_recoD0Max+m_recoD0MaxSeedDiff); - float ptMin = m_recoPtMin+m_recoPtMinSeedDiff; if(ptMin<1.0) ptMin=1.0; - float cuteta = 0.0325 + 490.0/ptMin; if(cuteta<m_etaHalfWidth)cuteta=m_etaHalfWidth; if(cuteta>10)cuteta=10; - float mintheta = 2*atan(exp(-(m_roiEta-cuteta))); - float maxtheta = 2*atan(exp(-(m_roiEta+cuteta))); - float mindzdr = cos(mintheta)/sin(mintheta); - float maxdzdr = cos(maxtheta)/sin(maxtheta); - - StrBRoadIterator r, rEnd=m_roads.end(); - std::vector<const TrigSiSpacePoint*>::iterator sp1, sp1End, sp2, sp2End; - - // Loop on Roads - for(r=m_roads.begin(); r!=rEnd && !limit; r++){ - - lay1 = (*r)->lay1; - lay2 = (*r)->lay2; - - if(m_spSeed[lay1].size()!=0 && m_spSeed[lay2].size()!=0) { - - // Loop on SP container of layer1 - sp1End=m_spSeed[lay1].end(); - for(sp1=m_spSeed[lay1].begin(); sp1!=sp1End && !limit; sp1++) { - - // Check if event timeout was reached - if (Athena::Timeout::instance().reached()) { - if(outputLevel<=MSG::DEBUG) - athenaLog << MSG::DEBUG << "Timeout reached. Aborting sequence." << endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::TIMEOUT); - } - - // Get sp1 info - s1 = (*sp1); - phi1 = s1->phi(); - r1 = s1->r(); - z1 = s1->z(); - - // Loop on layer2 - sp2End=m_spSeed[lay2].end(); - for(sp2=m_spSeed[lay2].begin(); sp2!=sp2End && !limit; sp2++) { - - // Get sp2 info - s2 = (*sp2); - - // Cut on eta - // dr = (s2->r()-r1); - // dz = (s2->z()-z1); - // if(dz<mindzr*dr || dz>maxdzr*dr) continue; - if((s2->z()-z1)<mindzdr*(s2->r()-r1) || (s2->z()-z1)>maxdzdr*(s2->r()-r1)) continue; - - // Loop on vtx - matchZV = false; - zvEnd=preZv.end(); - for(zv=preZv.begin(); zv!=zvEnd; zv++) { - // Cut on zv - if((z1*(s2->r()-r1)-(s2->z()-z1)*r1)<((*zv)+m_preVertexingZCut)*(s2->r()-r1) && (z1*(s2->r()-r1)-(s2->z()-z1)*r1)>((*zv)-m_preVertexingZCut)*(s2->r()-r1)) {matchZV=true; break;} - } - if(!matchZV) continue; - - // Cut on d0 - //a = s2->y() - s1->y(); - //b = s1->x() - s2->x(); - //c = b*s1->y() + a*s1->x(); - //d02 = c*c; - //cut = cutd02*(a*a+b*b); - //if(d02>cut) continue; - if(((s1->x()-s2->x())*s1->y()+(s2->y()-s1->y())*s1->x())*((s1->x()-s2->x())*s1->y()+(s2->y()-s1->y())*s1->x()) > - cutd02*((s2->y()-s1->y())*(s2->y()-s1->y())+(s1->x()-s2->x())*(s1->x()-s2->x()))) continue; - - // Cut on dr - if(s2->r()<=r1) continue; - - // Cut on phi/r - //cut = m_dynamicalSeedingPreCutRPhi*dr; - //dphi = s2->phi() - phi1; - //if(dphi>M_PI) dphi=dphi-2*M_PI; else if(dphi<-M_PI) dphi=dphi+2*M_PI; - //if(dphi>cut || dphi<-cut) continue; - dphi = s2->phi()-phi1; - if(dphi>M_PI) dphi=dphi-2*M_PI; else if(dphi<-M_PI) dphi=dphi+2*M_PI; - if(dphi>m_dynamicalSeedingPreCutRPhi*(s2->r()-r1) || dphi<-m_dynamicalSeedingPreCutRPhi*(s2->r()-r1)) continue; - - // Create and save StrBSeed - pSeed->deleted = false; - pSeed->seed_sp1 = s1; - pSeed->seed_sp2 = s2; - pSeed->z0 = (z1*(s2->r()-r1)-(s2->z()-z1)*r1)/(s2->r()-r1); - - // Increase pointers - pSeed++; - - // Increase counters - m_trks_num++; - - seedMakingCount++; - if(seedMakingCount>=seedMakingLimit) limit=true; - - } - } - } - } - - m_trks_num_active = m_trks_num; - return HLT::OK; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeSeedFilter_Vertex() { - - /** Clear vertexing histo. */ - for(int i=0; i<m_vtxMaxBin; i++) m_vtxHisto[i] = 0; - - /** Fill histogram. */ - float scale=m_vertexingWindowSegments/m_vertexingWindowSize; - for(unsigned int seed=0; seed<m_trks_num; seed++) { - int index = (int)floor((m_trks[seed].z0+m_vertexingCutRZ)*scale); - m_vtxHisto[index]++; - } - - /** Find maxima. */ - for(int nVtx=0; nVtx<m_vertexingMaxVertices; nVtx++) { - int i, val=0, maxVal=0, maxPos=m_vertexingWindowSegments/4; - for(i=0; i<m_vertexingWindowSegments; i++) val+=m_vtxHisto[i]; - for(maxVal=val, i=m_vertexingWindowSegments; i<m_vtxMaxBin; i++) { - val-=m_vtxHisto[i-m_vertexingWindowSegments]; - val+=m_vtxHisto[i]; - if(val>maxVal) {maxVal=val; maxPos=i-(m_vertexingWindowSegments/4);} - } - for(i=-(m_vertexingWindowSegments/2); i<(m_vertexingWindowSegments/2); i++) if((maxPos+i)>=0 && (maxPos+i)<m_vtxMaxBin) m_vtxHisto[maxPos+i]=0; - float recVtx = -m_vertexingCutRZ + maxPos*(m_vertexingWindowSize/m_vertexingWindowSegments); - - /** Save vertex. */ - m_recZv.push_back(recVtx); - } - - /** Filter tracks around primary vertex. */ - m_trks_num_active = 0; - for(unsigned int seed=0; seed<m_trks_num; seed++) { - - // Evaluate minimum distance from primary vertex - float z0V = 1000.0; - std::vector<float>::iterator v, vEnd=m_recZv.end(); - for(v=m_recZv.begin(); v!=vEnd; v++) - if(m_trks[seed].z0-(*v)<z0V && m_trks[seed].z0-(*v)>-z0V) z0V=fabs(m_trks[seed].z0-(*v)); - - //Scale with sin theta - float dr = m_trks[seed].seed_sp2->r()-m_trks[seed].seed_sp1->r(); - float dz = m_trks[seed].seed_sp2->z()-m_trks[seed].seed_sp1->z(); - float denom = dr*dr+dz*dz; - float sintheta2=1; - if(denom!=0) sintheta2=dr*dr/denom; - - // Apply RZ cut around primary vertex - if((z0V*z0V*sintheta2)>(m_dynamicalSeedingCutRZ*m_dynamicalSeedingCutRZ)) - m_trks[seed].deleted=true; - else - m_trks_num_active++; - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeTripletDataSorting(const std::vector<const TrigSiSpacePoint*>& spacePointData) { - - /** Define z0 bins. */ - const float cutz0 = m_vertexingCutRZ; - const float z0Min = -cutz0; - const float z0Bin = 2*cutz0/m_spTripletZ0Steps; - - /** Define eta bins. */ - float ptMin = m_recoPtMin+m_recoPtMinSeedDiff; if(ptMin<1.0) ptMin=1.0; - float cuteta = 0.0325 + 490.0/ptMin; if(cuteta<m_etaHalfWidth)cuteta=m_etaHalfWidth; if(cuteta>10)cuteta=10; - const float etaMin = m_roiEta-cuteta; - const float etaBin = 2*cuteta/m_spTripletEtaSteps; - std::vector<float> dzdrLo, dzdrHi; - dzdrLo.reserve(m_spTripletEtaSteps+1); - dzdrHi.reserve(m_spTripletEtaSteps+1); - for(unsigned int loop=0; loop<m_spTripletEtaSteps; loop++) { - float etaLo = etaMin+etaBin*loop - 0.5*etaBin; - float etaHi = etaMin+etaBin*(loop+1) + 0.5*etaBin; - float mintheta = 2*atan(exp(-(etaLo))); - float maxtheta = 2*atan(exp(-(etaHi))); - float mindzdr = cos(mintheta)/sin(mintheta); - float maxdzdr = cos(maxtheta)/sin(maxtheta); - dzdrLo.push_back(mindzdr); - dzdrHi.push_back(maxdzdr); - } - - /** Loop on space points. */ - std::vector<const TrigSiSpacePoint*>::const_iterator sp, spEnd=spacePointData.end(); - for(sp=spacePointData.begin(); sp!=spEnd; sp++) { - const long layer = (*sp)->layer(); - const float z = (*sp)->z(), r = (*sp)->r(); - if (r == 0) continue; - for(unsigned int loopz0=0; loopz0<m_spTripletZ0Steps; loopz0++) { - const float z0Lo = z0Min+z0Bin*loopz0 - 0.5*z0Bin; - //const float z0Hi = z0Lo + 2*z0Bin; - const float dzdrH = (z - z0Lo) / r; - const float dzdrL = dzdrH - 2*z0Bin / r; // = (z - z0Hi) / r; dzdrL is always lower than dzdrH - std::vector<float>::iterator pos = std::lower_bound(dzdrHi.begin(), dzdrHi.end(), dzdrL); - const int firstEta = std::distance(dzdrHi.begin(), pos); - // int lastEta = -1; - for (unsigned loopeta = firstEta; loopeta < m_spTripletEtaSteps and dzdrLo[loopeta] <= dzdrH; loopeta++) { - m_spTriplet[layer*m_spTripletZ0Steps*m_spTripletEtaSteps+loopz0*m_spTripletEtaSteps+loopeta].push_back(*sp); - // lastEta = loopeta; - } - } - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -HLT::ErrorCode TrigL2PattRecoStrategyB::executeTripletMaking() { - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - float tripletMakingLimit=m_recoTimingFactor*2000.0*(sqrt(m_nSP/500.0))*m_mapLayerOneMultiplicity*m_mapLayerTwoMultiplicity; - bool limit = false; - int tripletMakingCount = 0; - - std::vector<const TrigSiSpacePoint*>::iterator sp3, sp3End; // 3rd layer spacepoints - const TrigSiSpacePoint *s1, *s2; - float x1, x2, y1, y2, z1, z2, r1, r2; - float x12, y12, z12, r12; - float r12inv; // z12inv; // extrapolation scale along R or Z - float dphi; - float cut_rz, cut_rphi=m_dynamicalExtensionCutRPhi*m_dynamicalExtensionCutRPhi; - float ptMin = m_recoPtMin+m_recoPtMinTripletDiff; if(ptMin<1.0) ptMin=1.0; - float cut_eta = (5./5.) * (0.0325 + 490/ptMin); - float cut_phi = (5./5.) * (0.003 + 970/ptMin); - if(cut_eta<m_etaHalfWidth) cut_eta = m_etaHalfWidth; - if(cut_phi<m_phiHalfWidth) cut_phi = m_phiHalfWidth; - float cut_d0 = m_recoD0Max + m_recoD0MaxTripletDiff; - float cut_pt = m_recoPtMin + m_recoPtMinTripletDiff; - float r12_squared, costheta_squared; - float x12_scaled, y12_scaled;//, z12_scaled, r12_scaled; - float xm1, ym1, cx1, cy1; - float xm2, ym2, cx2, cy2; - float tr, xc, yc, rc, phic; - float cotantheta; - float n, rr, rz, r, z, ang; - float iphi, ir, iz, ezez; - float d0, pt, phi, eta; - float diff_eta, diff_phi; - float phi12, eta12, theta12, theta, tanHalfTheta; - - - // Define z0 bins - float cutz0 = m_vertexingCutRZ; - float z0Min = -cutz0; - float z0Bin = 2*cutz0/m_spTripletZ0Steps; - std::vector<float> z0Lo, z0Hi; - for(unsigned int loop=0; loop<m_spTripletZ0Steps; loop++) { - float minz0 = z0Min+z0Bin*loop; - float maxz0 = z0Min+z0Bin*(loop+1); - z0Lo.push_back(minz0); - z0Hi.push_back(maxz0); - } - - // Define eta bins - float cuteta = 0.0325 + 490.0/ptMin; if(cuteta<m_etaHalfWidth)cuteta=m_etaHalfWidth; if(cuteta>10)cuteta=10; - float etaMin = m_roiEta-cuteta; - float etaBin = 2*cuteta/m_spTripletEtaSteps; - std::vector<float> dzdrLo, dzdrHi; - for(unsigned int loop=0; loop<m_spTripletEtaSteps; loop++) { - float etaLo = etaMin+etaBin*loop; - float etaHi = etaMin+etaBin*(loop+1); - float mintheta = 2*atan(exp(-(etaLo))); - float maxtheta = 2*atan(exp(-(etaHi))); - float mindzdr = cos(mintheta)/sin(mintheta); - float maxdzdr = cos(maxtheta)/sin(maxtheta); - dzdrLo.push_back(mindzdr); - dzdrHi.push_back(maxdzdr); - } - - - // Loop on patterns - m_trks_num_active=0; - for(unsigned int trk=0; trk<m_trks_num && !limit; trk++) { - - // Check if deleted and clear number of triplets - if(m_trks[trk].deleted) continue; - m_trks[trk].triplet_num=0; - m_trks[trk].triplet_sp3.clear(); - m_trks[trk].triplet_eta.clear(); - m_trks[trk].triplet_phi.clear(); - m_trks[trk].triplet_chi2.clear(); - m_trks[trk].triplet_pt.clear(); - m_trks[trk].triplet_d0.clear(); - - // Check if event timeout was reached - if (Athena::Timeout::instance().reached()) { - if(outputLevel<=MSG::DEBUG) - athenaLog << MSG::DEBUG << "Timeout reached. Aborting sequence." << endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::TIMEOUT); - } - - // Get sp1 and sp2 info - s1=m_trks[trk].seed_sp1; - s2=m_trks[trk].seed_sp2; - x1 = s1->x(); - x2 = s2->x(); - y1 = s1->y(); - y2 = s2->y(); - z1 = s1->z(); - z2 = s2->z(); - r1 = s1->r(); - r2 = s2->r(); - x12 = x2 - x1; - y12 = y2 - y1; - z12 = z2 - z1; - r12 = r2 - r1; - - // Protect against division by zero - if(r12>-0.00001 && r12<0.00001) { - float sign=1; if(r12<0) sign=-1; - r12=sign*0.00001; - } - - // Protect against division by zero - if(z12>-0.00001 && z12<0.00001) { - float sign=1; if(z12<0) sign=-1; - z12=sign*0.00001; - } - - r12inv = 1.0 / r12; - // z12inv = 1.0 / z12; - costheta_squared = r12*r12/(z12*z12+r12*r12); - r12_squared = r12*r12; - x12_scaled = x12*r12inv; - y12_scaled = y12*r12inv; - // z12_scaled = z12*r12inv; - // r12_scaled = r12*z12inv; - // rphi fit variables - xm1 = (s2->x()+s1->x())*0.5; - ym1 = (s2->y()+s1->y())*0.5; - cx1 = s2->y()-s1->y(); if(cx1==0) cx1=0.0001; - cy1 = s1->x()-s2->x(); if(cy1==0) cy1=0.0001; - // rz fit variables - cotantheta = z12/r12; - - // Get z0 index info - unsigned int z0index=0; - float z0=m_trks[trk].z0; - for(unsigned int loop=0; loop<m_spTripletZ0Steps; loop++) { - if(z0>=z0Lo[loop] && z0<z0Hi[loop]) z0index=loop; - } - - // Get eta index info - unsigned int etaindex=0; - float dzdr=cotantheta; - for(unsigned int loop=0; loop<m_spTripletEtaSteps; loop++) { - if(dzdr>=dzdrLo[loop] && dzdr<dzdrHi[loop]) etaindex=loop; - } - - // Loop on z0 indexes - for(unsigned int z0i=z0index; z0i<=z0index; z0i++) { - - // Loop on eta indexes - for(unsigned int etai=etaindex; etai<=etaindex; etai++) { - - // Loop on barrel layers - int lay = s2->layer()+1; - for( ; lay<m_layPixEC && !limit; lay++) { // USING GEO INFO - - // Check layer matching - //if(fabs((z1 + z12_scaled*(m_geoR[lay]-r1)))<m_geoZmin[lay] || fabs((z1 + z12_scaled*(m_geoR[lay]-r1)))>m_geoZmax[lay]) continue; - if(lay<m_laySctB) cut_rz=m_dynamicalExtensionCutRZPixel*m_dynamicalExtensionCutRZPixel; // USING GEO INFO - else cut_rz=m_dynamicalExtensionCutRZ*m_dynamicalExtensionCutRZ; - - // Loop on space points of each layer - std::vector<const TrigSiSpacePoint*>& spv = m_spTriplet[lay*m_spTripletZ0Steps*m_spTripletEtaSteps+z0i*m_spTripletEtaSteps+etai]; - sp3End=spv.end(); - for(sp3=spv.begin(); sp3!=sp3End && !limit; sp3++) { - - // Cut on rz - //dz = (z1-(*sp3)->z())*r12+((*sp3)->r()-r1)*z12; - //value = dz*dz*costheta_squared; - //cut = cut_rz*r12*r12; - if(((z1-(*sp3)->z())*r12+((*sp3)->r()-r1)*z12)*((z1-(*sp3)->z())*r12+((*sp3)->r()-r1)*z12)*costheta_squared > (cut_rz*r12_squared)) continue; - - // Cut on rphi - if(((x1 + x12_scaled*((*sp3)->r()-r1) - (*sp3)->x())*(x1 + x12_scaled*((*sp3)->r()-r1) - (*sp3)->x()) + - (y1 + y12_scaled*((*sp3)->r()-r1) - (*sp3)->y())*(y1 + y12_scaled*((*sp3)->r()-r1) - (*sp3)->y())) > - (cut_rphi*((*sp3)->r()-r2)*((*sp3)->r()-r2)*((*sp3)->r()-r2))) continue; - - // Fit in rphi - xm2 = (s2->x()+(*sp3)->x())*0.5; - ym2 = (s2->y()+(*sp3)->y())*0.5; - cx2 = (s2->y()-(*sp3)->y()); if(cx2==0) cx2=0.0001; - cy2 = ((*sp3)->x()-s2->x()); if(cy2==0) cy2=0.0001; - // Cut on too straight tracks - if(cy2==0) continue; - tr = (cx1-cy1*cx2/cy2); - if(tr==0) continue; - // Evaluate circle radius - tr = (xm2-xm1+(ym1-ym2)*cx2/cy2)/tr; - xc = xm1 + cx1*tr; - yc = ym1 + cy1*tr; - rc = sqrt((xc-s1->x())*(xc-s1->x())+(yc-s1->y())*(yc-s1->y())); - // Cut on d0 - d0 = fabs(sqrt(xc*xc+yc*yc)-rc); - if(d0>cut_d0) continue; - // Cut on pT - pt = rc*1.042*9.0/15.0; - if(pt<cut_pt) continue; - // Evaluate phi - phi = atan2(-xc, yc); - dphi = phi-s1->phi(); - if(dphi<-M_PI) dphi+=2*M_PI; - if(dphi>M_PI) dphi-=2*M_PI; - if(dphi<-M_PI*0.5) phi+=M_PI; - if(dphi>M_PI*0.5) phi-=M_PI; - if(phi<-M_PI) phi+=2*M_PI; - if(phi>M_PI) phi-=2*M_PI; - - // Fit in rz - phic = atan2(xc, -yc); - n=rr=rz=r=z=0; - // sp1 - ezez =(s1->dz()*s1->dz())+(cotantheta*cotantheta)*(s1->dr()*s1->dr()); - iphi = atan2(xc-s1->x(), -yc+s1->y()); - ir = iphi-phic; if(ir>M_PI) ir=ir-2*M_PI; if(ir<-M_PI) ir=ir+2*M_PI; - iz = s1->z(); - n+=1/ezez; rr+=(ir*ir)/ezez; rz+=(ir*iz)/ezez; r+=ir/ezez; z+=iz/ezez; - // sp2 - ezez =(s2->dz()*s2->dz())+(cotantheta*cotantheta)*(s2->dr()*s2->dr()); - iphi = atan2(xc-s2->x(), -yc+s2->y()); - ir = iphi-phic; if(ir>M_PI) ir=ir-2*M_PI; if(ir<-M_PI) ir=ir+2*M_PI; - iz = s2->z(); - n+=1/ezez; rr+=(ir*ir)/ezez; rz+=(ir*iz)/ezez; r+=ir/ezez; z+=iz/ezez; - // sp3 - ezez =((*sp3)->dz()*(*sp3)->dz())+(cotantheta*cotantheta)*((*sp3)->dr()*(*sp3)->dr()); - iphi = atan2(xc-(*sp3)->x(), -yc+(*sp3)->y()); - ir = iphi-phic; if(ir>M_PI) ir=ir-2*M_PI; if(ir<-M_PI) ir=ir+2*M_PI; - iz = (*sp3)->z(); - n+=1/ezez; rr+=(ir*ir)/ezez; rz+=(ir*iz)/ezez; r+=ir/ezez; z+=iz/ezez; - // Evaluate eta - if((n*rr-r*r)==0) continue; - ang = (n*rz-r*z)/(n*rr-r*r); - theta = atan2(rc, ang); if(theta<-M_PI) theta+=2*M_PI; if(theta>M_PI) theta-=2*M_PI; if(theta<0) theta=M_PI+theta; - if((theta>(M_PI*0.5) && z12>0) || (theta<(M_PI*0.5) && z12<0)) theta=M_PI-theta; - eta = -log(tan(theta*0.5)); - - // Cut on eta-phi - diff_eta = eta - m_roiEta; - diff_phi = phi - m_roiPhi; - if(diff_phi<-M_PI) diff_phi+=2*M_PI; - if(diff_phi>M_PI) diff_phi-=2*M_PI; - if(diff_eta>cut_eta || diff_eta<-cut_eta || diff_phi>cut_phi || diff_phi<-cut_phi) continue; - - // Save triplet - if(m_trks[trk].triplet_num<100) { - m_trks[trk].triplet_sp3.push_back(*sp3); - m_trks[trk].triplet_eta.push_back(eta); - m_trks[trk].triplet_phi.push_back(phi); - m_trks[trk].triplet_d0.push_back(d0); - m_trks[trk].triplet_pt.push_back(pt); - m_trks[trk].triplet_num++; - } - tripletMakingCount++; - if(tripletMakingCount>tripletMakingLimit) {m_trks_num=trk+1; limit=true;} - - } - } - - // Loop on endcap layers - for( ; lay<m_layMax && !limit; lay++) { // USING GEO INFO - - // Check layer matching - //if(fabs((r1 + r12_scaled*(m_geoZ[lay]-z1)))<m_geoRmin[lay] || fabs((r1 + r12_scaled*(m_geoZ[lay]-z1)))>m_geoRmax[lay]) {rejLayMatch++; continue;} - if(lay<m_laySctEC) cut_rz=m_dynamicalExtensionCutRZPixel*m_dynamicalExtensionCutRZPixel; // USING GEO INFO - else cut_rz=m_dynamicalExtensionCutRZ*m_dynamicalExtensionCutRZ; - - // Loop on space points of each layer - std::vector<const TrigSiSpacePoint*>& spv = m_spTriplet[lay*m_spTripletZ0Steps*m_spTripletEtaSteps+z0i*m_spTripletEtaSteps+etai]; - sp3End=spv.end(); - for(sp3=spv.begin(); sp3!=sp3End && !limit; sp3++) { - - // Cut on rz - if(((z1-(*sp3)->z())*r12+((*sp3)->r()-r1)*z12)*((z1-(*sp3)->z())*r12+((*sp3)->r()-r1)*z12)*costheta_squared > (cut_rz*r12_squared)) continue; - - // Cut on rphi - if(((x1 + x12_scaled*((*sp3)->r()-r1) - (*sp3)->x())*(x1 + x12_scaled*((*sp3)->r()-r1) - (*sp3)->x()) + - (y1 + y12_scaled*((*sp3)->r()-r1) - (*sp3)->y())*(y1 + y12_scaled*((*sp3)->r()-r1) - (*sp3)->y())) > - (cut_rphi*((*sp3)->r()-r2)*((*sp3)->r()-r2)*((*sp3)->r()-r2))) continue; - - // Fit in rphi - xm2 = (s2->x()+(*sp3)->x())*0.5; - ym2 = (s2->y()+(*sp3)->y())*0.5; - cx2 = (s2->y()-(*sp3)->y()); if(cx2==0) cx2=0.0001; - cy2 = ((*sp3)->x()-s2->x()); if(cy2==0) cy2=0.0001; - // Cut on too straight tracks - if(cy2==0) continue; - tr = (cx1-cy1*cx2/cy2); - if(tr==0) continue; - // Evaluate circle radius - tr = (xm2-xm1+(ym1-ym2)*cx2/cy2)/tr; - xc = xm1 + cx1*tr; - yc = ym1 + cy1*tr; - rc = sqrt((xc-s1->x())*(xc-s1->x())+(yc-s1->y())*(yc-s1->y())); - // Cut on d0 - d0 = fabs(sqrt(xc*xc+yc*yc)-rc); - if(d0>cut_d0) continue; - // Cut on pT - pt = rc*1.042*9.0/15.0; - if(pt<cut_pt) continue; - // Evaluate phi - phi = atan2(-xc, yc); - dphi = phi-s1->phi(); - if(dphi<-M_PI) dphi+=2*M_PI; - if(dphi>M_PI) dphi-=2*M_PI; - if(dphi<-M_PI*0.5) phi+=M_PI; - if(dphi>M_PI*0.5) phi-=M_PI; - if(phi<-M_PI) phi+=2*M_PI; - if(phi>M_PI) phi-=2*M_PI; - - // Fit in rz - phic = atan2(xc, -yc); - n=rr=rz=r=z=0; - // sp1 - ezez =(s1->dz()*s1->dz())+(cotantheta*cotantheta)*(s1->dr()*s1->dr()); - iphi = atan2(xc-s1->x(), -yc+s1->y()); - ir = iphi-phic; if(ir>M_PI) ir=ir-2*M_PI; if(ir<-M_PI) ir=ir+2*M_PI; - iz = s1->z(); - n+=1/ezez; rr+=(ir*ir)/ezez; rz+=(ir*iz)/ezez; r+=ir/ezez; z+=iz/ezez; - // sp2 - ezez =(s2->dz()*s2->dz())+(cotantheta*cotantheta)*(s2->dr()*s2->dr()); - iphi = atan2(xc-s2->x(), -yc+s2->y()); - ir = iphi-phic; if(ir>M_PI) ir=ir-2*M_PI; if(ir<-M_PI) ir=ir+2*M_PI; - iz = s2->z(); - n+=1/ezez; rr+=(ir*ir)/ezez; rz+=(ir*iz)/ezez; r+=ir/ezez; z+=iz/ezez; - // sp3 - ezez =((*sp3)->dz()*(*sp3)->dz())+(cotantheta*cotantheta)*((*sp3)->dr()*(*sp3)->dr()); - iphi = atan2(xc-(*sp3)->x(), -yc+(*sp3)->y()); - ir = iphi-phic; if(ir>M_PI) ir=ir-2*M_PI; if(ir<-M_PI) ir=ir+2*M_PI; - iz = (*sp3)->z(); - n+=1/ezez; rr+=(ir*ir)/ezez; rz+=(ir*iz)/ezez; r+=ir/ezez; z+=iz/ezez; - // Evaluate eta - if((n*rr-r*r)==0) continue; - ang = (n*rz-r*z)/(n*rr-r*r); - theta = atan2(rc, ang); if(theta<-M_PI) theta+=2*M_PI; if(theta>M_PI) theta-=2*M_PI; if(theta<0) theta=M_PI+theta; - if((theta>(M_PI*0.5) && z12>0) || (theta<(M_PI*0.5) && z12<0)) theta=M_PI-theta; - eta = -log(tan(theta*0.5)); - - // Cut on eta-phi - diff_eta = eta - m_roiEta; - diff_phi = phi - m_roiPhi; - if(diff_phi<-M_PI) diff_phi+=2*M_PI; - if(diff_phi>M_PI) diff_phi-=2*M_PI; - if(diff_eta>cut_eta || diff_eta<-cut_eta || diff_phi>cut_phi || diff_phi<-cut_phi) continue; - - // Save triplet - if(m_trks[trk].triplet_num<100) { - m_trks[trk].triplet_sp3.push_back(*sp3); - m_trks[trk].triplet_eta.push_back(eta); - m_trks[trk].triplet_phi.push_back(phi); - m_trks[trk].triplet_d0.push_back(d0); - m_trks[trk].triplet_pt.push_back(pt); - m_trks[trk].triplet_num++; - } - tripletMakingCount++; - if(tripletMakingCount>tripletMakingLimit) {m_trks_num=trk+1; limit=true;} - - } - } - } - - // Delete trk if too few triplets are found - if((int)m_trks[trk].triplet_num<(m_dynamic_extensionCutSpacePoints-2)) - m_trks[trk].deleted = true; - else { - // Increase counter - m_trks_num_active++; - // Evaluate chi2 of triplets - phi12 = atan2(s2->y()-s1->y(), s2->x()-s1->x()); - if(phi12>M_PI) phi12=phi12-2*M_PI; else if(phi12<-M_PI) phi12=phi12+2*M_PI; - theta12 = atan2(s2->r()-s1->r(), s2->z()-s1->z()); - if(theta12<-M_PI) theta12+=2*M_PI; - if(theta12>M_PI) theta12-=2*M_PI; - if(theta12<0) theta12=M_PI+theta12; - tanHalfTheta=tan(0.5*theta12); - if(tanHalfTheta!=0) - eta12 = -log(tanHalfTheta); - else { - if(s2->z()-s1->z()>0) eta12=4.0; - else eta12=-4.0; - } - for(unsigned int trip=0; trip<m_trks[trk].triplet_num; trip++) { - diff_eta = m_trks[trk].triplet_eta[trip]-eta12; - diff_phi = m_trks[trk].triplet_phi[trip]-phi12; - if(diff_phi<-M_PI) diff_phi+=2*M_PI; - if(diff_phi>M_PI) diff_phi-=2*M_PI; - m_trks[trk].triplet_chi2.push_back(diff_eta*diff_eta+diff_phi*diff_phi); - } - } - } - } - - return HLT::OK; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeTripletAmbiguity() { - - // Loop on trks - m_full_trks_num = 0; - for(unsigned int trk=0; trk<m_trks_num && ((int)m_full_trks_num)<m_recoMaxTracks; trk++) { - - // Check if deleted - if(m_trks[trk].deleted) continue; - - // Create ambiguities - std::vector<StrBTrack> ambiguities(m_trks[trk].triplet_num); - for(unsigned int triplet=0; triplet<m_trks[trk].triplet_num; triplet++) { - ambiguities[triplet].sp[m_trks[trk].seed_sp1->layer()]=m_trks[trk].seed_sp1; - ambiguities[triplet].sp[m_trks[trk].seed_sp2->layer()]=m_trks[trk].seed_sp2; - ambiguities[triplet].sp[m_trks[trk].triplet_sp3[triplet]->layer()]=m_trks[trk].triplet_sp3[triplet]; - ambiguities[triplet].eta=m_trks[trk].triplet_eta[triplet]; - ambiguities[triplet].phi=m_trks[trk].triplet_phi[triplet]; - ambiguities[triplet].chi2=m_trks[trk].triplet_chi2[triplet]; - } - - // Fill ambiguity list - typedef std::vector<StrBTrack>::iterator StrBTrackScalarIterator; - std::multimap< float, std::pair<StrBTrackScalarIterator,StrBTrackScalarIterator> > ambiguitiesMap; - StrBTrackScalarIterator t1, t2, tEnd=ambiguities.end(); - for(t1=ambiguities.begin(); t1!=tEnd; t1++) { - for(t2=t1, t2++; t2!=tEnd; t2++) { - if(t1->deleted || t2->deleted) continue; - float distance = tripletAmbiguityDistance(&(*t1), &(*t2)); - if(distance<m_extensionSolveTripletsDRCut) ambiguitiesMap.insert(std::make_pair(distance, std::make_pair(t1,t2))); - } - } - if(ambiguitiesMap.size()==0) { - m_trks[trk].deleted=true; - continue; - } - - // Merge ambiguities - std::multimap< float, std::pair<StrBTrackScalarIterator,StrBTrackScalarIterator> >::iterator ambiguity, ambiguityEnd=ambiguitiesMap.end(); - for(ambiguity=ambiguitiesMap.begin(); ambiguity!=ambiguityEnd; ambiguity++) { - tripletMergeAmbiguity(&(*(ambiguity->second.first)), &(*(ambiguity->second.second))); - } - - // Find best ambiguity - StrBTrackScalarIterator amb=ambiguities.begin(), ambEnd=ambiguities.end(), ambBest=ambiguities.begin(); - for(amb++; amb!=ambEnd; amb++) { - if((*amb)<(*ambBest)) ambBest = amb; - } - - // Delete pattern if too few space points in best ambiguity - ambBest->evaluateSum(); - if(ambBest->sumSp < m_dynamic_extensionCutSpacePoints) { - m_trks[trk].deleted=true; - } - // Otherwise save best ambiguity - else { - m_full_trks[m_full_trks_num] = (*ambBest); - m_full_trks[m_full_trks_num].resetDistance(); - m_full_trks_num++; - } - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeTrackAmbiguity() { - - // Fill ambiguity list - std::multimap< float, std::pair<StrBTrack*,StrBTrack*> > ambiguities; - float deta, dphi; - - // Loop on trks - for(unsigned int trk1=0; trk1<m_full_trks_num; trk1++) { - // Check if deleted - if(m_full_trks[trk1].deleted) continue; - for(unsigned int trk2=trk1+1; trk2<m_full_trks_num; trk2++) { - // Check if deleted - if(m_full_trks[trk2].deleted) continue; - // Check eta range - deta = m_full_trks[trk2].eta-m_full_trks[trk1].eta; - if(deta<-0.1) continue; - if(deta>0.1) continue; - // Check phi range - dphi = m_full_trks[trk2].phi-m_full_trks[trk1].phi; if(dphi<-M_PI) dphi+=2*M_PI; if(dphi>M_PI) dphi-=2*M_PI; - if(dphi<-0.1) continue; - if(dphi>0.1) continue; - // Evaluate ambiguity - float fraction = trackAmbiguityFraction(&(m_full_trks[trk1]), &(m_full_trks[trk2])); - if((m_extensionSolveShared&&(fraction>0.3)) || (fraction>0.5)) - ambiguities.insert(std::make_pair(fraction, std::make_pair(&(m_full_trks[trk1]),&(m_full_trks[trk2])))); - } - } - - // Remove ambiguities - std::multimap< float, std::pair<StrBTrack*,StrBTrack*> >::reverse_iterator amb, ambEnd=ambiguities.rend(); - for(amb=ambiguities.rbegin(); amb!=ambEnd; amb++) { - if(amb->second.first->deleted || amb->second.second->deleted) continue; - float fraction = trackAmbiguityFraction(amb->second.first, amb->second.second); - if(fraction>=0.75 && trackAmbiguityDistance(amb->second.first, amb->second.second)<m_extensionSolveTracksDRCut) - trackMergeAmbiguity(amb->second.first, amb->second.second); - else - trackRemoveAmbiguity(amb->second.first, amb->second.second); - } - ambiguities.clear(); - - // Loop on trks - for(unsigned int trk1=0; trk1<m_full_trks_num; trk1++) { - // Check if deleted - if(m_full_trks[trk1].deleted) continue; - for(unsigned int trk2=trk1+1; trk2<m_full_trks_num; trk2++) { - // Check if deleted - if(m_full_trks[trk2].deleted) continue; - // Evaluate ambiguity - float fraction = trackAmbiguityFraction(&(m_full_trks[trk1]), &(m_full_trks[trk2])); - if((m_extensionSolveShared&&(fraction>0.2)) || (fraction>0.5)) - ambiguities.insert(std::make_pair(fraction, std::make_pair(&(m_full_trks[trk1]),&(m_full_trks[trk2])))); - } - } - - // Remove ambiguities - ambEnd=ambiguities.rend(); - for(amb=ambiguities.rbegin(); amb!=ambEnd; amb++) { - if(amb->second.first->deleted || amb->second.second->deleted) continue; - float fraction = trackAmbiguityFraction(amb->second.first, amb->second.second); - if(fraction>=0.75 && trackAmbiguityDistance(amb->second.first, amb->second.second)<m_extensionSolveTracksDRCut) - trackMergeAmbiguity(amb->second.first, amb->second.second); - else - trackRemoveAmbiguity(amb->second.first, amb->second.second); - } - ambiguities.clear(); - - // Remove shared ambiguities - if(m_extensionSolveShared) { - for(unsigned int trk1=0; trk1<m_full_trks_num; trk1++) { - if(m_full_trks[trk1].deleted) continue; - for(unsigned int trk2=trk1+1; trk2<m_full_trks_num; trk2++) { - if(m_full_trks[trk2].deleted) continue; - // Evaluate shared ambiguities - trackAmbiguityShared(&(m_full_trks[trk1]), &(m_full_trks[trk2])); - } - } - } - - m_full_trks_num_active=0; - for(unsigned int trk1=0; trk1<m_full_trks_num; trk1++) { - if(m_full_trks[trk1].deleted) continue; - m_full_trks[trk1].evaluateSum(); - if(m_extensionSolveShared && (m_full_trks[trk1].evaluateSharedFraction()>0.2)) { - m_full_trks[trk1].deleted=true; - } - else m_full_trks_num_active++; - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeTrackMaking(TrigInDetTrackCollection*& trackColl) { - - // Check if the track has too few space points or has been deleted - for(unsigned int trk=0; trk<m_full_trks_num; trk++) { - if(m_full_trks[trk].deleted) continue; - m_full_trks[trk].evaluateSum(); - if((m_full_trks[trk].sumSp<4) || (m_full_trks[trk].sumSpAll<m_dynamic_extensionSpacePoints) || m_full_trks[trk].deleted) { - m_full_trks[trk].deleted = true; - } - } - - // Create TrigInDetTracks - for(unsigned int trk=0; trk<m_full_trks_num; trk++) { - if(m_full_trks[trk].deleted) continue; - - // Create space point vector - std::vector<const TrigSiSpacePoint*>* trackSpacePoints = new std::vector<const TrigSiSpacePoint*>; - - //std::cout << "SITRACK TRACK ----------------------" << std::endl; - - // Pixel barrel - for(int i=0; i<m_laySctB; i++) { - if(m_full_trks[trk].sp[i]!=0) { - trackSpacePoints->push_back(m_full_trks[trk].sp[i]); - //std::cout << "SP" << i << " r/z/phi " << m_full_trks[trk].sp[i]->r() << " " << m_full_trks[trk].sp[i]->z() << " " << m_full_trks[trk].sp[i]->phi() << " " << std::endl; - } - if(m_full_trks[trk].sp2[i]!=0) { - trackSpacePoints->push_back(m_full_trks[trk].sp2[i]); - //std::cout << "SP" << i << " r/z/phi " << m_full_trks[trk].sp2[i]->r() << " " << m_full_trks[trk].sp2[i]->z() << " " << m_full_trks[trk].sp2[i]->phi() << " " << std::endl; - } - } - // Pixel endcap - for(int i=m_layPixEC; i<m_laySctEC; i++) { - if(m_full_trks[trk].sp[i]!=0) { - trackSpacePoints->push_back(m_full_trks[trk].sp[i]); - //std::cout << "SP" << i << " r/z/phi " << m_full_trks[trk].sp[i]->r() << " " << m_full_trks[trk].sp[i]->z() << " " << m_full_trks[trk].sp[i]->phi() << " " << std::endl; - } - if(m_full_trks[trk].sp2[i]!=0) { - trackSpacePoints->push_back(m_full_trks[trk].sp2[i]); - //std::cout << "SP" << i << " r/z/phi " << m_full_trks[trk].sp2[i]->r() << " " << m_full_trks[trk].sp2[i]->z() << " " << m_full_trks[trk].sp2[i]->phi() << " " << std::endl; - } - } - // SCT barrel - for(int i=m_laySctB; i<m_layPixEC; i++) { - if(m_full_trks[trk].sp[i]!=0) { - trackSpacePoints->push_back(m_full_trks[trk].sp[i]); - //std::cout << "SP" << i << " r/z/phi " << m_full_trks[trk].sp[i]->r() << " " << m_full_trks[trk].sp[i]->z() << " " << m_full_trks[trk].sp[i]->phi() << " " << std::endl; - } - if(m_full_trks[trk].sp2[i]!=0) { - trackSpacePoints->push_back(m_full_trks[trk].sp2[i]); - //std::cout << "SP" << i << " r/z/phi " << m_full_trks[trk].sp2[i]->r() << " " << m_full_trks[trk].sp2[i]->z() << " " << m_full_trks[trk].sp2[i]->phi() << " " << std::endl; - } - } - // SCT endcap - for(int i=m_laySctEC; i<m_layMax; i++) { - if(m_full_trks[trk].sp[i]!=0) { - trackSpacePoints->push_back(m_full_trks[trk].sp[i]); - //std::cout << "SP" << i << " r/z/phi " << m_full_trks[trk].sp[i]->r() << " " << m_full_trks[trk].sp[i]->z() << " " << m_full_trks[trk].sp[i]->phi() << " " << std::endl; - } - if(m_full_trks[trk].sp2[i]!=0) { - trackSpacePoints->push_back(m_full_trks[trk].sp2[i]); - //std::cout << "SP" << i << " r/z/phi " << m_full_trks[trk].sp2[i]->r() << " " << m_full_trks[trk].sp2[i]->z() << " " << m_full_trks[trk].sp2[i]->phi() << " " << std::endl; - } - } - - // Create parameters - const TrigInDetTrackFitPar* fittedTrack; - fittedTrack = new TrigInDetTrackFitPar(0, m_full_trks[trk].phi, 0, m_full_trks[trk].eta, 0, - 0, 0, 0, 0, 0); - - // Create TrigInDetTrack - TrigInDetTrack* track = new TrigInDetTrack(trackSpacePoints, fittedTrack, 0, 0); - track->algorithmId(TrigInDetTrack::STRATEGY_B_ID); - - // Preliminary fit track - bool goodFit = fit(track); - if(!goodFit){ - delete track; - continue; - } - - // Add track to collection - trackColl->push_back(track); - - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeSetup() { - - /** Inizialize SP layers */ - // Seeding - std::vector<const TrigSiSpacePoint*> spLayer; - for(int i=0; i<m_layMax; i++) { - m_spSeed.push_back(spLayer); - } - - // Triplet - if(m_spTriplet==0) { - // Evaluate z0 steps - float cutz0 = m_vertexingCutRZ; - float z0Bin = m_recoZ0Bin; - m_spTripletZ0Steps = (unsigned int)ceil(2*cutz0/z0Bin); - // Evaluate eta steps - float ptMin = m_recoPtMin+m_recoPtMinSeedDiff; if(ptMin<1.0) ptMin=1.0; - float cuteta = 0.0325 + 490.0/ptMin; if(cuteta<m_etaHalfWidth)cuteta=m_etaHalfWidth; if(cuteta>10)cuteta=10; - float etaBin = m_recoEtaBin; - m_spTripletEtaSteps = (unsigned int)ceil(2*cuteta/etaBin); - // Create array - m_spTriplet = new std::vector<const TrigSiSpacePoint*>[m_layMax*m_spTripletZ0Steps*m_spTripletEtaSteps]; - } - -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::executeCleanup() { - - if (m_spTriplet) { - for (auto triplet : *m_spTriplet) { - if (triplet) { - delete triplet; - triplet = nullptr; - } - } - m_spTriplet->clear(); - delete [] m_spTriplet; - m_spTriplet = nullptr; - } - - std::vector< std::vector<const TrigSiSpacePoint*> >::iterator it, itEnd=m_spSeed.end(); - for(it=m_spSeed.begin(); it!=itEnd; it++){ - it->clear(); - } - m_spSeed.clear(); - - /** Clear roads */ - StrBRoadIterator road, roadEnd=m_roads.end(); - for(road=m_roads.begin(); road!=roadEnd; road++) delete (*road); - m_roads.clear(); - - /** Clear tracks */ - m_trks_num = 0; - m_full_trks_num = 0; - - /** Clear reconstructed vertexes. */ - m_recZv.clear(); -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -float TrigL2PattRecoStrategyB::tripletAmbiguityDistance(StrBTriplet* t1, StrBTriplet* t2) { - - // Scaling factors - float scale; - float dphi, deta; - - // Phi distance - dphi = t1->phi - t2->phi; - if(dphi>M_PI) dphi = dphi - 2*M_PI; - if(dphi<-M_PI) dphi = dphi + 2*M_PI; - scale = m_extensionSolveTripletsPhiScale; - dphi /= scale; - - // Eta distance - deta = t1->eta - t2->eta; - scale = m_extensionSolveTripletsEtaScale; - deta /= scale; - - // Return squared distance - float dr = dphi*dphi + deta*deta; - return dr; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -float TrigL2PattRecoStrategyB::tripletAmbiguityDistance(StrBTrack* t1, StrBTrack* t2) { - - // Scaling factors - float scale; - float dphi, deta; - - // Phi distance - dphi = t1->phi - t2->phi; - if(dphi>M_PI) dphi = dphi - 2*M_PI; - if(dphi<-M_PI) dphi = dphi + 2*M_PI; - scale = m_extensionSolveTripletsPhiScale; - dphi /= scale; - - // Eta distance - deta = t1->eta - t2->eta; - scale = m_extensionSolveTripletsEtaScale; - deta /= scale; - - // Return squared distance - float dr = dphi*dphi + deta*deta; - return dr; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::tripletMergeAmbiguity(StrBTrack* t1, StrBTrack* t2) { - - // Skip deleted - if(t1->deleted || t2->deleted) return; - - // Check order and set flags - if((*t1)<(*t2)) { - // Insert second track space points in first track - for(int i=0; i<m_layMax; i++) { - // Add first layer SP - if(t1->sp[i]==0 && t2->sp[i]!=0) { - t1->sp[i]=t2->sp[i]; - t1->tr[i]=t2->tr[i]; - } - // Add second layer SP - if(t1->sp[i]!=0 && t1->sp2[i]==0 && t2->sp[i]!=0) { - // Barrel - if(i<m_layPixEC) { - float dr = t2->sp[i]->r()-t1->sp[i]->r(); - if(dr>0.5) {t1->sp2[i]=t2->sp[i]; t1->tr2[i]=t2->tr[i];} - if(dr<-0.5) {t1->sp2[i]=t1->sp[i]; t1->sp[i]=t2->sp[i]; t1->tr2[i]=t1->tr[i]; t1->tr[i]=t2->tr[i];} - } - // Endcap - else { - float dz = t2->sp[i]->z()-t1->sp[i]->z(); - if(t2->sp[i]->z()<0) dz=-dz; - if(dz>0.5) {t1->sp2[i]=t2->sp[i]; t1->tr2[i]=t2->tr[i];} - if(dz<-0.5) {t1->sp2[i]=t1->sp[i]; t1->sp[i]=t2->sp[i]; t1->tr2[i]=t1->tr[i]; t1->tr[i]=t2->tr[i];} - } - } - } - t1->chi2+=t2->chi2; - t2->deleted=true; - } - else { - // Insert first track space points in second track - for(int i=0; i<m_layMax; i++) { - // Add first layer SP - if(t2->sp[i]==0 && t1->sp[i]!=0) { - t2->sp[i]=t1->sp[i]; - t2->tr[i]=t1->tr[i]; - } - // Add second layer SP - if(t2->sp[i]!=0 && t2->sp2[i]==0 && t1->sp[i]!=0) { - // Barrel - if(i<m_layPixEC) { - float dr = t1->sp[i]->r()-t2->sp[i]->r(); - if(dr>0.5) {t2->sp2[i]=t1->sp[i]; t2->tr2[i]=t1->tr[i];} - if(dr<-0.5) {t2->sp2[i]=t2->sp[i]; t2->sp[i]=t1->sp[i]; t2->tr2[i]=t2->tr[i]; t2->tr[i]=t1->tr[i];} - } - // Endcap - else { - float dz = t1->sp[i]->z()-t2->sp[i]->z(); - if(t1->sp[i]->z()<0) dz=-dz; - if(dz>0.5) {t2->sp2[i]=t1->sp[i]; t2->tr2[i]=t1->tr[i];} - if(dz<-0.5) {t2->sp2[i]=t2->sp[i]; t2->sp[i]=t1->sp[i]; t2->tr2[i]=t2->tr[i]; t2->tr[i]=t1->tr[i];} - } - } - } - t2->chi2 += t1->chi2; - t1->deleted=true; - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -float TrigL2PattRecoStrategyB::trackAmbiguityFraction(StrBTrack* t1, StrBTrack* t2) { - - // Count identical spacepoints - int total=0, common=0; - bool first=true, commonFirst=false; - for(int i=0; i<m_layMax; i++) { - if(t1->sp[i]!=0 && t2->sp[i]!=0) total++; - if(t1->sp[i]!=0 && t1->sp[i]==t2->sp[i]) { - if(first) {commonFirst=true; first=false;} - common++; - } - if(t1->sp2[i]!=0 && t1->sp2[i]==t2->sp2[i]) { - common++; - } - if((t1->sp[i]!=0||t2->sp[i]!=0) && (t1->sp[i]!=t2->sp[i])) first=false; - } - - // Evaluate fraction - float ambiguity=0.0; - if(total!=0) { - ambiguity=((float)common)/total; - if(m_extensionSolveV0Tracks && commonFirst) ambiguity += 1.0; - } - - return ambiguity; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -float TrigL2PattRecoStrategyB::trackAmbiguityDistance(StrBTrack* t1, StrBTrack* t2) { - - // Scaling factors - double scale; - double dphi, deta; - - // Phi distance - dphi = t1->phi - t2->phi; - if(dphi>M_PI) dphi = dphi - 2*M_PI; - if(dphi<-M_PI) dphi = dphi + 2*M_PI; - scale = m_extensionSolveTracksPhiScale; - dphi /= scale; - - // Eta distance - deta = t1->eta - t2->eta; - scale = m_extensionSolveTracksEtaScale; - deta /= scale; - - // Return squared distance - double dr = dphi*dphi + deta*deta; - return dr; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::trackAmbiguityShared(StrBTrack* t1, StrBTrack* t2) { - - // Count identical spacepoints - if((*t1)<(*t2)) { - for(int i=0; i<m_layMax; i++) { - if(t1->sp[i]!=0 && t1->sp[i]==t2->sp[i]) t2->spShared[i]=1; - if(t1->sp[i]!=0 && t1->sp[i]==t2->sp2[i]) t2->spShared[i]=1; - if(t1->sp2[i]!=0 && t1->sp2[i]==t2->sp[i]) t2->spShared[i]=1; - if(t1->sp2[i]!=0 && t1->sp2[i]==t2->sp2[i]) t2->spShared[i]=1; - } - } - else { - for(int i=0; i<m_layMax; i++) { - if(t2->sp[i]!=0 && t2->sp[i]==t1->sp[i]) t1->spShared[i]=1; - if(t2->sp[i]!=0 && t2->sp[i]==t1->sp2[i]) t1->spShared[i]=1; - if(t2->sp2[i]!=0 && t2->sp2[i]==t1->sp[i]) t1->spShared[i]=1; - if(t2->sp2[i]!=0 && t2->sp2[i]==t1->sp2[i]) t1->spShared[i]=1; - } - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::trackMergeAmbiguity(StrBTrack* t1, StrBTrack* t2) { - - // Skip deleted - if(t1->deleted || t2->deleted) return; - - // Check order and set flags - if((*t1)<(*t2)) { - // Insert second track space points in first track - for(int i=0; i<m_layMax; i++) { - // Add first layer SP - if(t1->sp[i]==0 && t2->sp[i]!=0) { - t1->sp[i]=t2->sp[i]; - t1->tr[i]=t2->tr[i]; - } - // Add second layer SP - if(t1->sp[i]!=0 && t1->sp2[i]==0 && t2->sp[i]!=0) { - // Barrel - if(i<m_layPixEC) { - float dr = t2->sp[i]->r()-t1->sp[i]->r(); - if(dr>0.5) {t1->sp2[i]=t2->sp[i]; t1->tr2[i]=t2->tr[i];} - if(dr<-0.5) {t1->sp2[i]=t1->sp[i]; t1->sp[i]=t2->sp[i]; t1->tr2[i]=t1->tr[i]; t1->tr[i]=t2->tr[i];} - } - // Endcap - else { - float dz = t2->sp[i]->z()-t1->sp[i]->z(); - if(t2->sp[i]->z()<0) dz=-dz; - if(dz>0.5) {t1->sp2[i]=t2->sp[i]; t1->tr2[i]=t2->tr[i];} - if(dz<-0.5) {t1->sp2[i]=t1->sp[i]; t1->sp[i]=t2->sp[i]; t1->tr2[i]=t1->tr[i]; t1->tr[i]=t2->tr[i];} - } - } - } - //t1->chi2+=t2->chi2; - t2->deleted=true; - } - else { - // Insert first track space points in second track - for(int i=0; i<m_layMax; i++) { - // Add first layer SP - if(t2->sp[i]==0 && t1->sp[i]!=0) { - t2->sp[i]=t1->sp[i]; - t2->tr[i]=t1->tr[i]; - } - // Add second layer SP - if(t2->sp[i]!=0 && t2->sp2[i]==0 && t1->sp[i]!=0) { - // Barrel - if(i<m_layPixEC) { - float dr = t1->sp[i]->r()-t2->sp[i]->r(); - if(dr>0.5) {t2->sp2[i]=t1->sp[i]; t2->tr2[i]=t1->tr[i];} - if(dr<-0.5) {t2->sp2[i]=t2->sp[i]; t2->sp[i]=t1->sp[i]; t2->tr2[i]=t2->tr[i]; t2->tr[i]=t1->tr[i];} - } - // Endcap - else { - float dz = t1->sp[i]->z()-t2->sp[i]->z(); - if(t1->sp[i]->z()<0) dz=-dz; - if(dz>0.5) {t2->sp2[i]=t1->sp[i]; t2->tr2[i]=t1->tr[i];} - if(dz<-0.5) {t2->sp2[i]=t2->sp[i]; t2->sp[i]=t1->sp[i]; t2->tr2[i]=t2->tr[i]; t2->tr[i]=t1->tr[i];} - } - } - } - //t2->chi2 += t1->chi2; - t1->deleted=true; - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::trackRemoveAmbiguity(StrBTrack* t1, StrBTrack* t2) { - - // Skip deleted - if(t1->deleted || t2->deleted) return; - - // Check order and set flags - if((*t1)<(*t2)) { - t2->deleted=true; - } - else { - t1->deleted=true; - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -bool TrigL2PattRecoStrategyB::fit(TrigInDetTrack* t) { - - // Temporary variables - float xc, yc, rc, phic, q, pt; - bool goodFit = true; - - /** PERFORM FIT. */ - if(t->siSpacePoints()->size()>2) { - // Perform preliminaty RPhi fit - circlefitRPhi(t, xc, yc, rc, phic, q, pt); - // Perform extended RZ fit - fitRZ(t, xc, yc, rc, phic, q, pt); - } - if(t->siSpacePoints()->size()>3) { - // Perform extended RPhi fit - goodFit = fitRPhi(t, xc, yc); - } - - return goodFit; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::circlefitRPhi(TrigInDetTrack* t, float &xc, float &yc, float &rc, float &phic, float &q, float &pt) { - - /** Fitting variables. **/ - float phi=0, d0=0; - float x[3], y[3];// z[3], r[3]; - float tr, cx1, cy1, cx2, cy2, xm1, ym1, xm2, ym2; - float phi0, dph0p; - - /** Get space point indexes. **/ - float rsp, rval[3]={10000.0, 10000.0, 10000.0}; - int ind, rind[3]={0, 1, 2}; - - std::vector<const TrigSiSpacePoint*>::iterator sp, spEnd=t->siSpacePoints()->end(); - for(sp=t->siSpacePoints()->begin(), ind=0; sp!=spEnd; sp++, ind++) { - // Save indices for preliminary RPhi fit - rsp = (*sp)->r(); - if(rsp<rval[0]) {rval[0]=rsp; rind[0]=ind;} - if(rsp>122.5 && (rsp-122.5)<rval[1]) {rval[1]=rsp-122.5; rind[1]=ind;} - if(rsp>350.0 && (rsp-350.0)<rval[2]) {rval[2]=rsp-350.5; rind[2]=ind;} - } - if(rind[0]==rind[1] || rind[1]==rind[2] || - ((*(t->siSpacePoints()))[rind[1]]->r()-(*(t->siSpacePoints()))[rind[0]]->r())<1.0 || - ((*(t->siSpacePoints()))[rind[2]]->r()-(*(t->siSpacePoints()))[rind[1]]->r())<1.0) {rind[0]=0; rind[1]=1; rind[2]=t->siSpacePoints()->size()-1;} - - /** Get space point coordinates. */ - for(int i=0; i<3; i++) { - x[i] = (*(t->siSpacePoints()))[rind[i]]->x(); - y[i] = (*(t->siSpacePoints()))[rind[i]]->y(); - //z[i] = (*(t->siSpacePoints()))[rind[i]]->z(); - // r[i] = (*(t->siSpacePoints()))[rind[i]]->r(); - } - - /** Evaluate useful quantities. */ - xm1 = (x[1]+x[0])/2; - ym1 = (y[1]+y[0])/2; - cx1 = y[1] - y[0]; - cy1 = x[0] - x[1]; - - xm2 = (x[1]+x[2])/2; - ym2 = (y[1]+y[2])/2; - cx2 = y[1] - y[2]; - cy2 = x[2] - x[1]; - - /** Check if coordinates need switching. */ - bool switched=false; - double tmp; - if(cy1==0 || cy2==0) { - switched=true; - tmp=xm1; xm1=ym1; ym1=tmp; - tmp=xm2; xm2=ym2; ym2=tmp; - tmp=cx1; cx1=-cy1; cy1=-tmp; - tmp=cx2; cx2=-cy2; cy2=-tmp; - } - - /** Check if track is too straight. */ - bool straight=false; - if(cx1/cy1 == cx2/cy2) { - straight=true; - } - else { - // Evaluate circle radius - tr = (xm2-xm1+(ym1-ym2)*cx2/cy2)/(cx1-cy1*cx2/cy2); - xc = xm1 + cx1*tr; - yc = ym1 + cy1*tr; - if(switched) {tmp=xc; xc=yc; yc=tmp;} - rc = sqrt((xc-x[0])*(xc-x[0])+(yc-y[0])*(yc-y[0])); - pt = rc*1.042*9.0/15.0; - if(pt>=1000000.0) straight=true; - } - - /** Treat straight tracks. */ - if(straight) { - phi = atan2(y[1]-y[0], x[1]-x[0]); - if(phi<-M_PI) phi+=2*M_PI; - if(phi>M_PI) phi-=2*M_PI; - pt = 1000000.0; - xc = yc = rc = 0; - float phiV = atan2(y[0], x[0]); - d0 = sqrt(x[0]*x[0]+y[0]*y[0])*sin(phiV-phi); - } - /** Treat curved tracks. */ - else { - phic = atan2(xc, -yc); - d0 = sqrt(xc*xc+yc*yc)-rc; - /** Evaluate charge. */ - phi0 = atan2(xc-x[0],-yc+y[0]); - dph0p = phi0-phic; - if (dph0p > M_PI) dph0p = dph0p - 2*M_PI; - if (dph0p < -M_PI) dph0p = dph0p + 2*M_PI; - if (dph0p > 0) { - q = -1; - } else { - q = 1; - } - pt = pt*q; - - /** Evaluate phi0. */ - phi = atan2(-xc, yc) + (1+q)/2*M_PI; - if(phi<-M_PI) phi+=2*M_PI; - if(phi>M_PI) phi-=2*M_PI; - - /** Evaluate d0 sign. */ - float absd0 = fabs(d0); - float phiV = atan2(y[0], x[0]); - if(phiV<-M_PI) phiV+=2*M_PI; - if(phiV> M_PI) phiV-=2*M_PI; - float newsign = sin(phiV-phi); - if (newsign<0){ - d0 = -absd0; - } else { - d0 = absd0; - } - } - - /** Save track parameters. */ - TrigInDetTrackFitPar* par = const_cast<TrigInDetTrackFitPar*>(t->param()); - par->a0(d0); - par->phi0(phi); - par->pT(pt); - -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::fitRZ(TrigInDetTrack* t, float &xc, float &yc, float &rc, float &phic, float &q, float &pt) { - - /** Fill sum variables. */ - // Sum variable - float ang=0, z0=0, cotantheta=0; - float n=0, rr=0, rz=0, r=0, z=0; - float iphi, ir, iz, ezez; - - // Preliminary track parameters - TrigInDetTrackFitPar* par = const_cast<TrigInDetTrackFitPar*>(t->param()); - float z1=(*(t->siSpacePoints()))[0]->z(), r1=(*(t->siSpacePoints()))[0]->r(), z2, r2; - z2=z1; r2=r1; - for(unsigned int nSP=1; nSP<t->siSpacePoints()->size(); nSP++) { - z2=(*(t->siSpacePoints()))[nSP]->z(); r2=(*(t->siSpacePoints()))[1]->r(); - if((r2-r1)!=0 && (z2-z1)!=0) break; - } - - int trackType=2; // 0=nonsense 1=straight 2=normal - if((r2-r1)==0 && (z2-z1)==0) trackType=0; - else if(pt>=1000000.0) trackType=1; - - if(trackType==0) { // NONSENSE TRACK - par->eta(0); - par->z0(0); - } - else if(trackType==1) { // STRAIGHT TRACK - z0=z1-((z2-z1)/(r2-r1))*r1; - par->z0(z0); - float theta = atan2(r2-r1, z2-z1); - if(theta<-M_PI) theta+=2*M_PI; - if(theta>M_PI) theta-=2*M_PI; - if(theta<0) theta=M_PI+theta; - float tanHalfTheta=tan(0.5*theta); - float eta=0; - if(tanHalfTheta!=0) - eta = -log(tanHalfTheta); - else { - if((z2-z1)>0) eta=4.0; - else eta=-4.0; - } - par->eta(eta); - } - else { // NORMAL TRACK - - // Loop on SPs - cotantheta = (z2-z1)/(r2-r1); - std::vector<const TrigSiSpacePoint*>::iterator sp, spEnd=t->siSpacePoints()->end(); - for(sp=t->siSpacePoints()->begin(); sp!=spEnd; sp++) { - // Evaluate error on Z - ezez = ((*sp)->dz()*(*sp)->dz()) + (cotantheta*cotantheta)*((*sp)->dr()*(*sp)->dr()); - // Evaluate sum variables - iphi = atan2(xc-(*sp)->x(), -yc+(*sp)->y()); - ir = iphi-phic; if(ir>M_PI) ir=ir-2*M_PI; if(ir<-M_PI) ir=ir+2*M_PI; - iz = (*sp)->z(); - n+=1/ezez; rr+=(ir*ir)/ezez; rz+=(ir*iz)/ezez; r+=ir/ezez; z+=iz/ezez; - } - - /** Evaluate line parameters. */ - float invdelta, z0; - invdelta = 1/((double)n*rr-(double)r*r); - z0 = invdelta*((double)rr*z-(double)r*rz); - ang = invdelta*((double)n*rz-(double)r*z); - - /** Evaluate track parameters. */ - float theta = atan2(-q*rc, ang); - if(theta<-M_PI) theta+=2*M_PI; - if(theta>M_PI) theta-=2*M_PI; - if(theta<0) theta=M_PI+theta; - float tanHalfTheta=tan(0.5*theta); - float eta=0; - if(tanHalfTheta!=0) - eta = -log(tanHalfTheta); - else { - if(-q*rc*ang>0) eta=4.0; - else eta=-4.0; - } - - par->eta(eta); - par->z0(z0); - } -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -bool TrigL2PattRecoStrategyB::fitRPhi(TrigInDetTrack* t, float &xc, float &yc) { - - /** Fill sum variables. */ - float infinite=666666666666.666; - float Cxx, Cxy, Cyy, Cxrr, Cyrr, Crrrr, q1, q2; - float Sw=0, x=0, y=0, xx=0, xy=0, yy=0, xrr=0, yrr=0, rr=0, rrrr=0; - float ix, iy, ir, iphi, iphic, idr, idphi, ee; - float phiref, phi, phi1, phi2, phidiff1, phidiff2, rho, d0; - float k, delta; - - // Preliminary track parameters - TrigInDetTrackFitPar* par = const_cast<TrigInDetTrackFitPar*>(t->param()); - phiref = phi = phi1 = phi2 = par->phi0(); - - // Loop on SPs - for(unsigned int i=0; i<t->siSpacePoints()->size(); i++) { - // Get coordinates - ix = (*t->siSpacePoints())[i]->x(); - iy = (*t->siSpacePoints())[i]->y(); - ir = (*t->siSpacePoints())[i]->r(); - iphi = (*t->siSpacePoints())[i]->phi(); - iphic = atan2(iy-yc, ix-xc); - idr = (*t->siSpacePoints())[i]->dr(); - idphi = (*t->siSpacePoints())[i]->dphi(); - - // Evaluate error - ee = (ir*ir*idphi*idphi*cos(M_PI/2+iphi-iphic)*cos(M_PI/2+iphi-iphic)) + - (idr*idr*sin(M_PI/2+iphi-iphic)*sin(M_PI/2+iphi-iphic)); - // Evaluate sum variables - Sw+=1/ee; x+=ix/ee; y+=iy/ee; xx+=(ix*ix)/ee; xy+=(ix*iy)/ee; yy+=(iy*iy)/ee; xrr+=(ix*ir*ir)/ee; yrr+=(iy*ir*ir)/ee; rr+=(ir*ir)/ee; rrrr+=(ir*ir*ir*ir)/ee; - } - // Divide by weight sum - x/=Sw; y/=Sw; xx/=Sw; xy/=Sw; yy/=Sw; xrr/=Sw; yrr/=Sw; rr/=Sw; rrrr/=Sw; - - /** Evaluate circle parameters. */ - Cxx=xx-x*x; Cxy=xy-x*y; Cyy=yy-y*y; Cxrr=xrr-x*rr; Cyrr=yrr-y*rr; Crrrr=rrrr-rr*rr; - q1=(Crrrr*Cxy)-(Cxrr*Cyrr); q2=Crrrr*(Cxx-Cyy)-(Cxrr*Cxrr)+(Cyrr*Cyrr); - - float signx = cos(phiref)/fabs(cos(phiref)); float signy = sin(phiref)/fabs(sin(phiref)); - - if(q2==0) phi=0.5*atan2(signy*infinite, signx); - else phi=0.5*atan2(signy*2*q1/q2, signx); - if(phi>M_PI) phi-=2*M_PI; else if(phi<-M_PI) phi+=2*M_PI; - - if(signx<0 && signy>=0) { - phi1 = M_PI/2 - phi; - phi2 = M_PI - phi; - } - else if(signx>=0 && signy<0) { - phi1 = 3*M_PI/2-phi; - phi2 = -phi; - } - else if(signx>=0 && signy>=0) { - phi1 = M_PI/2+phi; - phi2 = phi; - } - else if(signx<0 && signy<0) { - phi1 = 3*M_PI/2+phi; - phi2 = M_PI+phi; - } - - if(phi1>M_PI) phi1-=2*M_PI; else if(phi1<-M_PI) phi1+=2*M_PI; - if(phi2>M_PI) phi2-=2*M_PI; else if(phi2<-M_PI) phi2+=2*M_PI; - phidiff1 = phi1-phiref; if(phidiff1>M_PI) phidiff1-=2*M_PI; else if(phidiff1<-M_PI) phidiff1+=2*M_PI; phidiff1=fabs(phidiff1); - phidiff2 = phi2-phiref; if(phidiff2>M_PI) phidiff2-=2*M_PI; else if(phidiff2<-M_PI) phidiff2+=2*M_PI; phidiff2=fabs(phidiff2); - if(phidiff1>0.5 && phidiff2>0.5) return false; - if(phidiff1<phidiff2) phi=phi1; else phi=phi2; - - if(Crrrr==0) k=infinite; - else k =(sin(phi)*Cxrr-cos(phi)*Cyrr)/Crrrr; - delta = -k*rr + sin(phi)*x - cos(phi)*y; - rho = 2*k/sqrt(1-4*delta*k); - d0 = -2*delta/(1+sqrt(1-4*delta*k)); - - /** Evaluate track parameters. */ - par->phi0(phi); - par->a0(d0); - par->pT(1.042*(1/rho)*9.0/15.0); - - return true; -} - - -//** ----------------------------------------------------------------------------------------------------------------- **// - - -void TrigL2PattRecoStrategyB::shiftRPhi(TrigInDetTrack* t) { - - /** SHIFT FINAL TRACK D0 VALUE. */ - // Get original d0 value - TrigInDetTrackFitPar* param=const_cast<TrigInDetTrackFitPar*>(t->param()); - float oldd0 = param->a0(); - float phi0 = param->phi0(); - - // Evaluate new d0 value - float newd0 = oldd0 - m_xc*sin(phi0) + m_yc*cos(phi0); - param->a0(newd0); -} diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyC.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyC.cxx deleted file mode 100644 index 910f5e566153a49501ddb36fe849a6788eb46d64..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyC.cxx +++ /dev/null @@ -1,908 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -//////////////////////////////////////////////////////////////////////////////// -// TrigL2PattRecoStrategyC -// ------------------------------- -// ATLAS Collaboration -// -// 16.01.2011 Package created -// -// Author: Dmitry Emeliyanov, RAL -// e-mail: Dmitry.Emeliyanov@cern.ch -// -// implements offline track finding algorithm based on I.Gavrilenko's -// InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededFinder_Lv2 -// -//////////////////////////////////////////////////////////////////////////////// - -#include <cmath> -#include <iostream> -#include <list> -//#include "StoreGate/DataHandle.h" - -#include "TrigInDetEvent/TrigInDetTrack.h" -#include "TrigInDetEvent/TrigInDetTrackCollection.h" - -#include "TrigInDetRecoTools/ITrigL2PattRecoStrategy.h" - -#include "IRegionSelector/IRoiDescriptor.h" - -#include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h" -#include "InDetRecToolInterfaces/ISiZvertexMaker.h" -#include "InDetRecToolInterfaces/ISiTrackMaker.h" -#include "SiSpacePoint/SCT_SpacePoint.h" -#include "SiSpacePoint/PixelSpacePoint.h" - -#include "SiSPSeededTrackFinderData/SiSpacePointsSeedMakerEventData.h" -#include "SiSPSeededTrackFinderData/SiTrackMakerEventData_xk.h" - -#include "TrkRIO_OnTrack/RIO_OnTrack.h" -#include "TrkSpacePoint/SpacePoint.h" -#include "TrkSpacePoint/SpacePointCollection.h" -#include "TrkSpacePoint/SpacePointContainer.h" - -#include "InDetIdentifier/PixelID.h" -#include "InDetIdentifier/SCT_ID.h" - -#include "TrkSurfaces/PerigeeSurface.h" -#include "TrkParameters/TrackParameters.h" -#include "InDetPrepRawData/SiClusterContainer.h" -#include "InDetPrepRawData/PixelClusterCollection.h" -#include "InDetPrepRawData/SCT_ClusterCollection.h" -//#include "DataModel/tools/IdentContIndex.h" - -#include "TrkEventPrimitives/FitQuality.h" -#include "TrkEventPrimitives/ParamDefs.h" - -#include "TrigTimeAlgs/TrigTimerSvc.h" - -#include "IRegionSelector/IRegSelSvc.h" -#include "TrigInDetRecoTools/TrigL2PattRecoStrategyC.h" -#include "TrigInDetRecoTools/TrigL2DataConversionUtils.h" - -TrigL2PattRecoStrategyC::TrigL2PattRecoStrategyC(const std::string& t, - const std::string& n, - const IInterface* p ): - AthAlgTool(t,n,p), - - m_useZvertexTool(true), - m_nfreeCut(5) , - m_seedsmaker("InDet::SiSpacePointsSeedMaker_ATLxk/InDetTrigSiSpacePointsSeedMaker"), - m_zvertexmaker("InDet::SiZvertexMaker_xk/InDetTrigZvertexMaker"), - m_trackmaker("InDet::SiTrackMaker_xk/InDetTrigSiTrackMaker"), - m_regionSelector("RegSelSvc", n), - m_sctSpacePointsName ("SCT_TempSpacePoints"), - m_pixelSpacePointsName ("PixelTempSpacePoints"), - m_sctOnlineSpacePointsName("TrigSCT_SpacePoints"), - m_pixelOnlineSpacePointsName("TrigPixelSpacePoints") -{ - declareInterface< ITrigL2PattRecoStrategy >( this ); - - declareProperty("SeedsTool" ,m_seedsmaker ); - declareProperty("ZvertexTool" ,m_zvertexmaker ); - declareProperty("TrackTool" ,m_trackmaker ); - declareProperty("useZvertexTool" ,m_useZvertexTool); - declareProperty("SCT_SpacePointsName", m_sctSpacePointsName); - declareProperty("PixelSpacePointsName", m_pixelSpacePointsName); - declareProperty("FreeClustersCut" ,m_nfreeCut ); -} - -StatusCode TrigL2PattRecoStrategyC::initialize() -{ - StatusCode sc = AthAlgTool::initialize(); - MsgStream athenaLog(msgSvc(), name()); - - // Get tool for space points seed maker - - sc=m_seedsmaker.retrieve(); - - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL << "Failed to retrieve tool " << m_seedsmaker << endmsg; - return sc; - } - else { - athenaLog << MSG::INFO << "Retrieved tool " << m_seedsmaker << endmsg; - } - - if(m_useZvertexTool) { - - // Get tool for z-coordinates primary vertices search - sc=m_zvertexmaker.retrieve(); - - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL << "Failed to retrieve tool " << m_zvertexmaker << endmsg; - return sc; - } - else { - athenaLog << MSG::INFO << "Retrieved tool " << m_zvertexmaker << endmsg; - } - } - - // Get track-finding tool - sc = m_trackmaker.retrieve(); - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL << "Failed to retrieve tool " << m_trackmaker << endmsg; - return sc; - } - else { - athenaLog << MSG::INFO << "Retrieved tool " << m_trackmaker << endmsg; - } - - sc = m_regionSelector.retrieve(); - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL<< "Unable to retrieve RegionSelector tool "<< m_regionSelector.type() << endmsg; - return sc; - } - - // @TODO how to properly initialize and use read handles here ? - // optional PRD to track association map - ATH_CHECK( m_prdToTrackMap.initialize( !m_prdToTrackMap.key().empty() ) ); - - // Get SCT & pixel Identifier helpers - - if (detStore()->retrieve(m_pixelId, "PixelID").isFailure()) { - athenaLog << MSG::FATAL << "Could not get Pixel ID helper" << endmsg; - return StatusCode::FAILURE; - } - - if (detStore()->retrieve(m_sctId, "SCT_ID").isFailure()) { - athenaLog << MSG::FATAL << "Could not get SCT ID helper" << endmsg; - return StatusCode::FAILURE; - } - // register the IdentifiableContainers into StoreGate - // ------------------------------------------------------ - - if( !evtStore()->transientContains<SpacePointContainer>(m_pixelSpacePointsName)){ - - m_pixelSpacePointsContainer = new SpacePointContainer(m_pixelId->wafer_hash_max()); - m_pixelSpacePointsContainer->addRef(); //preventing SG from deleting object: - - if (evtStore()->record(m_pixelSpacePointsContainer, m_pixelSpacePointsName).isFailure()) { - athenaLog << MSG::WARNING << " Container " << m_pixelSpacePointsName - << " could not be recorded in StoreGate !" << endmsg; - } - else { - athenaLog << MSG::INFO << "Container " << m_pixelSpacePointsName - << " registered in StoreGate" << endmsg; - } - } - else { - sc = evtStore()->retrieve(m_pixelSpacePointsContainer, m_pixelSpacePointsName); - if (sc.isFailure()) { - athenaLog << MSG::ERROR << "Failed to get Pixel space point Container" << endmsg; - return sc; - } - else { - m_pixelSpacePointsContainer->addRef(); //increase ref count: - athenaLog << MSG::INFO << "Got Pixel space point Container from TDS: " - << m_pixelSpacePointsName << endmsg; - } - } - - if( !evtStore()->transientContains<SpacePointContainer>(m_sctSpacePointsName)){ - m_sctSpacePointsContainer = new SpacePointContainer(m_sctId->wafer_hash_max()); - m_sctSpacePointsContainer->addRef(); //preventing SG from deleting object: - - if (evtStore()->record(m_sctSpacePointsContainer, m_sctSpacePointsName).isFailure()) { - athenaLog << MSG::WARNING << " Container " << m_sctSpacePointsName - << " could not be recorded in StoreGate !" << endmsg; - } - else { - athenaLog << MSG::INFO << "Container " << m_sctSpacePointsName - << " registered in StoreGate" << endmsg; - } - } - else { - sc = evtStore()->retrieve(m_sctSpacePointsContainer, m_sctSpacePointsName); - if (sc.isFailure()) { - athenaLog << MSG::ERROR << "Failed to get SCT space point Container" << endmsg; - return sc; - } - else { - m_sctSpacePointsContainer->addRef(); //increase ref count: - athenaLog << MSG::INFO << "Got SCT space point Container from TDS: " - << m_sctSpacePointsName << endmsg; - } - } - - ITrigTimerSvc* timerSvc; - StatusCode scTime = service( "TrigTimerSvc", timerSvc); - if( scTime.isFailure() ) { - athenaLog << MSG::INFO<< "Unable to locate Service TrigTimerSvc " << endmsg; - m_timers = false; - } - else{ - m_timers = true; - } - if ( m_timers ) { - m_timer[0] = timerSvc->addItem("StrC_PattReco"); - m_timer[1] = timerSvc->addItem("Seed_NE"); - m_timer[2] = timerSvc->addItem("Seed_Prod"); - m_timer[3] = timerSvc->addItem("Seed_Ret"); - m_timer[3]->propName("Seed_Ret.nSeed"); - m_timer[4] = timerSvc->addItem("TMak_NE"); - m_timer[5] = timerSvc->addItem("TMak_Get"); - m_timer[5]->propName("TMak_Get.nSeed"); - m_timer[6] = timerSvc->addItem("TMak_Qm"); - m_timer[6]->propName("TMak_Qm.nTracks"); - m_timer[7] = timerSvc->addItem("TMak_EE"); - m_timer[8] = timerSvc->addItem("TrackFilt"); - m_timer[8]->propName("TrackFlt.nTracks"); - m_timer[9] = timerSvc->addItem("ZVMaker"); - - } - - athenaLog << MSG::INFO << "TrigL2PattRecoStrategyC initialized "<< endmsg; - return sc; -} - -StatusCode TrigL2PattRecoStrategyC::finalize() { - - m_sctSpacePointsContainer->cleanup(); - m_sctSpacePointsContainer->release(); - m_pixelSpacePointsContainer->cleanup(); - m_pixelSpacePointsContainer->release(); - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - -TrigL2PattRecoStrategyC::~TrigL2PattRecoStrategyC() { - -} - -namespace InDet { - class ExtendedSiTrackMakerEventData_xk : public InDet::SiTrackMakerEventData_xk - { - public: - ExtendedSiTrackMakerEventData_xk(const SG::ReadHandleKey<Trk::PRDtoTrackMap> &key) { - if (!key.key().empty()) { - m_prdToTrackMap = SG::ReadHandle<Trk::PRDtoTrackMap>(key); - if (!m_prdToTrackMap.isValid()) { - throw std::runtime_error(std::string("Failed to get PRD to track map:") + key.key()); - } - setPRDtoTrackMap(m_prdToTrackMap.cptr()); - } - } - private: - void dummy() {} - SG::ReadHandle<Trk::PRDtoTrackMap> m_prdToTrackMap; - }; - - // Alternative veriosn with direct access if read handles do not work here: - // InDet::AltExtendedSiCombinatorialTrackFinderData_xk combinatorialData(evtStore(),m_prdToTrackMap.key()); - class AltExtendedSiTrackMakerEventData_xk : public SiTrackMakerEventData_xk - { - public: - AltExtendedSiTrackMakerEventData_xk(ServiceHandle<StoreGateSvc> &event_store, - const std::string &key) { - if (!key.empty()) { - const Trk::PRDtoTrackMap *prd_to_track_map_cptr = nullptr; - if (event_store->retrieve(prd_to_track_map_cptr, key).isFailure()) { - throw std::runtime_error(std::string("Failed to get PRD to track map:") + key); - } - setPRDtoTrackMap(prd_to_track_map_cptr); - } - } - - protected: - void dummy() override {} - }; - -} - - -HLT::ErrorCode TrigL2PattRecoStrategyC::findTracks(const std::vector<const TrigSiSpacePoint*>& /*vsp*/, - const IRoiDescriptor& roi, - TrigInDetTrackCollection* trackColl) { - - m_pattRecoTiming=0.0; - HLT::ErrorCode rc=HLT::OK; - - m_zVertices.clear(); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - if (outputLevel <= MSG::DEBUG) - athenaLog<< MSG::DEBUG<<"TrigL2PattRecoStrategyC called in RoI-based mode "<<endmsg; - - std::vector<IdentifierHash> listOfSCTIds; - std::vector<IdentifierHash> listOfPixIds; - - m_regionSelector->DetHashIDList(SCT, roi, listOfSCTIds ); - - m_regionSelector->DetHashIDList(PIXEL,roi, listOfPixIds); - - StatusCode sc=convertInputData(listOfPixIds,listOfSCTIds); - - if(sc.isFailure()) { - athenaLog<< MSG::WARNING<<"Failed to convert input data into offline spacepoints "<<endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); - } - - if(m_timers) m_timer[0]->start(); - - InDet::SiSpacePointsSeedMakerEventData seedEventData; - std::list<Trk::Vertex> VZ; - - if( m_useZvertexTool ) { - - if(m_timers) m_timer[9]->start(); - - VZ = m_zvertexmaker->newRegion(seedEventData, listOfPixIds, listOfSCTIds, roi); - std::for_each(VZ.begin(),VZ.end(),ZVertexCopyFunctor(m_zVertices)); - if(m_timers) m_timer[9]->stop(); - if (outputLevel <= MSG::DEBUG) - athenaLog << MSG::DEBUG << "REGTEST: Number of zvertex found = " << VZ.size() << endmsg; - } - else{ - if(m_timers) m_timer[1]->start(); - m_seedsmaker->newRegion(seedEventData, listOfPixIds, listOfSCTIds, roi); - if(m_timers) m_timer[1]->stop(); - } - - if(m_timers) m_timer[2]->start(); - m_seedsmaker->find3Sp(seedEventData, VZ); - if(m_timers) m_timer[2]->stop(); - - bool PIX = true; - bool SCT = true; - InDet::ExtendedSiTrackMakerEventData_xk trackEventData(m_prdToTrackMap); - InDet::AltExtendedSiTrackMakerEventData_xk trackEventData_alt(evtStore(),m_prdToTrackMap.key()); - if(m_timers) m_timer[4]->start(); - m_trackmaker->newTrigEvent(trackEventData, PIX, SCT); - if(m_timers) m_timer[4]->stop(); - - // Loop through all seeds and reconsrtucted tracks collection preparation - // - - TrackCollection* foundTracks = new TrackCollection; - std::multimap<double,Trk::Track*> qualityTrack; - - m_nseeds = 0; - m_ntracks = 0; - - const InDet::SiSpacePointsSeed* seed = 0; - - if(m_timers) { - m_timer[3]->start();m_timer[3]->pause(); - m_timer[5]->start();m_timer[5]->pause(); - m_timer[6]->start();m_timer[6]->pause(); - } - - while(true) { - if(m_timers) m_timer[3]->resume(); - seed = m_seedsmaker->next(seedEventData); - if(m_timers) m_timer[3]->pause(); - - if(seed==0) break; - - ++m_nseeds; - if(m_timers) m_timer[5]->resume(); - std::list<Trk::Track*> T = m_trackmaker->getTracks(trackEventData, seed->spacePoints()); - if(m_timers) m_timer[5]->pause(); - if(m_timers) m_timer[6]->resume(); - for(std::list<Trk::Track*>::const_iterator t=T.begin(); t!=T.end(); ++t) { - if((*t)) - { - ++m_ntracks; - qualityTrack.insert(std::make_pair(-trackQuality((*t)),(*t))); - } - } - if(m_timers) m_timer[6]->pause(); - } - if(m_timers) { - m_timer[3]->propVal(m_nseeds); - m_timer[3]->stop(); - m_timer[5]->propVal(m_nseeds); - m_timer[5]->stop(); - m_timer[6]->propVal(m_ntracks); - m_timer[6]->stop(); - } - - - if(m_timers) m_timer[7]->start(); - m_trackmaker->endEvent(trackEventData); - if(m_timers) m_timer[7]->stop(); - - // Remove shared tracks with worse quality - // - - if(m_timers) m_timer[8]->start(); - filterSharedTracks(qualityTrack); - m_timer[8]->propVal(m_ntracks); - if(m_timers) m_timer[8]->stop(); - - std::multimap<double,Trk::Track*>::iterator - q = qualityTrack.begin(), qe =qualityTrack.end(); - - m_ntracks = 0; - - for(; q!=qe; ++q) { - foundTracks->push_back((*q).second); ++m_ntracks; - } - - if(m_timers) { - m_timer[0]->stop(); - m_pattRecoTiming=m_timer[0]->elapsed(); - } - - if (outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG << "REGTEST: Number of seeds found = " << m_nseeds << endmsg; - athenaLog << MSG::DEBUG << "REGTEST: Investigated " - << std::setw(7) << m_nseeds - << " seeds and found " - << std::setw(5) << foundTracks->size() <<" tracks" - << endmsg; - } - - for (size_t i=0; i<foundTracks->size() ; i++){ - TrigInDetTrack* p = convertOutputTracks(foundTracks->at(i)); - if(p!=NULL) { - trackColl->push_back(p); - } - } - - delete foundTracks; - - return rc; -} - - -HLT::ErrorCode TrigL2PattRecoStrategyC::findTracks(const std::vector<const TrigSiSpacePoint*>& //vsp - , - TrigInDetTrackCollection* trackColl) { - - m_pattRecoTiming=0.0; - m_zVertices.clear(); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - HLT::ErrorCode rc=HLT::OK; - if (outputLevel <= MSG::DEBUG) - athenaLog<< MSG::DEBUG<<"TrigL2PattRecoStrategyC called in full-scan mode "<<endmsg; - - StatusCode sc=convertInputData(); - - if(sc.isFailure()) { - athenaLog<< MSG::WARNING<<"Failed to convert input data into offline spacepoints "<<endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); - } - - //initialize monitoring variables - m_nseeds = 0; - m_ntracks= 0; - - // Test is sct clusters collection for given event - // - bool PIX = true; - bool SCT = true; - - InDet::SiSpacePointsSeedMakerEventData seedEventData; - std::list<Trk::Vertex> VZ; - - if(m_timers) m_timer[0]->start(); - if( m_useZvertexTool ) { - - if(m_timers) m_timer[9]->start(); - VZ = m_zvertexmaker->newEvent(seedEventData); - std::for_each(VZ.begin(),VZ.end(),ZVertexCopyFunctor(m_zVertices)); - if(m_timers) m_timer[9]->stop(); - if (outputLevel <= MSG::DEBUG) - athenaLog << MSG::DEBUG << "REGTEST: Number of zvertex found = " << VZ.size() << endmsg; - } - else{ - if(m_timers) m_timer[1]->start(); - m_seedsmaker->newEvent(seedEventData); - if(m_timers) m_timer[1]->stop(); - } - - if(m_timers) m_timer[2]->start(); - m_seedsmaker->find3Sp(seedEventData, VZ); - if(m_timers) m_timer[2]->stop(); - - if(m_timers) m_timer[4]->start(); - InDet::ExtendedSiTrackMakerEventData_xk trackEventData(m_prdToTrackMap); - m_trackmaker->newTrigEvent(trackEventData, PIX, SCT); - if(m_timers) m_timer[4]->stop(); - - // Loop through all seeds and reconsrtucted tracks collection preparation - // - - TrackCollection* foundTracks = new TrackCollection; - std::multimap<double,Trk::Track*> qualityTrack; - - m_nseeds = 0; - m_ntracks = 0; - - const InDet::SiSpacePointsSeed* seed = 0; - - if(m_timers) { - m_timer[3]->start();m_timer[3]->pause(); - m_timer[5]->start();m_timer[5]->pause(); - m_timer[6]->start();m_timer[6]->pause(); - } - - while(true) { - if(m_timers) m_timer[3]->resume(); - seed = m_seedsmaker->next(seedEventData); - if(m_timers) m_timer[3]->pause(); - - if(seed==0) break; - - ++m_nseeds; - if(m_timers) m_timer[5]->resume(); - std::list<Trk::Track*> T = m_trackmaker->getTracks(trackEventData, seed->spacePoints()); - if(m_timers) m_timer[5]->pause(); - if(m_timers) m_timer[6]->resume(); - for(std::list<Trk::Track*>::const_iterator t=T.begin(); t!=T.end(); ++t) { - if((*t)) - { - ++m_ntracks; - qualityTrack.insert(std::make_pair(-trackQuality((*t)),(*t))); - } - } - if(m_timers) m_timer[6]->pause(); - } - if(m_timers) { - m_timer[3]->propVal(m_nseeds); - m_timer[3]->stop(); - m_timer[5]->propVal(m_nseeds); - m_timer[5]->stop(); - m_timer[6]->propVal(m_ntracks); - m_timer[6]->stop(); - } - - - if(m_timers) m_timer[7]->start(); - m_trackmaker->endEvent(trackEventData); - if(m_timers) m_timer[7]->stop(); - - // Remove shared tracks with worse quality - // - - if(m_timers) m_timer[8]->start(); - filterSharedTracks(qualityTrack); - m_timer[8]->propVal(m_ntracks); - if(m_timers) m_timer[8]->stop(); - - std::multimap<double,Trk::Track*>::iterator - q = qualityTrack.begin(), qe =qualityTrack.end(); - - m_ntracks = 0; - - for(; q!=qe; ++q) { - foundTracks->push_back((*q).second); ++m_ntracks; - } - - if(m_timers) { - m_timer[0]->stop(); - m_pattRecoTiming=m_timer[0]->elapsed(); - } - - if (outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG << "REGTEST: Number of seeds found = " << m_nseeds << endmsg; - athenaLog << MSG::DEBUG << "REGTEST: Investigated " - << std::setw(7) << m_nseeds - << " seeds and found " - << std::setw(5) << foundTracks->size() <<" tracks" - << endmsg; - } - - for (size_t i=0; i<foundTracks->size() ; i++){ - TrigInDetTrack* p = convertOutputTracks(foundTracks->at(i)); - if(p!=NULL) { - trackColl->push_back(p); - } - } - - delete foundTracks; - - return rc; -} - - -/////////////////////////////////////////////////////////////////// -// Track quality calculation -/////////////////////////////////////////////////////////////////// - -double TrigL2PattRecoStrategyC::trackQuality(const Trk::Track* Tr) -{ - - DataVector<const Trk::TrackStateOnSurface>::const_iterator - m = Tr->trackStateOnSurfaces()->begin(), - me = Tr->trackStateOnSurfaces()->end (); - - double quality = 0. ; - double W = 17.; - - for(; m!=me; ++m) { - const Trk::FitQualityOnSurface* fq = (*m)->fitQualityOnSurface(); - if(!fq) continue; - - double x2 = fq->chiSquared(); - double q; - if(fq->numberDoF() == 2) q = (1.2*(W-x2*.5)); - else q = (W-x2 ); - if(q < 0.) q = 0.; - quality+=q; - } - return quality; -} - -/////////////////////////////////////////////////////////////////// -// Filter shared tracks -/////////////////////////////////////////////////////////////////// - -void TrigL2PattRecoStrategyC::filterSharedTracks(std::multimap<double,Trk::Track*>& QT) { - - std::set<const Trk::PrepRawData*> clusters; - std::multimap<double,Trk::Track*>::iterator q = QT.begin(); - - const Trk::PrepRawData* prd[100]; - - while(q!=QT.end()) { - - std::set<const Trk::PrepRawData*>::iterator fe = clusters.end(); - - DataVector<const Trk::MeasurementBase>::const_iterator - m = (*q).second->measurementsOnTrack()->begin(), - me = (*q).second->measurementsOnTrack()->end (); - - int nf = 0, nc = 0; - for(; m!=me; ++m) { - - const Trk::PrepRawData* pr = ((const Trk::RIO_OnTrack*)(*m))->prepRawData(); - if(pr) { - ++nc; if(clusters.find(pr)==fe) {prd[nf++]=pr; if(nf==100) break;} - } - } - - if(nf >= m_nfreeCut|| nf == nc) { - for(int n=0; n!=nf; ++n) clusters.insert(prd[n]); - ++q; - } - else { - delete (*q).second; QT.erase(q++); - } - } -} - -StatusCode TrigL2PattRecoStrategyC::convertInputData(const std::vector<IdentifierHash>& pixelIds, const std::vector<IdentifierHash>& sctIds) { - - //MsgStream athenaLog(msgSvc(), name()); - StatusCode sc = getIDCs(); - - if(sc.isFailure()) return sc; - - TrigL2SpacePointCollectionConverter<TrigL2SCT_SpacePointConverter> sctSpCnv(m_sctSpacePointsContainer, m_sctOnlineSpacePointsContainer); - std::for_each(sctIds.begin(),sctIds.end(),sctSpCnv); - TrigL2SpacePointCollectionConverter<TrigL2PixelSpacePointConverter> pixSpCnv(m_pixelSpacePointsContainer, m_pixelOnlineSpacePointsContainer); - std::for_each(pixelIds.begin(),pixelIds.end(),pixSpCnv); - - return sc; -} - -StatusCode TrigL2PattRecoStrategyC::convertInputData() { - - // MsgStream athenaLog(msgSvc(), name()); - - StatusCode sc = getIDCs(); - if(sc.isFailure()) return sc; - - TrigL2SpacePointCollectionConverter<TrigL2SCT_SpacePointConverter> sctSpCnv(m_sctSpacePointsContainer, m_sctOnlineSpacePointsContainer); - std::for_each( m_sctOnlineSpacePointsContainer->begin(),m_sctOnlineSpacePointsContainer->end(),sctSpCnv); - TrigL2SpacePointCollectionConverter<TrigL2PixelSpacePointConverter> pixSpCnv(m_pixelSpacePointsContainer, m_pixelOnlineSpacePointsContainer); - std::for_each( m_pixelOnlineSpacePointsContainer->begin(), m_pixelOnlineSpacePointsContainer->end(),pixSpCnv); - - return sc; -} - -StatusCode TrigL2PattRecoStrategyC::getIDCs() { -MsgStream athenaLog(msgSvc(), name()); - - StatusCode sc(StatusCode::SUCCESS); - - if( !evtStore()->transientContains<SpacePointContainer>(m_pixelSpacePointsName)){ - m_pixelSpacePointsContainer->cleanup(); - - if (evtStore()->record(m_pixelSpacePointsContainer, m_pixelSpacePointsName).isFailure()) { - athenaLog << MSG::WARNING << " Container " << m_pixelSpacePointsName - << " could not be recorded in StoreGate !" << endmsg; - } - else { - /* - athenaLog << MSG::DEBUG << "Container " << m_pixelSpacePointsName - << " registered in StoreGate" << endmsg; - */ - } - } - else { - sc = evtStore()->retrieve(m_pixelSpacePointsContainer, m_pixelSpacePointsName); - if (sc.isFailure()) { - athenaLog << MSG::ERROR << "Failed to get Pixel space point Container" << endmsg; - return sc; - } - else { - /* - athenaLog << MSG::DEBUG << "Got Pixel space point Container from TDS: " - << m_pixelSpacePointsName << endmsg; - */ - } - } - - if( !evtStore()->transientContains<SpacePointContainer>(m_sctSpacePointsName)){ - - m_sctSpacePointsContainer->cleanup(); - - if (evtStore()->record(m_sctSpacePointsContainer, m_sctSpacePointsName).isFailure()) { - athenaLog << MSG::WARNING << " Container " << m_sctSpacePointsName - << " could not be recorded in StoreGate !" << endmsg; - } - else { - /* - athenaLog << MSG::DEBUG << "Container " << m_sctSpacePointsName - << " registered in StoreGate" << endmsg; - */ - } - } - else { - sc = evtStore()->retrieve(m_sctSpacePointsContainer, m_sctSpacePointsName); - if (sc.isFailure()) { - athenaLog << MSG::ERROR << "Failed to get SCT space point Container" << endmsg; - return sc; - } - else { - /* - athenaLog << MSG::DEBUG << "Got SCT space point Container from TDS: " - << m_sctSpacePointsName << endmsg; - */ - } - } - - sc = evtStore()->retrieve(m_pixelOnlineSpacePointsContainer, m_pixelOnlineSpacePointsName); - if (sc.isFailure()) { - athenaLog << MSG::ERROR << "Failed to get Pixel SpacePoints Container " <<m_pixelOnlineSpacePointsName<< endmsg; - return sc; - } - else { - /* - athenaLog << MSG::DEBUG << "Got Pixel SpacePoints Container from TDS: " - << m_pixelOnlineClustersName << endmsg; - */ - } - - sc = evtStore()->retrieve(m_sctOnlineSpacePointsContainer, m_sctOnlineSpacePointsName); - if (sc.isFailure()) { - athenaLog << MSG::ERROR << "Failed to get SCT SpacePoints Container " <<m_sctOnlineSpacePointsName<< endmsg; - return sc; - } - else { - /* - athenaLog << MSG::DEBUG << "Got SCT SpacePoints Container from TDS: " - << m_pixelOnlineClustersName << endmsg; - */ - } - return sc; -} - -TrigInDetTrack* TrigL2PattRecoStrategyC::convertOutputTracks(Trk::Track* t) { - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - TrigInDetTrack* pTrack=NULL; - - std::vector<const TrigSiSpacePoint*>* pvsp = new std::vector<const TrigSiSpacePoint*>; - pvsp->clear(); - - std::vector<const TrigSiSpacePoint*> vpsctSP; - vpsctSP.clear(); - std::vector<const InDet::SCT_Cluster*> vpClust; - vpClust.clear(); - - DataVector<const Trk::MeasurementBase>::const_iterator mIt = t->measurementsOnTrack()->begin(); - for(; mIt!=t->measurementsOnTrack()->end();++mIt) { - const Trk::PrepRawData* pPRD = ((const Trk::RIO_OnTrack*)(*mIt))->prepRawData(); - if(pPRD) { - const InDet::SCT_Cluster* pSCT = dynamic_cast<const InDet::SCT_Cluster*>(pPRD); - if(pSCT) { - const IdentContIndex ici = pSCT->getHashAndIndex(); - // std::cout<<"SCT cluster hashId="<<ici.collHash()<<std::endl; - TrigSiSpacePointContainer::const_iterator spCollIt = m_sctOnlineSpacePointsContainer->indexFind(ici.collHash()); - if(spCollIt!=m_sctOnlineSpacePointsContainer->end()) { - // std::cout<<"Found ! iterating now looking for "<<pSCT->identify()<<std::endl; - for(TrigSiSpacePointCollection::const_iterator spIt=(*spCollIt)->begin();spIt!=(*spCollIt)->end();++spIt) { - if(pSCT->identify()==(*spIt)->clusters().first->identify()) { - // std::cout<<"Phi cluster detected, corresponding stereo id="<<(*spIt)->clusters().second->identify()<<std::endl; - vpsctSP.push_back((*spIt)); - } - } - } - else { - // std::cout<<"Not found, could be a stereo cluster, id="<<pSCT->identify()<<std::endl; - vpClust.push_back(pSCT); - } - } - else { - const InDet::PixelCluster* pPIX = dynamic_cast<const InDet::PixelCluster*>(pPRD); - if(pPIX) { - const IdentContIndex ici = pPIX->getHashAndIndex(); - // std::cout<<"Pixel cluster hashId="<<ici.collHash()<<std::endl; - TrigSiSpacePointContainer::const_iterator spCollIt = m_pixelOnlineSpacePointsContainer->indexFind(ici.collHash()); - if(spCollIt!=m_pixelOnlineSpacePointsContainer->end()) { - // std::cout<<"Found ! iterating now"<<std::endl; - for(TrigSiSpacePointCollection::const_iterator spIt=(*spCollIt)->begin();spIt!=(*spCollIt)->end();++spIt) { - if(pPIX->identify()==(*spIt)->clusters().first->identify()) { - // std::cout<<"Pixel cluster detected"<<std::endl; - pvsp->push_back((*spIt)); - // std::cout<<"sp stored"<<std::endl; - } - } - } - else { - std::cout<<"ERROR PIXEL CL NOT FOUND IN SP id="<<pPIX->identify()<<std::endl; - } - } - } - } - } - - // resolving stereo clusters - int nClust = vpClust.size(); - for(std::vector<const TrigSiSpacePoint*>::const_iterator spIt=vpsctSP.begin();spIt!=vpsctSP.end();++spIt) { - for(std::vector<const InDet::SCT_Cluster*>::const_iterator clIt=vpClust.begin();clIt!=vpClust.end();++clIt) { - if((*spIt)->clusters().second->identify()==(*clIt)->identify()) { - pvsp->push_back(*spIt); - --nClust; - } - } - } - if (outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG <<nClust<<" SCT clusters left unassigned "<<endmsg; - } - - if(pvsp->empty() || (pvsp->size()<4)) { - delete pvsp; - return pTrack; - } - - if (outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG <<"created vector with "<<pvsp->size()<<" spacepoints"<<endmsg; - } - - // std::cout<<(*t)<<std::endl; - - const Trk::TrackParameters* trackPars; - trackPars = t->perigeeParameters(); - - if(trackPars==NULL) { - delete pvsp; - return pTrack; - } - - double D0 = trackPars->parameters()[Trk::d0]; - double Z0 = trackPars->parameters()[Trk::z0]; - double Phi0 = trackPars->parameters()[Trk::phi0]; - double Theta = trackPars->parameters()[Trk::theta]; - if(Phi0>M_PI) Phi0-=2*M_PI; - if(Phi0<-M_PI) Phi0+=2*M_PI; - double Eta = -log(sin(0.5*Theta)/cos(0.5*Theta)); - - double qOverP = trackPars->parameters()[Trk::qOverP]; - double Pt=sin(Theta)/qOverP; - - // delete trackPars; - - const TrigInDetTrackFitPar* tidtfp = new TrigInDetTrackFitPar(D0,Phi0,Z0,Eta,Pt,NULL); - - pTrack = new TrigInDetTrack(pvsp,tidtfp); - pTrack->algorithmId(TrigInDetTrack::STRATEGY_C_ID); - - return pTrack; - -} diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyT.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyT.cxx deleted file mode 100644 index e6e00ba5e830831c62b9060019832a90845d0979..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2PattRecoStrategyT.cxx +++ /dev/null @@ -1,1054 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -//////////////////////////////////////////////////////////////////////////////// -// TrigL2PattRecoStrategyT -// ------------------------------- -// ATLAS Collaboration -// -// 15.03.2011 Package created -// -// Author: Dmitry Emeliyanov, RAL -// e-mail: Dmitry.Emeliyanov@cern.ch -// -// implements TRT seeded backtracking strategy based on I.Gavrilenko's -// offline reconstruction tools -// -//////////////////////////////////////////////////////////////////////////////// - -#include <cmath> -#include <iostream> -#include <list> - -#include "TrigInDetEvent/TrigInDetTrack.h" -#include "TrigInDetEvent/TrigInDetTrackCollection.h" - -#include "TrigInDetRecoTools/ITrigL2PattRecoStrategy.h" - -#include "IRegionSelector/IRoiDescriptor.h" - -#include "InDetRecToolInterfaces/ITRT_SeededTrackFinder.h" -#include "SiSPSeededTrackFinderData/SiCombinatorialTrackFinderData_xk.h" - -#include "TrkRIO_OnTrack/RIO_OnTrack.h" - -#include "InDetIdentifier/PixelID.h" -#include "InDetIdentifier/SCT_ID.h" -#include "InDetIdentifier/TRT_ID.h" - -//#include "TrkSurfaces/PerigeeSurface.h" -#include "TrkTrack/TrackCollection.h" -#include "SiSpacePoint/SCT_SpacePoint.h" -#include "SiSpacePoint/PixelSpacePoint.h" -#include "TrkSpacePoint/SpacePoint.h" -//#include "TrkSpacePoint/SpacePointCollection.h" -#include "TrkSpacePoint/SpacePointContainer.h" -//#include "InDetPrepRawData/SiClusterContainer.h" -#include "InDetPrepRawData/PixelCluster.h" -#include "InDetPrepRawData/SCT_Cluster.h" -//#include "InDetPrepRawData/PixelClusterCollection.h" -//#include "InDetPrepRawData/SCT_ClusterCollection.h" -//#include "InDetPrepRawData/TRT_DriftCircleContainer.h" - -//#include "DataModel/tools/IdentContIndex.h" - -#include "TrkEventPrimitives/FitQuality.h" -#include "TrkEventPrimitives/ParamDefs.h" -#include "TrkSegment/SegmentCollection.h" -#include "InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h" -#include "TrkParameters/TrackParameters.h" - -#include "TrigTimeAlgs/TrigTimerSvc.h" - -#include "IRegionSelector/IRegSelSvc.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" - -#include "TrigInDetRecoTools/TrigL2PattRecoStrategyT.h" - -TrigL2PattRecoStrategyT::TrigL2PattRecoStrategyT(const std::string& t, - const std::string& n, - const IInterface* p ): - AthAlgTool(t,n,p), - - m_nfreeCut(5), - m_minTrtHits(10), - m_trackmaker("InDet::TRT_SeededTrackFinderTool"), - m_regionSelector("RegSelSvc", n), - m_trtDataProvider("TrigTRT_DriftCircleProviderTool"), - m_robDataProvider("ROBDataProviderSvc",this->name()), - m_trtFilteredContName ("TRT_FilteredDriftCircles"), - m_sctOnlineSpacePointsName("TrigSCT_SpacePoints"), - m_pixelOnlineSpacePointsName("TrigPixelSpacePoints") -{ - declareInterface< ITrigL2SeededPattRecoStrategy >( this ); - - declareProperty("TrackTool" ,m_trackmaker ); - declareProperty("FreeClustersCut" ,m_nfreeCut ); - declareProperty("MinTrtHitsCut" , m_minTrtHits ); - declareProperty( "TRT_FilteredContainerName",m_trtFilteredContName="TRT_FilteredDriftCircles"); - declareProperty( "TRT_ContainerName",m_trtContName="TRT_DriftCircle"); - declareProperty( "SegmentsMakerTool",m_segmentsmaker); - -} - -StatusCode TrigL2PattRecoStrategyT::initialize() -{ - StatusCode sc = AthAlgTool::initialize(); - MsgStream athenaLog(msgSvc(), name()); - - // Get track-finding tool - sc = m_trackmaker.retrieve(); - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL << "Failed to retrieve tool " << m_trackmaker << endmsg; - return sc; - } - else { - athenaLog << MSG::INFO << "Retrieved tool " << m_trackmaker << endmsg; - } - - sc = m_regionSelector.retrieve(); - if ( sc.isFailure() ) { - athenaLog << MSG::FATAL<< "Unable to retrieve RegionSelector tool "<< m_regionSelector.type() << endmsg; - return sc; - } - - sc = m_robDataProvider.retrieve(); - if(sc.isFailure()) { - athenaLog << MSG::ERROR << "Unable to retrieve ROBDataProviderSvc" <<m_robDataProvider <<endmsg; - return StatusCode::FAILURE; - } - - sc = m_trtDataProvider.retrieve(); - if(sc.isFailure()) { - athenaLog << MSG::FATAL << "Unable to locate TRT data provider tool " <<m_trtDataProvider<< endmsg; - return sc; - } - - sc = m_segmentsmaker.retrieve(); - if( sc.isFailure() ) { - athenaLog <<"Could not get TRT_TrackSegmentsMaker tool "<<m_segmentsmaker<<endmsg; - return sc; - } - - // Get SCT & pixel Identifier helpers - - if (detStore()->retrieve(m_pixelId, "PixelID").isFailure()) { - athenaLog << MSG::FATAL << "Could not get Pixel ID helper" << endmsg; - return StatusCode::FAILURE; - } - - if (detStore()->retrieve(m_sctId, "SCT_ID").isFailure()) { - athenaLog << MSG::FATAL << "Could not get SCT ID helper" << endmsg; - return StatusCode::FAILURE; - } - - ATH_CHECK( m_prdToTrackMap.initialize(m_prdToTrackMap.key().empty() )); - - m_filteredDriftCircleContainer = new InDet::TRT_DriftCircleContainer(m_trtId->straw_layer_hash_max()); - m_filteredDriftCircleContainer->addRef(); - - - ITrigTimerSvc* timerSvc; - StatusCode scTime = service( "TrigTimerSvc", timerSvc); - if( scTime.isFailure() ) { - athenaLog << MSG::INFO<< "Unable to locate Service TrigTimerSvc " << endmsg; - m_timers = false; - } - else{ - m_timers = true; - } - if ( m_timers ) { - m_timer[0] = timerSvc->addItem("StrT_PattReco"); - m_timer[1] = timerSvc->addItem("Seed_NE"); - m_timer[2] = timerSvc->addItem("Seed_Prod"); - m_timer[3] = timerSvc->addItem("Seed_Ret"); - m_timer[3]->propName("Seed_Ret.nSeed"); - m_timer[4] = timerSvc->addItem("TMak_NE"); - m_timer[5] = timerSvc->addItem("TMak_Get"); - m_timer[5]->propName("TMak_Get.nSeed"); - m_timer[6] = timerSvc->addItem("TMak_Qm"); - m_timer[6]->propName("TMak_Qm.nTracks"); - m_timer[7] = timerSvc->addItem("TMak_EE"); - m_timer[8] = timerSvc->addItem("TrackFilt"); - m_timer[8]->propName("TrackFlt.nTracks"); - m_timer[9] = timerSvc->addItem("ZVMaker"); - - } - - athenaLog << MSG::INFO << "TrigL2PattRecoStrategyT initialized "<< endmsg; - return sc; -} - -StatusCode TrigL2PattRecoStrategyT::finalize() { - - m_filteredDriftCircleContainer->cleanup(); - m_filteredDriftCircleContainer->release(); - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - -TrigL2PattRecoStrategyT::~TrigL2PattRecoStrategyT() { - -} - -namespace InDet { - class ExtendedSiCombinatorialTrackFinderData_xk : public SiCombinatorialTrackFinderData_xk { - public: - ExtendedSiCombinatorialTrackFinderData_xk(const SG::ReadHandleKey<Trk::PRDtoTrackMap> &key) { - if (!key.key().empty()) { - m_prdToTrackMap = SG::ReadHandle<Trk::PRDtoTrackMap>(key); - if (!m_prdToTrackMap.isValid()) { - throw std::runtime_error(std::string("Failed to get PRD to track map:") + key.key()); - } - setPRDtoTrackMap(m_prdToTrackMap.cptr()); - } - } - - protected: - void dummy() override {} - SG::ReadHandle<Trk::PRDtoTrackMap> m_prdToTrackMap; - }; - - // Alternative veriosn with direct access if read handles do not work here: - // InDet::AltExtendedSiCombinatorialTrackFinderData_xk combinatorialData(evtStore(),m_prdToTrackMap.key()); - class AltExtendedSiCombinatorialTrackFinderData_xk : public SiCombinatorialTrackFinderData_xk { - public: - AltExtendedSiCombinatorialTrackFinderData_xk(ServiceHandle<StoreGateSvc> &event_store, - const std::string &key) { - if (!key.empty()) { - const Trk::PRDtoTrackMap *prd_to_track_map_cptr = nullptr; - if (event_store->retrieve(prd_to_track_map_cptr, key).isFailure()) { - throw std::runtime_error(std::string("Failed to get PRD to track map:") + key); - } - setPRDtoTrackMap(prd_to_track_map_cptr); - } - } - - protected: - void dummy() override {} - }; - -} - -HLT::ErrorCode TrigL2PattRecoStrategyT::findTracks(const TrigInDetTrackCollection& inputTrackColl, - const std::vector<const TrigSiSpacePoint*>& //vsp - , - const IRoiDescriptor& roi, - TrigInDetTrackCollection* trackColl - ) { - - m_pattRecoTiming=0.0; - HLT::ErrorCode rc=HLT::OK; - - m_zVertices.clear(); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - if (outputLevel <= MSG::DEBUG) - athenaLog<< MSG::DEBUG<<"TrigL2PattRecoStrategyT called in RoI-based mode "<<endmsg; - - - StatusCode sc = getIDCs(); - if(sc.isFailure()) { - athenaLog<<MSG::WARNING<<"Cannot retrieve SCT and Pixel SP IDCs "<<endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); - } - - std::vector<IdentifierHash> listOfFilteredTrtIds; - - sc = getFilteredTRT_Hits(inputTrackColl,roi,listOfFilteredTrtIds); - - if(sc.isFailure()) { - athenaLog<<MSG::WARNING<<"Failure in TRT hit filtering "<<endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); - } - - std::unique_ptr<InDet::ITRT_TrackSegmentsMaker::IEventData> - event_data = m_segmentsmaker->newRegion(listOfFilteredTrtIds); - m_segmentsmaker->find(*event_data); - - Trk::Segment* segment = 0; - int nsegments = 0; - - // Loop through all segments and reconsrtucted segments collection preparation - - Trk::SegmentCollection* foundSegments = new Trk::SegmentCollection; - - while((segment = m_segmentsmaker->next(*event_data))) { - ++nsegments; foundSegments->push_back(segment); - } - - m_segmentsmaker->endEvent(*event_data); - - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "REGTEST: Found " << nsegments << " TRT segments" << endmsg; - - if(nsegments==0) - return rc; - - std::vector<IdentifierHash> listOfSCTIds; - std::vector<IdentifierHash> listOfPixIds; - - m_regionSelector->DetHashIDList(SCT, roi, listOfSCTIds ); - m_regionSelector->DetHashIDList(PIXEL, roi, listOfPixIds); - - InDet::AltExtendedSiCombinatorialTrackFinderData_xk combinatorialData_alt(evtStore(),m_prdToTrackMap.key()); - InDet::ExtendedSiCombinatorialTrackFinderData_xk combinatorialData(m_prdToTrackMap); - std::unique_ptr<InDet::ITRT_SeededTrackFinder::IEventData> event_data_p( m_trackmaker->newRegion(combinatorialData, - listOfPixIds, - listOfSCTIds) ); //RoI-based reconstruction - - TrackCollection* tempTracks = new TrackCollection; //Temporary track collection per event - - int nTrtSegGood=0; - - for(Trk::SegmentCollection::iterator segIt=foundSegments->begin();segIt!=foundSegments->end();++segIt) { - - const Trk::Segment* trtSegment = (*segIt); - - const Trk::TrackSegment* trtTrack = dynamic_cast<const Trk::TrackSegment*>(trtSegment); - - int nTrtHits = (*segIt)->numberOfMeasurementBases(); - - if(outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "Number Of Trt hits " << nTrtHits << endmsg; - if(nTrtHits<m_minTrtHits) { - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "Found segment with too few TRT hits = " << nTrtHits << endmsg; - continue; - } - - nTrtSegGood++; - std::list<Trk::Track*> trackSi = m_trackmaker->getTrack(*event_data_p, *trtTrack); //Get the possible Si extensions - - if(trackSi.size()==0){ - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "No Si track candidates associated to the TRT track " << endmsg; - continue; - } - - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "REGTEST: Found " << (trackSi.size()) << " Si tracks associated to the TRT track " - << endmsg; - - for (std::list<Trk::Track*>::const_iterator itt = trackSi.begin(); itt != trackSi.end(); ++itt){ - - tempTracks->push_back((*itt)); - - const DataVector<const Trk::TrackStateOnSurface>* temptsos = (*itt)->trackStateOnSurfaces(); - - if(!temptsos) continue; - - createTriggerTrack(**itt,*trtTrack,trackColl); - } - } - - delete tempTracks; - delete foundSegments; - - return rc; - -} - - -HLT::ErrorCode TrigL2PattRecoStrategyT::findTracks(const TrigInDetTrackCollection& //inputTrackColl - , - const std::vector<const TrigSiSpacePoint*>& //vsp - , - TrigInDetTrackCollection* //trackColl - ) { - - m_pattRecoTiming=0.0; - m_zVertices.clear(); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - HLT::ErrorCode rc=HLT::OK; - if (outputLevel <= MSG::DEBUG) - athenaLog<< MSG::DEBUG<<"TrigL2PattRecoStrategyT called in full-scan mode "<<endmsg; - - /* - StatusCode sc=convertInputData(); - - if(sc.isFailure()) { - athenaLog<< MSG::WARNING<<"Failed to convert input data into offline spacepoints "<<endmsg; - return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); - } - - //initialize monitoring variables - m_nseeds = 0; - m_ntracks= 0; - - // Test is sct clusters collection for given event - // - bool PIX = true; - bool SCT = true; - - std::list<Trk::Vertex> VZ; - - if(m_timers) m_timer[0]->start(); - if( m_useZvertexTool ) { - - if(m_timers) m_timer[9]->start(); - m_zvertexmaker->newEvent(); - VZ = m_zvertexmaker->getVertices(); - std::for_each(VZ.begin(),VZ.end(),ZVertexCopyFunctor(m_zVertices)); - if(m_timers) m_timer[9]->stop(); - if (outputLevel <= MSG::DEBUG) - athenaLog << MSG::DEBUG << "REGTEST: Number of zvertex found = " << VZ.size() << endmsg; - } - else{ - if(m_timers) m_timer[1]->start(); - m_seedsmaker->newEvent(); - if(m_timers) m_timer[1]->stop(); - } - - if(m_timers) m_timer[2]->start(); - m_seedsmaker->find3Sp(VZ); - if(m_timers) m_timer[2]->stop(); - - if(m_timers) m_timer[4]->start(); - InDet::SiCombinatorialTrackFinderData_xk combinatorialData; - m_trackmaker->newTrigEvent(combinatorialData, PIX, SCT); - if(m_timers) m_timer[4]->stop(); - - // Loop through all seeds and reconsrtucted tracks collection preparation - // - - TrackCollection* foundTracks = new TrackCollection; - std::multimap<double,Trk::Track*> qualityTrack; - - m_nseeds = 0; - m_ntracks = 0; - - const InDet::SiSpacePointsSeed* seed = 0; - - if(m_timers) { - m_timer[3]->start();m_timer[3]->pause(); - m_timer[5]->start();m_timer[5]->pause(); - m_timer[6]->start();m_timer[6]->pause(); - } - - while(true) { - if(m_timers) m_timer[3]->resume(); - seed = m_seedsmaker->next(); - if(m_timers) m_timer[3]->pause(); - - if(seed==0) break; - - ++m_nseeds; - if(m_timers) m_timer[5]->resume(); - const std::list<Trk::Track*>& T = m_trackmaker->getTracks(combinatorialData, seed->spacePoints()); - if(m_timers) m_timer[5]->pause(); - if(m_timers) m_timer[6]->resume(); - for(std::list<Trk::Track*>::const_iterator t=T.begin(); t!=T.end(); ++t) { - if((*t)) - { - ++m_ntracks; - qualityTrack.insert(std::make_pair(-trackQuality((*t)),(*t))); - } - } - if(m_timers) m_timer[6]->pause(); - } - if(m_timers) { - m_timer[3]->propVal(m_nseeds); - m_timer[3]->stop(); - m_timer[5]->propVal(m_nseeds); - m_timer[5]->stop(); - m_timer[6]->propVal(m_ntracks); - m_timer[6]->stop(); - } - - - if(m_timers) m_timer[7]->start(); - m_trackmaker->endEvent(combinatorialData); - if(m_timers) m_timer[7]->stop(); - - // Remove shared tracks with worse quality - // - - if(m_timers) m_timer[8]->start(); - filterSharedTracks(qualityTrack); - m_timer[8]->propVal(m_ntracks); - if(m_timers) m_timer[8]->stop(); - - std::multimap<double,Trk::Track*>::iterator - q = qualityTrack.begin(), qe =qualityTrack.end(); - - m_ntracks = 0; - - for(; q!=qe; ++q) { - foundTracks->push_back((*q).second); ++m_ntracks; - } - - if(m_timers) { - m_timer[0]->stop(); - m_pattRecoTiming=m_timer[0]->elapsed(); - } - - if (outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG << "REGTEST: Number of seeds found = " << m_nseeds << endmsg; - athenaLog << MSG::DEBUG << "REGTEST: Investigated " - << std::setw(7) << m_nseeds - << " seeds and found " - << std::setw(5) << foundTracks->size() <<" tracks" - << endmsg; - } - - for (size_t i=0; i<foundTracks->size() ; i++){ - TrigInDetTrack* p = convertOutputTracks(foundTracks->at(i)); - if(p!=NULL) { - trackColl->push_back(p); - } - } - - delete foundTracks; - */ - - return rc; -} - - -/////////////////////////////////////////////////////////////////// -// Track quality calculation -/////////////////////////////////////////////////////////////////// -/* -double TrigL2PattRecoStrategyT::trackQuality(const Trk::Track* Tr) -{ - - DataVector<const Trk::TrackStateOnSurface>::const_iterator - m = Tr->trackStateOnSurfaces()->begin(), - me = Tr->trackStateOnSurfaces()->end (); - - double quality = 0. ; - double W = 17.; - - for(; m!=me; ++m) { - const Trk::FitQualityOnSurface* fq = (*m)->fitQualityOnSurface(); - if(!fq) continue; - - double x2 = fq->chiSquared(); - double q; - if(fq->numberDoF() == 2) q = (1.2*(W-x2*.5)); - else q = (W-x2 ); - if(q < 0.) q = 0.; quality+=q; - } - return quality; -} - -/////////////////////////////////////////////////////////////////// -// Filter shared tracks -/////////////////////////////////////////////////////////////////// - -void TrigL2PattRecoStrategyT::filterSharedTracks(std::multimap<double,Trk::Track*>& QT) { - - std::set<const Trk::PrepRawData*> clusters; - std::multimap<double,Trk::Track*>::iterator q = QT.begin(); - - const Trk::PrepRawData* prd[100]; - - while(q!=QT.end()) { - - std::set<const Trk::PrepRawData*>::iterator fe = clusters.end(); - - DataVector<const Trk::MeasurementBase>::const_iterator - m = (*q).second->measurementsOnTrack()->begin(), - me = (*q).second->measurementsOnTrack()->end (); - - int nf = 0, nc = 0; - for(; m!=me; ++m) { - - const Trk::PrepRawData* pr = ((const Trk::RIO_OnTrack*)(*m))->prepRawData(); - if(pr) { - ++nc; if(clusters.find(pr)==fe) {prd[nf++]=pr; if(nf==100) break;} - } - } - - if(nf >= m_nfreeCut|| nf == nc) { - for(int n=0; n!=nf; ++n) clusters.insert(prd[n]); ++q; - } - else { - delete (*q).second; QT.erase(q++); - } - } -} -*/ - -void TrigL2PattRecoStrategyT::createTriggerTrack(const Trk::Track& siTrack - , - const Trk::TrackSegment& trtTrack - , - TrigInDetTrackCollection* trackColl - ) { - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - TrigInDetTrack* pTrack=NULL; - - //converting the silicon part - - std::vector<const TrigSiSpacePoint*>* pvsp = new std::vector<const TrigSiSpacePoint*>; - pvsp->clear(); - - std::vector<const TrigSiSpacePoint*> vpsctSP; - vpsctSP.clear(); - std::vector<const InDet::SCT_Cluster*> vpClust; - vpClust.clear(); - - DataVector<const Trk::MeasurementBase>::const_iterator mIt = siTrack.measurementsOnTrack()->begin(); - for(; mIt!=siTrack.measurementsOnTrack()->end();++mIt) { - const Trk::PrepRawData* pPRD = ((const Trk::RIO_OnTrack*)(*mIt))->prepRawData(); - if(pPRD) { - const InDet::SCT_Cluster* pSCT = dynamic_cast<const InDet::SCT_Cluster*>(pPRD); - if(pSCT) { - const IdentContIndex ici = pSCT->getHashAndIndex(); - // std::cout<<"SCT cluster hashId="<<ici.collHash()<<std::endl; - TrigSiSpacePointContainer::const_iterator spCollIt = m_sctOnlineSpacePointsContainer->indexFind(ici.collHash()); - if(spCollIt!=m_sctOnlineSpacePointsContainer->end()) { - // std::cout<<"Found ! iterating now looking for "<<pSCT->identify()<<std::endl; - for(TrigSiSpacePointCollection::const_iterator spIt=(*spCollIt)->begin();spIt!=(*spCollIt)->end();++spIt) { - if(pSCT->identify()==(*spIt)->clusters().first->identify()) { - // std::cout<<"Phi cluster detected, corresponding stereo id="<<(*spIt)->clusters().second->identify()<<std::endl; - vpsctSP.push_back((*spIt)); - } - } - } - else { - // std::cout<<"Not found, could be a stereo cluster, id="<<pSCT->identify()<<std::endl; - vpClust.push_back(pSCT); - } - } - else { - const InDet::PixelCluster* pPIX = dynamic_cast<const InDet::PixelCluster*>(pPRD); - if(pPIX) { - const IdentContIndex ici = pPIX->getHashAndIndex(); - // std::cout<<"Pixel cluster hashId="<<ici.collHash()<<std::endl; - TrigSiSpacePointContainer::const_iterator spCollIt = m_pixelOnlineSpacePointsContainer->indexFind(ici.collHash()); - if(spCollIt!=m_pixelOnlineSpacePointsContainer->end()) { - // std::cout<<"Found ! iterating now"<<std::endl; - for(TrigSiSpacePointCollection::const_iterator spIt=(*spCollIt)->begin();spIt!=(*spCollIt)->end();++spIt) { - if(pPIX->identify()==(*spIt)->clusters().first->identify()) { - // std::cout<<"Pixel cluster detected"<<std::endl; - pvsp->push_back((*spIt)); - // std::cout<<"sp stored"<<std::endl; - } - } - } - else { - std::cout<<"ERROR PIXEL CL NOT FOUND IN SP id="<<pPIX->identify()<<std::endl; - } - } - } - } - } - - // resolving stereo clusters - int nClust = vpClust.size(); - for(std::vector<const TrigSiSpacePoint*>::const_iterator spIt=vpsctSP.begin();spIt!=vpsctSP.end();++spIt) { - for(std::vector<const InDet::SCT_Cluster*>::const_iterator clIt=vpClust.begin();clIt!=vpClust.end();++clIt) { - if((*spIt)->clusters().second->identify()==(*clIt)->identify()) { - pvsp->push_back(*spIt); - --nClust; - } - } - } - if (outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG <<nClust<<" SCT clusters left unassigned "<<endmsg; - } - - if(pvsp->empty()) { - delete pvsp; - return; - } - - if (outputLevel <= MSG::DEBUG) { - athenaLog << MSG::DEBUG <<"created vector with "<<pvsp->size()<<" spacepoints"<<endmsg; - } - - // converting the TRT part - - int nTR=0,nTime=0,nHits=0; - bool validDT=false; - - std::vector<const Trk::MeasurementBase*>::const_iterator s = trtTrack.containedMeasurements().begin(), - se = trtTrack.containedMeasurements().end(); - - std::vector<const InDet::TRT_DriftCircle*>* pvDC=new std::vector<const InDet::TRT_DriftCircle*>; - - for(++s; s!=se; ++s) { - if (!(dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(*s))) continue; - const InDet::TRT_DriftCircle* dc = (dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(*s))->prepRawData(); - if(dc!=0){ - nHits++; - pvDC->push_back(dc); - if(dc->highLevel()) nTR++; - dc->driftTime(validDT); - if(validDT) nTime++; - } - } - - pTrack->StrawHits(nHits); - pTrack->StrawTime(nTime); - pTrack->TRHits(nTR); - - pTrack->trtDriftCircles(pvDC); - - // now track parameters; - - const Trk::TrackParameters* trackPars; - trackPars = siTrack.perigeeParameters(); - - double D0 = trackPars->parameters()[Trk::d0]; - double Z0 = trackPars->parameters()[Trk::z0]; - double Phi0 = trackPars->parameters()[Trk::phi0]; - double Theta = trackPars->parameters()[Trk::theta]; - if(Phi0>M_PI) Phi0-=2*M_PI; - if(Phi0<-M_PI) Phi0+=2*M_PI; - double Eta = -log(sin(0.5*Theta)/cos(0.5*Theta)); - - double qOverP = trackPars->parameters()[Trk::qOverP]; - double Pt=sin(Theta)/qOverP; - - const TrigInDetTrackFitPar* tidtfp = new TrigInDetTrackFitPar(D0,Phi0,Z0,Eta,Pt,NULL); - - pTrack = new TrigInDetTrack(pvsp,tidtfp); - pTrack->algorithmId(TrigInDetTrack::STRATEGY_C_ID); - - trackColl->push_back(pTrack); -} - -StatusCode TrigL2PattRecoStrategyT::getFilteredTRT_Hits(const TrigInDetTrackCollection& inputTrackColl, - const IRoiDescriptor& roi, - std::vector<IdentifierHash>& listOfFilteredTrtIds) { - - StatusCode sc(StatusCode::SUCCESS); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - std::vector<IdentifierHash> listOfTrtIds; - - //1. Collect used TRT hits - - m_filteredDriftCircleContainer->cleanup(); - if(!evtStore()->contains<InDet::TRT_DriftCircleContainer>(m_trtFilteredContName)) - { - StatusCode sc=evtStore()->record(m_filteredDriftCircleContainer,m_trtFilteredContName,false); - if(sc.isFailure()) - { - athenaLog << MSG::WARNING << "TRT DriftCircleContainer " << m_trtFilteredContName << - " cannot be recorded into StoreGate! "<<endmsg; - return sc; - } - else - { - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO<<"TRT DriftCircleContainer " << m_trtFilteredContName << - " recorded into StoreGate! "<<endmsg; - } - } - - std::set<Identifier> usedHits; - usedHits.clear(); - if(!inputTrackColl.empty()) { - - //1a. loop over input tracks, build a set of used TRT hits - - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "Total " << inputTrackColl.size()<<" input tracks..."<< endmsg; - - TrigInDetTrackCollection::const_iterator trIt,lastIt; - - trIt = inputTrackColl.begin();lastIt = inputTrackColl.end(); - for(; trIt !=lastIt; trIt++) { - if((*trIt)->trtDriftCircles()==NULL) continue; - std::vector<const InDet::TRT_DriftCircle*>::iterator hitIt=(*trIt)->trtDriftCircles()->begin(), - hitItEnd=(*trIt)->trtDriftCircles()->end(); - for(;hitIt!=hitItEnd;++hitIt) - usedHits.insert((*hitIt)->identify()); - } - } - - //2. retrieve TRT hits from a given RoI - - m_regionSelector->DetHashIDList(TRT, roi, listOfTrtIds); - - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO<< listOfTrtIds.size() << " REGTEST: TRT Dets in region" << endmsg; - - std::vector<unsigned int> uIntListOfTRTRobs; - - m_regionSelector->DetROBIDListUint(TRT, uIntListOfTRTRobs); - m_robDataProvider->addROBData(uIntListOfTRTRobs); - m_vROBF.clear(); - m_robDataProvider->getROBData(uIntListOfTRTRobs,m_vROBF); - // m_trtDataErrors.clear(); - - sc = m_trtDataProvider->fillCollections(listOfTrtIds,m_vROBF); - - - if(sc.isRecoverable()) - { - if(outputLevel <= MSG::INFO) - athenaLog<<MSG::INFO<<"Recoverable errors during TRT BS conversion "<<endmsg; - /* - const std::vector<int>* errVect = m_trtDataProvider->fillTRT_DataErrors(); - std::copy(errVect->begin(),errVect->end(),std::back_inserter(m_trtDataErrors)); - */ - } - else if(sc.isFailure()) - { - athenaLog << MSG::WARNING << " TRT Data provider failed" << endmsg; - return sc; - } - - // 3. Retrieve IDC - - const InDet::TRT_DriftCircleContainer* trtContainer; - sc=evtStore()->retrieve(trtContainer,m_trtDataProvider->trtContainerName()); - if(sc.isFailure()) - { - athenaLog<<MSG::WARNING<<"TRT DriftCircle container is not found: name " - <<m_trtDataProvider->trtContainerName()<< - " pointer="<<trtContainer<< endmsg; - return sc; - } - if(outputLevel <= MSG::INFO) - athenaLog<<MSG::INFO<<"TRT DriftCircle container retrieved"<<endmsg; - - int nTotalHits=0; - int nFilteredHits=0; - - // 4. collect unused TRT hits - - listOfFilteredTrtIds.clear(); - - - for(std::vector<IdentifierHash>::iterator idIt=listOfTrtIds.begin();idIt!=listOfTrtIds.end();++idIt){ - - InDet::TRT_DriftCircleContainer::const_iterator collIt(trtContainer->indexFind(*idIt)); - if(collIt==trtContainer->end()) continue; - - const InDet::TRT_DriftCircleCollection* coll=&(**collIt); - if(coll->begin()==coll->end()) continue; - - InDet::TRT_DriftCircleCollection* pNewColl=NULL; - pNewColl = new InDet::TRT_DriftCircleCollection(coll->identifyHash()); - pNewColl->setIdentifier(coll->identify()); - - for(InDet::TRT_DriftCircleCollection::const_iterator dcIt=coll->begin();dcIt!=coll->end();++dcIt) { - Identifier dcId = (*dcIt)->identify(); - nTotalHits++; - if(usedHits.find(dcId)!=usedHits.end()) continue; - - InDet::TRT_DriftCircle* pRIO = new InDet::TRT_DriftCircle(**dcIt); - - pRIO->setHashAndIndex(pNewColl->identifyHash(), pNewColl->size()); - /* - std::cout<<"Old DC:"<<std::endl; - std::cout<<(**dcIt)<<std::endl; - std::cout<<"Copy DC:"<<std::endl; - std::cout<<(*pRIO)<<std::endl; - */ - pNewColl->push_back(pRIO); - nFilteredHits++; - } - StatusCode scColl = m_filteredDriftCircleContainer->addCollection(pNewColl,pNewColl->identifyHash()); - listOfFilteredTrtIds.push_back(pNewColl->identifyHash()); - if(scColl.isFailure()) { - athenaLog<<MSG::WARNING<<"Cannot store collection in IDC "<< endmsg; - } - } - - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "Total " << nTotalHits <<" TRT hits in RoI, "<<nFilteredHits<<" left after filtering"<< endmsg; - - return sc; -} - - -StatusCode TrigL2PattRecoStrategyT::getFilteredTRT_Hits(const TrigInDetTrackCollection& inputTrackColl, - std::vector<IdentifierHash>& listOfFilteredTrtIds) { - - StatusCode sc(StatusCode::SUCCESS); - - MsgStream athenaLog(msgSvc(), name()); - int outputLevel = msgSvc()->outputLevel( name() ); - - std::vector<IdentifierHash> listOfTrtIds; - - //1. Collect used TRT hits - - m_filteredDriftCircleContainer->cleanup(); - if(!evtStore()->contains<InDet::TRT_DriftCircleContainer>(m_trtFilteredContName)) - { - StatusCode sc=evtStore()->record(m_filteredDriftCircleContainer,m_trtFilteredContName,false); - if(sc.isFailure()) - { - athenaLog << MSG::WARNING << "TRT DriftCircleContainer " << m_trtFilteredContName << - " cannot be recorded into StoreGate! "<<endmsg; - return sc; - } - else - { - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO<<"TRT DriftCircleContainer " << m_trtFilteredContName << - " recorded into StoreGate! "<<endmsg; - } - } - - std::set<Identifier> usedHits; - usedHits.clear(); - if(!inputTrackColl.empty()) { - - //1a. loop over input tracks, build a set of used TRT hits - - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "Total " << inputTrackColl.size()<<" input tracks..."<< endmsg; - - TrigInDetTrackCollection::const_iterator trIt,lastIt; - - trIt = inputTrackColl.begin();lastIt = inputTrackColl.end(); - for(; trIt !=lastIt; trIt++) { - if((*trIt)->trtDriftCircles()==NULL) continue; - std::vector<const InDet::TRT_DriftCircle*>::iterator hitIt=(*trIt)->trtDriftCircles()->begin(), - hitItEnd=(*trIt)->trtDriftCircles()->end(); - for(;hitIt!=hitItEnd;++hitIt) - usedHits.insert((*hitIt)->identify()); - } - } - - //2. retrieve TRT hits - - m_regionSelector->DetHashIDList(TRT, listOfTrtIds); - - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO<< listOfTrtIds.size() << " REGTEST: TRT Dets in region" << endmsg; - - std::vector<unsigned int> uIntListOfTRTRobs; - - m_regionSelector->DetROBIDListUint(TRT,uIntListOfTRTRobs); - m_robDataProvider->addROBData(uIntListOfTRTRobs); - m_vROBF.clear(); - m_robDataProvider->getROBData(uIntListOfTRTRobs,m_vROBF); - // m_trtDataErrors.clear(); - - sc = m_trtDataProvider->fillCollections(listOfTrtIds,m_vROBF); - - if(sc.isRecoverable()) - { - if(outputLevel <= MSG::INFO) - athenaLog<<MSG::INFO<<"Recoverable errors during TRT BS conversion "<<endmsg; - /* - const std::vector<int>* errVect = m_trtDataProvider->fillTRT_DataErrors(); - std::copy(errVect->begin(),errVect->end(),std::back_inserter(m_trtDataErrors)); - */ - } - else if(sc.isFailure()) - { - athenaLog << MSG::WARNING << " TRT Data provider failed" << endmsg; - return sc; - } - - // 3. Retrieve IDC - - const InDet::TRT_DriftCircleContainer* trtContainer; - sc=evtStore()->retrieve(trtContainer,m_trtDataProvider->trtContainerName()); - if(sc.isFailure()) - { - athenaLog<<MSG::WARNING<<"TRT DriftCircle container is not found: name " - <<m_trtDataProvider->trtContainerName()<< - " pointer="<<trtContainer<< endmsg; - return sc; - } - if(outputLevel <= MSG::INFO) - athenaLog<<MSG::INFO<<"TRT DriftCircle container retrieved"<<endmsg; - - int nTotalHits=0; - int nFilteredHits=0; - - // 4. collect unused TRT hits - - listOfFilteredTrtIds.clear(); - - for(std::vector<IdentifierHash>::iterator idIt=listOfTrtIds.begin();idIt!=listOfTrtIds.end();++idIt){ - - InDet::TRT_DriftCircleContainer::const_iterator collIt(trtContainer->indexFind(*idIt)); - if(collIt==trtContainer->end()) continue; - - const InDet::TRT_DriftCircleCollection* coll=&(**collIt); - if(coll->begin()==coll->end()) continue; - - InDet::TRT_DriftCircleCollection* pNewColl=NULL; - pNewColl = new InDet::TRT_DriftCircleCollection(coll->identifyHash()); - pNewColl->setIdentifier(coll->identify()); - - for(InDet::TRT_DriftCircleCollection::const_iterator dcIt=coll->begin();dcIt!=coll->end();++dcIt) { - Identifier dcId = (*dcIt)->identify(); - nTotalHits++; - if(usedHits.find(dcId)!=usedHits.end()) continue; - - InDet::TRT_DriftCircle* pRIO = new InDet::TRT_DriftCircle(**dcIt); - - pRIO->setHashAndIndex(pNewColl->identifyHash(), pNewColl->size()); - /* - std::cout<<"Old DC:"<<std::endl; - std::cout<<(**dcIt)<<std::endl; - std::cout<<"Copy DC:"<<std::endl; - std::cout<<(*pRIO)<<std::endl; - */ - pNewColl->push_back(pRIO); - nFilteredHits++; - } - StatusCode scColl = m_filteredDriftCircleContainer->addCollection(pNewColl,pNewColl->identifyHash()); - listOfFilteredTrtIds.push_back(pNewColl->identifyHash()); - if(scColl.isFailure()) { - athenaLog<<MSG::WARNING<<"Cannot store collection in IDC "<< endmsg; - } - } - - if (outputLevel <= MSG::INFO) - athenaLog << MSG::INFO << "Total " << nTotalHits <<" TRT hits in RoI, "<<nFilteredHits<<" left after filtering"<< endmsg; - - return sc; - } - - - -StatusCode TrigL2PattRecoStrategyT::getIDCs() { - - MsgStream athenaLog(msgSvc(), name()); - - StatusCode sc(StatusCode::SUCCESS); - - sc = evtStore()->retrieve(m_pixelOnlineSpacePointsContainer, m_pixelOnlineSpacePointsName); - if (sc.isFailure()) { - athenaLog << MSG::ERROR << "Failed to get Pixel SpacePoints Container " <<m_pixelOnlineSpacePointsName<< endmsg; - return sc; - } - else { - /* - athenaLog << MSG::DEBUG << "Got Pixel SpacePoints Container from TDS: " - << m_pixelOnlineClustersName << endmsg; - */ - } - - sc = evtStore()->retrieve(m_sctOnlineSpacePointsContainer, m_sctOnlineSpacePointsName); - if (sc.isFailure()) { - athenaLog << MSG::ERROR << "Failed to get SCT SpacePoints Container " <<m_sctOnlineSpacePointsName<< endmsg; - return sc; - } - else { - /* - athenaLog << MSG::DEBUG << "Got SCT SpacePoints Container from TDS: " - << m_pixelOnlineClustersName << endmsg; - */ - } - return sc; -} - diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/components/TrigInDetRecoTools_entries.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/components/TrigInDetRecoTools_entries.cxx deleted file mode 100644 index aabeab08a9c093ce9a657f15ba8e3011e26d9c1d..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/components/TrigInDetRecoTools_entries.cxx +++ /dev/null @@ -1,18 +0,0 @@ -#include "TrigInDetEvent/TrigInDetTrack.h" -#include "TrigInDetRecoTools/TrigL2PattRecoStrategyA.h" -#include "TrigInDetRecoTools/TrigL2PattRecoStrategyB.h" -#include "TrigInDetRecoTools/TrigL2PattRecoStrategyC.h" -#include "TrigInDetRecoTools/TrigL2PattRecoStrategyT.h" -#include "TrigInDetRecoTools/TrigL2DupTrackRemovalTool.h" -#include "TrigInDetRecoTools/TrigInDetRoadMakerTool.h" -#include "../TrigL2LayerSetPredictorTool.h" - - -DECLARE_COMPONENT( TrigL2PattRecoStrategyA ) -DECLARE_COMPONENT( TrigL2PattRecoStrategyB ) -DECLARE_COMPONENT( TrigL2PattRecoStrategyC ) -DECLARE_COMPONENT( TrigL2PattRecoStrategyT ) -DECLARE_COMPONENT( TrigL2DupTrackRemovalTool ) -DECLARE_COMPONENT( TrigInDetRoadMakerTool ) -DECLARE_COMPONENT( TrigL2LayerSetPredictorTool ) -