Skip to content

Commit a679abd

Browse files
committed
Fix TH2D arithmetic operators in Python
1 parent a7f2531 commit a679abd

File tree

1 file changed

+49
-5
lines changed

1 file changed

+49
-5
lines changed

hist/hist/inc/TH2.h

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class TH2C : public TH2, public TArrayC {
166166

167167
TH2C& operator=(const TH2C &h1);
168168
friend TH2C operator*(Float_t c1, TH2C const &h1);
169-
friend TH2C operator*(TH2C const &h1, Float_t c1) {return operator*(c1,h1);}
169+
friend TH2C operator*(TH2C const &h1, Float_t c1);
170170
friend TH2C operator+(TH2C const &h1, TH2C const &h2);
171171
friend TH2C operator-(TH2C const &h1, TH2C const &h2);
172172
friend TH2C operator*(TH2C const &h1, TH2C const &h2);
@@ -179,6 +179,13 @@ class TH2C : public TH2, public TArrayC {
179179
ClassDefOverride(TH2C,4) //2-Dim histograms (one char per channel)
180180
};
181181

182+
TH2C operator*(Float_t c1, TH2C const &h1);
183+
inline
184+
TH2C operator*(TH2C const &h1, Float_t c1) {return operator*(c1,h1);}
185+
TH2C operator+(TH2C const &h1, TH2C const &h2);
186+
TH2C operator-(TH2C const &h1, TH2C const &h2);
187+
TH2C operator*(TH2C const &h1, TH2C const &h2);
188+
TH2C operator/(TH2C const &h1, TH2C const &h2);
182189

183190
//______________________________________________________________________________
184191

@@ -208,7 +215,7 @@ class TH2S : public TH2, public TArrayS {
208215

209216
TH2S& operator=(const TH2S &h1);
210217
friend TH2S operator*(Float_t c1, TH2S const &h1);
211-
friend TH2S operator*(TH2S const &h1, Float_t c1) {return operator*(c1,h1);}
218+
friend TH2S operator*(TH2S const &h1, Float_t c1);
212219
friend TH2S operator+(TH2S const &h1, TH2S const &h2);
213220
friend TH2S operator-(TH2S const &h1, TH2S const &h2);
214221
friend TH2S operator*(TH2S const &h1, TH2S const &h2);
@@ -221,6 +228,13 @@ class TH2S : public TH2, public TArrayS {
221228
ClassDefOverride(TH2S,4) //2-Dim histograms (one short per channel)
222229
};
223230

231+
TH2S operator*(Float_t c1, TH2S const &h1);
232+
inline
233+
TH2S operator*(TH2S const &h1, Float_t c1) {return operator*(c1,h1);}
234+
TH2S operator+(TH2S const &h1, TH2S const &h2);
235+
TH2S operator-(TH2S const &h1, TH2S const &h2);
236+
TH2S operator*(TH2S const &h1, TH2S const &h2);
237+
TH2S operator/(TH2S const &h1, TH2S const &h2);
224238

225239
//______________________________________________________________________________
226240

@@ -250,7 +264,7 @@ class TH2I : public TH2, public TArrayI {
250264

251265
TH2I& operator=(const TH2I &h1);
252266
friend TH2I operator*(Float_t c1, TH2I const &h1);
253-
friend TH2I operator*(TH2I const &h1, Float_t c1) {return operator*(c1,h1);}
267+
friend TH2I operator*(TH2I const &h1, Float_t c1);
254268
friend TH2I operator+(TH2I const &h1, TH2I const &h2);
255269
friend TH2I operator-(TH2I const &h1, TH2I const &h2);
256270
friend TH2I operator*(TH2I const &h1, TH2I const &h2);
@@ -263,6 +277,14 @@ class TH2I : public TH2, public TArrayI {
263277
ClassDefOverride(TH2I,4) //2-Dim histograms (one 32 bit integer per channel)
264278
};
265279

280+
TH2I operator*(Float_t c1, TH2I const &h1);
281+
inline
282+
TH2I operator*(TH2I const &h1, Float_t c1) {return operator*(c1,h1);}
283+
TH2I operator+(TH2I const &h1, TH2I const &h2);
284+
TH2I operator-(TH2I const &h1, TH2I const &h2);
285+
TH2I operator*(TH2I const &h1, TH2I const &h2);
286+
TH2I operator/(TH2I const &h1, TH2I const &h2);
287+
266288
//______________________________________________________________________________
267289

268290
class TH2L : public TH2, public TArrayL64 {
@@ -289,7 +311,7 @@ class TH2L : public TH2, public TArrayL64 {
289311
void SetBinsLength(Int_t n=-1) override;
290312
TH2L& operator=(const TH2L &h1);
291313
friend TH2L operator*(Float_t c1, TH2L const &h1);
292-
friend TH2L operator*(TH2L const &h1, Float_t c1) {return operator*(c1,h1);}
314+
friend TH2L operator*(TH2L const &h1, Float_t c1);
293315
friend TH2L operator+(TH2L const &h1, TH2L const &h2);
294316
friend TH2L operator-(TH2L const &h1, TH2L const &h2);
295317
friend TH2L operator*(TH2L const &h1, TH2L const &h2);
@@ -302,6 +324,14 @@ class TH2L : public TH2, public TArrayL64 {
302324
ClassDefOverride(TH2L,0) //2-Dim histograms (one 64 bit integer per channel)
303325
};
304326

327+
TH2L operator*(Float_t c1, TH2L const &h1);
328+
inline
329+
TH2L operator*(TH2L const &h1, Float_t c1) {return operator*(c1,h1);}
330+
TH2L operator+(TH2L const &h1, TH2L const &h2);
331+
TH2L operator-(TH2L const &h1, TH2L const &h2);
332+
TH2L operator*(TH2L const &h1, TH2L const &h2);
333+
TH2L operator/(TH2L const &h1, TH2L const &h2);
334+
305335
//______________________________________________________________________________
306336

307337
class TH2F : public TH2, public TArrayF {
@@ -350,6 +380,12 @@ class TH2F : public TH2, public TArrayF {
350380
ClassDefOverride(TH2F,4) //2-Dim histograms (one float per channel)
351381
};
352382

383+
TH2F operator*(Float_t c1, TH2F const &h1);
384+
TH2F operator*(TH2F const &h1, Float_t c1);
385+
TH2F operator+(TH2F const &h1, TH2F const &h2);
386+
TH2F operator-(TH2F const &h1, TH2F const &h2);
387+
TH2F operator*(TH2F const &h1, TH2F const &h2);
388+
TH2F operator/(TH2F const &h1, TH2F const &h2);
353389

354390
//______________________________________________________________________________
355391

@@ -385,7 +421,7 @@ class TH2D : public TH2, public TArrayD {
385421

386422
TH2D& operator=(const TH2D &h1);
387423
friend TH2D operator*(Float_t c1, TH2D const &h1);
388-
friend TH2D operator*(TH2D const &h1, Float_t c1) {return operator*(c1,h1);}
424+
friend TH2D operator*(TH2D const &h1, Float_t c1);
389425
friend TH2D operator+(TH2D const &h1, TH2D const &h2);
390426
friend TH2D operator-(TH2D const &h1, TH2D const &h2);
391427
friend TH2D operator*(TH2D const &h1, TH2D const &h2);
@@ -398,4 +434,12 @@ class TH2D : public TH2, public TArrayD {
398434
ClassDefOverride(TH2D,4) //2-Dim histograms (one double per channel)
399435
};
400436

437+
TH2D operator*(Float_t c1, TH2D const &h1);
438+
inline
439+
TH2D operator*(TH2D const &h1, Float_t c1) {return operator*(c1,h1);}
440+
TH2D operator+(TH2D const &h1, TH2D const &h2);
441+
TH2D operator-(TH2D const &h1, TH2D const &h2);
442+
TH2D operator*(TH2D const &h1, TH2D const &h2);
443+
TH2D operator/(TH2D const &h1, TH2D const &h2);
444+
401445
#endif

0 commit comments

Comments
 (0)