Revision: | 1.2 |
Committed: | Tue Jun 16 17:08:21 2009 UTC (15 years, 10 months ago) by loizides |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, HEAD |
Branch point for: | Mit_025c_branch |
Changes since 1.1: | +15 -8 lines |
Log Message: | Added a few instantiations of Pair objects |
# | User | Rev | Content |
---|---|---|---|
1 | loizides | 1.1 | //-------------------------------------------------------------------------------------------------- |
2 | loizides | 1.2 | // $Id: Pair.h,v 1.1 2009/06/16 15:56:21 loizides Exp $ |
3 | loizides | 1.1 | // |
4 | // Pair | ||
5 | // | ||
6 | // Pair class to allow matching of particles to each other. | ||
7 | // | ||
8 | // Authors: C.Loizides | ||
9 | //-------------------------------------------------------------------------------------------------- | ||
10 | |||
11 | #ifndef MITANA_DATATREE_PAIR_H | ||
12 | #define MITANA_DATATREE_PAIR_H | ||
13 | |||
14 | #include "MitAna/DataTree/interface/DataBase.h" | ||
15 | #include "MitAna/DataTree/interface/Particle.h" | ||
16 | |||
17 | namespace mithep | ||
18 | { | ||
19 | template<class A, class B=A> | ||
20 | class Pair : public DataBase | ||
21 | { | ||
22 | public: | ||
23 | loizides | 1.2 | Pair() : fP1(0), fP2(0), fOwn1(0), fOwn2(0) {} |
24 | Pair(const A *p1, const B *p2) : fP1(const_cast<A*>(p1)), fP2(const_cast<B*>(p2)), | ||
25 | fOwn1(0), fOwn2(0) {} | ||
26 | Pair(A *p1, Bool_t o, const B *p2) : fP1(p1), fP2(const_cast<B*>(p2)), | ||
27 | fOwn1(o), fOwn2(0) {} | ||
28 | Pair(const A *p1, B *p2, Bool_t o) : fP1(const_cast<A*>(p1)), fP2(p2), | ||
29 | fOwn1(0), fOwn2(o) {} | ||
30 | Pair(A *p1, B *p2, Bool_t o1, Bool_t o2) : fP1(p1), fP2(p2), | ||
31 | fOwn1(o1), fOwn2(o2) {} | ||
32 | loizides | 1.1 | ~Pair() { if (fOwn1) delete fP1; if (fOwn2) delete fP2; } |
33 | |||
34 | loizides | 1.2 | const A *First() const { return fP1; } |
35 | const B *Second() const { return fP2; } | ||
36 | EObjType ObjType() const { return kPair; } | ||
37 | const A *P1() const { return fP1; } | ||
38 | const B *P2() const { return fP2; } | ||
39 | loizides | 1.1 | |
40 | protected: | ||
41 | A *fP1; //first object | ||
42 | B *fP2; //second object | ||
43 | Bool_t fOwn1; //=true then first object is owned | ||
44 | Bool_t fOwn2; //=true then second object is owned | ||
45 | |||
46 | ClassDef(Pair, 1) // Pair class | ||
47 | }; | ||
48 | } | ||
49 | #endif |