ROOT logo
#ifndef HMDCGETCONTAINERS_H
#define HMDCGETCONTAINERS_H

#include "hades.h"
#include "hmdctrackddef.h"
#include "hcategory.h"
#include "TString.h"

class HRuntimeDb;
class HSpectrometer;
class HMdcLayerGeomPar;
class HMdcGeomPar;
class HMdcDetector;
class HSpecGeomPar;
class HMdcGeomStruct;
class HMdcRawStruct;
class HMdcLookupGeom;
class HGeomCompositeVolume;
class HModGeomPar;
class HMdcLayerGeomParLay;
class HGeomTransform;
class HMdcLayerCorrPar;
class HParSet;

class HMdcGetContainers : public TObject {
  protected:
    static HMdcGetContainers* fMdcGetContainers;

    HCategory*        pMdcCal1Cat;
    HCategory*        pGeantKineCat;
    HCategory*        pGeantMdcCat;
    HCategory*        pMdcClusCat;
    HCategory*        pMdcClusFitCat;
    HCategory*        pMdcWireFitCat;
    HCategory*        pMdcClusInfCat;
    HCategory*        pMdcTrkCandCat;
    
    HRuntimeDb*       rtdb;
    Bool_t            isRtdb;
    HSpectrometer*    spectr;
    HMdcLayerGeomPar* fMdcLayerGeomPar;
    Bool_t            isMdcLayerGeomPar;
    HMdcGeomPar*      fMdcGeomPar;
    Bool_t            isMdcGeomPar;
    HMdcDetector*     fMdcDetector;
    Bool_t            isMdcDetector;
    HSpecGeomPar*     fSpecGeomPar;
    Bool_t            isSpecGeomPar;
    HMdcGeomStruct*   fMdcGeomStruct;
    Bool_t            isMdcGeomStruct;
    HMdcRawStruct*    fMdcRawStruct;
    Bool_t            isMdcRawStruct;
    HMdcLookupGeom*   fMdcLookupGeom;
    Bool_t            isMdcLookupGeom;
    HMdcLayerCorrPar* fMdcLayerCorrPar;
    Bool_t            isMdcLayerCorrPar;
    
    Bool_t            isMdcSetupInited;
    Bool_t            modSetup[6][4];
    Bool_t            segSetup[6][2];
    Short_t           numMods[6];
    
    Int_t             isSimulation;      // 0-real data, 1-sim.data, 2-merge
    
  public:
    static Bool_t isInited(HParSet *par);
    static HMdcGetContainers* getObject();
    static void deleteCont();
    
    // Parameters HRuntimeDb:
    HMdcLayerGeomPar*     getMdcLayerGeomPar(Bool_t init=kFALSE);
    HMdcLayerCorrPar*     getMdcLayerCorrPar(Bool_t init=kFALSE);
    HMdcGeomPar*          getMdcGeomPar(Bool_t init=kFALSE);
    HMdcDetector*         getMdcDetector();
    HSpecGeomPar*         getSpecGeomPar(Bool_t init=kFALSE);
    HMdcGeomStruct*       getMdcGeomStruct(Bool_t init=kFALSE);
    HMdcRawStruct*        getMdcRawStruct(Bool_t init=kFALSE);
    HMdcLookupGeom*       getMdcLookupGeom(Bool_t init=kFALSE);
    HModGeomPar*          getModGeomPar(Int_t sec,Int_t mod,Bool_t init=kFALSE);
    HGeomCompositeVolume* getGeomCompositeVolume(Int_t mod, Bool_t init=kFALSE);
    HMdcLayerGeomParLay*  getMdcLayerGeomParLay(Int_t sec,Int_t mod,Int_t lay, Bool_t init=kFALSE);
    // Transformations:
    const HGeomTransform& getLabTransSec(Int_t sec, Bool_t init=kFALSE);
    Bool_t   getLabTransSec(HGeomTransform& trans,Int_t sec,Bool_t init=kFALSE);
    const HGeomTransform& getLabTransMod(Int_t sec,Int_t mod, Bool_t init=kFALSE);
    Bool_t   getLabTransMod(HGeomTransform& trans, Int_t sec, Int_t mod, Bool_t init=kFALSE);
    Bool_t   getSecTransMod(HGeomTransform& trans, Int_t sec, Int_t mod, Bool_t init=kFALSE);
    Bool_t   getLabTransLayer(HGeomTransform& trans, Int_t sec,Int_t mod, Int_t lay,
                              Bool_t init=kFALSE);
    Bool_t   getSecTransLayer(HGeomTransform& trans, Int_t sec,Int_t mod, Int_t lay, 
                              Bool_t init=kFALSE);
    const HGeomTransform& getModTransLayer(Int_t sec, Int_t mod, Int_t lay, Bool_t init=kFALSE);
    Bool_t   getSecTransCathLayer(HGeomTransform& trans1,HGeomTransform& trans2,
                                  Int_t sec, Int_t mod, Int_t lay, Bool_t init=kFALSE);
    Bool_t   getLabTransLayerZ0(HGeomTransform& trans, Int_t sec, Int_t mod, Int_t lay, 
                                Bool_t init=kFALSE) {return getLabTransLayer(trans,sec,mod,init);}
    Double_t getSensWireThick(Int_t mod, Int_t lay);
    Bool_t   getModTransGeantLayer(HGeomTransform& trans, Int_t sec, Int_t mod, Int_t lay);
    Bool_t   getLabTransGeantLayer(HGeomTransform& trans, Int_t sec, Int_t mod, Int_t lay);
    Bool_t   getSecTransGeantLayer(HGeomTransform& trans, Int_t sec, Int_t mod, Int_t lay);
    void     setModList(const Int_t (*modList)[4]);
    Bool_t   isModActive(UInt_t sec, UInt_t mod);
    Bool_t   isSegActive(UInt_t sec, UInt_t seg);
    Bool_t   isSecActive(UInt_t sec);
    Short_t  getNumModulesInSec(UInt_t sec);
     
    // Categories:
    HCategory*    getCatMdcCal1(void);
    HCategory*    getCatGeantKine(void);
    HCategory*    getCatGeantMdc(void);
    HCategory*    getCatMdcClus(Bool_t create=kFALSE);
    HCategory*    getCatMdcClusFit(Bool_t create=kFALSE);
    HCategory*    getCatMdcWireFit(Bool_t create=kFALSE);
    HCategory*    getCatMdcClusInf(Bool_t create=kFALSE);
    HCategory*    getCatMdcTrkCand(Bool_t create=kFALSE);
    
    //  For using in macro without Hades object:
    void          setCatMdcCal1(HCategory* cat)    {pMdcCal1Cat = cat;}
    void          setCatGeantKine(HCategory* cat)  {pGeantKineCat = cat;}
    void          setCatGeantMdc(HCategory* cat)   {pGeantMdcCat = cat;}
    void          setCatMdcClus(HCategory* cat)    {pMdcClusCat = cat;}
    void          setCatMdcClusFit(HCategory* cat) {pMdcClusFitCat = cat;}
    void          setCatMdcWireFit(HCategory* cat) {pMdcWireFitCat = cat;}
    void          setCatMdcClusInf(HCategory* cat) {pMdcClusInfCat = cat;}
    void          setCatMdcTrkCand(HCategory* cat) {pMdcTrkCandCat = cat;}
    
    // Others:
    static Bool_t isGeant(void) {return getObject()->isSimData();}
    static void   getFileName(TString& fileName);
    static void   getFileNameWInd(TString& fileName);
    static void   getRunId(TString& runId);
    static void   getEventDate(TString& eventDate);
    static void   getEventTime(TString& eventTime);
    
  private:
    Bool_t        isSimData(void);
    Bool_t        initCont(HParSet *par);
    void          initMdcSetup(void);
    HMdcGetContainers();
    ~HMdcGetContainers(){}
                                         
    ClassDef(HMdcGetContainers,0)
};

#endif  /*!HMDCGETCONTAINERS_H*/
 hmdcgetcontainers.h:1
 hmdcgetcontainers.h:2
 hmdcgetcontainers.h:3
 hmdcgetcontainers.h:4
 hmdcgetcontainers.h:5
 hmdcgetcontainers.h:6
 hmdcgetcontainers.h:7
 hmdcgetcontainers.h:8
 hmdcgetcontainers.h:9
 hmdcgetcontainers.h:10
 hmdcgetcontainers.h:11
 hmdcgetcontainers.h:12
 hmdcgetcontainers.h:13
 hmdcgetcontainers.h:14
 hmdcgetcontainers.h:15
 hmdcgetcontainers.h:16
 hmdcgetcontainers.h:17
 hmdcgetcontainers.h:18
 hmdcgetcontainers.h:19
 hmdcgetcontainers.h:20
 hmdcgetcontainers.h:21
 hmdcgetcontainers.h:22
 hmdcgetcontainers.h:23
 hmdcgetcontainers.h:24
 hmdcgetcontainers.h:25
 hmdcgetcontainers.h:26
 hmdcgetcontainers.h:27
 hmdcgetcontainers.h:28
 hmdcgetcontainers.h:29
 hmdcgetcontainers.h:30
 hmdcgetcontainers.h:31
 hmdcgetcontainers.h:32
 hmdcgetcontainers.h:33
 hmdcgetcontainers.h:34
 hmdcgetcontainers.h:35
 hmdcgetcontainers.h:36
 hmdcgetcontainers.h:37
 hmdcgetcontainers.h:38
 hmdcgetcontainers.h:39
 hmdcgetcontainers.h:40
 hmdcgetcontainers.h:41
 hmdcgetcontainers.h:42
 hmdcgetcontainers.h:43
 hmdcgetcontainers.h:44
 hmdcgetcontainers.h:45
 hmdcgetcontainers.h:46
 hmdcgetcontainers.h:47
 hmdcgetcontainers.h:48
 hmdcgetcontainers.h:49
 hmdcgetcontainers.h:50
 hmdcgetcontainers.h:51
 hmdcgetcontainers.h:52
 hmdcgetcontainers.h:53
 hmdcgetcontainers.h:54
 hmdcgetcontainers.h:55
 hmdcgetcontainers.h:56
 hmdcgetcontainers.h:57
 hmdcgetcontainers.h:58
 hmdcgetcontainers.h:59
 hmdcgetcontainers.h:60
 hmdcgetcontainers.h:61
 hmdcgetcontainers.h:62
 hmdcgetcontainers.h:63
 hmdcgetcontainers.h:64
 hmdcgetcontainers.h:65
 hmdcgetcontainers.h:66
 hmdcgetcontainers.h:67
 hmdcgetcontainers.h:68
 hmdcgetcontainers.h:69
 hmdcgetcontainers.h:70
 hmdcgetcontainers.h:71
 hmdcgetcontainers.h:72
 hmdcgetcontainers.h:73
 hmdcgetcontainers.h:74
 hmdcgetcontainers.h:75
 hmdcgetcontainers.h:76
 hmdcgetcontainers.h:77
 hmdcgetcontainers.h:78
 hmdcgetcontainers.h:79
 hmdcgetcontainers.h:80
 hmdcgetcontainers.h:81
 hmdcgetcontainers.h:82
 hmdcgetcontainers.h:83
 hmdcgetcontainers.h:84
 hmdcgetcontainers.h:85
 hmdcgetcontainers.h:86
 hmdcgetcontainers.h:87
 hmdcgetcontainers.h:88
 hmdcgetcontainers.h:89
 hmdcgetcontainers.h:90
 hmdcgetcontainers.h:91
 hmdcgetcontainers.h:92
 hmdcgetcontainers.h:93
 hmdcgetcontainers.h:94
 hmdcgetcontainers.h:95
 hmdcgetcontainers.h:96
 hmdcgetcontainers.h:97
 hmdcgetcontainers.h:98
 hmdcgetcontainers.h:99
 hmdcgetcontainers.h:100
 hmdcgetcontainers.h:101
 hmdcgetcontainers.h:102
 hmdcgetcontainers.h:103
 hmdcgetcontainers.h:104
 hmdcgetcontainers.h:105
 hmdcgetcontainers.h:106
 hmdcgetcontainers.h:107
 hmdcgetcontainers.h:108
 hmdcgetcontainers.h:109
 hmdcgetcontainers.h:110
 hmdcgetcontainers.h:111
 hmdcgetcontainers.h:112
 hmdcgetcontainers.h:113
 hmdcgetcontainers.h:114
 hmdcgetcontainers.h:115
 hmdcgetcontainers.h:116
 hmdcgetcontainers.h:117
 hmdcgetcontainers.h:118
 hmdcgetcontainers.h:119
 hmdcgetcontainers.h:120
 hmdcgetcontainers.h:121
 hmdcgetcontainers.h:122
 hmdcgetcontainers.h:123
 hmdcgetcontainers.h:124
 hmdcgetcontainers.h:125
 hmdcgetcontainers.h:126
 hmdcgetcontainers.h:127
 hmdcgetcontainers.h:128
 hmdcgetcontainers.h:129
 hmdcgetcontainers.h:130
 hmdcgetcontainers.h:131
 hmdcgetcontainers.h:132
 hmdcgetcontainers.h:133
 hmdcgetcontainers.h:134
 hmdcgetcontainers.h:135
 hmdcgetcontainers.h:136
 hmdcgetcontainers.h:137
 hmdcgetcontainers.h:138
 hmdcgetcontainers.h:139
 hmdcgetcontainers.h:140
 hmdcgetcontainers.h:141
 hmdcgetcontainers.h:142
 hmdcgetcontainers.h:143
 hmdcgetcontainers.h:144
 hmdcgetcontainers.h:145