ATLAS Offline Software
xAODElectronAuxContainerCnv_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 
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::Electron_v1() );
43  }
44  oldInt.setStore( oldObj );
45 
47  for( size_t i = 0; i < newObj->size(); ++i ) {
48  newInt.push_back( new xAOD::Electron() );
49  }
50  newInt.setStore( newObj );
51 
52  for( size_t i = 0; i < oldInt.size(); ++i ) {
53 
54  float e237 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::e237);
55  float e277 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::e277);
56  float Reta= ( e277 != 0 ? e237/e277 : 0);
57  newInt[ i ]->setShowerShapeValue(Reta, xAOD::EgammaParameters::Reta);
58  //
59  float e233 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::e233);
60  float Rphi= ( e237 != 0 ? e233/e237 : 0);
61  newInt[ i ]->setShowerShapeValue(Rphi, xAOD::EgammaParameters::Rphi);
62  //
63  float emax = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::emaxs1);
64  float emax2 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::e2tsts1);
65  float Eratio = fabs(emax+emax2)>0. ? (emax-emax2)/(emax+emax2) : 0.;
66  newInt[ i ]->setShowerShapeValue(Eratio, xAOD::EgammaParameters::Eratio);
67  //
68  float emin = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::emins1);
69  float DeltaE = emax2-emin;
70  newInt[ i ]->setShowerShapeValue(DeltaE, xAOD::EgammaParameters::DeltaE);
71  //
72  const xAOD::CaloCluster* cluster = oldInt[ i ]->caloCluster();
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  return;
91 }
92 
99  MsgStream& log ) const {
100 
101  log << MSG::ERROR
102  << "Somebody called xAODElectronAuxContainerCnv_v2::transToPers"
103  << endmsg;
104  throw std::runtime_error( "Somebody called xAODElectronAuxContainerCnv_v2::"
105  "transToPers" );
106 
107  return;
108 }
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
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
xAOD::EgammaParameters::Rphi
@ Rphi
e233/e237
Definition: EgammaEnums.h:156
xAOD::ElectronAuxContainer_v2
Container holding the payload of the electron container.
Definition: ElectronAuxContainer_v2.h:36
xAOD::AuxContainerBase::resize
virtual bool resize(size_t size) override
Resize the arrays to a given size.
Definition: AuxContainerBase.cxx:504
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:429
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
xAODElectronAuxContainerCnv_v2::persToTrans
virtual void persToTrans(const xAOD::ElectronAuxContainer_v2 *oldObj, xAOD::ElectronAuxContainer *newObj, MsgStream &log) const override
Function converting from the old type to the current one.
Definition: xAODElectronAuxContainerCnv_v2.cxx:26
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
ElectronContainer.h
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
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::EgammaParameters::Rhad1
@ Rhad1
ethad1/et
Definition: EgammaEnums.h:162
xAODElectronAuxContainerCnv_v2::xAODElectronAuxContainerCnv_v2
xAODElectronAuxContainerCnv_v2()
Default constructor.
Definition: xAODElectronAuxContainerCnv_v2.cxx:21
xAODElectronAuxContainerCnv_v2.h
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::Electron_v1
Definition: Electron_v1.h:34
xAODElectronAuxContainerCnv_v2::transToPers
virtual void transToPers(const xAOD::ElectronAuxContainer *, xAOD::ElectronAuxContainer_v2 *, MsgStream &log) const override
Dummy function inherited from the base class.
Definition: xAODElectronAuxContainerCnv_v2.cxx:97
xAOD::ElectronAuxContainer_v3
Container holding the payload of the electron container.
Definition: ElectronAuxContainer_v3.h:36
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ElectronContainer_v1.h
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.
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