KaliVeda
Toolkit for HIC analysis
KVSimReader_IQMD.cpp
1 #include "KVSimReader_IQMD.h"
2 #include "KV2Body.h"
3 
4 
6 
8 {
9  SetTreeName("IQMD");
10 }
11 
12 
13 
15 
18 {
20 }
21 
22 
23 
25 
27 {
28  auto status = ReadLineAndCheck(6," "); // 30 40 83 126 34.600 zp,np,zt,nt,ein(MeV/n)
29  if(status == ReadStatus::OK)
30  {
31  auto zp = GetIntReadPar(0);
32  auto np = GetIntReadPar(1);
33  auto zt = GetIntReadPar(2);
34  auto nt = GetIntReadPar(3);
35  auto ebeam = GetDoubleReadPar(4);
36  KV2Body reac({zp,zp+np,(zp+np)*ebeam},{zt,zt+nt});
37  KVError::Info(this,"ReadHeader", "Reading events for reaction: %s", reac.GetTitle());
38 
39  SetROOTFileName(Form("IQMD_%s_%s_%s_%.1fAMeV",
40  sim_type.Data(),
41  reac.GetNucleus(KV2Body::projectile)->GetSymbol(),
42  reac.GetNucleus(KV2Body::target)->GetSymbol(),
43  ebeam));
44  SetTreeTitle(Form("IQMD %s events: %s", sim_type.Data(), reac.GetTitle()));
45  AddInfo({"Projectile",reac.GetNucleus(KV2Body::projectile)->GetSymbol()});
46  AddInfo({"Target",reac.GetNucleus(KV2Body::target)->GetSymbol()});
47  AddInfo({"E/A", ebeam});
48 
49  status = ReadLineAndCheck(3," "); // 0.000 12.000 bmin,bmax
50  if(status == ReadStatus::OK)
51  {
52  AddInfo({"bmin", GetDoubleReadPar(0)});
53  AddInfo({"bmax", GetDoubleReadPar(1)});
54 
55  status = ReadLineAndCheck(4," ");// 1.000 2000.000 1599990 dt,tmax,nevent
56  if(status == ReadStatus::OK)
57  {
58  AddInfo({"dt",GetDoubleReadPar(0)});
59  AddInfo({"tmax",GetDoubleReadPar(1)});
60  AddInfo({"nevent",GetIntReadPar(2)});
61 
62  // read 'header' line " b(fm) t Z N px(MeV/n) py(MeV/n) pz(MeV/n) event_id"
63  return ReadLine()==ReadStatus::OK;
64  }
65  }
66  }
67  return false;
68 }
69 
70 
71 
75 
77 {
78  // b(fm) t Z N px(MeV/n) py(MeV/n) pz(MeV/n) event_id
79  // 9.518 554.000 69 116 -0.6173435 -10.5668182 -29.6082726 000001
80 
81  auto status = (reuse_last_line ? ReuseLineAndCheck(8, " ") : ReadLineAndCheck(8," "));
82  if(status != ReadStatus::OK)
83  return false;
84 
85  reuse_last_line = false;
86  auto event_id = GetIntReadPar(7);
87  evt->SetNumber(event_id);
88  evt->GetParameters()->SetValue("ImpactParameter", GetDoubleReadPar(0));
89  evt->GetParameters()->SetValue("Time", GetDoubleReadPar(1));
90  do {
91  ReadNucleus(evt->AddParticle());
92  status = ReadLineAndCheck(8, " ");
93  } while( status==ReadStatus::OK && event_id==GetIntReadPar(7));
94 
95  if(status == ReadStatus::OK){
96  reuse_last_line = true;
97  }
98 
99  return true;
100 }
101 
102 
103 
108 
110 {
111  // Don't actually read anything, just use already read-in values
112  // b(fm) t Z N px(MeV/n) py(MeV/n) pz(MeV/n) event_id
113  // 9.518 554.000 69 116 -0.6173435 -10.5668182 -29.6082726 000001
114 
115  nuc->SetZ(GetIntReadPar(2));
116  nuc->SetN(GetIntReadPar(3));
117  nuc->SetMomentum(nuc->GetA()*GetDoubleReadPar(4),nuc->GetA()*GetDoubleReadPar(5),nuc->GetA()*GetDoubleReadPar(6));
118  return true;
119 }
120 
121 
123 
bool Bool_t
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
char * Form(const char *fmt,...)
Relativistic binary kinematics calculator.
Definition: KV2Body.h:178
@ target
Definition: KV2Body.h:265
@ projectile
Definition: KV2Body.h:264
virtual void SetNumber(UInt_t num)
Definition: KVBase.h:224
KVNameValueList * GetParameters() const
Definition: KVEvent.h:180
@ OK
successful read and import of parameters from line
ReadStatus ReadLineAndCheck(Int_t nexpect, const KVString &pattern)
Definition: KVFileReader.h:279
ReadStatus ReadLine(const KVString &pattern="")
Definition: KVFileReader.h:243
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:334
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:338
ReadStatus ReuseLineAndCheck(Int_t nexpect, const KVString &pattern)
Definition: KVFileReader.h:304
void SetValue(const Char_t *name, value_type value)
Int_t GetA() const
Definition: KVNucleus.cpp:805
void SetN(Int_t n)
Definition: KVNucleus.cpp:690
void SetZ(Int_t z, Char_t mt=-1)
Definition: KVNucleus.cpp:709
void SetMomentum(const TVector3 &v)
Definition: KVParticle.h:581
Container class for simulated nuclei, KVSimNucleus.
Definition: KVSimEvent.h:22
Nucleus in a simulated event.
Definition: KVSimNucleus.h:32
Class used to import primary events generated with IQMD.
Bool_t ReadFileHeader() override
Bool_t ReadNucleus(KVSimNucleus *nuc) override
Bool_t ReadEvent(KVSimEvent *evt) override
void SetROOTFileName(KVString name)
Definition: KVSimReader.h:247
void SetTreeTitle(KVString n)
Definition: KVSimReader.h:237
void ConvertEventsInFile(KVString filename)
Definition: KVSimReader.cpp:24
void SetTreeName(KVString n)
Definition: KVSimReader.h:232
Particle * AddParticle()
const char * Data() const
void Info(UserClass p, const char *location, const char *va_(fmt),...)
Definition: KVError.h:134
ClassImp(TPyArg)