KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimReader_SMF.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Mon Jul 5 16:21:41 2010
2 //Author: bonnet
3 
4 #include "KVSimReader_SMF.h"
5 #include "KVString.h"
6 
8 
9 
10 //________________________________________________________________
11 
12 
16 {
17  // Default constructor
18  init();
19 }
20 
21 
22 
24 
26 {
27  init();
28  ConvertEventsInFile(filename);
29 }
30 
31 
32 
35 
37 {
38  // Destructor
39 }
40 
41 
42 
43 
45 
47 {
48 
49  while (IsOK()) {
50  if (ReadHeader() && ReadEvent()) {
51  if (nevt % 1000 == 0) Info("ReadFile", "%d evts lus", nevt);
52  if (HasToFill()) FillTree();
53  }
54  }
55 
56 }
57 
58 
59 
61 
63 {
64 
65  KVString snom;
66  auto res = ReadLineAndCheck(1, " ");
67  switch (res) {
69  return kFALSE;
71  snom.Form("%s", GetReadPar(0).Data());
72  snom.ReplaceAll("evt_", "");
73  //Info("ReadHeader","lecture %d",snom.Atoi());
74  nv->SetValue("event_number", snom.Atoi());
75 
76  return kTRUE;
77  default:
78 
79  return kFALSE;
80  }
81 
82 }
83 
84 
85 
87 
89 {
90 
91  evt->Clear();
92 
93  Int_t mult = 0;
94  auto res = ReadLineAndCheck(1, " ");
95  switch (res) {
97  return kFALSE;
99  mult = GetIntReadPar(0);
100  break;
101 
102  default:
103  return kFALSE;
104  }
105 
106  evt->SetNumber(nv->GetIntValue("event_number"));
107  //Info("ReadEvent"," Lecture evt %d -> mult %d",evt->GetNumber(),mult);
108  for (Int_t mm = 0; mm < mult; mm += 1) {
110  if (!ReadNucleus()) return kFALSE;
111  }
112 
113  nevt += 1;
114 
115  return kTRUE;
116 
117 }
118 
119 
120 
122 
124 {
125 
126  ReadLine(" ");
127  Int_t res = GetNparRead();
128  Int_t npar = 0;
129  switch (res) {
130  case 0:
131  Info("ReadNucleus", "case 0 line est vide");
132  return kFALSE;
133 
134  default:
135 
136  ReadLineAndAdd(" ");
137  npar = GetNparRead();
138  if (npar != 12) {
139  Info("ReadNucleus", "Nombre de parametres (%d) different de celui attendu(%d)", npar, 12);
140  return kFALSE;
141  }
144  nuc->GetParameters()->SetValue("density", GetDoubleReadPar(2));
146  nuc->GetParameters()->SetValue("spin", GetDoubleReadPar(4));
147  //Axe "faisceau dans SMF z"
150  nuc->GetParameters()->SetValue("avoir", GetDoubleReadPar(11));
151 
152  return kTRUE;
153  }
154 
155 }
156 
157 
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
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
ReadStatus ReadLine(const KVString &pattern="")
Definition: KVFileReader.h:242
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:333
ReadStatus ReadLineAndAdd(const KVString &pattern="")
Definition: KVFileReader.h:260
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:337
Int_t GetNparRead() const
Definition: KVFileReader.h:324
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 SetExcitEnergy(Double_t e)
Definition: KVNucleus.cpp:865
void SetA(Int_t a)
Definition: KVNucleus.cpp:655
void SetZ(Int_t z, Char_t mt=-1)
Definition: KVNucleus.cpp:704
KVNameValueList * GetParameters() const
Definition: KVParticle.h:816
void SetMomentum(const TVector3 &v)
Definition: KVParticle.h:576
Nucleus in a simulated event.
Definition: KVSimNucleus.h:31
void SetPosition(Double_t rx, Double_t ry, Double_t rz)
set the position of the nucleus in position space
Read ascii file for events of the SMF code after clusterization.
virtual void ReadFile()
virtual Bool_t ReadEvent()
virtual Bool_t ReadNucleus()
KVSimReader_SMF()
Default constructor.
virtual ~KVSimReader_SMF()
Destructor.
virtual Bool_t ReadHeader()
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
Int_t Nint(T x)