diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h index 18fe9aa594f6c54e20f41a098628a660a3ec178f..bd2f5242e2fc2bf1535bdc9619de70a95090fab0 100755 --- a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h @@ -20,7 +20,6 @@ #include "InDetReadoutGeometry/SiDetectorElement.h" // cant be forward declared #include "TrkPrepRawData/PrepRawData.h" #include "TrkSurfaces/Surface.h" - #include <memory> class PixelClusterContainerCnv; @@ -105,17 +104,19 @@ public: /// return the flag of this cluster containing a gangedPixel virtual bool gangedPixel() const; - /// return the detector element corresponding to this PRD - /// The pointer will be zero if the det el is not defined (i.e. it was - /// not passed in by the ctor) - virtual const InDetDD::SiDetectorElement* detectorElement() const; + /// The pointer will be zero if the det el is not defined (i.e. it was not + /// passed in by the ctor) + virtual const InDetDD::SiDetectorElement* detectorElement() const override final; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override final; /// dump information about the SiCluster - virtual MsgStream& dump(MsgStream& stream) const; + virtual MsgStream& dump(MsgStream& stream) const override; /// dump information about the SiCluster - virtual std::ostream& dump(std::ostream& stream) const; - //@} + virtual std::ostream& dump(std::ostream& stream) const override; + //@} /// Set the m_detEl and calculate globalPostion //used by TPCnv converters @@ -135,48 +136,7 @@ operator<<(MsgStream& stream, const SiCluster& prd); std::ostream& operator<<(std::ostream& stream, const SiCluster& prd); -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// -// return width: -inline const InDet::SiWidth& -SiCluster::width() const -{ - return m_width; -} -// return globalPosition: -inline const Amg::Vector3D& -SiCluster::globalPosition() const -{ - return m_globalPosition; -} -// set gangedPixel: -inline void -SiCluster::setGangedPixel(bool ganged) -{ - m_gangedPixel = ganged; -} -// get gangedPixel: -inline bool -SiCluster::gangedPixel() const -{ - return m_gangedPixel; } -inline const InDetDD::SiDetectorElement* -SiCluster::detectorElement() const -{ - return m_detEl; -} - -inline void -SiCluster::setDetectorElement(const InDetDD::SiDetectorElement* detEl) -{ - m_detEl = detEl; - if (m_detEl) { - m_globalPosition = - m_detEl->surface(identify()).localToGlobalPos(localPosition()); - } -} -} +#include "InDetPrepRawData/SiCluster.icc" #endif // TRKPREPRAWDATA_SICLUSTER_H diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.icc b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.icc new file mode 100644 index 0000000000000000000000000000000000000000..921555a260756e24d09c2641402e50fb86d26d79 --- /dev/null +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.icc @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +namespace InDet { +// return width: +inline const InDet::SiWidth& +SiCluster::width() const +{ + return m_width; +} +// return globalPosition: +inline const Amg::Vector3D& +SiCluster::globalPosition() const +{ + return m_globalPosition; +} +// set gangedPixel: +inline void +SiCluster::setGangedPixel(bool ganged) +{ + m_gangedPixel = ganged; +} +// get gangedPixel: +inline bool +SiCluster::gangedPixel() const +{ + return m_gangedPixel; +} + +inline bool +SiCluster::type(Trk::PrepRawDataType::Type type) const +{ + return type == Trk::PrepRawDataType::SiCluster; +} + +inline const InDetDD::SiDetectorElement* +SiCluster::detectorElement() const +{ + return m_detEl; +} + +inline void +SiCluster::setDetectorElement(const InDetDD::SiDetectorElement* detEl) +{ + m_detEl = detEl; + if (m_detEl) { + m_globalPosition = + m_detEl->surface(identify()).localToGlobalPos(localPosition()); + } +} + + +} diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/TRT_DriftCircle.h b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/TRT_DriftCircle.h index 77394955bac582bed1622e0217f3cff12ac54c0b..7cc82d31343c4385d5392a2bc7d15717a727d5a6 100755 --- a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/TRT_DriftCircle.h +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/TRT_DriftCircle.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -36,18 +36,18 @@ class TRT_DriftCircle : public Trk::PrepRawData // Public methods: /////////////////////////////////////////////////////////////////// public: - + TRT_DriftCircle(); TRT_DriftCircle(const TRT_DriftCircle &) =default; TRT_DriftCircle &operator=(const TRT_DriftCircle &)=default; TRT_DriftCircle &operator=(TRT_DriftCircle &&)=default; /** Constructor with parameters: - compact id of the DriftCircle, + compact id of the DriftCircle, the driftRadius and its error - the RDO dataword with additional validity bit + the RDO dataword with additional validity bit this class owns the pointers passed (except the TRT_BaseElement), */ - TRT_DriftCircle( + TRT_DriftCircle( const Identifier &clusId, const Amg::Vector2D& driftRadius, const std::vector<Identifier>& rdoList, @@ -56,16 +56,16 @@ class TRT_DriftCircle : public Trk::PrepRawData const unsigned int word=0 ); - TRT_DriftCircle( + TRT_DriftCircle( const Identifier &clusId, const Amg::Vector2D& driftRadius, const Amg::MatrixX* errDriftRadius, const InDetDD::TRT_BaseElement* detEl, const unsigned int word=0 ); - - TRT_DriftCircle( - const Identifier &Id, + + TRT_DriftCircle( + const Identifier &Id, const Amg::Vector2D& driftRadius, std::vector<Identifier>&& rdoList, std::unique_ptr<const Amg::MatrixX> errDriftRadius, @@ -86,57 +86,61 @@ class TRT_DriftCircle : public Trk::PrepRawData /** returns the trailing edge bin */ virtual int trailingEdge() const; - + /** returns true if the high level threshold was passed */ virtual bool highLevel() const ; /** returns true if the first bin is high */ - virtual bool firstBinHigh() const; + virtual bool firstBinHigh() const; /** returns true if the last bin is high */ - virtual bool lastBinHigh() const; - + virtual bool lastBinHigh() const; + /** returns Time over threshold in ns */ - virtual double timeOverThreshold() const ; + virtual double timeOverThreshold() const ; /** returns number of high bins between LE and TE (these included) */ - virtual int numberOfHighsBetweenEdges() const; + virtual int numberOfHighsBetweenEdges() const; /** returns number of low bins between LE and TE (these included) */ - virtual int numberOfLowsBetweenEdges() const; - /** returns the raw driftTime */ - virtual double rawDriftTime() const; - - /** returns the raw driftTime, - * the passed boolean indicates if the drift time is valid or not. - * depreciated for 13.0.20 and later */ - virtual double driftTime(bool& valid) const; + virtual int numberOfLowsBetweenEdges() const; + /** returns the raw driftTime */ + virtual double rawDriftTime() const; + + /** returns the raw driftTime, + * the passed boolean indicates if the drift time is valid or not. + * depreciated for 13.0.20 and later */ + virtual double driftTime(bool& valid) const; + + /** return true if the corrected drift time is OK */ + virtual bool driftTimeValid() const; + + /** return the detector element corresponding to this PRD */ + virtual const InDetDD::TRT_BaseElement* detectorElement() const override final; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override final; - /** return true if the corrected drift time is OK */ - virtual bool driftTimeValid() const; - - /** return the detector element corresponding to this PRD */ - virtual const InDetDD::TRT_BaseElement* detectorElement() const; - // modifiers + // modifiers - /** set driftTimeValid flag */ - virtual void setDriftTimeValid(bool valid); + /** set driftTimeValid flag */ + virtual void setDriftTimeValid(bool valid); - //analysers + //analysers - /** returns true if the hit is caused by noise with a high - probability. This is a temporary feature. To be replaced - by a tool that can be configured for different gas - speeds etc */ - virtual bool isNoise() const; + /** returns true if the hit is caused by noise with a high + probability. This is a temporary feature. To be replaced + by a tool that can be configured for different gas + speeds etc */ + virtual bool isNoise() const; - //debug printers + //debug printers - /** dump information about the PRD object. */ - virtual MsgStream& dump( MsgStream& stream) const; + /** dump information about the PRD object. */ + virtual MsgStream& dump( MsgStream& stream) const override; - /** dump information about the PRD object. */ - virtual std::ostream& dump( std::ostream& stream) const; + /** dump information about the PRD object. */ + virtual std::ostream& dump( std::ostream& stream) const override; private: @@ -149,208 +153,8 @@ class TRT_DriftCircle : public Trk::PrepRawData MsgStream& operator << (MsgStream& stream, const TRT_DriftCircle& prd); std::ostream& operator << (std::ostream& stream, const TRT_DriftCircle& prd); - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - -inline unsigned int TRT_DriftCircle::getWord() const -{ - return m_word; -} - -inline int TRT_DriftCircle::driftTimeBin() const -{ - unsigned mask = 0x02000000; - unsigned word_LE = m_word>>6; - word_LE = word_LE<<6; - - mask >>=1; - bool SawZero = false; - int i; - for(i=1;i<18;++i) - { - if ( (word_LE & mask) && SawZero) break; - else if ( !(word_LE & mask) ) SawZero = true; - mask>>=1; - if(i==7 || i==15) mask>>=1; - } - if(i==18) i=0; - return i; -} - -inline int TRT_DriftCircle::trailingEdge() const -{ - unsigned mask = 0x00000001; - unsigned mask_word = 0x0001fff0; // 11111111 1 11110000 - unsigned mask_last_bit =0x10; //10000 - - unsigned word_TE = m_word & mask_word; - - bool SawZero=true; - bool SawZero1=false; - bool SawZero2=false; - bool SawUnit1=false; - int i=0; - int j=0; - int k=0; - - if(word_TE & mask_last_bit) - { - - for (j = 0; j < 11; ++j) - { - mask_last_bit=mask_last_bit<<1; - - if(j==3) mask_last_bit=mask_last_bit<<1; - - if ( !(word_TE & mask_last_bit) ) - { - SawZero2 = true; - break; - } - } - - if(SawZero2 == false) return 19; - - if(SawZero2 == true){ - for (k = j+1; k < 11; ++k) - { - mask_last_bit=mask_last_bit<<1; - - if(k==3) mask_last_bit=mask_last_bit<<1; - - if ( word_TE & mask_last_bit ) - { - SawUnit1 = true; - break; - } - } - } - - if(SawUnit1 == false && SawZero2 == true) return 19; - - } - - //+++++++++++++++++++++++++++++++++++++ - - for (i = 0; i < 24; ++i) - { - - if(!(word_TE & mask) && i>3) - { - SawZero1 = true; - } - if(SawZero1){ - if ( (word_TE & mask) && SawZero ) - break; - else if ( !(word_TE & mask) ) - SawZero = true; - } - mask <<= 1; - if (i == 7 || i == 15) - mask <<= 1; - } - - if ( 24 == i ) - return i; - - return (23 - i); - -} - -inline bool TRT_DriftCircle::highLevel() const -{ - return (m_word & 0x04020100); -} - - -inline bool -TRT_DriftCircle::firstBinHigh() const -{ - return (m_word & 0x02000000); -} - -inline bool -TRT_DriftCircle::lastBinHigh() const -{ - return (m_word & 0x1); -} - -inline double TRT_DriftCircle::timeOverThreshold() const -{ - double binWidth = 3.125; - - int LE = driftTimeBin( ); - int TE = trailingEdge( ); - - if ( (0 == LE) || (24 == LE) || (24 == TE) || (0 == TE) || (23 == LE) ) - { - return 0; - } - - double time = (double) (TE - LE + 1) * binWidth; - - return time; - -} - -inline double TRT_DriftCircle::rawDriftTime() const -{ - return (driftTimeBin()+0.5)*3.125; -} - -inline bool TRT_DriftCircle::driftTimeValid() const -{ - return m_word & 0x08000000; -} - -inline void TRT_DriftCircle::setDriftTimeValid(bool valid) -{ - unsigned maskfalse = 0xF7FFFFFF; - unsigned masktrue = 0x08000000; - if( valid ) { - m_word |= masktrue; - } else { - m_word &= maskfalse; } } -inline int TRT_DriftCircle::numberOfHighsBetweenEdges() const -{ - int LE = driftTimeBin( ); - int TE = trailingEdge( ); - unsigned mask = 0x02000000; - int nhigh=0; - int i; - for (i = 0; i < 24; ++i) - { - if ( (m_word & mask) && i>=LE && i<=TE ) nhigh++; - mask >>= 1; - if (i == 7 || i == 15) mask >>= 1; - } - return nhigh; -} - -inline int TRT_DriftCircle::numberOfLowsBetweenEdges() const -{ - int LE = driftTimeBin( ); - int TE = trailingEdge( ); - return (TE-LE+1-numberOfHighsBetweenEdges()); -} - - -inline bool TRT_DriftCircle::isNoise() const -{ - if( numberOfHighsBetweenEdges()<3 ) return true; - if( timeOverThreshold()<7.) return true; - return false; -} - -inline const InDetDD::TRT_BaseElement* TRT_DriftCircle::detectorElement() const -{ - return m_detEl; -} - -} +#include "InDetPrepRawData/TRT_DriftCircle.icc" #endif // TRKPREPRAWDATA_TRT_DRIFTCIRCLE_H diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/TRT_DriftCircle.icc b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/TRT_DriftCircle.icc new file mode 100644 index 0000000000000000000000000000000000000000..90696e45840b7860151c2d9347b7f8eb81efbaef --- /dev/null +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/TRT_DriftCircle.icc @@ -0,0 +1,219 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +namespace InDet { + +inline unsigned int +TRT_DriftCircle::getWord() const +{ + return m_word; +} + +inline int +TRT_DriftCircle::driftTimeBin() const +{ + unsigned mask = 0x02000000; + unsigned word_LE = m_word >> 6; + word_LE = word_LE << 6; + + mask >>= 1; + bool SawZero = false; + int i; + for (i = 1; i < 18; ++i) { + if ((word_LE & mask) && SawZero) + break; + else if (!(word_LE & mask)) + SawZero = true; + mask >>= 1; + if (i == 7 || i == 15) + mask >>= 1; + } + if (i == 18) + i = 0; + return i; +} + +inline int +TRT_DriftCircle::trailingEdge() const +{ + unsigned mask = 0x00000001; + unsigned mask_word = 0x0001fff0; // 11111111 1 11110000 + unsigned mask_last_bit = 0x10; // 10000 + + unsigned word_TE = m_word & mask_word; + + bool SawZero = true; + bool SawZero1 = false; + bool SawZero2 = false; + bool SawUnit1 = false; + int i = 0; + int j = 0; + int k = 0; + + if (word_TE & mask_last_bit) { + + for (j = 0; j < 11; ++j) { + mask_last_bit = mask_last_bit << 1; + + if (j == 3) + mask_last_bit = mask_last_bit << 1; + + if (!(word_TE & mask_last_bit)) { + SawZero2 = true; + break; + } + } + + if (SawZero2 == false) + return 19; + + if (SawZero2 == true) { + for (k = j + 1; k < 11; ++k) { + mask_last_bit = mask_last_bit << 1; + + if (k == 3) + mask_last_bit = mask_last_bit << 1; + + if (word_TE & mask_last_bit) { + SawUnit1 = true; + break; + } + } + } + + if (SawUnit1 == false && SawZero2 == true) + return 19; + } + + //+++++++++++++++++++++++++++++++++++++ + + for (i = 0; i < 24; ++i) { + + if (!(word_TE & mask) && i > 3) { + SawZero1 = true; + } + if (SawZero1) { + if ((word_TE & mask) && SawZero) + break; + else if (!(word_TE & mask)) + SawZero = true; + } + mask <<= 1; + if (i == 7 || i == 15) + mask <<= 1; + } + + if (24 == i) + return i; + + return (23 - i); +} + +inline bool +TRT_DriftCircle::highLevel() const +{ + return (m_word & 0x04020100); +} + +inline bool +TRT_DriftCircle::firstBinHigh() const +{ + return (m_word & 0x02000000); +} + +inline bool +TRT_DriftCircle::lastBinHigh() const +{ + return (m_word & 0x1); +} + +inline double +TRT_DriftCircle::timeOverThreshold() const +{ + double binWidth = 3.125; + + int LE = driftTimeBin(); + int TE = trailingEdge(); + + if ((0 == LE) || (24 == LE) || (24 == TE) || (0 == TE) || (23 == LE)) { + return 0; + } + + double time = (double)(TE - LE + 1) * binWidth; + + return time; +} + +inline double +TRT_DriftCircle::rawDriftTime() const +{ + return (driftTimeBin() + 0.5) * 3.125; +} + +inline bool +TRT_DriftCircle::driftTimeValid() const +{ + return m_word & 0x08000000; +} + +inline void +TRT_DriftCircle::setDriftTimeValid(bool valid) +{ + unsigned maskfalse = 0xF7FFFFFF; + unsigned masktrue = 0x08000000; + if (valid) { + m_word |= masktrue; + } else { + m_word &= maskfalse; + } +} + +inline int +TRT_DriftCircle::numberOfHighsBetweenEdges() const +{ + int LE = driftTimeBin(); + int TE = trailingEdge(); + unsigned mask = 0x02000000; + int nhigh = 0; + int i; + for (i = 0; i < 24; ++i) { + if ((m_word & mask) && i >= LE && i <= TE) + nhigh++; + mask >>= 1; + if (i == 7 || i == 15) + mask >>= 1; + } + return nhigh; +} + +inline int +TRT_DriftCircle::numberOfLowsBetweenEdges() const +{ + int LE = driftTimeBin(); + int TE = trailingEdge(); + return (TE - LE + 1 - numberOfHighsBetweenEdges()); +} + +inline bool +TRT_DriftCircle::isNoise() const +{ + if (numberOfHighsBetweenEdges() < 3) + return true; + if (timeOverThreshold() < 7.) + return true; + return false; +} +inline bool +TRT_DriftCircle::type(Trk::PrepRawDataType::Type type) const +{ + return type == Trk::PrepRawDataType::TRT_DriftCircle; +} + +inline const InDetDD::TRT_BaseElement* +TRT_DriftCircle::detectorElement() const +{ + return m_detEl; +} + +} diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx index e6cd050dac4f4bef6b0f14bb0043a45d5d910362..e26f80da541d0e3672f5799eeaccf5e36301ec9b 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx @@ -22,7 +22,7 @@ using HepGeom::Point3D; namespace InDet { - + static const InterfaceID IID_IConversionFinderUtils("InDet::ConversionFinderUtils", 1, 0); ConversionFinderUtils::ConversionFinderUtils(const std::string& type, @@ -30,26 +30,26 @@ namespace InDet { const IInterface* parent) : AthAlgTool(type, name, parent) { - declareInterface<ConversionFinderUtils>(this); + declareInterface<ConversionFinderUtils>(this); } - + ConversionFinderUtils::~ConversionFinderUtils() = default; - - const InterfaceID& ConversionFinderUtils::interfaceID() + + const InterfaceID& ConversionFinderUtils::interfaceID() { return IID_IConversionFinderUtils; } - + StatusCode ConversionFinderUtils::initialize() { return StatusCode::SUCCESS; } - + StatusCode ConversionFinderUtils::finalize() { return StatusCode::SUCCESS; } - - /** - * hits counter + + /** + * hits counter */ void ConversionFinderUtils::countHits( @@ -58,26 +58,34 @@ namespace InDet { int& nclus) const { - DataVector<const Trk::MeasurementBase>::const_iterator its, itse=mb->end(); - - for(its=mb->begin();its!=itse;++its) { - - const Trk::RIO_OnTrack* ri = dynamic_cast<const Trk::RIO_OnTrack*>(*its); - if(!ri) continue; - - const Trk::PrepRawData* rd = ri->prepRawData(); - if(!rd) continue; - - const InDet::SiCluster* si = dynamic_cast<const InDet::SiCluster*>(rd); - if(si) { ++nclus; continue;} - - const InDet::TRT_DriftCircle* dc = dynamic_cast<const InDet::TRT_DriftCircle*>(rd); - if(dc) { ++ntrt; continue;} - - }//end of loop over meas.bases - } // end of count hits method - - /** + DataVector<const Trk::MeasurementBase>::const_iterator its, + itse = mb->end(); + + for (its = mb->begin(); its != itse; ++its) { + + const Trk::RIO_OnTrack* ri = dynamic_cast<const Trk::RIO_OnTrack*>(*its); + if (!ri) + continue; + + const Trk::PrepRawData* rd = ri->prepRawData(); + if (!rd){ + continue; + } + + if (rd->type(Trk::PrepRawDataType::SiCluster)) { + ++nclus; + continue; + } + + if (rd->type(Trk::PrepRawDataType::TRT_DriftCircle)) { + ++ntrt; + continue; + } + + } // end of loop over meas.bases + } // end of count hits method + + /** * hl trt hits / trt hits ratio calculater */ double @@ -86,27 +94,27 @@ namespace InDet { { DataVector<const Trk::MeasurementBase>::const_iterator itp=mb->begin(), itpe=mb->end(); - int ntrth = 0; + int ntrth = 0; int nHL = 0; for(;itp!=itpe;++itp) { const Trk::RIO_OnTrack* ri = dynamic_cast<const Trk::RIO_OnTrack*>(*itp); if(!ri) continue; const Trk::PrepRawData* rd = ri->prepRawData(); - + if(!rd) continue; const InDet::TRT_DriftCircle* RawDataClus = dynamic_cast<const InDet::TRT_DriftCircle*>(rd); if(!RawDataClus) continue; ++ntrth; - + if(RawDataClus->highLevel()) ++nHL; }//end of loop over measurement bases - + if(ntrth>0) return double(nHL)/double(ntrth); return 1000.; } // end of trRatio method - /** - * mom fraction + /** + * mom fraction */ double ConversionFinderUtils::momFraction(const Trk::TrackParameters* per1, @@ -119,7 +127,7 @@ namespace InDet { return momFraction; } - /** + /** * distance between two tracks */ double @@ -130,61 +138,61 @@ namespace InDet { //position of the first measurement on the positive track const Trk::MeasurementBase* first_pos_meas = trk_pos->measurementsOnTrack()->front(); Amg::Vector3D trk_hit_pos = first_pos_meas->globalPosition(); - + //check if really the first measurement for (const Trk::MeasurementBase* m : *trk_pos->measurementsOnTrack()) - if(trk_hit_pos.mag() > m->globalPosition().mag()) first_pos_meas = m; - + if(trk_hit_pos.mag() > m->globalPosition().mag()) first_pos_meas = m; + trk_hit_pos = first_pos_meas->globalPosition(); - + //position of the first hit--->track2 const Trk::MeasurementBase* first_neg_meas = trk_neg->measurementsOnTrack()->front(); Amg::Vector3D trk_hit_neg = first_neg_meas->globalPosition(); - + //check if really the first measurement for (const Trk::MeasurementBase* m : *trk_neg->measurementsOnTrack()) - if(trk_hit_neg.mag() > m->globalPosition().mag()) first_neg_meas = m; - + if(trk_hit_neg.mag() > m->globalPosition().mag()) first_neg_meas = m; + trk_hit_neg = first_neg_meas->globalPosition(); double distance = 1000.; - + //check if measurements are on the same surface - if (first_pos_meas->associatedSurface() == first_neg_meas->associatedSurface()) distance = - sqrt(pow(trk_hit_pos[0] - trk_hit_neg[0],2.) + pow(trk_hit_pos[1] - trk_hit_neg[1],2.) + + if (first_pos_meas->associatedSurface() == first_neg_meas->associatedSurface()) distance = + sqrt(pow(trk_hit_pos[0] - trk_hit_neg[0],2.) + pow(trk_hit_pos[1] - trk_hit_neg[1],2.) + pow(trk_hit_pos[2] - trk_hit_neg[2],2.)); - - - //if not choose the track with the fist measurement closest to 000 and calculate the distance + + + //if not choose the track with the fist measurement closest to 000 and calculate the distance //of the closest approach of another track to this measurement else { - + //define reference point and track parameter (--> perigees) of the second track - Amg::Vector3D ref_point; - const Trk::Perigee* perigee; - + Amg::Vector3D ref_point; + const Trk::Perigee* perigee; + if (first_pos_meas->globalPosition().mag() < first_neg_meas->globalPosition().mag()) { ref_point = first_pos_meas->globalPosition(); - perigee = trk_neg->perigeeParameters(); + perigee = trk_neg->perigeeParameters(); } else { ref_point = first_neg_meas->globalPosition(); - perigee = trk_pos->perigeeParameters(); + perigee = trk_pos->perigeeParameters(); } // when the helix can be approximated as a straight line, when the // distance of closest approach can be calculated as distance^2 = [momentum // x (ref_point-position)]^2/momentum^2 - Amg::Vector3D momentum = perigee->momentum(); - Amg::Vector3D position = perigee->position(); - double p = momentum.mag(); - Amg::Vector3D delta = position - ref_point; - distance = sqrt(pow(delta.mag(),2.) - pow((delta.adjoint()*momentum)[0]/p,2.)); + Amg::Vector3D momentum = perigee->momentum(); + Amg::Vector3D position = perigee->position(); + double p = momentum.mag(); + Amg::Vector3D delta = position - ref_point; + distance = sqrt(pow(delta.mag(),2.) - pow((delta.adjoint()*momentum)[0]/p,2.)); } - + ATH_MSG_DEBUG("Distance between two tracks = "<<distance); return distance; } // end of distBetweenTracks method - /** + /** * return first track parameters */ const Trk::TrackParameters* @@ -192,20 +200,20 @@ namespace InDet { { const DataVector<const Trk::TrackStateOnSurface>* tsos = track->trackStateOnSurfaces(); if(!tsos) return nullptr; - - DataVector<const Trk::TrackStateOnSurface>::const_iterator itse = tsos->end(); - DataVector<const Trk::TrackStateOnSurface>::const_iterator itsb = tsos->begin(); - + + DataVector<const Trk::TrackStateOnSurface>::const_iterator itse = tsos->end(); + DataVector<const Trk::TrackStateOnSurface>::const_iterator itsb = tsos->begin(); + for(;itsb!=itse;++itsb) { if((*itsb)->measurementOnTrack()) { const Trk::TrackParameters* trkP = (*itsb)->trackParameters(); if(trkP->associatedSurface().center().perp()>=10.) return trkP; }//end of meas on track check }//end of loop over all track states on surface - - return nullptr; + + return nullptr; } - + /** * return first track particle parameters */ @@ -214,9 +222,9 @@ namespace InDet { const Trk::TrackParticleBase* track) const { - std::vector<const Trk::TrackParameters*>::const_iterator vpb = track->trackParameters().begin(); - std::vector<const Trk::TrackParameters*>::const_iterator vpe = track->trackParameters().end(); - for(;vpb != vpe; ++vpb) if((*vpb)->position().perp()>=10.) return (*vpb); + std::vector<const Trk::TrackParameters*>::const_iterator vpb = track->trackParameters().begin(); + std::vector<const Trk::TrackParameters*>::const_iterator vpe = track->trackParameters().end(); + for(;vpb != vpe; ++vpb) if((*vpb)->position().perp()>=10.) return (*vpb); return nullptr; } @@ -225,27 +233,27 @@ namespace InDet { ConversionFinderUtils::addNewPerigeeToTrack(const Trk::Track* track, const Trk::Perigee* mp) const { - + // fitQuality from track - const Trk::FitQuality* fq = track->fitQuality()->clone(); + const Trk::FitQuality* fq = track->fitQuality()->clone(); if(!fq) return nullptr; - + // output datavector of TSOS DataVector<const Trk::TrackStateOnSurface>* ntsos = new DataVector<const Trk::TrackStateOnSurface>; const DataVector<const Trk::TrackStateOnSurface>* tsos = track->trackStateOnSurfaces(); if(!tsos) {delete ntsos; return nullptr;} DataVector<const Trk::TrackStateOnSurface>::const_iterator its,itse = tsos->end(); for(its=tsos->begin();its!=itse;++its) { - + std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Perigee); const Trk::TrackStateOnSurface* per_tsos = ((*its)->type(Trk::TrackStateOnSurface::Perigee)) ? new Trk::TrackStateOnSurface(nullptr, mp->clone(), nullptr, nullptr, typePattern) : (*its)->clone(); - ntsos->push_back(per_tsos); + ntsos->push_back(per_tsos); } - + //Construct the new track Trk::TrackInfo info; Trk::Track* newTrk = new Trk::Track(info, ntsos, fq); @@ -259,28 +267,28 @@ namespace InDet { Amg::Vector3D correctVertex(initVxCandidate->position().x()+guessVertex.x(), initVxCandidate->position().y()+guessVertex.y(), initVxCandidate->position().z()+guessVertex.z()); - + Amg::Vector3D globalVertexPosition(correctVertex.x(),correctVertex.y(),correctVertex.z()); - + std::vector<Trk::VxTrackAtVertex> tmpVTAV; - - std::vector<Trk::VxTrackAtVertex> trkAtVtx = initVxCandidate->vxTrackAtVertex(); + + std::vector<Trk::VxTrackAtVertex> trkAtVtx = initVxCandidate->vxTrackAtVertex(); for (unsigned int i = 0; i < trkAtVtx.size() ; ++i) { - Trk::VxTrackAtVertex vtxTrack = trkAtVtx[i]; - const Trk::TrackParameters* vtxPer = vtxTrack.perigeeAtVertex(); + Trk::VxTrackAtVertex vtxTrack = trkAtVtx[i]; + const Trk::TrackParameters* vtxPer = vtxTrack.perigeeAtVertex(); const AmgVector(5)& iv = vtxPer->parameters(); AmgSymMatrix(5) em(*(vtxPer->covariance())); - Trk::PerigeeSurface surface (globalVertexPosition); + Trk::PerigeeSurface surface (globalVertexPosition); Trk::TrackParameters* tmpMeasPer = surface.createParameters<5,Trk::Charged>(0.,0.,iv[2],iv[3],iv[4],&em); Trk::VxTrackAtVertex trkV(vtxTrack.trackQuality().chiSquared(), tmpMeasPer); tmpVTAV.push_back(trkV); - }//end of loop over VxTracksAtVertex - + }//end of loop over VxTracksAtVertex + if(tmpVTAV.size()!=2) return nullptr; - + //Create the xAOD::Vertex and set the position and VxTrackAtVertex properly xAOD::Vertex *vx = new xAOD::Vertex(*initVxCandidate); vx->setPosition(correctVertex); @@ -290,7 +298,7 @@ namespace InDet { vx->vxTrackAtVertex().push_back(vtxTrack); } - return vx; + return vx; }//end of correct vxCandidate method - + } // end InDet diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/CscPrepData.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/CscPrepData.h index e8a9efb7244ad312482da909c1d3e28b01cbdf0f..ffe4cf0e98bbb24cc83027f9c10bbfd80cb10b71 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/CscPrepData.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/CscPrepData.h @@ -51,20 +51,20 @@ class CscPrepData : public MuonCluster CscPrepData(CscPrepData &&); CscPrepData &operator=(const CscPrepData &); CscPrepData &operator=(CscPrepData &&); - - /** @brief Full constructor. + + /** @brief Full constructor. @param RDOId The identifier of the central strip of the cluster @param idDE The IdenifierHash of the collection used to store this object (i.e. of Muon::CscPrepDataCollection) @param locpos The local coords of the measurement (this object will now own the LocalPostion) @param rdoList Vector of all the Identifiers of the strips used in this cluster @param locErrMat The error of the measurement (this object will now own the ErrorMatrix) - @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken + @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken (the pointer is assumed to belong to GeoModel and will not be deleted) - @param charge The charge measured by the CSC + @param charge The charge measured by the CSC @param time The time measured by the CSC - @param status The status of the position measurement. See Muon::CscClusterStatus for more information. - @param timestatus The status of the time measurement (peak strip due to max charge). See Muon::CscTimeStatus for more information. + @param status The status of the position measurement. See Muon::CscClusterStatus for more information. + @param timestatus The status of the time measurement (peak strip due to max charge). See Muon::CscTimeStatus for more information. */ CscPrepData( const Identifier& RDOId, const IdentifierHash &idDE, @@ -77,43 +77,49 @@ class CscPrepData : public MuonCluster const CscClusterStatus status, const CscTimeStatus timeStatus=Muon::CscTimeStatusUndefined ); - + /** @brief Destructor */ virtual ~CscPrepData(); - + /////////////////////////////////////////////////////////////////// // Virtual methods /////////////////////////////////////////////////////////////////// - + /** @brief Returns the global position*/ - const Amg::Vector3D& globalPosition() const; - + virtual const Amg::Vector3D& globalPosition() const override; + /** @brief Return the detector element corresponding to this PRD. - + The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor) */ - virtual const MuonGM::CscReadoutElement* detectorElement() const; - + virtual const MuonGM::CscReadoutElement* detectorElement() const override final; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override final + { + return type == Trk::PrepRawDataType::CscPrepData; + } + /////////////////////////////////////////////////////////////////////////////////////////////// /** Returns the charge. */ int charge() const; - + /** Returns the time */ double time() const; - + /** Returns the Csc status (position measurement) flag */ CscClusterStatus status() const; - + /** Returns the Csc time status flag */ CscTimeStatus timeStatus() const; - + /** Dumps information about the PRD*/ - virtual MsgStream& dump( MsgStream& stream) const; - + virtual MsgStream& dump( MsgStream& stream) const override; + /** Dumps information about the PRD*/ - virtual std::ostream& dump( std::ostream& stream) const; - + virtual std::ostream& dump( std::ostream& stream) const override; + private: - + /** Pointer to the detector element. This is owned by this object and is therefore not deleted.*/ const MuonGM::CscReadoutElement* m_detEl; int m_charge; @@ -121,26 +127,26 @@ private: CscClusterStatus m_status; CscTimeStatus m_timeStatus; }; - + /////////////////////////////////////////////////////////////////// // Inline methods: /////////////////////////////////////////////////////////////////// - + inline const MuonGM::CscReadoutElement* CscPrepData::detectorElement() const { return m_detEl; } - + inline int CscPrepData::charge() const { return m_charge; } - - inline double CscPrepData::time() const - { + + inline double CscPrepData::time() const + { return m_time; } - + inline CscClusterStatus CscPrepData::status() const { return m_status; @@ -150,16 +156,16 @@ private: { return m_timeStatus; } - + // return globalPosition: inline const Amg::Vector3D& CscPrepData::globalPosition() const { if (not m_globalPosition) m_globalPosition.set(std::unique_ptr<const Amg::Vector3D>(m_detEl->surface(identify()).Trk::Surface::localToGlobal(localPosition()))); - + if (not m_globalPosition) throw Trk::PrepRawDataUndefinedVariable(); return *m_globalPosition; } - + } #endif // MUONPREPRAWDATA_CSCPREPDATA_H diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/CscStripPrepData.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/CscStripPrepData.h index 09e92fab6a4797cc3051459123b8fac1d948bd04..78ebb0c31373fbebf3fe1a7206c31a465bdb6bb3 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/CscStripPrepData.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/CscStripPrepData.h @@ -46,20 +46,20 @@ namespace Muon friend class ::CscStripPrepDataContainerCnv; friend class Muon::CscStripPrepDataContainerCnv_p1; - + CscStripPrepData(); CscStripPrepData(const CscStripPrepData &); CscStripPrepData &operator=(const CscStripPrepData &); - /** Constructor + /** Constructor @param RDOId The identifier of the strip @param collectionHash The IdenifierHash of the collection used to store this object (i.e. of Muon::CscPrepDataCollection) @param locpos The local coords of the measurement (this object will now own the LocalPostion) @param locErrMat The error of the measurement (this object will now own the ErrorMatrix) - @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken + @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken (the pointer is assumed to belong to GeoModel and will not be deleted) - @param sampleCharges The vector of charges measured by the strip. @todo More info. + @param sampleCharges The vector of charges measured by the strip. @todo More info. @param timeOfFirstSample The time measured by the CSC @todo More info. @param samplingRate The sampling rate. */ @@ -70,18 +70,24 @@ namespace Muon const MuonGM::CscReadoutElement* detEl, const std::vector<float>& sampleCharges, float timeOfFirstSample, - unsigned short samplingRate + unsigned short samplingRate ); /// Destructor: virtual ~CscStripPrepData(); - + /** return global position reference */ const Amg::Vector3D& globalPosition() const; /** return the detector element corresponding to this PRD The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor) */ - virtual const MuonGM::CscReadoutElement* detectorElement() const; + virtual const MuonGM::CscReadoutElement* detectorElement() const override; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override + { + return type == Trk::PrepRawDataType::MdtPrepData; + } /** returns the IdentifierHash corresponding to the channel. */ virtual const IdentifierHash collectionHash() const; @@ -90,21 +96,21 @@ namespace Muon const std::vector<float>& sampleCharges() const; /** return the time of the first sample */ - double timeOfFirstSample() const; + double timeOfFirstSample() const; /** return the sampling phase */ bool samplingPhase() const; /** return the sampling time in ns: the time between samplings */ - unsigned short samplingTime() const; + unsigned short samplingTime() const; /** dump information about the PRD*/ - virtual MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** dump information about the PRD*/ - virtual std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; - /** set the sampling phase + /** set the sampling phase @warning This does not conform to ATLAS Coding Conventions and will be renamed to setSamplingPhase() */ void set_samplingPhase () ; @@ -137,7 +143,7 @@ namespace Muon { return m_detEl; } - + inline const IdentifierHash CscStripPrepData::collectionHash() const { return m_collectionHash; @@ -158,14 +164,14 @@ namespace Muon return m_samplingTime; } - inline bool CscStripPrepData::samplingPhase() const + inline bool CscStripPrepData::samplingPhase() const { return m_samplingPhase; } - - inline void CscStripPrepData::set_samplingPhase() - { - m_samplingPhase = true; + + inline void CscStripPrepData::set_samplingPhase() + { + m_samplingPhase = true; } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MMPrepData.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MMPrepData.h index 8182d28e2e4aa0cc72296975e5e8df47c8a9ee04..6885247a8910ce7be992b4ad078acdad99433c20 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MMPrepData.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MMPrepData.h @@ -15,17 +15,17 @@ class MMPrepDataContainerCnv; class IdentifierHash; -namespace Muon +namespace Muon { class MMRdoToPrepDataTool; - + /** @brief Class to represent MM measurements. */ class MMPrepData : public MuonCluster { friend class Muon::MMRdoToPrepDataTool; - + /////////////////////////////////////////////////////////////////// // Public methods: /////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ namespace Muon @param locpos The local coords of the measurement (this object will now own the LocalPostion) @param rdoList Vector of all the Identifiers of the strips used in this cluster @param locErrMat The error of the measurement (this object will now own the ErrorMatrix) - @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken + @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken (the pointer is assumed to belong to GeoModel and will not be deleted) */ @@ -55,12 +55,12 @@ namespace Muon const Amg::Vector2D& locpos, const std::vector<Identifier>& rdoList, const Amg::MatrixX* locErrMat, - const MuonGM::MMReadoutElement* detEl, + const MuonGM::MMReadoutElement* detEl, const short int time, - const int charge, + const int charge, const float driftDist, - const std::vector<uint16_t>& stripNumbers, - const std::vector<short int>& stripTimes, + const std::vector<uint16_t>& stripNumbers, + const std::vector<short int>& stripTimes, const std::vector<int>& stripCharges ); /** @brief constructor including time and charge and drift distance */ @@ -69,7 +69,7 @@ namespace Muon const Amg::Vector2D& locpos, const std::vector<Identifier>& rdoList, const Amg::MatrixX* locErrMat, - const MuonGM::MMReadoutElement* detEl, + const MuonGM::MMReadoutElement* detEl, const short int time, const int charge, const float driftDist ); @@ -80,7 +80,7 @@ namespace Muon const Amg::Vector2D& locpos, const std::vector<Identifier>& rdoList, const Amg::MatrixX* locErrMat, - const MuonGM::MMReadoutElement* detEl, + const MuonGM::MMReadoutElement* detEl, const short int time, const int charge ); @@ -104,11 +104,17 @@ namespace Muon void setDriftDist(const std::vector<float>& driftDist, const std::vector<float>& stripDriftErrors_0_0, const std::vector<float>& stripDriftErrors_1_1); /** @brief Returns the global position*/ - const Amg::Vector3D& globalPosition() const; + virtual const Amg::Vector3D& globalPosition() const override; /** @brief Returns the detector element corresponding to this PRD. The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor)*/ - const MuonGM::MMReadoutElement* detectorElement() const; + virtual const MuonGM::MMReadoutElement* detectorElement() const override final; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override final + { + return type == Trk::PrepRawDataType::MMPrepData; + } /** @brief Returns the time (in ns) */ short int time() const; @@ -139,16 +145,16 @@ namespace Muon /** @brief returns the list of drift distances */ const std::vector<Amg::MatrixX>& stripDriftErrors() const; - + // getter functions for the EventTPConverters const std::vector<float> stripDriftErrors_0_0() const; const std::vector<float> stripDriftErrors_1_1() const; - + /** @brief Dumps information about the PRD*/ - MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** @brief Dumps information about the PRD*/ - std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; enum Author{ @@ -189,7 +195,7 @@ namespace Muon std::vector<int> m_stripCharges; std::vector<float> m_stripDriftDist; std::vector<Amg::MatrixX> m_stripDriftErrors; - + Author m_author; }; @@ -207,27 +213,27 @@ namespace Muon return *m_globalPosition; } - inline short int MMPrepData::time() const + inline short int MMPrepData::time() const { return m_time; } - - inline int MMPrepData::charge() const + + inline int MMPrepData::charge() const { return m_charge; } - inline float MMPrepData::driftDist() const + inline float MMPrepData::driftDist() const { return m_driftDist; } - inline float MMPrepData::angle() const + inline float MMPrepData::angle() const { return m_angle; } - inline float MMPrepData::chisqProb() const + inline float MMPrepData::chisqProb() const { return m_chisqProb; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MdtPrepData.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MdtPrepData.h index 8c1bda70f6e8094f043403343747526b565ac3f3..26d62e71b82c38e4716b8a9f13270f0acc266b3e 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MdtPrepData.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MdtPrepData.h @@ -32,7 +32,7 @@ namespace Muon class MdtPrepDataContainerCnv_p1; -/** @brief Class to represent measurements from the Monitored Drift Tubes*/ +/** @brief Class to represent measurements from the Monitored Drift Tubes*/ class MdtPrepData : public Trk::PrepRawData { @@ -52,7 +52,7 @@ public: MdtPrepData &operator=(MdtPrepData &&); /** Constructor with parameters: this class owns the pointers passed (except the MuonDetectorElement) - @param id Identifier of the tube which generated DriftCircle, + @param id Identifier of the tube which generated DriftCircle, @param collectionHash IdentifierHash of the PRD collection in which the MdtPrepData is stored @param driftRadius this local position object should contain the drift radius @param errDriftRadius the error on the driftRadius (i.e. 1d error matix) @@ -86,32 +86,38 @@ public: /** @brief Destructor*/ virtual ~MdtPrepData(); - - /** @brief Returns the global position of the CENTER of the drift tube (i.e. it is important to realise that this is NOT the true position of the measurement). + + /** @brief Returns the global position of the CENTER of the drift tube (i.e. it is important to realise that this is NOT the true position of the measurement). The reason that this is done here, and not simply through the detector element is that here it can be cached for better performance.*/ virtual const Amg::Vector3D& globalPosition() const; /** @brief Returns the detector element corresponding to this PRD. The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor)*/ - virtual const MuonGM::MdtReadoutElement* detectorElement() const; + virtual const MuonGM::MdtReadoutElement* detectorElement() const override; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override + { + return type == Trk::PrepRawDataType::MdtPrepData; + } /** @brief Returns the TDC (typically range is 0 to 2500). */ int tdc() const; /** @brief Returns the ADC (typically range is 0 to 250)*/ int adc() const; - + /** @brief Returns the status of the measurement */ MdtDriftCircleStatus status() const; - + /** @brief Returns the IdentifierHash corresponding to the Mdt tube which was hit. */ virtual IdentifierHash collectionHash() const; /** @brief Dumps information about the PRD*/ - virtual MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** @brief Dumps information about the PRD*/ - virtual std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; private: @@ -128,7 +134,7 @@ private: MdtDriftCircleStatus m_status; protected : - + /**@brief Global position of measurement. Calculated on demand and cached (not deleted in destructor, not written to disk)*/ CxxUtils::CachedUniquePtr<const Amg::Vector3D> m_globalPosition; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonCluster.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonCluster.h index d34717ad8c939ff189baf1e32980779139d03f3a..d669d75b36872601c4676075fbef8193cac68d05 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonCluster.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonCluster.h @@ -17,7 +17,7 @@ #define MUONPREPRAWDATA_MUONCLUSTER_H // Base classes -#include "TrkPrepRawData/PrepRawData.h" +#include "TrkPrepRawData/PrepRawData.h" #include "Identifier/IdentifierHash.h" #include "MuonReadoutGeometry/MuonClusterReadoutElement.h" #include "GeoPrimitives/GeoPrimitives.h" @@ -37,9 +37,9 @@ namespace Muon { public: - + /**@brief Default constructor. - + For use by POOL only - do not use! */ MuonCluster(); MuonCluster(const MuonCluster &); @@ -51,7 +51,7 @@ namespace Muon @param RDOId The channel identifier of the central measurement of the cluster. @param collectionHash the hash associated with the PRD collection in storegate @param locpos The position of the cluster in the surface reference frame. - the first coordinate is the precision coordinate, the second is set to + the first coordinate is the precision coordinate, the second is set to the centre of the strip. Ownership passes to this object! @param rdoList List of channels associated with cluster @param locErrMat The measurement errors. Ownership passes to this object! @@ -65,7 +65,7 @@ namespace Muon /** @brief Destructor*/ virtual ~MuonCluster(); - + /** @brief Returns the global position of the measurement (calculated on the fly) */ virtual const Amg::Vector3D& globalPosition() const = 0; @@ -74,19 +74,22 @@ namespace Muon /** @brief Returns the detector element corresponding to this PRD. The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor)*/ - virtual const MuonGM::MuonClusterReadoutElement* detectorElement() const = 0; + virtual const MuonGM::MuonClusterReadoutElement* detectorElement() const override = 0; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override = 0; /** @brief Dumps information about the PRD*/ - virtual MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** @brief Dumps information about the PRD*/ - virtual std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; protected: /**@brief Global position of measurement. Calculated on demand and cached */ CxxUtils::CachedUniquePtr<const Amg::Vector3D> m_globalPosition; - + }; // ///////////////////////////////////////////////////////////////// @@ -99,7 +102,7 @@ namespace Muon { return getHashAndIndex().collHash(); } - + } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/RpcPrepData.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/RpcPrepData.h index 451ffad9acc532925b5a463346eb5b01d92b53d6..247c628ad7860b0ab11b81fcdbe3674ae9ca32b9 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/RpcPrepData.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/RpcPrepData.h @@ -23,19 +23,19 @@ class RpcPrepDataContainerCnv; -namespace Muon +namespace Muon { class RpcRdoToPrepDataToolCore; class RpcPrepDataContainerCnv_p1; class RpcPrepDataContainerCnv_p2; - + /** @brief Class to represent RPC measurements. */ class RpcPrepData : public MuonCluster { friend class Muon::RpcRdoToPrepDataToolCore; - + /////////////////////////////////////////////////////////////////// // Public methods: /////////////////////////////////////////////////////////////////// @@ -58,7 +58,7 @@ public: @param locpos The local coords of the measurement (this object will now own the LocalPostion) @param rdoList Vector of all the Identifiers of the strips used in this cluster @param locErrMat The error of the measurement (this object will now own the ErrorMatrix) - @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken + @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken (the pointer is assumed to belong to GeoModel and will not be deleted) @param time The time measured by the RPC @param triggerInfo The trigger info flag - see m_triggerInfo for more definition. @@ -91,15 +91,21 @@ public: float time() const; /** @brief Returns the global position*/ - const Amg::Vector3D& globalPosition() const; + virtual const Amg::Vector3D& globalPosition() const override; /** @brief Returns the detector element corresponding to this PRD. The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor)*/ - virtual const MuonGM::RpcReadoutElement* detectorElement() const; + virtual const MuonGM::RpcReadoutElement* detectorElement() const override final; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override final + { + return type == Trk::PrepRawDataType::RpcPrepData; + } /** @brief Returns the trigger coincidence - usually false, unless ijk>5 or highpt&&ijk==0*/ int triggerInfo() const; - + /** @brief Returns the number of ambiguities associated with this RpcPrepData. - 0 if the ambiguites have not been removed by choice; - 1 if the ambiguities are fully solved @@ -107,20 +113,20 @@ public: int ambiguityFlag() const; /** @brief Dumps information about the PRD*/ - virtual MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** @brief Dumps information about the PRD*/ - virtual std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; private: /** Cached pointer to the detector element - should never be zero.*/ const MuonGM::RpcReadoutElement* m_detEl; - /** Float since PRD produced from RDO, and RDO should contain the time calculated from the bcid and the RPC clock + /** Float since PRD produced from RDO, and RDO should contain the time calculated from the bcid and the RPC clock ticks. (as bcid*25+ticks*3.125).*/ float m_time; - + /** usually false, unless ijk>5 or highpt&&ijk==0 */ int m_triggerInfo; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/TgcPrepData.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/TgcPrepData.h index aef897fd13a03aedebf2a1f27355e2ee5f424d3e..86f302e41e53ddc1c53a57c3fbc1170dfbbce851 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/TgcPrepData.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/TgcPrepData.h @@ -15,7 +15,7 @@ #ifndef MUONPREPRAWDATA_TGCPREPDATA_H #define MUONPREPRAWDATA_TGCPREPDATA_H - + // Base classes #include "MuonPrepRawData/MuonCluster.h" #include "TrkSurfaces/Surface.h" @@ -51,7 +51,7 @@ namespace Muon @param locpos The local coords of the measurement (this object will now own the LocalPostion) @param rdoList Vector of all the Identifiers of the strips used in this cluster @param locErrMat The error of the measurement (this object will now own the ErrorMatrix) - @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken + @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken (the pointer is assumed to belong to GeoModel and will not be deleted) */ TgcPrepData( const Identifier& RDOId, @@ -70,11 +70,17 @@ namespace Muon // ///////////////////////////////////////////////////////////////// /** @brief Returns the global position */ - const Amg::Vector3D& globalPosition() const; + virtual const Amg::Vector3D& globalPosition() const override; /** @brief Returns the detector element corresponding to this PRD The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor)*/ - virtual const MuonGM::TgcReadoutElement* detectorElement() const; + virtual const MuonGM::TgcReadoutElement* detectorElement() const override final; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override final + { + return type == Trk::PrepRawDataType::TgcPrepData; + } /** @brief Returns the bcBitMap of this PRD bit2 for Previous BC, bit1 for Current BC, bit0 for Next BC */ @@ -85,10 +91,10 @@ namespace Muon void setBcBitMap(const uint16_t); /** @brief Dumps information about the PRD*/ - virtual MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** @brief Dumps information about the PRD*/ - virtual std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; private: @@ -110,7 +116,7 @@ namespace Muon inline const Amg::Vector3D& TgcPrepData::globalPosition() const { if (not m_globalPosition) m_globalPosition.set(std::unique_ptr<const Amg::Vector3D>(m_detEl->surface(identify()).Trk::Surface::localToGlobal(localPosition()))); - + if (not m_globalPosition) throw Trk::PrepRawDataUndefinedVariable(); return *m_globalPosition; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/sTgcPrepData.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/sTgcPrepData.h index 4ebcce1ac907acdc7a62a010273f8c68c4c11f58..dfbeb36007bb9a7731f72b0458e357ccddc0a93f 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/sTgcPrepData.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/sTgcPrepData.h @@ -12,17 +12,17 @@ class sTgcPrepDataContainerCnv; -namespace Muon +namespace Muon { class sTgcRdoToPrepDataTool; - + /** @brief Class to represent sTgc measurements. */ class sTgcPrepData : public MuonCluster { friend class Muon::sTgcRdoToPrepDataTool; - + /////////////////////////////////////////////////////////////////// // Public methods: /////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ namespace Muon @param locpos The local coords of the measurement (this object will now own the LocalPostion) @param rdoList Vector of all the Identifiers of the strips used in this cluster @param locErrMat The error of the measurement (this object will now own the ErrorMatrix) - @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken + @param detEl The pointer to the Detector Element on which this measurement was made (must NOT be zero). Ownership is NOT taken (the pointer is assumed to belong to GeoModel and will not be deleted) @param bcBitMap bitmap storing in which bunches the channel fired */ @@ -56,7 +56,7 @@ namespace Muon const short int time, const uint16_t bcBitMap, const std::vector<uint16_t>& stripNumbers, - const std::vector<short int>& stripTimes, + const std::vector<short int>& stripTimes, const std::vector<int>& stripCharges ); @@ -76,17 +76,23 @@ namespace Muon virtual ~sTgcPrepData(); /** @brief Returns the global position*/ - const Amg::Vector3D& globalPosition() const; + virtual const Amg::Vector3D& globalPosition() const override; /** @brief Returns the detector element corresponding to this PRD. The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor)*/ - const MuonGM::sTgcReadoutElement* detectorElement() const; + virtual const MuonGM::sTgcReadoutElement* detectorElement() const override final; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override final + { + return type == Trk::PrepRawDataType::sTgcPrepData; + } /** @brief Dumps information about the PRD*/ - MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** @brief Dumps information about the PRD*/ - std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; /** @brief Returns the bcBitMap of this PRD bit2 for Previous BC, bit1 for Current BC, bit0 for Next BC */ @@ -100,7 +106,7 @@ namespace Muon /** @brief returns the list of times */ const std::vector<short int>& stripTimes() const; - + /** @brief returns the list of charges */ const std::vector<int>& stripCharges() const; @@ -122,7 +128,7 @@ namespace Muon Patrick Scholer 3.12.2019 */ std::vector<short int> m_stripTimes; - std::vector<int> m_stripCharges; + std::vector<int> m_stripCharges; }; @@ -158,7 +164,7 @@ namespace Muon { return m_stripNumbers; } - + inline const std::vector<short int>& sTgcPrepData::stripTimes() const { return m_stripTimes; diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarCluster.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarCluster.h index d75d4a6ff22b650a91ea4a5599ac5f6f5bf169ec..b521bff99cfb0324ca8949143b6dee36056556de 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarCluster.h +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarCluster.h @@ -11,7 +11,7 @@ #ifndef ISF_FATRASEVENT_PLANARCLUSTER_H #define ISF_FATRASEVENT_PLANARCLUSTER_H -//Base class +//Base class #include "TrkPrepRawData/PrepRawData.h" #include "CxxUtils/CachedUniquePtr.h" @@ -32,7 +32,7 @@ namespace iFatras { */ class PlanarCluster : public Trk::PrepRawData { - + ///////////////////////////////////////////// // Public methods: ///////////////////////////////////////////// @@ -45,51 +45,57 @@ namespace iFatras { PlanarCluster &operator=(const PlanarCluster &); PlanarCluster &operator=( PlanarCluster &&); - + PlanarCluster( const Identifier& RDOId, - const Amg::Vector2D& locpos, + const Amg::Vector2D& locpos, const std::vector<Identifier>& rdoList, const InDet::SiWidth& width, const iFatras::PlanarDetElement* detEl, const Amg::MatrixX* locErrMat ); - + PlanarCluster( const Identifier& RDOId, - const Amg::Vector2D& locpos, + const Amg::Vector2D& locpos, std::vector<Identifier>&& rdoList, const InDet::SiWidth& width, const iFatras::PlanarDetElement* detEl, std::unique_ptr<const Amg::MatrixX> locErrMat ); - + // Deconstructor: virtual ~PlanarCluster(); - + /** return width class reference */ const InDet::SiWidth& width() const; - + /** return global position as a pointer. */ const Amg::Vector3D* globalPositionPtr() const; - + /** return global position reference */ const Amg::Vector3D& globalPosition() const; - + /** return the detector element corresponding to this PRD */ - const iFatras::PlanarDetElement* detectorElement() const; + virtual const iFatras::PlanarDetElement* detectorElement() const override; + + /** Interface method checking the type*/ + virtual bool type(Trk::PrepRawDataType::Type type) const override{ + return type==Trk::PrepRawDataType::PlanarCluster; + } + /** dump information about the PlanarCluster*/ - MsgStream& dump( MsgStream& stream) const; + MsgStream& dump( MsgStream& stream) const override; /** dump information about the PlanarCluster*/ - std::ostream& dump( std::ostream& stream) const; - + std::ostream& dump( std::ostream& stream) const override; + private: InDet::SiWidth m_width; //col, row, and width in mm CxxUtils::CachedUniquePtr<const Amg::Vector3D> m_globalPosition; const iFatras::PlanarDetElement* m_detEl; - + }; MsgStream& operator << (MsgStream& stream, const PlanarCluster& prd); std::ostream& operator << (std::ostream& stream, const PlanarCluster& prd); - + /////////////////////////////////////////////////////////////////// // Inline methods: /////////////////////////////////////////////////////////////////// @@ -97,22 +103,22 @@ namespace iFatras { inline const InDet::SiWidth& PlanarCluster::width() const { return m_width; } - + // return globalPosition: inline const Amg::Vector3D* PlanarCluster::globalPositionPtr() const { if (not m_globalPosition) m_globalPosition.set(std::unique_ptr<const Amg::Vector3D>(m_detEl->surface(identify()).localToGlobal(localPosition()))); return m_globalPosition.get(); } - + // return globalPosition: inline const Amg::Vector3D& PlanarCluster::globalPosition() const { return *globalPositionPtr(); } - + inline const iFatras::PlanarDetElement* PlanarCluster::detectorElement() const { return m_detEl; } - + } #endif // ISF_FATRASEVENT_PLANARCLUSTER_H diff --git a/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawData.h b/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawData.h index 928cb27b539051d6355ba264b1e0e8592dd48ea6..cc3fcde5513b96b5c3be948db5c71c00f2640d08 100755 --- a/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawData.h +++ b/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawData.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -14,168 +14,158 @@ #include "AthLinks/tools/IdentContIndex.h" // Eigen -#include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" +#include "GeoPrimitives/GeoPrimitives.h" -#include <vector> #include <atomic> #include <iostream> +#include <vector> class MsgStream; class PrepRawDataCnv_p1; namespace Muon { - class RpcPrepDataContainerCnv_p1; +class RpcPrepDataContainerCnv_p1; } -namespace Trk{ +namespace Trk { + +namespace PrepRawDataType { +/* The various kind of PrepRawData + * to avoid dynamic_cast via using the type method + */ +enum Type +{ + SiCluster = 0, + TRT_DriftCircle = 1, + PlanarCluster = 2, + MdtPrepData = 3, + CscStripPrepData = 4, + CscPrepData = 5, + MMPrepData = 6, + RpcPrepData = 7, + TgcPrepData = 8, + sTgcPrepData = 9 +}; +} - class TrkDetElementBase; +class TrkDetElementBase; /** class thrown in the event of an variable not being defined.*/ - class PrepRawDataUndefinedVariable { - }; - - class PrepRawData { - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - /** public because of DataPool*/ - PrepRawData(); - PrepRawData(const PrepRawData &); - PrepRawData(PrepRawData &&); - PrepRawData &operator=(const PrepRawData &); - PrepRawData &operator=(PrepRawData &&); - - - /** Full Constructor (with references) - @param clusId Identifier of the tube, strip etc which has produced this Trk::PrepRawData. - @param locpos LocalPosition of the measurement (see Trk::LocalPosition for more discussion about what this means). - @param rdoList Vector the Identifiers tubes, strips etc which produced this Trk::PrepRawData (cluster). - @param locerr Errors of the above measurement. - */ - PrepRawData( - const Identifier& clusId, - const Amg::Vector2D& locpos, - const std::vector<Identifier>& rdoList, - const Amg::MatrixX* locerr - ); - - PrepRawData( - const Identifier& clusId, - const Amg::Vector2D& locpos, - std::vector<Identifier>&& rdoList, - std::unique_ptr<const Amg::MatrixX> locerr - ); - - /** Constructor - same as above, but no need to pass a vector of Identifiers (i.e. for DriftCircles) - @param clusId Identifier of the tube, strip etc which has produced this Trk::PrepRawData. - @param locpos LocalPosition of the measurement (see Trk::LocalPosition for more discussion about what this means). - @param locerr Errors of the above measurement. It is not required to pass this (e.g. for Trigger clients) - in which case a null pointer is passed - */ - PrepRawData( - const Identifier& clusId, - const Amg::Vector2D& locpos, - const Amg::MatrixX* locerr - ); - - - /** Destructor:*/ - virtual ~PrepRawData(); - - /** return the identifier*/ - Identifier identify() const; - - /** return the local position reference*/ - const Amg::Vector2D& localPosition() const; - - /** return the List of rdo identifiers (pointers) */ - const std::vector<Identifier>& rdoList() const; - - /** return the error matrix reference */ - const Amg::MatrixX& localCovariance() const; - - /** return the detector element corresponding to this PRD - The pointer will be zero if the det el is not defined (i.e. it was not passed in by the ctor)*/ - virtual const TrkDetElementBase* detectorElement() const = 0; - - /** dump information about the PRD object. I would like to make this pure virtual, but I don't want to risk screwing up the muon classes for the moment*/ - virtual MsgStream& dump( MsgStream& stream) const; - /** dump information about the PRD object. I would like to make this pure virtual, but I don't want to risk screwing up the muon classes for the moment*/ - virtual std::ostream& dump( std::ostream& stream) const; - - /** TEMP for testing: might make some classes friends later ... */ - void setHashAndIndex(unsigned short collHash, unsigned short objIndex); - const IdentContIndex& getHashAndIndex() const; - - /**return number of parameters currently created*/ - static unsigned int numberOfInstantiations() ; - - private: - friend class ::PrepRawDataCnv_p1; - friend class Muon::RpcPrepDataContainerCnv_p1; - - /**PrepRawData ID, not const because of DataPool*/ - Identifier m_clusId; - /**see derived classes for definition of meaning of LocalPosition*/ - // Need to force proper alignment; otherwise cling gets it wrong. - alignas(16) Amg::Vector2D m_localPos; - /**Stores the identifiers of the RDOs.*/ - std::vector<Identifier> m_rdoList; - /**See derived classes for definition of ErrorMatrix */ - const Amg::MatrixX* m_localCovariance; - - /**Stores its own position (index) in collection plus the hash id for the collection - (needed for the EL to IDC) */ - IdentContIndex m_indexAndHash; - - /** number of objects of this type in memory */ - - static std::atomic<unsigned int> s_numberOfInstantiations; - - - }; - - MsgStream& operator << (MsgStream& stream, const PrepRawData& prd); - std::ostream& operator << (std::ostream& stream, const PrepRawData& prd); - - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - inline Identifier PrepRawData::identify() const - { - return m_clusId; - } - - inline const Amg::Vector2D& PrepRawData::localPosition() const - { - return m_localPos; - } - - inline const Amg::MatrixX& PrepRawData::localCovariance() const - { - return *m_localCovariance; - } - - inline const std::vector<Identifier>& PrepRawData::rdoList() const - { - return m_rdoList; - } - - /** TEMP for testing: might make some classes friends later ... */ - inline void PrepRawData::setHashAndIndex(unsigned short collHash, unsigned short objIndex) - { - m_indexAndHash.setCollHash(collHash); - m_indexAndHash.setObjIndex(objIndex); - } - inline const IdentContIndex& PrepRawData::getHashAndIndex() const - { - return m_indexAndHash; - } - +class PrepRawDataUndefinedVariable +{}; + +class PrepRawData +{ + /////////////////////////////////////////////////////////////////// + // Public methods: + /////////////////////////////////////////////////////////////////// +public: + /** public because of DataPool*/ + PrepRawData(); + PrepRawData(const PrepRawData&); + PrepRawData(PrepRawData&&); + PrepRawData& operator=(const PrepRawData&); + PrepRawData& operator=(PrepRawData&&); + + /** Full Constructor (with references) + @param clusId Identifier of the tube, strip etc which has produced this + Trk::PrepRawData. + @param locpos LocalPosition of the measurement (see Trk::LocalPosition for + more discussion about what this means). + @param rdoList Vector the Identifiers tubes, strips etc which produced + this Trk::PrepRawData (cluster). + @param locerr Errors of the above measurement. + */ + PrepRawData(const Identifier& clusId, + const Amg::Vector2D& locpos, + const std::vector<Identifier>& rdoList, + const Amg::MatrixX* locerr); + + PrepRawData(const Identifier& clusId, + const Amg::Vector2D& locpos, + std::vector<Identifier>&& rdoList, + std::unique_ptr<const Amg::MatrixX> locerr); + + /** Constructor - same as above, but no need to pass a vector of Identifiers + (i.e. for DriftCircles) + @param clusId Identifier of the tube, strip etc which has produced this + Trk::PrepRawData. + @param locpos LocalPosition of the measurement (see Trk::LocalPosition for + more discussion about what this means). + @param locerr Errors of the above measurement. It is not required to pass + this (e.g. for Trigger clients) in which case a null pointer is passed + */ + PrepRawData(const Identifier& clusId, + const Amg::Vector2D& locpos, + const Amg::MatrixX* locerr); + + /** Destructor:*/ + virtual ~PrepRawData(); + + /** return the identifier*/ + Identifier identify() const; + + /** return the local position reference*/ + const Amg::Vector2D& localPosition() const; + + /** return the List of rdo identifiers (pointers) */ + const std::vector<Identifier>& rdoList() const; + + /** return the error matrix reference */ + const Amg::MatrixX& localCovariance() const; + + /** return the detector element corresponding to this PRD + The pointer will be zero if the det el is not defined (i.e. it was not + passed in by the ctor)*/ + virtual const TrkDetElementBase* detectorElement() const = 0; + + /** Interface method checking the type*/ + virtual bool type(PrepRawDataType::Type type) const = 0; + + /** dump information about the PRD object. */ + virtual MsgStream& dump(MsgStream& stream) const; + /** dump information about the PRD object. I would like to make this pure + * virtual, but I don't want to risk screwing up the muon classes for the + * moment*/ + virtual std::ostream& dump(std::ostream& stream) const; + + /** TEMP for testing: might make some classes friends later ... */ + void setHashAndIndex(unsigned short collHash, unsigned short objIndex); + const IdentContIndex& getHashAndIndex() const; + + /**return number of parameters currently created*/ + static unsigned int numberOfInstantiations(); + +private: + friend class ::PrepRawDataCnv_p1; + friend class Muon::RpcPrepDataContainerCnv_p1; + + /**PrepRawData ID, not const because of DataPool*/ + Identifier m_clusId; + /**see derived classes for definition of meaning of LocalPosition*/ + // Need to force proper alignment; otherwise cling gets it wrong. + alignas(16) Amg::Vector2D m_localPos; + /**Stores the identifiers of the RDOs.*/ + std::vector<Identifier> m_rdoList; + /**See derived classes for definition of ErrorMatrix */ + const Amg::MatrixX* m_localCovariance; + + /**Stores its own position (index) in collection plus the hash id for the + collection (needed for the EL to IDC) */ + IdentContIndex m_indexAndHash; + + /** number of objects of this type in memory */ + + static std::atomic<unsigned int> s_numberOfInstantiations; +}; + +MsgStream& +operator<<(MsgStream& stream, const PrepRawData& prd); +std::ostream& +operator<<(std::ostream& stream, const PrepRawData& prd); } + +#include "TrkPrepRawData/PrepRawData.icc" #endif // TRKPREPRAWDATA_PREPRAWDATA_H diff --git a/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawData.icc b/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawData.icc new file mode 100644 index 0000000000000000000000000000000000000000..c3368b48f4a4b9798f32057124234353fecc1ae5 --- /dev/null +++ b/Tracking/TrkEvent/TrkPrepRawData/TrkPrepRawData/PrepRawData.icc @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +namespace Trk{ + +inline Identifier +PrepRawData::identify() const +{ + return m_clusId; +} + +inline const Amg::Vector2D& +PrepRawData::localPosition() const +{ + return m_localPos; +} + +inline const Amg::MatrixX& +PrepRawData::localCovariance() const +{ + return *m_localCovariance; +} + +inline const std::vector<Identifier>& +PrepRawData::rdoList() const +{ + return m_rdoList; +} + +/** TEMP for testing: might make some classes friends later ... */ +inline void +PrepRawData::setHashAndIndex(unsigned short collHash, unsigned short objIndex) +{ + m_indexAndHash.setCollHash(collHash); + m_indexAndHash.setObjIndex(objIndex); +} +inline const IdentContIndex& +PrepRawData::getHashAndIndex() const +{ + return m_indexAndHash; +} + +}