2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 ///@file TauCommonDetails.icc
7 /// Inline function implementations for tau event details class
9 ///Package: Reconstruction/TauEvent
11 ///@author Thomas Burgess <tburgess-at-cern-ch>
13 /// Created by Thomas Burgess on 2009-01-17.
15 /// $Id: TauJet.icc,v 1.7 2009-03-11 15:50:06 tburgess Exp $
19 inline bool TauJet::operator!=( const TauJet& rhs ) const
21 return !((*this)==rhs);
24 // Implementation of calorimetry info accessors
25 inline const CaloCluster *TauJet::cluster() const
27 return ( (m_cluster.isValid()) ? (*m_cluster) : 0 );
30 inline void TauJet::setCluster( const CaloClusterContainer *cont,
31 const CaloCluster *clust )
33 if( m_cluster.isValid() )
35 m_cluster.toContainedElement( *cont, clust);
38 inline const ElementLink<CaloClusterContainer> TauJet::clusterLink() const
43 inline ElementLink<CaloClusterContainer> &TauJet::clusterLink()
48 inline void TauJet::setClusterLink(
49 const ElementLink<CaloClusterContainer> &x)
54 inline const CaloCluster *TauJet::cellCluster() const
56 return ( (m_cellCluster.isValid()) ? (*m_cellCluster) : 0 );
59 inline void TauJet::setCellCluster( const CaloClusterContainer *cont,
60 const CaloCluster *clust )
62 if( m_cellCluster.isValid() )
63 m_cellCluster.reset();
64 m_cellCluster.toContainedElement( *cont, clust);
67 inline const ElementLink<CaloClusterContainer>
68 TauJet::cellClusterLink() const
73 inline ElementLink<CaloClusterContainer> &TauJet::cellClusterLink()
78 inline void TauJet::setCellClusterLink(
79 const ElementLink<CaloClusterContainer> &x)
85 inline const Jet *TauJet::jet() const
87 return ( (m_jet.isValid()) ? (*m_jet) : 0 );
90 inline void TauJet::setJet(
91 const JetCollection *cont,
96 m_jet.toContainedElement( *cont, jet );
99 inline const ElementLink<JetCollection> TauJet::jetLink() const
104 inline ElementLink<JetCollection> &TauJet::jetLink()
109 inline void TauJet::setJetLink( const ElementLink<JetCollection> &x)
114 // Implementation of tracking info accessors
115 inline const Rec::TrackParticle *TauJet::track( unsigned int i ) const
117 if( m_tracks.size() <= i )
119 else if( m_tracks[i].isValid() )
120 return *(m_tracks[i]);
125 inline const ElementLinkVector<Rec::TrackParticleContainer>&
126 TauJet::trackLinkVector() const
131 inline ElementLinkVector<Rec::TrackParticleContainer>&
132 TauJet::trackLinkVector()
137 inline void TauJet::addTrack(
138 const Rec::TrackParticleContainer *cont,
139 const Rec::TrackParticle *track )
141 ElementLink<Rec::TrackParticleContainer> link;
142 link.toContainedElement( *cont, track ) ;
143 m_tracks.push_back( link ) ;
146 inline void TauJet::clearTracks()
148 return m_tracks.clear();
151 inline unsigned int TauJet::numTrack() const
153 return m_tracks.size();
156 //Implementation of conversion track accessors
157 inline const Rec :: TrackParticle * TauJet::conversionTrack(
158 unsigned int i ) const
160 if( m_conversionTracks.size() <= i )
162 if( m_conversionTracks[i].isValid() )
163 return *(m_conversionTracks[i]);
167 inline unsigned int TauJet::numConversionTrack() const
169 return m_conversionTracks.size();
172 inline const ElementLinkVector<Rec::TrackParticleContainer>&
173 TauJet::conversionTrackLinkVector() const
175 return m_conversionTracks;
178 inline ElementLinkVector<Rec::TrackParticleContainer>&
179 TauJet::conversionTrackLinkVector()
181 return m_conversionTracks;
184 inline void TauJet::addConversionTrack(
185 const Rec::TrackParticleContainer *cont,
186 const Rec::TrackParticle *track )
188 ElementLink<Rec::TrackParticleContainer> link;
189 link.toContainedElement( *cont, track ) ;
190 m_conversionTracks.push_back( link ) ;
193 inline void TauJet::clearConversionTracks()
195 return m_conversionTracks.clear();
198 inline int TauJet::nProng() const
200 return m_tracks.size()-m_conversionTracks.size();
203 inline bool TauJet::isConversionTrack(
204 unsigned int i) const
206 if (m_tracks.size()<=i) return false;
208 m_conversionTracks.begin(),
209 m_conversionTracks.end(),
210 m_tracks[i] ) != m_conversionTracks.end();
213 // Implementation of seed calo tracking info accessors
214 inline const Rec::TrackParticle *TauJet::seedTrk_track( unsigned int i ) const
216 if( m_seedTrk_tracks.size() <= i )
218 else if( m_seedTrk_tracks[i].isValid() )
219 return *(m_seedTrk_tracks[i]);
224 inline const ElementLinkVector<Rec::TrackParticleContainer>&
225 TauJet::seedTrk_trackLinkVector() const
227 return m_seedTrk_tracks;
230 inline ElementLinkVector<Rec::TrackParticleContainer>&
231 TauJet::seedTrk_trackLinkVector()
233 return m_seedTrk_tracks;
236 inline void TauJet::addSeedTrk_track(
237 const Rec::TrackParticleContainer *cont,
238 const Rec::TrackParticle *track )
240 ElementLink<Rec::TrackParticleContainer> link;
241 link.toContainedElement( *cont, track ) ;
242 m_seedTrk_tracks.push_back( link ) ;
245 inline void TauJet::clearSeedTrk_tracks()
247 return m_seedTrk_tracks.clear();
250 inline unsigned int TauJet::seedTrk_numTrack() const
252 return m_seedTrk_tracks.size();
255 // Implementation of seed calo tracking info accessors
256 inline const Rec::TrackParticle *TauJet::seedCalo_track( unsigned int i ) const
258 if( m_seedCalo_tracks.size() <= i )
260 else if( m_seedCalo_tracks[i].isValid() )
261 return *(m_seedCalo_tracks[i]);
266 inline const ElementLinkVector<Rec::TrackParticleContainer>&
267 TauJet::seedCalo_trackLinkVector() const
269 return m_seedCalo_tracks;
272 inline ElementLinkVector<Rec::TrackParticleContainer>&
273 TauJet::seedCalo_trackLinkVector()
275 return m_seedCalo_tracks;
278 inline void TauJet::addSeedCalo_track(
279 const Rec::TrackParticleContainer *cont,
280 const Rec::TrackParticle *track )
282 ElementLink<Rec::TrackParticleContainer> link;
283 link.toContainedElement( *cont, track ) ;
284 m_seedCalo_tracks.push_back( link ) ;
287 inline void TauJet::clearSeedCalo_tracks()
289 return m_seedCalo_tracks.clear();
292 inline unsigned int TauJet::seedCalo_numTrack() const
294 return m_seedCalo_tracks.size();
299 // Accessors for identification info
300 inline TauPID *TauJet::tauID()
305 inline const TauPID *TauJet::tauID() const
310 inline void TauJet::setTauID( TauPID *tauID )
316 // Accessors for detail classes
317 inline void TauJet::addDetails( const TauDetailsContainer *container,
318 TauDetails *details )
320 ElementLink<TauDetailsContainer> p_link;
321 p_link.toContainedElement( *container, details );
322 m_tauDetails.push_back( p_link );
326 inline TauJetParameters::Author TauJet::author() const
328 return TauJetParameters::unknown;
331 inline bool TauJet::hasAuthor(
332 const TauJetParameters::Author &author ) const
334 return m_author.test( author );
337 inline void TauJet::setAuthor( const TauJetParameters::Author &author )
339 m_author.set( author ); // enum used as size_t
342 inline void TauJet::clearAuthor( const TauJetParameters::Author &author )
344 m_author.reset( author ); // enum used as size_t
347 // Independent number of tracks accessors
348 inline unsigned int TauJet::numberOfTracks() const
350 return m_numberOfTracks;
353 inline void TauJet::setNumberOfTracks( unsigned int numberOfTracks )
355 m_numberOfTracks = numberOfTracks;
358 inline void TauJet::setROIWord( unsigned int RoiWord )
363 inline unsigned int TauJet::ROIWord() const
368 template <typename T> const T *TauJet::details(
369 const std::string &name ) const
371 const unsigned int p_size = m_tauDetails.size();
372 for( unsigned int i = 0; i != p_size; ++i ) {
373 if (!m_tauDetails[i].isValid()) continue;
374 const TauDetails *details = *m_tauDetails[i];
375 if( (m_tauDetails.elementDataID(i) == name)
376 && (typeid( *details ).name() == typeid( const T ).name()) )
377 return dynamic_cast<const T*>( details );
382 template <typename T> const T *TauJet::details() const
384 const unsigned int p_size = m_tauDetails.size();
385 for( unsigned int i = 0; i != p_size; ++i ) {
386 if (!m_tauDetails[i].isValid()) continue;
387 const TauDetails *details = *m_tauDetails[i];
388 if( typeid( *details ).name() == typeid( const T ).name() )
389 return dynamic_cast<const T*>( details );
394 inline ElementLinkVector<TauDetailsContainer>& TauJet::tauDetailLinkVector()
398 inline const ElementLinkVector<TauDetailsContainer>& TauJet::tauDetailLinkVector() const
403 inline void TauJet::setE( const double ene )
405 return this->momentumBase().setE(ene);
408 inline void TauJet::setEta( const double eta )
410 return this->momentumBase().setEta(eta);
413 inline void TauJet::setPhi( const double phi )
415 return this->momentumBase().setPhi(phi);
418 inline void TauJet::setM( const double m )
420 return this->momentumBase().setM(m);
423 inline bool TauJet::hasMergedToCommonDetails() const
425 return m_hasMergedToCommonDetails;
428 inline void TauJet::setHasMergedToCommonDetails(
431 m_hasMergedToCommonDetails = state;
434 inline void TauJet::storeHLV( TauJetParameters::TauCalibType type, CLHEP::HepLorentzVector hlv )
436 //Some form of sanity check should probably go here...e.g. protect if already stored
437 for(std::vector<std::pair<TauJetParameters::TauCalibType, CLHEP::HepLorentzVector> >::size_type i = 0;
438 i != m_tauHLVStorage.size(); i++)
440 if(m_tauHLVStorage[i].first==type)
445 m_tauHLVStorage.push_back( std::make_pair(type,hlv) );
448 inline CLHEP::HepLorentzVector TauJet::getHLV( TauJetParameters::TauCalibType type ) const
450 //loop over m_tauHLVStorage and return the hlv paired with 'type'
451 for(std::vector<std::pair<TauJetParameters::TauCalibType, CLHEP::HepLorentzVector> >::size_type i = 0;
452 i != m_tauHLVStorage.size(); i++)
454 if(m_tauHLVStorage[i].first==type)
456 return m_tauHLVStorage[i].second;
460 //If we find nothing, return a trivial result
461 CLHEP::HepLorentzVector dummy;
465 inline const std::vector<PanTau::PanTauSeed*>& TauJet::getListOfPanTauSeeds() const {
466 return m_listOfPanTauSeeds;
469 inline void TauJet::addPanTauSeed(PanTau::PanTauSeed* pantauSeed) {
470 m_listOfPanTauSeeds.push_back(pantauSeed);