EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eventchannel.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eventchannel.cpp
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 //
21 //
22 // File and Version Information:
23 // $Rev:: 255 $: revision of last commit
24 // $Author:: jnystrand $: author of last commit
25 // $Date:: 2016-04-06 14:01:46 +0100 #$: date of last commit
26 //
27 // Description:
28 // Class needed for root output
29 //
30 //
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(const inputParameters& inputParametersInstance, beamBeamSystem& bbsystem)
46  : readLuminosity(inputParametersInstance),
47  _bbs(bbsystem),
48  _nmbAttempts(0),
49  _nmbAccepted(0),
50  _totalChannelCrossSection(0)
51 {
52  _ptCutEnabled = inputParametersInstance.ptCutEnabled();
53  _ptCutMin = inputParametersInstance.ptCutMin();
54  _ptCutMax = inputParametersInstance.ptCutMax();
55  _etaCutEnabled = inputParametersInstance.etaCutEnabled();
56  _etaCutMin = inputParametersInstance.etaCutMin();
57  _etaCutMax = inputParametersInstance.etaCutMax();
58  _randy.SetSeed(inputParametersInstance.randomSeed());
59 }
60 
61 
62 //______________________________________________________________________________
64 { }
65 
66 
67 //______________________________________________________________________________
68 void
69 eventChannel::transform(const double betax,
70  const double betay,
71  const double betaz,
72  double& E,
73  double& px,
74  double& py,
75  double& pz,
76  int& iFbadevent)
77 {
78  // carries out a lorentz transform of the frame. (Not a boost!)???
79  const double E0 = E;
80  const double px0 = px;
81  const double py0 = py;
82  const double pz0 = pz;
83 
84  const double beta = sqrt(betax * betax + betay * betay + betaz * betaz);
85  if (beta >= 1)
86  iFbadevent = 1;
87  const double gamma = 1. / sqrt(1. - beta * beta);
88  const double gob = (gamma - 1) / (beta * beta);
89 
90  E = gamma * (E0 - betax * px0 - betay * py0 - betaz* pz0);
91  px = -gamma * betax * E0 + (1. + gob * betax * betax) * px0
92  + gob * betax * betay * py0 + gob * betax * betaz * pz0;
93  py = -gamma * betay * E0 + gob * betay * betax * px0
94  + (1. + gob * betay * betay) * py0 + gob * betay * betaz *pz0;
95  pz = -gamma * betaz * E0 + gob * betaz * betax * px0
96  + gob * betaz * betay * py0 + (1. + gob * betaz * betaz) * pz0;
97 }
98 
99 
100 //______________________________________________________________________________
101 double
103  const double py,
104  const double pz)
105 {
106  const double pT= sqrt(px * px + py * py);
107  const double p = sqrt(pz * pz + pT * pT);
108  double eta = -99.9; // instead of special value, std::numeric_limits<double>::quiet_NaN() should be used
109  if ((p - pz) != 0)
110  eta = 0.5 * log((p + pz)/(p - pz));
111  return eta;
112 }
113