@@ -86,8 +86,8 @@ void FFitWeights::init()
8686 fW_data ->Add (new TProfile (" pMeanPt" , " " , centBin, 0 , centBin));
8787 fW_data ->Add (new TH2D (" hPtWeight" , " " , centBin, 0 , centBin, ptBin, ptAxis->GetXmin (), ptAxis->GetXmax ()));
8888
89- ptProfCent = reinterpret_cast <TProfile*>(fW_data ->FindObject (" pMeanPt" ));
90- h2ptCent = reinterpret_cast <TH2D *>(fW_data ->FindObject (" hPtWeight" ));
89+ ptProfCent = dynamic_cast <TProfile*>(fW_data ->FindObject (" pMeanPt" ));
90+ h2ptCent = dynamic_cast <TH2D *>(fW_data ->FindObject (" hPtWeight" ));
9191};
9292
9393void FFitWeights::fillWeights (float centrality, float qn, int nh, const char * pf)
@@ -98,10 +98,10 @@ void FFitWeights::fillWeights(float centrality, float qn, int nh, const char* pf
9898 if (!tar)
9999 return ;
100100
101- TH2D * th2 = reinterpret_cast <TH2D *>(tar->FindObject (this ->getQName (nh, pf)));
101+ TH2D * th2 = dynamic_cast <TH2D *>(tar->FindObject (this ->getQName (nh, pf)));
102102 if (!th2) {
103103 tar->Add (new TH2D (this ->getQName (nh, pf), this ->getAxisName (nh, pf), centBin, 0 , centBin, qAxis->GetNbins (), qAxis->GetXmin (), qAxis->GetXmax ()));
104- th2 = reinterpret_cast <TH2D *>(tar->At (tar->GetEntries () - 1 ));
104+ th2 = dynamic_cast <TH2D *>(tar->At (tar->GetEntries () - 1 ));
105105 }
106106 th2->Fill (centrality, qn);
107107};
@@ -117,7 +117,7 @@ void FFitWeights::fillPt(float centrality, float pt, float weight, bool first)
117117float FFitWeights::getPtMult (float centrality)
118118{
119119 if (!ptProfCent) {
120- ptProfCent = reinterpret_cast <TProfile*>(fW_data ->FindObject (" pMeanPt" ));
120+ ptProfCent = dynamic_cast <TProfile*>(fW_data ->FindObject (" pMeanPt" ));
121121 }
122122 return ptProfCent->GetBinContent (ptProfCent->FindBin (centrality));
123123};
@@ -132,7 +132,7 @@ Long64_t FFitWeights::Merge(TCollection* collist)
132132 }
133133 FFitWeights* lW = 0 ;
134134 TIter allW (collist);
135- while ((lW = (reinterpret_cast <FFitWeights*>(allW ())))) {
135+ while ((lW = (dynamic_cast <FFitWeights*>(allW ())))) {
136136 addArray (fW_data , lW->getDataArray ());
137137 nmerged++;
138138 }
@@ -150,7 +150,7 @@ void FFitWeights::addArray(TObjArray* targ, TObjArray* sour)
150150
151151 auto * tObj = targ->FindObject (obj->GetName ());
152152 if (!tObj) {
153- auto * clone = static_cast <TObject*>( obj->Clone (obj->GetName () ));
153+ auto * clone = obj->Clone (obj->GetName ());
154154 if (auto * h = dynamic_cast <TH1 *>(clone))
155155 h->SetDirectory (0 );
156156 targ->Add (clone);
@@ -168,7 +168,7 @@ void FFitWeights::mptSel()
168168 if (!tar)
169169 return ;
170170
171- TH2D * th2 = reinterpret_cast <TH2D *>(tar->FindObject (" hPtWeight" ));
171+ TH2D * th2 = dynamic_cast <TH2D *>(tar->FindObject (" hPtWeight" ));
172172 if (!th2) {
173173 return ;
174174 }
@@ -198,7 +198,7 @@ void FFitWeights::qSelection(const std::vector<int>& nhv, const std::vector<std:
198198
199199 for (const auto & pf : stv) {
200200 for (const auto & nh : nhv) {
201- TH2D * th2{reinterpret_cast <TH2D *>(tar->FindObject (this ->getQName (nh, pf.c_str ())))};
201+ TH2D * th2{dynamic_cast <TH2D *>(tar->FindObject (this ->getQName (nh, pf.c_str ())))};
202202 if (!th2) {
203203 LOGF (info, " FFitWeights qh not found!" );
204204 return ;
0 commit comments