Project
Loading...
Searching...
No Matches
EventDecayer.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef ALICEO2_EVENTGEN_EVENTDECAYER_H_
13#define ALICEO2_EVENTGEN_EVENTDECAYER_H_
14
15#include "Pythia8/Pythia.h"
16#include <TParticle.h>
17#include <map>
18#include <string>
19#include <unordered_map>
20#include <utility>
21#include <vector>
22
23namespace o2
24{
25namespace eventgen
26{
27
30 std::map<int, long> decayed; // particles decayed by Pythia8
31 std::map<int, long> failed; // particles Pythia8 could not decay
32 std::map<int, long> unknownInO2; // particles to transport unknown to O2DatabasePDG
33 std::map<int, long> unknownInG4; // particles to transport unknown to Geant4
34 std::map<int, std::pair<double, double>> lifetimeMismatch; // pdg -> {pythia ctau mm, g4 ctau mm}
35 void merge(EventDecayerReport const& other);
36 void print() const;
37};
38
41 std::string name;
42 double ctauMM;
45};
46
48std::unordered_map<int, G4ParticleInfo> loadG4ParticleTable(std::string const& path);
49
52{
53 public:
54 bool init();
56 void setUnits(double positionUnit, double timeUnit, double momentumUnit = 1., double energyUnit = 1.)
57 {
58 mPositionUnit = positionUnit;
59 mTimeUnit = timeUnit;
60 mMomentumUnit = momentumUnit;
61 mEnergyUnit = energyUnit;
62 }
63 EventDecayerReport decay(std::vector<TParticle>& particles);
64 std::string configSummary() const;
65 bool vertexLimitsActive() const;
66 int seed() const { return mSeed; }
67
68 private:
69 bool decayable(int pdg) const;
70 bool decayOne(std::vector<TParticle>& particles, int index);
71 void checkParticles(std::vector<TParticle> const& particles, EventDecayerReport& report) const;
72 void checkLifetimes(EventDecayerReport& report) const;
73
74 mutable ::Pythia8::Pythia mPythia; // mutable since Pythia8 settings lookups are not const
75 std::vector<std::string> mConfigs; // expanded config paths
76 std::unordered_map<int, G4ParticleInfo> mG4Particles; // Geant4 particle table
77 bool mHasG4Table = false;
78 bool mVerbose = false;
79 double mPositionUnit = 1.; // caller's position unit in cm
80 double mTimeUnit = 1.; // caller's time unit in s
81 double mMomentumUnit = 1.; // caller's momentum unit in GeV/c
82 double mEnergyUnit = 1.; // caller's energy unit in GeV
83 double mTau0Max = 0.; // tau0 limit in mm/c in use after init, 0 when off
84 int mSeed = 0; // Pythia8 seed in use after init
85};
86
87} // namespace eventgen
88} // namespace o2
89
90#endif // ALICEO2_EVENTGEN_EVENTDECAYER_H_
Decays unstable generator particles with Pythia8 before transport, keeping the full chain.
void setUnits(double positionUnit, double timeUnit, double momentumUnit=1., double energyUnit=1.)
Sets the caller's units in cm, s, GeV/c and GeV, as the unit setters of Generator (default cm,...
EventDecayerReport decay(std::vector< TParticle > &particles)
std::string configSummary() const
GLuint index
Definition glcorearb.h:781
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
void report(gsl::span< o2::InteractionTimeRecord > irs, int threshold, bool verbose)
std::unordered_map< int, G4ParticleInfo > loadG4ParticleTable(std::string const &path)
Reads the Geant4 particle table written by o2-sim-g4-particle-table.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Counts of what one or more EventDecayer::decay calls did, per PDG code.
std::map< int, long > unknownInG4
std::map< int, std::pair< double, double > > lifetimeMismatch
std::map< int, long > failed
void merge(EventDecayerReport const &other)
std::map< int, long > unknownInO2
std::map< int, long > decayed
One entry of the Geant4 particle table.
VectorOfTObjectPtrs other