On Fri, 26 Oct 2001 08:58:27 -0400 "Flemming Videbaek" <videbaek@sgs1.hirg.bnl.gov> wrote concerning "Re: BB vertex question": > Kris, > > I am partly responsible for this. > One rationale is that the BB rdo information (i.e called vertex has only a > very small overlap with the vrtex information from > the tpc, albeit a better with the Zdc. > > The information from the BB is > z0, t0 from different methods. Which gives you the members: Double_t fZ; UInt_t fT; enum EMethod { kSmall, kBig, kICannotRememberWhat }; > The information from the ZDC > z0, t0 from maybe two methods Which gives you Double_t fZ; UInt_t fT; enum EMethod { kIDonotKnowWhat1, kIDonotKnowWhat2 }; > The information from TPC > x,y,z and no timing.+ other fiducial values which gives you BrVector3D fPostition; BrVector3D fSqVariance; > This classes have a rather poor overlap (except for BB,ZDC) so you > would restrict a base class to have only z, variance, and nothing > else (certainly BB and ZDC does not give you any x,y and s(x) s(y) > so don't waste space) - so what is gained by calling it a vertex. Loads. See below. > It should in my opinion just be named a 'rdo object or another > approbiate , and just ensure the Getter have similar names. But it isn't a RDO is it? It's derived from the RDO information. > I fail to see the gain in having them deriving from a common class. Well, you can have interface methods that does not nessecarily correspond to member, but still defines an interface. Here's what I imagine. class BrVertex : public BrDataObject { private: public: BrVertex() {} virtual ~BrVertex() {} virtual Double_t GetX() const { return 0; } virtual Double_t GetY() const { return 0; } virtual Double_t GetZ() const { return 0; } virtual BrVector3D& GetPosition() const { return 0; } virtual BrVector3D& GetVariance() const { return 0; } virtual void SetX(Double_t) {} virtual void SetY(Double_t) {} virtual void SetZ(Double_t) {} virtual void SetPosition(const BrVector3D&) {} virtual void SetPosition(Double_t x=0, Double_t y=0, Double_t z=0) {} virtual void SetVariance(const BrVector3D&) {} virtual void SetVariance(Double_t x=0, Double_t y=0, Double_t z=0) {} virtual void Print(Option_t* option="") const = 0; ClassDef(BrVertex, 1) // ABC for verex classes }; class BrTimeVertex : public BrVertex { private: UInt_t fT; public: BrTimeVertex() fT(0) {} BrTimeVertex(UInt_t t) : fT(t) {} virtual ~BrTimeVertex() {} virtual UInt_t GetT() const { return fT; } virtual void SetT(UInt_t t) { fT = t; } ClassDef(BrTimeVertex, 1) // ABC Vertex with time information }; class BrPositionVertex : public BrVertex { private: BrVector3D fPosition; public: BrPositionVertex() : fPostition(0, 0, 0) {} BrPositionVertex(Double_t x, Double_t y, Double_t z) : fPosition(x,y,z) {} BrPositionVertex(const BrVector3D& v) : fPosition(v) {} virtual ~BrPositionVertex() {} virtual Double_t GetX() const { return fPosition.X(); } virtual Double_t GetY() const { return fPosition.Y(); } virtual Double_t GetZ() const { return fPosition.Z(); } virtual BrVector3D& GetPosition() const { return fPosition; } virtual void SetX(Double_t x) { fPosition.SetX(x); } virtual void SetY(Double_t y) { fPosition.SetY(y); } virtual void SetZ(Double_t z) { fPosition.SetZ(z); } virtual void SetPosition(const BrVector3D& v) { fPosition = v; } virtual void SetPosition(Double_t x=0, Double_t y=0, Double_t z=0) { fPosition.SetX(x); fPosition.SetY(y); fPosition.SetZ(z); } ClassDef(BrPositionVertex, 1) // ABC for 3D positioned vertex }; class BrBbVertex : public BrTimeVertex { public: enum EMethod { kSmall, kBig, kICannotRememberWhat }; private: Double_t fZ; EMethod fMethod; public: BrBbVertex() : fZ(0), fMethod(kSmall) {} BrBbVertex(Double_t z, UInt_t t, EMethod e) : BrTimeVertex(t), fZ(z), fMethod(e) {} virtual ~BrBbVertex() {} virtual Double_t GetZ() const { return fZ; } virtual EMethod GetMethod() const { return fMethod; } virtual void SetZ(Double_t z) { fZ = z; } virtual void SetPosition(const BrVector3D& v) { fZ = v.Z(); } virtual void SetPosition(Double_t x=0, Double_t y=0, Double_t z=0) { fZ = z; } virtual void SetMethod(EMethod m) { fMethod = m; } virtual void Print(Option_t* option="") const; ClassDef(BrBbVertex, 1) // BB vertex information }; class BrTpcVertex : public BrPositionVertex { private: BrVector3D fSqVariance; public: BrBbVertex() : fZ(0), fT(0), fMethod(kSmall) {} BrBbVertex(Double_t z, UInt_t t, EMethod e) : fZ(z), fT(t), fMethod(e) {} virtual ~BrBbVertex() {} ... virtual void Print(Option_t* option="") const; ClassDef(BrTpcVertex, 1) // TPC vertex information }; and so on. Now, most modules uses only the z information and cares little about the x and y information, hence, most modules can do BrVertex* v = (BrVertex*)inNode->GetObject("What ever"); Double_t vtxZ = v->GetZ(); Modules that need the timing information can be more selective and do BrTimeVertex* v = (BrTimeVertex*)inNode->GetObject("What ever"); UInt_t vtxT = v->GetT(); Modules that need a specific vertex can do, for example BrTpcVertex* v = (BrTpcVertex*)inNode->GetObject("TPM1 vertex"); BrVector3D& vtxSqVar = v->GetSqVariance(); Not only is this the Right OOP Way of doing things, it also allows most modules to ignore where the vertex comes from - i.e., there are defently benefiets to doing it like this. Remember, abstraction does not nessecarily mean that an overlap exists, only that you require some minimal functionallity - members are normally not part of an abstraction. Yours, Christian Holm Christensen ------------------------------------------- Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 DK-2200 Copenhagen N Cell: (+45) 28 82 16 23 Denmark Office: (+45) 353 25 305 Email: cholm@nbi.dk Web: www.nbi.dk/~cholm
This archive was generated by hypermail 2b30 : Fri Oct 26 2001 - 09:41:11 EDT