diff --git a/Pr/PrVeloUT/src/PrVeloUT.cpp b/Pr/PrVeloUT/src/PrVeloUT.cpp index 208e3579a1b11711f7c6a2261cc2fb12e75d5f78..4cdaf88f05982c8c4fc0678598b773a9f7365586 100755 --- a/Pr/PrVeloUT/src/PrVeloUT.cpp +++ b/Pr/PrVeloUT/src/PrVeloUT.cpp @@ -32,6 +32,7 @@ StatusCode PrVeloUT::initialize() { m_veloUTTime = m_timerTool->addTimer( "Internal VeloUT Tracking" ); m_timerTool->decreaseIndent(); } + counter("#tracks"); return StatusCode::SUCCESS; } @@ -60,17 +61,20 @@ std::vector<LHCb::Track> PrVeloUT::operator()(const std::vector<LHCb::Track>& in boost::optional<LHCb::Track> outVeloUT; counter("#seeds") += inputTracks.size(); - // list tracks to be ignored as they are not respecting the Impact Parameter cut - std::map<const LHCb::Track*, bool> cutTracks; - for (auto& vertex : vertices) { - for (const LHCb::Track* track : vertex.tracks()) { - cutTracks[track] = acceptTrackForIPCut(*track, vertex, m_minIP); + auto eventState = m_veloUTTool->createState(); + bool killtrack = false; + for(const auto& veloTr: inputTracks) { + //you want to process only those velo input track having IP > m_minIP w.r.t. to all PV, + //i.e., if it has for at least 1 PV IP < m_minIP, the track is not propagated further + + killtrack = false; + if( m_doIPCut){ + for( const auto& vertex : vertices){ + if( !acceptTrackForIPCut( veloTr, vertex, m_minIP) ){ killtrack = true; break;} + } } - } + if( m_doIPCut && killtrack) continue; - auto eventState = m_veloUTTool->createState(); - for(const auto* veloTr: inputTracks) { - if (!cutTracks[veloTr]) continue; m_veloUTTool->tracksFromTrack(veloTr, outVeloUT, eventState).ignore(); if(outVeloUT){ outputTracks.push_back(std::move(outVeloUT.value())); diff --git a/Pr/PrVeloUT/src/PrVeloUT.cpp.orig b/Pr/PrVeloUT/src/PrVeloUT.cpp.orig new file mode 100755 index 0000000000000000000000000000000000000000..42e62780fbdc48a443cea47daa9d9158106fdfc1 --- /dev/null +++ b/Pr/PrVeloUT/src/PrVeloUT.cpp.orig @@ -0,0 +1,124 @@ +// Include files + +// local +#include "PrVeloUT.h" +#include "LHCbMath/GeomFun.h" +//----------------------------------------------------------------------------- +// Implementation file for class : PrVeloUT +// +// 2007-05-08 : Mariusz Witek +// 2017-03-01: Christoph Hasse (adapt to future framework) +//----------------------------------------------------------------------------- + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( PrVeloUT ) + +/// Standard constructor, initializes variables +PrVeloUT::PrVeloUT(const std::string& name, + ISvcLocator* pSvcLocator) : +Transformer(name, pSvcLocator, + {KeyValue{"InputTracksName", LHCb::TrackLocation::Velo}, + KeyValue{"InputVerticesName", LHCb::RecVertexLocation::Velo3D}}, + KeyValue{"OutputTracksName", LHCb::TrackLocation::VeloTT}) { +} + +/// Initialization +StatusCode PrVeloUT::initialize() { + auto sc = Transformer::initialize(); + if (sc.isFailure()) return sc; // error printed already by GaudiAlgorithm + if (m_doTiming) { + m_timerTool = tool<ISequencerTimerTool>( "SequencerTimerTool" ); + m_timerTool->increaseIndent(); + m_veloUTTime = m_timerTool->addTimer( "Internal VeloUT Tracking" ); + m_timerTool->decreaseIndent(); + } + return StatusCode::SUCCESS; +} + +namespace { + /// whether a given track passes the IP cut + bool acceptTrackForIPCut(const LHCb::Track& track, + const LHCb::RecVertex& vertex, + float minIP) { + const Gaudi::XYZPoint& point = vertex.position(); + const LHCb::State& s = track.closestState(point.Z()); + const Gaudi::Math::Line<Gaudi::XYZPoint,Gaudi::XYZVector> line + (Gaudi::XYZPoint(s.x(), s.y(), s.z()), Gaudi::XYZVector(s.tx(), s.ty(), 1.0)); + Gaudi::XYZVector impact = Gaudi::Math::closestPoint(point, line)-point; + return impact.R() > minIP; + } +} + +<<<<<<< HEAD +//============================================================================= +// Main execution +//============================================================================= +std::vector<LHCb::Track> PrVeloUT::operator()(const std::vector<LHCb::Track>& inputTracks, + const LHCb::RecVertices& vertices) const { + if ( m_doTiming ) m_timerTool->start( m_veloUTTime ); + std::vector<LHCb::Track> outputTracks; + outputTracks.reserve(inputTracks.size()); + boost::optional<LHCb::Track> outVeloUT; +======= +/// Main execution +<<<<<<< HEAD +LHCb::Tracks PrVeloUT::operator()(const LHCb::Tracks& inputTracks, + const std::vector<LHCb::RecVertex>& vertices) const { + if (m_doTiming) m_timerTool->start(m_veloUTTime); + LHCb::Tracks outputTracks; + outputTracks.reserve(200); + std::vector<LHCb::Track*> tmpTracks; + tmpTracks.reserve(5); +>>>>>>> Optimized event model for Clusters in HLT1 + counter("#seeds") += inputTracks.size(); +======= +std::vector<LHCb::Track> PrVeloUT::operator()(const std::vector<LHCb::Track>& inputTracks, + const std::vector<LHCb::RecVertex>& vertices) const { +>>>>>>> Fixed IP cut and make it off by defalut - credits to Renato + + if ( m_doTiming ) m_timerTool->start( m_veloUTTime ); + std::vector<LHCb::Track> outputTracks; + outputTracks.reserve(inputTracks.size()); + boost::optional<LHCb::Track> outVeloUT; + +<<<<<<< HEAD + auto eventState = m_veloUTTool->createState(); + for(const auto* veloTr: inputTracks) { + if (!cutTracks[veloTr]) continue; + m_veloUTTool->tracksFromTrack(veloTr, outVeloUT, eventState).ignore(); + if(outVeloUT){ + outputTracks.push_back(std::move(outVeloUT.value())); + outVeloUT = boost::none; + } + } + counter("#tracks") += outputTracks.size(); + if ( m_doTiming ) m_timerTool->stop( m_veloUTTime ); + return outputTracks; +} +======= + + auto eventState = m_veloUTTool->createState(); + bool killtrack = false; + for(const auto& veloTr: inputTracks) { + //you want to process only those velo input track having IP > m_minIP w.r.t. to all PV, + //i.e., if it has for at least 1 PV IP < m_minIP, the track is not propagated further + + killtrack = false; + if( m_doIPCut){ + for( const auto& vertex : vertices){ + if( !acceptTrackForIPCut( veloTr, vertex, m_minIP) ){ killtrack = true; break;} + } + } + if( m_doIPCut && killtrack) continue; + + m_veloUTTool->tracksFromTrack(veloTr, outVeloUT, eventState).ignore(); + if(outVeloUT){ + outputTracks.push_back(std::move(outVeloUT.value())); + outVeloUT = boost::none; + } + } + counter("#tracks") += outputTracks.size(); + if ( m_doTiming ) m_timerTool->stop( m_veloUTTime ); + return outputTracks; + } +>>>>>>> Fixed IP cut and make it off by defalut - credits to Renato diff --git a/Pr/PrVeloUT/src/PrVeloUT.h b/Pr/PrVeloUT/src/PrVeloUT.h index 5ea3369850d13fdabc465c64a8528b900bf5c72d..22ce2dacb264d162161d19fe856d304005999632 100755 --- a/Pr/PrVeloUT/src/PrVeloUT.h +++ b/Pr/PrVeloUT/src/PrVeloUT.h @@ -26,22 +26,25 @@ * 2017-03-01: Christoph Hasse (adapt to future framework) */ -class PrVeloUT : public Gaudi::Functional::Transformer<std::vector<LHCb::Track>(const std::vector<LHCb::Track>&, const std::vector<LHCb::RecVertex>&)>{ +class PrVeloUT : public Gaudi::Functional::Transformer<std::vector<LHCb::Track>(const std::vector<LHCb::Track>&, + const std::vector<LHCb::RecVertex>&)>{ + public: /// Standard constructor PrVeloUT( const std::string& name, ISvcLocator* pSvcLocator ); - + virtual StatusCode initialize() override; ///< Algorithm initialization std::vector<LHCb::Track> operator()(const std::vector<LHCb::Track>& inputTracks, const std::vector<LHCb::RecVertex>& vertices) const override; - + private: ToolHandle<ITracksFromTrackR> m_veloUTTool{this, "PrVeloUTTool", "PrVeloUTTool", "The tool that does the actual pattern recognition"}; Gaudi::Property<bool> m_doTiming{this, "TimingMeasurement", false}; Gaudi::Property<float> m_minIP{this, "minIP", 0.1*Gaudi::Units::millimeter}; + Gaudi::Property<bool> m_doIPCut{this, "doIPCut", false}; ISequencerTimerTool* m_timerTool = nullptr; ///< Timing tool int m_veloUTTime = 0; ///< Counter for timing tool diff --git a/Pr/PrVeloUT/src/PrVeloUT.h.orig b/Pr/PrVeloUT/src/PrVeloUT.h.orig new file mode 100755 index 0000000000000000000000000000000000000000..72c2dbf4195b322fb6580d04487eafd753bd1730 --- /dev/null +++ b/Pr/PrVeloUT/src/PrVeloUT.h.orig @@ -0,0 +1,62 @@ +#ifndef PRVELOUT_H +#define PRVELOUT_H 1 + +// Include files +// from Gaudi +#include "GaudiAlg/ISequencerTimerTool.h" +#include "GaudiAlg/Transformer.h" +// from TrackInterfaces +#include "TrackInterfaces/ITracksFromTrackR.h" +#include "Event/Track.h" +#include "Event/RecVertex.h" + +/** @class PrVeloUT PrVeloUT.h + * + * PrVeloUT algorithm. This is just a wrapper, + * the actual pattern recognition is done in the 'PrVeloUTTool'. + * + * - InputTracksName: Input location for Velo tracks + * - OutputTracksName: Output location for VeloTT tracks + * - TimingMeasurement: Do a timing measurement? + * + * @author Mariusz Witek + * @date 2007-05-08 + * @update for A-Team framework 2007-08-20 SHM + * + * 2017-03-01: Christoph Hasse (adapt to future framework) + */ + +<<<<<<< HEAD +class PrVeloUT : public Gaudi::Functional::Transformer<std::vector<LHCb::Track>(const std::vector<LHCb::Track>&, const std::vector<LHCb::RecVertex>&)>{ +======= +class PrVeloUT : public Gaudi::Functional::Transformer<std::vector<LHCb::Track>(const std::vector<LHCb::Track>&, + const std::vector<LHCb::RecVertex>&)>{ + +>>>>>>> Fixed IP cut and make it off by defalut - credits to Renato +public: + /// Standard constructor + PrVeloUT( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual StatusCode initialize() override; ///< Algorithm initialization + + std::vector<LHCb::Track> operator()(const std::vector<LHCb::Track>& inputTracks, + const std::vector<LHCb::RecVertex>& vertices) const override; +<<<<<<< HEAD + +======= + +>>>>>>> Fixed IP cut and make it off by defalut - credits to Renato +private: + + ToolHandle<ITracksFromTrackR> m_veloUTTool{this, "PrVeloUTTool", "PrVeloUTTool", "The tool that does the actual pattern recognition"}; + + Gaudi::Property<bool> m_doTiming{this, "TimingMeasurement", false}; + Gaudi::Property<float> m_minIP{this, "minIP", 0.1*Gaudi::Units::millimeter}; + Gaudi::Property<float> m_doIPCut{this, "doIPCut", false}; + + ISequencerTimerTool* m_timerTool = nullptr; ///< Timing tool + int m_veloUTTime = 0; ///< Counter for timing tool + +}; + +#endif // PRVELOUT_H diff --git a/Pr/PrVeloUT/src/PrVeloUT_BACKUP_40535.h b/Pr/PrVeloUT/src/PrVeloUT_BACKUP_40535.h new file mode 100755 index 0000000000000000000000000000000000000000..2a5da48631ffbcb6c5f8eef574ba88a0bddf021a --- /dev/null +++ b/Pr/PrVeloUT/src/PrVeloUT_BACKUP_40535.h @@ -0,0 +1,60 @@ +#ifndef PRVELOUT_H +#define PRVELOUT_H 1 + +// Include files +// from Gaudi +#include "GaudiAlg/ISequencerTimerTool.h" +#include "GaudiAlg/Transformer.h" +// from TrackInterfaces +#include "TrackInterfaces/ITracksFromTrackR.h" +#include "Event/Track.h" +#include "Event/RecVertex.h" + +/** @class PrVeloUT PrVeloUT.h + * + * PrVeloUT algorithm. This is just a wrapper, + * the actual pattern recognition is done in the 'PrVeloUTTool'. + * + * - InputTracksName: Input location for Velo tracks + * - OutputTracksName: Output location for VeloTT tracks + * - TimingMeasurement: Do a timing measurement? + * + * @author Mariusz Witek + * @date 2007-05-08 + * @update for A-Team framework 2007-08-20 SHM + * + * 2017-03-01: Christoph Hasse (adapt to future framework) + */ + +<<<<<<< HEAD +class PrVeloUT : public Gaudi::Functional::Transformer<std::vector<LHCb::Track>(const std::vector<LHCb::Track>&, const LHCb::RecVertices&)>{ +======= +class PrVeloUT : public Gaudi::Functional::Transformer<LHCb::Tracks(const LHCb::Tracks&, const std::vector<LHCb::RecVertex>&)>{ +>>>>>>> Optimized event model for Clusters in HLT1 +public: + /// Standard constructor + PrVeloUT( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual StatusCode initialize() override; ///< Algorithm initialization + +<<<<<<< HEAD + std::vector<LHCb::Track> operator()(const std::vector<LHCb::Track>& inputTracks, + const LHCb::RecVertices& vertices) const override; +======= + LHCb::Tracks operator()(const LHCb::Tracks& inputTracks, + const std::vector<LHCb::RecVertex>& vertices) const override; +>>>>>>> Optimized event model for Clusters in HLT1 + +private: + + ToolHandle<ITracksFromTrackR> m_veloUTTool{this, "PrVeloUTTool", "PrVeloUTTool", "The tool that does the actual pattern recognition"}; + + Gaudi::Property<bool> m_doTiming{this, "TimingMeasurement", false}; + Gaudi::Property<float> m_minIP{this, "minIP", 0.1*Gaudi::Units::millimeter}; + + ISequencerTimerTool* m_timerTool = nullptr; ///< Timing tool + int m_veloUTTime = 0; ///< Counter for timing tool + +}; + +#endif // PRVELOUT_H diff --git a/Pr/PrVeloUT/src/PrVeloUT_BASE_40535.h b/Pr/PrVeloUT/src/PrVeloUT_BASE_40535.h new file mode 100644 index 0000000000000000000000000000000000000000..f07fe40fae713447a234524f766e84c8e80189ab --- /dev/null +++ b/Pr/PrVeloUT/src/PrVeloUT_BASE_40535.h @@ -0,0 +1,51 @@ +#ifndef PRVELOUT_H +#define PRVELOUT_H 1 + +// Include files +// from Gaudi +#include "GaudiAlg/ISequencerTimerTool.h" +#include "GaudiAlg/Transformer.h" +// from TrackInterfaces +#include "TrackInterfaces/ITracksFromTrackR.h" +#include "Event/Track.h" +#include "Event/RecVertex.h" + +/** @class PrVeloUT PrVeloUT.h + * + * PrVeloUT algorithm. This is just a wrapper, + * the actual pattern recognition is done in the 'PrVeloUTTool'. + * + * - InputTracksName: Input location for Velo tracks + * - OutputTracksName: Output location for VeloTT tracks + * - TimingMeasurement: Do a timing measurement? + * + * @author Mariusz Witek + * @date 2007-05-08 + * @update for A-Team framework 2007-08-20 SHM + * + * 2017-03-01: Christoph Hasse (adapt to future framework) + */ + +class PrVeloUT : public Gaudi::Functional::Transformer<LHCb::Tracks(const LHCb::Tracks&, const LHCb::RecVertices&)>{ +public: + /// Standard constructor + PrVeloUT( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual StatusCode initialize() override; ///< Algorithm initialization + + LHCb::Tracks operator()(const LHCb::Tracks& inputTracks, + const LHCb::RecVertices& vertices) const override; + +private: + + ToolHandle<ITracksFromTrackR> m_veloUTTool{this, "PrVeloUTTool", "PrVeloUTTool", "The tool that does the actual pattern recognition"}; + + Gaudi::Property<bool> m_doTiming{this, "TimingMeasurement", false}; + Gaudi::Property<float> m_minIP{this, "minIP", 0.1*Gaudi::Units::millimeter}; + + ISequencerTimerTool* m_timerTool = nullptr; ///< Timing tool + int m_veloUTTime = 0; ///< Counter for timing tool + +}; + +#endif // PRVELOUT_H diff --git a/Pr/PrVeloUT/src/PrVeloUT_LOCAL_40535.h b/Pr/PrVeloUT/src/PrVeloUT_LOCAL_40535.h new file mode 100644 index 0000000000000000000000000000000000000000..16e2043fe8231f03860843fcf0a5742d0f3df0cb --- /dev/null +++ b/Pr/PrVeloUT/src/PrVeloUT_LOCAL_40535.h @@ -0,0 +1,51 @@ +#ifndef PRVELOUT_H +#define PRVELOUT_H 1 + +// Include files +// from Gaudi +#include "GaudiAlg/ISequencerTimerTool.h" +#include "GaudiAlg/Transformer.h" +// from TrackInterfaces +#include "TrackInterfaces/ITracksFromTrackR.h" +#include "Event/Track.h" +#include "Event/RecVertex.h" + +/** @class PrVeloUT PrVeloUT.h + * + * PrVeloUT algorithm. This is just a wrapper, + * the actual pattern recognition is done in the 'PrVeloUTTool'. + * + * - InputTracksName: Input location for Velo tracks + * - OutputTracksName: Output location for VeloTT tracks + * - TimingMeasurement: Do a timing measurement? + * + * @author Mariusz Witek + * @date 2007-05-08 + * @update for A-Team framework 2007-08-20 SHM + * + * 2017-03-01: Christoph Hasse (adapt to future framework) + */ + +class PrVeloUT : public Gaudi::Functional::Transformer<std::vector<LHCb::Track>(const std::vector<LHCb::Track>&, const LHCb::RecVertices&)>{ +public: + /// Standard constructor + PrVeloUT( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual StatusCode initialize() override; ///< Algorithm initialization + + std::vector<LHCb::Track> operator()(const std::vector<LHCb::Track>& inputTracks, + const LHCb::RecVertices& vertices) const override; + +private: + + ToolHandle<ITracksFromTrackR> m_veloUTTool{this, "PrVeloUTTool", "PrVeloUTTool", "The tool that does the actual pattern recognition"}; + + Gaudi::Property<bool> m_doTiming{this, "TimingMeasurement", false}; + Gaudi::Property<float> m_minIP{this, "minIP", 0.1*Gaudi::Units::millimeter}; + + ISequencerTimerTool* m_timerTool = nullptr; ///< Timing tool + int m_veloUTTime = 0; ///< Counter for timing tool + +}; + +#endif // PRVELOUT_H diff --git a/Pr/PrVeloUT/src/PrVeloUT_REMOTE_40535.h b/Pr/PrVeloUT/src/PrVeloUT_REMOTE_40535.h new file mode 100644 index 0000000000000000000000000000000000000000..139fc5d8edf77bf6ab41590325872e0651b58bdb --- /dev/null +++ b/Pr/PrVeloUT/src/PrVeloUT_REMOTE_40535.h @@ -0,0 +1,51 @@ +#ifndef PRVELOUT_H +#define PRVELOUT_H 1 + +// Include files +// from Gaudi +#include "GaudiAlg/ISequencerTimerTool.h" +#include "GaudiAlg/Transformer.h" +// from TrackInterfaces +#include "TrackInterfaces/ITracksFromTrackR.h" +#include "Event/Track.h" +#include "Event/RecVertex.h" + +/** @class PrVeloUT PrVeloUT.h + * + * PrVeloUT algorithm. This is just a wrapper, + * the actual pattern recognition is done in the 'PrVeloUTTool'. + * + * - InputTracksName: Input location for Velo tracks + * - OutputTracksName: Output location for VeloTT tracks + * - TimingMeasurement: Do a timing measurement? + * + * @author Mariusz Witek + * @date 2007-05-08 + * @update for A-Team framework 2007-08-20 SHM + * + * 2017-03-01: Christoph Hasse (adapt to future framework) + */ + +class PrVeloUT : public Gaudi::Functional::Transformer<LHCb::Tracks(const LHCb::Tracks&, const std::vector<LHCb::RecVertex>&)>{ +public: + /// Standard constructor + PrVeloUT( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual StatusCode initialize() override; ///< Algorithm initialization + + LHCb::Tracks operator()(const LHCb::Tracks& inputTracks, + const std::vector<LHCb::RecVertex>& vertices) const override; + +private: + + ToolHandle<ITracksFromTrackR> m_veloUTTool{this, "PrVeloUTTool", "PrVeloUTTool", "The tool that does the actual pattern recognition"}; + + Gaudi::Property<bool> m_doTiming{this, "TimingMeasurement", false}; + Gaudi::Property<float> m_minIP{this, "minIP", 0.1*Gaudi::Units::millimeter}; + + ISequencerTimerTool* m_timerTool = nullptr; ///< Timing tool + int m_veloUTTime = 0; ///< Counter for timing tool + +}; + +#endif // PRVELOUT_H diff --git a/Tf/TrackSys/python/TrackSys/RecoUpgradeTracking.py b/Tf/TrackSys/python/TrackSys/RecoUpgradeTracking.py index 256ec5443d825a314e4d11daa2ecceb0079e0305..30e3f0aa6b6c20f6fef8bbd02d72b59a26cca331 100755 --- a/Tf/TrackSys/python/TrackSys/RecoUpgradeTracking.py +++ b/Tf/TrackSys/python/TrackSys/RecoUpgradeTracking.py @@ -150,6 +150,8 @@ def RecoUpstream(min_pt = 0.0, input_tracks = "Rec/Track/Velo", prVeloUT.OutputTracksName = output_tracks prVeloUT.addTool(PrVeloUTTool, "PrVeloUTTool") prVeloUT.PrVeloUTTool.minPT = min_pt + prVeloUT.doIPCut = False + prVeloUT.minIP = 0.1*mm prVeloUT.InputVerticesName = "Rec/Vertex/Primary" from Configurables import TrackMasterFitter prVeloUT.addTool(TrackMasterFitter,"Fitter")