9#include <generators/modules/SADInputModule.h>
10#include <mdst/dataobjects/MCParticleGraph.h>
12#include <framework/logging/Logger.h>
13#include <framework/utilities/FileSystem.h>
15#include <framework/gearbox/Unit.h>
16#include <framework/gearbox/GearDir.h>
18#include <framework/datastore/StoreArray.h>
20#include <TGeoMatrix.h>
37 setDescription(
"Reads the SAD data from a root file and stores it into the MCParticle collection.");
44 "The read mode: 0 = one SAD particle per event, 1 = one real particle per event, 2 = all SAD particles per event", 0);
47 addParam(
"PxResolution",
m_pxRes,
"The resolution for the x momentum component of the SAD real particle.", 0.01);
48 addParam(
"PyResolution",
m_pyRes,
"The resolution for the y momentum component of the SAD real particle.", 0.01);
50 "Rotate the SAD particles around the nominal beam axis [deg] (just for unphysical tests !!!).", 0.0);
65 B2ERROR(
"Parameter <Filename>: Could not open the file. The filename " <<
m_filename <<
" does not exist !");
73 GearDir ler(
"/Detector/SuperKEKB/LER/");
74 GearDir her(
"/Detector/SuperKEKB/HER/");
83 default: B2FATAL(
"Please specify a valid number for the accRing parameter (0 = LER, 1 = HER) !");
107 default: B2FATAL(
"Please specify a valid number for the readMode parameter !");
116 }
catch (ReaderSAD::SADEndOfFile& exc) {
117 B2DEBUG(10, exc.what());
121 }
catch (runtime_error& exc) {
133 double rate = reader.getSADParticle(mpg);
134 if (rate < 0)
return;
140 if (!reader.getRealParticle(mpg))
return;
static bool fileExists(const std::string &filename)
Check if the file with given filename exists.
GearDir is the basic class used for accessing the parameter store.
Class to build, validate and sort a particle decay chain.
@ c_checkCyclic
Check for cyclic dependencies.
@ c_setDecayInfo
Set decay time and vertex.
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_Input
This module is an input module (reads data).
Class to read files that have been created by SAD and store their content in a MCParticle graph.
void addAllSADParticles(MCParticleGraph &graph)
Reads all SAD particles from the file into the MCParticles collection which are inside the specified ...
void open(const std::string &filename)
Opens a root file and prepares it for reading.
void initialize(TGeoHMatrix *transMatrix, double sRange, AcceleratorRings accRing, double readoutTime)
Initializes the reader, sets the particle parameters and calculates important values.
void setMomentumRes(double pxRes, double pyRes)
Sets the resolution of the momentum for the real particles.
@ c_HER
High Energy Ring (electrons)
@ c_LER
Low Energy Ring (positrons)
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
static const double deg
degree to radians
static const double us
[microsecond]
static const double cm
Standard units with the value = 1.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.