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#include <genfit/MeasuredStateOnPlane.h>
19
20using namespace Belle2;
21using namespace TrackFindingCDC;
22
23double Advancer::extrapolateToPlane(genfit::MeasuredStateOnPlane& measuredStateOnPlane,
24 const genfit::SharedPlanePtr& plane) const
25{
27
28 double returnValue = NAN;
29 try {
30 const double extrapolatedS = measuredStateOnPlane.extrapolateToPlane(plane);
31
32 if (arcLengthInRightDirection(extrapolatedS, m_param_direction)) {
33 returnValue = static_cast<double>(m_param_direction) * extrapolatedS;
34 }
35 } catch (const genfit::Exception& e) {
36 B2DEBUG(29, "Extrapolation failed: " << e.what());
37 }
38
40 return returnValue;
41}
42
44{
45 genfit::MaterialEffects::getInstance()->setNoEffects(not m_param_useMaterialEffects);
46}
47
49{
50 genfit::MaterialEffects::getInstance()->setNoEffects(false);
51}
52
53void Advancer::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
54{
55 moduleParamList->addParameter(prefixed(prefix, "useMaterialEffects"),
57 "Use the material effects during extrapolation.",
59
60 moduleParamList->addParameter(prefixed(prefix, "direction"), m_param_directionAsString,
61 "The direction where the extrapolation will happen.");
62}
63
void resetMaterialEffects() const
Call this to reset the material effects back to their default value (turned on).
Definition Advancer.cc:48
bool m_param_useMaterialEffects
Use material effects during extrapolation or not.
Definition Advancer.h:56
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:23
void initialize() final
Convert the string parameter to a valid forward backward information.
Definition Advancer.cc:64
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Expose the parameters.
Definition Advancer.cc:53
TrackFindingCDC::EForwardBackward m_param_direction
Direction parameter converted from the string parameters.
Definition Advancer.h:61
void setMaterialEffectsToParameterValue() const
Call this to set the material effects handling accorinf to the given parameters.
Definition Advancer.cc:43
std::string m_param_directionAsString
Parameter for the distance given to the framework (can not handle EForwardBackward directly)
Definition Advancer.h:59
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.