26 SetConditions(0, 0, 0);
30 RedefineTRandom(
"TRandom3");
32 BreakUpMethod =
"BreakUsingChain";
33 SetBreakUpMethod(BreakUpMethod);
36 lhisto->SetOwner(
kTRUE);
38 hzz =
new TH1F(
"KVBreakUp_hzz",
"distri z", 200, -0.5, 199.5);
43 lobjects->SetOwner(
kTRUE);
48 tstart = tstop = tellapsed = 0;
68 size_max = taille_max;
87 if (bound)
delete [] bound;
91 if ((
c1 = (
TCanvas*)
gROOT->GetListOfCanvases()->FindObject(
"BreakUp_Control")))
delete c1;
107 ResetTotalIterations();
125 hzt =
new TH1F(
"KVBreakUp_hzt",
"h ztotal", 200, -0.5, 199.5);
127 hmt =
new TH1F(
"KVBreakUp_hmt",
"h mtotal", 200, -0.5, 199.5);
142 if (bound)
delete bound;
143 bound =
new Int_t[Ztotal];
144 for (
Int_t nn = 0; nn < Ztotal; nn += 1) bound[nn] = 1;
145 nbre_nuc = Ztotal - Mtotal * Zmin;
158 Error(
"SetMtot",
"%d -> La multiplicite max (%d) est depassee", mt, size_max);
162 nbre_nuc = Ztotal - Mtotal * Zmin;
175 nbre_nuc = Ztotal - Mtotal * Zmin;
187 BreakUpMethod = bup_method;
198 if (current_event)
delete current_event;
216 if (alea)
delete alea;
248 if (bup_method ==
"") {
249 Info(
"DefineBreakUpMethod",
"Available methods are");
250 cout <<
"BreakUsingChain" << endl;
251 cout <<
"BreakUsingPile" << endl;
252 cout <<
"BreakUsingIndividual" << endl;
253 cout <<
"BreakUsingLine" << endl;
254 cout <<
"Make your choice" << endl;
257 SetBreakUpMethod(bup_method);
306 return BreakUpMethod;
318 SetBit(kStorePartitions, choix);
341 Int_t Ztotal_corr = Ztotal - (Zmin - 1) * Mtotal;
346 while (mtire < Mtotal) {
348 bb =
TMath::Nint(alea->Uniform(0, (Ztotal_corr) - 0.5));
350 if (bound[bb] == 1) {
360 Int_t mtot_corr = val.size();
365 for (
Int_t ii = 1; ii < mtot_corr; ii += 1) {
366 taille = val[ii] - val[ii - 1];
372 taille = Ztotal_corr - val[mtot_corr - 1] + val[0];
380 if (zc == Ztotal && mtot_corr == Mtotal)
return 1;
404 Int_t Ztotal_corr = Ztotal - (Zmin - 1) * Mtotal;
409 while (mtire < Mtotal - 1) {
411 bb =
TMath::Nint(alea->Uniform(1, (Ztotal_corr - 1) - 0.5));
413 if (bound[bb] == 1) {
429 Int_t mtot_corr = val.size();
434 for (
Int_t ii = 1; ii < mtot_corr; ii += 1) {
435 taille = val[ii] - val[ii - 1];
437 size[ii - 1] += taille;
438 hzz->Fill(
size[ii - 1]);
444 if (zc == Ztotal && mtot_corr - 1 == Mtotal)
return 1;
468 Int_t Ztotal_corr = Ztotal - (Zmin) * Mtotal;
473 val[
mm] = alea->Uniform(0, 1);
477 Int_t surplus[Mtotal];
485 if (zc != Ztotal_corr) {
486 Int_t diff = Ztotal_corr - zc;
491 bb =
TMath::Nint(alea->Uniform(0, (Mtotal) - 0.5));
497 bb =
TMath::Nint(alea->Uniform(0, (Mtotal) - 0.5));
512 if (zc == Ztotal)
return 1;
533 bb =
TMath::Nint(alea->Uniform(0, (Mtotal) - 0.5));
537 Int_t mc = 0, zc = 0;
544 if (mc == Mtotal && zc == Ztotal)
return 1;
573 partition->Fill(
size, Mtotal);
574 Int_t* tab = partition->CreateTableOfValues();
576 current_event->Clear();
577 for (
Int_t ii = 0; ii < Mtotal; ii += 1)
578 current_event->AddParticle()->SetZ(tab[ii]);
582 if (TestBit(kStorePartitions)) {
599 return current_event;
628 for (
Int_t nn = 0; nn < times; nn += 1) {
629 if (nn % 10000 == 0)
Info(
"BreakNtimes",
"%d partitions generees sur %d", nn, times);
634 Info(
"BreakNtimes",
"%s retourne %ld", BreakUpMethod.Data(), ret);
639 Info(
"BreakNtimes",
"Tirage termine");
643 Info(
"BreakNtimes",
"Temps ecoule en secondes : %d", GetDeltaTime());
679 for (
Int_t nn = 0; nn < times; nn += 1) {
680 if (nn % 1000 == 0) printf(
"%d partitions generees sur %d\n", nn, times);
685 if (mt > 0 && zt > 0 && zt >= mt * zmin) {
686 SetConditions(zt, mt, zmin);
703 Info(
"BreakNtimesOnGaussian",
"Temps ecoule en secondes : %d", GetDeltaTime());
733 while (!(mt > 0 && zt > 0 && zt >= mt * zmin)) {
738 SetConditions(zt, mt, zmin);
742 return current_event;
782 TH2F* h2 = hh_zt_VS_mt;
800 if (mt > 0 && zt > 0 && zt >= mt * zmin) {
802 SetConditions(zt, mt, zmin);
803 for (
Int_t nn = 0; nn < stat; nn += 1) {
808 if (stat_par % 1000 == 0) printf(
"%d partitions generees sur %d\n", stat_par, stat_tot);
812 cout << zt <<
" " << mt << endl;
817 niter_tot += stat_par;
820 Info(
"BreakNtimesFromHisto",
"Temps ecoule en secondes : %d", GetDeltaTime());
886 lhisto->Execute(
"Reset",
"");
902 if (!(
c1 = (
TCanvas*)
gROOT->GetListOfCanvases()->FindObject(
"BreakUp_Control"))) {
904 c1 =
new TCanvas(
"BreakUp_Control",
"Control", 0, 0, 900, 900);
905 c1->Divide(2, 2, 0.001, 0.001, 10);
907 if (hzz->GetEntries() > 0)
gPad->SetLogy(1);
910 if (hzt->GetEntries() > 0)
gPad->SetLogy(1);
913 if (hmt->GetEntries() > 0)
gPad->SetLogy(1);
943 if (filename ==
"") filename =
"KVBreakUp_Ouput.root";
947 suff.
Form(
"Zt%d_Mt%d_Zm%d_%s", GetZtot(), GetMtot(), GetZmin(), GetBreakUpMethod().Data());
950 for (
Int_t nn = 0; nn < lhisto->GetEntries(); nn += 1) {
951 snom.
Form(
"%s_%s", lhisto->At(nn)->GetName(), suff.
Data());
952 lhisto->At(nn)->Write(snom.
Data());
973 Info(
"Print",
"Configuration for the break up");
974 printf(
" Ztot=%d - Mtot=%d - Zmin=%d\n", GetZtot(), GetMtot(), GetZmin());
975 printf(
" Charge to be distributed %d - Biggest possible charge %d\n", nbre_nuc, Zmin + nbre_nuc);
976 printf(
" Methode de cassage aleatoire %s\n", GetBreakUpMethod().Data());
978 printf(
" Partition are stored via KVPartitionList : %d\n",
Int_t(TestBit(kStorePartitions)));
979 printf(
"------------------------------------------------------");
1009 tellapsed = tstop - tstart;
std::vector< Int_t > IntArray
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
size_t size(const MatrixT &matrix)
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 *="")
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()
Comme c'est écrit.
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.
Base class container for multi-particle events.
Extended version of ROOT THashList.
Handle a list of positive integers (partition)
void Clear(Option_t *option="")
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,...)