KaliVeda
Toolkit for HIC analysis
KVSimReader_DIT.cpp
1 //Created by KVClassFactory on Fri Sep 11 23:31:56 2020
2 //Author: henri
3 
4 #include "KVSimReader_DIT.h"
5 
7 
8 // BEGIN_HTML <!--
10 /* -->
11 <h2>KVSimReader_DIT</h2>
12 <h4></h4>
13 <!-- */
14 // --> END_HTML
16 
17 
18 
21 {
22  projectile = proj;
23  target = targ;
24  energy = ener;
25  //
26  InitReader();
27  ConvertAndSaveEventsInFile(filename);
28 }
29 
30 
31 
33 
35 {
36  SkipFirstLine();
37  return true;
38 }
39 
40 
41 
42 
43 
45 
47 {
48  auto res = ReadLineAndCheck(21, " ");
49  switch (res) {
51  Info("ReadEvent", "Line is empty");
52  return kFALSE;
53 
55  evt->SetNumber(GetEventNumber());
56  StoreEventInVariables();
57  FillEvent(evt);
58  break;
59 
60  default :
61  return kFALSE;
62  }
63  return kTRUE;
64 }
65 
66 
67 
68 
70 
71 void KVSimReader_DIT::StoreEventInVariables()
72 {
73  weight = GetDoubleReadPar(0);
74  inicident_partial_wave = GetDoubleReadPar(1);
75  impact_parameter = GetDoubleReadPar(2);
76  itype = GetIntReadPar(3);
77  a_proj_like = GetIntReadPar(4);
78  a_targ_like = GetIntReadPar(5);
79  z_proj_like = GetIntReadPar(6);
80  z_targ_like = GetIntReadPar(7);
81  excitation_energy_proj_like = GetDoubleReadPar(8);
82  excitation_energy_targ_like = GetDoubleReadPar(9);
83  spin_proj_like = GetDoubleReadPar(10);
84  spin_targ_like = GetDoubleReadPar(11);
85  energy_proj_like = GetDoubleReadPar(12);
86  energy_targ_like = GetDoubleReadPar(13);
87  theta_proj_like = GetDoubleReadPar(14);
88  theta_targ_like = GetDoubleReadPar(15);
89  theta_cm = GetDoubleReadPar(16);
90  q_reaction = GetDoubleReadPar(17);
91  k_n = GetIntReadPar(18);
92  k_p = GetIntReadPar(19);
93  min_dist = GetIntReadPar(20);
94 }
95 
96 
97 
98 
101 
102 void KVSimReader_DIT::FillEvent(KVSimEvent* evt)
103 {
104  // Fill projectile-like nucleus
105  auto nuc = evt->AddParticle();
106 
107  nuc->SetZandA(z_proj_like, a_proj_like);
108  nuc->SetE(energy_proj_like);
109  nuc->SetTheta(TMath::Abs(theta_proj_like));
110 
111  if (itype == DITCollOk) {
112  if (theta_proj_like < 0.) {
113  nuc->SetPhi(270.);
114  }
115  else {
116  nuc->SetPhi(90.);
117  }
118  }
119  else {
120  nuc->SetPhi(0.);
121  }
122 
123  nuc->SetExcitEnergy(excitation_energy_proj_like);
124  nuc->SetSpin(spin_proj_like, 0., 0.); // Spin component given by the model is normal to the reaction plane, this last being (YZ), thus the spin is on the X-axis
125  //
126  // Fill target-like nucleus if it exists (meaning he itype code is 0, a DIC event and not a fusion
127  if (itype == DITCollOk) {
128  nuc = evt->AddParticle();
129 
130  nuc->SetZandA(z_targ_like, a_targ_like);
131  nuc->SetE(energy_targ_like);
132  nuc->SetTheta(TMath::Abs(theta_targ_like));
133 
134  if (theta_targ_like < 0.) {
135  nuc->SetPhi(270.);
136  }
137  else {
138  nuc->SetPhi(90.);
139  }
140 
141  nuc->SetExcitEnergy(excitation_energy_targ_like);
142  nuc->SetSpin(spin_targ_like, 0., 0.); // Spin component given by the model is normal to the reaction plane, this last being (YZ), thus the spin is on the X-axis
143  }
144  //
145  // Add parameters to event
146  evt->SetParameter("weight", weight);
147  evt->SetParameter("inicident_partial_wave", inicident_partial_wave);
148  evt->SetParameter("impact_parameter", impact_parameter);
149  evt->SetParameter("itype", itype);
150  evt->SetParameter("theta_cm", theta_cm);
151  evt->SetParameter("q_reaction", q_reaction);
152  evt->SetParameter("k_n", k_n);
153  evt->SetParameter("k_p", k_p);
154  evt->SetParameter("min_dist", min_dist);
155 }
156 
157 
158 
159 
161 
162 void KVSimReader_DIT::InitReader()
163 {
164  SetTreeName("DIT");
165  SetTreeTitle("dit_events");
166  SetBranchName("DITKVSimEvents");
167  SetROOTFileName(Form("DIT_%s+%s@%.1fMeV", projectile.Data(), target.Data(), energy));
168 }
169 
170 
171 
172 
178 
179 void KVSimReader_DIT::SkipFirstLine()
180 {
181  //
182  // Skip first line of the file events.dat, which should be :
183  // WEIGHT/F:ANGM0:IMPAR:ITYPE/I:A[2]:Z[2]:EX[2]/F:SPIN[2]:ELAB[2]:THETA[2]:THCM:Q:KN/I:KP:SMIN/F
184  //
185  ReadLine(0);
186  Info("SkipFirstLine", "Skipping firt line of simulated data file!");
187 }
188 
189 
190 //____________________________________________________________________________//
191 
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
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 winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
char * Form(const char *fmt,...)
virtual void SetNumber(UInt_t num)
Definition: KVBase.h:224
void SetParameter(const Char_t *name, ValType value) const
Definition: KVEvent.h:198
@ 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: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
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
Definition: KVNucleus.cpp:726
Container class for simulated nuclei, KVSimNucleus.
Definition: KVSimEvent.h:22
Read and convert to KaliVeda format outputs from DIT.
Bool_t ReadFileHeader() override
Bool_t ReadEvent(KVSimEvent *) override
Base class to convert output from different simulation codes into TTrees containing KVSimEvent event ...
Definition: KVSimReader.h:117
void SetROOTFileName(KVString name)
Definition: KVSimReader.h:247
void SetTreeTitle(KVString n)
Definition: KVSimReader.h:237
void SetBranchName(KVString n)
Definition: KVSimReader.h:256
int GetEventNumber() const
Definition: KVSimReader.h:190
void SetTreeName(KVString n)
Definition: KVSimReader.h:232
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
Particle * AddParticle()
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
Double_t Abs(Double_t d)
ClassImp(TPyArg)