@@ -398,7 +398,6 @@ void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec& axis, co
398398 LOGF (warning, " Multiplicity axis does not exist" );
399399 return ;
400400 }
401-
402401 delete fSubList ;
403402 fSubList = new TList ();
404403 fSubList ->SetOwner (kTRUE );
@@ -426,7 +425,6 @@ void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec& axis, co
426425 for (const auto & name : histnames) {
427426 fSubList ->Add (new BootstrapProfile (name.c_str (), this ->GetTitle (), nMultiBins, multiBins.data ()));
428427 }
429-
430428 delete fSubCMList ;
431429 fSubCMList = new TList ();
432430 fSubCMList ->SetOwner (kTRUE );
@@ -475,7 +473,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m
475473 if (mpar == 0 ) {
476474 mpar = maxOrder;
477475 }
478-
479476 delete fSubList ;
480477 fSubList = new TList ();
481478 fSubList ->SetOwner (kTRUE );
@@ -503,7 +500,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m
503500 for (const auto & name : histnames) {
504501 fSubList ->Add (new BootstrapProfile (name.c_str (), this ->GetTitle (), nbinsx, xbins));
505502 }
506-
507503 delete fSubCMList ;
508504 fSubCMList = new TList ();
509505 fSubCMList ->SetOwner (kTRUE );
@@ -579,7 +575,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double xlow, double xhigh,
579575 for (const auto & name : histnames) {
580576 fSubList ->Add (new BootstrapProfile (name.c_str (), this ->GetTitle (), nbinsx, xlow, xhigh));
581577 }
582-
583578 delete fSubCMList ;
584579 fSubCMList = new TList ();
585580 fSubCMList ->SetOwner (kTRUE );
@@ -694,6 +689,45 @@ void FlowPtContainer::fillPtProfiles(const double& centmult, const double& rn)
694689 }
695690 }
696691}
692+ bool FlowPtContainer::addPtProfile (const char * name, int observableOrder)
693+ {
694+ if (!fCorrList || !name || (name[0 ] == 0 ) || observableOrder < 1 || observableOrder > mpar) {
695+ LOGF (error, " Cannot add pT profile %s for order %d" , name ? name : " (null)" , observableOrder);
696+ return false ;
697+ }
698+ const std::string profileName{name};
699+ if (fCorrList ->FindObject (profileName.c_str ())) {
700+ LOGF (error, " pT profile %s already exists" , profileName.c_str ());
701+ return false ;
702+ }
703+ auto * original = dynamic_cast <BootstrapProfile*>(fCorrList ->At (observableOrder - 1 ));
704+ const auto * axis = original->GetXaxis ();
705+ BootstrapProfile* profile = nullptr ;
706+ if (axis->GetXbins ()->GetSize () != 0 ) {
707+ profile = new BootstrapProfile (profileName.c_str (), profileName.c_str (), axis->GetNbins (), axis->GetXbins ()->GetArray ());
708+ } else {
709+ profile = new BootstrapProfile (profileName.c_str (), profileName.c_str (), axis->GetNbins (), axis->GetXmin (), axis->GetXmax ());
710+ }
711+ if (original->fListOfEntries ) {
712+ profile->InitializeSubsamples (original->fListOfEntries ->GetEntries ());
713+ }
714+ fCorrList ->Add (profile);
715+ return true ;
716+ }
717+ bool FlowPtContainer::fillPtProfile (const char * name, int observableOrder, double mult, double eventWeight, double rn)
718+ {
719+ if (!fCorrList || !name || observableOrder < 1 || observableOrder > mpar ||
720+ static_cast <size_t >(observableOrder) >= corrDen.size () || corrDen[observableOrder] == 0 . || eventWeight == 0 .) {
721+ return false ;
722+ }
723+ auto * profile = dynamic_cast <BootstrapProfile*>(fCorrList ->FindObject (name));
724+ if (!profile) {
725+ LOGF (error, " pT profile %s has not been booked" , name);
726+ return false ;
727+ }
728+ profile->FillProfile (mult, corrNum[observableOrder] / corrDen[observableOrder], eventWeight, rn);
729+ return true ;
730+ }
697731void FlowPtContainer::fillSubeventPtProfiles (const double & centmult, const double & rn)
698732{
699733 int histCounter = 0 ;
0 commit comments