Belle II Software development
Advancer.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <tracking/ckf/general/utilities/Advancer.h>
10#include <tracking/ckf/general/utilities/SearchDirection.h>
11
12#include <framework/core/ModuleParamList.templateDetails.h>
13
14#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
15#include <framework/logging/Logger.h>
16#include <genfit/MaterialEffects.h>
17#include <genfit/Exception.h>
18
19using namespace Belle2;
20using namespace TrackFindingCDC;
21
22double Advancer::extrapolateToPlane(genfit::MeasuredStateOnPlane& measuredStateOnPlane,
23 const genfit::SharedPlanePtr& plane) const
24{
26
27 double returnValue = NAN;
28 try {
29 const double extrapolatedS = measuredStateOnPlane.extrapolateToPlane(plane);
30
31 if (arcLengthInRightDirection(extrapolatedS, m_param_direction)) {
32 returnValue = static_cast<double>(m_param_direction) * extrapolatedS;
33 }
34 } catch (const genfit::Exception& e) {
35 B2DEBUG(29, "Extrapolation failed: " << e.what());
36 }
37
39 return returnValue;
40}
41
43{
44 genfit::MaterialEffects::getInstance()->setNoEffects(not m_param_useMaterialEffects);
45}
46
48{
49 genfit::MaterialEffects::getInstance()->setNoEffects(false);
50}
51
52void Advancer::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
53{
54 moduleParamList->addParameter(prefixed(prefix, "useMaterialEffects"),
56 "Use the material effects during extrapolation.",
58
59 moduleParamList->addParameter(prefixed(prefix, "direction"), m_param_directionAsString,
60 "The direction where the extrapolation will happen.");
61}
62
64{
66
68}
void resetMaterialEffects() const
Call this to reset the material effects back to their default value (turned on).
Definition: Advancer.cc:47
bool m_param_useMaterialEffects
Use material effects during extrapolation or not.
Definition: Advancer.h:57
double extrapolateToPlane(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const genfit::SharedPlanePtr &plane) const
Extrapolate the mSoP of one plane to another plane and return the traveled distance or NAN,...
Definition: Advancer.cc:22
void initialize() final
Convert the string parameter to a valid forward backward information.
Definition: Advancer.cc:63
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Expose the parameters.
Definition: Advancer.cc:52
TrackFindingCDC::EForwardBackward m_param_direction
Direction parameter converted from the string parameters.
Definition: Advancer.h:62
void setMaterialEffectsToParameterValue() const
Call this to set the material effects handling accorinf to the given parameters.
Definition: Advancer.cc:42
std::string m_param_directionAsString
Parameter for the distance given to the framework (can not handle EForwardBackward directly)
Definition: Advancer.h:60
The Module parameter list class.
virtual void initialize()
Receive signal before the start of the event processing.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
TrackFindingCDC::EForwardBackward fromString(const std::string &directionString)
Helper function to turn a direction string into a valid forward backward information.
constexpr bool arcLengthInRightDirection(double arcLength2D, TrackFindingCDC::EForwardBackward forwardBackward)
Given the calculated arc length between a start point and an end point, checks if the travelled path ...
Abstract base class for different kinds of events.