]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSpackageSSD.h
alignment of sensor wrt hybrid is now allowed (fgkSSDModulVerticalDisalignement)...
[u/mrichter/AliRoot.git] / ITS / AliITSpackageSSD.h
1 #ifndef ALIITSPACKAGESSD_H
2 #define ALIITSPACKAGESSD_H
3 //Class describing set of AliITSoneSideClusterSSDs, which contact each other.
4 //Piotr Krzysztof Skowronski
5 //Warsaw University of Technology
6 //skowron@if.pw.edu.pl
7 //
8 #include "TObject.h"
9 #include "TArrayI.h"
10
11 //#include "AliITSclusterSSD.h"
12
13 class AliITSclusterSSD;
14
15 //-------------------------------------------------------------------
16
17 class AliITSpackageSSD : public TObject
18 {
19  public:
20   AliITSpackageSSD(); 
21
22   AliITSpackageSSD(Int_t len, TClonesArray *clustersP, TClonesArray *clustersN);  
23   AliITSpackageSSD(TClonesArray *clustersP, TClonesArray *clustersN);   
24
25   ~AliITSpackageSSD();
26   
27   AliITSpackageSSD(const AliITSpackageSSD &package); 
28   AliITSpackageSSD&  operator=( const AliITSpackageSSD & package);
29   //Add cluster in side N, clindex is an index of this cluster in TClonesArray
30   
31   void     AddNSideCluster(Int_t clindex) {(*fClusterNIndexes)[fNclustersN++]=clindex;} 
32   void     AddPSideCluster(Int_t clindex) {(*fClusterPIndexes)[fNclustersP++]=clindex;} 
33
34   void     AddCluster(Int_t clindex, Bool_t side){
35               (side)?(*fClusterNIndexes)[fNclustersN++]= 
36                    clindex:(*fClusterPIndexes)[fNclustersP++]=clindex;}
37         
38 //Returns index of one side cluster in TClonesArray, NOT AliITSclusterSSD
39   Int_t    GetNSideClusterIdx(Int_t index) const; //input index is number of cluster in this package 
40   Int_t    GetPSideClusterIdx(Int_t index) const; //returns index in TClonesArray
41   Int_t    GetClusterIdx(Int_t index,Bool_t side) const 
42                 {return (side)?GetPSideClusterIdx(index):GetNSideClusterIdx(index);}
43  
44   AliITSclusterSSD*    GetNSideCluster(Int_t index);
45   AliITSclusterSSD*    GetPSideCluster(Int_t index); //index is 
46   AliITSclusterSSD*    GetCluster(Int_t index, Bool_t side)
47                 {return (side)?GetPSideCluster(index):GetNSideCluster(index);}
48                         
49   Int_t    GetNextPIdx(Int_t OI) const; //Returns index of next P cluster in package; OI == Original Inedx (in TClonesArray)
50   Int_t    GetPrvPIdx(Int_t OI) const;  //Returns index of previous P cluster in package; OI == Original Inedx (in TClonesArray)
51   Int_t    GetNextNIdx(Int_t OI) const; //Returns index of next N cluster in package; OI == Original Inedx (in TClonesArray)
52   Int_t    GetPrvNIdx(Int_t OI) const;  //Returns index of previous N cluster in package; OI == Original Inedx (in TClonesArray)
53   
54   Int_t    GetNumOfClustersN() const {return fNclustersN;}  
55   Int_t    GetNumOfClustersP() const {return fNclustersP;}   
56   Int_t    GetNumOfClusters() const {return fNclustersP+fNclustersN;}  
57   Int_t    GetNumOfClusters(Bool_t side) const {return (side)?fNclustersP:fNclustersN;}
58   
59   //returns number of clusters belonging to package,
60   //that crosses with only one cluster on the other side 
61   //There might be only 2 such a clusters:
62   //on the begining and on the end of the package
63   //
64   Bool_t    GetClusterWithOneCross(Int_t & index, Bool_t& side );  
65   void      DelCluster(Int_t index, Bool_t side);
66   void      DelPCluster(Int_t index);
67   void      DelNCluster(Int_t index);
68   void      DelClusterOI(Int_t index, Bool_t side); //OI indicates that it is Original Index
69   void      DelPClusterOI(Int_t index); //it means value in look up table
70   void      DelNClusterOI(Int_t index);  
71   
72   void      SplitPackage(Int_t pi, Int_t ni, AliITSpackageSSD* pkg);
73   void      GetAllCombinations(Int_t**array,Int_t &num,Int_t size);
74   
75   void      ConsumeClusters();
76   void      PrintClusters();
77   
78 protected:
79   
80   TClonesArray *fClustersN;   //Pointer to array of clusters - only to have direct acces to 
81   TClonesArray *fClustersP;   //clusters
82   Int_t    fNclustersN;       // number of N clusters
83   Int_t    fNclustersP;       // number of P cluster
84   TArrayI *fClusterNIndexes;  // array of pointers to the N clusters
85   TArrayI *fClusterPIndexes;  // array of pointers to the P clusters
86
87   static const Bool_t fgkSIDEP;  // boolean for P side 
88   static const Bool_t fgkSIDEN;  // boolean for N side
89   static const Int_t fgkDebug=0;    // debugging flag
90
91
92 /***************/
93 /*   Methods   */
94 /***************/
95
96   
97   void    MakeCombin(Int_t**arr, Int_t& nu, Int_t np, Int_t *occup,Int_t size);
98   Bool_t  IsFree(Int_t idx, Int_t nn, const Int_t *lis) const;
99   
100
101                  
102 private:
103                  
104 //-------------------------------------------------------                
105   ClassDef(AliITSpackageSSD,1)  
106 };
107
108 #endif