-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathextgen.C
More file actions
36 lines (30 loc) · 846 Bytes
/
extgen.C
File metadata and controls
36 lines (30 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
It is mandatory that the function returns a FairGenerator*
whereas there are no restrictions on the function name
and the arguments to the function prototype.
FairGenerator *extgen(Int_t aPDG = 211.);
**/
#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "FairGenerator.h"
#include "FairPrimaryGenerator.h"
#include <iostream>
#endif
class MyGenerator : public FairGenerator
{
public:
MyGenerator(Int_t aPDG) : FairGenerator("MyGenerator"), mPDG(aPDG){};
Bool_t ReadEvent(FairPrimaryGenerator* primGen) override
{
primGen->AddTrack(mPDG, 0.5, 0.5, 0., 0., 0., 0.);
return kTRUE;
};
private:
Int_t mPDG;
};
FairGenerator*
extgen(Int_t aPDG = 211)
{
std::cout << "This is a template function for an custom generator" << std::endl;
auto gen = new MyGenerator(aPDG);
return gen;
}