@@ -384,7 +384,7 @@ Double_t multGlauberNBDFitter::ContinuousNBD(Double_t n, Double_t mu, Double_t k
384384 return F;
385385}
386386
387- void multGlauberNBDFitter::CalculateAvNpNc (TProfile* lNPartProf, TProfile* lNCollProf, TH2F* lNPart2DPlot, TH2F* lNColl2DPlot, TH1F* hPercentileMap, Double_t lLoRange, Double_t lHiRange, TH3D* lNpNcEcc, TH2F* lEcc2DPlot)
387+ void multGlauberNBDFitter::CalculateAvNpNc (TProfile* lNPartProf, TProfile* lNCollProf, TH2F* lNPart2DPlot, TH2F* lNColl2DPlot, TH1F* hPercentileMap, Double_t lLoRange, Double_t lHiRange, TH3D* lNpNcEcc, TH2F* lEcc2DPlot, TH3D* lNpNcB, TH2F* lB2DPlot, TH2F* lNancestor2DPlot, Double_t fProbabilityCutoff )
388388{
389389 cout << " Calculating <Npart>, <Ncoll> in centrality bins..." << endl;
390390 cout << " Range to calculate: " << lLoRange << " to " << lHiRange << endl;
@@ -415,28 +415,56 @@ void multGlauberNBDFitter::CalculateAvNpNc(TProfile* lNPartProf, TProfile* lNCol
415415 }
416416 // bypass to zero
417417 for (int ibin = 0 ; ibin < fNNpNcPairs ; ibin++) {
418- if (ibin % 2000 == 0 )
418+ if (ibin % 200 == 0 )
419419 cout << " At NpNc pair #" << ibin << " of " << fNNpNcPairs << " ..." << endl;
420420 Double_t lNAncestors0 = (Int_t)(fNpart [ibin] * ff + fNcoll [ibin] * (1.0 - ff));
421421 Double_t lNAncestors1 = TMath::Floor (fNpart [ibin] * ff + fNcoll [ibin] * (1.0 - ff) + 0.5 );
422422 Double_t lNAncestors2 = (fNpart [ibin] * ff + fNcoll [ibin] * (1.0 - ff));
423423
424- TH1D* hEccentricity = 0x0 ;
424+ // define ancestors officially
425+ Double_t lNancestors = lNAncestors0;
426+ if (fAncestorMode == 1 )
427+ lNancestors = lNAncestors1;
428+ if (fAncestorMode == 2 )
429+ lNancestors = lNAncestors2;
425430
431+ // eccentricity handling
432+ TH1D* hEccentricity = 0x0 ;
426433 if (lNpNcEcc) {
427434 // locate the histogram that corresponds to the eccentricity distribution in this NpNc pair
428435 lNpNcEcc->GetXaxis ()->SetRange (lNpNcEcc->GetXaxis ()->FindBin (fNpart [ibin]), lNpNcEcc->GetXaxis ()->FindBin (fNpart [ibin]));
429436 lNpNcEcc->GetYaxis ()->SetRange (lNpNcEcc->GetYaxis ()->FindBin (fNcoll [ibin]), lNpNcEcc->GetYaxis ()->FindBin (fNcoll [ibin]));
430437 hEccentricity = reinterpret_cast <TH1D*>(lNpNcEcc->Project3D (" z" ));
431438 hEccentricity->SetName (Form (" hEccentricity_%i" , ibin));
439+
440+ // normalize into unitary fractions
441+ Double_t eccIntegral = hEccentricity->Integral (1 , hEccentricity->GetNbinsX () + 1 );
442+ if (eccIntegral > 1e-6 ) { // no counts
443+ hEccentricity->Scale (1 . / eccIntegral);
444+ } else {
445+ hEccentricity->Scale (0.0 );
446+ }
447+ }
448+
449+ // impact parameter handling
450+ TH1D* hImpactParameter = 0x0 ;
451+ if (lNpNcB) {
452+ // locate the histogram that corresponds to the eccentricity distribution in this NpNc pair
453+ lNpNcB->GetXaxis ()->SetRange (lNpNcB->GetXaxis ()->FindBin (fNpart [ibin]), lNpNcB->GetXaxis ()->FindBin (fNpart [ibin]));
454+ lNpNcB->GetYaxis ()->SetRange (lNpNcB->GetYaxis ()->FindBin (fNcoll [ibin]), lNpNcB->GetYaxis ()->FindBin (fNcoll [ibin]));
455+ hImpactParameter = reinterpret_cast <TH1D*>(lNpNcB->Project3D (" z" ));
456+ hImpactParameter->SetName (Form (" hImpactParameter_%i" , ibin));
457+
458+ // normalize into unitary fractions
459+ Double_t bIntegral = hImpactParameter->Integral (1 , hImpactParameter->GetNbinsX () + 1 );
460+ if (bIntegral > 1e-6 ) { // no counts
461+ hImpactParameter->Scale (1 . / bIntegral);
462+ } else {
463+ hImpactParameter->Scale (0.0 );
464+ }
432465 }
433466
434467 for (Long_t lMultValue = 1 ; lMultValue < lHiRange; lMultValue++) {
435- Double_t lNancestors = lNAncestors0;
436- if (fAncestorMode == 1 )
437- lNancestors = lNAncestors1;
438- if (fAncestorMode == 2 )
439- lNancestors = lNAncestors2;
440468 Double_t lNancestorCount = fContent [ibin];
441469 Double_t lThisMu = (((Double_t)lNancestors)) * fMu ;
442470 Double_t lThisk = (((Double_t)lNancestors)) * fk;
@@ -447,11 +475,20 @@ void multGlauberNBDFitter::CalculateAvNpNc(TProfile* lNPartProf, TProfile* lNCol
447475 if (lMultValue > 1e-6 )
448476 lMult = fAncestorMode != 2 ? fNBD ->Eval (lMultValue) : ContinuousNBD (lMultValue, lThisMu, lThisk);
449477 Double_t lProbability = lNancestorCount * lMult;
478+
479+ if (lProbability < fProbabilityCutoff ) {
480+ continue ; // skip if probability of contributing too small
481+ }
482+
450483 Double_t lMultValueToFill = lMultValue;
451484 if (hPercentileMap)
452485 lMultValueToFill = hPercentileMap->GetBinContent (hPercentileMap->FindBin (lMultValue));
453486 lNPartProf->Fill (lMultValueToFill, fNpart [ibin], lProbability);
454487 lNCollProf->Fill (lMultValueToFill, fNcoll [ibin], lProbability);
488+ if (lNancestor2DPlot) {
489+ // fill cross-check histogram with lNancestorCount at lNancestors value
490+ lNancestor2DPlot->Fill (lMultValueToFill, lNancestors, lProbability);
491+ }
455492 if (lNPart2DPlot)
456493 lNPart2DPlot->Fill (lMultValueToFill, fNpart [ibin], lProbability);
457494 if (lNColl2DPlot)
@@ -462,6 +499,12 @@ void multGlauberNBDFitter::CalculateAvNpNc(TProfile* lNPartProf, TProfile* lNCol
462499 lEcc2DPlot->Fill (lMultValueToFill, hEccentricity->GetBinCenter (ib), lProbability * hEccentricity->GetBinContent (ib));
463500 }
464501 }
502+ if (lNpNcB) {
503+ // collapse the entire impact parameter distribution for this combo
504+ for (int ib = 1 ; ib < hImpactParameter->GetNbinsX () + 1 ; ib++) {
505+ lB2DPlot->Fill (lMultValueToFill, hImpactParameter->GetBinCenter (ib), lProbability * hImpactParameter->GetBinContent (ib));
506+ }
507+ }
465508 }
466509 }
467510}
0 commit comments