60 {
61
63
65 bool skipSample = true;
67 if (mcid==eventInfo->mcChannelNumber()) {
68 skipSample = false;
69 break;
70 }
71 }
72 if (skipSample) return StatusCode::SUCCESS;
73 }
74
75
77 ATH_MSG_ERROR(
"Tool is attempting to write a StoreGate key " <<
m_refitpvKey.key() <<
" which already exists. Please use a different key");
78 return StatusCode::FAILURE;
79 }
80
81
83
86 refittedPVContainer->setStore( refittedPVAuxContainer );
87
88 SG::WriteHandle<xAOD::VertexContainer> vertexContainer(
m_refitpvKey, ctx);
89 ATH_CHECK(vertexContainer.recordNonConst(std::unique_ptr< xAOD::VertexContainer >(refittedPVContainer),
90 std::unique_ptr< xAOD::VertexAuxContainer >(refittedPVAuxContainer)));
91
93 for ( const auto *v : *pv_cont ) {
96 break;
97 }
98 }
99 if (!pv) {
100 return StatusCode::SUCCESS;
101 }
103
104
106
107
108 std::vector< std::vector<unsigned int> > eepairs;
110
112
113 for (auto pair : eepairs) {
114 std::vector<const xAOD::TrackParticle*> tps = {
117 };
118
119 TLorentzVector
v0, v1, egamVec;
120 if(
electrons->at(pair[0])->caloCluster())
121 {
122 v0.SetPtEtaPhiM(
electrons->at(pair[0])->e()/cosh(
electrons->at(pair[0])->caloCluster()->etaBE(2)),
123 electrons->at(pair[0])->caloCluster()->etaBE(2),
124 electrons->at(pair[0])->caloCluster()->phiBE(2),
125 0.0);
126 }
127
128 if(
electrons->at(pair[1])->caloCluster())
129 {
130 v1.SetPtEtaPhiM(
electrons->at(pair[1])->e()/cosh(
electrons->at(pair[1])->caloCluster()->etaBE(2)),
131 electrons->at(pair[1])->caloCluster()->etaBE(2),
132 electrons->at(pair[1])->caloCluster()->phiBE(2),
133 0.0);
134 }
135
137
138 ATH_MSG_DEBUG(
"Refitting PV for e tracks: " << tps[0] <<
" " << tps[1]);
140 if (pv_ref) {
142
143 int ipv = 0;
147 if(ipv !=0 ) refittedPVContainer->
push_back(nv);
148 ipv++;
149 }
150
152 {
155
157 float vert_dphi = (fabs(vtxmom.DeltaPhi(egamVec)));
158
162 }
163
164
167
170
171 std::vector<ElementLink<xAOD::TrackParticleContainer> > electronTrackLinks = {
172 electrons->at(pair[0])->trackParticleLink(),
173 electrons->at(pair[1])->trackParticleLink()
174 };
176 } else {
177 ATH_MSG_DEBUG(
"Electrons from pair not used in the refitting ");
178 }
179 }
180 else {
182 }
183 }
184
185 ATH_MSG_DEBUG(
"Vertex container size: " << refittedPVContainer->size());
186
187 return StatusCode::SUCCESS;
188 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void makePrivateStore()
Create a new (empty) private store for this object.
@ IS_SIMULATION
true: simulation, false: data
float z() const
Returns the z position.
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
static const SG::AuxElement::Decorator< float > sumPt2("sumPt2")
static const SG::AuxElement::Decorator< float > vertices_sumPt("vertices_sumPt")
static const SG::AuxElement::Decorator< std::vector< ElementLink< xAOD::TrackParticleContainer > > > electronTrackLinksDecor("ElectronTrackLinks")
static const SG::AuxElement::Decorator< float > vertices_sumPt2("vertices_sumPt2")
static const SG::AuxElement::Decorator< float > vertices_dPhi("vertices_dPhi")
const xAOD::TrackParticle * getOriginalTrackParticle(const xAOD::Electron *el)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron.
float getVertexSumPt(const xAOD::Vertex *vertex, int power=1, bool useAux=true)
Loop over track particles associated with vertex and return scalar sum of pT^power in GeV (from auxda...
TLorentzVector getVertexMomentum(const xAOD::Vertex *vertex, bool useAux=true, const std::string &derivationPrefix="")
Return vector sum of tracks associated with vertex (from auxdata if available and useAux = true)
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.