9#include <generators/modules/TouschekTURTLEInputModule.h>
11#include <framework/datastore/StoreArray.h>
13#include <framework/gearbox/Gearbox.h>
14#include <framework/gearbox/GearDir.h>
15#include <framework/gearbox/Unit.h>
16#include <framework/utilities/FileSystem.h>
18#include <generators/touschek/TouschekReaderTURTLE.h>
37 setDescription(
"Reads the Touschek data from a TURTLE file and stores it into the MCParticle collection.");
43 addParam(
"ReadHER",
m_readHER,
"Set to false to skip reading the HER data.",
true);
44 addParam(
"ReadLER",
m_readLER,
"Set to false to skip reading the LER data.",
true);
46 "Indicates the z-coordinate of the TURTLE particles in the file. (default is 50cm, 400cm is also implemented.)", 50.0);
48 "The maximum number of particles per event that should be read. -1 means all of the particles are read.", -1);
69 B2FATAL(
"The Touschek Turtle input module requires a valid Gearbox. Please make sure you have the Gearbox module added to your path.");
78 B2ERROR(
"Parameter <FilenameHER>: Could not open the file. The filename " <<
m_filenameHER <<
" does not exist !");
82 B2ERROR(
"Parameter <FilenameLER>: Could not open the file. The filename " <<
m_filenameLER <<
" does not exist !");
88 double angleher = irDir.
getAngle(
"AngleHER");
89 double angleler = irDir.
getAngle(
"AngleLER");
98 int readHERParticles = 0;
99 int readLERParticles = 0;
106 if ((readHERParticles > 0) || (readLERParticles > 0)) {
110 B2INFO(
"Read " << readHERParticles <<
" e- particles (HER).");
111 B2INFO(
"Read " << readLERParticles <<
" e+ particles (LER).");
113 }
catch (runtime_error& exc) {
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).
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Class to read Touschek files and store their content in a MCParticle graph.
void open(const std::string &filename)
Opens an ascii file and prepares it for reading.
int getParticles(int number, MCParticleGraph &graph)
Reads the specified number of particles from the file and stores the result in the given MCParticle g...
static const double deg
degree to radians
double getAngle(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard angle unit.
static Gearbox & getInstance()
Return reference to the Gearbox instance.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
GearDir getDetectorComponent(const std::string &component)
Return GearDir representing a given DetectorComponent.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.