Belle II Software  release-05-02-19
AnalysisConfigurationModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Ilya Komarov *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <string>
12 #include <set>
13 #include <analysis/modules/AnalysisConfiguration/AnalysisConfigurationModule.h>
14 #include <analysis/utility/AnalysisConfiguration.h>
15 
16 using namespace std;
17 using namespace Belle2;
18 
19 
20 
22 
24 {
25  setDescription("This is a supplimentary module designed to configure other modules");
26  addParam("tupleStyle", m_tupleStyle, R"DOCSTRING(This parameter defines style of variables written by all other ntuples tools. \n
27  Possible styles on example of PX variable of pi0 from D in decay B->(D->pi0 pi) pi0:\n
28  'default': B_D_pi0_PX\n
29  'semilaconic': D_pi0_PX\n
30  'laconic': pi01_PX\n)DOCSTRING", std::string("default"));
31 
32  addParam("mcMatchingVersion", m_mcMatchingVersion, "Specifies what version of mc matching algorithm is going to be used. \n"
33  "Possibilities are: BelleII (default) and Belle. The latter should be used when analysing Belle MC.\n"
34  "The difference between the algorithms is only in the treatment (identification) of FSR photons. In Belle II MC \n"
35  "it is possible to identify FSR photons via special flag set by the generator, while in case of Belle MC such\n"
36  "information is not available.", std::string("BelleII"));
37 }
38 
39 void AnalysisConfigurationModule::initialize()
40 {
41  if (m_styles.find(m_tupleStyle) == m_styles.end()) {
42  B2WARNING("Chosen tuple style '" << m_tupleStyle << "' is not defined. Using default tuple style.");
43  }
44  AnalysisConfiguration::instance()->setTupleStyle(m_tupleStyle);
45 
46  if (m_mcMatchingVersion == "BelleII")
47  AnalysisConfiguration::instance()->useLegacyMCMatching(false);
48  else if (m_mcMatchingVersion == "Belle" or m_mcMatchingVersion == "MC5")
49  AnalysisConfiguration::instance()->useLegacyMCMatching(true);
50  else
51  B2ERROR("Invalid mcMatchingVersion specified to AnalysisConfiguration: " << m_mcMatchingVersion << "\n"
52  "Please choose between BelleII or Belle depending whether you are analysing Belle II or Belle MC.");
53 }
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::AnalysisConfiguration
Singleton class keeping configurables of analysis components.
Definition: AnalysisConfiguration.h:28
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::AnalysisConfigurationModule
Class to hold general basf2 configuration Used to intiate and configure CreateAnalysis object.
Definition: AnalysisConfigurationModule.h:44