]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STARLIGHT/starlight/TStarLight/TStarLight.h
STARLIGHT update (missing modifications in 65f9e959b845e683a0d24545a6372e7f985b7853)
[u/mrichter/AliRoot.git] / STARLIGHT / starlight / TStarLight / TStarLight.h
CommitLineData
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>
c9f2e893 22#include <iostream>
da32329d
AM
23
24#include <TGenerator.h>
25#include <TString.h>
26#include <TMath.h>
27
28#ifdef __CINT__
29# undef __GNUC__
30# define _SYS__SELECT_H_
31struct pthread_cond_t;
32struct pthread_mutex_t;
33#endif
34
35// Star Light includes
36#include "starlight.h"
37#include "upcevent.h"
38#include "inputParameters.h"
39#include "randomgenerator.h"
40
c9f2e893 41using std::ostream;
da32329d
AM
42//
43class TObjArray;
44class TClonesArray;
45
46class TStarLight : public TGenerator {
47 public:
48 TStarLight();
49
50 TStarLight(const char* name,
51 const char* title,
52 const char* slConfigFile="./slight.in");
53
54 virtual ~TStarLight();
55
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;
62
63 // read configuration from a file
64 void ImportConfigurationFromFile(const char* filename){
65 const std::string sf(filename);
66 fInputParameters->configureFromFile(sf);
67 }
68
69 void PrintInputs(ostream& out) const {
70 fInputParameters->print(out);
71 }
72
73 Bool_t InitStarLight() {
74 if (not fInputParameters->init()) {
75 Fatal("InitStarLight", "parameter initialization has failed");
76 fErrorStatus = -1;
77 return false;
78 }
79 return fStarLight->init();
80 }
81
82 void SetParameter(const char* line);
83
84 void SetInput(inputParameters *in) { fInputParameters = in; }
85 inputParameters* GetInputParameters() { return fInputParameters; }
86
87 Int_t GetErrorStatusFlag() const { return fErrorStatus; }
88
89 // boost event to the experiment CM frame
90 void BoostEvent() {
91 fEvent.boost(0.5*(TMath::ACosH(fInputParameters->beam1LorentzGamma()) -
92 TMath::ACosH(fInputParameters->beam2LorentzGamma())));
93 }
94
95 private:
96 bool Stable(Int_t pdgCode) const {
97 switch(TMath::Abs(pdgCode)) {
98 case 11: // electon
99 case 12: // e_neutreno
100 case 13: // Muon
101 case 14: // Muon_neutreno
102 case 16: // tau_neutreno
103 case 22: // Photon
104 case 211:// Charge Pion
105 case 130:// K0 long
106 case 310:// K0 short
107 case 311:// K0
108 case 321:// Charged K
109 case 2212:// Proton
110 case 2112:// neutron
111 case 3122:// Lamda
112 case 3222:// Sigma+
113 case 3112:// Sigma-
114 case 3322:// Exi0
115 case 3312:// Exi-
116 case 3334:// Omega-
117 return kTRUE; // Stable enough.
118 default:
119 return kFALSE; // Not Stable.
120 } // end switch
121 return kFALSE;
122 }
a2de4243 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.
da32329d
AM
128
129 ClassDef(TStarLight,1); // STARlight interface to ROOT's Virtual Monte Carlo
130} ;
131
132#endif
133