8 #include "KVNucleusEvent.h"
27 SetConditions(0, 0, 0);
31 RedefineTRandom(
"TRandom3");
33 BreakUpMethod =
"BreakUsingChain";
34 SetBreakUpMethod(BreakUpMethod);
37 lhisto->SetOwner(
kTRUE);
39 hzz =
new TH1F(
"KVBreakUp_hzz",
"distri z", 200, -0.5, 199.5);
44 lobjects->SetOwner(
kTRUE);
49 tstart = tstop = tellapsed = 0;
69 size_max = taille_max;
88 if (bound)
delete [] bound;
92 if ((
c1 = (
TCanvas*)
gROOT->GetListOfCanvases()->FindObject(
"BreakUp_Control")))
delete c1;
108 ResetTotalIterations();
126 hzt =
new TH1F(
"KVBreakUp_hzt",
"h ztotal", 200, -0.5, 199.5);
128 hmt =
new TH1F(
"KVBreakUp_hmt",
"h mtotal", 200, -0.5, 199.5);
143 if (bound)
delete bound;
144 bound =
new Int_t[Ztotal];
145 for (
Int_t nn = 0; nn < Ztotal; nn += 1) bound[nn] = 1;
146 nbre_nuc = Ztotal - Mtotal * Zmin;
159 Error(
"SetMtot",
"%d -> La multiplicite max (%d) est depassee", mt, size_max);
163 nbre_nuc = Ztotal - Mtotal * Zmin;
176 nbre_nuc = Ztotal - Mtotal * Zmin;
188 BreakUpMethod = bup_method;
199 if (current_event)
delete current_event;
217 if (alea)
delete alea;
249 if (bup_method ==
"") {
250 Info(
"DefineBreakUpMethod",
"Available methods are");
251 cout <<
"BreakUsingChain" << endl;
252 cout <<
"BreakUsingPile" << endl;
253 cout <<
"BreakUsingIndividual" << endl;
254 cout <<
"BreakUsingLine" << endl;
255 cout <<
"Make your choice" << endl;
258 SetBreakUpMethod(bup_method);
307 return BreakUpMethod;
319 SetBit(kStorePartitions, choix);
336 for (
Int_t mm = 0; mm < Mtotal; mm += 1) {
342 Int_t Ztotal_corr = Ztotal - (Zmin - 1) * Mtotal;
347 while (mtire < Mtotal) {
349 bb =
TMath::Nint(alea->Uniform(0, (Ztotal_corr) - 0.5));
351 if (bound[bb] == 1) {
360 IntArray val = nl.GetArray();
361 Int_t mtot_corr = val.size();
366 for (
Int_t ii = 1; ii < mtot_corr; ii += 1) {
367 taille = val[ii] - val[ii - 1];
373 taille = Ztotal_corr - val[mtot_corr - 1] + val[0];
381 if (zc == Ztotal && mtot_corr == Mtotal)
return 1;
399 for (
Int_t mm = 0; mm < Mtotal; mm += 1) {
405 Int_t Ztotal_corr = Ztotal - (Zmin - 1) * Mtotal;
410 while (mtire < Mtotal - 1) {
412 bb =
TMath::Nint(alea->Uniform(1, (Ztotal_corr - 1) - 0.5));
414 if (bound[bb] == 1) {
429 IntArray val = nl.GetArray();
430 Int_t mtot_corr = val.size();
435 for (
Int_t ii = 1; ii < mtot_corr; ii += 1) {
436 taille = val[ii] - val[ii - 1];
438 size[ii - 1] += taille;
439 hzz->Fill(
size[ii - 1]);
445 if (zc == Ztotal && mtot_corr - 1 == Mtotal)
return 1;
463 for (
Int_t mm = 0; mm < Mtotal; mm += 1) {
469 Int_t Ztotal_corr = Ztotal - (Zmin) * Mtotal;
472 for (
Int_t mm = 0; mm < Mtotal; mm += 1) {
474 val[mm] = alea->Uniform(0, 1);
478 Int_t surplus[Mtotal];
480 for (
Int_t mm = 0; mm < Mtotal; mm += 1) {
481 surplus[mm] =
TMath::Nint(val[mm] * Ztotal_corr / sum_val);
486 if (zc != Ztotal_corr) {
487 Int_t diff = Ztotal_corr - zc;
492 bb =
TMath::Nint(alea->Uniform(0, (Mtotal) - 0.5));
498 bb =
TMath::Nint(alea->Uniform(0, (Mtotal) - 0.5));
507 for (
Int_t mm = 0; mm < Mtotal; mm += 1) {
508 size[mm] += surplus[mm];
513 if (zc == Ztotal)
return 1;
528 for (
Int_t mm = 0; mm < Mtotal; mm += 1) {
533 for (
Int_t mm = 0; mm < nbre_nuc; mm += 1) {
534 bb =
TMath::Nint(alea->Uniform(0, (Mtotal) - 0.5));
538 Int_t mc = 0, zc = 0;
539 for (
Int_t mm = 0; mm < Mtotal; mm += 1) {
545 if (mc == Mtotal && zc == Ztotal)
return 1;
574 partition->Fill(
size, Mtotal);
575 Int_t* tab = partition->CreateTableOfValues();
577 current_event->Clear();
578 for (
Int_t ii = 0; ii < Mtotal; ii += 1)
579 current_event->AddNucleus()->SetZ(tab[ii]);
583 if (TestBit(kStorePartitions)) {
600 return current_event;
629 for (
Int_t nn = 0; nn < times; nn += 1) {
630 if (nn % 10000 == 0)
Info(
"BreakNtimes",
"%d partitions generees sur %d", nn, times);
635 Info(
"BreakNtimes",
"%s retourne %ld", BreakUpMethod.Data(), ret);
640 Info(
"BreakNtimes",
"Tirage termine");
644 Info(
"BreakNtimes",
"Temps ecoule en secondes : %d", GetDeltaTime());
680 for (
Int_t nn = 0; nn < times; nn += 1) {
681 if (nn % 1000 == 0) printf(
"%d partitions generees sur %d\n", nn, times);
686 if (mt > 0 && zt > 0 && zt >= mt * zmin) {
687 SetConditions(zt, mt, zmin);
704 Info(
"BreakNtimesOnGaussian",
"Temps ecoule en secondes : %d", GetDeltaTime());
734 while (!(mt > 0 && zt > 0 && zt >= mt * zmin)) {
739 SetConditions(zt, mt, zmin);
743 return current_event;
783 TH2F* h2 = hh_zt_VS_mt;
801 if (mt > 0 && zt > 0 && zt >= mt * zmin) {
803 SetConditions(zt, mt, zmin);
804 for (
Int_t nn = 0; nn < stat; nn += 1) {
809 if (stat_par % 1000 == 0) printf(
"%d partitions generees sur %d\n", stat_par, stat_tot);
813 cout << zt <<
" " << mt << endl;
818 niter_tot += stat_par;
821 Info(
"BreakNtimesFromHisto",
"Temps ecoule en secondes : %d", GetDeltaTime());
885 lhisto->Execute(
"Reset",
"");
901 if (!(
c1 = (
TCanvas*)
gROOT->GetListOfCanvases()->FindObject(
"BreakUp_Control"))) {
903 c1 =
new TCanvas(
"BreakUp_Control",
"Control", 0, 0, 900, 900);
904 c1->Divide(2, 2, 0.001, 0.001, 10);
906 if (hzz->GetEntries() > 0)
gPad->SetLogy(1);
909 if (hzt->GetEntries() > 0)
gPad->SetLogy(1);
912 if (hmt->GetEntries() > 0)
gPad->SetLogy(1);
946 suff.
Form(
"Zt%d_Mt%d_Zm%d_%s", GetZtot(), GetMtot(), GetZmin(), GetBreakUpMethod().Data());
949 for (
Int_t nn = 0; nn < lhisto->GetEntries(); nn += 1) {
950 snom.
Form(
"%s_%s", lhisto->At(nn)->GetName(), suff.
Data());
951 lhisto->At(nn)->Write(snom.
Data());
970 Info(
"Print",
"Configuration for the break up");
971 printf(
" Ztot=%d - Mtot=%d - Zmin=%d\n", GetZtot(), GetMtot(), GetZmin());
972 printf(
" Charge to be distributed %d - Biggest possible charge %d\n", nbre_nuc, Zmin + nbre_nuc);
973 printf(
" Methode de cassage aleatoire %s\n", GetBreakUpMethod().Data());
975 printf(
" Partition are stored via KVPartitionList : %d\n",
Int_t(TestBit(kStorePartitions)));
976 printf(
"------------------------------------------------------");
1006 tellapsed = tstop - tstart;
size_t size(const MatrixT &matrix)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
TClass * IsA() const override
Permet de casser aleatoirement un nombre entier (ztot) en un nombre (mtot) d'entiers plus petits d'un...
void BreakFromHisto(TH2F *hh_zt_VS_mt, Int_t zmin=1)
virtual void SaveHistos(KVString filename="", KVString suff="", Option_t *option="recreate")
Int_t GetTotalIterations(void)
KVEvent * BreakOnGaussian(Double_t Ztot_moy, Double_t Ztot_rms, Double_t Mtot_moy, Double_t Mtot_rms, Int_t zmin)
virtual void ResetHistos()
Met a zero le contenu des histogrammes.
void DefineBreakUpMethod(KVString bup_method="")
virtual void TreatePartition()
Int_t GetZtot(void) const
Retourne le nombre entier a casser.
void Clear(Option_t *="") override
KVHashList * GetObjects()
Retourne la liste d'objects autres ...
virtual ~KVBreakUp()
Destructeur.
void SetZmin(Int_t zlim)
Protected method.
KVString GetBreakUpMethod(void) const
Retourne methode de cassure.
Int_t BreakUsingPile()
Methode de cassure.
Int_t BreakUsingIndividual()
void StorePartitions(Bool_t choix=kTRUE)
si choix=kTRUE, on enregistre les partitions
void LinkEvent(KVEvent *)
void BreakNtimes(Int_t times=1000)
KVEvent * GetCurrentEvent()
void BreakNtimesOnGaussian(Int_t times, Double_t Ztot_moy, Double_t Ztot_rms, Double_t Mtot_moy, Double_t Mtot_rms, Int_t zmin=1)
KVBreakUp(Int_t taille_max=1000)
void SetZtot(Int_t zt)
Protected method.
Int_t GetZmin(void) const
Retourne la taille minimale des entiers apres cassure.
void SetConditions(Int_t zt, Int_t mt, Int_t zmin=1)
void RedefineTRandom(KVString TRandom_Method)
virtual void ResetTotalIterations()
Int_t GetMtot(void) const
Retourne le nombre d'entiers apres cassure (la multiplicite)
virtual void DefineHistos()
void SetMtot(Int_t mt)
Protected method.
void SetBreakUpMethod(KVString bup_method)
Protected method.
Abstract base class container for multi-particle events.
static KVEvent * Factory(const char *plugin)
Extended version of ROOT THashList.
Handle a list of positive integers (partition)
void Clear(Option_t *option="") override
Mise a zero de la liste.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
virtual Double_t GetBinCenter(Int_t bin) const
virtual Int_t GetNbinsY() const
virtual Int_t GetNbinsX() const
virtual Double_t Integral(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Option_t *option="") const
virtual Double_t GetBinContent(Int_t bin) const
static const EReturnType kLong
void InitWithPrototype(const char *function, const char *proto, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
const char * Data() const
void Form(const char *fmt,...)