KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
MCSampler.h
Go to the documentation of this file.
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 
21  class MCSampler : public KVBase {
22  private:
23  void init();
27 
28  void SetBranch(TTree* theTree, const TString& name, void* variable, const TString& vartype);
29 
30  protected:
41 
43 
44  void initialiseWeightList();
45 
46  public:
47  MCSampler();
48  MCSampler(const Char_t* name, const Char_t* title = "");
49  virtual ~MCSampler();
50 
51  void SetEventList(TTree* t, const TString& branchname);
52  void SetStatWeight(const TString&);
53 
55  {
57 
58  fBranch->GetEntry(i);
59  return fPartition;
60  }
61  void SetModifyMasses(Bool_t yes = kTRUE)
62  {
63  fModifyMasses = yes;
64  }
65  void UpdateMasses();
66 
67  void CalculateWeights(Double_t excitation_energy);
69  {
70  return fWeightList;
71  }
73  {
74  return (StatWeight*)(*fWeightList)[i];
75  }
77  {
78  return fSumWeights;
79  }
80 
83  {
84  return fLastPicked;
85  }
86 
87  void SetUpTreeBranches(KVEvent*& event, TTree* theTree, const TString& bname);
88  void GenerateEvents(TTree*, KVEvent* event, Double_t, Long64_t npartitions, Long64_t nev_part = 10);
91  void GenerateEvent(TTree* theTree, KVEvent* event);
92 
93  void PlotMultiplicities(double emin = 0., double emax = 100., double estep = 1., Option_t* opt = "");
94  void PlotProbabilities(double emin = 0., double emax = 100., double estep = 1., Option_t* opt = "");
96  {
102  fLegendProbaMin = p;
103  };
105  {
106  return fLegendProbaMin;
107  };
108  void ShowLegend()
109  {
115  if (fTheLegend) fTheLegend->Draw();
116  };
117 
118  ClassDef(MCSampler, 1) //Monte-Carlo sampling of events with statistical weights
119  };
120 
121 }
122 #endif
int Int_t
char Char_t
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:141
Abstract base class container for multi-particle events.
Definition: KVEvent.h:66
Monte-Carlo sampling of events with statistical weights .
Definition: MCSampler.h:21
virtual ~MCSampler()
Destructor.
Definition: MCSampler.cpp:71
Bool_t fModifyMasses
the partition index
Definition: MCSampler.h:42
KVEvent * fPartition
branch containing events
Definition: MCSampler.h:33
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:25
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:38
TLegend * fTheLegend
minimum probability for which channels are included in automatically generated TLegend when PlotProba...
Definition: MCSampler.h:26
void initialiseWeightList()
if nuclear masses are modified
Definition: MCSampler.cpp:36
StatWeight * GetWeight(Int_t i) const
Definition: MCSampler.h:72
void SetUpTreeBranches(KVEvent *&event, TTree *theTree, const TString &bname)
Definition: MCSampler.cpp:219
Double_t EDISP
the excitation energy (Exx)
Definition: MCSampler.h:39
Long64_t IPART
the available kinetic energy
Definition: MCSampler.h:40
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:24
void SetLegendProbaMin(Double_t p)
Definition: MCSampler.h:95
TClonesArray * fWeightList
statistical weight class
Definition: MCSampler.h:35
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:36
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:54
Double_t GetLegendProbaMin() const
Definition: MCSampler.h:104
void SetModifyMasses(Bool_t yes=kTRUE)
Definition: MCSampler.h:61
void init()
default initialisations
Definition: MCSampler.cpp:21
void SetStatWeight(const TString &)
Definition: MCSampler.cpp:102
StatWeight * GetRandomChannelWeight() const
Definition: MCSampler.h:82
Long64_t fPartitions
Definition: MCSampler.h:31
void GenerateEvent(TTree *theTree, KVEvent *event)
Definition: MCSampler.cpp:341
TBranch * fBranch
number of partitions in TTree/TChain
Definition: MCSampler.h:32
TClass * fWeight
event read from fPartitionList tree
Definition: MCSampler.h:34
TClonesArray * GetWeights() const
Definition: MCSampler.h:68
Double_t GetSumWeights() const
Definition: MCSampler.h:76
Abstract base class for calculating statistical weights for events .
Definition: StatWeight.h:20
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
virtual void Draw(Option_t *option="")
long long Long64_t