50 #include "TClonesArray.h"
52 #include "TObjString.h"
55 #include "reportingUtils.hpp"
56 #include "reportingUtilsRoot.hpp"
64 bool leptoProductionVertex::_debug =
false;
67 leptoProductionVertex::leptoProductionVertex(
const particlePtr& beamLepton,
73 _beamLeptonMomCache (),
74 _scatteredLeptonMomCache(),
79 printErr <<
"null pointer to beam lepton particle. aborting." << endl;
83 printErr <<
"null pointer to target particle. aborting." << endl;
87 printErr <<
"null pointer to particle representing X system. aborting." << endl;
96 printWarn <<
"recoil not specified. assuming elastic scattering." << endl;
101 printDebug <<
"constructed " << *
this << endl;
131 const bool cloneOutParticles)
const
134 if (cloneInParticles)
136 if (cloneOutParticles)
139 printDebug <<
"cloned " << *
this <<
"; " <<
this <<
" -> " << vertexClone <<
" "
141 << ((
cloneOutParticles) ?
"in" :
"ex") <<
"cluding outgoing particles" << std::endl;
150 printWarn <<
"cannot add incoming particle to " << *
this << endl;
159 printWarn <<
"cannot add outgoing particle to " << *
this << endl;
169 TVector3 k1, k2,
q, v;
172 const TLorentzVector targetLv =
target()->lzVec();
173 if (targetLv.Vect() == TVector3(0, 0, 0)) {
188 TLorentzVector beamLeptonLv =
beamLepton()->lzVec();
190 TLorentzVector virtPhotonLv =
virtPhoton()->lzVec();
191 TLorentzVector XParticleLv =
XParticle()->lzVec();
192 const TLorentzVector photonTargetCM = virtPhotonLv + targetLv;
193 const TVector3 cmBoost = photonTargetCM.BoostVector();
194 beamLeptonLv.Boost(cmBoost);
195 scatteredLeptonLv.Boost(cmBoost);
196 virtPhotonLv.Boost(cmBoost);
197 XParticleLv.Boost(cmBoost);
198 k1 = beamLeptonLv.Vect();
199 k2 = scatteredLeptonLv.Vect();
200 q = virtPhotonLv.Vect();
201 v = XParticleLv.Vect();
204 const TVector3 leptonPlaneNormal = k1.Cross(k2);
205 const TVector3 productionPlaneNormal = q.Cross(v);
206 const double parProjection = leptonPlaneNormal.Dot(productionPlaneNormal);
207 const double perpProjection = leptonPlaneNormal.Cross(productionPlaneNormal).Mag();
208 const double phi = atan2(perpProjection, parProjection);
213 printInfo <<
"phi = " << phi <<
", epsilon = " << maxPrecision(epsilon) <<
", "
214 <<
"delta = " << maxPrecision(delta) <<
", pol = " <<
_longPol << endl;
216 const double xi = sqrt(epsilon * (1 + epsilon + 2 * delta));
217 const double zeta = sqrt(xi * (1 - epsilon) / (1 + epsilon));
218 const double term =
_longPol * sqrt(1 - epsilon * epsilon);
219 const complex<double> phase = exp(complex<double>(0, phi));
220 printInfo <<
"xi = " << xi <<
", zeta = " << zeta <<
", term = " << term << endl;
227 complex<double>
rho[3][3];
229 rho[0][0] = 1 + term;
230 rho[1][0] = (
_longPol * zeta + xi) * phase;
231 rho[2][0] = -epsilon * exp(complex<double>(0, 2 * phi));
233 rho[1][1] = 2 * (epsilon +
delta);
234 rho[2][1] = (
_longPol * zeta - xi) * phase;
236 rho[2][2] = 1 - term;
238 rho[0][1] =
conj(rho[1][0]);
239 rho[0][2] =
conj(rho[2][0]);
240 rho[1][2] =
conj(rho[2][1]);
241 for (
unsigned int j = 0; j < 3; ++j)
242 for (
unsigned int i = 0;
i < 3; ++
i)
243 printInfo <<
"rho[" <<
i <<
"][" << j <<
"] = " << maxPrecisionDouble(rho[
i][j]) << endl;
244 const complex<double> detRho = rho[0][0] * rho[1][1] * rho[2][2]
245 + rho[0][1] * rho[1][2] * rho[2][0]
246 + rho[1][0] * rho[2][1] * rho[0][2]
247 - rho[0][2] * rho[1][1] * rho[2][0]
248 - rho[1][2] * rho[0][0] * rho[2][1]
249 - rho[0][1] * rho[2][2] * rho[1][0];
250 printInfo <<
"det[rho] = " << detRho <<
" vs. "
258 complex<double> V[3][3];
260 V[0][0] = sqrt(real(rho[0][0]));
261 V[1][0] = rho[1][0] / real(V[0][0]);
262 V[2][0] = rho[2][0] / real(V[0][0]);
264 V[1][1] = sqrt(real(rho[1][1]) - norm(V[1][0]));
265 V[2][1] = (rho[2][1] - V[2][0] *
conj(V[1][0])) / real(V[1][1]);
267 V[2][2] = sqrt(real(rho[2][2]) - norm(V[2][1]) - norm(V[2][0]));
272 printInfo <<
"V[2][2]^2 = " << real(rho[2][2]) - norm(V[2][1]) - norm(V[2][0]) <<
": "
273 << real(rho[2][2]) <<
" - " << norm(V[2][1]) <<
" - " << norm(V[2][0]) << endl;
274 for (
unsigned int j = 0; j < 3; ++j)
275 for (
unsigned int i = 0;
i < 3; ++
i)
276 printInfo <<
"V[" <<
i <<
"][" << j <<
"] = " << maxPrecisionDouble(V[
i][j]) << endl;
278 for (
unsigned int j = 0; j < 3; ++j)
279 for (
unsigned int i = 0;
i < 3; ++
i) {
281 for (
unsigned int r = 0; r < 3; ++r)
282 rhoPrime[
i][j] += V[
i][r] *
conj(V[j][r]);
284 for (
unsigned int j = 0; j < 3; ++j)
285 for (
unsigned int i = 0;
i < 3; ++
i)
286 printInfo <<
"deltaRho[" <<
i <<
"][" << j <<
"] = "
287 << maxPrecisionDouble(rho[
i][j] - rhoPrime[
i][j]) << endl;
291 complex<double> prodAmp = 0;
299 const double Q2 = this->
Q2();
300 const double xBj = this->
xBj();
301 const double xBj2 = xBj *
xBj;
302 const double y = this->
y();
303 const double y2 = y *
y;
308 const double term1 =
beamLepton()->mass2() * y2 * gamma2 /
Q2;
309 const double term2 = 1 / ((1 -
y) * (1 - y));
310 const double u0 = sqrt(1 - term1 * (1 + term2) + term1 * term1 * term2);
311 const double E1E2 = Q2 * (1 -
y) / (y2 * gamma2);
312 const double Q2Min = 2 * (E1E2 * (1 - u0) -
beamLepton()->mass2());
313 const double k1k2 = E1E2 * u0;
314 const double sin2ThetaHalf = (Q2 - Q2Min) / (4 * k1k2);
315 const double tan2ThetaHalf = sin2ThetaHalf / (1 - sin2ThetaHalf);
316 const double term3 = 1 - Q2Min /
Q2;
317 const double oneOverEpsilon = 1 + 2 * (1 + 1 /
gamma2) * tan2ThetaHalf / (term3 * term3);
318 return 1 / oneOverEpsilon;
354 const string partClassName = prodKinPartNames.GetClass()->GetName();
355 if (partClassName !=
"TObjString") {
356 printWarn <<
"production kinematics particle names are of type '" << partClassName
357 <<
"' and not TObjString." << endl;
362 printWarn <<
"array of production kinematics particle names has wrong size: "
364 <<
"scattered lepton (index 1); "
365 <<
"recoil (index 2) target (index 3) are optional." << endl;
371 const string beamLeptonName = ((TObjString*)prodKinPartNames[0])->GetString().Data();
373 printWarn <<
"wrong particle at index 0 in production kinematics input data: "
374 <<
"read '" << beamLeptonName <<
"', "
375 <<
"expected beam lepton '" <<
beamLepton()->name() <<
"'" << endl;
380 const string scatteredLeptonName = ((TObjString*)prodKinPartNames[1])->GetString().Data();
382 printWarn <<
"wrong particle at index 1 in production kinematics input data: "
383 <<
"read '" << scatteredLeptonName <<
"', "
384 <<
"expected scattered lepton '" <<
scatteredLepton()->name() <<
"'" << endl;
390 const string recoilName = ((TObjString*)prodKinPartNames[2])->GetString().Data();
392 printWarn <<
"wrong particle at index 2 in production kinematics input data: "
393 <<
"read '" << recoilName <<
"', "
394 <<
"expected recoil particle '" <<
recoil()->name() <<
"'" << endl;
401 const string targetName = ((TObjString*)prodKinPartNames[3])->GetString().Data();
403 printWarn <<
"wrong particle at index 3 in production kinematics input data: "
404 <<
"read '" << targetName <<
"', "
405 <<
"expected target particle '" <<
target()->name() <<
"'" << endl;
423 const int nmbProdKinMom = prodKinMomenta.GetEntriesFast();
425 printWarn <<
"array of production kinematics particle momenta has wrong size: "
427 <<
"cannot read production kinematics." << endl;
433 TVector3* beamLeptonMom =
dynamic_cast<TVector3*
>(prodKinMomenta[0]);
436 printDebug <<
"setting momentum of beam lepton '" <<
beamLepton()->name()
437 <<
"' to " << *beamLeptonMom <<
" GeV" << endl;
441 printWarn <<
"production kinematics data entry [0] is not of type TVector3. "
442 <<
"cannot read beam lepton momentum." << endl;
447 TVector3* scatteredLeptonMom =
dynamic_cast<TVector3*
>(prodKinMomenta[1]);
448 if (scatteredLeptonMom) {
450 printDebug <<
"setting momentum of scattered lepton '" <<
beamLepton()->name()
451 <<
"' to " << *beamLeptonMom <<
" GeV" << endl;
455 printWarn <<
"production kinematics data entry [1] is not of type TVector3. "
456 <<
"cannot read scattered lepton momentum." << endl;
463 TVector3* recoilMom =
dynamic_cast<TVector3*
>(prodKinMomenta[2]);
466 printDebug <<
"setting momentum of recoil particle '" <<
recoil()->name()
467 <<
"' to " << *recoilMom <<
" GeV" << endl;
468 recoil()->setMomentum(*recoilMom);
471 printWarn <<
"production kinematics data entry [2] is not of type TVector3. "
472 <<
"cannot read recoil particle momentum." << endl;
479 TVector3* targetMom =
dynamic_cast<TVector3*
>(prodKinMomenta[3]);
482 printDebug <<
"setting momentum of target particle '" <<
target()->name()
483 <<
"' to " << *targetMom <<
" GeV" << endl;
484 target()->setMomentum(*targetMom);
487 printWarn <<
"production kinematics data entry [3] is not of type TVector3. "
488 <<
"cannot read target particle momentum." << endl;
503 printDebug <<
"resetting beam lepton momentum to " <<
_beamLeptonMomCache <<
" GeV" << endl
504 <<
" resetting scattered lepton momentum to "
506 <<
" resetting recoil momentum to " <<
_recoilMomCache <<
" GeV" << endl
507 <<
" resetting target momentum to " <<
_targetMomCache <<
" GeV" << endl;
522 out <<
name() <<
": "
525 <<
" + target " <<
target()->qnSummary() <<
" ---> "
534 out <<
name() <<
": " << endl
535 <<
" beam lepton ........ " << *
beamLepton() << endl
536 <<
" target ............. " << *
target() << endl
537 <<
" virtual photon ..... " << *
virtPhoton() << endl
539 <<
" X .................. " << *
XParticle() << endl
540 <<
" recoil ............. " << *
recoil() << endl;
548 out <<
name() <<
" " <<
this <<
": "
550 <<
"target particle = " <<
target() <<
"; "
551 <<
"virtual photon = " <<
virtPhoton() <<
"; "
553 <<
"X particle = " <<
XParticle() <<
"; "
554 <<
"recoil particle = " <<
recoil() << endl;