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;
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));
496 bb =
TMath::Nint(alea->Uniform(0, (Mtotal) - 0.5));
511 if (zc == Ztotal)
return 1;
532 bb =
TMath::Nint(alea->Uniform(0, (Mtotal) - 0.5));
536 Int_t mc = 0, zc = 0;
543 if (mc == Mtotal && zc == Ztotal)
return 1;
572 partition->Fill(
size, Mtotal);
573 Int_t* tab = partition->CreateTableOfValues();
575 current_event->Clear();
576 for (
Int_t ii = 0; ii < Mtotal; ii += 1)
577 current_event->AddNucleus()->SetZ(tab[ii]);
581 if (TestBit(kStorePartitions)) {
597 return current_event;
626 for (
Int_t nn = 0; nn < times; nn += 1) {
627 if (nn % 10000 == 0)
Info(
"BreakNtimes",
"%d partitions generees sur %d", nn, times);
632 Info(
"BreakNtimes",
"%s retourne %ld", BreakUpMethod.Data(), ret);
637 Info(
"BreakNtimes",
"Tirage termine");
641 Info(
"BreakNtimes",
"Temps ecoule en secondes : %d", GetDeltaTime());
677 for (
Int_t nn = 0; nn < times; nn += 1) {
678 if (nn % 1000 == 0) printf(
"%d partitions generees sur %d\n", nn, times);
683 if (mt > 0 && zt > 0 && zt >= mt * zmin) {
684 SetConditions(zt, mt, zmin);
700 Info(
"BreakNtimesOnGaussian",
"Temps ecoule en secondes : %d", GetDeltaTime());
730 while (!(mt > 0 && zt > 0 && zt >= mt * zmin)) {
735 SetConditions(zt, mt, zmin);
739 return current_event;
778 TH2F* h2 = hh_zt_VS_mt;
796 if (mt > 0 && zt > 0 && zt >= mt * zmin) {
798 SetConditions(zt, mt, zmin);
799 for (
Int_t nn = 0; nn < stat; nn += 1) {
804 if (stat_par % 1000 == 0) printf(
"%d partitions generees sur %d\n", stat_par, stat_tot);
807 cout << zt <<
" " << mt << endl;
812 niter_tot += stat_par;
815 Info(
"BreakNtimesFromHisto",
"Temps ecoule en secondes : %d", GetDeltaTime());
881 lhisto->Execute(
"Reset",
"");
897 if (!(
c1 = (
TCanvas*)
gROOT->GetListOfCanvases()->FindObject(
"BreakUp_Control"))) {
899 c1 =
new TCanvas(
"BreakUp_Control",
"Control", 0, 0, 900, 900);
900 c1->Divide(2, 2, 0.001, 0.001, 10);
902 if (hzz->GetEntries() > 0)
gPad->SetLogy(1);
905 if (hzt->GetEntries() > 0)
gPad->SetLogy(1);
908 if (hmt->GetEntries() > 0)
gPad->SetLogy(1);
938 if (filename ==
"") filename =
"KVBreakUp_Ouput.root";
942 suff.
Form(
"Zt%d_Mt%d_Zm%d_%s", GetZtot(), GetMtot(), GetZmin(), GetBreakUpMethod().Data());
945 for (
Int_t nn = 0; nn < lhisto->GetEntries(); nn += 1) {
946 snom.
Form(
"%s_%s", lhisto->At(nn)->GetName(), suff.
Data());
947 lhisto->At(nn)->Write(snom.
Data());
968 Info(
"Print",
"Configuration for the break up");
969 printf(
" Ztot=%d - Mtot=%d - Zmin=%d\n", GetZtot(), GetMtot(), GetZmin());
970 printf(
" Charge to be distributed %d - Biggest possible charge %d\n", nbre_nuc, Zmin + nbre_nuc);
971 printf(
" Methode de cassage aleatoire %s\n", GetBreakUpMethod().Data());
973 printf(
" Partition are stored via KVPartitionList : %d\n",
Int_t(TestBit(kStorePartitions)));
974 printf(
"------------------------------------------------------");
1004 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.
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="")
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,...)