9#include <analysis/utility/PCmsLabTransform.h>
11#include <analysis/modules/EventShapeCalculator/EventShapeCalculatorModule.h>
13#include <analysis/dataobjects/ParticleList.h>
14#include <analysis/dataobjects/Particle.h>
15#include <mdst/dataobjects/MCParticle.h>
17#include <framework/logging/Logger.h>
21#include <analysis/ContinuumSuppression/Thrust.h>
22#include <analysis/ContinuumSuppression/HarmonicMoments.h>
23#include <analysis/ContinuumSuppression/CleoCones.h>
24#include <analysis/ContinuumSuppression/FoxWolfram.h>
25#include <analysis/ContinuumSuppression/SphericityEigenvalues.h>
27#include <Math/Vector4D.h>
45 setDescription(
"Module to compute event shape attributes starting from particlelists. The core algorithms are not implemented in this module, but in dedicated basf2 classes.");
53 addParam(
"enableFoxWolfram",
m_enableFW,
"Enables the calculation of the Fox-Wolfram moments.",
true);
55 addParam(
"enableJets",
m_enableJets,
"Enables the calculation of jet-related quantities.",
true);
60 "Enables the check for duplicates in the input list. If a duplicate entry is found, the first one is kept.",
false);
79 if (nPart == 0)
return;
88 for (
short i = 0; i < 9; i++) {
93 for (
short i = 0; i < 5; i++) {
107 B2WARNING(
"Eigenvalues not ordered!!!!!!!!!!");
109 for (
short i = 0; i < 3; i++) {
121 float thrustVal = thrust.R();
122 thrust = thrust.Unit();
131 for (
short i = 0; i < 9; i++) {
137 for (
short i = 0; i < 5; i++) {
153 std::vector<float> cones;
154 cones = cleoCones.cleo_cone_with_all();
155 for (
short i = 0; i < 10; i++) {
163 ROOT::Math::PxPyPzEVector p4FWD;
164 ROOT::Math::PxPyPzEVector p4BKW;
166 if (p4.Vect().Dot(thrust) > 0)
183 ROOT::Math::XYZVector collisionAxis(0., 0., 1.);
188 std::vector<float> cones;
189 cones = cleoCones.cleo_cone_with_all();
190 for (
short i = 0; i < 10; i++) {
200 for (
short i = 0; i < 9; i++) {
206 for (
short i = 0; i < 5; i++) {
223 unsigned int nParticlesInAllLists = 0;
224 unsigned short nParticleLists = particleListNames.size();
225 if (nParticleLists == 0)
226 B2WARNING(
"No particle lists found. EventShape calculation not performed.");
232 std::vector<int> usedMdstSources;
235 for (
unsigned short iList = 0; iList < nParticleLists; iList++) {
236 string particleListName = particleListNames[iList];
240 nParticlesInAllLists += particleList->getListSize();
242 for (
unsigned int iPart = 0; iPart < particleList->getListSize(); iPart++) {
243 const Particle* part = particleList->getParticle(iPart);
245 if (mcParticle and mcParticle->
isInitial())
continue;
249 bool isDuplicate =
false;
254 auto result = std::find(usedMdstSources.begin(), usedMdstSources.end(), mdstSource);
255 if (result == usedMdstSources.end()) {
256 usedMdstSources.push_back(mdstSource);
258 B2WARNING(
"Duplicate particle found. The new one won't be used for the calculation of the event shape variables. "
259 "Please, double check your input lists and try to make them mutually exclusive.");
274 return nParticlesInAllLists;
Class to calculate the Cleo clone variables.
int parseParticleLists(std::vector< std::string >)
Turns the ParticleLists provided as inputs in std::vectors of PxPyPzEVector and B2Vector3D,...
bool m_enableCollisionAxis
Enables the calculation of the quantities related to the collision axis.
virtual void initialize() override
Define the physical parameters.
std::vector< ROOT::Math::XYZVector > m_p3List
vector containing all the 3-momenta of the particles contained in the input lists.
virtual void event() override
Main method, called for each events.
bool m_enableHarmonicMoments
Enables the calculation of the Harmonic moments.
std::vector< std::string > m_particleListNames
Names of the ParticleLists (inputs).
bool m_enableAllMoments
Enables the calculation of the FW moments from 5 to 8.
bool m_enableThrust
Enables the calculation of thust-related quantities.
bool m_enableCleoCones
Enables the calculation of the Cleo Cones.
bool m_enableJets
Enables the calculation of the Jet-related quantities.
std::vector< ROOT::Math::PxPyPzEVector > m_p4List
vector containing all the 4-momenta of the particles contained in the input lists.
bool m_enableFW
Enables the calculation of the FW moments.
bool m_checkForDuplicates
Enables the check for the duplicates in the input list.
EventShapeCalculatorModule()
Constructor: Sets the description, the properties and the parameters of the module.
StoreObjPtr< EventShapeContainer > m_eventShapeContainer
event shape container object pointer
bool m_enableSphericity
Enables the calculation of the Sphericity matrix.
Class to calculate the Fox-Wolfram moments up to order 8.
void calculateAllMoments()
Method to perform the calculation of the moments up to order 8.
void calculateBasicMoments()
Method to perform the calculation of the moments up to order 4, which are the most relevant ones.
double getH(int i) const
Returns the i-th moment.
Class to calculate the Harmonic moments up to order 8 with respect to a given axis.
void calculateAllMoments()
Calculates the moments up to order 8.
double getMoment(short i, double sqrts) const
Returns the moment of order i.
void calculateBasicMoments()
Calculates the moments up to order 4.
A Class to store the Monte Carlo particle information.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Class to store reconstructed particles.
const MCParticle * getMCParticle() const
Returns the pointer to the MCParticle object that was used to create this Particle (ParticleType == c...
int getMdstSource() const
Returns unique identifier of final state particle (needed in particle combiner)
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
Class to calculate the Sphericity tensor eigenvalues and eigenvectors starting from an array of 3-mom...
void calculateEigenvalues()
Calculates eigenvalues and eigenvectors.
ROOT::Math::XYZVector getEigenvector(short i) const
Returns the i-th Eigenvector.
double getEigenvalue(short i) const
Returns the i-th Eigenvalue.
Type-safe access to single objects in the data store.
static ROOT::Math::XYZVector calculateThrust(const std::vector< ROOT::Math::XYZVector > &momenta)
calculates the thrust axis
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.
bool isInitial() const
Check if particle is an initial particle such as ISR.
Abstract base class for different kinds of events.