#ifndef ROOT_TGeoPatternFinder
#define ROOT_TGeoPatternFinder
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TGeoVolume
#include "TGeoVolume.h"
#endif
class TGeoMatrix;
class TGeoPatternFinder : public TObject
{
protected :
enum EGeoPatternFlags {
kPatternReflected = BIT(14)
};
Double_t fStep;
Double_t fStart;
Double_t fEnd;
Int_t fCurrent;
Int_t fNdivisions;
Int_t fDivIndex;
TGeoMatrix *fMatrix;
TGeoVolume *fVolume;
Int_t fNextIndex;
TGeoPatternFinder(const TGeoPatternFinder&);
TGeoPatternFinder& operator=(const TGeoPatternFinder&);
public:
TGeoPatternFinder();
TGeoPatternFinder(TGeoVolume *vol, Int_t ndiv);
virtual ~TGeoPatternFinder();
virtual void cd(Int_t ) {}
virtual TGeoNode *CdNext();
virtual TGeoNode *FindNode(Double_t * , const Double_t * =0) {return 0;}
virtual Int_t GetByteCount() const {return 36;}
Int_t GetCurrent() {return fCurrent;}
Int_t GetDivIndex() {return fDivIndex;}
virtual Int_t GetDivAxis() {return 1;}
virtual TGeoMatrix *GetMatrix() {return fMatrix;}
Int_t GetNdiv() const {return fNdivisions;}
Int_t GetNext() const {return fNextIndex;}
TGeoNode *GetNodeOffset(Int_t idiv) {return fVolume->GetNode(fDivIndex+idiv);}
Double_t GetStart() const {return fStart;}
Double_t GetStep() const {return fStep;}
Double_t GetEnd() const {return fEnd;}
TGeoVolume *GetVolume() const {return fVolume;}
virtual Bool_t IsOnBoundary(const Double_t * ) const {return kFALSE;}
Bool_t IsReflected() const {return TObject::TestBit(kPatternReflected);}
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
void Reflect(Bool_t flag=kTRUE) {TObject::SetBit(kPatternReflected,flag);}
void SetDivIndex(Int_t index) {fDivIndex = index;}
void SetNext(Int_t index) {fNextIndex = index;}
void SetVolume(TGeoVolume *vol) {fVolume = vol;}
ClassDef(TGeoPatternFinder, 3)
};
class TGeoTranslation;
class TGeoPatternX : public TGeoPatternFinder
{
public:
TGeoPatternX();
TGeoPatternX(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternX(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternX(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternX();
virtual void cd(Int_t idiv);
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext);
virtual Int_t GetDivAxis() {return 1;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternX, 1)
};
class TGeoPatternY : public TGeoPatternFinder
{
public:
TGeoPatternY();
TGeoPatternY(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternY(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternY(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternY();
virtual void cd(Int_t idiv);
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext);
virtual Int_t GetDivAxis() {return 2;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternY, 1)
};
class TGeoPatternZ : public TGeoPatternFinder
{
public:
TGeoPatternZ();
TGeoPatternZ(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternZ(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternZ(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternZ();
virtual void cd(Int_t idiv);
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext);
virtual Int_t GetDivAxis() {return 3;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternZ, 1)
};
class TGeoPatternParaX : public TGeoPatternFinder
{
public:
TGeoPatternParaX();
TGeoPatternParaX(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternParaX(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternParaX(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternParaX();
virtual void cd(Int_t idiv);
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 1;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternParaX, 1)
};
class TGeoPatternParaY : public TGeoPatternFinder
{
private :
Double_t fTxy;
public:
TGeoPatternParaY();
TGeoPatternParaY(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternParaY(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternParaY(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternParaY();
virtual void cd(Int_t idiv);
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 2;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternParaY, 1)
};
class TGeoPatternParaZ : public TGeoPatternFinder
{
private :
Double_t fTxz;
Double_t fTyz;
public:
TGeoPatternParaZ();
TGeoPatternParaZ(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternParaZ(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternParaZ(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternParaZ();
virtual void cd(Int_t idiv);
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 3;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternParaZ, 1)
};
class TGeoPatternTrapZ : public TGeoPatternFinder
{
private :
Double_t fTxz;
Double_t fTyz;
public:
TGeoPatternTrapZ();
TGeoPatternTrapZ(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternTrapZ(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternTrapZ(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternTrapZ();
Double_t GetTxz() const {return fTxz;}
Double_t GetTyz() const {return fTyz;}
virtual void cd(Int_t idiv);
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 3;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternTrapZ, 1)
};
class TGeoPatternCylR : public TGeoPatternFinder
{
public:
TGeoPatternCylR();
TGeoPatternCylR(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternCylR(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternCylR(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternCylR();
virtual void cd(Int_t idiv) {fCurrent=idiv;}
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 1;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternCylR, 1)
};
class TGeoPatternCylPhi : public TGeoPatternFinder
{
private :
Double_t *fSinCos;
protected:
TGeoPatternCylPhi(const TGeoPatternCylPhi& pfc)
: TGeoPatternFinder(pfc), fSinCos(pfc.fSinCos) { }
TGeoPatternCylPhi& operator=(const TGeoPatternCylPhi& pfc)
{if(this!=&pfc) {TGeoPatternFinder::operator=(pfc); fSinCos=pfc.fSinCos;}
return *this;}
public:
TGeoPatternCylPhi();
TGeoPatternCylPhi(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternCylPhi(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternCylPhi(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternCylPhi();
virtual void cd(Int_t idiv);
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 2;}
virtual Bool_t IsOnBoundary(const Double_t *point) const;
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternCylPhi, 1)
};
class TGeoPatternSphR : public TGeoPatternFinder
{
public:
TGeoPatternSphR();
TGeoPatternSphR(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternSphR(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternSphR(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternSphR();
virtual void cd(Int_t idiv) {fCurrent=idiv;}
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 1;}
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternSphR, 1)
};
class TGeoPatternSphTheta : public TGeoPatternFinder
{
public:
TGeoPatternSphTheta();
TGeoPatternSphTheta(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternSphTheta(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternSphTheta(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternSphTheta();
virtual void cd(Int_t idiv) {fCurrent=idiv;}
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 2;}
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternSphTheta, 1)
};
class TGeoPatternSphPhi : public TGeoPatternFinder
{
public:
TGeoPatternSphPhi();
TGeoPatternSphPhi(TGeoVolume *vol, Int_t ndivisions);
TGeoPatternSphPhi(TGeoVolume *vol, Int_t ndivisions, Double_t step);
TGeoPatternSphPhi(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
virtual ~TGeoPatternSphPhi();
virtual void cd(Int_t idiv) {fCurrent=idiv;}
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
virtual Int_t GetDivAxis() {return 3;}
virtual
TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGeoPatternSphPhi, 1)
};
class TGeoPatternHoneycomb : public TGeoPatternFinder
{
private :
Int_t fNrows;
Int_t fAxisOnRows;
Int_t *fNdivisions;
Double_t *fStart;
protected:
TGeoPatternHoneycomb(const TGeoPatternHoneycomb&);
TGeoPatternHoneycomb& operator=(const TGeoPatternHoneycomb&);
public:
TGeoPatternHoneycomb();
TGeoPatternHoneycomb(TGeoVolume *vol, Int_t nrows);
virtual ~TGeoPatternHoneycomb();
virtual void cd(Int_t idiv) {fCurrent=idiv;}
virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
ClassDef(TGeoPatternHoneycomb, 1)
};
#endif