@@ -395,7 +395,7 @@ TProfile* FlowContainer::GetCorrXXVsMulti(const char* order, int l_pti)
395395 }
396396 return retSubset;
397397};
398- TProfile * FlowContainer::GetCorrXXVsPt (const char * order, double lminmulti, double lmaxmulti)
398+ TH1D * FlowContainer::GetCorrXXVsPt (const char * order, double lminmulti, double lmaxmulti)
399399{
400400 int minm = 1 ;
401401 int maxm = fProf ->GetXaxis ()->GetNbins ();
@@ -408,35 +408,27 @@ TProfile* FlowContainer::GetCorrXXVsPt(const char* order, double lminmulti, doub
408408 if (lmaxmulti > lminmulti)
409409 maxm = fProf ->GetXaxis ()->FindBin (lmaxmulti - 0.001 );
410410 ProfileSubset* rhProfSub = new ProfileSubset (*fProf );
411- TProfile* retSubset = 0 ;
412411 TString l_name (" " );
413412 Ssiz_t l_pos = 0 ;
414413 while (fIDName .Tokenize (l_name, l_pos)) {
415414 TString ybl1 (Form (" %s%s_pt_1" , l_name.Data (), order));
416415 TString ybl2 (Form (" %s%s_pt_%i" , l_name.Data (), order, fNbinsPt ));
417416 int ybn1 = fProf ->GetYaxis ()->FindBin (ybl1.Data ());
418417 int ybn2 = fProf ->GetYaxis ()->FindBin (ybl2.Data ());
419- rhProfSub->GetYaxis ()->SetRange (ybn1, ybn2);
420- TProfile* tempprof = rhProfSub->GetSubset (kFALSE , " tempprof" , minm, maxm, fNbinsPt , fbinsPt);
421- if (!retSubset) {
422- TString profname = Form (" %s_MultiB_%i_%i" , order, minm, maxm);
423- retSubset = dynamic_cast <TProfile*>(tempprof->Clone (profname.Data ()));
424- } else {
425- retSubset->Add (tempprof);
418+ TProfile* profY = rhProfSub->ProfileY (" profY" , minm, maxm);
419+ TH1D* histY = ProfToHist (profY);
420+ TH1D* hist = new TH1D (" temphist" , " temphist" , fNbinsPt , fbinsPt);
421+ for (int ibin = 1 ; ibin < hist->GetNbinsX (); ibin++) {
422+ TString bLabel = rhProfSub->GetYaxis ()->GetBinLabel (ibin + ybn1 - 1 );
423+ hist->GetXaxis ()->SetBinLabel (ibin, bLabel.Data ());
424+ hist->SetBinContent (ibin, histY->GetBinContent (ibin + ybn1 - 1 ));
425+ hist->SetBinError (ibin, histY->GetBinError (ibin + ybn1 - 1 ));
426426 }
427- delete tempprof;
428- }
429- delete rhProfSub;
430- if (fPtRebinEdges ) {
431- TString pnbu (retSubset->GetName ());
432- retSubset->SetName (" TempName" );
433- TProfile* tempprof = dynamic_cast <TProfile*>(retSubset->Rebin (fPtRebin , pnbu.Data (), fPtRebinEdges ));
434- delete retSubset;
435- retSubset = tempprof;
436- } else {
437- retSubset->RebinX (fPtRebin );
427+ delete histY;
428+ delete rhProfSub;
429+ return hist;
438430 }
439- return retSubset ;
431+ return nullptr ;
440432};
441433TH1D* FlowContainer::ProfToHist (TProfile* inpf)
442434{
@@ -462,16 +454,14 @@ TH1D* FlowContainer::GetHistCorrXXVsMulti(const char* order, int l_pti)
462454}
463455TH1D* FlowContainer::GetHistCorrXXVsPt (const char * order, double lminmulti, double lmaxmulti)
464456{
465- TProfile* tpf = GetCorrXXVsPt (order, lminmulti, lmaxmulti);
466- TH1D* rethist = ProfToHist (tpf);
457+ TH1D* rethist = GetCorrXXVsPt (order, lminmulti, lmaxmulti);
467458 TProfile* refflow = GetRefFlowProfile (order, lminmulti, lmaxmulti);
468459 if (refflow) {
469460 refflow->RebinX (refflow->GetNbinsX ());
470461 rethist->SetBinContent (0 , refflow->GetBinContent (1 ));
471462 rethist->SetBinError (0 , refflow->GetBinError (1 ));
472463 }
473464 delete refflow;
474- delete tpf;
475465 return rethist;
476466}
477467TH1D* FlowContainer::GetVN2 (TH1D* cn2)
0 commit comments