ATLAS Offline Software
xAODPhotonAuxContainerCnv_v1.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 // System include(s):
7 #include <stdexcept>
8 
9 // Gaudi/Athena include(s):
10 #include "GaudiKernel/MsgStream.h"
11 
12 // Core EDM include(s):
14 
15 // Local include(s):
19 
20 
22 {
23 }
24 
28  MsgStream& /*log*/ ) const {
29 
30  // Clear the transient object:
31  newObj->resize( 0 );
32 
33  // Copy the payload of the v1 object into the latest one by misusing
34  // the thinning code a bit...
35  SG::copyAuxStoreThinned( *oldObj, *newObj, nullptr );
36 
37  // Set up interface containers on top of them:
38 
39  //The old uses v_
41  for( size_t i = 0; i < oldObj->size(); ++i ) {
42  oldInt.push_back( new xAOD::Photon_v1() );
43  }
44  oldInt.setStore( oldObj );
45 
46  xAOD::PhotonContainer newInt;
47  for( size_t i = 0; i < newObj->size(); ++i ) {
48  newInt.push_back( new xAOD::Photon() );
49  }
50  newInt.setStore( newObj );
51 
52  for( size_t i = 0; i < oldInt.size(); ++i ) {
53  float e237 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::e237);
54  float e277 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::e277);
55  float Reta= ( e277 != 0 ? e237/e277 : 0);
56  newInt[ i ]->setShowerShapeValue(Reta, xAOD::EgammaParameters::Reta);
57  //
58  float e233 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::e233);
59  float Rphi= ( e237 != 0 ? e233/e237 : 0);
60  newInt[ i ]->setShowerShapeValue(Rphi, xAOD::EgammaParameters::Rphi);
61  //
62  float emax = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::emaxs1);
63  float emax2 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::e2tsts1);
64  float Eratio = fabs(emax+emax2)>0. ? (emax-emax2)/(emax+emax2) : 0.;
65  newInt[ i ]->setShowerShapeValue(Eratio, xAOD::EgammaParameters::Eratio);
66  //
67  float emin = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::emins1);
68  float DeltaE = emax2-emin;
69  newInt[ i ]->setShowerShapeValue(DeltaE, xAOD::EgammaParameters::DeltaE);
70  //
71  const xAOD::CaloCluster* cluster = oldInt[ i ]->caloCluster();
72  if (cluster) {
73  const float eta2 = fabsf(cluster->etaBE(2));
74  // transverse energy in calorimeter (using eta position in second sampling)
75  const double energy = cluster->e();
76  double et = 0.;
77  if (eta2<999.) {
78  const double cosheta = cosh(eta2);
79  et = (cosheta != 0.) ? energy /cosheta : 0.;
80  }
81  float ethad = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::ethad);
82  float Rhad = fabs(et) > 0. ? ethad/et : 0.;
83  newInt[ i ]->setShowerShapeValue(Rhad, xAOD::EgammaParameters::Rhad);
84  //
85  float ethad1 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::ethad1);
86  float Rhad1 = fabs(et) > 0. ? ethad1/et : 0.;
87  newInt[ i ]->setShowerShapeValue(Rhad1, xAOD::EgammaParameters::Rhad1);
88  }
89  }
90 
91  return;
92 }
93 
100  MsgStream& log ) const {
101 
102  log << MSG::ERROR
103  << "Somebody called xAODPhotonAuxContainerCnv_v1::transToPers"
104  << endmsg;
105  throw std::runtime_error( "Somebody called xAODPhotonAuxContainerCnv_v1::"
106  "transToPers" );
107 
108  return;
109 }
SG::copyAuxStoreThinned
void copyAuxStoreThinned(const SG::IConstAuxStore &orig, SG::IAuxStore &copy, const SG::ThinningInfo *info)
Helper to copy an aux store while applying thinning.
xAOD::EgammaParameters::e233
@ e233
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x3 (in cell units e...
Definition: EgammaEnums.h:68
PhotonContainer_v1.h
et
Extra patterns decribing particle interation process.
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
xAOD::EgammaParameters::Reta
@ Reta
e237/e277
Definition: EgammaEnums.h:154
xAODPhotonAuxContainerCnv_v1::transToPers
virtual void transToPers(const xAOD::PhotonAuxContainer *, xAOD::PhotonAuxContainer_v1 *, MsgStream &log) const override
Dummy function inherited from the base class.
Definition: xAODPhotonAuxContainerCnv_v1.cxx:98
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
xAOD::EgammaParameters::ethad1
@ ethad1
transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated fr...
Definition: EgammaEnums.h:42
xAOD::EgammaParameters::Rphi
@ Rphi
e233/e237
Definition: EgammaEnums.h:156
xAODPhotonAuxContainerCnv_v1::persToTrans
virtual void persToTrans(const xAOD::PhotonAuxContainer_v1 *oldObj, xAOD::PhotonAuxContainer *newObj, MsgStream &log) const override
Function converting from the old type to the current one.
Definition: xAODPhotonAuxContainerCnv_v1.cxx:26
xAOD::AuxContainerBase::resize
virtual bool resize(size_t size) override
Resize the arrays to a given size.
Definition: AuxContainerBase.cxx:485
xAODPhotonAuxContainerCnv_v1.h
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:644
xAOD::AuxContainerBase::size
virtual size_t size() const override
Get the size of the container.
Definition: AuxContainerBase.cxx:410
xAOD::EgammaParameters::ethad
@ ethad
ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling::TileGap3.
Definition: EgammaEnums.h:45
copyAuxStoreThinned.h
Helper to copy an aux store while applying thinning.
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
xAOD::EgammaParameters::emins1
@ emins1
energy reconstructed in the strip with the minimal value between the first and second maximum
Definition: EgammaEnums.h:143
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::EgammaParameters::Rhad1
@ Rhad1
ethad1/et
Definition: EgammaEnums.h:162
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::PhotonAuxContainer_v1
Auxiliary store for offline photons.
Definition: PhotonAuxContainer_v1.h:37
xAOD::PhotonAuxContainer_v3
Auxiliary store for offline photons.
Definition: PhotonAuxContainer_v3.h:36
xAOD::Photon_v1
Definition: Photon_v1.h:37
xAODPhotonAuxContainerCnv_v1::xAODPhotonAuxContainerCnv_v1
xAODPhotonAuxContainerCnv_v1()
Default constructor.
Definition: xAODPhotonAuxContainerCnv_v1.cxx:21
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
xAOD::EgammaParameters::e277
@ e277
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
Definition: EgammaEnums.h:80
xAOD::EgammaParameters::Eratio
@ Eratio
(emaxs1-e2tsts1)/(emaxs1+e2tsts1)
Definition: EgammaEnums.h:158
xAOD::EgammaParameters::e237
@ e237
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x7
Definition: EgammaEnums.h:77
xAOD::EgammaParameters::e2tsts1
@ e2tsts1
energy of the cell corresponding to second energy maximum in the first sampling
Definition: EgammaEnums.h:108
xAOD::EgammaParameters::Rhad
@ Rhad
ethad/et
Definition: EgammaEnums.h:160
xAOD::EgammaParameters::DeltaE
@ DeltaE
e2tsts1-emins1
Definition: EgammaEnums.h:164
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
PhotonContainer.h
xAOD::EgammaParameters::emaxs1
@ emaxs1
energy of strip with maximal energy deposit
Definition: EgammaEnums.h:145
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265