ATLAS Offline Software
Loading...
Searching...
No Matches
TauJetCnv_p3.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
17
18
19#include "tauEvent/TauJet.h"
22
26
27//Pre-allocate converters
32static const ElementLinkVectorCnv_p1<
34static const ElementLinkVectorCnv_p1<
36static const ElementLinkVectorCnv_p1<
38
39static void setBit( unsigned char &field, unsigned num, bool val )
40{
41 if ( val )
42 field |= (1 << num);
43 else
44 field &= ~(1 << num);
45}
46
47static bool getBit( unsigned char field, unsigned num )
48{
49 return (field & (1 << num)) ? true : false;
50}
51
53 Analysis::TauJet *trans,
54 MsgStream &msg ) const
55{
56 momCnv.persToTrans( &pers->m_momentum, &trans->momentumBase(), msg );
57 partBaseCnv.persToTrans( &pers->m_particleBase, &trans->particleBase(),
58 msg );
59 clusterCnv.persToTrans( &pers->m_cluster, &trans->clusterLink(), msg );
60 clusterCnv.persToTrans( &pers->m_cellCluster, &trans->cellClusterLink(), msg );
61 jetCnv.persToTrans( &pers->m_jet, &trans->jetLink(), msg );
62 tracksCnv.persToTrans( &pers->m_tracks, &trans->trackLinkVector(), msg );
63 detailsCnv.persToTrans( &pers->m_tauDetails, &trans->tauDetailLinkVector(), msg );
65 trans->setROIWord (pers->m_roiWord);
66
67 if( getBit( pers->m_flags, 0 ) ) {
68 std::vector<std::pair<TauJetParameters::TauID, double> > params;
69 params.reserve(pers->m_params.size());
70 for (const auto& p : pers->m_params) {
71 params.emplace_back( static_cast<TauJetParameters::TauID>( p.first),
72 p.second);
73
74 }
75
76 Analysis::TauPID* tauID = new Analysis::TauPID (std::move(params),
77 pers->m_isTauFlags,
78 pers->m_vetoFlags);
79 trans->setTauID (tauID);
80 } else {
81 trans->setTauID( 0 );
82 }
83
84 if( getBit( pers->m_flags, 2 ) )
86 if( getBit( pers->m_flags, 3 ) )
88 conversionTracksCnv.persToTrans(
89 &pers->m_conversionTracks,
90 &trans->conversionTrackLinkVector(), msg );
91}
92
94 TauJet_p3 *pers,
95 MsgStream &msg ) const
96{
97 momCnv.transToPers( &trans->momentumBase(), &pers->m_momentum, msg );
98 partBaseCnv.transToPers( &trans->particleBase(), &pers->m_particleBase,
99 msg );
100 const ElementLink<CaloClusterContainer> clusterLink = trans->clusterLink();
101 clusterCnv.transToPers( &clusterLink, &pers->m_cluster, msg );
102 const ElementLink<CaloClusterContainer> cellClusterLink = trans->cellClusterLink();
103 clusterCnv.transToPers( &cellClusterLink, &pers->m_cellCluster, msg );
104 const ElementLink<JetCollection> jetLink = trans->jetLink();
105 jetCnv.transToPers( &jetLink, &pers->m_jet, msg );
106 tracksCnv.transToPers( &trans->trackLinkVector(), &pers->m_tracks, msg );
107 detailsCnv.transToPers( &trans->tauDetailLinkVector(), &pers->m_tauDetails, msg );
108 pers->m_numberOfTracks = trans->numberOfTracks();
109 pers->m_roiWord = trans->ROIWord();
110 pers->m_params.clear();
111
112
113 if( trans->tauID() ) {
114 setBit( pers->m_flags, 0, true );
115
116 pers->m_vetoFlags = trans->tauID()->vetoFlags().to_ulong();
117 pers->m_isTauFlags = trans->tauID()->isTauFlags().to_ulong();
118
119 pers->m_params.reserve (trans->tauID()->params().size());
120 for (const auto& p : trans->tauID()->params()) {
121 pers->m_params.emplace_back (static_cast<int>( p.first ), p.second);
122 }
123 } else {
124 setBit( pers->m_flags, 0, false );
125 }
126 if( trans->hasAuthor( TauJetParameters::tauRec ) )
127 setBit( pers->m_flags, 2, true );
129 setBit( pers->m_flags, 3, true );
130 conversionTracksCnv.transToPers(
131 &trans->conversionTrackLinkVector(),
132 &pers->m_conversionTracks, msg );
133}
This file contains the class definition for the ElementLinkCnv_p1 class.
This file contains the class definition for the ElementLinkVectorCnv_p1 class.
static const P4ImplPxPyPzECnv_p1 momCnv
Definition JetCnv_p1.cxx:30
static const JetCnv_p1 jetCnv
static const ClusterLinkCnv_t clusterCnv
static const ParticleBaseCnv_p1 partBaseCnv
Declaration of tau jet transient class.
static const ElementLinkVectorCnv_p1< ElementLinkVector< Rec::TrackParticleContainer > > tracksCnv
static const ElementLinkVectorCnv_p1< ElementLinkVector< Rec::TrackParticleContainer > > conversionTracksCnv
static void setBit(unsigned char &field, unsigned num, bool val)
static bool getBit(unsigned char field, unsigned num)
static const ElementLinkVectorCnv_p1< ElementLinkVector< Analysis::TauDetailsContainer > > detailsCnv
static void setBit(unsigned char &field, unsigned num, bool val)
static bool getBit(unsigned char field, unsigned num)
Implementation of transient<->persistent converter for Analysis::TauCommonDetails v3.
Object for taus common for ESD and AOD.
const ElementLink< CaloClusterContainer > cellClusterLink() const
ElementLink to cell CaloCluster, might be invalid the ID variables are calculated from this cluster i...
void setROIWord(unsigned int RoiWord)
Set ROI Word (trigger purposes)
const ElementLinkVector< Rec::TrackParticleContainer > & trackLinkVector() const
Get track link vector.
void setNumberOfTracks(unsigned int numberOfTracks)
Set number of tracks.
const ElementLink< CaloClusterContainer > clusterLink() const
ElementLink to seed CaloCluster, DEPRECATED as of release 13
const ElementLink< JetCollection > jetLink() const
ElementLink to seed Jet, might be invalid if not seeded from a Jet
unsigned int ROIWord() const
Retrieve ROI Word (trigger purposes)
void setTauID(TauPID *tauID)
Set TauPID object that contains discriminant values.
const ElementLinkVector< Rec::TrackParticleContainer > & conversionTrackLinkVector() const
Get conversion track element link vector (const)
unsigned int numberOfTracks() const
Get number of tracks.
const TauPID * tauID() const
Get TauPID object containing discriminant values.
ElementLinkVector< TauDetailsContainer > & tauDetailLinkVector()
bool hasAuthor(const TauJetParameters ::Author &author) const
check if this object has Author author (can be more than one)
void setAuthor(const TauJetParameters ::Author &author)
set the author flag to true
Class containing discriminants produced by identification algorithms.
Definition TauPID.h:32
const std::bitset< 32 > & vetoFlags() const
Definition TauPID.cxx:94
const std::vector< std::pair< TauJetParameters::TauID, double > > & params() const
Definition TauPID.cxx:86
const std::bitset< 32 > & isTauFlags() const
Definition TauPID.cxx:90
ElementLinkVector implementation for standalone ROOT.
const momentum_type & momentumBase() const
access to underlying base type (I4Momentum-like)
const particle_type & particleBase() const
access to underlying base type (IParticle-like)
void transToPers(const Analysis::TauJet *trans, TauJet_p3 *pers, MsgStream &msg) const
Fills a persistent object from a transient object.
void persToTrans(const TauJet_p3 *pers, Analysis::TauJet *trans, MsgStream &msg) const
Fills a transient object from a persistent object.
ElementLinkInt_p1 m_jet
Definition TauJet_p3.h:54
ElementLinkIntVector_p1 m_conversionTracks
Definition TauJet_p3.h:66
ElementLinkInt_p1 m_cellCluster
Definition TauJet_p3.h:53
P4EEtaPhiMFloat_p2 m_momentum
Definition TauJet_p3.h:50
ElementLinkInt_p1 m_cluster
Definition TauJet_p3.h:52
std ::vector< std ::pair< int, float > > m_params
Definition TauJet_p3.h:65
unsigned char m_flags
Definition TauJet_p3.h:57
unsigned long m_isTauFlags
Definition TauJet_p3.h:62
ElementLinkIntVector_p1 m_tracks
Definition TauJet_p3.h:55
unsigned long m_numberOfTracks
Definition TauJet_p3.h:63
unsigned long m_vetoFlags
Definition TauJet_p3.h:61
ElementLinkIntVector_p1 m_tauDetails
Definition TauJet_p3.h:56
unsigned int m_roiWord
Definition TauJet_p3.h:64
ParticleBase_p1 m_particleBase
Definition TauJet_p3.h:51
TauID
Enum for discriminants.
MsgStream & msg
Definition testRead.cxx:32