KaliVeda
Toolkit for HIC analysis
MCSampler.h
1 
4 #ifndef __MCSAMPLER_H
5 #define __MCSAMPLER_H
6 
7 #include "KVBase.h"
8 #include "KVNucleusEvent.h"
9 #include "TTree.h"
10 #include "TLegend.h"
11 #include "StatWeight.h"
12 
13 namespace MicroStat {
14 
22  class MCSampler : public KVBase {
23  private:
24  void init();
28 
29  void SetBranch(TTree* theTree, const TString& name, void* variable, const TString& vartype);
30 
31  protected:
42 
44 
45  void initialiseWeightList();
46 
47  public:
48  MCSampler();
49  MCSampler(const Char_t* name, const Char_t* title = "");
50  virtual ~MCSampler();
51 
52  void SetEventList(TTree* t, const TString& branchname);
53  void SetStatWeight(const TString&);
54 
56  {
58 
59  fBranch->GetEntry(i);
60  return fPartition;
61  }
62  void SetModifyMasses(Bool_t yes = kTRUE)
63  {
64  fModifyMasses = yes;
65  }
66  void UpdateMasses();
67 
68  void CalculateWeights(Double_t excitation_energy);
70  {
71  return fWeightList;
72  }
74  {
75  return (StatWeight*)(*fWeightList)[i];
76  }
78  {
79  return fSumWeights;
80  }
81 
84  {
85  return fLastPicked;
86  }
87 
88  void SetUpTreeBranches(KVEvent*& event, TTree* theTree, const TString& bname);
89  void GenerateEvents(TTree*, KVEvent* event, Double_t, Long64_t npartitions, Long64_t nev_part = 10);
92  void GenerateEvent(TTree* theTree, KVEvent* event);
93 
94  void PlotMultiplicities(double emin = 0., double emax = 100., double estep = 1., Option_t* opt = "");
95  void PlotProbabilities(double emin = 0., double emax = 100., double estep = 1., Option_t* opt = "");
97  {
103  fLegendProbaMin = p;
104  };
106  {
107  return fLegendProbaMin;
108  };
109  void ShowLegend()
110  {
116  if (fTheLegend) fTheLegend->Draw();
117  };
118 
119  ClassDef(MCSampler, 1) //Monte-Carlo sampling of events with statistical weights
120  };
121 
122 }
123 #endif
int Int_t
bool Bool_t
char Char_t
double Double_t
const char Option_t
#define ClassDef(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Base class for KaliVeda framework.
Definition: KVBase.h:142
Abstract base class container for multi-particle events.
Definition: KVEvent.h:67
Monte-Carlo sampling of events with statistical weights .
Definition: MCSampler.h:22
virtual ~MCSampler()
Destructor.
Definition: MCSampler.cpp:71
Bool_t fModifyMasses
the partition index
Definition: MCSampler.h:43
KVEvent * fPartition
branch containing events
Definition: MCSampler.h:34
void PlotProbabilities(double emin=0., double emax=100., double estep=1., Option_t *opt="")
Definition: MCSampler.cpp:372
Double_t fLegendProbaMin
weight of channel picked by call to PickRandomChannel()
Definition: MCSampler.h:26
Bool_t SetDecayChannel()
Definition: MCSampler.cpp:312
void PlotMultiplicities(double emin=0., double emax=100., double estep=1., Option_t *opt="")
Definition: MCSampler.cpp:469
MCSampler()
Default constructor.
Definition: MCSampler.cpp:48
void SetBranch(TTree *theTree, const TString &name, void *variable, const TString &vartype)
automatically generated legend for PlotProbabilities
Definition: MCSampler.cpp:198
Double_t ESTAR
variables for TTree branches
Definition: MCSampler.h:39
TLegend * fTheLegend
minimum probability for which channels are included in automatically generated TLegend when PlotProba...
Definition: MCSampler.h:27
void initialiseWeightList()
if nuclear masses are modified
Definition: MCSampler.cpp:36
StatWeight * GetWeight(Int_t i) const
Definition: MCSampler.h:73
void SetUpTreeBranches(KVEvent *&event, TTree *theTree, const TString &bname)
Definition: MCSampler.cpp:219
Double_t EDISP
the excitation energy (Exx)
Definition: MCSampler.h:40
Long64_t IPART
the available kinetic energy
Definition: MCSampler.h:41
void SetEventList(TTree *t, const TString &branchname)
Define the TTree or TChain containing all possible events (partitions).
Definition: MCSampler.cpp:83
StatWeight * fLastPicked
Definition: MCSampler.h:25
void SetLegendProbaMin(Double_t p)
Definition: MCSampler.h:96
TClonesArray * fWeightList
statistical weight class
Definition: MCSampler.h:36
void GenerateEvents(TTree *, KVEvent *event, Double_t, Long64_t npartitions, Long64_t nev_part=10)
Definition: MCSampler.cpp:252
Bool_t SetExcitationEnergy(Double_t Exx)
Definition: MCSampler.cpp:294
Double_t fSumWeights
list of weights for all events
Definition: MCSampler.h:37
Long64_t PickRandomChannel()
Definition: MCSampler.cpp:169
void CalculateWeights(Double_t excitation_energy)
Definition: MCSampler.cpp:133
KVEvent * GetPartition(Long64_t i)
Definition: MCSampler.h:55
Double_t GetLegendProbaMin() const
Definition: MCSampler.h:105
void SetModifyMasses(Bool_t yes=kTRUE)
Definition: MCSampler.h:62
void init()
default initialisations
Definition: MCSampler.cpp:21
void SetStatWeight(const TString &)
Definition: MCSampler.cpp:102
StatWeight * GetRandomChannelWeight() const
Definition: MCSampler.h:83
Long64_t fPartitions
Definition: MCSampler.h:32
void GenerateEvent(TTree *theTree, KVEvent *event)
Definition: MCSampler.cpp:341
TBranch * fBranch
number of partitions in TTree/TChain
Definition: MCSampler.h:33
TClass * fWeight
event read from fPartitionList tree
Definition: MCSampler.h:35
TClonesArray * GetWeights() const
Definition: MCSampler.h:69
Double_t GetSumWeights() const
Definition: MCSampler.h:77
Abstract base class for calculating statistical weights for events .
Definition: StatWeight.h:21
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
void Draw(Option_t *option="") override
long long Long64_t