Skip to content

Commit 7f4efb4

Browse files
preghenellasawenzel
authored andcommitted
Implementation of Pythia8 external decayer
1 parent ec482f1 commit 7f4efb4

14 files changed

Lines changed: 324 additions & 6 deletions

File tree

Detectors/gconfig/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ o2_add_library(SimSetup
1616
MC::Geant4
1717
O2::SimulationDataFormat
1818
O2::DetectorsPassive
19+
O2::Generators
1920
MC::Pythia6 # this is needed by Geant3 and
2021
# EGPythia6
2122
ROOT::EGPythia6 # this is needed by Geant4

Detectors/gconfig/commonConfig.C

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#if !defined(__CLING__) || defined(__ROOTCLING__)
55
#include "SimulationDataFormat/Stack.h"
66
#include "SimulationDataFormat/StackParam.h"
7+
#include "TVirtualMC.h"
8+
#include "Generators/DecayerPythia8.h"
79
#endif
810

911
template <typename T, typename R>
@@ -40,3 +42,10 @@ void stackSetup(T* vmc, R* run)
4042
}
4143
*/
4244
}
45+
46+
void decayerSetup(TVirtualMC* vmc)
47+
{
48+
auto decayer = new o2::eventgen::DecayerPythia8;
49+
decayer->Init();
50+
vmc->SetExternalDecayer(decayer);
51+
}

Detectors/gconfig/g3Config.C

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ void Config()
3232
}
3333
stackSetup(geant3, run);
3434

35+
// setup decayer
36+
decayerSetup(geant3);
37+
3538
// ******* GEANT3 specific configuration for simulated Runs *******
3639
geant3->SetTRIG(1); // Number of events to be processed
3740
geant3->SetSWIT(4, 100);

Detectors/gconfig/g4Config.C

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <iostream>
1111
#include "TGeant4.h"
1212
#include "TString.h"
13-
#include "TPythia6Decayer.h"
1413
#include "FairRunSim.h"
1514
#include "TSystem.h"
1615
#include "TG4RunConfiguration.h"
@@ -69,10 +68,7 @@ void Config()
6968
stackSetup(geant4, FairRunSim::Instance());
7069

7170
// setup decayer
72-
if (FairRunSim::Instance()->IsExtDecayer()) {
73-
TVirtualMCDecayer* decayer = TPythia6Decayer::Instance();
74-
geant4->SetExternalDecayer(decayer);
75-
}
71+
decayerSetup(geant4);
7672

7773
TString configm(gSystem->Getenv("VMCWORKDIR"));
7874
auto configm1 = configm + "/Detectors/gconfig/g4config.in";

Detectors/gconfig/src/G3Config.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <DetectorsPassive/Cave.h>
2020
#include "DetectorsBase/MaterialManager.h"
2121
#include "SimSetup/GlobalProcessCutSimParam.h"
22+
#include "Generators/DecayerPythia8.h"
2223

2324
//using declarations here since SetCuts.C and g3Config.C are included within namespace
2425
// these are needed for SetCuts.C inclusion
@@ -29,6 +30,8 @@ using o2::base::MaterialManager;
2930
// these are used in g3Config.C
3031
using std::cout;
3132
using std::endl;
33+
// these are used in commonConfig.C
34+
using o2::eventgen::DecayerPythia8;
3235
#include <SimSetup/SimSetup.h>
3336

3437
namespace o2

Detectors/gconfig/src/G4Config.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "DetectorsBase/MaterialManager.h"
2222
#include "SimSetup/GlobalProcessCutSimParam.h"
2323
#include "SimConfig/G4Params.h"
24+
#include "Generators/DecayerPythia8.h"
2425

2526
//using declarations here since SetCuts.C and g4Config.C are included within namespace
2627
// these are needed for SetCuts.C inclusion
@@ -31,6 +32,8 @@ using o2::base::MaterialManager;
3132
// these are used in g4Config.C
3233
using std::cout;
3334
using std::endl;
35+
// these are used in commonConfig.C
36+
using o2::eventgen::DecayerPythia8;
3437

3538
namespace o2
3639
{

Generators/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ o2_add_library(Generators
3636
$<$<BOOL:${pythia6_FOUND}>:src/GeneratorPythia6.cxx>
3737
$<$<BOOL:${pythia6_FOUND}>:src/GeneratorPythia6Param.cxx>
3838
$<$<BOOL:${pythia_FOUND}>:src/GeneratorPythia8.cxx>
39+
$<$<BOOL:${pythia_FOUND}>:src/DecayerPythia8.cxx>
3940
$<$<BOOL:${pythia_FOUND}>:src/GeneratorPythia8Param.cxx>
41+
$<$<BOOL:${pythia_FOUND}>:src/DecayerPythia8Param.cxx>
4042
$<$<BOOL:${HepMC_FOUND}>:src/GeneratorHepMC.cxx>
4143
PUBLIC_LINK_LIBRARIES FairRoot::Base O2::SimConfig O2::CommonUtils
4244
O2::SimulationDataFormat ${pythia6Target} ${pythiaTarget} ${hepmcTarget}
@@ -75,8 +77,11 @@ if (pythia6_FOUND)
7577
endif()
7678

7779
if(pythia_FOUND)
78-
list(APPEND headers include/Generators/GeneratorPythia8.h
80+
list(APPEND headers
81+
include/Generators/GeneratorPythia8.h
82+
include/Generators/DecayerPythia8.h
7983
include/Generators/GeneratorPythia8Param.h
84+
include/Generators/DecayerPythia8Param.h
8085
include/Generators/GeneratorFactory.h)
8186
endif()
8287

@@ -131,3 +136,9 @@ install(FILES share/egconfig/pythia8_inel.cfg
131136
share/egconfig/pythia8_hi.cfg
132137
share/egconfig/pythia8_userhooks_charm.C
133138
DESTINATION share/Generators/egconfig/)
139+
140+
install(FILES share/pythia8/decays/base.cfg
141+
share/pythia8/decays/bjpsidimuon.cfg
142+
DESTINATION share/Generators/pythia8/decays/)
143+
144+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \author R+Preghenella - June 2020
12+
13+
#ifndef ALICEO2_EVENTGEN_DECAYERPYTHIA8_H_
14+
#define ALICEO2_EVENTGEN_DECAYERPYTHIA8_H_
15+
16+
#include "TVirtualMCDecayer.h"
17+
#include "Pythia8/Pythia.h"
18+
19+
#include <iostream>
20+
21+
namespace o2
22+
{
23+
namespace eventgen
24+
{
25+
26+
/*****************************************************************/
27+
/*****************************************************************/
28+
29+
class DecayerPythia8 : public TVirtualMCDecayer
30+
{
31+
32+
public:
33+
/** default constructor **/
34+
DecayerPythia8() = default;
35+
/** destructor **/
36+
~DecayerPythia8() override = default;
37+
38+
/** methods to override **/
39+
void Init() override;
40+
void Decay(Int_t pdg, TLorentzVector* lv) override;
41+
Int_t ImportParticles(TClonesArray* particles) override;
42+
void SetForceDecay(Int_t type) override{};
43+
void ForceDecay() override{};
44+
Float_t GetPartialBranchingRatio(Int_t ipart) override { return 0.; };
45+
Float_t GetLifetime(Int_t kf) override { return 0.; };
46+
void ReadDecayTable() override{};
47+
48+
protected:
49+
/** copy constructor **/
50+
DecayerPythia8(const DecayerPythia8&);
51+
/** operator= **/
52+
DecayerPythia8& operator=(const DecayerPythia8&);
53+
54+
/** Pythia8 **/
55+
::Pythia8::Pythia mPythia; //!
56+
57+
ClassDefOverride(DecayerPythia8, 1);
58+
59+
}; /** class Decayer **/
60+
61+
/*****************************************************************/
62+
/*****************************************************************/
63+
64+
} // namespace eventgen
65+
} // namespace o2
66+
67+
#endif /* ALICEO2_EVENTGEN_DECAYER_H_ */
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \author R+Preghenella - June 2020
12+
13+
#ifndef ALICEO2_EVENTGEN_DECAYERPYTHIA8PARAM_H_
14+
#define ALICEO2_EVENTGEN_DECAYERPYTHIA8PARAM_H_
15+
16+
#include "CommonUtils/ConfigurableParam.h"
17+
#include "CommonUtils/ConfigurableParamHelper.h"
18+
#include <string>
19+
20+
namespace o2
21+
{
22+
namespace eventgen
23+
{
24+
25+
/**
26+
** a parameter class/struct to keep the settings of
27+
** the Pythia8 decayer and
28+
** allow the user to modify them
29+
**/
30+
31+
struct DecayerPythia8Param : public o2::conf::ConfigurableParamHelper<DecayerPythia8Param> {
32+
std::string config = "${O2_ROOT}/share/Generators/pythia8/decays/base.cfg";
33+
O2ParamDef(DecayerPythia8Param, "DecayerPythia8");
34+
};
35+
36+
} // end namespace eventgen
37+
} // end namespace o2
38+
39+
#endif // ALICEO2_EVENTGEN_DECAYERPYTHIA8PARAM_H_
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### do not show changed particle data
2+
3+
Init:showChangedParticleData off
4+
5+
### switch off decays of long-lived particles
6+
### including particles that decay electromagnetically
7+
8+
13:mayDecay off # mu-
9+
15:mayDecay off # tau-
10+
111:mayDecay off # pi0
11+
130:mayDecay off # K_0L
12+
211:mayDecay off # pi+
13+
221:mayDecay off # eta
14+
310:mayDecay off # K_S0
15+
321:mayDecay off # K+
16+
411:mayDecay off # D+
17+
421:mayDecay off # D0
18+
431:mayDecay off # D_s+
19+
511:mayDecay off # B0
20+
521:mayDecay off # B+
21+
531:mayDecay off # B_s0
22+
541:mayDecay off # B_c+
23+
3112:mayDecay off # Sigma-
24+
3122:mayDecay off # Lambda0
25+
3212:mayDecay off # Sigma0
26+
3222:mayDecay off # Sigma+
27+
3312:mayDecay off # Xi-
28+
3322:mayDecay off # Xi0
29+
3334:mayDecay off # Omega-
30+
4122:mayDecay off # Lambda_c+
31+
4132:mayDecay off # Xi_c0
32+
4232:mayDecay off # Xi_c+
33+
4332:mayDecay off # Omega_c0
34+
5122:mayDecay off # Lambda_b0

0 commit comments

Comments
 (0)