Commit bb08d4b0 authored by Niels Van Eldik's avatar Niels Van Eldik Committed by Graeme Stewart
Browse files

update os format (MuonSegment-01-00-04)

parent 8866d6a5
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// MuonSegment.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef MUONSEGMENT_MUONSEGMENT_H
#define MUONSEGMENT_MUONSEGMENT_H
// Trk
#include "TrkSegment/Segment.h"
#include "TrkEventPrimitives/LocalDirection.h"
#include "TrkSpaceTimePoint/SpaceTimePointBase.h"
#include "TrkSurfaces/PlaneSurface.h"
#include "TrkRIO_OnTrack/RIO_OnTrack.h"
namespace Muon {
/** @class MuonSegment
This is the common class for 3D segments used in the muon spectrometer.
The Surface type for MuonSegments is restricted to be a PlaneSurface.
The parameters of the MuonSegment are:
- the Trk::LocalPosition of the segment in the surface reference frame
- the Trk::LocalDirection of the segment which consistes of the angles
@f$ \theta_{xz} @f$ and @f$\theta_{yz}@f$.
The MuonSegment stores a list of Trk::MeasurementBase objects allowing it to
contain measurements from all detector types in the muon spectrometer.
@image html segment_example.gif
@image html MuonSegment.gif
@author Niels.van.Eldik@cern.ch, Edward.Moyse@cern.ch, Andreas.Salzburger@cern.ch
*/
class MuonSegment : public Trk::Segment, public Trk::SpaceTimePointBase {
public:
/** define invalid value, used when the segment has no fitted t0 */
static const float kNoValue;
/** Default Constructor for POOL */
MuonSegment();
/** Copy Constructor */
MuonSegment(const MuonSegment& seg);
/** Assignment operator */
MuonSegment& operator=(const MuonSegment& seg);
/** Constructor within standard track parameters frame taking a vector of MeasurementBase.
@param locpars 4 dim or 5 dim standard track parameters representation
@param locerr 4 x 4 error or 5 x 5 error on standard track parameters repr.
@param psf plane surface
@param cmeas vector of contained measurements on track
@param fqual fit quality object
@param author enum to indicate author, see Segment.h for the possible authors
*/
MuonSegment( const Trk::LocalParameters& locpars,
const Amg::MatrixX& locerr,
Trk::PlaneSurface* psf,
DataVector<const Trk::MeasurementBase>* cmeas,
Trk::FitQuality* fqual,
Segment::Author author=AuthorUnknown
);
/** Constructor within local parameters of the Segment taking a vector of MeasurementBase
@param segLocPos 2 local position coordinates
@param segLocalErr 2 local direction coordinates
@param segLocalErr 4 x 4 full local error
@param psf plane surface
@param cmeas vector of contained measurements on track
@param fqual fit quality object
@param author enum to indicate author, see Segment.h for the possible authors
*/
MuonSegment( const Amg::Vector2D& segLocPos, // 2 local position coordinates
const Trk::LocalDirection& segLocDir, //
const Amg::MatrixX& segLocalErr, //
Trk::PlaneSurface* psf, // plane surface to define frame
DataVector<const Trk::MeasurementBase>* cmeas, // vector of contained measurements on track
Trk::FitQuality* fqual, // fit quality object
Segment::Author author=AuthorUnknown);
/** Destructor */
virtual ~MuonSegment();
/** needed to avoid excessive RTTI*/
virtual MuonSegment* clone() const;
/** global position */
const Amg::Vector3D& globalPosition() const;
/** global direction */
const Amg::Vector3D& globalDirection() const;
/** local direction */
const Trk::LocalDirection& localDirection() const;
/** returns the surface for the local to global transformation
- interface from MeasurementBase */
const Trk::PlaneSurface& associatedSurface() const;
/** number of RIO_OnTracks */
unsigned int numberOfContainedROTs() const;
/** returns the vector of Trk::RIO_OnTrack objects
- specific for this TrackSegment: Trk::RIO_OnTrack (generic)
*/
const std::vector<const Trk::RIO_OnTrack*>& containedROTs() const;
/** returns the RIO_OnTrack (also known as ROT) objects depending on the integer*/
const Trk::RIO_OnTrack* rioOnTrack(unsigned int) const;
/** set the fitted time and error on the time */
void setT0Error(float t0, float t0Error);
/** returns whether the segment has a fitted t0 */
bool hasFittedT0() const;
/** recalculate the cache */
void recalculateCache();
private:
/** The global position the surface can be associated to. Cached (not persistified)*/
Amg::Vector3D m_globalPosition;
/** cache global direction, not persistified */
Amg::Vector3D m_globalDirection;
/** LocalDirection */
Trk::LocalDirection m_localDirection;
/** The plane surface to which the segment parameters are expressed to */
mutable const Trk::PlaneSurface* m_associatedSurface;
/** The cached vector of contained (generic) Trk::RIO_OnTrack objects.
The pointers are not deleted, since the actual objects belong to the base class */
mutable std::vector<const Trk::RIO_OnTrack*>* m_cachedRots;
/** private method to clear the Trk::RIO_OnTrack vector */
void clearRotVector();
/** private method to clear the Trk::MeasurementBase vector */
void clearMeasVector();
/** private method to copy all Trk::RIO_OnTrack pointers in m_cachedRots to m_containedMeasurements */
void copyMeasurementsToROTs() const;
protected:
/**returns some information about this RIO_OnTrack/TrackSegment.
It should be overloaded by any child classes*/
MsgStream& dump( MsgStream& out ) const;
/**returns some information about this RIO_OnTrack/TrackSegment.
It should be overloaded by any child classes*/
std::ostream& dump( std::ostream& out ) const;
};
inline const Amg::Vector3D& MuonSegment::globalPosition() const
{
return m_globalPosition;
}
inline const Amg::Vector3D& MuonSegment::globalDirection() const
{
return m_globalDirection;
}
inline const Trk::LocalDirection& MuonSegment::localDirection() const
{
return m_localDirection;
}
inline const Trk::PlaneSurface& MuonSegment::associatedSurface() const
{ return (*m_associatedSurface); }
inline MuonSegment* MuonSegment::clone() const
{
return new MuonSegment(*this);
}
inline const std::vector<const Trk::RIO_OnTrack*>& MuonSegment::containedROTs() const
{
if (0==m_cachedRots) copyMeasurementsToROTs();
return (*m_cachedRots);
}
inline const Trk::RIO_OnTrack* MuonSegment::rioOnTrack(unsigned int indx) const
{
if (0==m_cachedRots) copyMeasurementsToROTs();
if (indx<numberOfContainedROTs())
return (*m_cachedRots)[indx];
return 0;
}
inline unsigned int MuonSegment::numberOfContainedROTs() const {
if (0==m_cachedRots) copyMeasurementsToROTs();
return m_cachedRots->size();
}
inline void MuonSegment::setT0Error(float t0, float t0Error){
m_time=t0; m_errorTime=t0Error;
}
inline bool MuonSegment::hasFittedT0() const {
return m_time != MuonSegment::kNoValue;
}
}
#endif // MUONSEGMENT_MUONSEGMENT_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// MdtSegment.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef MUONSEGMENT_MUONSEGMENTCOMBINATION_H
#define MUONSEGMENT_MUONSEGMENTCOMBINATION_H
namespace Trk {
class Segment;
}
namespace Muon {
class MuonSegment;
}
#include <vector>
namespace Muon {
/** @class MuonSegmentCombination
Class to hold a set of MuonSegments belonging together.
The MuonSegments are stored per chamber, making it easier to keep track of possible
ambiguities per station.
@author niels.van.eldik@cern.ch
*/
class MuonSegmentCombination {
public:
typedef std::vector< const MuonSegment* > SegmentVec;
typedef std::vector< SegmentVec* > SegmentVecVec;
public:
/** Default constructor */
MuonSegmentCombination();
/** Destructor */
~MuonSegmentCombination();
/** Copy constructor */
MuonSegmentCombination( const MuonSegmentCombination& );
/** assigment operator */
MuonSegmentCombination& operator=( const MuonSegmentCombination& );
/** Add a set of Segments for a give station.
For now no sorting but this could be changed so the segments
are stored with increasing radius. Also no check is performed
whether there are already segments for the given station.
This is up to the user.
*/
bool addSegments( SegmentVec* );
/** Number of stations with segment */
unsigned int numberOfStations() const;
/** Access to segments in a given station */
const SegmentVec* stationSegments( unsigned int index ) const;
/** Number of ambiguities */
unsigned int numberOfAmbiguities() const;
private:
/** clear data */
void clear();
/** copy data */
void copy( const MuonSegmentCombination& segc );
SegmentVecVec m_segmentsPerStation;
};
inline bool MuonSegmentCombination::addSegments( SegmentVec* segs )
{
m_segmentsPerStation.push_back( segs );
return true;
}
inline unsigned int MuonSegmentCombination::numberOfStations() const
{
return m_segmentsPerStation.size();
}
inline const MuonSegmentCombination::SegmentVec*
MuonSegmentCombination::stationSegments( unsigned int index ) const
{
if( index < numberOfStations() ) return m_segmentsPerStation[index];
return 0;
}
inline unsigned int MuonSegmentCombination::numberOfAmbiguities() const
{
unsigned int solutions(1);
SegmentVecVec::const_iterator it = m_segmentsPerStation.begin();
SegmentVecVec::const_iterator it_end = m_segmentsPerStation.end();
for( ; it!=it_end; ++it ) solutions *= (*it)->size();
return solutions;
}
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUON_MUONSEGMENT_MUONSEGMENTCOMBINATIONCOLLECTION_H
#define MUON_MUONSEGMENT_MUONSEGMENTCOMBINATIONCOLLECTION_H
#include "DataModel/DataVector.h"
#include "MuonSegment/MuonSegmentCombination.h"
#include "CLIDSvc/CLASS_DEF.h"
/**This typedef represents a collection of MuonSegmentCombination objects.
It is a DataVector. It can be saved
to storegate, and written out via pool*/
typedef DataVector<Muon::MuonSegmentCombination> MuonSegmentCombinationCollection;
CLASS_DEF(MuonSegmentCombinationCollection , 1314529658 , 1 )
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUON_MUONSEGMENT_MUONSEGMENTDICT_H
#define MUON_MUONSEGMENT_MUONSEGMENTDICT_H
#include "MuonSegment/MuonSegment.h"
#include "MuonSegment/T0MuonSegment.h"
#include "MuonSegment/MuonSegmentCombinationCollection.h"
#include <vector>
class MuonSegmentDict_Dummy {
MuonSegmentCombinationCollection t0;
std::vector<const Muon::MuonSegment*> t1;
std::vector<const Muon::T0MuonSegment*> t2;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// MuonSegmentQuality.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef MUONSEGMENT_MUONSEGMENTQUALITY_H
#define MUONSEGMENT_MUONSEGMENTQUALITY_H
#include "Identifier/Identifier.h"
#include "TrkEventPrimitives/FitQuality.h"
#include <vector>
namespace Muon {
/** @class MuonSegmentQuality
This is the common muon segment quality object.
The object stores a list of channels, crossed by the segment, without hit
For specific cases, like for example for the MDTs, a more complicated quality object is needed.
It inherites from MuonSegmentQuality.
The number of holes on the segment is calculated by the MuonSegmentQuality as being the
total number of channels without a hit. The function can be overloaded by specific qualty objects to
provide a more detailed quality measure.
@author Niels.van.Eldik@cern.ch
*/
class MuonSegmentQuality : public Trk::FitQuality {
public:
/** Default Constructor needed for POOL */
MuonSegmentQuality();
/** Constructor */
MuonSegmentQuality( double chi2, int ndof, const std::vector<Identifier>& channelsWithoutHit, bool isStrict=false );
/** Destructor */
virtual ~MuonSegmentQuality() {}
/** number of holes */
virtual unsigned int numberOfHoles() const;
/** vector of identifiers of channels crossed by the segment but without hit */
const std::vector<Identifier>& channelsWithoutHit() const;
virtual MuonSegmentQuality* clone() const;
bool isStrict() const; //!< Returns true if the segment was created using strict criteria
private:
std::vector<Identifier> m_channelsWithoutHit;
bool m_isStrict;
};
inline unsigned int MuonSegmentQuality::numberOfHoles() const {
return m_channelsWithoutHit.size();
}
inline const std::vector<Identifier>& MuonSegmentQuality::channelsWithoutHit() const {
return m_channelsWithoutHit;
}
inline MuonSegmentQuality* MuonSegmentQuality::clone() const {
return new MuonSegmentQuality(*this);
}
inline bool MuonSegmentQuality::isStrict() const {
return m_isStrict;
}
}
#endif // MUONSEGMENT_MUONSEGMENTQUALITY_H
<lcgdict>
<class name="Muon::MuonSegment">
<field name="m_cachedRots" transient="true" />
<field name="m_globalPosition" transient="true" />
<field name="m_globalDirection" transient="true" />
</class>
<class name="Muon::T0MuonSegment" />
<class name="Muon::MuonSegmentCombination" />
<class name="DataVector<Muon::MuonSegmentCombination>" />
<class name="std::vector<Muon::MuonSegmentCombination*>" />
<class name="std::vector<std::vector<const Muon::MuonSegment*>*>" />
<class name="std::vector<const Muon::MuonSegment*>" />
<class name="std::vector<const Muon::T0MuonSegment*>" />
</lcgdict>
package MuonSegment
manager Niels van Eldik <nveldik@nikhef.nl>
author Niels van Eldik <nveldik@nikhef.nl>
use AtlasPolicy AtlasPolicy-*
use CLIDSvc CLIDSvc-* Control
use DataModel DataModel-* Control
use Identifier Identifier-* DetectorDescription
use TrkRIO_OnTrack TrkRIO_OnTrack-* Tracking/TrkEvent
use TrkSegment TrkSegment-* Tracking/TrkEvent
use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
use TrkSpaceTimePoint TrkSpaceTimePoint-* Tracking/TrkEvent
apply_pattern installed_library
library MuonSegment *.cxx
private
use AtlasReflex AtlasReflex-* External -no_auto_imports
use GeoPrimitives GeoPrimitives-* DetectorDescription
use EventPrimitives EventPrimitives-* Event
use CxxUtils CxxUtils-* Control
#apply_pattern lcgdict dict=MuonSegment selectionfile=selection.xml headerfiles="../MuonSegment/MuonSegmentDict.h"
private
# macro cppdebugflags '$(cppdebugflags_s)'
# macro_remove componentshr_linkopts "-Wl,-s"
macro DOXYGEN_IMAGE_PATH "../doc/images"
macro DOXYGEN_INLINE_INHERITED_MEMB "YES"
end_private
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage MuonSegment package
@author Niels.Van.Eldik@cern.ch, Edward.Moyse@cern.ch, Andreas.Salzburger@cern.ch
@section MuonSegmentIntro Introduction
The package contains the following objects:
- Muon::MuonSegment
- Muon::MuonSegmentCombination
The objects can be stored in StoreGate using the following collections:
- MuonSegmentCollection
- MuonSegmentCombinationCollection
@section ExtrasMuonSegment Extra Pages
- @ref UsedMuonSegment
- @ref RequirementsMuonSegment
*/
/**
@page UsedMuonSegment Used Packages
@htmlinclude used_packages.html
*/
/**
@page RequirementsMuonSegment Requirements
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonSegment/MuonSegment.h"
// TrkEvent
#include "TrkEventPrimitives/FitQuality.h"
#include "TrkEventPrimitives/LocalParameters.h"
#include "TrkEventPrimitives/DefinedParameter.h"
#include "TrkEventPrimitives/ParamDefs.h"
#include "TrkRIO_OnTrack/RIO_OnTrack.h"
#include "CxxUtils/sincos.h"
#include "EventPrimitives/EventPrimitivesToStringConverter.h"
#include "GeoPrimitives/GeoPrimitivesToStringConverter.h"
#include <float.h>
#include <iostream>
namespace Muon {
const float MuonSegment::kNoValue = FLT_MAX;
MuonSegment::MuonSegment()
:
Segment(),
SpaceTimePointBase(kNoValue,kNoValue,1.),
m_globalPosition( ),
m_globalDirection( ),
m_localDirection( ),
m_associatedSurface( 0 ),
m_cachedRots( 0 )
{}
MuonSegment::MuonSegment(const MuonSegment& seg)
:
Segment(seg),
SpaceTimePointBase(seg),
m_globalPosition( seg.m_globalPosition ),
m_globalDirection( seg.m_globalDirection ),
m_localDirection ( seg.m_localDirection ),
m_associatedSurface( 0 ),