#ifndef HMDCIDEALTRACKING_H
#define HMDCIDEALTRACKING_H
#include "hreconstructor.h"
#include "hlocation.h"
#include "hmdclistgroupcells.h"
class HIterator;
class HMdcHitSim;
class HMdcSegSim;
class HCategory;
class HMdcTrkCand;
class HMdcSizesCells;
class HGeantKine;
class HGeantMdc;
class HMdcIdealTracking : public HReconstructor {
  private:
    
    HCategory* pGeantKineCat;      
    HCategory* pGeantMdcCat;       
    HCategory* pMdcCal1Cat;        
    HIterator* iterGeantKine;      
    HLocation  locCal1;            
    
    
    HCategory* pMdcSegCat;         
    HCategory* pMdcHitCat;         
    HCategory* pMdcTrkCandCat;     
    HLocation  locSeg;             
    HLocation  locHit;             
    HLocation  locTrkCand;         
    HMdcSizesCells* pMSizesCells;
    Bool_t isMdcActive[6][4];     
    
    
    Int_t nFiredLayersSeg1cut;    
    Int_t nFiredLayersSeg2cut;    
    
    
    Int_t      trackNumber;       
    Int_t      trackSector;       
    HGeantMdc* geantHitMod[4];    
    HGeantMdc* geantHitLay[4][6]; 
    UChar_t    nGeantMdcLay[4];   
    Double_t   x1[4],y1[4],z1[4]; 
    Double_t   x2[4],y2[4],z2[4]; 
    HMdcList24GroupCells* lCells; 
    Bool_t     fillParallel;      
    Double_t   sigX[4];           
    Double_t   sigY[4];           
  public:
    HMdcIdealTracking(void);
    HMdcIdealTracking(const Text_t *name,const Text_t *title);
    ~HMdcIdealTracking(void);
    void   fillParallelCategories(){fillParallel=kTRUE;}
    void   setResolutionX(Double_t x0,Double_t x1,Double_t x2,Double_t x3) {sigX[0] = x0; sigX[1] = x1; sigX[2] = x2; sigX[3] = x3;}
    void   setResolutionY(Double_t y0,Double_t y1,Double_t y2,Double_t y3) {sigY[0] = y0; sigY[1] = y1; sigY[2] = y2; sigY[3] = y3;}
    Bool_t init(void);
    Bool_t reinit(void);
    Bool_t finalize(void);
    Int_t  execute(void);
    void   setNFiredLayersCuts(Int_t c1,Int_t c2) {nFiredLayersSeg1cut=c1; nFiredLayersSeg2cut=c2;}
    void printStatus(void);
  private:
    void         clear(void);
    Bool_t       testTrack(HGeantKine* pGeantKine);
    Int_t        fillHitsSeg(Int_t segment);
    HMdcSegSim*  getSegSlot(Int_t segment, Int_t& index);
    Int_t        fillHit(Int_t module);
    HMdcHitSim*  getHitSlot(Int_t module, Int_t& index);
    HMdcTrkCand* fillTrkCandISeg(Int_t segIndex);
    HMdcTrkCand* fillTrkCandOSeg(HMdcTrkCand* fTCand,Int_t segIndex);
    void         collectWires(Int_t s,Int_t m, Int_t l, HGeantMdc* pGeantMdc);
    void         setWires(HMdcSegSim* pMdcSeg, Int_t seg);
    void         setWires(HMdcHitSim* pMdcHit, Int_t mod);
  ClassDef(HMdcIdealTracking,0) 
};
#endif