ATLAS Offline Software
Loading...
Searching...
No Matches
xAODElectronAuxContainerCnv_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
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::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 if (cluster) {
74 const float eta2 = fabsf(cluster->etaBE(2));
75 // transverse energy in calorimeter (using eta position in second sampling)
76 const double energy = cluster->e();
77 double et = 0.;
78 if (eta2<999.) {
79 const double cosheta = cosh(eta2);
80 et = (cosheta != 0.) ? energy /cosheta : 0.;
81 }
82 float ethad = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::ethad);
83 float Rhad = fabs(et) > 0. ? ethad/et : 0.;
84 newInt[ i ]->setShowerShapeValue(Rhad, xAOD::EgammaParameters::Rhad);
85 //
86 float ethad1 = oldInt[ i ]->showerShapeValue(xAOD::EgammaParameters::ethad1);
87 float Rhad1 = fabs(et) > 0. ? ethad1/et : 0.;
88 newInt[ i ]->setShowerShapeValue(Rhad1, xAOD::EgammaParameters::Rhad1);
89 }
90 }
91
92 return;
93}
94
101 MsgStream& log ) const {
102
103 log << MSG::ERROR
104 << "Somebody called xAODElectronAuxContainerCnv_v1::transToPers"
105 << endmsg;
106 throw std::runtime_error( "Somebody called xAODElectronAuxContainerCnv_v1::"
107 "transToPers" );
108
109 return;
110}
#define endmsg
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual void persToTrans(const xAOD::ElectronAuxContainer_v1 *oldObj, xAOD::ElectronAuxContainer *newObj, MsgStream &log) const override
Function converting from the old type to the current one.
virtual void transToPers(const xAOD::ElectronAuxContainer *, xAOD::ElectronAuxContainer_v1 *, MsgStream &log) const override
Dummy function inherited from the base class.
virtual bool resize(size_t size) override
Resize the arrays to a given size.
virtual size_t size() const override
Get the size of the container.
virtual double e() const
The total energy of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Temporary container used until we have I/O for AuxStoreInternal.
Helper to copy an aux store while applying thinning.
void copyAuxStoreThinned(const SG::IConstAuxStore &orig, SG::IAuxStore &copy, const SG::ThinningInfo *info)
Helper to copy an aux store while applying thinning.
@ ethad1
transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated fr...
Definition EgammaEnums.h:43
@ e277
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
Definition EgammaEnums.h:81
@ e237
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x7
Definition EgammaEnums.h:78
@ ethad
ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling::TileGap3.
Definition EgammaEnums.h:46
@ Eratio
(emaxs1-e2tsts1)/(emaxs1+e2tsts1)
@ emaxs1
energy of strip with maximal energy deposit
@ DeltaE
e2tsts1-emins1
@ e233
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x3 (in cell units e...
Definition EgammaEnums.h:69
@ e2tsts1
energy of the cell corresponding to second energy maximum in the first sampling
@ emins1
energy reconstructed in the strip with the minimal value between the first and second maximum
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
DataVector< xAOD::Electron_v1 > ElectronContainer_v1
The container is a simple typedef for now.
ElectronAuxContainer_v3 ElectronAuxContainer
Definition of the current electron auxiliary container.
Electron_v1 Electron
Definition of the current "egamma version".
Extra patterns decribing particle interation process.