]>
Commit | Line | Data |
---|---|---|
da32329d AM |
1 | //////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // Copyright 2013 | |
4 | // | |
5 | //////////////////////////////////////////////////////////////////////// | |
6 | // | |
7 | // File and Version Information: | |
8 | // $Rev:: $: revision of last commit | |
9 | // $Authro:: $: Author of last commit | |
10 | // $Date:: $: Date of last commit | |
11 | // | |
12 | // Description: | |
13 | // TStarLight.h is the include file defining data members and | |
14 | // functions specifically needed to implement an interface of STARlight | |
15 | // to ROOT's TGenerator (a part of ROOT's Virtual Monte Carlo). | |
16 | // | |
17 | // Based on work done by Bjoern Nielson | |
18 | //////////////////////////////////////////////////////////////////////// | |
19 | #ifndef STARLIGHT_TSTARLIGHT_H | |
20 | #define STARLIGHT_TSTARLIGHT_H | |
21 | #include <cstring> | |
22 | ||
23 | #include <TGenerator.h> | |
24 | #include <TString.h> | |
25 | #include <TMath.h> | |
26 | ||
27 | #ifdef __CINT__ | |
28 | # undef __GNUC__ | |
29 | # define _SYS__SELECT_H_ | |
30 | struct pthread_cond_t; | |
31 | struct pthread_mutex_t; | |
32 | #endif | |
33 | ||
34 | // Star Light includes | |
35 | #include "starlight.h" | |
36 | #include "upcevent.h" | |
37 | #include "inputParameters.h" | |
38 | #include "randomgenerator.h" | |
39 | ||
40 | // | |
41 | class TObjArray; | |
42 | class TClonesArray; | |
43 | ||
44 | class TStarLight : public TGenerator { | |
45 | public: | |
46 | TStarLight(); | |
47 | ||
48 | TStarLight(const char* name, | |
49 | const char* title, | |
50 | const char* slConfigFile="./slight.in"); | |
51 | ||
52 | virtual ~TStarLight(); | |
53 | ||
54 | // TGenerator overloaded methods | |
55 | virtual void GenerateEvent(); | |
56 | virtual Int_t ImportParticles(TClonesArray *particles, Option_t *opt=""); | |
57 | virtual TObjArray* ImportParticles(Option_t *opt=""); | |
58 | virtual void SetParameter(const char* key, Double_t val); | |
59 | virtual Double_t GetParameter(const char* name) const; | |
60 | ||
61 | // read configuration from a file | |
62 | void ImportConfigurationFromFile(const char* filename){ | |
63 | const std::string sf(filename); | |
64 | fInputParameters->configureFromFile(sf); | |
65 | } | |
66 | ||
67 | void PrintInputs(ostream& out) const { | |
68 | fInputParameters->print(out); | |
69 | } | |
70 | ||
71 | Bool_t InitStarLight() { | |
72 | if (not fInputParameters->init()) { | |
73 | Fatal("InitStarLight", "parameter initialization has failed"); | |
74 | fErrorStatus = -1; | |
75 | return false; | |
76 | } | |
77 | return fStarLight->init(); | |
78 | } | |
79 | ||
80 | void SetParameter(const char* line); | |
81 | ||
82 | void SetInput(inputParameters *in) { fInputParameters = in; } | |
83 | inputParameters* GetInputParameters() { return fInputParameters; } | |
84 | ||
85 | Int_t GetErrorStatusFlag() const { return fErrorStatus; } | |
86 | ||
87 | // boost event to the experiment CM frame | |
88 | void BoostEvent() { | |
89 | fEvent.boost(0.5*(TMath::ACosH(fInputParameters->beam1LorentzGamma()) - | |
90 | TMath::ACosH(fInputParameters->beam2LorentzGamma()))); | |
91 | } | |
92 | ||
93 | private: | |
94 | bool Stable(Int_t pdgCode) const { | |
95 | switch(TMath::Abs(pdgCode)) { | |
96 | case 11: // electon | |
97 | case 12: // e_neutreno | |
98 | case 13: // Muon | |
99 | case 14: // Muon_neutreno | |
100 | case 16: // tau_neutreno | |
101 | case 22: // Photon | |
102 | case 211:// Charge Pion | |
103 | case 130:// K0 long | |
104 | case 310:// K0 short | |
105 | case 311:// K0 | |
106 | case 321:// Charged K | |
107 | case 2212:// Proton | |
108 | case 2112:// neutron | |
109 | case 3122:// Lamda | |
110 | case 3222:// Sigma+ | |
111 | case 3112:// Sigma- | |
112 | case 3322:// Exi0 | |
113 | case 3312:// Exi- | |
114 | case 3334:// Omega- | |
115 | return kTRUE; // Stable enough. | |
116 | default: | |
117 | return kFALSE; // Not Stable. | |
118 | } // end switch | |
119 | return kFALSE; | |
120 | } | |
121 | Int_t fErrorStatus; // Error status flag. 0=OK | |
122 | TString fConfigFileName; // Input Configuration file name | |
123 | starlight *fStarLight; //! Simulation Class | |
124 | inputParameters *fInputParameters; //! Pointer to simulation input information. | |
125 | upcEvent fEvent; //! object holding STARlight simulated event. | |
126 | ||
127 | ClassDef(TStarLight,1); // STARlight interface to ROOT's Virtual Monte Carlo | |
128 | } ; | |
129 | ||
130 | #endif | |
131 |