ATLAS Offline Software
xAODPhotonAuxContainerCnv_v2.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 v2 object into the latest one by misusing
34  // the thinning code a bit...
35  SG::copyAuxStoreThinned( *oldObj, *newObj, nullptr );
36  // Set up interface containers on top of them:
37 
38  //The old is using the v_
40  for( size_t i = 0; i < oldObj->size(); ++i ) {
41  oldInt.push_back( new xAOD::Photon_v1() );
42  }
43  oldInt.setStore( oldObj );
44 
45  xAOD::PhotonContainer newInt;
46  for( size_t i = 0; i < newObj->size(); ++i ) {
47  newInt.push_back( new xAOD::Photon() );
48  }
49  newInt.setStore( newObj );
50 
51  for( size_t i = 0; i < oldInt.size(); ++i ) {
52 
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  const float eta2 = fabsf(cluster->etaBE(2));
73  // transverse energy in calorimeter (using eta position in second sampling)
74  const double energy = cluster->e();
75  double et = 0.;
76  if (eta2<999.) {
77  const double cosheta = cosh(eta2);
78  et = (cosheta != 0.) ? energy /cosheta : 0.;
79  }
80  float ethad = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::ethad);
81  float Rhad = fabs(et) > 0. ? ethad/et : 0.;
82  newInt[ i ]->setShowerShapeValue(Rhad, xAOD::EgammaParameters::Rhad);
83  //
84  float ethad1 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::ethad1);
85  float Rhad1 = fabs(et) > 0. ? ethad1/et : 0.;
86  newInt[ i ]->setShowerShapeValue(Rhad1, xAOD::EgammaParameters::Rhad1);
87  }
88 
89  return;
90 }
91 
98  MsgStream& log ) const {
99 
100  log << MSG::ERROR
101  << "Somebody called xAODPhotonAuxContainerCnv_v2::transToPers"
102  << endmsg;
103  throw std::runtime_error( "Somebody called xAODPhotonAuxContainerCnv_v2::"
104  "transToPers" );
105 
106  return;
107 }
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
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
xAODPhotonAuxContainerCnv_v2::transToPers
virtual void transToPers(const xAOD::PhotonAuxContainer *, xAOD::PhotonAuxContainer_v2 *, MsgStream &log) const override
Dummy function inherited from the base class.
Definition: xAODPhotonAuxContainerCnv_v2.cxx:96
xAOD::EgammaParameters::Rphi
@ Rphi
e233/e237
Definition: EgammaEnums.h:156
xAODPhotonAuxContainerCnv_v2::xAODPhotonAuxContainerCnv_v2
xAODPhotonAuxContainerCnv_v2()
Default constructor.
Definition: xAODPhotonAuxContainerCnv_v2.cxx:21
xAOD::AuxContainerBase::resize
virtual bool resize(size_t size) override
Resize the arrays to a given size.
Definition: AuxContainerBase.cxx:505
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:430
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:85
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
xAODPhotonAuxContainerCnv_v2.h
xAOD::PhotonAuxContainer_v2
Auxiliary store for offline photons.
Definition: PhotonAuxContainer_v2.h:36
xAODPhotonAuxContainerCnv_v2::persToTrans
virtual void persToTrans(const xAOD::PhotonAuxContainer_v2 *oldObj, xAOD::PhotonAuxContainer *newObj, MsgStream &log) const override
Function converting from the old type to the current one.
Definition: xAODPhotonAuxContainerCnv_v2.cxx:26
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
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_v3
Auxiliary store for offline photons.
Definition: PhotonAuxContainer_v3.h:36
xAOD::Photon_v1
Definition: Photon_v1.h:37
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