29 float clusterEta = theFourVector.Eta();
31 const static SG::AuxElement::ConstAccessor<float> accCenterMag(
"CENTER_MAG");
32 float centerMag = accCenterMag(fe);
34 float radius = centerMag/cosh(clusterEta);
36 float EtaVertexCorrection = 0.0, PhiVertexCorrection = 0.0;
37 float clusterPhi = theFourVector.Phi();
39 if (radius > 1.0 && centerMag > 1e-3){
40 EtaVertexCorrection = (-vertexToCorrectTo.Z()/cosh(clusterEta) + (vertexToCorrectTo.X()*cos(clusterPhi) + vertexToCorrectTo.Y()*sin(clusterPhi))*tanh(clusterEta))/radius;
41 PhiVertexCorrection = (vertexToCorrectTo.X()*sin(clusterPhi) - vertexToCorrectTo.Y()*cos(clusterPhi))/radius;
44 float etaVertexCorrected = clusterEta + EtaVertexCorrection;
45 float p = std::sqrt(theFourVector.E()*theFourVector.E()-theFourVector.M()*theFourVector.M());
46 float ptVertexCorrected = p/cosh(etaVertexCorrected);
47 theFourVector.SetPtEtaPhiM(ptVertexCorrected, etaVertexCorrected, clusterPhi + PhiVertexCorrection, theFourVector.M());
80 const static SG::AuxElement::ConstAccessor< std::vector<float> > accEPerSampling(
"ePerSampling");
81 if(accEPerSampling.isAvailable(fe))
return accEPerSampling(fe);
84 const static SG::AuxElement::ConstAccessor<float> accPreSamplerB(
"LAYERENERGY_PreSamplerB");
85 const static SG::AuxElement::ConstAccessor<float> accEMB1(
"LAYERENERGY_EMB1");
86 const static SG::AuxElement::ConstAccessor<float> accEMB2(
"LAYERENERGY_EMB2");
87 const static SG::AuxElement::ConstAccessor<float> accEMB3(
"LAYERENERGY_EMB3");
88 const static SG::AuxElement::ConstAccessor<float> accPreSamplerE(
"LAYERENERGY_PreSamplerE");
89 const static SG::AuxElement::ConstAccessor<float> accEME1(
"LAYERENERGY_EME1");
90 const static SG::AuxElement::ConstAccessor<float> accEME2(
"LAYERENERGY_EME2");
91 const static SG::AuxElement::ConstAccessor<float> accEME3(
"LAYERENERGY_EME3");
92 const static SG::AuxElement::ConstAccessor<float> accHEC0(
"LAYERENERGY_HEC0");
93 const static SG::AuxElement::ConstAccessor<float> accHEC1(
"LAYERENERGY_HEC1");
94 const static SG::AuxElement::ConstAccessor<float> accHEC2(
"LAYERENERGY_HEC2");
95 const static SG::AuxElement::ConstAccessor<float> accHEC3(
"LAYERENERGY_HEC3");
96 const static SG::AuxElement::ConstAccessor<float> accTileBar0(
"LAYERENERGY_TileBar0");
97 const static SG::AuxElement::ConstAccessor<float> accTileBar1(
"LAYERENERGY_TileBar1");
98 const static SG::AuxElement::ConstAccessor<float> accTileBar2(
"LAYERENERGY_TileBar2");
99 const static SG::AuxElement::ConstAccessor<float> accTileGap1(
"LAYERENERGY_TileGap1");
100 const static SG::AuxElement::ConstAccessor<float> accTileGap2(
"LAYERENERGY_TileGap2");
101 const static SG::AuxElement::ConstAccessor<float> accTileGap3(
"LAYERENERGY_TileGap3");
102 const static SG::AuxElement::ConstAccessor<float> accTileExt0(
"LAYERENERGY_TileExt0");
103 const static SG::AuxElement::ConstAccessor<float> accTileExt1(
"LAYERENERGY_TileExt1");
104 const static SG::AuxElement::ConstAccessor<float> accTileExt2(
"LAYERENERGY_TileExt2");
105 const static SG::AuxElement::ConstAccessor<float> accFCAL0(
"LAYERENERGY_FCAL0");
106 const static SG::AuxElement::ConstAccessor<float> accFCAL1(
"LAYERENERGY_FCAL1");
107 const static SG::AuxElement::ConstAccessor<float> accFCAL2(
"LAYERENERGY_FCAL2");
108 const static SG::AuxElement::ConstAccessor<float> accMINIFCAL0(
"LAYERENERGY_MINIFCAL0");
109 const static SG::AuxElement::ConstAccessor<float> accMINIFCAL1(
"LAYERENERGY_MINIFCAL1");
110 const static SG::AuxElement::ConstAccessor<float> accMINIFCAL2(
"LAYERENERGY_MINIFCAL2");
111 const static SG::AuxElement::ConstAccessor<float> accMINIFCAL3(
"LAYERENERGY_MINIFCAL3");
114 std::vector<float> result(28, 0);
115 result[0] = accPreSamplerB(fe);
116 result[1] = accEMB1(fe);
117 result[2] = accEMB2(fe);
118 result[3] = accEMB3(fe);
119 result[4] = accPreSamplerE(fe);
120 result[5] = accEME1(fe);
121 result[6] = accEME2(fe);
122 result[7] = accEME3(fe);
123 result[8] = accHEC0(fe);
124 result[9] = accHEC1(fe);
125 result[10] = accHEC2(fe);
126 result[11] = accHEC3(fe);
127 result[12] = accTileBar0(fe);
128 result[13] = accTileBar1(fe);
129 result[14] = accTileBar2(fe);
130 result[15] = accTileGap1(fe);
131 result[16] = accTileGap2(fe);
132 result[17] = accTileGap3(fe);
133 result[18] = accTileExt0(fe);
134 result[19] = accTileExt1(fe);
135 result[20] = accTileExt2(fe);
136 result[21] = accFCAL0(fe);
137 result[22] = accFCAL1(fe);
138 result[23] = accFCAL2(fe);
139 result[24] = accMINIFCAL0(fe);
140 result[25] = accMINIFCAL1(fe);
141 result[26] = accMINIFCAL2(fe);
142 result[27] = accMINIFCAL3(fe);
248 static const std::array< std::pair<xAOD::CaloCluster::CaloSample, const SG::AuxElement::Accessor<float>>, 28> samplingAttributePairs{{
249 {xAOD::CaloCluster::CaloSample::PreSamplerB,SG::AuxElement::Accessor<float>(
"LAYERENERGY_PreSamplerB")},
250 {xAOD::CaloCluster::CaloSample::EMB1,SG::AuxElement::Accessor<float>(
"LAYERENERGY_EMB1")},
251 {xAOD::CaloCluster::CaloSample::EMB2,SG::AuxElement::Accessor<float>(
"LAYERENERGY_EMB2")},
252 {xAOD::CaloCluster::CaloSample::EMB3,SG::AuxElement::Accessor<float>(
"LAYERENERGY_EMB3")},
253 {xAOD::CaloCluster::CaloSample::PreSamplerE,SG::AuxElement::Accessor<float>(
"LAYERENERGY_PreSamplerE")},
254 {xAOD::CaloCluster::CaloSample::EME1,SG::AuxElement::Accessor<float>(
"LAYERENERGY_EME1")},
255 {xAOD::CaloCluster::CaloSample::EME2,SG::AuxElement::Accessor<float>(
"LAYERENERGY_EME2")},
256 {xAOD::CaloCluster::CaloSample::EME3,SG::AuxElement::Accessor<float>(
"LAYERENERGY_EME3")},
257 {xAOD::CaloCluster::CaloSample::HEC0,SG::AuxElement::Accessor<float>(
"LAYERENERGY_HEC0")},
258 {xAOD::CaloCluster::CaloSample::HEC1,SG::AuxElement::Accessor<float>(
"LAYERENERGY_HEC1")},
259 {xAOD::CaloCluster::CaloSample::HEC2,SG::AuxElement::Accessor<float>(
"LAYERENERGY_HEC2")},
260 {xAOD::CaloCluster::CaloSample::HEC3,SG::AuxElement::Accessor<float>(
"LAYERENERGY_HEC3")},
261 {xAOD::CaloCluster::CaloSample::TileBar0,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileBar0")},
262 {xAOD::CaloCluster::CaloSample::TileBar1,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileBar1")},
263 {xAOD::CaloCluster::CaloSample::TileBar2,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileBar2")},
264 {xAOD::CaloCluster::CaloSample::TileGap1,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileGap1")},
265 {xAOD::CaloCluster::CaloSample::TileGap2,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileGap2")},
266 {xAOD::CaloCluster::CaloSample::TileGap3,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileGap3")},
267 {xAOD::CaloCluster::CaloSample::TileExt0,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileExt0")},
268 {xAOD::CaloCluster::CaloSample::TileExt1,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileExt1")},
269 {xAOD::CaloCluster::CaloSample::TileExt2,SG::AuxElement::Accessor<float>(
"LAYERENERGY_TileExt2")},
270 {xAOD::CaloCluster::CaloSample::FCAL0,SG::AuxElement::Accessor<float>(
"LAYERENERGY_FCAL0")},
271 {xAOD::CaloCluster::CaloSample::FCAL1,SG::AuxElement::Accessor<float>(
"LAYERENERGY_FCAL1")},
272 {xAOD::CaloCluster::CaloSample::FCAL2,SG::AuxElement::Accessor<float>(
"LAYERENERGY_FCAL2")},
273 {xAOD::CaloCluster::CaloSample::MINIFCAL0,SG::AuxElement::Accessor<float>(
"LAYERENERGY_MINIFCAL0")},
274 {xAOD::CaloCluster::CaloSample::MINIFCAL1,SG::AuxElement::Accessor<float>(
"LAYERENERGY_MINIFCAL1")},
275 {xAOD::CaloCluster::CaloSample::MINIFCAL2,SG::AuxElement::Accessor<float>(
"LAYERENERGY_MINIFCAL2")},
276 {xAOD::CaloCluster::CaloSample::MINIFCAL3,SG::AuxElement::Accessor<float>(
"LAYERENERGY_MINIFCAL3")},
279 for (
const auto & [sampling,attribute]:samplingAttributePairs) {
280 attribute(theFE) = theCluster.
eSample(sampling);