#include "PndRichGeo.h" #include "FairGeoNode.h" ClassImp(PndRichGeo) // ----- Default constructor ------------------------------------------- PndRichGeo::PndRichGeo() : FairGeoSet() { // Constructor // fName has to be the name used in the geometry for all volumes. // If there is a mismatch the geometry cannot be build. fName="rich"; maxSectors=0; maxModules=10; fRichOffset = TVector3( 0, 0, 700-35-10/*+50*/ ); //-70 fAlBoxSize = TVector3( 300, 300, 100 ); fAlBoxWallThickness = 0.05; fAerogelSize = TVector3( 290, 120, 4 ); fAerogelOffset = TVector3( 0, 0, 1 ); fnOpt = std::vector(1,1.05); fAerogelLayers = std::vector(1,1); fAngleExtansionInner = 1.0; fAngleExtansionOuter = 1.0; fMirrorCurvature = 20; fAngleOfMirrorPosition = 50; fMirrorThickness = 0.1; fMirrorLength = 290; fPhDetLength = 290; fPhDetThickness = 3; fBeamPipeHoleX = 10; fBeamPipeHoleY = 10; fMirrorType = 0; fFlatMirrorZ = std::vector(2); fFlatMirrorY = std::vector(2); fFlatMirrorZGlob = std::vector(2); fFlatMirrorYGlob = std::vector(2); fPhDetZ = std::vector(2); fPhDetY = std::vector(2); } void PndRichGeo::init(size_t ver) { double ka1 = angleExtansionInner(); double ka2 = angleExtansionOuter(); double beta = mirrorCurvature(); double alpha = angleOfMirrorPosition(); // Mirror double za = richOffset().Z() /*+ alBoxWallThickness()*/ + aerogelOffset().Z(); double ya = aerogelSize().Y()/2; double wa = aerogelSize().Z(); double yp1 = ya + wa; double zp1 = wa; alpha = alpha < 45 - beta ? alpha : 45 -beta; alpha *= M_PI/180; beta *= M_PI/180; double thetaCh = acos(1/nOpt()[0]); double theta = atan(ya/za); double alpha1 = 2*(alpha+beta) - ka1*thetaCh; double alpha2 = 2*(alpha-beta) + ka2*thetaCh + theta; double alpham = (alpha1+alpha2)/2; double zm1 = zp1 + yp1/tan(alpha1); double ym1 = 0; double zm2 = (zm1+ya*tan(alpha))/(1-tan(theta+ka2*thetaCh)*tan(alpha)); double ym2 = (zm2-zm1)/tan(alpha); double zp2 = ((ym2-yp1+zm2*tan(alpha2))*tan(alpham)+zp1)/(1+tan(alpha2)*tan(alpham)); double yp2 = yp1 + (zp2-zp1)/tan(alpham); if (yp2=0) { TVector3 dP = pos - fPhDetP0U; return TVector3(dP*fPhDetNxU,dP*fPhDetNyU,dP*fPhDetNzU); } else { TVector3 dP = pos - fPhDetP0D; return TVector3(dP*fPhDetNxD,dP*fPhDetNyD,dP*fPhDetNzD); } } TVector3 PndRichGeo::PhDetPositionGlobal(TVector3 pos) { if (pos.Y()>=0) return fPhDetP0U + pos.X()*fPhDetNxU + pos.Y()*fPhDetNyU + pos.Z()*fPhDetNzU; else return fPhDetP0D + pos.X()*fPhDetNxD + pos.Y()*fPhDetNyD + pos.Z()*fPhDetNzD; } TVector3 PndRichGeo::PositionDiscretization(TVector3 pos, Double_t dX, Double_t dY, Double_t dZ) { Double_t dX_ = dX>0 ? dX : fdX; Double_t dY_ = dY>0 ? dY : fdY; Double_t dZ_ = dZ>0 ? dZ : fdZ; Double_t x = pos.X(); Double_t y = pos.Y(); Double_t z = pos.Z(); if (x&&dX) x = ((int)(x/dX_) + x/std::fabs(x)/2)*dX_; if (y&&dY) y = ((int)(y/dY_) + y/std::fabs(y)/2)*dY_; if (z&&dZ) z = ((int)(z/dZ_) + z/std::fabs(z)/2)*dZ_; return TVector3(x,y,z); } UInt_t PndRichGeo::IndexX(TVector3 pos) { return (int)((pos.X()+fdX*fiXmax/2)/fdX); } UInt_t PndRichGeo::IndexY(TVector3 pos) { return (int)((pos.Y()+fdY*fiXmax/2)/fdY); } TVector3 PndRichGeo::PixelPositionLocal(UInt_t ix, UInt_t iy) { Double_t x = ix*fdX-fiXmax*fdX/2+0.5*fdX; Double_t y = iy*fdY-fiYmax*fdY/2+0.5*fdY; return TVector3(x,y,0); } TVector3 PndRichGeo::PixelPositionGlobal(UInt_t ix, UInt_t iy) { return PhDetPositionGlobal(PixelPositionLocal(ix,iy)); } // ------------------------------------------------------------------------- const char* PndRichGeo::getModuleName(Int_t m) { /** Returns the module name of PndRich number m Setting PndRich here means that all modules names in the ASCII file should start with PndRich otherwise they will not be constructed */ sprintf(modName,"rich0%i",m+1); return modName; } const char* PndRichGeo::getEleName(Int_t m) { /** Returns the element name of Det number m */ sprintf(eleName,"rich0%i",m+1); return eleName; }