Belle II Software  release-08-01-10
TouschekReaderTURTLE.h
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 #pragma once
10 
11 #include <framework/core/FrameworkExceptions.h>
12 #include <mdst/dataobjects/MCParticleGraph.h>
13 
14 #include <TGeoMatrix.h>
15 
16 #include <string>
17 #include <fstream>
18 
19 namespace Belle2 {
35 
36  public:
37 
38  //Define exceptions
40  BELLE2_DEFINE_EXCEPTION(TouschekCouldNotOpenFileError, "Could not open file %1% !");
42  BELLE2_DEFINE_EXCEPTION(TouschekConvertFieldError, "Line %1%: Could not convert field %2%: %3%");
43 
49  TouschekReaderTURTLE(TGeoHMatrix* transMatrix, int pdg);
50 
55 
60  void open(const std::string& filename);
61 
71  int getParticles(int number, MCParticleGraph& graph);
72 
73 
74  protected:
75 
76  TGeoHMatrix* m_transMatrix;
77  int m_pdg;
78  std::ifstream m_input;
79  int m_lineNum;
80  };
81 
83 }
84 
Class to build, validate and sort a particle decay chain.
Class to read Touschek files and store their content in a MCParticle graph.
TouschekReaderTURTLE(TGeoHMatrix *transMatrix, int pdg)
Constructor of the TouschekReader class.
int m_lineNum
The line number in the ascii file of the last particle which was read.
TGeoHMatrix * m_transMatrix
Transformation matrix from local Touschek to global geant4 space.
int m_pdg
The pdg value of the type of particle that is read (e.g.
void open(const std::string &filename)
Opens an ascii file and prepares it for reading.
std::ifstream m_input
The input stream of the ascii file.
BELLE2_DEFINE_EXCEPTION(TouschekConvertFieldError, "Line %1%: Could not convert field %2%: %3%")
Exception is thrown if a field in the Touschek file could not be converted to a number.
int getParticles(int number, MCParticleGraph &graph)
Reads the specified number of particles from the file and stores the result in the given MCParticle g...
BELLE2_DEFINE_EXCEPTION(TouschekCouldNotOpenFileError, "Could not open file %1% !")
Exception is thrown if the Touschek file could not be opened.
Abstract base class for different kinds of events.