]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STARLIGHT/starlight/src/.svn/text-base/eventchannel.cpp.svn-base
STARLIGHT code and interface
[u/mrichter/AliRoot.git] / STARLIGHT / starlight / src / .svn / text-base / eventchannel.cpp.svn-base
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 //    Copyright 2010
4 //
5 //    This file is part of starlight.
6 //
7 //    starlight is free software: you can redistribute it and/or modify
8 //    it under the terms of the GNU General Public License as published by
9 //    the Free Software Foundation, either version 3 of the License, or
10 //    (at your option) any later version.
11 //
12 //    starlight is distributed in the hope that it will be useful,
13 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 //    GNU General Public License for more details.
16 //
17 //    You should have received a copy of the GNU General Public License
18 //    along with starlight. If not, see <http://www.gnu.org/licenses/>.
19 //
20 ///////////////////////////////////////////////////////////////////////////
21 //
22 // File and Version Information:
23 // $Rev::                             $: revision of last commit
24 // $Author::                          $: author of last commit
25 // $Date::                            $: date of last commit
26 //
27 // Description:
28 //    Class needed for root output
29 //
30 //
31 ///////////////////////////////////////////////////////////////////////////
32
33
34 #include <iostream>
35 #include <fstream>
36 #include <cmath>
37
38 #include "eventchannel.h"
39
40
41 using namespace std;
42
43
44 //______________________________________________________________________________
45 eventChannel::eventChannel(beamBeamSystem& bbsystem)
46         : readLuminosity(),
47           _bbs(bbsystem),
48           _nmbAttempts(0),
49           _nmbAccepted(0)
50 {
51   _ptCutEnabled  = inputParametersInstance.ptCutEnabled();
52   _ptCutMin      = inputParametersInstance.ptCutMin();
53   _ptCutMax      = inputParametersInstance.ptCutMax();
54   _etaCutEnabled = inputParametersInstance.etaCutEnabled();
55   _etaCutMin     = inputParametersInstance.etaCutMin();
56   _etaCutMax     = inputParametersInstance.etaCutMax();
57 }
58
59
60 //______________________________________________________________________________
61 eventChannel::~eventChannel()
62 { }
63
64
65 //______________________________________________________________________________
66 void
67 eventChannel::transform(const double  betax,
68                         const double  betay,
69                         const double  betaz,
70                         double&       E,
71                         double&       px,
72                         double&       py,
73                         double&       pz,
74                         int&          iFbadevent)
75 {
76   // carries out a lorentz transform of the frame.  (Not a boost!)???
77   const double E0  = E;
78   const double px0 = px;
79   const double py0 = py;
80   const double pz0 = pz;
81
82   const double beta = sqrt(betax * betax + betay * betay + betaz * betaz);
83   if (beta >= 1)
84           iFbadevent = 1;
85   const double gamma = 1. / sqrt(1. - beta * beta);
86   const double gob   = (gamma - 1) / (beta * beta);
87
88   E   = gamma * (E0 - betax * px0 - betay * py0 - betaz*  pz0);
89   px  = -gamma * betax * E0 + (1. + gob * betax * betax) * px0
90           + gob * betax * betay * py0 + gob * betax * betaz * pz0;
91   py  = -gamma * betay * E0 + gob * betay * betax * px0
92           + (1. + gob * betay * betay) * py0 + gob * betay * betaz  *pz0;
93   pz  = -gamma * betaz * E0 + gob * betaz * betax * px0
94           + gob * betaz * betay * py0 + (1. + gob * betaz * betaz) * pz0;
95 }
96
97
98 //______________________________________________________________________________
99 double
100 eventChannel::pseudoRapidity(const double px,
101                              const double py,
102                              const double pz)
103 {
104   const double pT= sqrt(px * px + py * py);
105   const double p = sqrt(pz * pz + pT * pT);
106   double eta = -99.9;  // instead of special value, std::numeric_limits<double>::quiet_NaN() should be used
107   if ((p - pz) != 0)
108           eta = 0.5 * log((p + pz)/(p - pz));
109   return eta;
110 }
111