ATLAS Offline Software
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
28 static const P4ImplEEtaPhiMCnv_p2 momCnv;
29 static const ParticleBaseCnv_p1 partBaseCnv;
32 static const ElementLinkVectorCnv_p1<
34 static const ElementLinkVectorCnv_p1<
36 static const ElementLinkVectorCnv_p1<
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(),
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 );
64  trans->setNumberOfTracks (pers->m_numberOfTracks);
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 );
128  if( trans->hasAuthor( TauJetParameters::tau1P3P ) )
129  setBit( pers->m_flags, 3, true );
130  conversionTracksCnv.transToPers(
131  &trans->conversionTrackLinkVector(),
132  &pers->m_conversionTracks, msg );
133 }
ElementLinkCnv_p1.h
This file contains the class definition for the ElementLinkCnv_p1 class.
TauJetCnv_p3::persToTrans
void persToTrans(const TauJet_p3 *pers, Analysis::TauJet *trans, MsgStream &msg) const
Fills a transient object from a persistent object.
Definition: TauJetCnv_p3.cxx:52
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.
TauJet_p3::m_momentum
P4EEtaPhiMFloat_p2 m_momentum
Definition: TauJet_p3.h:50
Analysis::TauPID
Class containing discriminants produced by identification algorithms.
Definition: TauPID.h:32
TauJetParameters::tau1P3P
@ tau1P3P
Definition: TauJetParameters.h:36
TauJet_p3::m_vetoFlags
unsigned long m_vetoFlags
Definition: TauJet_p3.h:61
P4ImplEEtaPhiMCnv_p2.h
ElementLinkVectorCnv_p1
Definition: ElementLinkVectorCnv_p1.h:28
TauJet_p3::m_tracks
ElementLinkIntVector_p1 m_tracks
Definition: TauJet_p3.h:55
Analysis::TauJet::hasAuthor
bool hasAuthor(const TauJetParameters ::Author &author) const
check if this object has Author author (can be more than one)
TauJet_p3::m_flags
unsigned char m_flags
Definition: TauJet_p3.h:57
TauJet_p3::m_numberOfTracks
unsigned long m_numberOfTracks
Definition: TauJet_p3.h:63
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...
ElementLinkVector< Analysis::TauDetailsContainer >
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_p3::m_cellCluster
ElementLinkInt_p1 m_cellCluster
Definition: TauJet_p3.h:53
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.
TauJet_p3::m_jet
ElementLinkInt_p1 m_jet
Definition: TauJet_p3.h:54
ParticleBaseCnv_p1::persToTrans
virtual void persToTrans(const ParticleBase_p1 *persObj, ParticleBase *transObj, MsgStream &msg) const final
Method creating the transient representation of ParticleBase from its persistent representation Parti...
Definition: ParticleBaseCnv_p1.cxx:49
TauJetParameters::tauRec
@ tauRec
Definition: TauJetParameters.h:35
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ElementLinkCnv_p1::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
TauJet_p3::m_isTauFlags
unsigned long m_isTauFlags
Definition: TauJet_p3.h:62
TauJet_p3::m_tauDetails
ElementLinkIntVector_p1 m_tauDetails
Definition: TauJet_p3.h:56
Analysis::TauJet
Object for taus common for ESD and AOD.
Definition: Reconstruction/tauEvent/tauEvent/TauJet.h:61
TauJet_p3::m_cluster
ElementLinkInt_p1 m_cluster
Definition: TauJet_p3.h:52
ParticleBaseCnv_p1.h
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
TauJet_p3
Definition: TauJet_p3.h:32
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
Analysis::TauJet::ROIWord
unsigned int ROIWord() const
Retrieve ROI Word (trigger purposes)
ElementLinkCnv_p1
Definition: ElementLinkCnv_p1.h:27
TauJetCnv_p3.h
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
ElementLinkCnv_p1::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
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_p3::m_params
std ::vector< std ::pair< int, float > > m_params
Definition: TauJet_p3.h:65
TauJet_p3::m_roiWord
unsigned int m_roiWord
Definition: TauJet_p3.h:64
ParticleBaseCnv_p1
Definition: ParticleBaseCnv_p1.h:30
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
Analysis::TauJet::trackLinkVector
const ElementLinkVector< Rec::TrackParticleContainer > & trackLinkVector() const
Get track link vector.
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.
ParticleBaseCnv_p1::transToPers
virtual void transToPers(const ParticleBase *transObj, ParticleBase_p1 *persObj, MsgStream &msg) const final
Method creating the persistent representation ParticleBase_p1 from its transient representation Parti...
Definition: ParticleBaseCnv_p1.cxx:80
TauJetCnv_p3::transToPers
void transToPers(const Analysis::TauJet *trans, TauJet_p3 *pers, MsgStream &msg) const
Fills a persistent object from a transient object
Definition: TauJetCnv_p3.cxx:93
TauJet_p3::m_particleBase
ParticleBase_p1 m_particleBase
Definition: TauJet_p3.h:51
TauJet_p3::m_conversionTracks
ElementLinkIntVector_p1 m_conversionTracks
Definition: TauJet_p3.h:66
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...
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
TauJet.h
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
Analysis::TauJet::tauDetailLinkVector
ElementLinkVector< TauDetailsContainer > & tauDetailLinkVector()