11#include <analysis/modules/TwoBodyISRPhotonCorrector/TwoBodyISRPhotonCorrectorModule.h>
13#include <analysis/dataobjects/Particle.h>
15#include <framework/datastore/StoreArray.h>
16#include <framework/logging/Logger.h>
17#include <framework/gearbox/Const.h>
19#include <analysis/DecayDescriptor/DecayDescriptor.h>
20#include <analysis/DecayDescriptor/DecayDescriptorParticle.h>
21#include <analysis/utility/PCmsLabTransform.h>
22#include <analysis/utility/ParticleCopy.h>
23#include <TDatabasePDG.h>
35 setDescription(
"This module corrects the energy and momentum of high energy ISR photons in single ISR events based on the beam energy, photon direction, and mass of the recoil particle. The corrected photons are stored in a new list, the original photon kinematics can be accessed via the originalParticle() metavariable.");
40 "Name of the massive particle participating in the two body decay with the ISR gamma.");
53 B2ERROR(
"TwoBodyISRPhotonCorrectorModule::event ParticleList " <<
m_outputGammaListName <<
" is not a gamma list");
57 B2ERROR(
"TwoBodyISRPhotonCorrectorModule: cannot copy Particles from " <<
m_inputGammaListName <<
63 B2ERROR(
"TwoBodyISRPhotonCorrectorModule::event ParticleList " <<
m_inputGammaListName <<
" is not a gamma list");
72 " selected for massive particle participating in two body decay. Its mass is " <<
73 massiveParticlePDG->Mass() <<
" GeV/c^2.");
87 B2WARNING(
"TwoBodyISRPhotonCorrectorModule: Output ParticleList " <<
m_outputGammaListName <<
" already exists. Overwriting.");
97 const unsigned int numParticles = inputGammaList->getListSize();
98 for (
unsigned int i = 0; i < numParticles; i++) {
99 ROOT::Math::PxPyPzEVector P4corrected;
102 Particle* iParticle = inputGammaList->getParticle(i);
103 ROOT::Math::PxPyPzEVector P4gamma = iParticle->
get4Vector();
106 ROOT::Math::XYZVector p3gamma_unit((P4gamma.Vect()).Unit());
107 ROOT::Math::XYZVector pbeam(P4beam.Vect());
108 double E_corrected = 0.5 * (P4beam.mag2() - massMassiveParticle * massMassiveParticle) /
109 (P4beam.E() - pbeam.Dot(p3gamma_unit));
110 P4corrected.SetPxPyPzE(p3gamma_unit.X()*E_corrected, p3gamma_unit.Y()*E_corrected,
111 p3gamma_unit.Z()*E_corrected, E_corrected);
122 if (numCopy != numParticles)
124 <<
" has changed while copying the Particles! original size = "
125 << numParticles <<
" vs. new size = " << numCopy);
int getPDGCode() const
PDG code.
static const ParticleType photon
photon particle
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
int getPDGCode() const
Return PDG code.
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
const DecayDescriptorParticle * getMother() const
return mother.
void setDescription(const std::string &description)
Sets the description of the module.
Class to store reconstructed particles.
void setMomentumScalingFactor(double momentumScalingFactor)
Sets momentum scaling.
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
void set4Vector(const ROOT::Math::PxPyPzEVector &p4)
Sets Lorentz vector.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
virtual void initialize() override
Initialises the module.
virtual void event() override
Method called for each event.
std::string m_inputGammaListName
name of input particle list.
StoreObjPtr< ParticleList > m_outputGammaList
output particleList
std::string m_outputGammaListName
name of output particle list.
Int_t m_massiveParticlePDGCode
PDG code of particle constraining the gamma energy.
TwoBodyISRPhotonCorrectorModule()
Constructor.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Particle * copyParticle(const Particle *original)
Function takes argument Particle and creates a copy of it and copies of all its (grand-)^n-daughters.
Abstract base class for different kinds of events.