ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Pair.h
Revision: 1.1
Committed: Tue Jun 16 15:56:21 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
Log Message:
Added pair class

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: Pair.h,v 1.9 2009/03/18 15:44:32 loizides Exp $
3 //
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 Pair(const A *p1, const B *p2) : fP1(const_cast<A*>(p1)), fP2(const_cast<B*>(p2)),
24 fOwn1(0), fOwn2(0) {}
25 // Pair(cA *p1, const B *p2) : fPart1(p1), fPart2(p2), fOwn1(0), fOwn2(0) {}
26 ~Pair() { if (fOwn1) delete fP1; if (fOwn2) delete fP2; }
27
28 const A *First() const { return fP1; }
29 const B *Second() const { return fP2; }
30
31 EObjType ObjType() const { return kPair; }
32
33 protected:
34 A *fP1; //first object
35 B *fP2; //second object
36 Bool_t fOwn1; //=true then first object is owned
37 Bool_t fOwn2; //=true then second object is owned
38
39 ClassDef(Pair, 1) // Pair class
40 };
41 }
42 #endif