10#include <ecl/modules/eclTrackCalDigitMatch/ECLTrackCalDigitMatchModule.h>
13#include <ecl/dataobjects/ECLCalDigit.h>
14#include <ecl/dataobjects/ECLElementNumbers.h>
15#include <ecl/geometry/ECLGeometryPar.h>
18#include <analysis/dataobjects/ECLEnergyCloseToTrack.h>
19#include <framework/dataobjects/Helix.h>
20#include <framework/gearbox/Const.h>
21#include <framework/logging/Logger.h>
22#include <mdst/dataobjects/Track.h>
23#include <mdst/dataobjects/TrackFitResult.h>
40 setDescription(
"Find ECLCalDigits closest to a track (this is *not* a track to cluster matcher)");
70 for (
unsigned int i = 0; i < 144; ++i) {
71 const unsigned thetaFWDEndcap = 12;
72 const unsigned thetaFWDBarrel = 13;
83 const unsigned thetaBWDEndcap = 59;
84 const unsigned thetaBWDBarrel = 58;
111 track.addRelationTo(anainfo);
115 auto closestMassFitResult = track.getTrackFitResultWithClosestMass(chargedStable);
116 if (closestMassFitResult ==
nullptr)
continue;
119 const double z0 = closestMassFitResult->getZ0();
120 const double tanlambda = closestMassFitResult->getTanLambda();
123 Helix h = closestMassFitResult->getHelix();
126 const double lHelixRadius = h.getArcLength2DAtCylindricalR(
m_extRadius) > 0 ? h.getArcLength2DAtCylindricalR(
m_extRadius) : 999999.;
129 const double lFWD = (
m_extZFWD - z0) / tanlambda > 0 ? (
m_extZFWD - z0) / tanlambda : 999999.;
132 const double lBWD = (
m_extZBWD - z0) / tanlambda > 0 ? (
m_extZBWD - z0) / tanlambda : 999999.;
135 const double l = std::min(std::min(lHelixRadius, lFWD), lBWD);
137 B2DEBUG(50, lHelixRadius <<
" " << lFWD <<
" " << lBWD <<
" -> " << l);
139 ROOT::Math::XYZVector posHelix = h.getPositionAtArcLength2D(l);
140 const double exttheta = atan2(posHelix.Rho(), posHelix.Z());
141 const double extphi = atan2(posHelix.Y(), posHelix.X());
144 if (!isnan(exttheta)) {
146 double extphitwopi = extphi;
147 if (extphi < 0) extphitwopi = 2.0 * M_PI + extphi;
148 const int phiid = extphitwopi / (2.0 * M_PI / 144);
151 double sum3FWDBarrel = 0.0;
152 double sum3FWDEndcap = 0.0;
153 double sum3BWDBarrel = 0.0;
154 double sum3BWDEndcap = 0.0;
156 for (
int i = 0; i < 3; ++i) {
161 B2DEBUG(50, phiid <<
" " << i <<
" " <<
m_FWD3Barrel[phiid][i] <<
" " << sum3FWDBarrel);
167 B2DEBUG(50, phiid <<
" " << i <<
" " <<
m_FWD3Endcap[phiid][i] <<
" " << sum3FWDEndcap);
173 B2DEBUG(50, phiid <<
" " << i <<
" " <<
m_BWD3Barrel[phiid][i] <<
" " << sum3BWDBarrel);
179 B2DEBUG(50, phiid <<
" " << i <<
" " <<
m_BWD3Endcap[phiid][i] <<
" " << sum3BWDEndcap);
182 anainfo->setEnergy3FWDBarrel(sum3FWDBarrel);
183 anainfo->setEnergy3FWDEndcap(sum3FWDEndcap);
184 anainfo->setEnergy3BWDBarrel(sum3BWDBarrel);
185 anainfo->setEnergy3BWDEndcap(sum3BWDEndcap);
187 anainfo->setExtTheta(exttheta);
188 anainfo->setExtPhi(extphi);
189 anainfo->setExtPhiId(phiid);
Provides a type-safe way to pass members of the chargedStableSet set.
static const ChargedStable electron
electron particle
double m_extZFWD
z position (FWD) to which track is extrapolated
std::map< int, std::vector< int > > m_FWD3Endcap
map between phi id and FWD3 cell ids on the endcap side
double m_angleFWDGap
FWD gap angle [deg].
virtual void initialize() override
initialize
int m_trackHypothesis
Track hypothesis to be used (will use closest one)
StoreArray< ECLEnergyCloseToTrack > m_anaEnergyCloseToTrack
Analysis level information attached to a track.
virtual void event() override
event
std::map< int, std::vector< int > > m_BWD3Barrel
map between phi id and BWD3 cell ids on the barrel side
double m_extZBWD
z position (BWD) to which track is extrapolated
double m_extRadius
radius to which track is extrapolated (using track parameters, not GEANT)
std::map< int, std::vector< int > > m_FWD3Barrel
map between phi id and FWD3 cell ids on the barrel side
StoreArray< Track > m_tracks
Required input array of Tracks.
ECL::ECLGeometryPar * geom
ECL geometry.
double m_angleBWDGap
BWD gap angle [deg].
ECLTrackCalDigitMatchModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::map< int, std::vector< int > > m_BWD3Endcap
map between phi id and BWD3 cell ids on the endcap side
StoreArray< ECLCalDigit > m_eclCalDigits
Required input array of ECLCalDigits
std::vector< int > m_eclCalDigitsArray
eclCalDigits in array
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
int GetCellID(int ThetaId, int PhiId)
Get Cell Id.
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 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.
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.