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
23 #include <TGenerator.h>
29 # define _SYS__SELECT_H_
30 struct pthread_cond_t;
31 struct pthread_mutex_t;
34 // Star Light includes
35 #include "starlight.h"
37 #include "inputParameters.h"
38 #include "randomgenerator.h"
44 class TStarLight : public TGenerator {
48 TStarLight(const char* name,
50 const char* slConfigFile="./slight.in");
52 virtual ~TStarLight();
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;
61 // read configuration from a file
62 void ImportConfigurationFromFile(const char* filename){
63 const std::string sf(filename);
64 fInputParameters->configureFromFile(sf);
67 void PrintInputs(ostream& out) const {
68 fInputParameters->print(out);
71 Bool_t InitStarLight() {
72 if (not fInputParameters->init()) {
73 Fatal("InitStarLight", "parameter initialization has failed");
77 return fStarLight->init();
80 void SetParameter(const char* line);
82 void SetInput(inputParameters *in) { fInputParameters = in; }
83 inputParameters* GetInputParameters() { return fInputParameters; }
85 Int_t GetErrorStatusFlag() const { return fErrorStatus; }
87 // boost event to the experiment CM frame
89 fEvent.boost(0.5*(TMath::ACosH(fInputParameters->beam1LorentzGamma()) -
90 TMath::ACosH(fInputParameters->beam2LorentzGamma())));
94 bool Stable(Int_t pdgCode) const {
95 switch(TMath::Abs(pdgCode)) {
97 case 12: // e_neutreno
99 case 14: // Muon_neutreno
100 case 16: // tau_neutreno
102 case 211:// Charge Pion
106 case 321:// Charged K
115 return kTRUE; // Stable enough.
117 return kFALSE; // Not Stable.
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.
127 ClassDef(TStarLight,1); // STARlight interface to ROOT's Virtual Monte Carlo