KaliVeda
Toolkit for HIC analysis
StatWeight.cpp
1 //Created by KVClassFactory on Thu May 7 11:00:37 2015
2 //Author: John Frankland,,,
3 
4 #include "StatWeight.h"
5 #include "KVNucleusEvent.h"
6 
8 
9 namespace MicroStat {
10 
11 
14 
16  {
17  // Default initialisations
18 
19  fWeight = 0;
20  }
21 
22 
23 
26 
28  {
29  // Default constructor
30  init();
31  }
32 
33 
34 
35 
38 
40  {
41  // Destructor
42  }
43 
44 
45 
47 
48  void StatWeight::ls(Option_t*) const
49  {
50  std::cout << ClassName() << " index = " << GetIndex() <<
51  " available energy = " << GetAvailableEnergy() <<
52  " weight = " << GetWeight() << std::endl;
53  }
54 
55 
56 
59 
60  Int_t StatWeight::Compare(const TObject* obj) const
61  {
62  // sort according to weight
63 
64  Double_t w = ((StatWeight*)obj)->GetWeight();
65  if (w < fWeight) return -1;
66  return (w == fWeight ? 0 : 1);
67  }
68 
69 
70 
78 
80  {
81  // Generate a full kinematical event using the statistical weight
82  // for the given partition with given available kinetic energy.
83  // Before calling this method, either call
84  // initGenerateEvent(...) // the first time, or
85  // resetGenerateEvent(...) // on subsequent calls
86 
87  // initialise the event
88  event->Clear();
89  Int_t mult = 0;
90 
91  for (auto& part : EventIterator(partition)) {
92  event->AddNucleus()->SetZandA(part.GetZ(), part.GetA());
93  ++mult;
94  }
95 
96  // generate momenta
97  for (auto& part : EventIterator(event)) {
98  nextparticleGenerateEvent(mult, &part);
99  --mult;
100  }
101  }
102 
103 
104 }/* namespace MicroStat */
105 
106 
int Int_t
double Double_t
const char Option_t
winID w
Class for iterating over nuclei in events accessed through base pointer/reference.
Abstract base class container for multi-particle events.
Definition: KVEvent.h:67
Abstract base class for calculating statistical weights for events .
Definition: StatWeight.h:21
StatWeight()
Default constructor.
Definition: StatWeight.cpp:27
void init()
Default initialisations.
Definition: StatWeight.cpp:15
void GenerateEvent(KVEvent *partition, KVEvent *event)
Definition: StatWeight.cpp:79
virtual ~StatWeight()
Destructor.
Definition: StatWeight.cpp:39
Double_t GetAvailableEnergy() const
Definition: StatWeight.h:48
void ls(Option_t *="") const
Definition: StatWeight.cpp:48
Int_t Compare(const TObject *obj) const
sort according to weight
Definition: StatWeight.cpp:60
Double_t GetWeight() const
Definition: StatWeight.h:44
virtual void nextparticleGenerateEvent(Int_t, KVNucleus *)=0
Long64_t GetIndex() const
Definition: StatWeight.h:57
virtual const char * ClassName() const
ClassImp(TPyArg)