KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimReader_SMF_asym.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Mon Jul 5 15:24:25 2010
2 //Author: bonnet
3 
4 #include "KVSimReader_SMF_asym.h"
5 #include "KVString.h"
6 
8 
9 
10 
14 {
15  // Default constructor
16  init();
17 }
18 
19 
20 
22 
24 {
25  init();
26  ConvertEventsInFile(filename);
27 }
28 
29 
30 
31 
34 
36 {
37  // Destructor
38 }
39 
40 
41 
43 
45 {
46 
47  while (IsOK()) {
48  if (ReadHeader()) {
49  for (Int_t nd = 0; nd < nv->GetIntValue("ndes"); nd += 1) {
50  if (ReadEvent()) {
51  if (nevt % 1000 == 0) Info("ReadFile", "%d evts lus", nevt);
52  if (HasToFill()) FillTree();
53  }
54  }
55  }
56  }
57 
58 }
59 
60 
61 
62 
64 
66 {
67 
68  KVString snom;
69  auto res = ReadLineAndCheck(1, " ");
70  switch (res) {
72  return kFALSE;
74  snom.Form("%s", GetReadPar(0).Data());
75  snom.ReplaceAll("evt_", "");
76  //Info("ReadHeader","lecture %d",snom.Atoi());
77  nv->SetValue("event_number", snom.Atoi());
78 
79  break;
80  default:
81  return kFALSE;
82  }
83 
84  res = ReadLineAndCheck(1, " ");
85  switch (res) {
87  return kFALSE;
89  nv->SetValue("ndes", GetIntReadPar(0));
90  ndes = 0;
91 
92  return kTRUE;
93  default:
94  return kFALSE;
95  }
96 
97 
98 }
99 
100 
101 //-----------------------------------------
102 
103 
105 
107 {
108 
109  evt->Clear();
110 
111  Int_t mult = 0;
112  auto res = ReadLineAndCheck(1, " ");
113  switch (res) {
115  return kFALSE;
117  mult = GetIntReadPar(0);
118  break;
119 
120  default:
121  return kFALSE;
122  }
123 
124  evt->SetNumber(nv->GetIntValue("event_number"));
125  evt->GetParameters()->SetValue("sub_number", ndes);
126  for (Int_t mm = 0; mm < mult; mm += 1) {
128  if (!ReadNucleus()) return kFALSE;
129  }
130 
131  nevt += 1;
132  ndes += 1;
133 
134  return kTRUE;
135 
136 }
137 
138 
139 //-----------------------------------------
140 
141 
143 
145 {
146 
147  auto res = ReadLineAndCheck(5, " ");
148  switch (res) {
150  Info("ReadNucleus", "case 0 line est vide");
151  return kFALSE;
152 
154  nuc->SetZ(GetIntReadPar(1));
155  nuc->SetA(GetIntReadPar(0));
156 
157  //Axe "faisceau dans SMF z"
159 
160  return kTRUE;
161 
162  default:
163 
164  return kFALSE;
165  }
166 
167 }
168 
169 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
const Bool_t kFALSE
bool Bool_t
const Bool_t kTRUE
virtual void SetNumber(UInt_t num)
Definition: KVBase.h:215
KVNameValueList * GetParameters() const
Definition: KVEvent.h:203
void Clear(Option_t *opt="")
Clear object properties : name, type/title, number, label.
Definition: KVEvent.h:262
@ EmptyLine
last line read was empty (only whitespace)
@ OK
successful read and import of parameters from line
ReadStatus ReadLineAndCheck(Int_t nexpect, const KVString &pattern)
Definition: KVFileReader.h:278
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:333
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:337
Bool_t IsOK()
Definition: KVFileReader.h:230
KVString GetReadPar(Int_t pos) const
Definition: KVFileReader.h:341
Int_t GetIntValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
void SetA(Int_t a)
Definition: KVNucleus.cpp:655
void SetZ(Int_t z, Char_t mt=-1)
Definition: KVNucleus.cpp:704
void SetMomentum(const TVector3 &v)
Definition: KVParticle.h:576
Nucleus in a simulated event.
Definition: KVSimNucleus.h:31
Read ascii file for asymptotic events of the SMF code after SIMON deexcitation.
virtual ~KVSimReader_SMF_asym()
Destructor.
KVSimReader_SMF_asym()
Default constructor.
Int_t nevt
Definition: KVSimReader.h:68
KVSimNucleus * nuc
Definition: KVSimReader.h:66
virtual Bool_t HasToFill()
Definition: KVSimReader.h:133
virtual void FillTree()
Definition: KVSimReader.h:129
virtual void ConvertEventsInFile(KVString filename)
Method called by constructors with KVString filename argument.
Definition: KVSimReader.cpp:56
KVSimEvent * evt
Definition: KVSimReader.h:65
KVNameValueList * nv
Definition: KVSimReader.h:80
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
Particle * AddParticle()
virtual void Info(const char *method, const char *msgfmt,...) const
Int_t Atoi() const
void Form(const char *fmt,...)
TString & ReplaceAll(const char *s1, const char *s2)
const long double mm
Definition: KVUnits.h:69