10#include <ecl/dataobjects/ECLShower.h>
13#include <analysis/dataobjects/Particle.h>
14#include <analysis/VariableManager/Manager.h>
15#include <framework/core/Module.h>
16#include <framework/datastore/StoreObjPtr.h>
17#include <framework/datastore/StoreArray.h>
18#include <mdst/dataobjects/ECLCluster.h>
31 double getShowerNumberOfCrystalsForEnergy(
const Particle* particle)
33 const ECLCluster* cluster = particle->getECLCluster();
35 auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
36 if (clusterShowerRelations.size() == 1) {
37 return clusterShowerRelations.object(0)->getNumberOfCrystalsForEnergy();
39 B2ERROR(
"Somehow found more than 1 ECLShower matched to the ECLCluster. This should not be possible!");
42 return std::numeric_limits<double>::quiet_NaN();
46 double getShowerNominalNumberOfCrystalsForEnergy(
const Particle* particle)
48 const ECLCluster* cluster = particle->getECLCluster();
50 auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
51 if (clusterShowerRelations.size() == 1) {
52 return clusterShowerRelations.object(0)->getNominalNumberOfCrystalsForEnergy();
54 B2ERROR(
"Somehow found more than 1 ECLShower matched to the ECLCluster. This should not be possible!");
57 return std::numeric_limits<double>::quiet_NaN();
61 double getShowerHadronIntensity(
const Particle* particle)
63 const ECLCluster* cluster = particle->getECLCluster();
65 auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
66 if (clusterShowerRelations.size() == 1) {
67 return clusterShowerRelations.object(0)->getShowerHadronIntensity();
69 B2ERROR(
"Somehow found more than 1 ECLShower matched to the ECLCluster. This should not be possible!");
72 return std::numeric_limits<double>::quiet_NaN();
76 double getShowerNumberOfHadronDigits(
const Particle* particle)
78 const ECLCluster* cluster = particle->getECLCluster();
80 auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
81 if (clusterShowerRelations.size() == 1) {
82 return clusterShowerRelations.object(0)->getNumberOfHadronDigits();
84 B2ERROR(
"Somehow found more than 1 ECLShower matched to the ECLCluster. This should not be possible!");
87 return std::numeric_limits<double>::quiet_NaN();
91 double getAbsZernikeMomentNM(
const Particle* particle,
92 const std::vector<double>& arguments)
94 if (arguments.size() != 2) {
95 B2FATAL(
"Wrong number of arguments, 2 required for meta function absZernikeMoment");
97 const long n = std::lround(arguments[0]);
98 const long m = std::lround(arguments[1]);
100 if ((n < 1) or (n > 5)) {
101 B2FATAL(
"n must be between 1 and 5 for meta function absZernikeMoment");
104 B2FATAL(
"m must be less than or equal to n for meta function absZernikeMoment");
107 const ECLCluster* cluster = particle->getECLCluster();
109 auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
110 if (clusterShowerRelations.size() == 1) {
111 return clusterShowerRelations.object(0)->getAbsZernikeMoment(n, m);
113 B2ERROR(
"Somehow found more than 1 ECLShower matched to the ECLCluster. This should not be possible!");
116 return std::numeric_limits<float>::quiet_NaN();
120 VARIABLE_GROUP(
"ECL Shower Debugging (cDST)");
122 REGISTER_VARIABLE(
"eclShowerNumberOfCrystalsForEnergy", getShowerNumberOfCrystalsForEnergy,
123 "[debugging] Returns the number of crystals ued to calculate the shower energy (optimized to minimize the energy resolution). This should not be confused with the number of crystals contained in the cluster. ");
125 REGISTER_VARIABLE(
"eclShowerNominalNumberOfCrystalsForEnergy", getShowerNominalNumberOfCrystalsForEnergy,
126 "[debugging] Returns the nominal number of crystals ued to calculate the shower energy (optimized to minimize the energy resolution). This should not be confused with the number of crystals contained in the cluster. ");
128 REGISTER_VARIABLE(
"eclShowerHadronIntensity", getShowerHadronIntensity,
129 "[debugging] Returns the hadron intensity of the shower associated with the particle.");
131 REGISTER_VARIABLE(
"eclShowerNumberOfHadronDigits", getShowerNumberOfHadronDigits,
132 "[debugging] Returns the number of hadron digits of the shower associated with the particle.");
134 VARIABLE_GROUP(
"ECL Shower Variables (cDST)");
136 REGISTER_VARIABLE(
"absZernikeMoment(n, m)", getAbsZernikeMomentNM,
137 "[eclChargedPIDExpert] the absolute value of zernike moment nm. Requires n <= 5 and m <= n.");
Abstract base class for different kinds of events.