]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11GeomCable.h
Replacing array of objects by array of pointers
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeomCable.h
1 #ifndef ALIITSV11GEOMCABLE_H
2 #define ALIITSV11GEOMCABLE_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7
8 class TGeoVolume;
9 class TGeoNode;
10
11 #include <TObjArray.h>
12
13 //*************************************************************************
14 //   Base class of cable classes
15 //
16 //
17 // Ludovic Gaudichet                                   gaudichet@to.infn.it
18 //*************************************************************************
19
20
21 class AliITSv11GeomCable : public TNamed {
22
23  public:
24   AliITSv11GeomCable()
25     { fInitialNode = 0; fPointArray.SetOwner(); fDebug=0; };
26   AliITSv11GeomCable(const char* name);
27   AliITSv11GeomCable(const AliITSv11GeomCable &source);
28   AliITSv11GeomCable& operator=(const AliITSv11GeomCable &source);
29
30   virtual ~AliITSv11GeomCable();
31   void SetDebug(Int_t debug = 1) {fDebug = debug;};
32
33   void  SetInitialNode(TGeoVolume *vol);
34   void  ResetInitialNode();
35
36   void  AddCheckPoint( TGeoVolume *vol, Int_t iCheckPt, Double_t *coord);
37   virtual Int_t       GetNCheckPoints() const;
38   virtual Int_t       GetPoint(Int_t iCheckPt, Double_t *coord) const;
39   virtual Int_t       GetVect(Int_t iCheckPt, Double_t *coord) const;
40   virtual TGeoVolume* GetVolume( Int_t iCheckPt ) const;
41
42   virtual Int_t       GetCheckPoint( Int_t iCheckPt, Int_t nOccur,
43                                      Int_t motherLevel, Double_t *coord);
44   virtual Int_t       GetCheckVect( Int_t iCheckPt, Int_t nOccur,
45                                     Int_t motherLevel, Double_t *coord);
46   virtual Int_t       GetCheckVect( const Double_t *localCoord,
47                                     TGeoVolume *vol, Int_t nOccur,
48                                     Int_t motherLevel, Double_t *coord);
49   void ResetPoints();
50
51  protected:
52   bool     CheckDaughter(TGeoNode* node, Int_t i = 0);
53   void     ResetCheckDaughter();
54   void     CopyFrom(Double_t *c, const Double_t *o) const;
55   Double_t ScalProd(const Double_t *a, const Double_t *b) const;
56
57   static const Int_t fgkCableMaxNodeLevel = 50; // max. number of levels
58   static const Int_t fgkCableMaxLayer = 15;     // max. number of layers
59
60   Int_t fDebug;                         // debug flag
61   Int_t fNodeInd[fgkCableMaxNodeLevel]; // index of nodes in the node tree
62   TObjArray fPointArray;                // array of points
63   TObjArray fVolumeArray;               // volumes containing the points
64   TGeoVolume *fCurrentVol;              // volume to search in the node tree
65   TGeoNode *fInitialNode;               // initial node to start searching
66
67   ClassDef(AliITSv11GeomCable,1)
68 };
69
70 inline Int_t AliITSv11GeomCable::GetNCheckPoints() const{
71   return fVolumeArray.GetEntriesFast(); };
72
73 inline void AliITSv11GeomCable::ResetCheckDaughter() {
74   for (Int_t i=0; i<fgkCableMaxNodeLevel; i++) fNodeInd[i] = -1; };
75
76 inline void AliITSv11GeomCable::CopyFrom(Double_t *c, const Double_t *o)
77 const { *(c++)=*(o++); *(c++)=*(o++); *c=*o; };
78
79 inline Double_t AliITSv11GeomCable::ScalProd(const Double_t *a,
80                                                 const Double_t *b) const {
81   Double_t s = *(a++)*(*(b++)); s+=*(a++)*(*(b++)); s+=*a*(*b);
82   return s;
83 };
84
85
86
87
88
89 #endif