10#include <ecl/modules/eclClusterProperties/ECLClusterPropertiesModule.h>
13#include <ecl/geometry/ECLGeometryPar.h>
16#include <framework/geometry/VectorUtil.h>
19#include <Math/Vector3D.h>
36 setDescription(
"This module calculates some properties of ECL clusters.");
40 std::string(
"AngularDistance"));
60 unsigned short trackID = std::numeric_limits<unsigned short>::max();
62 shower.setMinTrkDistance(dist);
64 if (cluster !=
nullptr) {
65 cluster->setMinTrkDistance(
float(dist));
66 cluster->setMinTrkDistanceID(trackID);
71 if (cluster->isTrack()) {
74 B2DEBUG(29,
"shower depth: ltrk = " << lTrk <<
" lShower = " << lShower);
75 shower.setTrkDepth(lTrk);
76 shower.setShowerDepth(lShower);
77 cluster->setdeltaL(lTrk);
84 unsigned short& trackID)
const
86 double minDist(10000);
87 ROOT::Math::XYZVector cryCenter;
88 VectorUtil::setMagThetaPhi(
92 for (
const auto& track : tracks) {
93 ROOT::Math::XYZVector trkpos;
94 for (
const auto& extHit : track.getRelationsTo<
ExtHit>()) {
95 if (abs(extHit.getPdgCode()) != pdgCode)
continue;
96 if ((extHit.getDetectorID() != Const::EDetector::ECL))
continue;
97 if (extHit.getCopyID() == -1)
continue;
98 trkpos = extHit.getPosition();
99 double distance = (cryCenter - trkpos).
R();
100 if (distance < minDist) {
101 trackID = track.getArrayIndex();
106 if (minDist > 9999) minDist = -1;
115 ROOT::Math::XYZVector avgDir(0, 0, 0), showerCenter, trkpos, trkdir;
116 VectorUtil::setMagThetaPhi(
120 for (
unsigned int iRel = 0; iRel < relatedDigitsPairs.size(); iRel++) {
121 const auto aECLCalDigit = relatedDigitsPairs.object(iRel);
122 const auto weight = relatedDigitsPairs.weight(iRel);
123 double energy = weight * aECLCalDigit->getEnergy();
124 int cellid = aECLCalDigit->getCellId();
125 ROOT::Math::XYZVector cvec = geometry->GetCrystalVec(cellid - 1);
126 avgDir += energy * cvec;
129 if (cluster ==
nullptr)
return;
130 const Track* selectedTrk =
nullptr;
135 if (fit != 0) cp = fit->getMomentum().R();
137 selectedTrk = &track;
141 if (selectedTrk ==
nullptr)
return;
144 if ((extHit.getDetectorID() != Const::EDetector::ECL))
continue;
145 if (extHit.getStatus() != EXT_ENTER)
continue;
146 if (extHit.getCopyID() == -1)
continue;
147 trkpos = extHit.getPosition();
148 trkdir = extHit.getMomentum().Unit();
153 ROOT::Math::XYZVector w0 = showerCenter - trkpos;
154 double costh = avgDir.Unit().Dot(trkdir);
155 double sin2th = 1 - costh * costh;
156 lShower = costh * w0.Dot(trkdir) - w0.Dot(avgDir.Unit());
159 lTrk = w0.Dot(trkdir) - costh * w0.Dot(avgDir.Unit());
Provides a type-safe way to pass members of the chargedStableSet set.
int getPDGCode() const
PDG code.
static const ChargedStable pion
charged pion particle
Class to store calibrated ECLDigits: ECLCalDigits.
std::string m_trackClusterRelationName
name of relation array between tracks and ECL clusters
StoreArray< ECLShower > m_eclShowers
Required input array of ECLShowers.
virtual void initialize() override
Initialize the required input arrays.
virtual void event() override
Event loop.
void computeDepth(const ECLShower &shower, double &lTrk, double &lShower) const
Computation of depths / distances.
StoreArray< Track > m_tracks
Required input array of Tracks.
virtual ~ECLClusterPropertiesModule()
Destructor.
StoreArray< ECLCluster > m_eclClusters
Required input array of ECLClusters.
double computeTrkMinDistance(const ECLShower &, StoreArray< Track > &, unsigned short &trackID) const
Minimal distance between track and shower.
ECLClusterPropertiesModule()
Constructor: Sets the description, the properties and the parameters of the module.
StoreArray< ExtHit > m_extHits
Required input array of ExtHits.
StoreArray< ECLCalDigit > m_eclCalDigits
Required input array of ECLCalDigits.
Class to store ECL Showers.
double getPhi() const
Get Phi.
double getR() const
Get R.
double getTheta() const
Get Theta.
The Class for ECL Geometry Parameters.
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
Store one Ext hit as a ROOT object.
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...
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
Accessor to arrays stored in the data store.
Values of the result of a track fit with a given particle hypothesis.
Class that bundles various TrackFitResults.
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.
Abstract base class for different kinds of events.