MpdZdcDigiScheme.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*************************************************************************************
  2. *
  3. * Class MpdZdcDigiScheme
  4. *
  5. * Author: Elena Litvinenko
  6. * e-mail: litvin@nf.jinr.ru
  7. * Version: 16-May-2008
  8. *
  9. ************************************************************************************/
  10. #ifndef MPDZDCDIGISCHEME_H
  11. #define MPDZDCDIGISCHEME_H
  12. #include "FairGeoNode.h"
  13. #include "MpdZdcGeoPar.h"
  14. #include "MpdZdcDigiPar.h"
  15. #include "MpdZdcPsdGeoPar.h"
  16. #include "MpdZdcPsdDigiPar.h"
  17. #include "TObject.h"
  18. #include <map>
  19. #include <vector>
  20. using std::vector;
  21. using std::pair;
  22. typedef std::vector<Int_t> MpdZdcVolId_t; // now - {MotherMotherCopyNo, MotherCopyNo, VolumeId, CopyNo}
  23. typedef std::vector<Int_t> MpdZdcDigiId_t; // now - {DetectorID, ModuleID, ChannelID}
  24. typedef std::vector<Double_t> MpdZdcVolInfo_t; // now - Center X,Y,Z; and Dx,Dy,Dz from center to the corner
  25. class MpdZdcDigiScheme: public TObject
  26. {
  27. public:
  28. MpdZdcDigiScheme();
  29. virtual ~MpdZdcDigiScheme();
  30. Bool_t Init (MpdZdcGeoPar* geoPar, MpdZdcDigiPar* digiPar, Bool_t pAddPsd=kFALSE, Int_t pVerbose=0);
  31. Bool_t InitPsd (MpdZdcPsdGeoPar* geoPar, MpdZdcPsdDigiPar* digiPar, Int_t pVerbose=0);
  32. static MpdZdcDigiScheme* Instance();
  33. Bool_t AddNodes (TObjArray* sensNodes,Int_t pGlobalDetectorNumber, Bool_t pAddPsd=kFALSE, Int_t pVerbose=0);
  34. MpdZdcVolInfo_t* CreateVolInfoElement (FairGeoNode* nod, Int_t pVerbose);
  35. MpdZdcVolId_t* CreateVolElement (FairGeoNode* nod, Int_t nodeNumber,
  36. MpdZdcDigiId_t* right, Int_t pGlobalDetectorNumber, Int_t pVerbose);
  37. Bool_t CreateVolCopyElements (MpdZdcVolId_t* left, MpdZdcDigiId_t* right);
  38. Bool_t CreateVolInfoCopyElements (MpdZdcDigiId_t* right, MpdZdcVolInfo_t *volInfo );
  39. Bool_t IsVolumeExist (MpdZdcVolId_t* pVolId);
  40. MpdZdcDigiId_t GetDigiId (MpdZdcVolId_t* pVolId);
  41. Int_t GetDetectorID (MpdZdcVolId_t* pVolId);
  42. Int_t GetChannelID (MpdZdcVolId_t* pVolId);
  43. Bool_t GetDetIdModIdChanId (Int_t pMcVolumeNumber, Int_t pMcCopyNumber, Int_t pMotherCopyNumber,
  44. Int_t pMotherMotherCopyNumber, Int_t &pDetId, Int_t &pChanId, Int_t &pModId);
  45. Bool_t GetVolCenterXYZ (MpdZdcDigiId_t* pDigiId, Double_t &x, Double_t &y,Double_t &z);
  46. Bool_t GetVolDxDyDz (MpdZdcDigiId_t* pDigiId, Double_t &Dx, Double_t &Dy, Double_t &Dz);
  47. MpdZdcVolInfo_t* GetVolInfo (MpdZdcVolId_t* pVolId);
  48. void Print();
  49. void PrintVolume (Int_t volID, Int_t copyNo, Int_t copyNoMother, Int_t copyNoMotherMother=1);
  50. Bool_t CalcDimensions (Int_t pGlobalDetectorNumber, Int_t &nx, Int_t &ny, Int_t &nz);
  51. void GetZdcDimensions (Int_t &nx, Int_t &ny, Int_t &nz);
  52. void GetZdcPsdDimensions (Int_t &nx_psd, Int_t &ny_psd, Int_t &nz_psd);
  53. MpdZdcDigiId_t GetDigiIdFromCoords (Double_t x, Double_t y, Double_t z);
  54. MpdZdcDigiId_t GetDigiIdFromVolumeData (Int_t pMcVolumeNumber, Int_t pMcCopyNumber, Int_t pMotherCopyNumber,
  55. Int_t pMotherMotherCopyNumber);
  56. void SplitDigiID (MpdZdcDigiId_t digiID, Int_t &detID, Int_t &modID, Int_t &chanID);
  57. inline MpdZdcDigiPar* GetZdcDigiPar() {return fZdcDigiPar;};
  58. inline MpdZdcPsdDigiPar* GetZdcPsdDigiPar() {return fZdcPsdDigiPar;};
  59. protected:
  60. static MpdZdcDigiScheme* fInstance; // Instance of singleton object
  61. static Int_t fRefcount; // Counter of references on this
  62. static Bool_t fInitialized; // Defines whether was initialized
  63. static Bool_t fYesPsd; //
  64. private:
  65. std::map<MpdZdcVolId_t,MpdZdcDigiId_t> fVolToDigiIdMap; //! correspondence for all active volumes (Zdc+ZdcPsd)
  66. std::map<MpdZdcDigiId_t,MpdZdcVolInfo_t*> fDigiToVolInfoMap; //! correspondence for active volumes (must exist for ZdcPsd, can also exist for Zdc)
  67. Int_t Nx;
  68. Int_t Ny;
  69. Int_t Nz;
  70. Int_t Nx_psd;
  71. Int_t Ny_psd;
  72. Int_t Nz_psd;
  73. MpdZdcDigiPar* fZdcDigiPar; //!
  74. MpdZdcPsdDigiPar* fZdcPsdDigiPar; //!
  75. TObjArray* fPasNodes; //!
  76. ClassDef(MpdZdcDigiScheme,1);
  77. };
  78. #endif // MPDZDCDIGISCHEME_H