@@ -68,14 +68,12 @@ class HFInvMassFitter : public TNamed
6868 };
6969 std::array<std::string, NTypesOfReflPdf> namesOfReflPdf{" reflFuncGaus" , " reflFuncDoubleGaus" , " reflFuncPoly3" , " reflFuncPoly6" };
7070 HFInvMassFitter () = delete ;
71- HFInvMassFitter (const TH1* histoToFit, double minValue, double maxValue, int fitTypeBkg = Expo, int fitTypeSgn = SingleGaus);
71+ HFInvMassFitter (TH1* histoToFit, double minValue, double maxValue, int fitTypeBkg = Expo, int fitTypeSgn = SingleGaus);
7272 ~HFInvMassFitter () override ;
73- void setHistogramForFit (const TH1* histoToFit)
73+ void setHistogramForFit (TH1* histoToFit)
7474 {
75-
7675 delete mHistoInvMass ;
77-
78- mHistoInvMass = dynamic_cast <TH1*>(histoToFit->Clone (" mHistoInvMass" ));
76+ mHistoInvMass = histoToFit;
7977 mHistoInvMass ->SetDirectory (nullptr );
8078 }
8179 void setUseLikelihoodFit () { mFitOption = " L,E" ; }
@@ -190,13 +188,14 @@ class HFInvMassFitter : public TNamed
190188 setInitialReflOverSgn (reflOverSgn);
191189 mFixReflOverSgn = true ;
192190 }
193- void setTemplateReflections (const TH1* histoRefl)
191+ void setTemplateReflections (TH1* histoRefl)
194192 {
195193 if (histoRefl == nullptr ) {
196194 mEnableReflections = false ;
197195 return ;
198196 }
199- mHistoTemplateRefl = dynamic_cast <TH1*>(histoRefl->Clone (" mHistoTemplateRefl" ));
197+ mHistoTemplateRefl = histoRefl;
198+ mHistoTemplateRefl ->SetName (" mHistoTemplateRefl" );
200199 }
201200 void setDrawBgPrefit (bool value = true ) { mDrawBgPrefit = value; }
202201 void setHighlightPeakRegion (bool value = true ) { mHighlightPeakRegion = value; }
0 commit comments