File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [Diamond]
2+ width[2]=6.0
3+
4+ [GeneratorExternal]
5+ fileName =${O2DPG_MC_CONFIG_ROOT}/MC/config/ALICE3/pythia8/generator_DittoMC.C
6+ funcName =generator_DittoMC(" Ditto_tune_pythia8_inel_136tev.root" )
Original file line number Diff line number Diff line change 1+ #include "Ditto.h"
2+
3+ #include <algorithm>
4+ #include <cstdint>
5+ #include <cstdlib>
6+ #include <stdexcept>
7+
8+ #if !defined(__CLING__ ) || defined(__ROOTCLING__ )
9+
10+ #include <SimulationDataFormat/MCGenProperties.h>
11+
12+ #include <Generators/GeneratorPythia8.h>
13+ #include <Pythia8/Pythia.h>
14+
15+ #include <FairGenerator.h>
16+ #include <FairPrimaryGenerator.h>
17+
18+ #endif
19+
20+ // Ditto event generator
21+
22+ class GeneratorDittoMC : public o2 ::eventgen ::GeneratorPythia8
23+ {
24+ public :
25+ /// Constructor
26+ GeneratorDittoMC (const TString & tuneFile ) : mGenerator (makeConfig (tuneFile ))
27+ {
28+ mPythia .readString ("ProcessLevel:all = off" );
29+ }
30+
31+ bool generateEvent () override
32+ {
33+ mGenerator .generate ();
34+ mGenerator .loadParticles (mPythia .event , true);
35+ return true;
36+ }
37+
38+ /// Destructor
39+ ~GeneratorDittoMC () = default ;
40+
41+ private :
42+ static Ditto ::Config makeConfig (const TString & tuneFile )
43+ {
44+ Ditto ::Config config ;
45+ if (tuneFile .IsNull ()) {
46+ throw std ::runtime_error ("DITTO_TUNE_FILE must point to a Ditto tune file" );
47+ }
48+ config .tuneFile = tuneFile ;
49+
50+ const char * alienProcId = std ::getenv ("ALIEN_PROC_ID" );
51+ config .seed = alienProcId ? static_cast < std ::uint64_t > (std ::atoll (alienProcId )) : 0 ;
52+ Printf ("Using Ditto tune: %s and seed: %lu\n" , config .tuneFile .c_str (), config .seed );
53+ return config ;
54+ }
55+
56+ Ditto ::Generator mGenerator ;
57+ };
58+
59+ FairGenerator * generator_DittoMC (const TString & tuneFile )
60+ {
61+ return new GeneratorDittoMC (tuneFile );
62+ }
You can’t perform that action at this time.
0 commit comments