diff --git a/Reconstruction/MuonIdentification/muonEvent/cmt/requirements b/Reconstruction/MuonIdentification/muonEvent/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..6f152b6026e76d987fe0ce4d8c60dbdca1b1c4c9 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/cmt/requirements @@ -0,0 +1,48 @@ +package muonEvent + +author Ketevi A. Assamagan <ketevi@bnl.gov> + +public + +use AtlasPolicy AtlasPolicy-* +use CLIDSvc CLIDSvc-* Control +use DataModel DataModel-* Control +use SGTools SGTools-* Control + +use AtlasCLHEP AtlasCLHEP-* External + +use FourMom FourMom-* Event +use NavFourMom NavFourMom-* Event + +use ParticleEvent ParticleEvent-* PhysicsAnalysis/AnalysisCommon + +use TrkSegment TrkSegment-* Tracking/TrkEvent +use TrkMaterialOnTrack TrkMaterialOnTrack-* Tracking/TrkEvent + + +use CaloEvent CaloEvent-* Calorimeter +use CaloIdentifier CaloIdentifier-* Calorimeter + +use Particle Particle-* Reconstruction + +library muonEvent *.cxx + +apply_pattern installed_library + +private + +use GaudiInterface GaudiInterface-* External +use VxVertex VxVertex-* Tracking/TrkEvent +use AtlasReflex AtlasReflex-* External -no_auto_imports +use Navigation Navigation-* Control + +macro navigables_MuonEvent "" +macro_append navigables_MuonEvent "Analysis::MuonContainer " + +apply_pattern lcgdict dict=muonEvent \ +selectionfile=selection.xml \ +navigables=$(navigables_MuonEvent) \ +elementLinks="MuonCaloEnergyContainer" \ +headerfiles=" ../muonEvent/muonEventDict.h" + + diff --git a/Reconstruction/MuonIdentification/muonEvent/doc/mainpage.h b/Reconstruction/MuonIdentification/muonEvent/doc/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..0ed3c0dd0846ddf0b33734d18f40980b92d2785f --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/doc/mainpage.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + +@mainpage Package providing the Muon object for combined reconstruction and physics analysis + + - This package contains the ATLAS muon EDM class, Analysis::Muon. + Using a flexible author/content scheme it describes the identification + mechanism together with muon parameters and the underlying Inner Detector, + Calorimeter and Muon Spectrometer information used for the identification. + The class is used for ALL muon (combined) reconstruction algorithms in + ATLAS, therefore describes standalone, combined, segment- and calo-tagged muons. + - The Analysis::MuonContainer is the StoreGate container holding a vector of + Analysis::Muon. + - It also carries the energy loss by the muon in the Calorimeter, CaloEnergy. + The CaloEnergy carries a vector of DepositInCalo, energy deposition in the + various calorimeter layers. + - This class also carries the calorimeter isolation ET and TrackIsolation + (number of tracks) calculated in various cones of 0.1, 0.2, 0.3, 0.4, 0.45 (default), + 0.5, 0.6 and 0.7. See the muon isolation tools, + MuonIsolationTool and TrackIsolationTool, for further details. + - It is the same class that is used for high Pt or low Pt reconstructions, although + each algorithm creates its own collection of Muon in the ESD. + - Currently the Muons in the names author collections or special ESD collections + are made without overlap removal, therefore contain only one author per muon. + In the persistified muon collections on ESD and AOD, overlaps are removed and + a physical muon identified by several algorithms has a choice of primary author + as well as the history which other authors have found this muon. + - There is also the Muon Spectrometer Shower object, Rec::MuonSpShowerContainer, + in the same package. The Rec::MuonSpShower object consists of the numbers of + Muon Spectrometer Hits and numbers of Muon::Segment in the Inner, Middle and + Outer multi-layer, numbers calculated in some cone (default 0.7) around the + Jet axes. + - The Rec::SegmentParticleContainer is a collection of Rec::SegmentParticle, + track segments to be used in the AOD. The Rec::SegmentParticle has a link, + ElementLink, to the original Muon::Segment, or Trk::TrackSegment from which + the Rec::SegmentParticle was created. Rec::SegmentParticle also has pointers + to the Trk::GlobalDirection, the global Trk::ErrorMatrix, the Trk::FitQuality, + the Trk::GlobalPosition, the number of Trk::RIO_OnTrack, and the IdentifierHash + for the detector element associated to the Trk::Surface of the orginal Trk::Segment. + + - Responsible: ATLAS Muon Combined Performance Working Group <br> + atlas-perf-muons-conveners (at) cern.ch + +@section ExtrasMuonEvent CMT and Dependency Description + + - @ref UsedMuonEvent + - @ref RequirementsMuonEvent +*/ + +/** +@page UsedMuonEvent Used Packages +@htmlinclude used_packages.html +*/ + +/** +@page RequirementsMuonEvent Requirements +@include requirements +*/ + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/CaloEnergy.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/CaloEnergy.h new file mode 100644 index 0000000000000000000000000000000000000000..2d3e778b2babfa9e970bb9b070ab6b0a00ab076f --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/CaloEnergy.h @@ -0,0 +1,140 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*************************************************************************** + calorimeter energy deposit (measured or parametrized) with asymmetric error + Author: Alan Poppleton + Author: Gustavo Ordenez + Integration with CombinedMuon.h - Ketevi A. Assamagan + --------------------------------------------------------------------------- + ***************************************************************************/ + +#ifndef MUONEVENT_CALOENERGY_H +#define MUONEVENT_CALOENERGY_H + +#include "muonEvent/DepositInCalo.h" +#include "TrkMaterialOnTrack/EnergyLoss.h" + +#include <vector> + +/** @class CaloEnergy + @brief class extending the basic Trk::EnergyLoss to describe + the measured or parameterised muon energy loss in the ATLAS calorimeters + @author K. Assamagan, G. Ordonez, A. Poppleton +*/ + +class CaloEnergy : public Trk::EnergyLoss { + +public: + + /** Calo Energy Loss Type + Parametrized : reconstruction configured to use the parametrization w/o looking in the calo (eg calo off) + NotIsolated : the measurement in the calorimeter is not reliable due to additional energy around the muon + --> the parametrized value isused. + MOP : measurement found to be compatible with most probable value --> mop used as more reliable at this + region of the eloss + Tail : measured eloss significantly higher than mop --> the calo measurement used + FSRcandidate : in standalone reconstruction the Tail option was used. but an imbalance is observed when comparing + Pstandalone and Pinnerdetector (Pstandalone>Pinnerdetector) --> if using the mop resolves the imbalance the + excess energy loss is stored as fsrEnergy and the mop is used as the eloss. + */ + enum EnergyLossType { Parametrized=0, NotIsolated=1, MOP=2, Tail=3, FSRcandidate=4 }; + + /** default constructor - to be used only for persistency */ + CaloEnergy(void); + + /** full constructor */ + CaloEnergy (const Trk::EnergyLoss& eloss); + + CaloEnergy (float deltaE, + float sigmaDeltaE, + float sigmaMinusDeltaE=0.0, + float sigmaPlusDeltaE=0.0, + unsigned short energyLossType=0, + float likelhoold=0, + unsigned short tag=0); + + /** full constructor with the detailed deposits in Calo */ + CaloEnergy (float deltaE, + float sigmaDeltaE, + float sigmaMinusDeltaE, + float sigmaPlusDeltaE, + unsigned short energyLossType, + float likelhoold, + unsigned short tag, + const std::vector<DepositInCalo>& deposits); + + /** destructor */ + ~CaloEnergy(); + + /** copy constructor */ + CaloEnergy (const CaloEnergy&); + CaloEnergy* clone() const; + + /** assignment operator */ + CaloEnergy &operator= (const CaloEnergy&); + + /** Accessor methods */ + + /** energy determined from parametrization or not (measured) */ + CaloEnergy::EnergyLossType energyLossType (void) const; + + /** the Calo Muon Identification tag */ + unsigned short caloMuonIdTag() const { return m_caloMuonIdTag; } + + /** the calo Muon Identification likehood */ + double caloLRLikelihood() const { return m_caloLRLikelihood; } + + /** the vector of detailed deposits in calo layers */ + const std::vector<DepositInCalo>& depositInCalo() const { return m_deposits; } + + /** FSR Candidate Energy */ + float fsrCandidateEnergy() const { return m_fsrCandidateEnergy; } + + /** isolation ET in core deltaR */ + float etCore() const { return m_etCore; } + + /** set methods */ + + /** set is_parametrized or measured energy loss */ + void set_energyLossType(const CaloEnergy::EnergyLossType lossType) { m_energyLossType = lossType; } + + /** set the likelihood */ + void set_caloLRLikelihood ( const float likelihood ) { m_caloLRLikelihood = likelihood; } + + /** set the tag */ + void set_caloMuonIdTag ( unsigned short tag ) { m_caloMuonIdTag = tag; } + + /** set the detailed energy deposits in the calorimeter layers */ + void set_deposits( const std::vector<DepositInCalo> & deposits ) { m_deposits = deposits; } + + /** insert a deposit */ + void insert_deposit ( const DepositInCalo& deposit ) { m_deposits.push_back( deposit ); } + + /** FSR Candidate Energy */ + void set_fsrCandidateEnergy(const float fs) { m_fsrCandidateEnergy=fs; } + + /** isolation ET in core deltaR */ + void set_etCore ( const float etcore ) { m_etCore=etcore; } + +private: + + EnergyLossType m_energyLossType; + float m_caloLRLikelihood; + unsigned short m_caloMuonIdTag; + float m_fsrCandidateEnergy; + std::vector<DepositInCalo> m_deposits; + float m_etCore; // summed cell ET in core DeltaR + +}; + +inline CaloEnergy::EnergyLossType CaloEnergy::energyLossType (void) const +{ return m_energyLossType; } + +inline CaloEnergy* CaloEnergy::clone() const +{ return new CaloEnergy(*this); } + +#endif // MUONEVENT_CALOENERGY_H + + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/DepositInCalo.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/DepositInCalo.h new file mode 100644 index 0000000000000000000000000000000000000000..a8d2f32305515dde4332c5303c1e8b03892316a7 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/DepositInCalo.h @@ -0,0 +1,79 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONEVENT_DEPOSITINCALO_H +#define MUONEVENT_DEPOSITINCALO_H + +#include "CaloIdentifier/CaloCell_ID.h" + +/***************************************** + * Energy deposit in one calo layer +Author: Gustavo Ordenez +Author: adapted by Ketevi A. Assamagan +Date: Feb 28 2007 +******************************************/ + +/** @class DepositInCalo + @brief class describing the measured energy loss associated to muons + on the detector level, that is per calo layer. + @author K. Assamagan, G. Ordonez +*/ + +class DepositInCalo { + public: + + /** constructors */ + DepositInCalo() : m_subCaloId(CaloCell_ID::PreSamplerB), + m_energyDeposited(0.0), + m_muonEnergyLoss(0.0), + m_etDeposited(0.0) {}; + + /** constructors */ + DepositInCalo( CaloCell_ID::CaloSample subCaloId, + float energyDeposited, float muonEnergyLoss, float etDeposited=0.0 ) + : m_subCaloId(subCaloId), + m_energyDeposited(energyDeposited), + m_muonEnergyLoss(muonEnergyLoss), + m_etDeposited(etDeposited) + {} + + /** copy constructor */ + DepositInCalo (const DepositInCalo&); + + /** assignment operator */ + DepositInCalo &operator= (const DepositInCalo &); + + /** destructor */ + virtual ~DepositInCalo() {} + + /** printing for debugging */ + void print() const; + + /** Calorimeter detailed information */ + CaloCell_ID::CaloSample subCaloId() const { return m_subCaloId; } + /** Calorimeter detailed information - Energy Deposited*/ + double energyDeposited() const { return m_energyDeposited; } + /** Calorimeter detailed information - Muon Energy Loss */ + double muonEnergyLoss() const {return m_muonEnergyLoss;} + /** Calorimeter detailed information - et Deposited*/ + double etDeposited() const { return m_etDeposited; } + + private: + + /** calorimeter sampling identifier */ + CaloCell_ID::CaloSample m_subCaloId; + + /** energy Desposited */ + float m_energyDeposited; + + /** energy Loss of the muons computed using the extrapolator */ + float m_muonEnergyLoss; + + /** Et of the energy deposit */ + float m_etDeposited; + +}; + +#endif // + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h new file mode 100644 index 0000000000000000000000000000000000000000..9930fffb7b2a5f4e1c1d625046f0339ac0acc17b --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h @@ -0,0 +1,790 @@ +// dear emacs, this is -*- C++ -*- + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONEVENT_MUON_H +#define MUONEVENT_MUON_H 1 +/***************************************************************************** +Name : Muon.h - Adapted from the previous CombinedMuon.h +Package : offline/Reconstruction/MuonIdentification/muonEvent +Author : Ketevi A. Assamagan +*****************************************************************************/ + +#include "ParticleEvent/ParticleImpl.h" +#include "CLHEP/Vector/LorentzVector.h" +#include "FourMom/Lib/P4ImplIPtCotThPhiM.h" + +#include "CaloEvent/CaloClusterContainer.h" +#include "Particle/TrackParticleContainer.h" +#include "TrkSegment/SegmentCollection.h" +#include "muonEvent/MuonCaloEnergyContainer.h" +#include "muonEvent/MuonParamDefs.h" +#include "DataModel/ElementLink.h" +#include "DataModel/ElementLinkVector.h" + +#include "muonEvent/MuonQualityWord.h" + +#include <inttypes.h> + +namespace Analysis { + typedef NavigableTerminalNode MuonNavigation; + + /** @class Analysis::Muon + @brief The ATLAS Muon object - see doxygen, physics workbookd and + the Muon Combined Performance WG's pages for full documentation + + */ + +class Muon : public ParticleImpl< + ::Analysis::MuonNavigation, + ::P4ImplIPtCotThPhiM + > +{ + + /////////////////////////////////////////////////////////////////// + // Public typedefs: + /////////////////////////////////////////////////////////////////// + public: + + // for readability and lazy people + typedef ParticleImpl< ::Analysis::MuonNavigation, + ::P4ImplIPtCotThPhiM + > MuonImpl_t; + typedef MuonImpl_t::navigable_type navigable_type; + typedef MuonImpl_t::momentum_type momentum_type; + typedef MuonImpl_t::particle_type particle_type; + + public: + + /** Default constructor */ + Muon( ); + + /** Default constructor */ + Muon( MuonParameters::Author author ); + + /** create the combined muon from 3 TrackParticles: InDet, Extrapolated and Combined TP, + the combined TP defines the Fourmomentum, - + isExtrapolatedToVertex indicates whether it is a Track Extrapolated to the perigee + otherwise (if false) then it is a track extraplated from vertex out to the spectrometer */ + Muon( MuonParameters::Author author, + const Rec::TrackParticle* inDetTP, const Rec::TrackParticle* extrapTP, + const Rec::TrackParticle* combTP, const bool isExtrapolatedToVertex=true); + + + /** if the combined failed, still create the combined muon from Inner Detector track + and a MuonSegment. The trackparticle is associated as ID trackparticle and defines + the Fourmomentum. */ + Muon( MuonParameters::Author author, const Rec::TrackParticle* inDetTP, + const Trk::SegmentCollection* segmentContainer, + const std::vector<const Trk::Segment*>& muonSegments); + + /** creates a muon for Standalone, ID-seeded (MuGirl) and Calo-tagged muons: + for isExtrapolatedToVertex the trackparticle is interpreted as MS-standalone muon, + for not isExtrapolatedToVertex the author is queried to distinguish MuGirl-refitted + from calo tagged muons. + */ + Muon(MuonParameters::Author author, + const Rec::TrackParticle* extrapTP, const bool isExtrapolatedToVertex=false); + + /** Copy constructor */ + Muon( const Muon& rhs ); + + /** Assignment operator */ + Muon& operator=( const Muon& rhs ); + + /** Destructor */ + ~Muon(); + + /** navigation method */ + virtual void fillToken( INavigationToken & thisToken ) const; + /** navigation method */ + virtual void fillToken( INavigationToken & thisToken, const boost::any& ) const; + + /** return the primary author of this Muon - the algorithm that is most likely to + reconstruct prompt muons with high purity */ + MuonParameters::Author author() const { return m_author; } + + /** get all the authors of this Muon + for example during overlap checking, the same Muon may have been reconstructed by + many different algorithms. + the authors are 16-bit word, 1-bit reserved for each muon Algorithm + the positions of the 1-bit are defined as follows: + Muonboy | STACO | MuTag | Muid SA | Muid Co | MuGirl | MuGirlLowBeta | CaloMuon | CaloTag | CaloLikelihood | MuTagIMO | MuonCombinedRefit | ExtrapolateMuonToIP + x x x x x x x x x x x x x + each of these authors have 1 bit and the lower bits are Muonboy + */ + uint16_t allAuthors() const { return m_allAuthors; } + + /** check if this author is among the list of authors of this Muon - + obviously, the primary author MUST be in the list */ + bool isAuthor ( const unsigned int author ) const; + + /** check if this author is among the list of authors of this Muon - + obviously, the primary author MUST be in the list */ + bool isAuthor ( const MuonParameters::Author author ) const; + + /** set the primary Author : the primary author is the algorithm that first created this Muon */ + void set_author (MuonParameters::Author author) { m_author = author;} + + /** set all the authors of this Muon + the authors are 16-bit word, 1-bit reserved for each muon Algorithm + the positions of the 1-bit are defined as follows: + Muonboy | STACO | MuTag | Muid SA | Muid Co | MuGirl | MuGirlLowBeta | CaloMuon | + CaloTag / CaloLikelihood | MuTagIMO | MuonCombinedRefit | ExtrapolateMuonToIP + each of these authors have 1 bit and the lower bits are Muonboy + */ + void set_allAuthors ( const uint16_t allAuthors ) { m_allAuthors = allAuthors; } + + /** the add_author method returns a bool: + - if the author was already set, it will not reset it; it will return false + - if the author does not exist in the author list; it will not all add it, instead it return false */ + bool add_author ( MuonParameters::Author author ); + + /** other add_author method */ + void add_authors ( const uint16_t authors ) { m_allAuthors |= authors; } + + /** method for querying primary identification mechanism: muon identified + by successfully combining a full ID and a full MS track */ + bool isCombinedMuon() const; + + /** method for querying primary identification mechanism: muon identified + by spectrometer track (that is not associated to ID) as main author */ + bool isStandAloneMuon() const; + + /** Method for querying primary identification mechanism: muon identified + by inner-detector seeded identification (segment tagging or ID+MS refit) */ + bool isSegmentTaggedMuon() const; + + /** Method for querying primary identification mechanism: muon identified + solely by calorimeter based identification (so no signal in MS) */ + bool isCaloMuonId() const; + + /** Method for querying primary identification mechanism: a combined + muon where a clean forward standalone muon has been associated to a ID + tracklet*/ + bool isSiliconAssociatedForwardMuon() const; + + /** is this muon also reconstructed by the lowPt algorithm? */ + bool alsoFoundByLowPt () const { return m_isAlsoFoundByLowPt; } + + /** is this muon also reconstructed by a CaloMuon ID algorithm? */ + bool alsoFoundByCaloMuonId () const { return m_isAlsoFoundByCaloMuonId; } + + /** is this Calo Muon also reconstructed by one of the standard muon reconstruction algorithm? + Note that for calo muons, only Inner Detector and Calorimeter are used - the standard muon + reconstruction used the muon spectrometer as well + 0 - not found by muon reconstruction + 1 - found by Muonboy/STACO/MuTag + 2 = found by MuID SA/MuID Combined/MuGirl + 3 - found by both 1 and 2 */ + unsigned short caloMuonAlsoFoundByMuonReco() const { return m_caloMuonAlsoFoundByMuonReco; } + + /** set is also seen by low Pt reconstruction */ + void set_isAlsoFoundByLowPt(const bool isAlsoSeenByLowPt) { + (isAlsoSeenByLowPt) ? m_isAlsoFoundByLowPt=true : m_isAlsoFoundByLowPt=false; + } + + /** set is also seen by calo muon Id reconstruction */ + void set_isAlsoFoundByCaloMuonId(const bool isAlsoSeenByCaloMuonId) { + (isAlsoSeenByCaloMuonId) ? m_isAlsoFoundByCaloMuonId=true : m_isAlsoFoundByCaloMuonId=false; } + + /** set if this calo muon is also reconstructed by one of the standard muon recosntruction algorithms + that require the muon spectrometer - not that for calo muons, Inner Detector and Calorimeter only + are used + 0 - not found by muon reconstruction + 1 - found by Muonboy/STACO/MuTag + 2 = found by MuID SA/MuID Combined/MuGirl + 3 - found by both 1 and 2 */ + void set_caloMuonAlsoFoundByMuonReco(const unsigned short isAlsoFoundByMuonReco) { + m_caloMuonAlsoFoundByMuonReco=isAlsoFoundByMuonReco; + } + + /** return the primary track of this muon */ + const Rec::TrackParticle * track() const; + + /** get a parameter for this Muon - isolation energy in some cone for example */ + double parameter( MuonParameters::ParamDef x) const; + /** vector of parameter pairs for this Muon - isolation energy in some cone for example */ + const std::vector< std::pair<MuonParameters::ParamDef,float> > & parameter() const { return m_parameters; } + + /** get the chi2 of the MS-ID track match at the perigee*/ + double matchChi2() const {return m_matchChi2;} + + /** get the chi2 over number of DoF of the track match at perigee */ + double matchChi2OverDoF() const { + int dof = this->matchNumberDoF(); + if (dof > 0) return (this->matchChi2()/dof); + else return 0; + } + + /** get the number of DoF of the track match at perigee */ + int matchNumberDoF() const {return m_matchNumberDoF;} + + /** get the chi2 of the track fit */ + double fitChi2() const { + const Rec::TrackParticle * theTrack = track(); + if ( theTrack ) return theTrack->fitQuality()->chiSquared(); + else return -1.0; + } + + /** get the number of DoF of the track fit */ + int fitNumberDoF() const { + const Rec::TrackParticle * theTrack = track(); + if ( theTrack ) return theTrack->fitQuality()->numberDoF(); + else return 0; + } + + /** get the chi2 over number of DoF of the track fit */ + double fitChi2OverDoF() const { + int dof = this->fitNumberDoF(); + if (dof > 0) return (fitChi2() / dof); + else return 0.0; + } + + /** returns track matching at MS entrance for combined muons and match at + first segment for tagged muons. Pointer cached+owned by muon object. */ + const Trk::FitQuality* outerMatchChi2() const{ + if (m_outerMatchNumberDoF>0) return &m_transientOuterMatchChi2; + else return NULL; + } + + /** energy loss and its uncertainty in the calorimeter */ + std::pair<double,double> energyLoss() const; + + /** energy loss in the calorimeter - access to the full object */ + const CaloEnergy* caloEnergyLoss() const { return (m_caloEnergyLoss.isValid() ? *m_caloEnergyLoss : 0); } + + /** Is this combined Muon the best match? + Given a combined track, this method returns true/false + if this combined track is the best match to a muon spectrometer track. + Indeed because of high track multiplicity in Inner Detector, + there may be many combined tracks for one given muon + spectrometer track. */ + bool bestMatch () const { return m_bestMatch; } + + /** is this Muon corrected or not in AOD-to-AOD correction */ + bool isCorrected () const { return m_isCorrected; } + + /** deprecated - please use primary identification, muon quality or MuonCP group + guidelines to adopt a given muon quality definition */ +// bool isLowPtReconstructedMuon() const { +// bool accept = false; + /** this is the case of the DPD where the Track may have been dropped */ +// if ( m_hasInDetTrackParticle && !this->hasInDetTrackParticle() ) +// accept = this->isLowPt() && !this->bestMatch(); +// /** this is the case of the AOD */ +// else +// accept = this->isLowPt() && this->hasInDetTrackParticle() && !this->bestMatch(); +// return accept; +// } + + /** deprecated - please use hasCombinedMuonTrackParticle() instead */ + bool hasCombinedMuon() const {return hasCombinedMuonTrackParticle();} + /** test if associated indet TrackParticle is available */ + bool hasInDetTrackParticle() const {return m_inDetTrackParticle.isValid();} + /** test if associated MS TrackParticle (extrapolated to IP) is available */ + bool hasMuonExtrapolatedTrackParticle() const {return m_muonExtrapolatedTrackParticle.isValid();} + /** test if associated TrackParticle from ID-seeded full track fit is available */ + bool hasInnerExtrapolatedTrackParticle() const {return m_innerExtrapolatedTrackParticle.isValid();} + /** test if associated combined-muon TrackParticle is available */ + bool hasCombinedMuonTrackParticle() const {return m_combinedMuonTrackParticle.isValid();} + /** test if (in addition to the refitted combined muon) a stat.combined TrackParticle is available. + If no refit and combined muon only found by Staco, should be identica */ + bool hasStatCombinedMuonTrackParticle() const {return m_statCombinedMuonTrackParticle.isValid();} + + /** test for a valid pointer to a muon cluster */ + bool hasCluster() const { return m_cluster.isValid();} + + /** flag if the there was re-fit of ID and MS hits, currently muons from MuidCB, + CombinedMuonFit and MuGirl-refit */ + bool hasGlobalMuonTrackFit() const; + + /** deprecated - instead use primary identification, muon quality or MuonCP group + guidelines to adopt a given muon quality definition */ +// bool isHighPt() const; + + /** deprecated - instead use primary identification, muon quality or MuonCP group + guidelines to adopt a given muon quality definition */ + // bool isLowPt() const; + + /** Access to the TrackParticles */ + const Rec::TrackParticle* inDetTrackParticle() const { + return ( (this->hasInDetTrackParticle()) ? *m_inDetTrackParticle : 0); } + + /** Access to the TrackParticles */ + const Rec::TrackParticle* muonSpectrometerTrackParticle() const { + return ( (m_muonSpectrometerTrackParticle.isValid()) ? *m_muonSpectrometerTrackParticle : 0); } + + /** Access to the TrackParticles */ + const Rec::TrackParticle* muonExtrapolatedTrackParticle() const { + return ( (this->hasMuonExtrapolatedTrackParticle()) ? *m_muonExtrapolatedTrackParticle : 0); } + + /** Access to the TrackParticles */ + const Rec::TrackParticle* innerExtrapolatedTrackParticle() const { + return ( (this->hasInnerExtrapolatedTrackParticle()) ? *m_innerExtrapolatedTrackParticle : 0); } + + /** Access to the TrackParticles */ + const Rec::TrackParticle* combinedMuonTrackParticle() const { + return ( (this->hasCombinedMuonTrackParticle()) ? *m_combinedMuonTrackParticle : 0); } + + /** Access to the TrackParticles: statistical combination. + If no refitted muon exists and combined muon only found by Staco, should be identical to above */ + const Rec::TrackParticle* statCombinedMuonTrackParticle() const { + return ( (this->hasStatCombinedMuonTrackParticle()) ? *m_statCombinedMuonTrackParticle : 0); } + + /** Access to vector smart pointers (ElementLink) to muon segments */ + const ElementLinkVector<Trk::SegmentCollection> muonSegmentLink() const { return m_muonSegments; } + + /** Access to the smart pointer (ElementLink) to a given muon segment in the list */ + const ElementLink<Trk::SegmentCollection> muonSegmentLink(const unsigned int i, bool& validLink) const; + + /** Access to the smart pointer to inner detector track */ + const ElementLink<Rec::TrackParticleContainer> inDetTrackLink() const { return m_inDetTrackParticle; } + + /** Access to the smart pointer to the muon track extrapolated to the vertex */ + const ElementLink<Rec::TrackParticleContainer> muonExtrapTrackLink() const { return m_muonExtrapolatedTrackParticle; } + + /** Access to the smart pointer to the muon track extrapolated out from the vertex */ + const ElementLink<Rec::TrackParticleContainer> innerExtrapTrackLink() const { return m_innerExtrapolatedTrackParticle; } + + /** Access to the smart pointer to the muon combined track */ + const ElementLink<Rec::TrackParticleContainer> combinedTrackLink() const { return m_combinedMuonTrackParticle; } + + /** Access to the smart pointer to the muon combined track */ + const ElementLink<Rec::TrackParticleContainer> statCombinedTrackLink() const { return m_statCombinedMuonTrackParticle; } + + /** Access to the smart pointer to the muon spectrometer track */ + const ElementLink<Rec::TrackParticleContainer> muonSpectrometerTrackLink() const { return m_muonSpectrometerTrackParticle; } + + /*8 Access to the smart pointer to the calo cluster associated to the muon */ + const ElementLink<CaloClusterContainer> clusterLink() const { return m_cluster; } + + /** Access to the smart pointer to the calorimeter energy loss objeect associated to the muon */ + const ElementLink<MuonCaloEnergyContainer> caloEnergyLink() const { return m_caloEnergyLoss; } + + /** access to the calorimeter info */ + const CaloCluster* cluster() const { return ((this->hasCluster()) ? *m_cluster : 0); } + + /** Get Inner detector Hits information from ID trackparticle */ + int numberOfBLayerHits() const; + /** Get number of Pixel hits from ID trackparticle */ + int numberOfPixelHits() const; + /** Get number of Silicon SCT hits from ID trackparticle */ + int numberOfSCTHits() const; + /** Get number of TRT hits from ID trackparticle */ + int numberOfTRTHits() const; + /** Get number of TRT High Threshold hits from ID trackparticle */ + int numberOfTRTHighThresholdHits() const; + /** Get number of shared hits or holes from ID trackparticle */ + int numberOfBLayerSharedHits() const; + /** Get number of Pixel shared hits from ID trackparticle */ + int numberOfPixelSharedHits() const; + /** Get number of Pixel holes from ID trackparticle */ + int numberOfPixelHoles() const; + /** Get number of Silicon SCT shared hits from ID trackparticle */ + int numberOfSCTSharedHits() const; + /** Get number of Silicon SCT holes from ID trackparticle */ + int numberOfSCTHoles() const; + /** Get number of TRT Outliers from ID trackparticle */ + int numberOfTRTOutliers() const; + /** Get number of TRT Outliers High Threshold from ID trackparticle */ + int numberOfTRTHighThresholdOutliers() const; + + /** Get Muon Spectrometer MDT Hits information for MS track or tagged segments */ + int numberOfMDTHits() const; + /** Get Muon Spectrometer MDT holes information for MS track or tagged segments */ + int numberOfMDTHoles() const; + /** Get Muon Spectrometer CSC Eta Hits information for MS track or tagged segments */ + int numberOfCSCEtaHits() const; + /** Get Muon Spectrometer CSC Eta Holes information for MS track or tagged segments */ + int numberOfCSCEtaHoles() const; + /** Get Muon Spectrometer CSC Phi Hits information for MS track or tagged segments */ + int numberOfCSCPhiHits() const; + /** Get Muon Spectrometer CSC Phi Holes information for MS track or tagged segments */ + int numberOfCSCPhiHoles() const; + /** Get Muon Spectrometer RPC Eta Hits information for MS track or tagged segments */ + int numberOfRPCEtaHits() const; + /** Get Muon Spectrometer RPC Eta Holes information for MS track or tagged segments */ + int numberOfRPCEtaHoles() const; + /** Get Muon Spectrometer RPC Phi Hits information for MS track or tagged segments */ + int numberOfRPCPhiHits() const; + /** Get Muon Spectrometer RPC Phi Holes information for MS track or tagged segments */ + int numberOfRPCPhiHoles() const; + /** Get Muon Spectrometer TGC Eta Hits information for MS track or tagged segments */ + int numberOfTGCEtaHits() const; + /** Get Muon Spectrometer TGC Eta Holes information for MS track or tagged segments */ + int numberOfTGCEtaHoles() const; + /** Get Muon Spectrometer TGC Phi Hits information for MS track or tagged segments */ + int numberOfTGCPhiHits() const; + /** Get Muon Spectrometer TGC Phi Holes information for MS track or tagged segments */ + int numberOfTGCPhiHoles() const; + + /** number of Ganged Pixel for track from primary author */ + int numberOfGangedPixels() const; + /** number of outliers for track from primary author */ + int numberOfOutliersOnTrack() const; + /** number of summaryTypes for track from primary author */ + int numberOfTrackSummaryTypes(unsigned int type=0) const; + + // get d0 and z0 with respect to primary vertex + // KC: These methods were taking out of the TrackParticle + // const double z0wrtPrimVtx() const; + // const double d0wrtPrimVtx() const; + + /** Access to the MS eta hits associated by segment-tagged muons */ + const std::vector<int>& associatedEtaDigits() const { return m_associatedEtaDigits; } + /** Access to the MS phi hits associated by segment-tagged muons */ + const std::vector<int>& associatedPhiDigits() const { return m_associatedPhiDigits; } + /** Access to the MS eta hits associated by segment-tagged muons */ + const std::vector<int>& segmentEtaDigits() const { return m_associatedEtaDigits; } + /** Access to the MS phi hits associated by segment-tagged muons */ + const std::vector<int>& segmentPhiDigits() const { return m_associatedPhiDigits; } + + /** field integral seen by the track in the muon spectrometer - defined only for standalone, + combined and MuGirl(refit) muons */ + float spectrometerFieldIntegral() const + { return this->parameter(MuonParameters::spectrometerFieldIntegral); } + + /** scatteringAngleSignificance based on the curvature significance, from track fit in ID + (thus not available for SA muons) */ + float scatteringCurvatureSignificance() const + { return this->parameter(MuonParameters::scatteringCurvatureSignificance); } + + /** scatteringAngleSignificance based on hard scatterers over few near-by measurements, + from track fit in inner detector (thus not available for SA muons) */ + float scatteringNeighbourSignificance() const + { return this->parameter(MuonParameters::scatteringNeighbourSignificance); } + + /** momentumBalanceSignificance defined for fitted or combined muons in order to identify decays in flight */ + float momentumBalanceSignificance() const + {return this->parameter(MuonParameters::momentumBalanceSignificance); } + + /** Access to some Delta(eta) from muon segment taggers */ + float segmentDeltaEta() const { return this->parameter(MuonParameters::segmentDeltaEta); } + /** Access to some Detla(phi) from muon segment taggers */ + float segmentDeltaPhi() const { return this->parameter(MuonParameters::segmentDeltaPhi); } + /** Access to a match chi2/ndf from muon segment taggers */ + float segmentChi2OverDoF() const { return this->parameter(MuonParameters::segmentChi2OverDoF); } + /** Access to some neural-network output for muons found by MuGirl */ + float annBarrel () const { return this->parameter(MuonParameters::annBarrel); } + /** Access to some neural-network output for muons found by MuGirl */ + float annEndCap () const { return this->parameter(MuonParameters::annEndCap); } + /** Access to some angles for muons found by MuGirl */ + float innAngle () const { return this->parameter(MuonParameters::innAngle); } + /** Access to some angles for muons found by MuGirl */ + float midAngle () const { return this->parameter(MuonParameters::midAngle); } + /** Access to event phase for muons found by MuGirlLowBeta */ + float t0() const { return this->parameter(MuonParameters::t0); } + /** Access to particle velocity fit parameter for muons found by MuGirlLowBeta */ + float beta() const { return this->parameter(MuonParameters::beta); } + + /** Access to the muon segments */ + const Trk::Segment * muonSegment(unsigned int i) const { + if ( m_muonSegments.size() <= i ) return 0; + else if ( m_muonSegments[i].isValid() ) return *(m_muonSegments[i]); + else return 0; } + + /** Access to the number of muon segments */ + unsigned int numberOfSegments() const { return m_muonSegments.size(); } + + /** access to TrkTracks - InDetTrack*/ + const Trk::Track* inDetTrkTrack() const { + return ((this->hasInDetTrackParticle()) ? (*m_inDetTrackParticle)->originalTrack() : 0); } + /** access to TrkTracks - MuonSpectrometerTrack*/ + const Trk::Track* muonSpectrometerTrkTrack() const { + return ((m_muonSpectrometerTrackParticle.isValid()) ? (*m_muonSpectrometerTrackParticle)->originalTrack() : 0); } + /** access to TrkTracks - muonExtrapolatedTrack*/ + const Trk::Track* muonExtrapolatedTrkTrack() const { + return ((this->hasMuonExtrapolatedTrackParticle()) ? (*m_muonExtrapolatedTrackParticle)->originalTrack() : 0); } + /** access to TrkTracks - innerExtrapolatedTrack*/ + const Trk::Track* innerExtrapolatedTrkTrack() const { + return ((this->hasInnerExtrapolatedTrackParticle()) ? (*m_innerExtrapolatedTrackParticle)->originalTrack() : 0); } + /** access to TrkTracks - CombinedTrack*/ + const Trk::Track* combinedMuonTrkTrack() const { + return ((this->hasCombinedMuonTrackParticle()) ? (*m_combinedMuonTrackParticle)->originalTrack() : 0); } + + /** access to muon quality information + the user must take care to delete the pointer + the Muon does not own it */ + const MuonQualityWord & isMuon () const { + return m_isMuonBits; + } + + /** test for muon being categorised as "loose" */ + bool isLoose () const { + return m_isMuonBits.isLoose(); + } + + /** test for muon being categorised as "medium" */ + bool isMedium () const { + return m_isMuonBits.isMedium(); + } + + /** test for muon being categorised as "tight" */ + bool isTight () const { + return m_isMuonBits.isTight(); + } + + /** return the muon likelihood - not yet used */ + float isMuonLikelihood() const { return m_isMuonLikelihood; } + + // set methods + + /** set a parameter in the MuonParamDefs.h */ + void set_parameter(MuonParameters::ParamDef index, double value, bool overwrite=false); + + /** set the energy loss in the calorimeter */ + void set_energyLoss ( const CaloEnergy* caloEnergy ) { m_caloEnergyLoss.setElement(const_cast<CaloEnergy*>(caloEnergy)); } + /** set the energy loss in the calorimeter */ + void set_energyLossContainer ( const MuonCaloEnergyContainer* cont ) { m_caloEnergyLoss.setStorableObject(*cont); } + /** set the energy loss in the calorimeter */ + void set_energyLoss ( const MuonCaloEnergyContainer* cont, const CaloEnergy* caloEnergy ); + + /** set the chi2 parameters - matchChi2*/ + void set_matchChi2(float x) {m_matchChi2 = x;} + /** set the chi2 parameters - number of degrees of freedom*/ + void set_matchNumberDoF(int x) {m_matchNumberDoF = x;} + /** set the outer match chi2/ndof for combined and segment-tagged muons */ + void set_outerMatchChi2(double x, int ndof); + + /** set the best match */ + void set_bestMatch( bool best) { m_bestMatch = best; } + + /** is this Muon corrected in AOD-to-AOD correction or not? */ + void set_isCorrected ( bool corrected ) { m_isCorrected=corrected; } + + /** set the Calorimeter information */ + void set_cluster( const CaloClusterContainer* cont, const CaloCluster* cluster ) { + m_cluster.toContainedElement( *cont, const_cast<CaloCluster*> (cluster)); + m_hasCluster = m_cluster.isValid(); + } + /** set the Calorimeter information */ + void set_cluster( const CaloCluster* cluster) { + m_cluster.setElement(const_cast<CaloCluster*>(cluster)); + m_hasCluster = m_cluster.isValid(); + } + /** set the Calorimeter information */ + void set_clusterContainer(const CaloClusterContainer * clusterContainer) { + m_cluster.setStorableObject(*clusterContainer); + m_hasCluster = m_cluster.isValid(); + } + + /** Set the inner detector track particle. Does not change the Muon's 4-momentum. */ + void set_inDetTrackParticle(const Rec::TrackParticleContainer*, const Rec::TrackParticle* ); + /** Set the inner detector track particle. Does not change the Muon's 4-momentum. */ + void set_inDetTrackParticle(const Rec::TrackParticle* ); + + /** set Muon Spectrometer TrackParticle */ + void set_muonSpectrometerTrackParticle(const Rec::TrackParticleContainer*, const Rec::TrackParticle*); + + /** set the muon spectrometer extrapolated track particle. Does not change the Muon's 4-momentum. */ + void set_muonExtrapolatedTrackParticle(const Rec::TrackParticleContainer*, const Rec::TrackParticle*); + /** set the muon spectrometer extrapolated track particle. Does not change the Muon's 4-momentum. */ + void set_muonExtrapolatedTrackParticle(const Rec::TrackParticle* ); + + /** set the extrapolated track particle from the inner detector. Does not change the Muon's 4-momentum. */ + void set_innerExtrapolatedTrackParticle(const Rec::TrackParticleContainer*, const Rec::TrackParticle*); + /** set the extrapolated track particle from the inner detector. Does not change the Muon's 4-momentum. */ + void set_innerExtrapolatedTrackParticle(const Rec::TrackParticle* ); + + /** set the combined muon track particle. Does not change the Muon's 4-momentum. */ + void set_combinedMuonTrackParticle(const Rec::TrackParticleContainer*, const Rec::TrackParticle* ); + /** set the combined muon track particle. Does not change the Muon's 4-momentum. */ + void set_combinedMuonTrackParticle(const Rec::TrackParticle* ); + /** set the combined muon track particle for statistical combination. Does not change the Muon's 4-momentum. */ + void set_statCombinedMuonTrackParticle(const Rec::TrackParticleContainer*, + const Rec::TrackParticle* ); + + /** set the combined muon track particle */ + void set_muonSegments(const Trk::SegmentCollection*, const std::vector<const Trk::Segment*>& ); + /** set the combined muon track particle */ + void addSegment ( const Trk::SegmentCollection*, const Trk::Segment* ); + + /** set the TrackParticle containers */ + void set_inDetTrackParticleContainer(const Rec::TrackParticleContainer * inDetTPContainer) { + m_inDetTrackParticle.setStorableObject(*inDetTPContainer); + m_hasInDetTrackParticle = m_inDetTrackParticle.isValid(); + } + /** set the TrackParticle containers */ + void set_muonExtrapolatedTrackParticleContainer(const Rec::TrackParticleContainer * + muonExtrapolatedTPContainer) { + m_muonExtrapolatedTrackParticle.setStorableObject(*muonExtrapolatedTPContainer); + m_hasMuonExtrapolatedTrackParticle = m_muonExtrapolatedTrackParticle.isValid(); + } + /** set the TrackParticle containers */ + void set_innerExtrapolatedTrackParticleContainer(const Rec::TrackParticleContainer * + innerExtrapolatedTPContainer) { + m_innerExtrapolatedTrackParticle.setStorableObject(*innerExtrapolatedTPContainer); + m_hasInnerExtrapolatedTrackParticle = m_innerExtrapolatedTrackParticle.isValid(); + } + /** set the TrackParticle containers */ + void set_combinedMuonTrackParticleContainer(const Rec::TrackParticleContainer * combinedMuonTPContainer) { + m_combinedMuonTrackParticle.setStorableObject(*combinedMuonTPContainer); + m_hasCombinedMuonTrackParticle = m_combinedMuonTrackParticle.isValid(); + } + + /** set the TrackParticle containers */ + void set_statCombinedMuonTrackParticleContainer(const Rec::TrackParticleContainer * combinedMuonTPContainer) { + m_statCombinedMuonTrackParticle.setStorableObject(*combinedMuonTPContainer); + } + + /** Set the LowPt stuff */ + /** Set the LowPt - Associated Eta Digits */ + void set_numberOfAssociatedEtaDigits(int nMDT, int nCSC, int nRPC, int nTGC); + /** Set the LowPt - Associated Phi Digits */ + void set_numberOfAssociatedPhiDigits(int nMDT, int nCSC, int nRPC, int nTGC); + /** Set the LowPt - Associated Eta Digits */ + void set_numberOfAssociatedEtaDigits(const std::vector<int>& associated_digits); + /** Set the LowPt - Associated Phi Digits */ + void set_numberOfAssociatedPhiDigits(const std::vector<int>& associated_digits); + + /** Set Segment Eta Digits */ + void set_numberOfSegmentEtaDigits(int nMDT, int nCSC, int nRPC, int nTGC); + /** Set Segment Phi Digits */ + void set_numberOfSegmentPhiDigits(int nMDT, int nCSC, int nRPC, int nTGC); + /** Set Segment Eta Digits */ + void set_numberOfSegmentEtaDigits(const std::vector<int>& associated_digits); + /** Set Segment Phi Digits */ + void set_numberOfSegmentPhiDigits(const std::vector<int>& associated_digits); + + /** set field integral seen by the track in the muon spectrometer - defined only for standalone, + combined and MuGirl(refit) muons */ + void set_spectrometerFieldIntegral (const float field) + { this->set_parameter(MuonParameters::spectrometerFieldIntegral,field); } + + /** set scatteringAngleSignificance based on the curvature significance, from track fit in ID. */ + void set_scatteringCurvatureSignificance (const float significance) + { this->set_parameter(MuonParameters::scatteringCurvatureSignificance,significance); } + + /** set scatteringAngleSignificance based on hard scatterers over few near-by measurements, + from track fit in inner detector */ + void set_scatteringNeighbourSignificance (const float significance) + { this->set_parameter(MuonParameters::scatteringNeighbourSignificance,significance); } + + /** set momentumBalanceSignificance for fitted or combined muons as discriminator against background muons */ + void set_momentumBalanceSignificance(const float significance) + { this->set_parameter(MuonParameters::momentumBalanceSignificance,significance); } + + /** Set Segment Delta Eta */ + void set_segmentDeltaEta (const float deltaEta) { this->set_parameter(MuonParameters::segmentDeltaEta,deltaEta); } + /** Set Segment Delta Phi */ + void set_segmentDeltaPhi (const float deltaPhi) { this->set_parameter(MuonParameters::segmentDeltaPhi,deltaPhi); } + /** Set Segment Chi2 over degrees of freeedom */ + void set_segmentChi2OverDoF (const float chi2) { this->set_parameter(MuonParameters::segmentChi2OverDoF,chi2); } + + /** Set annBarrel */ + void set_annBarrel (const float annB) { this->set_parameter(MuonParameters::annBarrel,annB); } + /** Set annEndCap */ + void set_annEndCap (const float annE) { this->set_parameter(MuonParameters::annEndCap,annE); } + /** Set innAngle */ + void set_innAngle (const float innA) { this->set_parameter(MuonParameters::innAngle,innA); } + /** Set midAngle */ + void set_midAngle (const float midA) { this->set_parameter(MuonParameters::midAngle,midA); } + + //----------------------------------------------------------------- + // 4-mom modifiers + //----------------------------------------------------------------- + + /** set inverse pT data member */ + void setIPt( const double theIPt ) + { return this->momentumBase().setIPt(theIPt); } + + /** set cot(theta) data member */ + void setCotTh( const double theCotTh ) + { return this->momentumBase().setCotTh(theCotTh); } + + /** set phi data member */ + void setPhi( const double thePhi ) + { return this->momentumBase().setPhi(thePhi); } + + /** set m data member */ + void setM( const double theM ) + { return this->momentumBase().setM(theM); } + + /** function to copy muon segment element links into this muon */ + void copySegmentLinkVector( const ElementLinkVector<Trk::SegmentCollection>& segments ); + + /** set muon quality parameters */ + void set_isMuonBits ( const uint16_t isMuonBits ) { m_isMuonBits.set(isMuonBits); } + void set_isMuonBits ( const MuonQualityWord& qWord ) { m_isMuonBits = qWord; } + void set_isMuonLikelihood ( const float muonLikelihood ) { m_isMuonLikelihood = muonLikelihood; } + + private: + + /** the author of this muon */ + MuonParameters::Author m_author; + + /** was there a successfully combined trach? */ + bool m_hasCombinedMuon; + + /** test for TrackParticles */ + bool m_hasInDetTrackParticle; + bool m_hasMuonExtrapolatedTrackParticle; + bool m_hasInnerExtrapolatedTrackParticle; + bool m_hasCombinedMuonTrackParticle; + + /* Calorimeter cluster info */ + bool m_hasCluster; + + /* chi2 of the track matching */ + float m_matchChi2; + int m_matchNumberDoF; + int m_outerMatchNumberDoF; + Trk::FitQuality m_transientOuterMatchChi2; + bool m_bestMatch; + + /** Low Pt muon stuff */ + std::vector<int> m_associatedEtaDigits; + std::vector<int> m_associatedPhiDigits; + /** end LowPt stuff */ + + /** the associated TrackParticles */ + ElementLink<Rec::TrackParticleContainer> m_inDetTrackParticle; + ElementLinkVector<Trk::SegmentCollection> m_muonSegments; + ElementLink<Rec::TrackParticleContainer> m_muonExtrapolatedTrackParticle; + ElementLink<Rec::TrackParticleContainer> m_innerExtrapolatedTrackParticle; + ElementLink<Rec::TrackParticleContainer> m_combinedMuonTrackParticle; + ElementLink<Rec::TrackParticleContainer> m_statCombinedMuonTrackParticle; + ElementLink<CaloClusterContainer> m_cluster; + + /** needed by MOORE */ + ElementLink<Rec::TrackParticleContainer> m_muonSpectrometerTrackParticle; + + /** Parameters as defined in MuonParamDef.h */ + std::vector<std::pair<MuonParameters::ParamDef, float> > m_parameters; + + /** this muon is also found by the lowPT reconstruction algorithm */ + bool m_isAlsoFoundByLowPt; + + /** this muon is also found by the Calo Muon ID reconstruction algorithm */ + bool m_isAlsoFoundByCaloMuonId; + + /** energy loss in calorimeter */ + ElementLink<MuonCaloEnergyContainer> m_caloEnergyLoss; + + /** flag the calo muon if it is also reconstruction by the standart muon algorithms */ + unsigned short m_caloMuonAlsoFoundByMuonReco; + + /** AOD to AOD correction */ + bool m_isCorrected; + + + /** all authors - all the authors of this this Muon */ + uint16_t m_allAuthors; + + /** muon selection parameters */ + MuonQualityWord m_isMuonBits; + float m_isMuonLikelihood; + +}; + +} + +#endif // MUONEVENT_MUON_H + + + + + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonCaloEnergyContainer.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonCaloEnergyContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..1ec1e09e80efacf583c2c929b9ae9981ff9cb3c3 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonCaloEnergyContainer.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONEVENT_MUONCALOENERGYCONTAINER_H +#define MUONEVENT_MUONCALOENERGYCONTAINER_H + +#include "DataModel/DataVector.h" +#include "CLIDSvc/CLASS_DEF.h" +#include "muonEvent/CaloEnergy.h" + +/** @class MuonCaloEnergyContainer + @brief Data object for a StoreGate container holding a vector of CaloEnergy, + the detailed energy loss description associated to combined muons + @author K. A. Assamagan +*/ + +class MuonCaloEnergyContainer : public DataVector<CaloEnergy> +{ + public: + MuonCaloEnergyContainer(SG::OwnershipPolicy own = SG::OWN_ELEMENTS) + : DataVector<CaloEnergy>(own) {} + virtual ~MuonCaloEnergyContainer() {}; + +}; + +CLASS_DEF(MuonCaloEnergyContainer, 1473853273, 1) + +#endif + + + + + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonContainer.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..018d17007c4157ae1f27d48b22e3ac0da8110d63 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonContainer.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONEVENT_MUONCONTAINER_H +#define MUONEVENT_MUONCONTAINER_H + +////////////////////////////////////////////////////////////////////////////////////// +/// +/// Name: MuonContainer.h +/// Package : offline/Reconstruction/MuonIdentification/muonEvent +/// +/// Authors: K. A. Assamagan +/// Created: December 2004 +/// +/// Purpose: This is a data object, containing a collection of Muon Objects +///////////////////////////////////////////////////////////////////////////////////// + +// INCLUDE HEADER FILES: + +#include "DataModel/DataVector.h" +#include "SGTools/CLASS_DEF.h" +#include "muonEvent/Muon.h" + +#include "NavFourMom/IParticleContainer.h" +// Needed for constructing the mirror container hierarchy +// This tells StoreGate that DV<Analysis::Muon> derives from DV<IParticle> +DATAVECTOR_BASE( Analysis::Muon, IParticle ); + +namespace Analysis { + + /** @class Analysis::MuonContainer + @brief definition of StoreGate container holding a vector of Analysis::Muon + @author K. A. Assamagan + */ + +class MuonContainer : public DataVector<Analysis::Muon> +{ + public: + MuonContainer(SG::OwnershipPolicy own = SG::OWN_ELEMENTS) + : DataVector<Analysis::Muon>(own) {} + virtual ~MuonContainer() {}; + void print(); + +}; + +} + +CLASS_DEF(Analysis::MuonContainer, 1073853171, 1) +SG_BASE(Analysis::MuonContainer, DataVector<Analysis::Muon> ); // < needed for auto-symlink feature + +#endif + + + + + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonParamDefs.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonParamDefs.h new file mode 100644 index 0000000000000000000000000000000000000000..95aea47168c24a697eeef60b34ec3b0bb192f5c9 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonParamDefs.h @@ -0,0 +1,149 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONEVENT_MUONPARAMDEFS_H +#define MUONEVENT_MUONPARAMDEFS_H +/***************************************************************************** +Name : MuonParamDefs.h +Package : offline/Reconstruction/MuonIdentification/muonEvent +Author : Ketevi A. Assamagan +Created : September 2005 + +DESCRIPTION: + +This file defines enums for Muon parameters + +*****************************************************************************/ + +#include <vector> +#include <string> + +namespace MuonParameters { + + /** do not change the order of these enums. You can add one, but + changing the order is bad. + The authors "highpt", "lowPt" and "mediumPt" should not be used - + they are kept for backward compatibility ONLY, to read old data + */ + enum Author { + unknown=0, + highPt=1, + lowPt=2, + mediumPt=3, + MuonboySP=4, + Muonboy=5, + STACO=6, + MuTag=7, + MOORE=10, + MuidSA=11, + MuidCo=12, + MuGirl=13, + CaloMuonId=14, + MuGirlLowBeta=15, + CaloTag=16, + CaloLikelihood=17, + MuTagIMO=18, + MuonCombinedRefit=19, + ExtrapolateMuonToIP=20, + NumberOfMuonAuthors=21 // increase this guy when adding + }; + + + /** @struct AuthorNames + + @brief Simple struct to access the strings of the author definitions + for output reasons. + + Use in the following way: + MuonParameters::AuthorNames authorNames; + std::string thisMuon = authorNames.author[muon.author()]; + + @author Wolfgang.Liebig@cern.ch + */ + struct AuthorNames { + /**Constructor*/ + AuthorNames() + { + author.reserve(NumberOfMuonAuthors); + + author.push_back("undefined"); // 0 + author.push_back("unknown"); + author.push_back("unknown"); + author.push_back("unknown"); + author.push_back("Muonboy (SP)"); + author.push_back("Muonboy"); // 5 + author.push_back("STACO"); + author.push_back("MuTag"); + author.push_back("unknown"); + author.push_back("unknown"); + author.push_back("Moore"); // 10 + author.push_back("Muid Standalone"); + author.push_back("Muid Combined"); + author.push_back("MuGirl"); + author.push_back("CaloMuonID"); + author.push_back("MuGirlLowBeta"); // 15 + author.push_back("CaloTag"); + author.push_back("CaloLikelihood"); + author.push_back("MuTagIMO"); + author.push_back("MuonCombinedRefit"); + author.push_back("ExtrapolateMuonToIP"); // 20 + } + + /**The member*/ + std::vector<std::string> author; + + }; + + + + /** Enum for parameter indexes */ + enum ParamDef { + /** isolation enums - common parameters */ + etcone10 = 0,//<! Isolation Et in a cone of 0.1 + etcone20 = 1,//<! Isolation Et in a cone of 0.2 + etcone30 = 2,//<! Isolation Et in a cone of 0.3 + etcone40 = 3,//<! Isolation Et in a cone of 0.4 + nucone10 = 8,//<! Number of Tracks in a cone of 0.1 + nucone20 = 9,//<! Number of Tracks in a cone of 0.2 + nucone30 = 10,//<! Number of Tracks in a cone of 0.3 + nucone40 = 11,//<! Number of Tracks in a cone of 0.4 + ptcone10 = 16,//<! summed Pt of tracks in a cone of 0.1 + ptcone20 = 17,//<! summed Pt of tracks in a cone of 0.2 + ptcone30 = 18,//<! summed Pt of tracks in a cone of 0.3 + ptcone40 = 19,//<! summed Pt of tracks in a cone of 0.4 +// + etconeNoEm10 = 20,//<! Isolation Et removing electromagnetic component in a cone of 0.1 + etconeNoEm20 = 21,//<! Isolation Et removing electromagnetic component in a cone of 0.2 + etconeNoEm30 = 22,//<! Isolation Et removing electromagnetic component in a cone of 0.3 + etconeNoEm40 = 23,//<! Isolation Et removing electromagnetic component in a cone of 0.4 + + + /** Discriminators and further variables */ + spectrometerFieldIntegral = 50, //<! B-field integral in MS + scatteringCurvatureSignificance = 51, //<! Scattering angle significance: curvature + scatteringNeighbourSignificance = 52, //<! Scattering angle significance: neighbours + momentumBalanceSignificance = 53, //<! momentum balance significance + + /** MuTag parameters */ + segmentDeltaEta = 100, + segmentDeltaPhi = 101, + segmentChi2OverDoF = 102, + /** MuGirl parameter */ + t0 = 198, + beta = 199, + annBarrel = 200, + annEndCap = 201, + /** common MuGirl and MuTag parameters */ + innAngle = 202, + midAngle = 203 + }; + +} + +#endif // MUONIDEVENT_MUONPARAMDEFS_H + + + + + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonQualityWord.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonQualityWord.h new file mode 100644 index 0000000000000000000000000000000000000000..b9c3e143c2d3fd7d906a6c81d2a083db2bd6fe09 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonQualityWord.h @@ -0,0 +1,94 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*************************************************************************** + Reconstruction/MuonIdentification/muonEvent/MuonQualityWord.h + Author: Ketevi A. Assamagan, July 2009 + Transienti class to hold muon quality bits and the methods to manipulate it + so as to return the the isLoose, isMedium and isTight to the use. + This object is not persistified. + --------------------------------------------------------------------------- + ***************************************************************************/ + +#ifndef MUONEVENT_MUONQUALITYWORD_H +#define MUONEVENT_MUONQUALITYWORD_H + +#include <inttypes.h> +#include <iostream> +class MsgStream; + +/** @class MuonQualityWord + + @brief A bitted word defining different levels of muon identification + qualities (in terms of purity and efficiency), based solely + on type of identification and reconstruction properties. + + The proposed bit encoding is as follows: + - bits 12-15 encode the ranking of a TIGHT muon + - bits 8-11 encode the ranking of a MEDIUM muon + - bits 4-7 encode the ranking of a LOOSE muon + - bits 0-3 encode the ranking of a UNSPECIFIED muon (i.e. container-specific information) + + As a consequence, + - isTight() returns the OR of bits 12-15 + - isMedium() returns the OR of bits 8-15 + - isLoose() returns the OR of bits 4-15 + + @author Ketevi Assamagan, Rikard Sandstroem +*/ + +class MuonQualityWord { + +public: + + /** full constructor with a quality word */ + MuonQualityWord ( uint16_t qualityWord ); + + /** default constructor */ + MuonQualityWord() { m_qualityWord = 0x0; }; + + /** destructor */ + ~MuonQualityWord(); + + /** copy constructor */ + MuonQualityWord (const MuonQualityWord&); + + /** assignment operator */ + MuonQualityWord &operator= (const MuonQualityWord&); + + /** set the quality word - needed if default constructor is used */ + void set ( uint16_t qualityWord ) { m_qualityWord = qualityWord; } + + /** Accessor methods */ + bool isLoose() const; + bool isMedium () const; + bool isTight () const; + + /** container specifi bits - may vary according to muon container */ + uint16_t type () const { return m_qualityWord & 0xF; } + + /** get back the quality word */ + uint16_t qualityWord() const { return m_qualityWord; } + +private: + + uint16_t m_qualityWord; +}; + +/** Overload of << operator for MsgStream for debug output*/ +MsgStream& operator << ( MsgStream& sl, const MuonQualityWord& qword); + +/** Overload of << operator for std::ostream for debug output*/ +std::ostream& operator << ( std::ostream& sl, const MuonQualityWord& qword); + + +inline bool MuonQualityWord::isLoose() const { return ( m_qualityWord >> 4) & 0xF; } + +inline bool MuonQualityWord::isMedium() const { return ( m_qualityWord >> 8) & 0xF; } + +inline bool MuonQualityWord::isTight() const { return ( m_qualityWord >> 12) & 0xF; } + +#endif // MUONEVENT_MUONQUALITYWORD_H + + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonSpShower.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonSpShower.h new file mode 100644 index 0000000000000000000000000000000000000000..55cc3b21db1ef5ed12726a0c0fc6c002ccd9d9b0 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonSpShower.h @@ -0,0 +1,120 @@ +// dear emacs, this is -*- C++ -*- + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*************************************************************************** + MuonSpShower.h - Description + ------------------- + begin : 28-07-2006 + authors : Ketevi A. Assamagan + email : ketevi@bnl.gov + + Store the numbers of hits and numbers of MuonSegments (MDT & CSC) in some + cone around jet axes. Store these number for Inner, Middle and Outer + multi-layers. + + April 2009: Riccardo Maria BIANCHI - Completing Doxygen docs for AOD Content Documentation + ***************************************************************************/ +#ifndef MUONEVENT_MUONSPSHOWER_H +#define MUONEVENT_MUONSPSHOWER_H 1 + +#include <vector> + +namespace Rec { + + class MuonSpShower { + + public: + + /** Default Constructor needed for persistency */ + MuonSpShower(); + + /** constructor */ + MuonSpShower( + const float eta, const float phi, + const unsigned short numOfTriggerHits, + const unsigned short numOfInnerHits, + const unsigned short numOfMiddleHits, + const unsigned short numOfOuterHits, + const unsigned short numOfInnerSegments, + const unsigned short numOfMiddleSegments, + const unsigned short numOfOuterSegments); + + /** copy constructor */ + MuonSpShower(const MuonSpShower & rhs); + + /** Assignement operator */ + MuonSpShower &operator= (const MuonSpShower &); + + /** Destructor */ + virtual ~MuonSpShower(); + + /** return the Jet axis - eta*/ + float eta() const { return m_eta; } + /** return the Jet axis - phi*/ + float phi() const { return m_phi; } + + /** return the number of Trigger hits */ + unsigned short numberOfTriggerHits() const + { return m_numberOfTriggerHits; } + /** return the number of Inner hits */ + unsigned short numberOfInnerHits() const + { return m_numberOfInnerHits; } + /** return the number of Middle hits */ + unsigned short numberOfMiddleHits() const + { return m_numberOfMiddleHits; } + /** return the number of Outer hits */ + unsigned short numberOfOuterHits() const + { return m_numberOfOuterHits; } + + /** return the number of Inner segments */ + unsigned short numberOfInnerSegments() const + { return m_numberOfInnerSegments; } + /** return the number of Middle segments */ + unsigned short numberOfMiddleSegments() const + { return m_numberOfMiddleSegments; } + /** return the number of Outer segments */ + unsigned short numberOfOuterSegments () const + { return m_numberOfOuterSegments; } + + /** set the Jet axis - eta */ + void set_eta(const float axisEta) { m_eta = axisEta; } + /** set the Jet axis - phi */ + void set_phi(const float axisPhi) { m_phi = axisPhi; } + + /** set the number of Trigger Hits */ + void set_numberOfTriggerHits (const unsigned short nHit) { m_numberOfTriggerHits = nHit; } + /** set the number of Inner Hits */ + void set_numberOfInnerHits (const unsigned short nHit) { m_numberOfInnerHits = nHit; } + /** set the number of Middle Hits */ + void set_numberOfMiddleHits (const unsigned short nHit) { m_numberOfMiddleHits = nHit; } + /** set the number of Outer Hits */ + void set_numberOfOuterHits (const unsigned short nHit) { m_numberOfOuterHits = nHit; } + + /** set the number of Inner segments */ + void set_numberOfInnerSegments (const unsigned short nSeg) { m_numberOfInnerSegments = nSeg; } + /** set the number of Middle segments */ + void set_numberOfMiddleSegments (const unsigned short nSeg) { m_numberOfMiddleSegments = nSeg; } + /** set the number of Outer segments */ + void set_numberOfOuterSegments (const unsigned short nSeg) { m_numberOfOuterSegments = nSeg; } + + private: + + float m_eta; + float m_phi; + unsigned short m_numberOfTriggerHits; + unsigned short m_numberOfInnerHits; + unsigned short m_numberOfInnerSegments; + unsigned short m_numberOfMiddleHits; + unsigned short m_numberOfMiddleSegments; + unsigned short m_numberOfOuterHits; + unsigned short m_numberOfOuterSegments; + + }; + +} + +#endif + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonSpShowerContainer.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonSpShowerContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..7d8c27500e1fc79e030b81b7e58f06ee3829f449 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/MuonSpShowerContainer.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONEVENT_MUONSPSHOWERCONTAINER_H +#define MUONEVENT_MUONSPSHOWERCONTAINER_H +////////////////////////////////////////////////////////////////////////////////////// +/// +/// Name: MuonSpContainer.h +/// Package : offline/Reconstruction/MuonIdentification/muonEvent +/// +/// Authors: K. A. Assamagan +/// Created: July 2006 +/// +/// Purpose: This is a data object, containing a collection of MuonSpShower objects +///////////////////////////////////////////////////////////////////////////////////// + +#include "DataModel/DataVector.h" +#include "CLIDSvc/CLASS_DEF.h" +#include "muonEvent/MuonSpShower.h" + +namespace Rec { +class MuonSpShowerContainer : public DataVector<MuonSpShower> { + public: + MuonSpShowerContainer(SG::OwnershipPolicy own = SG::OWN_ELEMENTS) + : DataVector<MuonSpShower>(own) {} + virtual ~MuonSpShowerContainer() {}; + +}; + +} + +CLASS_DEF(Rec::MuonSpShowerContainer, 1333253135, 1) + +#endif + + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/muonEventDict.h b/Reconstruction/MuonIdentification/muonEvent/muonEvent/muonEventDict.h new file mode 100644 index 0000000000000000000000000000000000000000..e3dd6811817da1b58f459df9c8a539ce6e4cda79 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/muonEventDict.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONEVENT_MUONEVENTDICT_H +#define MUONEVENT_MUONEVENTDICT_H + +#include "Navigation/Navigable.h" // for i686/.../muonEventDict_gen.h +#include "muonEvent/DepositInCalo.h" +#include "muonEvent/CaloEnergy.h" +#include "muonEvent/MuonContainer.h" +#include "muonEvent/MuonSpShowerContainer.h" +#include "muonEvent/MuonCaloEnergyContainer.h" + +/** @struct MuonDictionary + @brief EDM dictionary providing the muon, calo energy and SpShower classes +*/ + +struct MuonDictionary { + + ElementLink<MuonCaloEnergyContainer> m_linkCal; + std::pair<ElementLink<MuonCaloEnergyContainer>,double> m_pairCal; + MuonCaloEnergyContainer mcalCont; + CaloEnergy mcal; + + ElementLink<Rec::MuonSpShowerContainer> m_linkSho; + std::pair<ElementLink<Rec::MuonSpShowerContainer>,double> m_pairSho; + Rec::MuonSpShowerContainer shoCont; + Rec::MuonSpShower sho; + + Navigable<Analysis::MuonContainer,double> m_navMuon; + ElementLink<Analysis::MuonContainer> m_linkMuon; + std::pair<ElementLink<Analysis::MuonContainer>,double> m_pairMuon; + std::pair<MuonParameters::ParamDef,float> m_pairMuonParam; + std::vector<Analysis::Muon*> m_muonVecPointer; + std::vector<DepositInCalo*> m_depositVecPointer; + + // Work around dictionary generation problem. + DataVector<Rec::TrackParticle> m_dummy1; + DataVector<Rec::MuonSpShower> m_dummy3; + DataVector<Analysis::Muon> m_dummy4; + DataVector<int> m_dummy5; + DataVector<CaloEnergy> m_dummy6; +}; + + +#endif + + diff --git a/Reconstruction/MuonIdentification/muonEvent/muonEvent/selection.xml b/Reconstruction/MuonIdentification/muonEvent/muonEvent/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..c33797372889c0fc84c79c416117c3a9af90ef24 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/muonEvent/selection.xml @@ -0,0 +1,30 @@ +<lcgdict> + + <enum pattern="MuonParameters::*"/> + + <class name="DepositInCalo" /> + <class name="std::vector<DepositInCalo>" /> + <class name="std::vector<DepositInCalo*>" /> + + <class name="Rec::MuonSpShowerContainer" id="64AE1E07-67EC-549C-DE00-A953259EBC9E" /> + <class name="DataVector<Rec::MuonSpShower>" /> + <class name="std::vector<Rec::MuonSpShower*>" /> + <class name="Rec::MuonSpShower" /> + + <class name="Analysis::MuonContainer" id="593BF720-EC9D-4615-8C5B-0A04BEF90A00" /> + <class name="DataVector<Analysis::Muon>" /> + <class name="std::vector<Analysis::Muon*>" /> + <class name="Analysis::Muon" > + <field name="m_muonSegments" transient="true"/> + </class> + <class name="std::vector<std::pair<MuonParameters::ParamDef,float> >" /> + <class name="std::pair<MuonParameters::ParamDef,float>" /> + + <class name="MuonCaloEnergyContainer" id="CADD1FF7-EEEC-5CCC-DEBA-CA5BB59EBC9E" /> + <class name="DataVector<CaloEnergy>" /> + <class name="std::vector<CaloEnergy*>" /> + <class name="CaloEnergy" /> + <class name="MuonQualityWord" /> + +</lcgdict> + diff --git a/Reconstruction/MuonIdentification/muonEvent/src/CaloEnergy.cxx b/Reconstruction/MuonIdentification/muonEvent/src/CaloEnergy.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3c01a1c7f9666396ca056612a933a2c462e2926e --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/src/CaloEnergy.cxx @@ -0,0 +1,101 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*************************************************************************** + calorimeter energy deposit (measured or parametrized) with asymmetric error + Author: Alan Poppleton + Author: Gustavo Ordenez + Integration with Analysis::Muon.h - Ketevi A. Assamagan + --------------------------------------------------------------------------- + ***************************************************************************/ + +#include "muonEvent/CaloEnergy.h" + +using namespace Trk; + +/** constructors */ +CaloEnergy::CaloEnergy (void) + : EnergyLoss(0,0,0,0), + m_caloLRLikelihood (0), + m_caloMuonIdTag (0), + m_fsrCandidateEnergy (0), + m_deposits (), + m_etCore (0.0) +{ m_energyLossType = static_cast<CaloEnergy::EnergyLossType>(0); } + +CaloEnergy::CaloEnergy (const Trk::EnergyLoss& eloss) + : EnergyLoss( eloss ), + m_caloLRLikelihood (0), + m_caloMuonIdTag (0), + m_fsrCandidateEnergy (0), + m_deposits (), + m_etCore (0.0) +{ m_energyLossType = static_cast<CaloEnergy::EnergyLossType>(0); } + +CaloEnergy::CaloEnergy (float deltaE, + float sigmaDeltaE, + float sigmaMinusDeltaE, + float sigmaPlusDeltaE, + unsigned short energyLossType, + float likelihood, + unsigned short tag) + + : EnergyLoss(deltaE, sigmaDeltaE, sigmaMinusDeltaE, sigmaPlusDeltaE ), + m_caloLRLikelihood (likelihood), + m_caloMuonIdTag (tag), + m_deposits (), + m_etCore (0.0) +{ + m_energyLossType = static_cast<CaloEnergy::EnergyLossType>(energyLossType); + m_fsrCandidateEnergy = 0.0; +} + +CaloEnergy::CaloEnergy (float deltaE, + float sigmaDeltaE, + float sigmaMinusDeltaE, + float sigmaPlusDeltaE, + unsigned short energyLossType, + float likelihood, + unsigned short tag, + const std::vector<DepositInCalo>& deposits) + + : EnergyLoss(deltaE, sigmaDeltaE, sigmaMinusDeltaE, sigmaPlusDeltaE ), + m_caloLRLikelihood (likelihood), + m_caloMuonIdTag (tag), + m_etCore (0.0) +{ + m_energyLossType = static_cast<CaloEnergy::EnergyLossType>(energyLossType); + m_fsrCandidateEnergy = 0.0; + m_deposits = deposits; +} + +/** copy constructor */ +CaloEnergy::CaloEnergy (const CaloEnergy& caloEnergy) + : EnergyLoss ( caloEnergy ), + m_energyLossType (caloEnergy.m_energyLossType), + m_caloLRLikelihood (caloEnergy.m_caloLRLikelihood), + m_caloMuonIdTag (caloEnergy.m_caloMuonIdTag), + m_fsrCandidateEnergy (caloEnergy.m_fsrCandidateEnergy), + m_deposits (caloEnergy.m_deposits), + m_etCore (caloEnergy.m_etCore) +{} + +/** destructor */ +CaloEnergy::~CaloEnergy() {} + +/** Assignment operator */ +CaloEnergy& CaloEnergy::operator=(const CaloEnergy& rhs) { + if ( this != &rhs ) { + EnergyLoss::operator=( rhs ); + m_energyLossType = rhs.m_energyLossType; + m_caloLRLikelihood = rhs.m_caloLRLikelihood; + m_caloMuonIdTag = rhs.m_caloMuonIdTag; + m_fsrCandidateEnergy = rhs.m_fsrCandidateEnergy; + m_deposits = rhs.m_deposits; + m_etCore = rhs.m_etCore; + } + return *this; +} + + diff --git a/Reconstruction/MuonIdentification/muonEvent/src/DepositInCalo.cxx b/Reconstruction/MuonIdentification/muonEvent/src/DepositInCalo.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e048c2dace5e2d1a4296ffe9ae3f22531b8d1122 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/src/DepositInCalo.cxx @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "muonEvent/DepositInCalo.h" + +#include <iostream> + +void DepositInCalo::print() const +{ + + std::cout << "DepositInCalo: "; + if( subCaloId() == CaloCell_ID::PreSamplerB ) std::cout << "PreSamplerB"; + else if( subCaloId() == CaloCell_ID::EMB1 ) std::cout << "EMB1"; + else if( subCaloId() == CaloCell_ID::EMB2 ) std::cout << "EMB2"; + else if( subCaloId() == CaloCell_ID::EMB3 ) std::cout << "EMB3"; + else if( subCaloId() == CaloCell_ID::PreSamplerE ) std::cout << "PreSamplerE"; + else if( subCaloId() == CaloCell_ID::EME1 ) std::cout << "EME1"; + else if( subCaloId() == CaloCell_ID::EME2 ) std::cout << "EME2"; + else if( subCaloId() == CaloCell_ID::EME3 ) std::cout << "EME3"; + else if( subCaloId() == CaloCell_ID::HEC0 ) std::cout << "HEC0"; + else if( subCaloId() == CaloCell_ID::HEC1 ) std::cout << "HEC1"; + else if( subCaloId() == CaloCell_ID::HEC2 ) std::cout << "HEC2"; + else if( subCaloId() == CaloCell_ID::HEC3 ) std::cout << "HEC3"; + else if( subCaloId() == CaloCell_ID::TileBar0 ) std::cout << "TileBar0"; + else if( subCaloId() == CaloCell_ID::TileBar1 ) std::cout << "TileBar1"; + else if( subCaloId() == CaloCell_ID::TileBar2 ) std::cout << "TileBar2"; + else if( subCaloId() == CaloCell_ID::TileGap1 ) std::cout << "TileGap1"; + else if( subCaloId() == CaloCell_ID::TileGap2 ) std::cout << "TileGap2"; + else if( subCaloId() == CaloCell_ID::TileGap3 ) std::cout << "TileGap3"; + else if( subCaloId() == CaloCell_ID::TileExt0 ) std::cout << "TileExt0"; + else if( subCaloId() == CaloCell_ID::TileExt1 ) std::cout << "TileExt1"; + else if( subCaloId() == CaloCell_ID::TileExt2 ) std::cout << "TileExt2"; + else if( subCaloId() == CaloCell_ID::FCAL0 ) std::cout << "FCAL0"; + else if( subCaloId() == CaloCell_ID::FCAL1 ) std::cout << "FCAL1"; + else if( subCaloId() == CaloCell_ID::FCAL2 ) std::cout << "FCAL2"; + else std::cout << "Unknown"; + + std::cout << " EnergyDeposited " << energyDeposited() + << " Energy loss " << muonEnergyLoss() + << " Et Deposited " << etDeposited() << std::endl; +} + +/** copy constructor */ +DepositInCalo::DepositInCalo (const DepositInCalo& rhs) + : m_subCaloId ( rhs.m_subCaloId ), + m_energyDeposited ( rhs.m_energyDeposited ), + m_muonEnergyLoss ( rhs.m_muonEnergyLoss ), + m_etDeposited ( rhs.m_etDeposited ) +{} + +/** assignment operator */ +DepositInCalo & DepositInCalo::operator= (const DepositInCalo & rhs) { + if ( this != &rhs ) { + m_subCaloId = rhs.m_subCaloId; + m_energyDeposited = rhs.m_energyDeposited; + m_muonEnergyLoss = rhs.m_muonEnergyLoss; + m_etDeposited = rhs.m_etDeposited; + } + return *this; +} + diff --git a/Reconstruction/MuonIdentification/muonEvent/src/Muon.cxx b/Reconstruction/MuonIdentification/muonEvent/src/Muon.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c4173fec7a86b0b021dcd116157b84fa2e85add9 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/src/Muon.cxx @@ -0,0 +1,1178 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////// +/// Name : Muon.cxx +/// Package : offline/Reconstruction/MuonIdentification/muonEvent +/// Author : Ketevi A. Assamagan +/// Created : December 2004 +/// Note : CombinedMuon Object in the ESD +/// +/// DESCRIPTION: +/// +/// see Muon.h + +/// January 2007: Merge CombinedMuon with Muon into one class - simply Muon +//////////////////////////////////////////////////////////////////////////////// + + +#include "muonEvent/Muon.h" + +#include "VxVertex/RecVertex.h" +#include "Particle/TrackParticle.h" +#include "CaloEvent/CaloCluster.h" +#include "GaudiKernel/GaudiException.h" + +#include <math.h> +#include <string> + +namespace Analysis { + +//------------------------------------------------------------ +// Constructor -- just set defaults + +Muon::Muon() : + IAthenaBarCode(), + INavigable (), + I4Momentum (), + INavigable4Momentum (), + MuonImpl_t(), + m_author(MuonParameters::unknown), + m_hasCombinedMuon(false), + m_hasInDetTrackParticle(false), + m_hasMuonExtrapolatedTrackParticle(false), + m_hasInnerExtrapolatedTrackParticle(false), + m_hasCombinedMuonTrackParticle(false), + m_hasCluster(false), + m_matchChi2(-1.0), + m_matchNumberDoF(0), + m_outerMatchNumberDoF(0), + m_transientOuterMatchChi2(Trk::FitQuality()), + m_bestMatch(false), + m_parameters( ), + m_isAlsoFoundByLowPt(false), + m_isAlsoFoundByCaloMuonId(false), + m_caloMuonAlsoFoundByMuonReco(0), + m_isCorrected(false), + m_allAuthors(0), + m_isMuonBits(0), + m_isMuonLikelihood(0.0) +{ + this->set_charge(-999.0); + m_associatedEtaDigits.clear(); + m_associatedPhiDigits.clear(); +} + +//------------------------------------------------------------ +/** Constructor -- just set defaults */ +Muon::Muon(MuonParameters::Author author) : + IAthenaBarCode(), + INavigable (), + I4Momentum (), + INavigable4Momentum (), + MuonImpl_t(), + m_author(author), + m_hasCombinedMuon(false), + m_hasInDetTrackParticle(false), + m_hasMuonExtrapolatedTrackParticle(false), + m_hasInnerExtrapolatedTrackParticle(false), + m_hasCombinedMuonTrackParticle(false), + m_hasCluster(false), + m_matchChi2(-1.0), + m_matchNumberDoF(0), + m_outerMatchNumberDoF(0), + m_transientOuterMatchChi2(Trk::FitQuality()), + m_bestMatch(false), + m_parameters( ), + m_isAlsoFoundByLowPt(false), + m_isAlsoFoundByCaloMuonId(false), + m_caloMuonAlsoFoundByMuonReco(0), + m_isCorrected(false), + m_allAuthors(0), + m_isMuonBits(0), + m_isMuonLikelihood(0.0) +{ + this->add_author( author ); + this->set_charge(-999.0); + m_associatedEtaDigits.clear(); + m_associatedPhiDigits.clear(); + +} + +/** Principal constructor for combined muons with 3 TrackParticles */ +Muon::Muon(MuonParameters::Author author, + const Rec::TrackParticle* inDetTP, const Rec::TrackParticle* extrapTP, + const Rec::TrackParticle* combTP, const bool isExtrapolatedToVertex) + : + IAthenaBarCode(), + INavigable (), + I4Momentum (), + INavigable4Momentum (), + MuonImpl_t(), + m_author(author), + m_hasCombinedMuon(false), + m_matchChi2(-1.0), + m_matchNumberDoF(0), + m_outerMatchNumberDoF(0), + m_transientOuterMatchChi2(Trk::FitQuality()), + m_bestMatch(false), + m_isAlsoFoundByLowPt(false), + m_isAlsoFoundByCaloMuonId(false), + m_caloMuonAlsoFoundByMuonReco(0), + m_isCorrected(false) +{ + this->set4Mom(combTP->hlv()); + + m_inDetTrackParticle.setElement(const_cast<Rec::TrackParticle*>(inDetTP)); + + if(isExtrapolatedToVertex) + m_muonExtrapolatedTrackParticle.setElement(const_cast<Rec::TrackParticle*>(extrapTP)); + else + m_innerExtrapolatedTrackParticle.setElement(const_cast<Rec::TrackParticle*>(extrapTP)); + + m_combinedMuonTrackParticle.setElement(const_cast<Rec::TrackParticle*>(combTP)); + + m_hasCluster = m_cluster.isValid(); + m_hasInDetTrackParticle = m_inDetTrackParticle.isValid(); + m_hasMuonExtrapolatedTrackParticle = m_muonExtrapolatedTrackParticle.isValid(); + m_hasInnerExtrapolatedTrackParticle= m_innerExtrapolatedTrackParticle.isValid(); + m_hasCombinedMuonTrackParticle = m_combinedMuonTrackParticle.isValid(); + m_associatedEtaDigits.clear(); + m_associatedPhiDigits.clear(); + this->set_charge( combTP->charge() ); + m_allAuthors = 0; + this->add_author( author ); + m_isMuonBits = 0; + m_isMuonLikelihood = 0.0; + +} + +Muon::Muon(MuonParameters::Author author, + const Rec::TrackParticle* trackParticle, const bool isExtrapolatedToVertex) + : + IAthenaBarCode(), + INavigable (), + I4Momentum (), + INavigable4Momentum (), + MuonImpl_t(), + m_author(author), + m_hasCombinedMuon(false), + m_matchChi2(-1.0), + m_matchNumberDoF(0), + m_outerMatchNumberDoF(0), + m_transientOuterMatchChi2(Trk::FitQuality()), + m_bestMatch(false), + m_isAlsoFoundByLowPt(false), + m_isAlsoFoundByCaloMuonId(false), + m_caloMuonAlsoFoundByMuonReco(0), + m_isCorrected(false) + { + this->set4Mom(trackParticle->hlv()); + + if(isExtrapolatedToVertex) + m_muonExtrapolatedTrackParticle.setElement(const_cast<Rec::TrackParticle*>(trackParticle)); + else { + if (this->isCaloMuonId()) + m_inDetTrackParticle.setElement(const_cast<Rec::TrackParticle*>(trackParticle)); + else + m_innerExtrapolatedTrackParticle.setElement(const_cast<Rec::TrackParticle*>(trackParticle)); + } + m_hasCluster = m_cluster.isValid(); + m_hasInDetTrackParticle = m_inDetTrackParticle.isValid(); + m_hasMuonExtrapolatedTrackParticle = m_muonExtrapolatedTrackParticle.isValid(); + m_hasInnerExtrapolatedTrackParticle= m_innerExtrapolatedTrackParticle.isValid(); + m_hasCombinedMuonTrackParticle = m_combinedMuonTrackParticle.isValid(); + m_associatedEtaDigits.clear(); + m_associatedPhiDigits.clear(); + this->set_charge( trackParticle->charge() ); + m_allAuthors = 0; + this->add_author( author ); + m_isMuonBits = 0; + m_isMuonLikelihood = 0.0; + +} + +/** if the combined failed, still create the combined muon from the Inner Detector TrackParticle + and a muon segment */ +Muon::Muon(MuonParameters::Author author, + const Rec::TrackParticle* inDetTP, + const Trk::SegmentCollection * segmentContainer, + const std::vector<const Trk::Segment*>& muonSegments) + : + IAthenaBarCode(), + INavigable (), + I4Momentum (), + INavigable4Momentum (), + MuonImpl_t(), + m_author(author), + m_hasCombinedMuon(false), + m_matchChi2(-1.0), + m_matchNumberDoF(0), + m_outerMatchNumberDoF(0), + m_transientOuterMatchChi2(Trk::FitQuality()), + m_bestMatch(false), + m_isAlsoFoundByLowPt(false), + m_isAlsoFoundByCaloMuonId(false), + m_caloMuonAlsoFoundByMuonReco(0), + m_isCorrected(false) + { + this->set4Mom(inDetTP->hlv()); + m_inDetTrackParticle.setElement(const_cast<Rec::TrackParticle*>(inDetTP)); + + for (unsigned int i=0; i<muonSegments.size(); ++i) this->addSegment(segmentContainer, muonSegments[i]); + + m_hasCluster = m_cluster.isValid(); + m_hasInDetTrackParticle = m_inDetTrackParticle.isValid(); + m_hasMuonExtrapolatedTrackParticle = m_muonExtrapolatedTrackParticle.isValid(); + m_hasInnerExtrapolatedTrackParticle= m_innerExtrapolatedTrackParticle.isValid(); + m_hasCombinedMuonTrackParticle = m_combinedMuonTrackParticle.isValid(); + m_associatedEtaDigits.clear(); + m_associatedPhiDigits.clear(); + this->set_charge( inDetTP->charge() ); + m_allAuthors = 0; + this->add_author( author ); + m_isMuonBits = 0; + m_isMuonLikelihood = 0.0; +} + +//------------------------------------------------------------ +/** Copy Constructor */ +Muon::Muon( const Muon& rhs ) : + IAthenaBarCode(rhs), + INavigable (rhs), + I4Momentum (rhs), + INavigable4Momentum (rhs), + MuonImpl_t(rhs), + m_author ( rhs.m_author ), + m_hasCombinedMuon ( rhs.m_hasCombinedMuon ), + m_hasInDetTrackParticle ( rhs.m_hasInDetTrackParticle ), + m_hasMuonExtrapolatedTrackParticle ( rhs.m_hasMuonExtrapolatedTrackParticle ), + m_hasInnerExtrapolatedTrackParticle( rhs.m_hasInnerExtrapolatedTrackParticle ), + m_hasCombinedMuonTrackParticle ( rhs.m_hasCombinedMuonTrackParticle ), + m_hasCluster ( rhs.m_hasCluster ), + m_matchChi2 ( rhs.m_matchChi2 ), + m_matchNumberDoF ( rhs.m_matchNumberDoF ), + m_outerMatchNumberDoF ( rhs.m_outerMatchNumberDoF ), + m_transientOuterMatchChi2 ( rhs.m_transientOuterMatchChi2 ), + m_bestMatch ( rhs.m_bestMatch ), + m_associatedEtaDigits ( rhs.m_associatedEtaDigits ), + m_associatedPhiDigits ( rhs.m_associatedPhiDigits ), + m_inDetTrackParticle ( rhs.m_inDetTrackParticle ), + m_muonExtrapolatedTrackParticle ( rhs.m_muonExtrapolatedTrackParticle ), + m_innerExtrapolatedTrackParticle ( rhs.m_innerExtrapolatedTrackParticle ), + m_combinedMuonTrackParticle ( rhs.m_combinedMuonTrackParticle ), + m_statCombinedMuonTrackParticle ( rhs.m_statCombinedMuonTrackParticle ), + m_cluster ( rhs.m_cluster ), + m_muonSpectrometerTrackParticle ( rhs.m_muonSpectrometerTrackParticle), + m_parameters ( rhs.m_parameters ), + m_isAlsoFoundByLowPt ( rhs.m_isAlsoFoundByLowPt ), + m_isAlsoFoundByCaloMuonId ( rhs.m_isAlsoFoundByCaloMuonId ), + m_caloEnergyLoss ( rhs.m_caloEnergyLoss ), + m_caloMuonAlsoFoundByMuonReco ( rhs.m_caloMuonAlsoFoundByMuonReco ), + m_isCorrected ( rhs.m_isCorrected ), + m_allAuthors ( rhs.m_allAuthors ), + m_isMuonBits ( rhs.m_isMuonBits ), + m_isMuonLikelihood ( rhs.m_isMuonLikelihood ) + +{ + copySegmentLinkVector(rhs.m_muonSegments); +} + + +void Muon::copySegmentLinkVector( const ElementLinkVector<Trk::SegmentCollection>& segments ) { + if( !m_muonSegments.empty() ) m_muonSegments.clear(); + m_muonSegments.reserve(segments.size()); + ElementLinkVector<Trk::SegmentCollection>::const_iterator sit = segments.begin(); + ElementLinkVector<Trk::SegmentCollection>::const_iterator sit_end = segments.end(); + for( ;sit!=sit_end;++sit) m_muonSegments.push_back( *sit ); +} + +//------------------------------------------------------------ +/** Assignement operator */ +Muon& Muon::operator=( const Muon& rhs ) +{ + if ( this != &rhs ) { + IAthenaBarCode::operator=(rhs); + INavigable::operator=(rhs); + I4Momentum::operator=(rhs); + INavigable4Momentum::operator=(rhs); + MuonImpl_t::operator=(rhs); + m_author = rhs.m_author; + m_hasCombinedMuon = rhs.m_hasCombinedMuon; + m_hasInDetTrackParticle = rhs.m_hasInDetTrackParticle; + m_hasMuonExtrapolatedTrackParticle = rhs.m_hasMuonExtrapolatedTrackParticle; + m_hasInnerExtrapolatedTrackParticle= rhs.m_hasInnerExtrapolatedTrackParticle; + m_hasCombinedMuonTrackParticle = rhs.m_hasCombinedMuonTrackParticle; + m_hasCluster = rhs.m_hasCluster; + m_matchChi2 = rhs.m_matchChi2; + m_matchNumberDoF = rhs.m_matchNumberDoF; + m_outerMatchNumberDoF = rhs.m_outerMatchNumberDoF; + m_transientOuterMatchChi2 = rhs.m_transientOuterMatchChi2; + m_bestMatch = rhs.m_bestMatch; + m_associatedEtaDigits = rhs.m_associatedEtaDigits; + m_associatedPhiDigits = rhs.m_associatedPhiDigits; + m_inDetTrackParticle = rhs.m_inDetTrackParticle; + m_muonExtrapolatedTrackParticle = rhs.m_muonExtrapolatedTrackParticle; + m_innerExtrapolatedTrackParticle = rhs.m_innerExtrapolatedTrackParticle; + m_combinedMuonTrackParticle = rhs.m_combinedMuonTrackParticle; + m_statCombinedMuonTrackParticle = rhs.m_statCombinedMuonTrackParticle; + m_cluster = rhs.m_cluster; + m_muonSpectrometerTrackParticle = rhs.m_muonSpectrometerTrackParticle; + m_parameters = rhs.m_parameters; + m_isAlsoFoundByLowPt = rhs.m_isAlsoFoundByLowPt; + m_isAlsoFoundByCaloMuonId = rhs.m_isAlsoFoundByCaloMuonId; + m_caloEnergyLoss = rhs.m_caloEnergyLoss; + m_caloMuonAlsoFoundByMuonReco = rhs.m_caloMuonAlsoFoundByMuonReco; + m_isCorrected = rhs.m_isCorrected; + m_allAuthors = rhs.m_allAuthors; + m_isMuonBits = rhs.m_isMuonBits; + m_isMuonLikelihood = rhs.m_isMuonLikelihood; + + copySegmentLinkVector( rhs.m_muonSegments ); + + } + return *this; +} + +//------------------------------------------------------------ +/** Destructor */ +Muon::~Muon() {} + +bool Muon::isAuthor ( const unsigned int author ) const { + MuonParameters::Author x = static_cast<MuonParameters::Author>(author); + return this->isAuthor(x); +} + +bool Muon::isAuthor ( MuonParameters::Author author ) const { + bool is_it = false; + switch ( author ) { + case MuonParameters::Muonboy : + is_it = m_allAuthors & 1; + break; + case MuonParameters::STACO : + is_it = m_allAuthors & 2; + break; + case MuonParameters::MuTag : + is_it = m_allAuthors & 4; + break; + case MuonParameters::MuidSA : + is_it = m_allAuthors & 8; + break; + case MuonParameters::MuidCo : + is_it = m_allAuthors & 16; + break; + case MuonParameters::MuGirl : + is_it = m_allAuthors & 32; + break; + case MuonParameters::MuGirlLowBeta : + is_it = m_allAuthors & 64; + break; + case MuonParameters::CaloMuonId : + is_it = m_allAuthors & 128; + break; + case MuonParameters::CaloTag : + is_it = m_allAuthors & 256; + break; + case MuonParameters::CaloLikelihood : + is_it = m_allAuthors & 512; + break; + case MuonParameters::MuTagIMO : + is_it = m_allAuthors & 1024; + break; + case MuonParameters::MuonCombinedRefit : + is_it = m_allAuthors & 2048; + break; + case MuonParameters::ExtrapolateMuonToIP : + is_it = m_allAuthors & 4096; + break; + + default : + is_it = false; + } + return is_it; +} + +bool Muon::add_author ( MuonParameters::Author author ) { + bool is_set = false; + if ( !this->isAuthor( author ) ) { + is_set = true; + switch ( author ) { + case MuonParameters::Muonboy : + m_allAuthors = m_allAuthors | 1; + break; + case MuonParameters::STACO : + m_allAuthors = m_allAuthors | 2; + break; + case MuonParameters::MuTag : + m_allAuthors = m_allAuthors | 4; + break; + case MuonParameters::MuidSA : + m_allAuthors = m_allAuthors | 8; + break; + case MuonParameters::MuidCo : + m_allAuthors = m_allAuthors | 16; + break; + case MuonParameters::MuGirl : + m_allAuthors = m_allAuthors | 32; + break; + case MuonParameters::MuGirlLowBeta : + m_allAuthors = m_allAuthors | 64; + break; + case MuonParameters::CaloMuonId : + m_allAuthors = m_allAuthors | 128; + break; + case MuonParameters::CaloTag : + m_allAuthors = m_allAuthors | 256; + break; + case MuonParameters::CaloLikelihood : + m_allAuthors = m_allAuthors | 512; + break; + case MuonParameters::MuTagIMO : + m_allAuthors = m_allAuthors | 1024; + break; + case MuonParameters::MuonCombinedRefit : + m_allAuthors = m_allAuthors | 2048; + break; + case MuonParameters::ExtrapolateMuonToIP : + m_allAuthors = m_allAuthors | 4096; + break; + + default : + is_set = false; + } + } + return is_set; +} + +/** test for a MS-ID combined muon */ +bool Muon::isCombinedMuon() const { + if (m_hasCombinedMuonTrackParticle && // mind DPD where hasParticle() but EL may be invalid + ( m_author==MuonParameters::STACO || + m_author==MuonParameters::MuidCo || + m_author==MuonParameters::MuonCombinedRefit || + m_author==MuonParameters::MuGirl ) ) return true; + else return false; +} + +/** test for a MS-standalone muon */ +bool Muon::isStandAloneMuon() const { + + if (m_hasMuonExtrapolatedTrackParticle && // mind DPD where hasParticle() but EL may be invalid + ( m_author==MuonParameters::MuonboySP || + m_author==MuonParameters::Muonboy || + ( m_author==MuonParameters::STACO && !this->hasInDetTrackParticle()) || + m_author==MuonParameters::MOORE || + m_author==MuonParameters::MuidSA || + m_author==MuonParameters::ExtrapolateMuonToIP) ) return true; + else return false; + + // Formerly: !this->bestMatch() && !this->hasCombinedMuonTrackParticle() + // && !this->isSegmentTaggedMuon() && this->isHighPt() && this->m_hasMuonExtr... +} + + +/** test for a MS-segment tagged muon */ +bool Muon::isSegmentTaggedMuon() const { + if (m_author==MuonParameters::MuTag || + m_author==MuonParameters::MuTagIMO || + ( m_author==MuonParameters::MuGirl && ! m_hasCombinedMuonTrackParticle) ) return true; + else return false; +} + +/** test for a calo-tagged muon */ +bool Muon::isCaloMuonId() const { + if ( m_author==MuonParameters::CaloMuonId || + m_author==MuonParameters::CaloTag || + m_author==MuonParameters::CaloLikelihood ) return true; + else return false; +} + +/** test for a silicon associated forward muon*/ +bool Muon::isSiliconAssociatedForwardMuon() const { + const Rec::TrackParticle* indetParticle = inDetTrackParticle(); + if( !indetParticle ) return false; + return indetParticle->info().patternRecoInfo(Trk::TrackInfo::SiSpacePointsSeedMaker_ForwardTracks); +} + +/** flag if the there was re-fit of ID and MS hits */ +bool Muon::hasGlobalMuonTrackFit() const { + if (m_author==MuonParameters::MuidCo || + m_author==MuonParameters::MuonCombinedRefit || + this->hasInnerExtrapolatedTrackParticle() || + (m_author==MuonParameters::MuGirl && m_hasCombinedMuonTrackParticle) ) return true; + else return false; +} + + +/** get a parameter for this Muon - isolation energy in some cone for example */ +double Muon::parameter( MuonParameters::ParamDef x) const { + + typedef std::pair<MuonParameters::ParamDef,float> muonParams; + + double result = -999.; + std::vector<muonParams>::const_iterator p = m_parameters.begin(); + + for (;p !=m_parameters.end(); p++) { + if ( (*p).first == x ) + result = (*p).second; + } + + return result; +} + +void Muon::set_outerMatchChi2(double chi2, int ndof) +{ + if (ndof>0) { + m_outerMatchNumberDoF = ndof; + this->set_parameter(MuonParameters::segmentChi2OverDoF,(float)(chi2/ndof)); + m_transientOuterMatchChi2 = Trk::FitQuality(chi2,ndof); + } else { + m_outerMatchNumberDoF = 0; + this->set_parameter(MuonParameters::segmentChi2OverDoF,-1.0); + } +} + + +/** energy loss and its uncertainty in the calorimeter */ +std::pair<double,double> Muon::energyLoss() const{ + double eloss = 0.0; + double sigma = 0.0; + if ( m_caloEnergyLoss.isValid() ) { + const CaloEnergy * caloEnergy = *m_caloEnergyLoss; + eloss = caloEnergy->deltaE(); + sigma = caloEnergy->sigmaDeltaE(); + } + return std::make_pair(eloss, sigma); +} + +/** number of B-layer hits */ +int Muon::numberOfBLayerHits() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfBLayerHits ); + else return -1; + +} + +/** number of pixel hits */ +int Muon::numberOfPixelHits() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfPixelHits ); + else return -1; + +} + +/** number of Silicon hits */ +int Muon::numberOfSCTHits() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfSCTHits ); + else return -1; + +} + +/** number of TRT hits */ +int Muon::numberOfTRTHits() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfTRTHits ); + else return -1; + +} + +/** number of TRT high threshold hits */ +int Muon::numberOfTRTHighThresholdHits() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfTRTHighThresholdHits ); + else return -1; + +} + +/** number of shared hits at pixel b-layer */ +int Muon::numberOfBLayerSharedHits() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfBLayerSharedHits ); + else return -1; +} +int Muon::numberOfPixelSharedHits() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfPixelSharedHits ); + else return -1; +} + +int Muon::numberOfPixelHoles() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfPixelHoles ); + else return -1; +} + +int Muon::numberOfSCTSharedHits() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfSCTSharedHits ); + else return -1; +} + +int Muon::numberOfSCTHoles() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfSCTHoles ); + else return -1; +} + +int Muon::numberOfTRTOutliers() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfTRTOutliers ); + else return -1; +} + +int Muon::numberOfTRTHighThresholdOutliers() const { + if ( this->hasCombinedMuonTrackParticle() || this->hasInDetTrackParticle() ) + return (*m_inDetTrackParticle)->trackSummary()->get( Trk::numberOfTRTHighThresholdOutliers ); + else return -1; +} + +/** number of MDT hits/holes */ +int Muon::numberOfMDTHits() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfMdtHits ); + else if ( this->hasInDetTrackParticle() && associatedEtaDigits().size() > 0) + return ( associatedEtaDigits()[0] ); + else return -1; +} +int Muon::numberOfMDTHoles() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfMdtHoles ); + else return -1; +} + +/** number of CSC Phi hits/holes */ +int Muon::numberOfCSCPhiHits() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfCscPhiHits ); + else if ( this->hasInDetTrackParticle() && associatedPhiDigits().size() > 0) + return ( associatedPhiDigits()[1] ); + else return -1; +} +int Muon::numberOfCSCPhiHoles() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfCscPhiHoles ); + else return -1; +} + +/** number of CSC Eta hits/holes */ +int Muon::numberOfCSCEtaHits() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfCscEtaHits ); + else if ( this->hasInDetTrackParticle() && associatedEtaDigits().size() > 0) + return ( associatedEtaDigits()[1] ); + else return -1; +} +int Muon::numberOfCSCEtaHoles() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfCscEtaHoles ); + else return -1; +} + +/** number of RPC Phi hits/holes */ +int Muon::numberOfRPCPhiHits() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfRpcPhiHits ); + else if ( this->hasInDetTrackParticle() && associatedPhiDigits().size() > 0) + return ( associatedPhiDigits()[2] ); + else return -1; +} +int Muon::numberOfRPCPhiHoles() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfRpcPhiHoles ); + else return -1; +} + +/** number of RPC Eta hits/holes */ +int Muon::numberOfRPCEtaHits() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfRpcEtaHits ); + else if ( this->hasInDetTrackParticle() && associatedEtaDigits().size() > 0) + return ( associatedEtaDigits()[2] ); + else return -1; +} +int Muon::numberOfRPCEtaHoles() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfRpcEtaHoles ); + else return -1; +} + +/** number of TGC Phi hits/holes */ +int Muon::numberOfTGCPhiHits() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfTgcPhiHits ); + else if ( this->hasInDetTrackParticle() && associatedPhiDigits().size() > 0) + return ( associatedPhiDigits()[3] ); + else return -1; +} +int Muon::numberOfTGCPhiHoles() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfTgcPhiHoles ); + else return -1; +} + +/** number of TGC Eta hits/holes */ +int Muon::numberOfTGCEtaHits() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfTgcEtaHits ); + else if ( this->hasInDetTrackParticle() && associatedEtaDigits().size() > 0) + return ( associatedEtaDigits()[3] ); + else return -1; +} +int Muon::numberOfTGCEtaHoles() const { + if ( this->hasMuonExtrapolatedTrackParticle() ) + return (*m_muonExtrapolatedTrackParticle)->trackSummary()->get( Trk::numberOfTgcEtaHoles ); + else return -1; +} + +/** GangedPixel, outliers, summaryTypes */ +int Muon::numberOfGangedPixels() const { + const Rec::TrackParticle * theTrack = this->track(); + if ( theTrack ) + return theTrack->trackSummary()->get( Trk::numberOfGangedPixels ); + else return -1; +} + +int Muon::numberOfOutliersOnTrack() const { + const Rec::TrackParticle * theTrack = this->track(); + if ( theTrack ) + return theTrack->trackSummary()->get( Trk::numberOfOutliersOnTrack ); + else return -1; + +} + +int Muon::numberOfTrackSummaryTypes(unsigned int type) const { + const Rec::TrackParticle * theTrack = this->track(); + if ( theTrack && type < Trk::numberOfTrackSummaryTypes ) + return theTrack->trackSummary()->get( static_cast<Trk::SummaryType>(type) ); + else return -1; +} + +void Muon::set_energyLoss ( const MuonCaloEnergyContainer* cont, const CaloEnergy* caloEnergy ) +{ + if (m_caloEnergyLoss.isValid() ) m_caloEnergyLoss.reset(); + m_caloEnergyLoss.toContainedElement(*cont, const_cast<CaloEnergy*>(caloEnergy)); +} + +/** Set Inner Detector TrackParticle */ +void Muon::set_inDetTrackParticle(const Rec::TrackParticleContainer* cont, + const Rec::TrackParticle* trackParticle ) +{ + if (m_inDetTrackParticle.isValid() ) m_inDetTrackParticle.reset(); + m_inDetTrackParticle.toContainedElement(*cont, const_cast<Rec::TrackParticle*>(trackParticle)); + m_hasInDetTrackParticle = m_inDetTrackParticle.isValid(); +} + +void Muon::set_inDetTrackParticle(const Rec::TrackParticle* trackParticle ) +{ + m_inDetTrackParticle.setElement(const_cast<Rec::TrackParticle*>(trackParticle)); + m_hasInDetTrackParticle = m_inDetTrackParticle.isValid(); +} + +/** Set MuonSegments */ +void Muon::set_muonSegments(const Trk::SegmentCollection* segmentContainer, + const std::vector<const Trk::Segment*>& muonSegments) +{ + m_muonSegments.clear(); + for (unsigned int i=0; i<muonSegments.size(); ++i) this->addSegment(segmentContainer, muonSegments[i]); +} + +void Muon::addSegment ( const Trk::SegmentCollection* segmentContainer, const Trk::Segment* segment ) +{ + ElementLink<Trk::SegmentCollection> link; + link.toContainedElement( *segmentContainer, const_cast<Trk::Segment*>(segment) ) ; + m_muonSegments.push_back( link ) ; +} + +const ElementLink<Trk::SegmentCollection> Muon::muonSegmentLink(const unsigned int i, bool& validLink) const +{ + ElementLink<Trk::SegmentCollection> theLink; + if ( i < this->numberOfSegments() ) { + validLink = true; + theLink = m_muonSegments[i]; + } else { + validLink = false; + } + return theLink; +} + +/** muon spectromeetr track particle needed by MOORE */ +void Muon::set_muonSpectrometerTrackParticle(const Rec::TrackParticleContainer* cont, + const Rec::TrackParticle* trackParticle) +{ + if ( m_muonSpectrometerTrackParticle.isValid() ) m_muonSpectrometerTrackParticle.reset(); + if (cont && trackParticle) // allow also to remove an EL + m_muonSpectrometerTrackParticle.toContainedElement(*cont, const_cast<Rec::TrackParticle*>(trackParticle)); +} + +/** Set Muon Extrapolated TrackParticle */ +void Muon::set_muonExtrapolatedTrackParticle(const Rec::TrackParticleContainer* cont, + const Rec::TrackParticle* trackParticle ) +{ + if (m_muonExtrapolatedTrackParticle.isValid() ) m_muonExtrapolatedTrackParticle.reset(); + if (cont && trackParticle) { // allow also to remove an EL + m_muonExtrapolatedTrackParticle.toContainedElement(*cont, const_cast<Rec::TrackParticle*>(trackParticle)); + m_hasMuonExtrapolatedTrackParticle = m_muonExtrapolatedTrackParticle.isValid(); + } +} + +void Muon::set_muonExtrapolatedTrackParticle(const Rec::TrackParticle* trackParticle ) +{ + m_muonExtrapolatedTrackParticle.setElement(const_cast<Rec::TrackParticle*>(trackParticle)); + m_hasMuonExtrapolatedTrackParticle = m_muonExtrapolatedTrackParticle.isValid(); +} + +/** Set Muon Extrapolated TrackParticle */ +void Muon::set_innerExtrapolatedTrackParticle(const Rec::TrackParticleContainer* cont, + const Rec::TrackParticle* trackParticle ) +{ + if (m_innerExtrapolatedTrackParticle.isValid() ) m_innerExtrapolatedTrackParticle.reset(); + if (cont && trackParticle) { // allow also to remove an EL + m_innerExtrapolatedTrackParticle.toContainedElement(*cont, const_cast<Rec::TrackParticle*>(trackParticle)); + m_hasInnerExtrapolatedTrackParticle = m_innerExtrapolatedTrackParticle.isValid(); + } +} + +void Muon::set_innerExtrapolatedTrackParticle(const Rec::TrackParticle* trackParticle ) +{ + m_innerExtrapolatedTrackParticle.setElement(const_cast<Rec::TrackParticle*>(trackParticle)); + m_hasInnerExtrapolatedTrackParticle = m_innerExtrapolatedTrackParticle.isValid(); +} + +/** Set Combined Muon TrackParticle */ +void Muon::set_combinedMuonTrackParticle(const Rec::TrackParticleContainer* cont, + const Rec::TrackParticle* trackParticle ) +{ + if (m_combinedMuonTrackParticle.isValid() ) m_combinedMuonTrackParticle.reset(); + if (cont && trackParticle) { // allow also to remove an EL + m_combinedMuonTrackParticle.toContainedElement(*cont, const_cast<Rec::TrackParticle*>(trackParticle)); + m_hasCombinedMuonTrackParticle = m_combinedMuonTrackParticle.isValid(); + } +} + +void Muon::set_combinedMuonTrackParticle(const Rec::TrackParticle* trackParticle ) +{ + m_combinedMuonTrackParticle.setElement(const_cast<Rec::TrackParticle*>(trackParticle)); + m_hasCombinedMuonTrackParticle = m_combinedMuonTrackParticle.isValid(); +} + +/** Set Statistically Combined Muon TrackParticle */ +void Muon::set_statCombinedMuonTrackParticle(const Rec::TrackParticleContainer* cont, + const Rec::TrackParticle* trackParticle ) +{ + if (m_statCombinedMuonTrackParticle.isValid() ) m_statCombinedMuonTrackParticle.reset(); + if (cont && trackParticle) { // allow also to remove an EL + m_statCombinedMuonTrackParticle.toContainedElement(*cont, const_cast<Rec::TrackParticle*>(trackParticle)); + } +} + +/** low Pt parameters from low pt */ +void Muon::set_numberOfAssociatedEtaDigits(int nMDT, int nCSC, int nRPC, int nTGC) { + m_associatedEtaDigits.clear(); + m_associatedEtaDigits.push_back(nMDT); + m_associatedEtaDigits.push_back(nCSC); + m_associatedEtaDigits.push_back(nRPC); + m_associatedEtaDigits.push_back(nTGC); + +} +void Muon::set_numberOfAssociatedPhiDigits(int nMDT, int nCSC, int nRPC, int nTGC) { + m_associatedPhiDigits.clear(); + m_associatedPhiDigits.push_back(nMDT); + m_associatedPhiDigits.push_back(nCSC); + m_associatedPhiDigits.push_back(nRPC); + m_associatedPhiDigits.push_back(nTGC); +} + +void Muon::set_numberOfAssociatedEtaDigits(const std::vector<int>& associated_digits) { + m_associatedEtaDigits = associated_digits; +} + +void Muon::set_numberOfAssociatedPhiDigits(const std::vector<int>& associated_digits) { + m_associatedPhiDigits = associated_digits; +} +void Muon::set_numberOfSegmentEtaDigits(int nMDT, int nCSC, int nRPC, int nTGC) { + m_associatedEtaDigits.clear(); + m_associatedEtaDigits.push_back(nMDT); + m_associatedEtaDigits.push_back(nCSC); + m_associatedEtaDigits.push_back(nRPC); + m_associatedEtaDigits.push_back(nTGC); + +} +void Muon::set_numberOfSegmentPhiDigits(int nMDT, int nCSC, int nRPC, int nTGC) { + m_associatedPhiDigits.clear(); + m_associatedPhiDigits.push_back(nMDT); + m_associatedPhiDigits.push_back(nCSC); + m_associatedPhiDigits.push_back(nRPC); + m_associatedPhiDigits.push_back(nTGC); +} + +void Muon::set_numberOfSegmentEtaDigits(const std::vector<int>& associated_digits) { + m_associatedEtaDigits = associated_digits; +} + +void Muon::set_numberOfSegmentPhiDigits(const std::vector<int>& associated_digits) { + m_associatedPhiDigits = associated_digits; +} + +/** set a parameter in the MuonParamDefs.h */ +void Muon::set_parameter(MuonParameters::ParamDef index, double value, bool overwrite) { + + typedef std::pair<MuonParameters::ParamDef,float> muonParams; + + std::vector<muonParams>::iterator p = m_parameters.begin(); + + for (;p !=m_parameters.end(); p++) { + if ( (*p).first == index ) break; + } + + if ( p == m_parameters.end() ) { + m_parameters.push_back( muonParams(index,(float)value) ); + } + else { + if ( overwrite ) { + (*p).second = (float)value; + } + //else { + // throw GaudiException("parameter not saved", "Muon::set_parameter(...)", true); + //int ind = static_cast<int>(index); + //std::cout << "parameter not overwritten - Muon::set_parameter(...) index = " << ind << std::endl; + + //} + } +} + +/////////////////////////////////// +// Navigation without parameters // +/////////////////////////////////// + +void Muon::fillToken(INavigationToken& theToken) const +{ + + bool checkFlag = false; + + ////////////////////////// + // First check on track // + ////////////////////////// + + + const Rec::TrackParticle* aTrack; + + /// First combined, then try Extrap & In Det + if ( this->combinedMuonTrackParticle() ) { + + aTrack = this->combinedMuonTrackParticle(); + + // check requested object type with token type + NavigationToken<Rec::TrackParticle>* trackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle>* >(&theToken); + if ( trackToken != 0 ) { + // request is honored + trackToken->setObject(aTrack); + checkFlag = true; + } + + // alternative token type may phrase the same request + if ( ! checkFlag ) { + NavigationToken<Rec::TrackParticle,double>* parTrackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle,double>* > + (&theToken); + if ( parTrackToken != 0 ) { + parTrackToken->setObject(aTrack); + checkFlag = true; + } + } + if(!checkFlag) { + // try for generic type requests + if ( aTrack != 0 ) theToken.trySetObject(aTrack); + } + + } + else { + if ( this->muonExtrapolatedTrackParticle() ) { + aTrack = this->muonExtrapolatedTrackParticle(); + + // check requested object type with token type + NavigationToken<Rec::TrackParticle>* trackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle>* >(&theToken); + if ( trackToken != 0 ) { + // request is honored + trackToken->setObject(aTrack); + checkFlag = true; + } + + // alternative token type may phrase the same request + if ( ! checkFlag ) { + NavigationToken<Rec::TrackParticle,double>* parTrackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle,double>* > + (&theToken); + if ( parTrackToken != 0 ) { + parTrackToken->setObject(aTrack); + checkFlag = true; + } + } + if(!checkFlag) { + + // try for generic type requests + if ( aTrack != 0 ) theToken.trySetObject(aTrack); + } + + } + + if ( this->inDetTrackParticle() ) { + aTrack = this->inDetTrackParticle(); + + // check requested object type with token type + NavigationToken<Rec::TrackParticle>* trackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle>* >(&theToken); + if ( trackToken != 0 ) { + // request is honored + trackToken->setObject(aTrack); + checkFlag = true; + } + + // alternative token type may phrase the same request + if ( ! checkFlag ) { + NavigationToken<Rec::TrackParticle,double>* parTrackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle,double>* > + (&theToken); + if ( parTrackToken != 0 ) { + parTrackToken->setObject(aTrack); + checkFlag = true; + } + } + if(!checkFlag) { + + // try for generic type requests + if ( aTrack != 0 ) theToken.trySetObject(aTrack); + } + } + + } + + return; +} + +//////////////////////////////// +// Navigation with parameters // +/////////////////////////////// + +void Muon::fillToken(INavigationToken& theToken, + const boost::any& theWeight) const +{ + bool checkFlag = false; + + + const Rec::TrackParticle* aTrack; + + /// First combined, then try Extrap & In Det + if ( this->combinedMuonTrackParticle() ) { + + aTrack = this->combinedMuonTrackParticle(); + + // check requested object type with token type + NavigationToken<Rec::TrackParticle>* trackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle>* >(&theToken); + if ( trackToken != 0 ) { + // request is honored + trackToken->setObject(aTrack); + checkFlag = true; + } + + // alternative token type may phrase the same request + if ( ! checkFlag ) { + NavigationToken<Rec::TrackParticle,double>* parTrackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle,double>* > + (&theToken); + if ( parTrackToken != 0 ) { + parTrackToken->setObject(aTrack, + boost::any_cast<double>(theWeight)); + checkFlag = true; + } + } + if(!checkFlag) { + + // try for generic type requests + if ( aTrack != 0 ) theToken.trySetObject(aTrack, theWeight); + } + + } + else { + if ( this->muonExtrapolatedTrackParticle() ) { + aTrack = this->muonExtrapolatedTrackParticle(); + + // check requested object type with token type + NavigationToken<Rec::TrackParticle>* trackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle>* >(&theToken); + if ( trackToken != 0 ) { + // request is honored + trackToken->setObject(aTrack); + checkFlag = true; + } + + // alternative token type may phrase the same request + if ( ! checkFlag ) { + NavigationToken<Rec::TrackParticle,double>* parTrackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle,double>* > + (&theToken); + if ( parTrackToken != 0 ) { + parTrackToken->setObject(aTrack, + boost::any_cast<double>(theWeight)); + checkFlag = true; + } + } + if(!checkFlag) { + + // try for generic type requests + if ( aTrack != 0 ) theToken.trySetObject(aTrack, theWeight); + } + + } + + if ( this->inDetTrackParticle() ) { + aTrack = this->inDetTrackParticle(); + + // check requested object type with token type + NavigationToken<Rec::TrackParticle>* trackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle>* >(&theToken); + if ( trackToken != 0 ) { + // request is honored + trackToken->setObject(aTrack); + checkFlag = true; + } + + // alternative token type may phrase the same request + if ( ! checkFlag ) { + NavigationToken<Rec::TrackParticle,double>* parTrackToken = + dynamic_cast< NavigationToken<Rec::TrackParticle,double>* > + (&theToken); + if ( parTrackToken != 0 ) { + parTrackToken->setObject(aTrack, + boost::any_cast<double>(theWeight)); + checkFlag = true; + } + } + if(!checkFlag) { + + // try for generic type requests + if ( aTrack != 0 ) theToken.trySetObject(aTrack, theWeight); + } + } + + } + +} + +/** return the primary track of this muon */ +const Rec::TrackParticle * Muon::track() const { + if (this->hasCombinedMuonTrackParticle()) return (*m_combinedMuonTrackParticle); + else if (this->hasInnerExtrapolatedTrackParticle()) return (*m_innerExtrapolatedTrackParticle); + //else if (this->hasMuonExtrapolatedTrackParticle()) return (*m_muonExtrapolatedTrackParticle); + else if (this->hasInDetTrackParticle()) return (*m_inDetTrackParticle); + else if (this->hasMuonExtrapolatedTrackParticle()) return (*m_muonExtrapolatedTrackParticle); + else return 0; +} + +} //namespace + + diff --git a/Reconstruction/MuonIdentification/muonEvent/src/MuonCaloEnergyContainer.cxx b/Reconstruction/MuonIdentification/muonEvent/src/MuonCaloEnergyContainer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e6c8603fec4192fffa39e45fb4b06bfc9983b0ae --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/src/MuonCaloEnergyContainer.cxx @@ -0,0 +1,21 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////////////////////////////////////// +/// +/// Name: MuonCaloEnergyContainer.cxx +/// Package : offline/Reconstruction/MuonIdentification/muonEvent +/// +/// Authors: K. A. Assamagan +/// Created: February 2008 +/// +/// Purpose: This is a data object, containing a collection of Muon caloEnergy Objects +///////////////////////////////////////////////////////////////////////////////////// + +#include "muonEvent/MuonCaloEnergyContainer.h" + + + + + diff --git a/Reconstruction/MuonIdentification/muonEvent/src/MuonContainer.cxx b/Reconstruction/MuonIdentification/muonEvent/src/MuonContainer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8e48c672e7e23ddd3cff60136945da6bfdf23083 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/src/MuonContainer.cxx @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////////////////////////////////////// +/// +/// Name: MuonContainer.h +/// Package : offline/Reconstruction/MuonIdentification/muonEvent +/// +/// Authors: K. A. Assamagan +/// Created: December 2004 +/// +/// Purpose: This is a data object, containing a collection of Combined Muon Objects +///////////////////////////////////////////////////////////////////////////////////// + +#include "muonEvent/MuonContainer.h" +#ifdef HAVE_NEW_IOSTREAMS + #include <iomanip> + #include <iostream> +#else + #include <iomanip.h> + #include <iostream.h> +#endif + +namespace Analysis { + +// print objects found in container +void MuonContainer::print() +{ + std::cout << "Number of Muon objects in container " + << this->size() << std::endl; +} + +} + + + + diff --git a/Reconstruction/MuonIdentification/muonEvent/src/MuonQualityWord.cxx b/Reconstruction/MuonIdentification/muonEvent/src/MuonQualityWord.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8308f766f98ea925795539dfacf5ab9f8bd21456 --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/src/MuonQualityWord.cxx @@ -0,0 +1,78 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*************************************************************************** + Reconstruction/MuonIdentification/muonEvent/MuonQualityWord.h + Author: Ketevi A. Assamagan, July 2009 + Transienti class to hold muon quality bits and the methods to manipulate it + so as to return the the isLoose, isMedium and isTight to the use. + This object is not persistified. + --------------------------------------------------------------------------- + ***************************************************************************/ + +#include "muonEvent/MuonQualityWord.h" +#include "GaudiKernel/MsgStream.h" + +MuonQualityWord::MuonQualityWord ( uint16_t qualityWord ) + + : m_qualityWord (qualityWord) +{} + +/** copy constructor */ +MuonQualityWord::MuonQualityWord (const MuonQualityWord& qualityWord) + : m_qualityWord ( qualityWord.m_qualityWord ) +{} + +/** destructor */ +MuonQualityWord::~MuonQualityWord() {} + +/** Assignment operator */ +MuonQualityWord& MuonQualityWord::operator=(const MuonQualityWord& rhs) { + if ( this != &rhs ) { + m_qualityWord = rhs.m_qualityWord; + } + return *this; +} + +/** MsgStream output */ +MsgStream& operator << ( MsgStream& sl, const MuonQualityWord& qword) +// if namespace, need to use MsgStream& Rec::operator :-( +{ + sl <<"Muon quality word: "<<qword.qualityWord()<< " ["; + for( int index =15 ; index >= 0 ; index--){ + if (index==12 || index==8 || index==4) { + if( qword.qualityWord() & (1<<index) ) sl << " 1 ][" ; + else sl << " 0 ][" ; + } else if (index==0) { + if( qword.qualityWord() & (1<<index) ) sl << " 1 ]" ; + else sl << " 0 ]" ; + } else { + if( qword.qualityWord() & (1<<index) ) sl << " 1" ; + else sl << " 0" ; + } + } + sl << endreq; + return sl; +} + +/** MsgStream output */ +std::ostream& operator << ( std::ostream& sl, const MuonQualityWord& qword) +// if namespace, need to use MsgStream& Rec::operator :-( +{ + sl <<"Muon quality word: "<<qword.qualityWord()<< " ["; + for( int index =15 ; index >= 0 ; index--){ + if (index==12 || index==8 || index==4) { + if( qword.qualityWord() & (1<<index) ) sl << " 1 ][" ; + else sl << " 0 ][" ; + } else if (index==0) { + if( qword.qualityWord() & (1<<index) ) sl << " 1 ]" ; + else sl << " 0 ]" ; + } else { + if( qword.qualityWord() & (1<<index) ) sl << " 1" ; + else sl << " 0" ; + } + } + sl << std::endl; + return sl; +} diff --git a/Reconstruction/MuonIdentification/muonEvent/src/MuonSpShower.cxx b/Reconstruction/MuonIdentification/muonEvent/src/MuonSpShower.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6132f99b62f0988671df59b9bb284ba7d7cd9cfa --- /dev/null +++ b/Reconstruction/MuonIdentification/muonEvent/src/MuonSpShower.cxx @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*************************************************************************** + MuonSpShower.cxx - Description + ------------------- + begin : 28-07-2006 + authors : Ketevi A. Assamagan + email : Ketevi@bnl.gov + + ***************************************************************************/ + +#include "muonEvent/MuonSpShower.h" + +namespace Rec { + +/** default constructor */ +MuonSpShower::MuonSpShower() : + m_eta(0), + m_phi(0), + m_numberOfTriggerHits(0), + m_numberOfInnerHits(0), + m_numberOfInnerSegments(0), + m_numberOfMiddleHits(0), + m_numberOfMiddleSegments(0), + m_numberOfOuterHits(0), + m_numberOfOuterSegments(0) +{} + +/** Full constructor */ +MuonSpShower::MuonSpShower( + const float eta, const float phi, + const unsigned short numOfTriggerHits, + const unsigned short numOfInnerHits, + const unsigned short numOfMiddleHits, + const unsigned short numOfOuterHits, + const unsigned short numOfInnerSegments, + const unsigned short numOfMiddleSegments, + const unsigned short numOfOuterSegments) { + + m_eta = eta; + m_phi = phi; + m_numberOfTriggerHits = numOfTriggerHits; + m_numberOfInnerHits = numOfInnerHits; + m_numberOfMiddleHits = numOfMiddleHits; + m_numberOfOuterHits = numOfOuterHits; + m_numberOfInnerSegments = numOfInnerSegments; + m_numberOfMiddleSegments = numOfMiddleSegments; + m_numberOfOuterSegments = numOfOuterSegments; +} + +/** Copy Constructor */ +MuonSpShower::MuonSpShower( const MuonSpShower& rhs ) : + m_eta ( rhs.m_eta ), + m_phi ( rhs.m_phi ), + m_numberOfTriggerHits ( rhs.m_numberOfTriggerHits ), + m_numberOfInnerHits ( rhs.m_numberOfInnerHits ), + m_numberOfInnerSegments ( rhs.m_numberOfInnerSegments ), + m_numberOfMiddleHits ( rhs.m_numberOfMiddleHits ), + m_numberOfMiddleSegments ( rhs.m_numberOfMiddleSegments ), + m_numberOfOuterHits ( rhs.m_numberOfOuterHits ), + m_numberOfOuterSegments ( rhs.m_numberOfOuterSegments ) +{} + +/** Assignement operator */ +MuonSpShower& MuonSpShower::operator=( const MuonSpShower& rhs ) +{ + if ( this != &rhs ) { + m_eta = rhs.m_eta; + m_phi = rhs.m_phi; + m_numberOfTriggerHits = rhs.m_numberOfTriggerHits; + m_numberOfInnerHits = rhs.m_numberOfInnerHits; + m_numberOfMiddleHits = rhs.m_numberOfMiddleHits; + m_numberOfOuterHits = rhs.m_numberOfOuterHits; + m_numberOfInnerSegments = rhs.m_numberOfInnerSegments; + m_numberOfMiddleSegments = rhs.m_numberOfMiddleSegments; + m_numberOfOuterSegments = rhs.m_numberOfOuterSegments; + } + return *this; +} + +/** Destructor */ +MuonSpShower::~MuonSpShower() +{} + +} + +