Belle II Software  release-05-01-25
Advancer.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <tracking/ckf/general/utilities/Advancer.h>
12 #include <tracking/ckf/general/utilities/SearchDirection.h>
13 
14 #include <framework/core/ModuleParamList.templateDetails.h>
15 
16 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
17 #include <framework/logging/Logger.h>
18 #include <genfit/MaterialEffects.h>
19 #include <genfit/Exception.h>
20 
21 using namespace Belle2;
22 using namespace TrackFindingCDC;
23 
25  const genfit::SharedPlanePtr& plane) const
26 {
27  setMaterialEffectsToParameterValue();
28 
29  double returnValue = NAN;
30  try {
31  const double extrapolatedS = measuredStateOnPlane.extrapolateToPlane(plane);
32 
33  if (arcLengthInRightDirection(extrapolatedS, m_param_direction)) {
34  returnValue = m_param_direction * extrapolatedS;
35  }
36  } catch (const genfit::Exception& e) {
37  B2DEBUG(50, "Extrapolation failed: " << e.what());
38  }
39 
40  resetMaterialEffects();
41  return returnValue;
42 }
43 
45 {
46  genfit::MaterialEffects::getInstance()->setNoEffects(not m_param_useMaterialEffects);
47 }
48 
50 {
51  genfit::MaterialEffects::getInstance()->setNoEffects(false);
52 }
53 
54 void Advancer::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
55 {
56  moduleParamList->addParameter(prefixed(prefix, "useMaterialEffects"),
57  m_param_useMaterialEffects,
58  "Use the material effects during extrapolation.",
59  m_param_useMaterialEffects);
60 
61  moduleParamList->addParameter(prefixed(prefix, "direction"), m_param_directionAsString,
62  "The direction where the extrapolation will happen.");
63 }
64 
66 {
68 
69  m_param_direction = fromString(m_param_directionAsString);
70 }
genfit::Exception
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Definition: Exception.h:48
Belle2::fromString
TrackFindingCDC::EForwardBackward fromString(const std::string &directionString)
Helper function to turn a direction string into a valid forward backward information.
Definition: SearchDirection.h:46
genfit::SharedPlanePtr
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
Definition: SharedPlanePtr.h:40
Belle2::Advancer::extrapolateToPlane
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:24
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::Advancer::initialize
void initialize() final
Convert the string parameter to a valid forward backward information.
Definition: Advancer.cc:65
Belle2::Advancer::resetMaterialEffects
void resetMaterialEffects() const
Call this to reset the material effects back to their default value (turned on).
Definition: Advancer.cc:49
Belle2::TrackFindingCDC::ProcessingSignalListener::initialize
virtual void initialize()
Receive signal before the start of the event processing.
Definition: ProcessingSignalListener.cc:30
Belle2::arcLengthInRightDirection
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 ...
Definition: SearchDirection.h:40
Belle2::ModuleParamList::addParameter
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Definition: ModuleParamList.templateDetails.h:38
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Advancer::setMaterialEffectsToParameterValue
void setMaterialEffectsToParameterValue() const
Call this to set the material effects handling accorinf to the given parameters.
Definition: Advancer.cc:44
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::Advancer::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Expose the parameters.
Definition: Advancer.cc:54