KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimEvent.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Wed Jun 30 15:10:22 2010
2 //Author: bonnet
3 
4 #include "KVSimEvent.h"
5 
6 #include <KVSimNucleus.h>
7 using namespace std;
8 
10 
11 
12 
13 
17 void KVSimEvent::Print(Option_t* t) const
18 {
19  //Print a list of all particles in the event with some characteristics.
20  //Optional argument t can be used to select particles (="ok", "groupname", ...)
21 
22  cout << "\nKVSimEvent with " << GetMult(t) << " particles :" << endl;
23  cout << "------------------------------------" << endl;
24  fParameters.Print();
25  KVSimNucleus* frag = 0;
26  for (auto it = GetNextParticleIterator(t); it != end(); ++it) {
27  (*it).Print();
28  cout << " Position: (" << (*it).GetPosition().x() << "," << (*it).GetPosition().y() << "," << (*it).GetPosition().z() << ")" << endl;
29  }
30 
31 }
32 
33 
34 
38 
40 {
41  // Calculate total Coulomb potential energy of all particles in event
42  // Units are MeV.
43 
44  Double_t Vtot = 0;
45  for (KVSimEvent::Iterator it = begin(); it != end(); ++it) {
46  KVSimEvent::Iterator it2(it);
47  for (++it2; it2 != end(); ++it2) {
48  TVector3 D12 = (*it).GetPosition() - (*it2).GetPosition();
49  Vtot += (*it).GetZ() * (*it2).GetZ() * KVNucleus::e2 / D12.Mag();
50  }
51  }
52  return Vtot;
53 
54 }
55 
56 
61 
62 void KVSimEvent::Streamer(TBuffer& R__b)
63 {
64  //Stream an object of class KVReconstructedEvent.
65  //We set the particles' angles depending on whether mean or random angles
66  //are wanted (fMeanAngles = kTRUE or kFALSE)
67 
68  if (R__b.IsReading()) {
69  UInt_t R__s, R__c;
70  UInt_t R__v = R__b.ReadVersion(&R__s, &R__c);
71  if (R__v < 5) {
72  // all versions written with automatic streamer
73  // (version is not read correctly from TTree branches)
74  Clear();
75  KVBase::Streamer(R__b);
76  fParticles->Streamer(R__b);
77  fParameters.Streamer(R__b);
78  }
79  else
80  R__b.ReadClassBuffer(KVSimEvent::Class(), this, R__v, R__s, R__c);
81  }
82  else {
83  R__b.WriteClassBuffer(KVSimEvent::Class(), this);
84  }
85 }
86 
87 
unsigned int UInt_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
double Double_t
const char Option_t
static Double_t e2
e^2/(4.pi.epsilon_0) in MeV.fm
Definition: KVNucleus.h:173
Container class for simulated nuclei, KVSimNucleus.
Definition: KVSimEvent.h:21
Double_t GetTotalCoulombEnergy() const
Definition: KVSimEvent.cpp:39
virtual void Print(Option_t *t="") const
Definition: KVSimEvent.cpp:17
Nucleus in a simulated event.
Definition: KVSimNucleus.h:31
void Print(Option_t *t="") const
Display nucleus parameters.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
Bool_t IsReading() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Double_t Mag() const