10#include <analysis/dataobjects/ParticleList.h>
12#include <mdst/dataobjects/ECLCluster.h>
13#include <tracking/dataobjects/RecoTrack.h>
15#include <analysis/utility/PCmsLabTransform.h>
16#include <analysis/ClusterUtility/ClusterUtils.h>
23 namespace SoftwareTrigger {
26 inline ROOT::Math::PxPyPzEVector
getFourVector(
const T& item);
30 inline ROOT::Math::PxPyPzEVector
getFourVector(
const std::reference_wrapper<const ECLCluster>& cluster)
34 return ROOT::Math::PxPyPzEVector(v.Px(), v.Py(), v.Pz(), v.E());
39 inline ROOT::Math::PxPyPzEVector
getFourVector(
const RecoTrack& track)
41 const ROOT::Math::XYZVector& positionSeed = track.getPositionSeed();
42 return ROOT::Math::PxPyPzEVector(positionSeed.X(), positionSeed.Y(), positionSeed.Z(),
47 template<
class AnEntityType>
48 inline const AnEntityType* getElementFromParticle(
const Particle& particle);
52 inline const Particle* getElementFromParticle(
const Particle& particle)
59 inline const ECLCluster* getElementFromParticle(
const Particle& particle)
61 return particle.getECLCluster();
65 inline double BeamEnergyCMS()
68 return T.getCMSEnergy() / 2.0;
72 template<
class AnEntity>
73 inline double getRho(
const AnEntity* entity)
79 const ROOT::Math::PxPyPzEVector& fourVector = entity->get4Vector();
85 inline double getRho(
const ECLCluster* entity)
99 template<
class AReturnType>
100 static const AReturnType* getElementWithMaximumRhoBelow(
const StoreObjPtr<ParticleList>& particles,
101 const double belowLimit)
103 const AReturnType* elementMaximumRho =
nullptr;
104 double maximumRho = -1.;
105 for (
const Particle& currentParticle : *particles) {
106 const auto currentElement = getElementFromParticle<AReturnType>(currentParticle);
107 const double& currentRho = getRho(currentElement);
108 if (currentRho >= belowLimit) {
111 if (currentRho > maximumRho) {
112 maximumRho = currentRho;
113 elementMaximumRho = currentElement;
116 return elementMaximumRho;
120 template<
class AReturnType>
121 inline const AReturnType* getElementWithMaximumRho(
const StoreObjPtr<ParticleList>& particles)
123 return getElementWithMaximumRhoBelow<AReturnType>(particles, std::nan(
""));
126 extern double getRhoOfECLClusterWithMaximumRhoBelow(
const StoreObjPtr<ParticleList>& pions,
127 const StoreObjPtr<ParticleList>& gammas,
128 const double belowLimit);
131 inline double getRhoOfECLClusterWithMaximumRho(
const StoreObjPtr<ParticleList>& pionshlt,
132 const StoreObjPtr<ParticleList>& gammahlt)
134 return getRhoOfECLClusterWithMaximumRhoBelow(pionshlt, gammahlt, std::nan(
""));
static const double pionMass
charged pion mass
@ c_nPhotons
CR is split into n photons (N1)
GeneralVector< T > getFourVector(T energy, T angleX, T angleY, bool isHER)
get 4-momentum from energy and angles of beam
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.