00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGeoPatternFinder
00013 #define ROOT_TGeoPatternFinder
00014
00015 #ifndef ROOT_TObject
00016 #include "TObject.h"
00017 #endif
00018
00019 #ifndef ROOT_TGeoVolume
00020 #include "TGeoVolume.h"
00021 #endif
00022
00023
00024 class TGeoMatrix;
00025
00026
00027
00028
00029
00030
00031
00032
00033 class TGeoPatternFinder : public TObject
00034 {
00035 protected :
00036 enum EGeoPatternFlags {
00037 kPatternReflected = BIT(14)
00038 };
00039 Double_t fStep;
00040 Double_t fStart;
00041 Double_t fEnd;
00042 Int_t fCurrent;
00043 Int_t fNdivisions;
00044 Int_t fDivIndex;
00045 TGeoMatrix *fMatrix;
00046 TGeoVolume *fVolume;
00047 Int_t fNextIndex;
00048
00049 TGeoPatternFinder(const TGeoPatternFinder&);
00050 TGeoPatternFinder& operator=(const TGeoPatternFinder&);
00051
00052 public:
00053
00054 TGeoPatternFinder();
00055 TGeoPatternFinder(TGeoVolume *vol, Int_t ndiv);
00056
00057 virtual ~TGeoPatternFinder();
00058
00059 virtual void cd(Int_t ) {}
00060 virtual TGeoNode *CdNext();
00061 virtual TGeoNode *FindNode(Double_t * , const Double_t * =0) {return 0;}
00062 virtual Int_t GetByteCount() const {return 36;}
00063 Int_t GetCurrent() {return fCurrent;}
00064 Int_t GetDivIndex() {return fDivIndex;}
00065 virtual Int_t GetDivAxis() {return 1;}
00066 virtual TGeoMatrix *GetMatrix() {return fMatrix;}
00067 Int_t GetNdiv() const {return fNdivisions;}
00068 Int_t GetNext() const {return fNextIndex;}
00069 TGeoNode *GetNodeOffset(Int_t idiv) {return fVolume->GetNode(fDivIndex+idiv);}
00070 Double_t GetStart() const {return fStart;}
00071 Double_t GetStep() const {return fStep;}
00072 Double_t GetEnd() const {return fEnd;}
00073 TGeoVolume *GetVolume() const {return fVolume;}
00074 virtual Bool_t IsOnBoundary(const Double_t * ) const {return kFALSE;}
00075 Bool_t IsReflected() const {return TObject::TestBit(kPatternReflected);}
00076 virtual
00077 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00078 void Reflect(Bool_t flag=kTRUE) {TObject::SetBit(kPatternReflected,flag);}
00079 void SetDivIndex(Int_t index) {fDivIndex = index;}
00080 void SetNext(Int_t index) {fNextIndex = index;}
00081 void SetVolume(TGeoVolume *vol) {fVolume = vol;}
00082
00083 ClassDef(TGeoPatternFinder, 3)
00084 };
00085
00086
00087
00088
00089
00090
00091
00092 class TGeoTranslation;
00093
00094 class TGeoPatternX : public TGeoPatternFinder
00095 {
00096 public:
00097
00098 TGeoPatternX();
00099 TGeoPatternX(TGeoVolume *vol, Int_t ndivisions);
00100 TGeoPatternX(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00101 TGeoPatternX(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00102
00103
00104 virtual ~TGeoPatternX();
00105
00106 virtual void cd(Int_t idiv);
00107 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00108 virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext);
00109 virtual Int_t GetDivAxis() {return 1;}
00110 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00111 virtual
00112 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00113 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00114
00115 ClassDef(TGeoPatternX, 1)
00116 };
00117
00118
00119
00120
00121
00122
00123
00124 class TGeoPatternY : public TGeoPatternFinder
00125 {
00126 public:
00127
00128 TGeoPatternY();
00129 TGeoPatternY(TGeoVolume *vol, Int_t ndivisions);
00130 TGeoPatternY(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00131 TGeoPatternY(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00132
00133 virtual ~TGeoPatternY();
00134
00135 virtual void cd(Int_t idiv);
00136 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00137 virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext);
00138 virtual Int_t GetDivAxis() {return 2;}
00139 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00140 virtual
00141 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00142 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00143
00144 ClassDef(TGeoPatternY, 1)
00145 };
00146
00147
00148
00149
00150
00151
00152
00153 class TGeoPatternZ : public TGeoPatternFinder
00154 {
00155 public:
00156
00157 TGeoPatternZ();
00158 TGeoPatternZ(TGeoVolume *vol, Int_t ndivisions);
00159 TGeoPatternZ(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00160 TGeoPatternZ(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00161
00162 virtual ~TGeoPatternZ();
00163
00164 virtual void cd(Int_t idiv);
00165 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00166 virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext);
00167 virtual Int_t GetDivAxis() {return 3;}
00168 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00169 virtual
00170 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00171 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00172
00173 ClassDef(TGeoPatternZ, 1)
00174 };
00175
00176
00177
00178
00179
00180
00181
00182 class TGeoPatternParaX : public TGeoPatternFinder
00183 {
00184 public:
00185
00186 TGeoPatternParaX();
00187 TGeoPatternParaX(TGeoVolume *vol, Int_t ndivisions);
00188 TGeoPatternParaX(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00189 TGeoPatternParaX(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00190
00191
00192 virtual ~TGeoPatternParaX();
00193
00194 virtual void cd(Int_t idiv);
00195 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00196 virtual Int_t GetDivAxis() {return 1;}
00197 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00198 virtual
00199 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00200 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00201
00202 ClassDef(TGeoPatternParaX, 1)
00203 };
00204
00205
00206
00207
00208
00209
00210
00211 class TGeoPatternParaY : public TGeoPatternFinder
00212 {
00213 private :
00214
00215 Double_t fTxy;
00216 public:
00217
00218 TGeoPatternParaY();
00219 TGeoPatternParaY(TGeoVolume *vol, Int_t ndivisions);
00220 TGeoPatternParaY(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00221 TGeoPatternParaY(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00222
00223
00224 virtual ~TGeoPatternParaY();
00225
00226 virtual void cd(Int_t idiv);
00227 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00228 virtual Int_t GetDivAxis() {return 2;}
00229 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00230 virtual
00231 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00232 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00233
00234 ClassDef(TGeoPatternParaY, 1)
00235 };
00236
00237
00238
00239
00240
00241
00242
00243 class TGeoPatternParaZ : public TGeoPatternFinder
00244 {
00245 private :
00246
00247 Double_t fTxz;
00248 Double_t fTyz;
00249 public:
00250
00251 TGeoPatternParaZ();
00252 TGeoPatternParaZ(TGeoVolume *vol, Int_t ndivisions);
00253 TGeoPatternParaZ(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00254 TGeoPatternParaZ(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00255
00256
00257 virtual ~TGeoPatternParaZ();
00258
00259 virtual void cd(Int_t idiv);
00260 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00261 virtual Int_t GetDivAxis() {return 3;}
00262 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00263 virtual
00264 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00265 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00266
00267 ClassDef(TGeoPatternParaZ, 1)
00268 };
00269
00270
00271
00272
00273
00274
00275
00276 class TGeoPatternTrapZ : public TGeoPatternFinder
00277 {
00278 private :
00279
00280 Double_t fTxz;
00281 Double_t fTyz;
00282 public:
00283
00284 TGeoPatternTrapZ();
00285 TGeoPatternTrapZ(TGeoVolume *vol, Int_t ndivisions);
00286 TGeoPatternTrapZ(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00287 TGeoPatternTrapZ(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00288
00289
00290 virtual ~TGeoPatternTrapZ();
00291
00292 Double_t GetTxz() const {return fTxz;}
00293 Double_t GetTyz() const {return fTyz;}
00294 virtual void cd(Int_t idiv);
00295 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00296 virtual Int_t GetDivAxis() {return 3;}
00297 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00298 virtual
00299 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00300 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00301
00302 ClassDef(TGeoPatternTrapZ, 1)
00303 };
00304
00305
00306
00307
00308
00309
00310
00311
00312 class TGeoPatternCylR : public TGeoPatternFinder
00313 {
00314 public:
00315
00316 TGeoPatternCylR();
00317 TGeoPatternCylR(TGeoVolume *vol, Int_t ndivisions);
00318 TGeoPatternCylR(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00319 TGeoPatternCylR(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00320
00321 virtual ~TGeoPatternCylR();
00322
00323 virtual void cd(Int_t idiv) {fCurrent=idiv;}
00324 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00325 virtual Int_t GetDivAxis() {return 1;}
00326 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00327 virtual
00328 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00329 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00330
00331 ClassDef(TGeoPatternCylR, 1)
00332 };
00333
00334
00335
00336
00337
00338
00339
00340 class TGeoPatternCylPhi : public TGeoPatternFinder
00341 {
00342 private :
00343
00344 Double_t *fSinCos;
00345
00346 protected:
00347 TGeoPatternCylPhi(const TGeoPatternCylPhi& pfc)
00348 : TGeoPatternFinder(pfc), fSinCos(pfc.fSinCos) { }
00349 TGeoPatternCylPhi& operator=(const TGeoPatternCylPhi& pfc)
00350 {if(this!=&pfc) {TGeoPatternFinder::operator=(pfc); fSinCos=pfc.fSinCos;}
00351 return *this;}
00352
00353 public:
00354
00355 TGeoPatternCylPhi();
00356 TGeoPatternCylPhi(TGeoVolume *vol, Int_t ndivisions);
00357 TGeoPatternCylPhi(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00358 TGeoPatternCylPhi(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00359
00360 virtual ~TGeoPatternCylPhi();
00361
00362 virtual void cd(Int_t idiv);
00363 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00364 virtual Int_t GetDivAxis() {return 2;}
00365 virtual Bool_t IsOnBoundary(const Double_t *point) const;
00366 virtual
00367 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00368 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00369
00370 ClassDef(TGeoPatternCylPhi, 1)
00371 };
00372
00373
00374
00375
00376
00377
00378
00379 class TGeoPatternSphR : public TGeoPatternFinder
00380 {
00381 public:
00382
00383 TGeoPatternSphR();
00384 TGeoPatternSphR(TGeoVolume *vol, Int_t ndivisions);
00385 TGeoPatternSphR(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00386 TGeoPatternSphR(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00387
00388 virtual ~TGeoPatternSphR();
00389
00390 virtual void cd(Int_t idiv) {fCurrent=idiv;}
00391 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00392 virtual Int_t GetDivAxis() {return 1;}
00393 virtual
00394 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00395 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00396
00397 ClassDef(TGeoPatternSphR, 1)
00398 };
00399
00400
00401
00402
00403
00404
00405
00406 class TGeoPatternSphTheta : public TGeoPatternFinder
00407 {
00408 public:
00409
00410 TGeoPatternSphTheta();
00411 TGeoPatternSphTheta(TGeoVolume *vol, Int_t ndivisions);
00412 TGeoPatternSphTheta(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00413 TGeoPatternSphTheta(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00414
00415 virtual ~TGeoPatternSphTheta();
00416
00417 virtual void cd(Int_t idiv) {fCurrent=idiv;}
00418 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00419 virtual Int_t GetDivAxis() {return 2;}
00420 virtual
00421 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00422 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00423
00424 ClassDef(TGeoPatternSphTheta, 1)
00425 };
00426
00427
00428
00429
00430
00431
00432
00433 class TGeoPatternSphPhi : public TGeoPatternFinder
00434 {
00435 public:
00436
00437 TGeoPatternSphPhi();
00438 TGeoPatternSphPhi(TGeoVolume *vol, Int_t ndivisions);
00439 TGeoPatternSphPhi(TGeoVolume *vol, Int_t ndivisions, Double_t step);
00440 TGeoPatternSphPhi(TGeoVolume *vol, Int_t ndivisions, Double_t start, Double_t end);
00441
00442 virtual ~TGeoPatternSphPhi();
00443
00444 virtual void cd(Int_t idiv) {fCurrent=idiv;}
00445 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00446 virtual Int_t GetDivAxis() {return 3;}
00447 virtual
00448 TGeoPatternFinder *MakeCopy(Bool_t reflect=kFALSE);
00449 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00450
00451 ClassDef(TGeoPatternSphPhi, 1)
00452 };
00453
00454
00455
00456
00457
00458
00459
00460 class TGeoPatternHoneycomb : public TGeoPatternFinder
00461 {
00462 private :
00463
00464 Int_t fNrows;
00465 Int_t fAxisOnRows;
00466 Int_t *fNdivisions;
00467 Double_t *fStart;
00468
00469 protected:
00470 TGeoPatternHoneycomb(const TGeoPatternHoneycomb&);
00471 TGeoPatternHoneycomb& operator=(const TGeoPatternHoneycomb&);
00472
00473 public:
00474
00475 TGeoPatternHoneycomb();
00476 TGeoPatternHoneycomb(TGeoVolume *vol, Int_t nrows);
00477
00478 virtual ~TGeoPatternHoneycomb();
00479
00480 virtual void cd(Int_t idiv) {fCurrent=idiv;}
00481 virtual TGeoNode *FindNode(Double_t *point, const Double_t *dir=0);
00482
00483 ClassDef(TGeoPatternHoneycomb, 1)
00484 };
00485
00486 #endif