ATLAS Offline Software
TauJetCnv_p4.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
18 
19 
20 #include "tauEvent/TauJet.h"
23 
27 
28 //Pre-allocate converters
29 static const P4ImplEEtaPhiMCnv_p2 momCnv;
30 static const ParticleBaseCnv_p2 partBaseCnv;
38 
39 static 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 
47 static 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(), msg );
58  clusterCnv.persToTrans( &pers->m_cluster, &trans->clusterLink(), msg );
59  clusterCnv.persToTrans( &pers->m_cellCluster, &trans->cellClusterLink(), msg );
60  jetCnv.persToTrans( &pers->m_jet, &trans->jetLink(), msg );
61  tracksCnv.persToTrans( &pers->m_tracks, &trans->trackLinkVector(), msg );
62  detailsCnv.persToTrans( &pers->m_tauDetails, &trans->tauDetailLinkVector(), msg );
63  trans->setNumberOfTracks (pers->m_numberOfTracks);
64  trans->setROIWord (pers->m_roiWord);
65 
66  if( getBit( pers->m_flags, 0 ) ) {
67  std::vector<std::pair<TauJetParameters::TauID, double> > params;
68  params.reserve(pers->m_params.size());
69  for (const auto& p : pers->m_params) {
70  params.emplace_back( static_cast<TauJetParameters::TauID>( p.first),
71  p.second);
72 
73  }
74 
75  Analysis::TauPID* tauID = new Analysis::TauPID (std::move(params),
76  pers->m_isTauFlags,
77  pers->m_vetoFlags);
78  trans->setTauID (tauID);
79  } else {
80  trans->setTauID( 0 );
81  }
82 
83  if( getBit( pers->m_flags, 2 ) )
85  if( getBit( pers->m_flags, 3 ) )
87  conversionTracksCnv.persToTrans(
88  &pers->m_conversionTracks,
89  &trans->conversionTrackLinkVector(), msg );
90  seedCalo_tracksCnv.persToTrans(
91  &pers->m_seedCalo_tracks,
92  &trans->seedCalo_trackLinkVector(), msg );
93  seedTrk_tracksCnv.persToTrans(
94  &pers->m_seedTrk_tracks,
95  &trans->seedTrk_trackLinkVector(), msg );
96 
97 }
98 
100  TauJet_p4 *pers,
101  MsgStream &msg ) const
102 {
103  momCnv.transToPers( &trans->momentumBase(), &pers->m_momentum, msg );
104  partBaseCnv.transToPers( &trans->particleBase(), &pers->m_particleBase, msg );
105  const ElementLink<CaloClusterContainer> clusterLink = trans->clusterLink();
106  clusterCnv.transToPers( &clusterLink, &pers->m_cluster, msg );
107  const ElementLink<CaloClusterContainer> cellClusterLink = trans->cellClusterLink();
108  clusterCnv.transToPers( &cellClusterLink, &pers->m_cellCluster, msg );
109  const ElementLink<JetCollection> jetLink = trans->jetLink();
110  jetCnv.transToPers( &jetLink, &pers->m_jet, msg );
111  tracksCnv.transToPers( &trans->trackLinkVector(), &pers->m_tracks, msg );
112  detailsCnv.transToPers( &trans->tauDetailLinkVector(), &pers->m_tauDetails, msg );
113  pers->m_numberOfTracks = trans->numberOfTracks();
114  pers->m_roiWord = trans->ROIWord();
115  pers->m_params.clear();
116 
117 
118  if( trans->tauID() ) {
119  setBit( pers->m_flags, 0, true );
120 
121  pers->m_vetoFlags = trans->tauID()->vetoFlags().to_ulong();
122  pers->m_isTauFlags = trans->tauID()->isTauFlags().to_ulong();
123 
124  pers->m_params.reserve (trans->tauID()->params().size());
125  for (const auto& p : trans->tauID()->params()) {
126  pers->m_params.emplace_back (static_cast<int>( p.first ), p.second);
127  }
128  } else {
129  setBit( pers->m_flags, 0, false );
130  }
131  if( trans->hasAuthor( TauJetParameters::tauRec ) )
132  setBit( pers->m_flags, 2, true );
133  if( trans->hasAuthor( TauJetParameters::tau1P3P ) )
134  setBit( pers->m_flags, 3, true );
135  conversionTracksCnv.transToPers(
136  &trans->conversionTrackLinkVector(),
137  &pers->m_conversionTracks, msg );
138  seedCalo_tracksCnv.transToPers(
139  &trans->seedCalo_trackLinkVector(),
140  &pers->m_seedCalo_tracks, msg );
141  seedTrk_tracksCnv.transToPers(
142  &trans->seedTrk_trackLinkVector(),
143  &pers->m_seedTrk_tracks, msg );
144 }
TauJet_p4::m_particleBase
ParticleBase_p2 m_particleBase
Definition: TauJet_p4.h:52
Analysis::TauJet::seedCalo_trackLinkVector
const ElementLinkVector< Rec::TrackParticleContainer > & seedCalo_trackLinkVector() const
Get seed calo track link vector.
ElementLinkCnv_p3
Definition: ElementLinkCnv_p3.h:27
Analysis::TauJet::setROIWord
void setROIWord(unsigned int RoiWord)
Set ROI Word (trigger purposes)
P4ImplEEtaPhiMCnv_p2
Definition: P4ImplEEtaPhiMCnv_p2.h:35
Analysis::TauJet::setTauID
void setTauID(TauPID *tauID)
Set TauPID object that contains discriminant values.
Analysis::TauPID
Class containing discriminants produced by identification algorithms.
Definition: TauPID.h:32
ElementLinkCnv_p3.h
This file contains the class definition for the ElementLinkCnv_p3 class.
ElementLinkCnv_p3::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
TauJet_p4::m_flags
unsigned char m_flags
Definition: TauJet_p4.h:58
TauJetParameters::tau1P3P
@ tau1P3P
Definition: TauJetParameters.h:36
P4ImplEEtaPhiMCnv_p2.h
ParticleBaseCnv_p2::persToTrans
virtual void persToTrans(const ParticleBase_p2 *persObj, ParticleBase *transObj, MsgStream &msg) const final
Method creating the transient representation of ParticleBase from its persistent representation Parti...
Definition: ParticleBaseCnv_p2.cxx:42
ElementLinkVectorCnv_p1
Definition: ElementLinkVectorCnv_p1.h:28
TauJet_p4::m_cluster
ElementLinkInt_p3 m_cluster
Definition: TauJet_p4.h:53
Analysis::TauJet::hasAuthor
bool hasAuthor(const TauJetParameters ::Author &author) const
check if this object has Author author (can be more than one)
Analysis::TauJet::numberOfTracks
unsigned int numberOfTracks() const
Get number of tracks.
ElementLinkVectorCnv_p1.h
This file contains the class definition for the ElementLinkVectorCnv_p1 class. NOTE: it should be inc...
TauJet_p4::m_params
std ::vector< std ::pair< int, float > > m_params
Definition: TauJet_p4.h:66
ElementLinkVectorCnv_p1::persToTrans
void persToTrans(const PersLinkVect_t &pers, LinkVect_t &trans, MsgStream &log) const
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
Analysis::TauJet::jetLink
const ElementLink< JetCollection > jetLink() const
ElementLink to seed Jet, might be invalid if not seeded from a Jet
TauJet_p4::m_jet
ElementLinkInt_p3 m_jet
Definition: TauJet_p4.h:55
TauJetCnv_p4::transToPers
void transToPers(const Analysis::TauJet *trans, TauJet_p4 *pers, MsgStream &msg) const
Fills a persistent object from a transient object
Definition: TauJetCnv_p4.cxx:99
TauJet_p4
Definition: TauJet_p4.h:33
Analysis::TauPID::isTauFlags
const std::bitset< 32 > & isTauFlags() const
Definition: TauPID.cxx:90
Analysis::TauJet::tauID
const TauPID * tauID() const
Get TauPID object containing discriminant values.
ParticleBaseCnv_p2::transToPers
virtual void transToPers(const ParticleBase *transObj, ParticleBase_p2 *persObj, MsgStream &msg) const final
Method creating the persistent representation ParticleBase_p2 from its transient representation Parti...
Definition: ParticleBaseCnv_p2.cxx:73
ElementLinkCnv_p3::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
TauJetParameters::tauRec
@ tauRec
Definition: TauJetParameters.h:35
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ParticleBaseCnv_p2.h
TauJet_p4::m_conversionTracks
ElementLinkIntVector_p1 m_conversionTracks
Definition: TauJet_p4.h:67
TauJet_p4::m_seedTrk_tracks
ElementLinkIntVector_p1 m_seedTrk_tracks
Definition: TauJet_p4.h:69
Analysis::TauJet
Object for taus common for ESD and AOD.
Definition: Reconstruction/tauEvent/tauEvent/TauJet.h:61
Analysis::TauJet::seedTrk_trackLinkVector
const ElementLinkVector< Rec::TrackParticleContainer > & seedTrk_trackLinkVector() const
Get seed trk track link vector.
Analysis::TauJet::conversionTrackLinkVector
const ElementLinkVector< Rec::TrackParticleContainer > & conversionTrackLinkVector() const
Get conversion track element link vector (const)
Analysis::TauPID::vetoFlags
const std::bitset< 32 > & vetoFlags() const
Definition: TauPID.cxx:94
TauJetCnv_p4.h
TauJet_p4::m_seedCalo_tracks
ElementLinkIntVector_p1 m_seedCalo_tracks
Definition: TauJet_p4.h:68
Analysis::TauJet::clusterLink
const ElementLink< CaloClusterContainer > clusterLink() const
ElementLink to seed CaloCluster, DEPRECATED as of release 13
ParticleImpl::momentumBase
const momentum_type & momentumBase() const
access to underlying base type (I4Momentum-like)
Definition: ParticleImpl.h:393
TauJet_p4::m_isTauFlags
unsigned long m_isTauFlags
Definition: TauJet_p4.h:63
Analysis::TauJet::ROIWord
unsigned int ROIWord() const
Retrieve ROI Word (trigger purposes)
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
TauJetParameters::TauID
TauID
Enum for discriminants.
Definition: TauJetParameters.h:44
P4ImplEEtaPhiMCnv_p2::transToPers
virtual void transToPers(const P4ImplEEtaPhiM *transObj, P4EEtaPhiMFloat_p2 *persObj, MsgStream &log) const override
Method creating the persistent representation P4EEtaPhiMFloat_p2 from its transient representation P4...
Definition: P4ImplEEtaPhiMCnv_p2.cxx:38
ParticleImpl::particleBase
const particle_type & particleBase() const
access to underlying base type (IParticle-like)
Definition: ParticleImpl.h:403
TauJet_p4::m_numberOfTracks
unsigned long m_numberOfTracks
Definition: TauJet_p4.h:64
P4ImplEEtaPhiMCnv_p2::persToTrans
virtual void persToTrans(const P4EEtaPhiMFloat_p2 *persObj, P4ImplEEtaPhiM *transObj, MsgStream &log) const override
Method creating the transient representation of P4ImplEEtaPhiM from its persistent representation P4E...
Definition: P4ImplEEtaPhiMCnv_p2.cxx:26
TauJet_p4::m_roiWord
unsigned int m_roiWord
Definition: TauJet_p4.h:65
TauJet_p4::m_cellCluster
ElementLinkInt_p3 m_cellCluster
Definition: TauJet_p4.h:54
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
Analysis::TauJet::trackLinkVector
const ElementLinkVector< Rec::TrackParticleContainer > & trackLinkVector() const
Get track link vector.
TauJetCnv_p4::persToTrans
void persToTrans(const TauJet_p4 *pers, Analysis::TauJet *trans, MsgStream &msg) const
Fills a transient object from a persistent object.
Definition: TauJetCnv_p4.cxx:52
ElementLinkVectorCnv_p1::transToPers
void transToPers(const LinkVect_t &trans, PersLinkVect_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
Analysis::TauJet::setNumberOfTracks
void setNumberOfTracks(unsigned int numberOfTracks)
Set number of tracks @ param numberOfTracks Number of tracks.
TauJet_p4::m_tracks
ElementLinkIntVector_p1 m_tracks
Definition: TauJet_p4.h:56
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
Analysis::TauJet::cellClusterLink
const ElementLink< CaloClusterContainer > cellClusterLink() const
ElementLink to cell CaloCluster, might be invalid the ID variables are calculated from this cluster i...
TauJet_p4::m_momentum
P4EEtaPhiMFloat_p2 m_momentum
Definition: TauJet_p4.h:51
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
TauJet_p4::m_vetoFlags
unsigned long m_vetoFlags
Definition: TauJet_p4.h:62
TauJet.h
ParticleBaseCnv_p2
Definition: ParticleBaseCnv_p2.h:30
Analysis::TauJet::setAuthor
void setAuthor(const TauJetParameters ::Author &author)
set the author flag to true
Analysis::TauPID::params
const std::vector< std::pair< TauJetParameters::TauID, double > > & params() const
Definition: TauPID.cxx:86
TauJet_p4::m_tauDetails
ElementLinkIntVector_p1 m_tauDetails
Definition: TauJet_p4.h:57
Analysis::TauJet::tauDetailLinkVector
ElementLinkVector< TauDetailsContainer > & tauDetailLinkVector()