ATLAS Offline Software
TauJetCnv_p1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //-----------------------------------------------------------------------------
6 // file: TauJetCnv_p1.cxx
7 // author: Lukasz Janyst
8 // date: April 2007
9 //-----------------------------------------------------------------------------
10 
11 #include "tauEvent/TauJet.h"
14 
18 
19 static const P4ImplEEtaPhiMCnv_p1 momCnv;
20 static const ParticleBaseCnv_p1 partBaseCnv;
25 
26 static void setBit( unsigned char &field, unsigned num, bool val )
27 {
28  if( val )
29  field |= (1 << num);
30  else
31  field &= ~(1 << num);
32 }
33 
34 static bool getBit( unsigned char field, unsigned num )
35 {
36  return (field & (1 << num)) ? true : false;
37 }
38 
40  Analysis :: TauJet *trans,
41  MsgStream &msg ) const
42 {
43  momCnv.persToTrans( &pers->m_momentum, &trans->momentumBase(), msg );
44  partBaseCnv.persToTrans( &pers->m_particleBase, &trans->particleBase(),
45  msg );
46  clusterCnv.persToTrans( &pers->m_cluster, &trans->clusterLink(), msg );
47  clusterCnv.persToTrans( &pers->m_cellCluster, &trans->cellClusterLink(), msg );
48  jetCnv.persToTrans( &pers->m_jet, &trans->jetLink(), msg );
49  tracksCnv.persToTrans( &pers->m_tracks, &trans->trackLinkVector(), msg );
50  detailsCnv.persToTrans( &pers->m_tauDetails, &trans->tauDetailLinkVector(), msg );
51  trans->setNumberOfTracks (pers->m_numberOfTracks);
52  trans->setROIWord (pers->m_roiWord);
53 
54  if( getBit( pers->m_flags, 0 ) )
55  {
56  std::vector<std::pair<TauJetParameters::TauID, double> > params;
57  params.reserve(pers->m_params.size());
58  for (const auto& p : pers->m_params) {
59  params.emplace_back( static_cast<TauJetParameters::TauID>( p.first),
60  p.second);
61  }
62 
63  Analysis::TauPID* tauID = new Analysis::TauPID (std::move(params),
64  std::bitset<32>(),
65  pers->m_vetoFlags);
66  trans->setTauID (tauID);
67  }
68  else
69  trans->setTauID( 0 );
70 
71  if( getBit( pers->m_flags, 2 ) )
72  trans->setAuthor( TauJetParameters :: tauRec );
73  if( getBit( pers->m_flags, 3 ) )
74  trans->setAuthor( TauJetParameters :: tau1P3P );
75 }
76 
78  TauJet_p1 *pers,
79  MsgStream &msg ) const
80 {
81  pers->m_params.clear();
82  momCnv.transToPers( &trans->momentumBase(), &pers->m_momentum, msg );
83  partBaseCnv.transToPers( &trans->particleBase(), &pers->m_particleBase, msg );
84  const ElementLink<CaloClusterContainer> clusterLink = trans->clusterLink();
85  clusterCnv.transToPers( &clusterLink, &pers->m_cluster, msg );
86  const ElementLink<CaloClusterContainer> cellClusterLink = trans->cellClusterLink();
87  clusterCnv.transToPers( &cellClusterLink, &pers->m_cellCluster, msg );
88  const ElementLink<JetCollection> jetLink = trans->jetLink();
89  jetCnv.transToPers( &jetLink, &pers->m_jet, msg );
90  tracksCnv.transToPers( &trans->trackLinkVector(), &pers->m_tracks, msg );
91  detailsCnv.transToPers( &trans->tauDetailLinkVector(), &pers->m_tauDetails, msg );
92  pers->m_numberOfTracks = trans->numberOfTracks();
93  pers->m_roiWord = trans->ROIWord();
94 
95  if( trans->tauID() )
96  {
97  setBit( pers->m_flags, 0, true );
98 
99  pers->m_vetoFlags = trans->tauID()->vetoFlags().to_ulong();
100 
101  pers->m_params.reserve (trans->tauID()->params().size());
102  for (const auto& p : trans->tauID()->params()) {
103  pers->m_params.emplace_back (static_cast<int>( p.first ), p.second);
104  }
105  }
106  else
107  setBit( pers->m_flags, 0, false );
108 
109  if( trans->hasAuthor( TauJetParameters :: tauRec ) )
110  setBit( pers->m_flags, 2, true );
111  if( trans->hasAuthor( TauJetParameters :: tau1P3P ) )
112  setBit( pers->m_flags, 3, true );
113 }
P4ImplEEtaPhiMCnv_p1.h
ElementLinkCnv_p1.h
This file contains the class definition for the ElementLinkCnv_p1 class.
Analysis::TauPID
Class containing discriminants produced by identification algorithms.
Definition: TauPID.h:32
TauJetParameters::tau1P3P
@ tau1P3P
Definition: TauJetParameters.h:36
TauJet_p1::m_tauDetails
ElementLinkIntVector_p1 m_tauDetails
Definition: TauJet_p1.h:43
TauJet_p1::m_jet
ElementLinkInt_p1 m_jet
Definition: TauJet_p1.h:41
TauJet_p1::m_particleBase
ParticleBase_p1 m_particleBase
Definition: TauJet_p1.h:38
ElementLinkVectorCnv_p1
Definition: ElementLinkVectorCnv_p1.h:28
ElementLinkVectorCnv_p1.h
This file contains the class definition for the ElementLinkVectorCnv_p1 class. NOTE: it should be inc...
ElementLinkVectorCnv_p1::persToTrans
void persToTrans(const PersLinkVect_t &pers, LinkVect_t &trans, MsgStream &log) const
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
P4ImplEEtaPhiMCnv_p1
Definition: P4ImplEEtaPhiMCnv_p1.h:38
TauJet_p1::m_cluster
ElementLinkInt_p1 m_cluster
Definition: TauJet_p1.h:39
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
TauJetCnv_p1::persToTrans
void persToTrans(const TauJet_p1 *persObj, Analysis ::TauJet *transObj, MsgStream &msg) const
Definition: TauJetCnv_p1.cxx:39
ElementLinkCnv_p1::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
TauJet_p1::m_momentum
P4EEtaPhiM_p1 m_momentum
Definition: TauJet_p1.h:37
TauJet_p1::m_flags
unsigned char m_flags
Definition: TauJet_p1.h:44
ParticleBaseCnv_p1.h
TauJet_p1
Definition: TauJet_p1.h:24
TauJetCnv_p1::transToPers
void transToPers(const Analysis ::TauJet *transObj, TauJet_p1 *persObj, MsgStream &msg) const
Definition: TauJetCnv_p1.cxx:77
ElementLinkCnv_p1
Definition: ElementLinkCnv_p1.h:27
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
TauJetParameters::TauID
TauID
Enum for discriminants.
Definition: TauJetParameters.h:44
TauJet_p1::m_cellCluster
ElementLinkInt_p1 m_cellCluster
Definition: TauJet_p1.h:40
ElementLinkCnv_p1::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
TauJetCnv_p1.h
TauJet_p1::m_vetoFlags
unsigned long m_vetoFlags
Definition: TauJet_p1.h:48
TauJet
@ TauJet
Definition: TruthClasses.h:47
ParticleBaseCnv_p1
Definition: ParticleBaseCnv_p1.h:30
TauJet_p1::m_roiWord
unsigned int m_roiWord
Definition: TauJet_p1.h:50
P4ImplEEtaPhiMCnv_p1::transToPers
virtual void transToPers(const P4ImplEEtaPhiM *transObj, P4ImplEEtaPhiM_p1 *persObj, MsgStream &msg) const override
Method creating the persistent representation P4ImplEEtaPhiM_p1 from its transient representation P4I...
Definition: P4ImplEEtaPhiMCnv_p1.cxx:38
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ElementLinkVectorCnv_p1::transToPers
void transToPers(const LinkVect_t &trans, PersLinkVect_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
P4ImplEEtaPhiMCnv_p1::persToTrans
virtual void persToTrans(const P4ImplEEtaPhiM_p1 *persObj, P4ImplEEtaPhiM *transObj, MsgStream &msg) const override
Method creating the transient representation of P4ImplEEtaPhiM from its persistent representation P4I...
Definition: P4ImplEEtaPhiMCnv_p1.cxx:26
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
TauJet_p1::m_numberOfTracks
unsigned long m_numberOfTracks
Definition: TauJet_p1.h:49
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
TauJet_p1::m_params
std ::vector< std ::pair< int, double > > m_params
Definition: TauJet_p1.h:51
TauJet_p1::m_tracks
ElementLinkIntVector_p1 m_tracks
Definition: TauJet_p1.h:42
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
TauJet.h