1 ////////////////////////////////////////////////////////////////////////
5 ////////////////////////////////////////////////////////////////////////
7 // File and Version Information:
8 // $Rev:: $: revision of last commit
9 // $Authro:: $: Author of last commit
10 // $Date:: $: Date of last commit
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).
17 // Based on work done by Bjoern Nielson
18 ////////////////////////////////////////////////////////////////////////
19 #ifndef STARLIGHT_TSTARLIGHT_H
20 #define STARLIGHT_TSTARLIGHT_H
24 #include <TGenerator.h>
30 # define _SYS__SELECT_H_
31 struct pthread_cond_t;
32 struct pthread_mutex_t;
35 // Star Light includes
36 #include "starlight.h"
38 #include "inputParameters.h"
39 #include "randomgenerator.h"
46 class TStarLight : public TGenerator {
50 TStarLight(const char* name,
52 const char* slConfigFile="./slight.in");
54 virtual ~TStarLight();
56 // TGenerator overloaded methods
57 virtual void GenerateEvent();
58 virtual Int_t ImportParticles(TClonesArray *particles, Option_t *opt="");
59 virtual TObjArray* ImportParticles(Option_t *opt="");
60 virtual void SetParameter(const char* key, Double_t val);
61 virtual Double_t GetParameter(const char* name) const;
63 // read configuration from a file
64 void ImportConfigurationFromFile(const char* filename){
65 const std::string sf(filename);
66 fInputParameters->configureFromFile(sf);
69 void PrintInputs(ostream& out) const {
70 fInputParameters->print(out);
73 Bool_t InitStarLight() {
74 if (not fInputParameters->init()) {
75 Fatal("InitStarLight", "parameter initialization has failed");
79 return fStarLight->init();
82 void SetParameter(const char* line);
84 void SetInput(inputParameters *in) { fInputParameters = in; }
85 inputParameters* GetInputParameters() { return fInputParameters; }
87 Int_t GetErrorStatusFlag() const { return fErrorStatus; }
89 // boost event to the experiment CM frame
91 fEvent.boost(0.5*(TMath::ACosH(fInputParameters->beam1LorentzGamma()) -
92 TMath::ACosH(fInputParameters->beam2LorentzGamma())));
96 bool Stable(Int_t pdgCode) const {
97 switch(TMath::Abs(pdgCode)) {
99 case 12: // e_neutreno
101 case 14: // Muon_neutreno
102 case 16: // tau_neutreno
104 case 211:// Charge Pion
108 case 321:// Charged K
117 return kTRUE; // Stable enough.
119 return kFALSE; // Not Stable.
123 Int_t fErrorStatus; // Error status flag. 0=OK
124 TString fConfigFileName; // Input Configuration file name
125 starlight *fStarLight; //! Simulation Class
126 inputParameters *fInputParameters; //! Pointer to simulation input information.
127 upcEvent fEvent; //! object holding STARlight simulated event.
129 ClassDef(TStarLight,1); // STARlight interface to ROOT's Virtual Monte Carlo