BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
FairPlutoReactionGenerator.cxx
Go to the documentation of this file.
1// -------------------------------------------------------------------------
2// ----- FairPlutoReactionGenerator header file -----
3// ----- Created 05/07/08 by I. Froehlich -----
4// -------------------------------------------------------------------------
5
7
8#include "FairPrimaryGenerator.h"
9#include "TClonesArray.h"
10#include "TDatabasePDG.h"
11#include "TFile.h"
12#include "TLorentzVector.h"
13#include "TTree.h"
14#include "TVector3.h"
15
16#include <iostream>
17
18// ----- Default constructor ------------------------------------------
20{
21 iEvent = 0;
22 fReaction = NULL;
23#ifdef PLUTOVERSION_FOR_FAIR
24 fPlutoFairGenerator = NULL;
25#endif
26}
27// ------------------------------------------------------------------------
28
29// ----- Standard constructor -----------------------------------------
31{
32 iEvent = 0;
33 fReaction = reaction;
34#ifdef PLUTOVERSION_FOR_FAIR
35 fPlutoFairGenerator = new PFairGenerator();
36 if (!reaction) {
37 std::cout << "-E FairPlutoReactionGenerator: No PReaction!" << std::endl;
38 } else {
39 reaction->AddBulk(fPlutoFairGenerator);
40 reaction->IsInline();
41 }
42#else
43 std::cout << "-E FairPlutoReactionGenerator: You are using the wrong Pluto version" << std::endl;
44#endif
45}
46// ------------------------------------------------------------------------
47
48// ----- Destructor ---------------------------------------------------
50{
51#ifdef PLUTOVERSION_FOR_FAIR
52 if (fPlutoFairGenerator) {
53 delete fPlutoFairGenerator;
54 }
55#endif
56}
57// ------------------------------------------------------------------------
58
59// ----- Public method ReadEvent --------------------------------------
60Bool_t FairPlutoReactionGenerator::ReadEvent(FairPrimaryGenerator* primGen)
61{
62#ifdef PLUTOVERSION_FOR_FAIR
63
64 // Check for input file
65 if (!fReaction) {
66 cout << "-E FairPlutoReactionGenerator: No PReaction!" << endl;
67 return kFALSE;
68 }
69
70 fReaction->InitChannels();
71 fReaction->DisableWeightReset();
72 if (!fReaction->loop(1, 0, 0)) {
73 return kFALSE;
74 }
75
76 Double_t px, py, pz, vx, vy, vz;
77 Int_t pdgType;
78
79 while (fPlutoFairGenerator->GetNextParticle(&pdgType, &px, &py, &pz, &vx, &vy, &vz)) {
80
81 if (pdgType) {
82 primGen->AddTrack(pdgType, px, py, pz, vx, vy, vz);
83 }
84 }
85
86 return kTRUE;
87#else
88
89 return kFALSE;
90#endif
91}
92// ------------------------------------------------------------------------
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
FairPlutoReactionGenerator()
Default constructor (should not be used).
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)
Reads on event from the Pluto reaction and pushes the tracks onto the stack.
virtual ~FairPlutoReactionGenerator()
Destructor.