Belle II Software development
CDCCKFEclSeedCreator Class Referenceabstract

Findlet for. More...

#include <CDCCKFEclSeedCreator.h>

Inheritance diagram for CDCCKFEclSeedCreator:
Findlet< CDCCKFPath > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes = std::tuple< AIOTypes... >
 Types that should be served to apply on invocation.
 
using IOVectors = std::tuple< std::vector< AIOTypes >... >
 Vector types that should be served to apply on invocation.
 

Public Member Functions

 CDCCKFEclSeedCreator ()
 Add the subfindlets.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the parameters of the sub findlets.
 
void initialize () override
 Create the store arrays.
 
void apply (std::vector< CDCCKFPath > &seeds) override
 Load in the reco tracks and the hits.
 
virtual std::string getDescription ()
 Brief description of the purpose of the concrete findlet.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Types

using ToVector = typename ToVectorImpl< T >::Type
 Short hand for ToRangeImpl.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = TrackFindingCDC::Findlet< CDCCKFPath >
 Parent class.
 

Private Attributes

std::string m_param_inputEclShowerStoreArrayName = "ECLShowers"
 StoreArray name of the input Ecl Shower Store Array.
 
std::string m_param_eclSeedRecoTrackStoreArrayName = "EclSeedRecoTracks"
 StoreArray name of the output Track Store Array.
 
double m_param_minimalEnRequirement = 0.3
 Minimal pt requirement.
 
bool m_param_restrictToForwardSeeds = true
 Don't do Ecl seeding in central region to save computing time.
 
double m_param_showerDepth = 12.
 Correction if the shower is assumed to start in a certain depth.
 
double m_param_tanLambdaForwardNeg = -0.8
 Up to which (neg) tanLambda value should the seeding be performed.
 
double m_param_tanLambdaForwardPos = 1.8
 Up to which (pos) tanLambda value should the seeding be performed.
 
StoreArray< ECLShowerm_inputECLshowers
 Input ECL Showers Store Array.
 
StoreArray< RecoTrackm_eclSeedRecoTracks
 Output Reco Tracks Store Array.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happened before.
 
bool m_terminated = false
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Findlet for.

Definition at line 31 of file CDCCKFEclSeedCreator.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes = std::tuple<AIOTypes...>
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors = std::tuple< std::vector<AIOTypes>... >
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

Parent class.

Definition at line 33 of file CDCCKFEclSeedCreator.h.

◆ ToVector

using ToVector = typename ToVectorImpl<T>::Type
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ CDCCKFEclSeedCreator()

Add the subfindlets.

Definition at line 22 of file CDCCKFEclSeedCreator.cc.

22 : Super()
23{
24
25}
TrackFindingCDC::Findlet< CDCCKFPath > Super
Parent class.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 55 of file CompositeProcessingSignalListener.cc.

56{
58}
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
References to subordinary signal processing listener contained in this findlet.

◆ apply()

void apply ( std::vector< CDCCKFPath > &  seeds)
override

Load in the reco tracks and the hits.

Definition at line 75 of file CDCCKFEclSeedCreator.cc.

76{
77 // loop over all showers and create seed objects
78 for (auto& shower : m_inputECLshowers) {
79 if (shower.getHypothesisId() != ECLShower::c_nPhotons) {
80 continue;
81 }
82
83 const double Eclus = shower.getEnergy();
84 if (Eclus < m_param_minimalEnRequirement) {
85 continue;
86 }
87
88 // Get shower position, momentum
89 const double thetaClus = shower.getTheta();
90 const double phiClus = shower.getPhi();
91 const double rClus = shower.getR();
92
93 const double sinTheta = sin(thetaClus);
94 const double cosTheta = cos(thetaClus);
95 const double sinPhi = sin(phiClus);
96 const double cosPhi = cos(phiClus);
97
98 ROOT::Math::XYZVector pos(rClus * sinTheta * cosPhi, rClus * sinTheta * sinPhi, rClus * cosTheta);
99 const double tanLambda = pos.Z() / pos.Rho();
100
101 // restrict to forward seeds
103 if (tanLambda > m_param_tanLambdaForwardNeg && tanLambda < m_param_tanLambdaForwardPos) {
104 continue;
105 }
106 }
107
108 // Correction if shower is assumed to start in a certain depth
109 pos = pos - m_param_showerDepth / pos.R() * pos;
110
111 ROOT::Math::XYZVector mom = Eclus / pos.R() * pos;
112
113 // Calculate helix trajectory for negative and positive charge seeds
114 // Find center of circular trajectory
115 // factor 1. for charge // speed of light in [cm per ns] // const magnetic field
116 double rad = std::abs(mom.Rho() / (Const::speedOfLight * 1e-4 * 1. * 1.5));
117
118 // Particle would not be able to reach ECL (underestimation of shower energy)
119 if (2. * rad < pos.Rho()) {
120 rad = pos.Rho() / 2.0 + 1.0;
121 }
122
123 // Use pq formula (center of circle has to be on perpendicular line through center of line between (0,0) and seed position)
124 double q = pos.Rho();
125 double y3 = pos.Y() / 2.0;
126 double x3 = pos.X() / 2.0;
127
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;
130
131 double centerx1 = x3 + basex;
132 double centery1 = y3 + basey;
133 double centerx2 = x3 - basex;
134 double centery2 = y3 - basey;
135
136 // vectors for tangent at seed position (perpendicular to radius at seed position)
137 double momx1 = pos.Y() - centery1;
138 double momy1 = - (pos.X() - centerx1);
139 double momx2 = pos.Y() - centery2;
140 double momy2 = - (pos.X() - centerx2);
141
142 // two solutions (pointing toward and away from center)
143 // make sure that particle moves inwards
144 if (momx1 * pos.X() + momy1 * pos.Y() < 0) {
145 momx1 = -momx1;
146 momy1 = -momy1;
147 }
148 if (momx2 * pos.X() + momy2 * pos.Y() < 0) {
149 momx2 = -momx2;
150 momy2 = -momy2;
151 }
152
153 // scale to unit length
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;
160
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());
163
164 // Pick the right momentum for positive/negative charge
165 // Use cross product if momentum vector is (counter)clockwise wrt position vector
166 bool clockwise1 = true;
167 bool clockwise2 = true;
168 if (pos.Y() * mom1.X() - pos.X() * mom1.Y() > 0) {
169 clockwise1 = false;
170 }
171 if (pos.Y() * mom2.X() - pos.X() * mom2.Y() > 0) {
172 clockwise2 = false;
173 }
174
175 if (clockwise1 == clockwise2) {
176 B2WARNING("Something went wrong during helix extrapolation. Skipping track.");
177 continue;
178 }
179
180 ROOT::Math::XYZVector mompos;
181 ROOT::Math::XYZVector momneg;
182 if (clockwise1) {
183 mompos = mom2;
184 momneg = mom1;
185 } else {
186 mompos = mom1;
187 momneg = mom2;
188 }
189
190 // electron and positron hypothesis
191 RecoTrack* eclSeedNeg = m_eclSeedRecoTracks.appendNew(pos, momneg, -1);
192 eclSeedNeg->addRelationTo(&shower);
193 RecoTrack* eclSeedPos = m_eclSeedRecoTracks.appendNew(pos, mompos, +1);
194 eclSeedPos->addRelationTo(&shower);
195
196 // define MeasuredStateOnPlane (use pion hypothesis)
197 genfit::AbsTrackRep* repNeg = RecoTrackGenfitAccess::createOrReturnRKTrackRep(*eclSeedNeg, -Const::pion.getPDGCode());
198 genfit::MeasuredStateOnPlane msopNeg(repNeg);
199 genfit::AbsTrackRep* repPos = RecoTrackGenfitAccess::createOrReturnRKTrackRep(*eclSeedPos, Const::pion.getPDGCode());
200 genfit::MeasuredStateOnPlane msopPos(repPos);
201
202 // set position, momentum, cov, sharedPlanePtr
203 TMatrixDSym cov(6);
204 double covArray[6];
205 shower.getCovarianceMatrixAsArray(covArray);
206
207 // Calculate uncertainties on position from ECLShower
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];
213
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();
217
218 cov(0, 0) = dx2;
219 cov(1, 1) = dy2;
220 cov(2, 2) = dz2;
221 cov(3, 3) = dpx2;
222 cov(4, 4) = dpy2;
223 cov(5, 5) = dpz2;
224
225 // set properties of genfit objects
226 genfit::SharedPlanePtr planeNeg(new genfit::DetPlane(XYZToTVector(pos), XYZToTVector(pos)));
227 genfit::SharedPlanePtr planePos(new genfit::DetPlane(XYZToTVector(pos), XYZToTVector(pos)));
228 msopNeg.setPosMomCov(XYZToTVector(pos), XYZToTVector(momneg), cov);
229 msopNeg.setPlane(planeNeg);
230 msopPos.setPosMomCov(XYZToTVector(pos), XYZToTVector(mompos), cov);
231 msopPos.setPlane(planePos);
232
233 // create CDCCKF states
234 CDCCKFState seedStateNeg(eclSeedNeg, msopNeg);
235 seeds.push_back({seedStateNeg});
236 CDCCKFState seedStatePos(eclSeedPos, msopPos);
237 seeds.push_back({seedStatePos});
238 }
239}
StoreArray< ECLShower > m_inputECLshowers
Input ECL Showers Store Array.
bool m_param_restrictToForwardSeeds
Don't do Ecl seeding in central region to save computing time.
double m_param_minimalEnRequirement
Minimal pt requirement.
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.
Define states for CKF algorithm, which can be seed track or CDC wire hit.
Definition: CDCCKFState.h:25
static const ChargedStable pion
charged pion particle
Definition: Const.h:661
static const double speedOfLight
[cm/ns]
Definition: Const.h:695
@ c_nPhotons
CR is split into n photons (N1)
Definition: ECLShower.h:42
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...
Definition: RecoTrack.cc:409
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
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).
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
Definition: VectorUtil.h:24
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ beginEvent()

void beginEvent ( )
overridevirtualinherited

Receive and dispatch signal for the start of a new event.

Reimplemented from ProcessingSignalListener.

Reimplemented in SpacePointTagger< Belle2::CKFToPXDResult, Belle2::PXDCluster >, SpacePointTagger< Belle2::CKFToSVDResult, Belle2::SVDCluster >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, SharingHitsMatcher< Belle2::TrackFindingCDC::CDCTrack, Belle2::TrackFindingCDC::CDCSegment2D >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RecoTrackStorer, ROIFinder, and SVDHoughTracking.

Definition at line 31 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overridevirtualinherited

Receive and dispatch signal for the beginning of a new run.

Reimplemented from ProcessingSignalListener.

Reimplemented in LayerRelationFilter< AFilter >, FourHitFilter, QualityIndicatorFilter, ThreeHitFilter, TwoHitVirtualIPFilter, TwoHitVirtualIPQIFilter, RecoTrackStorer, ROIFinder, SpacePointLoaderAndPreparer, and TrackCandidateResultRefiner.

Definition at line 23 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ endRun()

void endRun ( )
overridevirtualinherited

Receive and dispatch signal for the end of the run.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

void exposeParameters ( ModuleParamList moduleParamList,
const std::string &  prefix 
)
overridevirtual

Expose the parameters of the sub findlets.

Reimplemented from Findlet< CDCCKFPath >.

Definition at line 27 of file CDCCKFEclSeedCreator.cc.

28{
29 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "inputECLshowersStoreArrayName"),
31 "StoreArray name of the input Shower Store Array.");
32
33 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "eclSeedRecoTrackStoreArrayName"),
35 "StoreArray name of the output Track Store Array.");
36
37 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minimalEnRequirementCluster"),
39 "Minimal energy requirement for the input clusters",
41
42 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "restrictToForwardSeeds"),
44 "Don't do Ecl seeding in central region to save computing time",
46
47 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "tanLambdaForwardNeg"),
49 "Up to which (neg) tanLambda value should the seeding be performed",
51
52 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "tanLambdaForwardPos"),
54 "Up to which (pos) tanLambda value should the seeding be performed",
56
57 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "showerDepth"),
59 "Don't do Ecl seeding in central region to save computing time",
61}
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.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getDescription()

virtual std::string getDescription ( )
inlinevirtualinherited

Brief description of the purpose of the concrete findlet.

Definition at line 60 of file Findlet.h.

61 {
62 return "(no description)";
63 }

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overridevirtual

Create the store arrays.

Reimplemented from ProcessingSignalListener.

Definition at line 63 of file CDCCKFEclSeedCreator.cc.

64{
66
68
71
73}
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.
Definition: RecoTrack.cc:53
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
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.
Definition: StoreArray.h:140
void initialize() override
Receive and dispatch signal before the start of the event processing.

◆ terminate()

void terminate ( )
overridevirtualinherited

Receive and dispatch Signal for termination of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, and StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >.

Definition at line 47 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
virtual void terminate()
Receive Signal for termination of the event processing.

Member Data Documentation

◆ m_eclSeedRecoTracks

StoreArray<RecoTrack> m_eclSeedRecoTracks
private

Output Reco Tracks Store Array.

Definition at line 71 of file CDCCKFEclSeedCreator.h.

◆ m_initialized

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_inputECLshowers

StoreArray<ECLShower> m_inputECLshowers
private

Input ECL Showers Store Array.

Definition at line 69 of file CDCCKFEclSeedCreator.h.

◆ m_param_eclSeedRecoTrackStoreArrayName

std::string m_param_eclSeedRecoTrackStoreArrayName = "EclSeedRecoTracks"
private

StoreArray name of the output Track Store Array.

Definition at line 55 of file CDCCKFEclSeedCreator.h.

◆ m_param_inputEclShowerStoreArrayName

std::string m_param_inputEclShowerStoreArrayName = "ECLShowers"
private

StoreArray name of the input Ecl Shower Store Array.

Definition at line 53 of file CDCCKFEclSeedCreator.h.

◆ m_param_minimalEnRequirement

double m_param_minimalEnRequirement = 0.3
private

Minimal pt requirement.

Definition at line 57 of file CDCCKFEclSeedCreator.h.

◆ m_param_restrictToForwardSeeds

bool m_param_restrictToForwardSeeds = true
private

Don't do Ecl seeding in central region to save computing time.

Definition at line 59 of file CDCCKFEclSeedCreator.h.

◆ m_param_showerDepth

double m_param_showerDepth = 12.
private

Correction if the shower is assumed to start in a certain depth.

Definition at line 61 of file CDCCKFEclSeedCreator.h.

◆ m_param_tanLambdaForwardNeg

double m_param_tanLambdaForwardNeg = -0.8
private

Up to which (neg) tanLambda value should the seeding be performed.

Definition at line 63 of file CDCCKFEclSeedCreator.h.

◆ m_param_tanLambdaForwardPos

double m_param_tanLambdaForwardPos = 1.8
private

Up to which (pos) tanLambda value should the seeding be performed.

Definition at line 65 of file CDCCKFEclSeedCreator.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 52 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated = false
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.


The documentation for this class was generated from the following files: