ROOT logo
#ifndef HMETAMATCH2_H
#define HMETAMATCH2_H
#include "hreconstructor.h"
#include "TString.h"
#include "TObject.h"

#define RICH_TAB_SIZE 3
#define META_TAB_SIZE 3

class HMetaMatch2:public TObject {
private:
   Int_t   trkCandInd;                     // index of HTrkCand object
   Int_t   ownIndex;                       // index of "this" object in categoty
   
   Char_t  sector;                         // sector number
   
   UChar_t nRpcClust;                      // Number of matched rpc clusters
   UChar_t nShrHits;                       // Number of matched shower hits
   UChar_t nTofHits;                       // Number of matched tof clusters or hits
   

   Short_t rungeKuttaInd;
   
   Short_t rkIndShower[META_TAB_SIZE];
   Short_t rkIndTofCl[META_TAB_SIZE];
   Short_t rkIndTof1[META_TAB_SIZE];
   Short_t rkIndTof2[META_TAB_SIZE];
   Short_t rkIndRpc[META_TAB_SIZE];

   Short_t kalmanFilterInd;                // index of HKalTrack in catKalTrack

   Short_t kfIndShower[META_TAB_SIZE];
   Short_t kfIndTofCl [META_TAB_SIZE];
   Short_t kfIndTof1  [META_TAB_SIZE];
   Short_t kfIndTof2  [META_TAB_SIZE];
   Short_t kfIndRpc   [META_TAB_SIZE];

   Short_t rpcClstInd[META_TAB_SIZE];      // Index of HRpcCluster object
   Short_t shrHitInd[META_TAB_SIZE];       // Index of HShowerHit object
   Short_t tofClstInd[META_TAB_SIZE];      // Index of HTofCluster object
   Short_t tofHit1Ind[META_TAB_SIZE];      // Index of HTofHit object  ???
   Short_t tofHit2Ind[META_TAB_SIZE];      // Index of HTofHit object  ???
   
   // System 0:
   Float_t rpcQuality[META_TAB_SIZE];      // Matching quality
   Float_t rpcDX[META_TAB_SIZE];           // Deviation in X-coordinate
   Float_t rpcDY[META_TAB_SIZE];           // Deviation in Y-coordinate
   
   Float_t shrQuality[META_TAB_SIZE];      // Matching quality
   Float_t shrDX[META_TAB_SIZE];           // Deviation in X-coordinate
   Float_t shrDY[META_TAB_SIZE];           // Deviation in Y-coordinate
   Float_t emcPath[META_TAB_SIZE];         // Track path in emc cluster cell
   
   // System 1:
   Float_t tofClstQuality[META_TAB_SIZE];  // Matching quality
   Float_t tofClstDX[META_TAB_SIZE];       // Deviation in X-coordinate
   Float_t tofClstDY[META_TAB_SIZE];       // Deviation in Y-coordinate
   
   Float_t tofHit1Quality[META_TAB_SIZE];  // Matching quality
   Float_t tofHit1DX[META_TAB_SIZE];       // Deviation in X-coordinate
   Float_t tofHit1DY[META_TAB_SIZE];       // Deviation in Y-coordinate
   
   Float_t tofHit2Quality[META_TAB_SIZE];  // Matching quality
   Float_t tofHit2DX[META_TAB_SIZE];       // Deviation in X-coordinate
   Float_t tofHit2DY[META_TAB_SIZE];       // Deviation in Y-coordinate
   
   
   Int_t   splineInd;                      // index of HSplineTrack object
  
   UChar_t nRichId;                        // number of matched rings in richInd[]
   UChar_t nRichIPUId;                     // number of matched rings in richIPUInd[]
   Int_t   richInd[RICH_TAB_SIZE];         // arr.of indexes of HRichHit objects
   Int_t   richIPUInd[RICH_TAB_SIZE];      // arr.of indexes of HRichHitIPU objects
                                           // arrais are sorted by matching quality

   Char_t  flag;               // First bit for shower(=0)/emc(=1) distinguish

   Bool_t isFakeInner;
   Bool_t isFakeOuter;

public:
   HMetaMatch2();
   ~HMetaMatch2(){}
   HMetaMatch2(Short_t sec, Int_t tkInd, Int_t ind);
   
   void setTrkCandInd(Int_t tr)                {trkCandInd = tr;}
   void setOwnIndex(Int_t ind)                 {ownIndex   = ind;}
   
   void setNRpcClust(UChar_t n)                {nRpcClust = n<META_TAB_SIZE ? n:META_TAB_SIZE;}
   void setNShrHits(UChar_t n)                 {nShrHits  = n<META_TAB_SIZE ? n:META_TAB_SIZE;}
   void setNTofHits(UChar_t n)                 {nTofHits  = n<META_TAB_SIZE ? n:META_TAB_SIZE;}
   void setRpcClst(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy);
   void setShrHit(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy);
   void setTofClst(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy);
   void setTofHit1(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy);
   void setTofHit2(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy);
   
   // Functions for HMetaMatchF2:
   void setRpcClstMMF(UChar_t nln,Short_t ind[],Float_t ql2[][3]);
   void setShrHitMMF( UChar_t nln,Short_t ind[],Float_t ql2[][3]);
   void setTofClstMMF(UChar_t nln,Short_t ind[][3],Float_t ql2[][9]);
   void setEmcClstMMF(UChar_t nln,Short_t ind[],Float_t ql2[][4]);


   void setSplineInd(Int_t _splineInd) { splineInd =  _splineInd; }

   void setSector(Char_t sec)                  {sector     = sec;}
   void setNCandForRich(UChar_t nrich)         {nRichId    = nrich;}
   void setNCandForIPU(UChar_t nrich)          {nRichIPUId = nrich;}
   void setRichInd(UChar_t id, Short_t ind)    {if(id<RICH_TAB_SIZE) richInd[id] = ind;}
   void setRichIPUInd(UChar_t id, Short_t ind) {if(id<RICH_TAB_SIZE) richIPUInd[id] = ind;}


   void setRungeKuttaIndShowerHit(UChar_t n, Short_t ind)  { rkIndShower[n] = ind; }
   void setRungeKuttaIndEmcCluster(UChar_t n, Short_t ind) { rkIndShower[n] = ind; }
   void setRungeKuttaIndTofClst(UChar_t n, Short_t ind)    { rkIndTofCl[n]  = ind; }
   void setRungeKuttaIndTofHit1(UChar_t n,  Short_t ind)   { rkIndTof1[n]   = ind; }
   void setRungeKuttaIndTofHit2(UChar_t n,  Short_t ind)   { rkIndTof2[n]   = ind; }
   void setRungeKuttaIndRpcClst(UChar_t n,   Short_t ind)  { rkIndRpc[n]    = ind; }
   
   void setRungeKuttaInd(Short_t _rungeKuttaInd)    { rungeKuttaInd = _rungeKuttaInd; }
   
   void setKalmanFilterInd(Int_t _kalmanFilterInd) {kalmanFilterInd = _kalmanFilterInd; }

   void setKalmanFilterIndShowerHit(UChar_t n, Short_t ind)  { kfIndShower[n] = ind; }
   void setKalmanFilterIndEmcCluster(UChar_t n, Short_t ind) { kfIndShower[n] = ind; }
   void setKalmanFilterIndTofClst  (UChar_t n, Short_t ind)  { kfIndTofCl[n]  = ind; }
   void setKalmanFilterIndTofHit1  (UChar_t n, Short_t ind)  { kfIndTof1[n]   = ind; }
   void setKalmanFilterIndTofHit2  (UChar_t n, Short_t ind)  { kfIndTof2[n]   = ind; }
   void setKalmanFilterIndRpcClst  (UChar_t n, Short_t ind)  { kfIndRpc[n]    = ind; }

   void setInnerFake(Bool_t fake) { isFakeInner=fake;}
   void setOuterFake(Bool_t fake) { isFakeOuter=fake;}
   void setEmcClusterFlag(void)   { flag |= 1;}
   void setShowerHitFlag(void)    { flag &= ~1;}

   Char_t  getSector(void) const                {return sector;}
   Int_t   getTrkCandInd(void) const            {return trkCandInd;}
   Int_t   getOwnIndex(void) const              {return ownIndex;}

   Int_t   getMetaArrSize(void) const           {return META_TAB_SIZE;}
   
   Bool_t  isEmcCluster(void) const             {return (flag&1)==1;}
   Bool_t  isShowerHit(void) const              {return (flag&1)==0;}
   
   Bool_t  isEmcClustValid(UChar_t n) const     {return isEmcCluster() && n<nShrHits;}
   Bool_t  isShowerHitValid(UChar_t n) const    {return isShowerHit() && n<nShrHits;}
   
   Int_t   getSystem(void) const;
   UChar_t getNRpcClusters(void) const          {return nRpcClust;}
   UChar_t getNShrHits(void) const              {return isShowerHit()  ? nShrHits : 0;}
   UChar_t getNEmcClusters(void) const          {return isEmcCluster() ? nShrHits : 0;}
   UChar_t getNTofHits(void) const              {return nTofHits;}
   
   Short_t getRpcClstInd(UChar_t n) const       {return n<nRpcClust ? rpcClstInd[n] : -1;}
   Short_t getShowerHitInd(UChar_t n) const     {return isShowerHitValid(n) ? shrHitInd[n] : -1;}
   Short_t getEmcClusterInd(UChar_t n) const    {return isEmcClustValid(n)  ? shrHitInd[n] : -1;}
   Short_t getTofClstInd(UChar_t n) const       {return n<nTofHits  ? tofClstInd[n] : -1;}
   Short_t getTofHit1Ind(UChar_t n) const       {return n<nTofHits  ? tofHit1Ind[n] : -1;}
   Short_t getTofHit2Ind(UChar_t n) const       {return n<nTofHits  ? tofHit2Ind[n] : -1;}
   
   Float_t getRpcClstQuality(UChar_t n) const   {return n<nRpcClust ? rpcQuality[n] : -1.f;}
   Float_t getShowerHitQuality(UChar_t n) const  {return isShowerHitValid(n) ? shrQuality[n] : -1.f;}
   Float_t getEmcClusterQuality(UChar_t n) const {return isEmcClustValid(n)  ? shrQuality[n] : -1.f;}
   Float_t getTofClstQuality(UChar_t n) const   {return n<nTofHits  ? tofClstQuality[n] : -1.f;}
   Float_t getTofHit1Quality(UChar_t n) const   {return n<nTofHits  ? tofHit1Quality[n] : -1.f;}
   Float_t getTofHit2Quality(UChar_t n) const   {return n<nTofHits  ? tofHit2Quality[n] : -1.f;}
   
   Float_t getRpcClstDX(UChar_t n) const        {return n<nRpcClust ? rpcDX[n] : -1000.f;}
   Float_t getShowerHitDX(UChar_t n) const      {return isShowerHitValid(n) ? shrDX[n] : -1000.f;}
   Float_t getEmcClusterDX(UChar_t n) const     {return isEmcClustValid(n)  ? shrDX[n] : -1000.f;}
   Float_t getEmcCellPath(UChar_t n) const      {return isEmcClustValid(n)  ? emcPath[n] : -1000.f;}
   Float_t getTofClstDX(UChar_t n) const        {return n<nTofHits  ? tofClstDX[n] : -1000.f;}
   Float_t getTofHit1DX(UChar_t n) const        {return n<nTofHits  ? tofHit1DX[n] : -1000.f;}
   Float_t getTofHit2DX(UChar_t n) const        {return n<nTofHits  ? tofHit2DX[n] : -1000.f;}
   
   Float_t getRpcClstDY(UChar_t n) const        {return n<nRpcClust ? rpcDY[n] : -1000.f;}
   Float_t getShowerHitDY(UChar_t n) const      {return isShowerHitValid(n) ? shrDY[n] : -1000.f;}
   Float_t getEmcClusterDY(UChar_t n) const     {return isEmcClustValid(n)  ? shrDY[n] : -1000.f;}
   Float_t getTofClstDY(UChar_t n) const        {return n<nTofHits  ? tofClstDY[n] : -1000.f;}
   Float_t getTofHit1DY(UChar_t n) const        {return n<nTofHits  ? tofHit1DY[n] : -1000.f;}
   Float_t getTofHit2DY(UChar_t n) const        {return n<nTofHits  ? tofHit2DY[n] : -1000.f;}


   Int_t   getSplineInd(void) const             {return splineInd;}
   
   
   Short_t getRungeKuttaIndShowerHit(UChar_t n)  const { return isShowerHitValid(n) ? rkIndShower[n] : -1; }
   Short_t getRungeKuttaIndEmcCluster(UChar_t n) const { return isEmcClustValid(n)  ? rkIndShower[n] : -1; }
   Short_t getRungeKuttaIndTofClst(UChar_t n)    const { return n < nTofHits  ?  rkIndTofCl[n] : -1; }
   Short_t getRungeKuttaIndTofHit1(UChar_t n)    const { return n < nTofHits  ?   rkIndTof1[n] : -1; }
   Short_t getRungeKuttaIndTofHit2(UChar_t n)    const { return n < nTofHits  ?   rkIndTof2[n] : -1; }
   Short_t getRungeKuttaIndRpcClst(UChar_t n)    const { return n < nRpcClust ?    rkIndRpc[n] : -1; }
   
   Short_t getRungeKuttaInd() const        { return rungeKuttaInd; }
   
   
   
   Short_t getKalmanFilterInd(void) const       {return kalmanFilterInd;}

   Short_t getKalmanFilterIndShowerHit(UChar_t n)  const { return isShowerHitValid(n) ? kfIndShower[n] : -1; }
   Short_t getKalmanFilterIndEmcCluster(UChar_t n) const { return isEmcClustValid(n)  ? kfIndShower[n] : -1; }
   Short_t getKalmanFilterIndTofClst  (UChar_t n) const { return n < nTofHits  ?  kfIndTofCl[n] : -1; }
   Short_t getKalmanFilterIndTofHit1  (UChar_t n) const { return n < nTofHits  ?   kfIndTof1[n] : -1; }
   Short_t getKalmanFilterIndTofHit2  (UChar_t n) const { return n < nTofHits  ?   kfIndTof2[n] : -1; }
   Short_t getKalmanFilterIndRpcClst  (UChar_t n) const { return n < nRpcClust ?    kfIndRpc[n] : -1; }
   
   UChar_t getNCandForRich(void) const          {return nRichId;}
   UChar_t getNCandForIPU(void) const           {return nRichIPUId;}
   Short_t getARichInd(UChar_t id) const        {return id<RICH_TAB_SIZE ? richInd[id]    : -1;}
   Short_t getARichIPUInd(UChar_t id) const     {return id<RICH_TAB_SIZE ? richIPUInd[id] : -1;}

   Bool_t isFake()      { return isFakeInner|isFakeOuter;}
   Bool_t isInnerFake() { return isFakeInner;}
   Bool_t isOuterFake() { return isFakeOuter;}

   void    print(void);
   
private:   
   void    setDefForRest(void);

   ClassDef(HMetaMatch2,3)
};

#endif

 hmetamatch2.h:1
 hmetamatch2.h:2
 hmetamatch2.h:3
 hmetamatch2.h:4
 hmetamatch2.h:5
 hmetamatch2.h:6
 hmetamatch2.h:7
 hmetamatch2.h:8
 hmetamatch2.h:9
 hmetamatch2.h:10
 hmetamatch2.h:11
 hmetamatch2.h:12
 hmetamatch2.h:13
 hmetamatch2.h:14
 hmetamatch2.h:15
 hmetamatch2.h:16
 hmetamatch2.h:17
 hmetamatch2.h:18
 hmetamatch2.h:19
 hmetamatch2.h:20
 hmetamatch2.h:21
 hmetamatch2.h:22
 hmetamatch2.h:23
 hmetamatch2.h:24
 hmetamatch2.h:25
 hmetamatch2.h:26
 hmetamatch2.h:27
 hmetamatch2.h:28
 hmetamatch2.h:29
 hmetamatch2.h:30
 hmetamatch2.h:31
 hmetamatch2.h:32
 hmetamatch2.h:33
 hmetamatch2.h:34
 hmetamatch2.h:35
 hmetamatch2.h:36
 hmetamatch2.h:37
 hmetamatch2.h:38
 hmetamatch2.h:39
 hmetamatch2.h:40
 hmetamatch2.h:41
 hmetamatch2.h:42
 hmetamatch2.h:43
 hmetamatch2.h:44
 hmetamatch2.h:45
 hmetamatch2.h:46
 hmetamatch2.h:47
 hmetamatch2.h:48
 hmetamatch2.h:49
 hmetamatch2.h:50
 hmetamatch2.h:51
 hmetamatch2.h:52
 hmetamatch2.h:53
 hmetamatch2.h:54
 hmetamatch2.h:55
 hmetamatch2.h:56
 hmetamatch2.h:57
 hmetamatch2.h:58
 hmetamatch2.h:59
 hmetamatch2.h:60
 hmetamatch2.h:61
 hmetamatch2.h:62
 hmetamatch2.h:63
 hmetamatch2.h:64
 hmetamatch2.h:65
 hmetamatch2.h:66
 hmetamatch2.h:67
 hmetamatch2.h:68
 hmetamatch2.h:69
 hmetamatch2.h:70
 hmetamatch2.h:71
 hmetamatch2.h:72
 hmetamatch2.h:73
 hmetamatch2.h:74
 hmetamatch2.h:75
 hmetamatch2.h:76
 hmetamatch2.h:77
 hmetamatch2.h:78
 hmetamatch2.h:79
 hmetamatch2.h:80
 hmetamatch2.h:81
 hmetamatch2.h:82
 hmetamatch2.h:83
 hmetamatch2.h:84
 hmetamatch2.h:85
 hmetamatch2.h:86
 hmetamatch2.h:87
 hmetamatch2.h:88
 hmetamatch2.h:89
 hmetamatch2.h:90
 hmetamatch2.h:91
 hmetamatch2.h:92
 hmetamatch2.h:93
 hmetamatch2.h:94
 hmetamatch2.h:95
 hmetamatch2.h:96
 hmetamatch2.h:97
 hmetamatch2.h:98
 hmetamatch2.h:99
 hmetamatch2.h:100
 hmetamatch2.h:101
 hmetamatch2.h:102
 hmetamatch2.h:103
 hmetamatch2.h:104
 hmetamatch2.h:105
 hmetamatch2.h:106
 hmetamatch2.h:107
 hmetamatch2.h:108
 hmetamatch2.h:109
 hmetamatch2.h:110
 hmetamatch2.h:111
 hmetamatch2.h:112
 hmetamatch2.h:113
 hmetamatch2.h:114
 hmetamatch2.h:115
 hmetamatch2.h:116
 hmetamatch2.h:117
 hmetamatch2.h:118
 hmetamatch2.h:119
 hmetamatch2.h:120
 hmetamatch2.h:121
 hmetamatch2.h:122
 hmetamatch2.h:123
 hmetamatch2.h:124
 hmetamatch2.h:125
 hmetamatch2.h:126
 hmetamatch2.h:127
 hmetamatch2.h:128
 hmetamatch2.h:129
 hmetamatch2.h:130
 hmetamatch2.h:131
 hmetamatch2.h:132
 hmetamatch2.h:133
 hmetamatch2.h:134
 hmetamatch2.h:135
 hmetamatch2.h:136
 hmetamatch2.h:137
 hmetamatch2.h:138
 hmetamatch2.h:139
 hmetamatch2.h:140
 hmetamatch2.h:141
 hmetamatch2.h:142
 hmetamatch2.h:143
 hmetamatch2.h:144
 hmetamatch2.h:145
 hmetamatch2.h:146
 hmetamatch2.h:147
 hmetamatch2.h:148
 hmetamatch2.h:149
 hmetamatch2.h:150
 hmetamatch2.h:151
 hmetamatch2.h:152
 hmetamatch2.h:153
 hmetamatch2.h:154
 hmetamatch2.h:155
 hmetamatch2.h:156
 hmetamatch2.h:157
 hmetamatch2.h:158
 hmetamatch2.h:159
 hmetamatch2.h:160
 hmetamatch2.h:161
 hmetamatch2.h:162
 hmetamatch2.h:163
 hmetamatch2.h:164
 hmetamatch2.h:165
 hmetamatch2.h:166
 hmetamatch2.h:167
 hmetamatch2.h:168
 hmetamatch2.h:169
 hmetamatch2.h:170
 hmetamatch2.h:171
 hmetamatch2.h:172
 hmetamatch2.h:173
 hmetamatch2.h:174
 hmetamatch2.h:175
 hmetamatch2.h:176
 hmetamatch2.h:177
 hmetamatch2.h:178
 hmetamatch2.h:179
 hmetamatch2.h:180
 hmetamatch2.h:181
 hmetamatch2.h:182
 hmetamatch2.h:183
 hmetamatch2.h:184
 hmetamatch2.h:185
 hmetamatch2.h:186
 hmetamatch2.h:187
 hmetamatch2.h:188
 hmetamatch2.h:189
 hmetamatch2.h:190
 hmetamatch2.h:191
 hmetamatch2.h:192
 hmetamatch2.h:193
 hmetamatch2.h:194
 hmetamatch2.h:195
 hmetamatch2.h:196
 hmetamatch2.h:197
 hmetamatch2.h:198
 hmetamatch2.h:199
 hmetamatch2.h:200
 hmetamatch2.h:201
 hmetamatch2.h:202
 hmetamatch2.h:203
 hmetamatch2.h:204
 hmetamatch2.h:205
 hmetamatch2.h:206
 hmetamatch2.h:207
 hmetamatch2.h:208
 hmetamatch2.h:209
 hmetamatch2.h:210
 hmetamatch2.h:211
 hmetamatch2.h:212
 hmetamatch2.h:213
 hmetamatch2.h:214
 hmetamatch2.h:215
 hmetamatch2.h:216
 hmetamatch2.h:217
 hmetamatch2.h:218
 hmetamatch2.h:219
 hmetamatch2.h:220
 hmetamatch2.h:221
 hmetamatch2.h:222
 hmetamatch2.h:223
 hmetamatch2.h:224
 hmetamatch2.h:225
 hmetamatch2.h:226