#ifndef HITOFGEOMPAR_H #define HITOFGEOMPAR_H #include "hdetgeompar.h" #include "hgeomvolume.h" #include "hgeomcompositevolume.h" #include "hgeomtransform.h" #include "hgeomvector.h" #include "hspecgeompar.h" #include using namespace std; #define ITOFMAXCELL 3 #define ITOFNPMT 12 class HiTofGeomPar : public HDetGeomPar { //------------------------------------------------------------- // Helper objects for geometric calculations // needs HSpecGeomPar for transformations, therefore // the objects have to be initialized by calling initGeomHelpers() // after init() function is finished (typically in the reinit() // function of a HReconstructor based task). The helper objects // will not be streamed //------------------------------------------------------------- HGeomTransform fLabToSec [6]; //! LAB -> SEC transTo HGeomTransform fSecToMod [6]; //! SEC -> MOD HGeomTransform fLabToMod [6]; //! LAB -> MOD HGeomTransform fModToCell [6][ITOFMAXCELL]; //! MOD -> CELL HGeomTransform fSecToCell [6][ITOFMAXCELL]; //! SEC -> CELL TVector3 normVecMod [6]; //! [sec] normal vector on the iTOF MOD in SEC sys TVector3 centerVecMod [6]; //! [sec] center vector on the iTOF MOD in SEC sys HGeomVector cellPoint[6][ITOFMAXCELL][4]; //! [sec][cell] 4points CELL sys HGeomVector pmtCell[ITOFMAXCELL][ITOFNPMT];//! location of PMT in CELL sys Bool_t fDebug; //! debugging prints //------------------------------------------------------------- public: HiTofGeomPar(const Char_t* name = "iTofGeomPar", const Char_t* title = "iTof geometry parameters", const Char_t* context = "GeomProduction"); ~HiTofGeomPar() {} Bool_t init(HParIo*,Int_t*); Int_t write(HParIo*); inline Int_t getSecNum (const TString&); inline Int_t getModNumInMod (const TString&); inline Int_t getModNumInComp(const TString&); inline Int_t getCompNum (const TString&); //------------------------------------------------------------- // Helper functions void setDebug(Bool_t debug = kTRUE ) { fDebug = debug; } Bool_t getDebug() { return fDebug; } Int_t getMaxCell() { return ITOFMAXCELL;} Int_t getNPMT() { return ITOFNPMT ;} Bool_t initGeomHelpers(HSpecGeomPar* specGeom); const HGeomTransform& getLabSecTrans (Int_t sec); const HGeomTransform& getLabModTrans (Int_t sec); const HGeomTransform& getSecModTrans (Int_t sec); const HGeomTransform& getModCellTrans(Int_t sec, Int_t cell); const HGeomTransform& getSecCellTrans(Int_t sec, Int_t cell); HGeomCompositeVolume* getGeomCompositeVolume (Int_t sec); HGeomVolume* getGeomVolumeCell (Int_t sec,Int_t cell); Int_t getGeomVolumePointsCell(Int_t sec,Int_t cell, vector& points); Bool_t getCenterAndNormVecMod (Int_t sec, TVector3& center,TVector3& norm); void calcSegPoints (HGeomVector& p1,HGeomVector& p2,Double_t phiseg,Double_t thetaseg,Double_t roseg,Double_t zseg); Bool_t findIntersectionLinePlane(HGeomVector& pointIntersect,const HGeomVector& pos, const HGeomVector& dir, const HGeomVector& planeCenter, const HGeomVector& planeNormal); Bool_t isInCell (HGeomVector& vcell, Int_t s,Int_t c,Float_t xRes=0, Float_t yRes=0); Bool_t findHitCell(HGeomVector& pointHit,Int_t& cell,Float_t distPMT[],Int_t s,Double_t phi,Double_t theta,Double_t r, Double_t z); Bool_t transformCellHit(HGeomVector& cellhit,Int_t sec,Int_t cell, Int_t sys); Bool_t transformModHit (HGeomVector& modhit ,Int_t sec, Int_t sys); Bool_t transformSecHit (HGeomVector& sechit ,Int_t sec, Int_t sys); Bool_t transformLabToSec(HGeomVector& hit ,Int_t sec, Int_t sys); Bool_t distPMT(Float_t distPMT[], const HGeomVector pointHit, const Int_t s,const Int_t c); //------------------------------------------------------------- ClassDef(HiTofGeomPar,1) // Container for the iTof geometry parameters }; inline Int_t HiTofGeomPar::getSecNum(const TString& name) { // returns the sector index retrieved from the module name TFNx return (Int_t)(name[3]-'0')-1; } inline Int_t HiTofGeomPar::getModNumInMod(const TString& name) { // returns the module index 0 return 0; } inline Int_t HiTofGeomPar::getModNumInComp(const TString& name) { // returns the module index 0 return 0; } inline Int_t HiTofGeomPar::getCompNum(const TString& name) { // returns the cell index retrieved from the component name TxxS1 return ((Int_t)(name[1]-'0')*10+(Int_t)(name[2]-'0')-23); } #endif /* !HITOFGEOMPAR_H */