EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EventGmcTrans.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EventGmcTrans.cxx
1 
11 
12 #include <cmath>
13 #include <sstream>
14 #include <string>
15 
16 namespace erhic {
17 
18 EventGmcTrans::EventGmcTrans(const std::string& s)
19 // Initialise all floats to NAN for consistency with EventDis
20 : mStruckQuark(0)
21 , mQSquared(NAN)
22 , mBjorkenX(NAN)
23 , mInelasticity(NAN)
24 , mWSquared(NAN)
25 , mNu(NAN)
26 , mS(NAN)
27 , mZ(NAN)
28 , mHadronPt(NAN)
29 , mLeptonTheta(NAN)
30 , mLeptonPhi(NAN)
31 , mPhiSpin(NAN)
32 , mPhiHadron(NAN)
33 , mF1(NAN)
34 , mG1(NAN)
35 , mH1(NAN)
36 , mD1(NAN)
37 , mF1TPerp(NAN)
38 , mF1TPerp1(NAN)
39 , mF1TPerp12(NAN)
40 , mH1Perp(NAN)
41 , mH1Perp1(NAN)
42 , mH1Perp12(NAN)
43 , mAutSiv(NAN)
44 , mAutWtSiv(NAN)
45 , mAutSivAllQ(NAN)
46 , mAutWtSivAllQ(NAN)
47 , mAutSivPiDiff(NAN)
48 , mAutWtSivPiDiff(NAN)
49 , mAutCol(NAN)
50 , mAutWtCol(NAN)
51 , mAutTw3Col(NAN)
52 , mAutWtTw3Col(NAN)
53 , mAutColAllQ(NAN)
54 , mAutWtColAllQ(NAN)
55 , mXUnpolarised(NAN)
56 , mXSivers(NAN)
57 , mXCollins(NAN) {
58  // Initialise from a string if provided.
59  if (!s.empty()) {
60  Parse(s);
61  } // if
62 }
63 
64 bool EventGmcTrans::Parse(const std::string& line) {
65  // Save ourselves the overhead of a new stringstream with each event read.
66  static std::stringstream stream;
67  // Clear the stream contents and flags from any previous use.
68  stream.str("");
69  stream.clear();
70  // Read values from the input line.
71  stream << line;
72  stream
73  // The first integer is always 0 (indicating start of event record)
74  // so skip that and read the next int, which is the struck quark.
76  >> mBjorkenX
77  >> mQSquared
78  >> mNu
79  >> mInelasticity
80  >> mWSquared
81  >> mZ
82  >> mHadronPt
83  >> mLeptonTheta
84  >> mLeptonPhi
85  >> mPhiSpin
86  >> mPhiHadron
87  >> mF1 >> mG1 >> mH1 >> mD1
89  >> mH1Perp >> mH1Perp1 >> mH1Perp12
95  // Inherits process from EventMC. Always set this equal to 99 for DIS
96  process = 99;
97  // The stream state should still be good if processing
98  // the string went OK.
99  return !stream.fail();
100 }
101 
102 } // namespace erhic