KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
StatWeight.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Thu May 7 11:00:37 2015
2 //Author: John Frankland,,,
3 
4 #include "StatWeight.h"
5 
7 
8 namespace MicroStat {
9 
10 
13 
15  {
16  // Default initialisations
17 
18  fWeight = 0;
19  }
20 
21 
22 
25 
27  {
28  // Default constructor
29  init();
30  }
31 
32 
33 
34 
37 
39  {
40  // Destructor
41  }
42 
43 
44 
46 
47  void StatWeight::ls(Option_t*) const
48  {
49  std::cout << ClassName() << " index = " << GetIndex() <<
50  " available energy = " << GetAvailableEnergy() <<
51  " weight = " << GetWeight() << std::endl;
52  }
53 
54 
55 
58 
59  Int_t StatWeight::Compare(const TObject* obj) const
60  {
61  // sort according to weight
62 
63  Double_t w = ((StatWeight*)obj)->GetWeight();
64  if (w < fWeight) return -1;
65  return (w == fWeight ? 0 : 1);
66  }
67 
68 
69 
77 
79  {
80  // Generate a full kinematical event using the statistical weight
81  // for the given partition with given available kinetic energy.
82  // Before calling this method, either call
83  // initGenerateEvent(...) // the first time, or
84  // resetGenerateEvent(...) // on subsequent calls
85 
86  // initialise the event
87  event->Clear();
88  Int_t mult = 0;
89  KVNucleus* part;
90  while ((part = partition->GetNextParticle())) {
91  event->AddParticle()->SetZandA(part->GetZ(), part->GetA());
92  ++mult;
93  }
94 
95  // generate momenta
96  while ((part = event->GetNextParticle())) {
97  nextparticleGenerateEvent(mult, part);
98  --mult;
99  }
100  }
101 
102 
103 }/* namespace MicroStat */
104 
105 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
double Double_t
const char Option_t
Base class container for multi-particle events.
Definition: KVEvent.h:176
KVNucleus * GetNextParticle(Option_t *opt="") const
Definition: KVEvent.cpp:564
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:125
Int_t GetA() const
Definition: KVNucleus.cpp:799
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
Definition: KVNucleus.cpp:721
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:770
Abstract base class for calculating statistical weights for events .
Definition: StatWeight.h:17
StatWeight()
Default constructor.
Definition: StatWeight.cpp:26
void init()
Default initialisations.
Definition: StatWeight.cpp:14
void GenerateEvent(KVEvent *partition, KVEvent *event)
Definition: StatWeight.cpp:78
virtual ~StatWeight()
Destructor.
Definition: StatWeight.cpp:38
Double_t GetAvailableEnergy() const
Definition: StatWeight.h:44
void ls(Option_t *="") const
Definition: StatWeight.cpp:47
Int_t Compare(const TObject *obj) const
sort according to weight
Definition: StatWeight.cpp:59
Double_t GetWeight() const
Definition: StatWeight.h:40
virtual void nextparticleGenerateEvent(Int_t, KVNucleus *)=0
Long64_t GetIndex() const
Definition: StatWeight.h:53
virtual const char * ClassName() const