#ifndef HShowerGeometry_H
#define HShowerGeometry_H

#include "hdetgeompar.h"
#include "hgeomvector2.h"
#include "hparset.h"
#include "hshowerparset.h"
#include "hlocation.h"
#include "hshowerpad.h"
#include "hshowerwire.h"
#include "hshowerframe.h"
#include "hshowersectorgeom.h"
#include "hshowermodulegeom.h"
class HGeomVolume;
class HShowerGeometry: public HDetGeomPar{
public:
	HShowerGeometry(const Char_t* name="ShowerGeometry",
					const Char_t* title="Shower geometry parameters",
					const Char_t* context="GeomProduction");
	~HShowerGeometry();					
	Bool_t init(HParIo*,Int_t*);
	Int_t write(HParIo* output);
	inline Int_t getSecNum(const TString&);
	inline Int_t getModNumInMod(const TString&);
	inline Int_t getModNumInComp(const TString&);
	Int_t getCompNum(const TString&) {return 0;}
	
	Int_t getSectors(){return m_nSectors;}
  Int_t getModules(){return m_nModules;}
  Int_t getRows(){return m_nRows;}
  Int_t getColumns(){return m_nColumns;}
  void setLab(Int_t nLab = 1){m_nLab = nLab;}
  Bool_t IsLab(){return m_nLab;}
	virtual Bool_t initAscii(HParHadAsciiFileIo* pHadAsciiFile);
	virtual Bool_t writeAscii(HParHadAsciiFileIo* pHadAsciiFile);
	virtual void clear();

  HShowerFrame* getFrame(Int_t n){return &frames[n];}
  HShowerWireTab* getWireTab(Int_t nMod){return &wires[nMod];}
  HShowerPadTab* getPadParam(Int_t nMod){return &pads[nMod];}
  void attachTables();

  void getLocalCoord(HLocation& loc, HGeomVector& v);
  void getLabCoord(HLocation& loc, HGeomVector2& v);
  void getSphereCoord(HLocation& loc, HGeomVector2& v, HGeomVector *pvTarget = NULL);
  void transLabToSphereCoord(HGeomVector2& labIn, HGeomVector2& sphereOut, HGeomVector *pvTarget);
  void transVectToLab(HLocation& loc, HGeomVector vLocal, HGeomVector2& vLab); 

  const HGeomTransform&  getTransform(Int_t sect);
  const HGeomTransform&  getTransform(Int_t sect, Int_t mod);

  void translModules();
  void rotateSectors();
  Bool_t transToLab();
	Bool_t transPadToLab();
	Bool_t updateDetGeom();
private:
	
	Bool_t initDetGeom();
	Bool_t writeModGeomParAscii(
			HParHadAsciiFileIo* pHadAsciiFile);
	Bool_t writeCompositeVolAscii(
			HParHadAsciiFileIo* pHadAsciiFile);
	Bool_t writeGeomVolAscii(
			HParHadAsciiFileIo* pHadAsciiFile,HGeomVolume *p);
	Bool_t initModGeomParAscii(
			HParHadAsciiFileIo* pHadAsciiFile);
	Bool_t initCompositeVolAscii(
			HParHadAsciiFileIo* pHadAsciiFile);
	Bool_t initGeomVolAscii(
			HParHadAsciiFileIo* pHadAsciiFile,HGeomVolume *p);
public:
	Int_t m_nSectors;           //number of sectors  
  Int_t m_nModules;           //number of modules
  Int_t m_nRows;              //number of rows
  Int_t m_nColumns;           //number of columns
  Int_t m_nLab;         //determinate if lab coordinates have been calculated       

  HShowerSectorGeom sectors[6]; //definitions of coordinates in lab

  HShowerFrame frames[3];   //definitions of local coordinates of frames
  HShowerWireTab wires[3];  //definitions of local coordinates of wires
  HShowerPadTab pads[3];    //definitions of local coordinates of pads

	
ClassDef(HShowerGeometry,2)//Class for PreShower geometry container	
};

inline Int_t HShowerGeometry::getSecNum(const TString& name){
		// Returns the sector index retrieved from the module name SHxMx
		return (Int_t)(name[4]-'0')-1;} 
inline Int_t HShowerGeometry::getModNumInMod(const TString& name){
		// Returns the module index retrieved from the module name SHxMx
		return (Int_t)(name[2]-'0')-1;} 
inline Int_t HShowerGeometry::getModNumInComp(const TString& name){
		// Returns the module index retrieved from the  layer of wires name SxSW 
		return (Int_t)name[1]-'0' -1;} 



#endif /* !HShowerGeometry_H */

Last change: Sat May 22 13:13:32 2010
Last generated: 2010-05-22 13:13

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.