8#include <tracking/ckf/cdc/findlets/CDCCKFEclSeedCreator.h>
10#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
12#include <tracking/dataobjects/RecoTrack.h>
13#include <tracking/ckf/cdc/entities/CDCCKFState.h>
15#include <framework/core/ModuleParamList.h>
17#include <framework/gearbox/Const.h>
18#include <framework/geometry/VectorUtil.h>
29 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"inputECLshowersStoreArrayName"),
31 "StoreArray name of the input Shower Store Array.");
33 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"eclSeedRecoTrackStoreArrayName"),
35 "StoreArray name of the output Track Store Array.");
37 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"minimalEnRequirementCluster"),
39 "Minimal energy requirement for the input clusters",
42 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"restrictToForwardSeeds"),
44 "Don't do Ecl seeding in central region to save computing time",
47 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"tanLambdaForwardNeg"),
49 "Up to which (neg) tanLambda value should the seeding be performed",
52 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"tanLambdaForwardPos"),
54 "Up to which (pos) tanLambda value should the seeding be performed",
57 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"showerDepth"),
59 "Don't do Ecl seeding in central region to save computing time",
83 const double Eclus = shower.getEnergy();
89 const double thetaClus = shower.getTheta();
90 const double phiClus = shower.getPhi();
91 const double rClus = shower.getR();
93 const double sinTheta = sin(thetaClus);
94 const double cosTheta = cos(thetaClus);
95 const double sinPhi = sin(phiClus);
96 const double cosPhi = cos(phiClus);
98 ROOT::Math::XYZVector pos(rClus * sinTheta * cosPhi, rClus * sinTheta * sinPhi, rClus * cosTheta);
99 const double tanLambda = pos.Z() / pos.Rho();
111 ROOT::Math::XYZVector mom = Eclus / pos.R() * pos;
119 if (2. * rad < pos.Rho()) {
120 rad = pos.Rho() / 2.0 + 1.0;
124 double q = pos.Rho();
125 double y3 = pos.Y() / 2.0;
126 double x3 = pos.X() / 2.0;
128 double basex =
sqrt(rad * rad - q * q / 4.0) * (-pos.Y()) / q;
129 double basey =
sqrt(rad * rad - q * q / 4.0) * pos.X() / q;
131 double centerx1 = x3 + basex;
132 double centery1 = y3 + basey;
133 double centerx2 = x3 - basex;
134 double centery2 = y3 - basey;
137 double momx1 = pos.Y() - centery1;
138 double momy1 = - (pos.X() - centerx1);
139 double momx2 = pos.Y() - centery2;
140 double momy2 = - (pos.X() - centerx2);
144 if (momx1 * pos.X() + momy1 * pos.Y() < 0) {
148 if (momx2 * pos.X() + momy2 * pos.Y() < 0) {
154 double mom1abs =
sqrt(momx1 * momx1 + momy1 * momy1);
155 double mom2abs =
sqrt(momx2 * momx2 + momy2 * momy2);
156 momx1 = momx1 / mom1abs;
157 momy1 = momy1 / mom1abs;
158 momx2 = momx2 / mom2abs;
159 momy2 = momy2 / mom2abs;
161 ROOT::Math::XYZVector mom1(momx1 * mom.Rho(), momy1 * mom.Rho(), mom.Z());
162 ROOT::Math::XYZVector mom2(momx2 * mom.Rho(), momy2 * mom.Rho(), mom.Z());
166 bool clockwise1 =
true;
167 bool clockwise2 =
true;
168 if (pos.Y() * mom1.X() - pos.X() * mom1.Y() > 0) {
171 if (pos.Y() * mom2.X() - pos.X() * mom2.Y() > 0) {
175 if (clockwise1 == clockwise2) {
176 B2WARNING(
"Something went wrong during helix extrapolation. Skipping track.");
180 ROOT::Math::XYZVector mompos;
181 ROOT::Math::XYZVector momneg;
198 genfit::MeasuredStateOnPlane msopNeg(repNeg);
200 genfit::MeasuredStateOnPlane msopPos(repPos);
205 shower.getCovarianceMatrixAsArray(covArray);
208 double dx2 = rClus * cosTheta * cosPhi * rClus * cosTheta * cosPhi * covArray[5]
209 + rClus * sinTheta * sinPhi * rClus * sinTheta * sinPhi * covArray[2];
210 double dy2 = rClus * cosTheta * sinPhi * rClus * cosTheta * sinPhi * covArray[5]
211 + rClus * sinTheta * cosPhi * rClus * sinTheta * cosPhi * covArray[2];
212 double dz2 = rClus * sinTheta * rClus * sinTheta * covArray[5];
214 double dpx2 = std::abs(mom1.X() - mom2.X()) / 4.0 * std::abs(mom1.X() - mom2.X()) / 4.0;
215 double dpy2 = std::abs(mom1.Y() - mom2.Y()) / 4.0 * std::abs(mom1.Y() - mom2.Y()) / 4.0;
216 double dpz2 = 0.25 * 0.25 * mom.Z() * mom.Z();
229 msopNeg.setPlane(planeNeg);
231 msopPos.setPlane(planePos);
235 seeds.push_back({seedStateNeg});
237 seeds.push_back({seedStatePos});
StoreArray< ECLShower > m_inputECLshowers
Input ECL Showers Store Array.
CDCCKFEclSeedCreator()
Add the subfindlets.
bool m_param_restrictToForwardSeeds
Don't do Ecl seeding in central region to save computing time.
void apply(std::vector< CDCCKFPath > &seeds) override
Load in the reco tracks and the hits.
double m_param_minimalEnRequirement
Minimal pt requirement.
void initialize() override
Create the store arrays.
std::string m_param_inputEclShowerStoreArrayName
StoreArray name of the input Ecl Shower Store Array.
std::string m_param_eclSeedRecoTrackStoreArrayName
StoreArray name of the output Track Store Array.
StoreArray< RecoTrack > m_eclSeedRecoTracks
Output Reco Tracks Store Array.
double m_param_tanLambdaForwardNeg
Up to which (neg) tanLambda value should the seeding be performed.
double m_param_tanLambdaForwardPos
Up to which (pos) tanLambda value should the seeding be performed.
double m_param_showerDepth
Correction if the shower is assumed to start in a certain depth.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
Define states for CKF algorithm, which can be seed track or CDC wire hit.
static const ChargedStable pion
charged pion particle
static const double speedOfLight
[cm/ns]
@ c_nPhotons
CR is split into n photons (N1)
The Module parameter list class.
static genfit::AbsTrackRep * createOrReturnRKTrackRep(RecoTrack &recoTrack, int PDGcode)
Checks if a TrackRap for the PDG id of the RecoTrack (and its charge conjugate) does already exit and...
This is the Reconstruction Event-Data Model Track.
static void registerRequiredRelations(StoreArray< RecoTrack > &recoTracks, std::string const &pxdHitsStoreArrayName="", std::string const &svdHitsStoreArrayName="", std::string const &cdcHitsStoreArrayName="", std::string const &bklmHitsStoreArrayName="", std::string const &eklmHitsStoreArrayName="", std::string const &recoHitInformationStoreArrayName="")
Convenience method which registers all relations required to fully use a RecoTrack.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
T * appendNew()
Construct a new T object at the end of the array.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
void initialize() override
Receive and dispatch signal before the start of the event processing.
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.