GeoGeometry Class Reference

#include <GeoGeometry.h>

Inheritance diagram for GeoGeometry:
GeoRefCnt

List of all members.

Public Types

typedef std::map< PlexPlaneId,
GeoPlnNode * >::iterator 
PlaneMapItr
typedef std::map< PlexPlaneId,
GeoPlnNode * >::const_iterator 
PlaneMapConstItr
typedef std::map< PlexPlaneId,
GeoPlnNode * >
::reverse_iterator 
PlaneMapRevItr
typedef std::map< PlexPlaneId,
GeoPlnNode * >
::const_reverse_iterator 
PlaneMapConstRevItr

Public Member Functions

 GeoGeometry ()
 GeoGeometry (const VldContext &vldc, Geo::EAppType apptype=Geo::kRecons)
virtual ~GeoGeometry ()
virtual void UpdateGlobalManager () const
bool IsAlgorithmic () const
bool IsFrozen () const
Geo::EAppType GetAppType () const
virtual PlexPlaneId GetPlaneIdFromZ (Double_t z) const
virtual GeoStripNodeGetStripNode (const PlexStripEndId &seid) const
virtual TVector3 GetHallExtentMin () const
virtual TVector3 GetHallExtentMax () const
virtual GeoScintPlnNodeGetScintPlnNode (PlexPlaneId planeId) const
virtual GeoSteelPlnNodeGetNearestSteelPlnNode (Double_t z) const
virtual const GeoMediumMapGetMediumMap () const
const std::vector
< GeoScintPlnNode * > & 
GetScintPlnNodePtrVector () const
const std::vector
< GeoSteelPlnNode * > & 
GetSteelPlnNodePtrVector () const
const std::vector< GeoPlnNode * > & GetPlnNodePtrVector () const
const std::map< Float_t,
GeoSteelPlnNode * > & 
GetSteelPlnNodeMap () const
virtual GeoSteelPlnNodeGetSteelPlnNode (PlexPlaneId planeId) const
virtual void GetTransverseExtent (PlaneView::PlaneView_t view, Float_t &tmin, Float_t &tmax) const
virtual void GetTransverseExtent (PlaneView::PlaneView_t view, Double_t &tmin, Double_t &tmax) const
virtual void GetZExtent (Float_t &zmin, Float_t &zmax, Int_t isup=-1) const
virtual void GetZExtent (Double_t &zmin, Double_t &zmax, Int_t isup=-1) const
virtual const VldRangeGetVldRange () const
bool IsCompatible (const VldContext &vldc, Geo::EAppType apptype) const
TGeoMedium * GetMedium (const char *name) const
virtual void Draw (Option_t *volname="")
virtual void ls (Option_t *option="") const
virtual void Print (Option_t *option="") const
virtual void PrintHeader (Option_t *option="") const
virtual void DumpVolume (std::string volname, std::string preface="") const
virtual void SwitchMedia (bool toswim)
TGeoRotation * GetRot45 () const
TGeoRotation * GetRot315 () const

Static Public Member Functions

static std::string GetGeoCompatibleName (std::string name)

Private Member Functions

virtual void BuildAll (const VldContext &vldc)
virtual void BuildVldRange (const VldContext &vldc)
virtual void TrimVldRange (const char *tblName="", const DbiValidityRec *dbivrec=0)
virtual void BuildRotations ()
virtual void BuildGeometry (const VldContext &vldc)
virtual void BuildDetector (const VldContext &vldc, TGeoVolume *hallVol)
virtual void BuildStrips (const UgliDbiTables &tbl, GeoScintMdlNode *node)
virtual void BuildHallExtent ()
virtual TGeoVolume * BuildFarMARS ()
virtual TGeoVolume * BuildNearMARS ()
virtual void BuildFarCoil (TGeoVolume *hallVol)
virtual void BuildFarLeadStacks (TGeoVolume *hallVol)
virtual void BuildMinerva (int mversion)
virtual int Time2MinervaVersion (const VldTimeStamp &vts) const
virtual void BuildNearCoil (TGeoVolume *hallVol)
virtual TGeoVolume * BuildCoilAirGapVolume (const VldContext &vldc) const
virtual TGeoVolume * BuildFarCoilAirGapVolume () const
virtual TGeoVolume * BuildNearCoilAirGapVolume () const
virtual void BuildPlanePairVolumes (const VldContext &vldc)
virtual void BuildStripVolumes (const VldContext &vldc)
virtual void BuildModules (const UgliDbiTables &tbl, GeoScintPlnNode *node)
virtual void UpdateNodeMatrices (TGeoVolume *volume)
Int_t GetSMPlaneLimits (const VldContext &vldc, Int_t *plnMin, Int_t *plnMax)

Private Attributes

VldRange fVldRange
Geo::EAppType fAppType
Float_t fSMZMin [2]
Float_t fSMZMax [2]
Float_t fScale
std::string fHallPath
TVector3 fHallMin
TVector3 fHallMax
TGeoManager * fGeoManager
std::map< PlexPlaneId,
GeoPlnNode * > 
fPlaneMap
std::vector< GeoScintPlnNode * > fScintPlnNodes
std::vector< GeoSteelPlnNode * > fSteelPlnNodes
std::vector< GeoPlnNode * > fPlnNodes
std::map< Float_t,
GeoSteelPlnNode * > 
fSteelPlnNodeMap
GeoShield fGeoShield
Bool_t fIsSwimMedia
GeoMediumMapfMediumMap
TGeoRotation * fRot45
TGeoRotation * fRot315

Detailed Description

Definition at line 47 of file GeoGeometry.h.


Member Typedef Documentation

typedef std::map<PlexPlaneId,GeoPlnNode*>::const_iterator GeoGeometry::PlaneMapConstItr

Definition at line 53 of file GeoGeometry.h.

typedef std::map<PlexPlaneId,GeoPlnNode*>::const_reverse_iterator GeoGeometry::PlaneMapConstRevItr

Definition at line 56 of file GeoGeometry.h.

typedef std::map<PlexPlaneId,GeoPlnNode*>::iterator GeoGeometry::PlaneMapItr

Definition at line 52 of file GeoGeometry.h.

typedef std::map<PlexPlaneId,GeoPlnNode*>::reverse_iterator GeoGeometry::PlaneMapRevItr

Definition at line 54 of file GeoGeometry.h.


Constructor & Destructor Documentation

GeoGeometry::GeoGeometry (  ) 

Definition at line 54 of file GeoGeometry.cxx.

References Msg::kDebug, and MSG.

00054                          : fVldRange(),fAppType(Geo::kRecons),
00055                 fScale(1),fHallPath(""),fGeoManager(0),fGeoShield(),
00056                 fIsSwimMedia(false),fMediumMap(0),fRot45(0),fRot315(0) {
00057   // Default constructor, used for i/o
00058 
00059   MSG("Geo",Msg::kDebug) << "GeoGeometry def ctor @ " << this << endl;
00060 
00061   UpdateGlobalManager(); // this is okay, because fGeoManager ptr stored
00062 
00063   // fScale has been set before this step
00064   for ( int ism = 0; ism < 2; ism++ ) { 
00065      fSMZMin[ism] = +999.*fScale; 
00066      fSMZMax[ism] = -999.*fScale; 
00067   }
00068 
00069   for ( int ic = 0; ic < 3; ic++ ) {
00070     fHallMin[ic] = 0;
00071     fHallMax[ic] = 0;
00072   }
00073 
00074 }

GeoGeometry::GeoGeometry ( const VldContext vldc,
Geo::EAppType  apptype = Geo::kRecons 
)

Definition at line 77 of file GeoGeometry.cxx.

References VldContext::AsString(), BuildAll(), BuildHallExtent(), fGeoManager, fMediumMap, fScale, fSMZMax, fSMZMin, Geo::GetScale(), Msg::kDebug, Msg::kInfo, Nav::kWarning, MSG, UpdateGlobalManager(), and UpdateNodeMatrices().

00077                                                                     : 
00078   fVldRange(),fAppType(apptype),fScale(1),fHallPath(""),
00079   fGeoManager(0),fGeoShield(this),fIsSwimMedia(false),fMediumMap(0),
00080   fRot45(0),fRot315(0) {
00081   // Normal constructor
00082   // Geometry is built for application type Geo::kRecons by default.
00083   // The application type determines the units the geometry will be built
00084   // in.  The default apptype = Geo::kRecons will build the geometry in
00085   // Minos standard units of meters.  Specifying apptype = Geo::kVMC will
00086   // build the geometry in TVirtualMC standard units of cm.
00087   
00088   MSG("Geo",Msg::kDebug) << "GeoGeometry normal ctor @ " << this << endl;
00089 
00090   UpdateGlobalManager(); // set gGeoManager to null before building new 
00091 
00092   MSG("Geo",Msg::kInfo) << "GeoGeometry build for validity " 
00093                         << vldc << "." << endl;
00094   
00095   // Silence TGeoManager info messages
00096   Int_t saveErrorIgnoreLevel = gErrorIgnoreLevel;
00097   gErrorIgnoreLevel = kWarning;
00098   
00099   //MsgStream* msgeo = MsgService::Instance() -> GetStream("Geo");
00100   //msgeo -> SetLogLevel(Msg::kVerbose);
00101   
00102   fScale = Geo::GetScale(apptype);
00103 
00104   // fScale must be set before this step
00105   for ( int ism = 0; ism < 2; ism++ ) { 
00106      fSMZMin[ism] = +999.*fScale; 
00107      fSMZMax[ism] = -999.*fScale; 
00108   }
00109 
00110   fGeoManager = new TGeoManager(vldc.AsString("s1ac-"),"a MINOS geometry");
00111   UpdateGlobalManager(); // set gGeoManager to fGeoManager
00112 
00113   fMediumMap = new GeoMediumMap(this,vldc);
00114   
00115   // Build all materials and detector geometry
00116   this -> BuildAll(vldc);
00117   
00118   fGeoManager->CloseGeometry();
00119 
00120   BuildHallExtent(); // fill in hall coordinates
00121   
00122   TGeoVolume* volume = fGeoManager->GetTopVolume();
00123   UpdateNodeMatrices(volume);
00124   // Invoke CdTop to position back to top (MARS) volume.
00125   fGeoManager->CdTop();
00126   
00127   //this -> DumpVolume("MARS");
00128   
00129   fGeoManager->SetVisLevel(4);
00130   fGeoManager->SetVisOption(0);
00131 
00132   MSG("Geo",Msg::kInfo) << "GeoGeometry build complete." << endl;
00133   gErrorIgnoreLevel = saveErrorIgnoreLevel;
00134 
00135 }

GeoGeometry::~GeoGeometry (  )  [virtual]

Definition at line 138 of file GeoGeometry.cxx.

References fGeoManager, fMediumMap, fPlaneMap, Msg::kDebug, MSG, and UpdateGlobalManager().

00138                           {
00139   // delete all the owned sub-objects
00140 
00141   MSG("Geo",Msg::kDebug) << "GeoGeometry dtor @ " << this << endl;
00142 
00143   UpdateGlobalManager();
00144 
00145   fPlaneMap.clear();
00146   if ( fMediumMap ) delete fMediumMap; fMediumMap = 0;
00147   
00148   if ( fGeoManager ) {
00149     delete fGeoManager; fGeoManager = 0;
00150   }
00151  
00152   UpdateGlobalManager(); // set gGeoManager to null to avoid further use
00153   
00154 }


Member Function Documentation

void GeoGeometry::BuildAll ( const VldContext vldc  )  [private, virtual]

Definition at line 791 of file GeoGeometry.cxx.

References BuildGeometry(), BuildRotations(), BuildVldRange(), fGeoManager, Msg::kDebug, MSG, and UpdateGlobalManager().

Referenced by GeoGeometry().

00791                                                  {
00792   // Private.  Build materials & geometry
00793 
00794   UpdateGlobalManager();
00795 
00796   MSG("Geo",Msg::kDebug) << "GeoGeometry BuildAll " << endl;
00797   assert(fGeoManager);
00798 
00799   // Get the VldRange that fits this context
00800   BuildVldRange(vldc);
00801 
00802   // Build commonly used rotation matrices
00803   BuildRotations();
00804   
00805   // Build Detector Geometry
00806   BuildGeometry(vldc);
00807 
00808 }

TGeoVolume * GeoGeometry::BuildCoilAirGapVolume ( const VldContext vldc  )  const [private, virtual]

Definition at line 2301 of file GeoGeometry.cxx.

References BuildFarCoilAirGapVolume(), BuildNearCoilAirGapVolume(), VldContext::GetDetector(), Detector::kFar, Detector::kNear, and UpdateGlobalManager().

Referenced by BuildPlanePairVolumes().

02301                                                                            {
02302   // Build coil region volume to be used in airgaps between scint and
02303   // steel planes.
02304 
02305   UpdateGlobalManager();
02306   
02307   TGeoVolume* coilVol = 0;
02308 
02309   Detector::Detector_t dettype = (Detector::Detector_t)vldc.GetDetector();
02310 
02311   switch (dettype) {
02312 
02313   case Detector::kFar:
02314     coilVol = BuildFarCoilAirGapVolume();
02315     break;
02316 
02317   case Detector::kNear:
02318     coilVol = BuildNearCoilAirGapVolume();
02319     break;
02320 
02321   default:
02322     break;
02323 
02324   }
02325 
02326   return coilVol;
02327   
02328 }

void GeoGeometry::BuildDetector ( const VldContext vldc,
TGeoVolume *  hallVol 
) [private, virtual]

Definition at line 1137 of file GeoGeometry.cxx.

References PlexPlaneId::AsString(), BuildFarCoil(), GeoShield::BuildGroupNodes(), BuildNearCoil(), BuildPlanePairVolumes(), fGeoManager, fGeoShield, fScale, VldContext::GetDetector(), GetGeoCompatibleName(), DbiResultPtr< T >::GetNumRows(), UgliDbiSteelPln::GetPhiDeg(), PlexPlaneId::GetPlane(), DbiResultPtr< T >::GetRow(), DbiResultPtr< T >::GetRowByIndex(), UgliLoanPool::GetShieldOff(), GetSMPlaneLimits(), UgliDbiSteelPln::GetThetaDeg(), UgliDbiSteelPln::GetThickness(), UgliDbiSteelPln::GetTotalZ(), UgliDbiSteelPln::GetX0(), UgliDbiSteelPln::GetY0(), UgliDbiSteelPln::GetZBack(), UgliLoanPool::Instance(), PlexPlaneId::IsVetoShield(), Detector::kCalDet, Msg::kDebug, Detector::kFar, Msg::kFatal, Msg::kInfo, Detector::kNear, MSG, and UpdateGlobalManager().

Referenced by BuildGeometry().

01138                                                      {
01139    // Private. Build this geometry's steel+scint planes + coil
01140 
01141   UpdateGlobalManager();
01142 
01143   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildDetector " << endl;
01144   assert(fGeoManager);
01145 
01146   DbiResultPtr<UgliDbiSteelPln> steelTbl(vldc);
01147 
01148   BuildPlanePairVolumes(vldc); // pre-build plane pair volumes
01149 
01150   // Build shield group volumes and install them as nodes in hall
01151   // and install shield plane pair nodes in group volumes
01152   bool shieldOff = UgliLoanPool::Instance()->GetShieldOff();
01153   if ( vldc.GetDetector() == Detector::kFar ) {
01154     if ( shieldOff ) {
01155       MSG("Geo",Msg::kInfo) 
01156         << "GeoGeometry build of Veto Shield disabled." << endl;
01157     }
01158     else fGeoShield.BuildGroupNodes(hallVol);
01159   }
01160  
01161   // Plane db positions are stored relative to mars so need
01162   // hall global position to recalculate
01163   // Translation taken from liner, since hall placed with identity
01164   // matrix relative to liner
01165   TGeoNode* linrNode = fGeoManager->GetVolume("MARS")->GetNode("LINR_1");
01166   const Double_t* h0 = linrNode -> GetMatrix() -> GetTranslation();
01167   
01168   Int_t plnMin[2] = {-1};
01169   Int_t plnMax[2] = {-1};
01170   Int_t nSM = GetSMPlaneLimits(vldc,plnMin,plnMax);
01171 
01172   std::string minPlaneName[2];
01173   std::string maxPlaneName[2];
01174   Int_t minPlane[2] = {9999,9999};
01175   Int_t maxPlane[2] = {-9999,-9999};
01176   
01177   // order construction by plane #, STL set will sort them
01178   std::set<PlexPlaneId> steelset;
01179   for (unsigned int irow=0; irow < steelTbl.GetNumRows(); ++irow) {
01180     const UgliDbiSteelPln* stRow = steelTbl.GetRow(irow);
01181     PlexPlaneId steelId = stRow -> GetPlaneId();
01182     steelset.insert(steelId);
01183   }
01184   
01185   std::set<PlexPlaneId>::const_iterator steelitr = steelset.begin();
01186   for ( ; steelitr != steelset.end() ; steelitr++) {
01187     PlexPlaneId steelId = *steelitr;
01188     if ( shieldOff && steelId.IsVetoShield() ) continue;
01189     const UgliDbiSteelPln* stRow = steelTbl.GetRowByIndex(steelId.GetPlane());
01190     if ( (vldc.GetDetector() ==  Detector::kFar && !steelId.IsVetoShield()) ) {
01191       // Dispatch some anomalies in the database
01192        if ( steelId.GetPlane() > 485 ) continue; // because db has 0-497
01193        // Skip planes that have intentionally been placed at unphysical
01194        // locations
01195        if ( TMath::Abs(stRow->GetX0() ) > 50. ) continue;
01196     }
01197 
01198     // This is used just for reporting info at end of build
01199     Int_t vsId = 0;
01200     std::string stName = GetGeoCompatibleName(steelId.AsString());
01201     if ( steelId.IsVetoShield() ) vsId = 1;
01202     if ( steelId.GetPlane() < minPlane[vsId] ) {
01203         minPlane[vsId] = steelId.GetPlane();
01204         minPlaneName[vsId] = stName;
01205     }
01206     if ( steelId.GetPlane() > maxPlane[vsId] ) {
01207         maxPlane[vsId] = steelId.GetPlane();
01208         maxPlaneName[vsId] = stName;
01209     }
01210     
01211     // Veto shield built separately
01212     if ( vldc.GetDetector() == Detector::kFar && steelId.IsVetoShield() ) 
01213                                                               continue;
01214     
01215     Double_t offxyz[3] = {h0[0],h0[1],h0[2]};
01216        
01217     // The pair volumes have been pre-built
01218     std::string pairName = GetGeoCompatibleName(steelId.AsString("b"));
01219     TGeoVolume* pairVol = fGeoManager -> GetVolume(pairName.c_str());
01220     if ( !pairVol ) {
01221       MSG("Geo",Msg::kFatal) 
01222          << "Unable to find pre-built pairvol for volume "
01223          << pairName.c_str() << endl;
01224       abort();
01225     }
01226     
01227     // Position pair bounding box 
01228     TGeoRotation* stRotMatrix = new TGeoRotation(pairName.c_str(),
01229                                 stRow->GetThetaDeg(0),stRow->GetPhiDeg(0),
01230                                 stRow->GetThetaDeg(1),stRow->GetPhiDeg(1),
01231                                 stRow->GetThetaDeg(2),stRow->GetPhiDeg(2));
01232     stRotMatrix -> RegisterYourself();
01233     
01234     // Plane DB translation is relative to MARS, move to SM or hall local 
01235     Float_t x0pair = (stRow->GetX0())*fScale - offxyz[0];
01236     Float_t y0pair = (stRow->GetY0())*fScale - offxyz[1];
01237 
01238     // If plane is first plane in supermodule than thickness of pair
01239     // box is just "Thickness".  If it's part of vetoshield, than 
01240     // thickness of pair box is just "TotalZ", else pair box thickness 
01241     // is set by distance from back face of
01242     // of current steel plane to back face of previous steel plane. z0pair
01243     // is defined as the position of the center of this pair box in z.
01244     Int_t planeno = steelId.GetPlane();
01245     Float_t z0pair = 0;
01246     if ( vldc.GetDetector() == Detector::kCalDet || steelId.IsVetoShield() ) 
01247       z0pair =(stRow->GetZBack()-0.5*(stRow->GetTotalZ()))*fScale - offxyz[2];
01248     else
01249       z0pair =(stRow->GetZBack()-0.5*(stRow->GetThickness()))*fScale-offxyz[2];
01250           
01251     if ( !steelId.IsVetoShield() ) {
01252       if ( planeno != plnMin[0] ) {
01253         if ( nSM == 1 || (nSM > 1 && planeno != plnMin[1]) ) {
01254           const UgliDbiSteelPln* stPrevRow = steelTbl.GetRowByIndex(planeno-1);
01255           z0pair = (stRow->GetZBack()-0.5*(stRow->GetZBack()
01256                                   -stPrevRow->GetZBack()))*fScale - offxyz[2];
01257         }
01258       }
01259     }
01260     
01261     TGeoCombiTrans* pairMatrix = new TGeoCombiTrans(pairName.c_str(),
01262                                     x0pair,y0pair,z0pair,stRotMatrix);
01263     MSG("Geo",Msg::kDebug) << "Placing plane pair " << pairName.c_str()
01264                            << " at " << x0pair << ","
01265                            << y0pair << "," << z0pair 
01266                            << "\n rotmatrix:(thetax/y/z,phix/y/z) (" 
01267                            << stRow->GetThetaDeg(0) << ","  
01268                            << stRow->GetPhiDeg(0) << "),("
01269                            << stRow->GetThetaDeg(1) << ","  
01270                            << stRow->GetPhiDeg(1) << "),("
01271                            << stRow->GetThetaDeg(2) << ","  
01272                            << stRow->GetPhiDeg(2) << ")"
01273                            << endl;
01274 
01275     // Place plane pairs directly in hall
01276     hallVol -> AddNode(pairVol,1,pairMatrix);
01277   } // end of loop over all plane db rows
01278 
01279 
01280   MSG("Geo",Msg::kInfo) << "GeoGeometry built detector planes "
01281                         << minPlaneName[0].c_str() << " to " 
01282                         << maxPlaneName[0].c_str() << "." << endl;
01283   if ( !minPlaneName[1].empty() ) {
01284     MSG("Geo",Msg::kInfo) << "GeoGeometry built shield planes "
01285                           << minPlaneName[1].c_str() << " to " 
01286                           << maxPlaneName[1].c_str() << "." << endl;
01287   }
01288   
01289   // Build outer coil after all planes are positioned so that detector
01290   // limits are known
01291   Detector::Detector_t dettype = (Detector::Detector_t)vldc.GetDetector();
01292   switch ( dettype ) {
01293   case Detector::kFar:
01294     BuildFarCoil(hallVol);
01295     break;
01296   case Detector::kNear:
01297     BuildNearCoil(hallVol);
01298     break;
01299   default:
01300     break;
01301   }
01302 
01303   return;
01304   
01305 }

void GeoGeometry::BuildFarCoil ( TGeoVolume *  hallVol  )  [private, virtual]

Definition at line 1907 of file GeoGeometry.cxx.

References fGeoManager, fScale, GeoMediumMap::GetMedium(), GetMediumMap(), GetZExtent(), Geo::kCoilRad, Msg::kDebug, Geo::kRCAir, Geo::kRCCoil, MSG, and UpdateGlobalManager().

Referenced by BuildDetector().

01907                                                   {
01908   // Private. Build the far detector coil outside of the detector.  
01909   // x0,y0 is coil hole center in HALL coordinates (assumed constant
01910   // over all planes).
01911 
01912   UpdateGlobalManager();
01913  
01914   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildFarCoil " << endl;
01915   assert(fGeoManager);
01916 
01917   const GeoMediumMap& medMap = GetMediumMap();
01918 
01919   // These dimensions/etc. of the coil should be in the db, but for now
01920   // use hardwired values
01921 
01922   // Nomenclature (BUS) is chosen to match that of gminos
01923   // BUSn is the center of the coil made up of medium FARCOIL
01924   // In the convention used here, n = supermodule number
01925 
01926   Float_t sRad = Geo::kCoilRad*fScale; // coil radius 
01927 
01928   Float_t halfhally = dynamic_cast<TGeoBBox*>(hallVol -> GetShape())->GetDY();
01929   
01930   // SM0 coil along z-direction of detector, ends at supermodule ends
01931   // return coil lies on floor
01932   Float_t zmin0,zmax0;
01933   GetZExtent(zmin0,zmax0,0);
01934   // Convert to HALL coordinates
01935   TGeoNode* linrNode = fGeoManager->GetVolume("MARS")->GetNode("LINR_1");
01936   const Double_t* h0 = linrNode -> GetMatrix() -> GetTranslation();
01937   zmin0 -= h0[2];
01938   zmax0 -= h0[2];
01939   Float_t x0 = -h0[0];
01940   Float_t y0 = -h0[1];
01941 
01942   // Per specification from J. Nelson received 8/1/2006, model return
01943   // coil lying along far detector floor as box of halfx 0.225 m and
01944   // halfy 0.05 m.
01945   Float_t retcoilhalfx = 0.225*fScale;
01946   Float_t retcoilhalfy = 0.05*fScale;
01947 
01948   Float_t zcoillen0 = zmax0-zmin0;
01949   TGeoVolume* BUS0=fGeoManager->MakeBox("BUS0",medMap.GetMedium(Geo::kRCCoil),
01950                                       retcoilhalfx,retcoilhalfy,0.5*zcoillen0);
01951   BUS0 -> SetLineColor(42); // tan  
01952   BUS0 -> SetVisibility(kTRUE);
01953 
01954   // Place SM0 return coil in hall
01955   Float_t z0 = 0.5*(zmin0 + zmax0);
01956   hallVol -> AddNode(BUS0,1,new TGeoTranslation("BUS0",x0,
01957                                            -halfhally+retcoilhalfy,z0));
01958   
01959   // SM1 coil along z-direction of detector, ends at supermodule ends
01960   Float_t zmin1,zmax1;
01961   GetZExtent(zmin1,zmax1,1);
01962   // Convert to HALL coordinates
01963   zmin1 -= h0[2];
01964   zmax1 -= h0[2];
01965 
01966   Float_t zcoillen1 = zmax1-zmin1;
01967   TGeoVolume* BUS1=fGeoManager->MakeBox("BUS1",medMap.GetMedium(Geo::kRCCoil),
01968                                       retcoilhalfx,retcoilhalfy,0.5*zcoillen1);
01969   BUS1 -> SetLineColor(42);  // tan  
01970   BUS1 -> SetVisibility(kTRUE);
01971 
01972   // Place SM1 return coil in hall
01973   Float_t z1 = 0.5*(zmin1 + zmax1);
01974   hallVol -> AddNode(BUS1,1,new TGeoTranslation("BUS1",x0,
01975                                                 -halfhally+retcoilhalfy,z1));
01976 
01977   // Build coil volume on xy faces
01978   // Dimensions for horse's tail are roughly those received from J. Nelson 
01979   // correspondence of 8/1/2006, but y-length of bottom section is adjusted to 
01980   // actual distance to floor, and top & mid-sections are trapezoids 
01981   // instead of boxes, dimension in z has been squeezed to fit the supermodule
01982   // gap...
01983   Float_t ycoillen = y0+halfhally+sRad; // top of coil to floor
01984 
01985   // gap between bottom section of tail & plane. Adjust to fit avail region.
01986   Float_t zbotgap = 0.10*fScale; 
01987   // Define bounding box to contain tail 
01988   Float_t xhalftail = 0.40*fScale;
01989   Float_t yhalftail = 0.5*ycoillen;
01990   Float_t zhalftail = 0.5*(zbotgap+0.4*fScale);
01991   TGeoVolume* BUXY = fGeoManager->MakeBox("BUXY",medMap.GetMedium(Geo::kRCAir),
01992                                            xhalftail,yhalftail,zhalftail);
01993   BUXY -> SetLineColor(14); // gray bounding box, invisible by default 
01994   BUXY -> SetVisibility(kFALSE);
01995 
01996   // Horse's tail bounding box is placed at 4 end planes, rotating &
01997   // translating as necessary
01998   // rotFlip defines a 180 rotation
01999   TGeoRotation *rotFlip = new TGeoRotation("BUXY",90,180,90,90,180,0);
02000   rotFlip -> RegisterYourself();
02001   
02002   Float_t xcoil = x0;
02003   Float_t ycoil = y0 + sRad - ycoillen/2.;
02004   hallVol -> AddNode(BUXY,1,new TGeoTranslation("BUXY_1",xcoil,ycoil,
02005                      zmin0-zhalftail));
02006   hallVol -> AddNode(BUXY,2,new TGeoCombiTrans("BUXY_2",xcoil,ycoil,
02007                      zmax0+zhalftail,rotFlip));
02008   hallVol -> AddNode(BUXY,3,new TGeoTranslation("BUXY_3",xcoil,ycoil,
02009                      zmin1-zhalftail));
02010   hallVol -> AddNode(BUXY,4,new TGeoCombiTrans("BUXY_4",xcoil,ycoil,
02011                      zmax1+zhalftail,rotFlip));
02012 
02013   // Now build the inserts for the coil tail bounding box
02014   // Top section is a trapezoid
02015   Float_t yhalftop = 0.5*0.53*fScale;
02016   Float_t zhalftop = 0.10*fScale;
02017   Float_t xhalfloy = 0.2825*fScale;
02018   Float_t xhalfhiy = 0.12*fScale;
02019   TGeoTrap* bxyTopShp = new TGeoTrap("BXYTOP",zhalftop,0.,0.,
02020                                      yhalftop,xhalfloy,xhalfhiy,0.,
02021                                      yhalftop,xhalfloy,xhalfhiy,0.);
02022   TGeoVolume* BXYTOP = new TGeoVolume("BXYTOP",bxyTopShp,
02023                                        medMap.GetMedium(Geo::kRCCoil));
02024   BXYTOP -> SetLineColor(42);  // tan
02025   BXYTOP -> SetVisibility(kTRUE);
02026   BUXY -> AddNode(BXYTOP,1,new TGeoTranslation(0.,yhalftail-sRad-yhalftop,
02027                                               -zhalftail+zhalftop));
02028   
02029 
02030   // Middle section is a trapezoid that skews towards the face of the
02031   // steel plane with decreasing y
02032   Float_t yhalfmid = 0.5*0.85*fScale;
02033   TGeoArb8* bxyMidShp = new TGeoArb8(yhalfmid);
02034   bxyMidShp -> SetVertex(0,-0.4*fScale,0.05*fScale);
02035   bxyMidShp -> SetVertex(1,-0.4*fScale,0.15*fScale);
02036   bxyMidShp -> SetVertex(2,0.4*fScale,0.15*fScale);
02037   bxyMidShp -> SetVertex(3,0.4*fScale,0.05*fScale);
02038   bxyMidShp -> SetVertex(4,-0.2825*fScale,-0.25*fScale);
02039   bxyMidShp -> SetVertex(5,-0.2825*fScale,-0.05*fScale);
02040   bxyMidShp -> SetVertex(6,0.2825*fScale,-0.05*fScale);
02041   bxyMidShp -> SetVertex(7,0.2825*fScale,-0.25*fScale);
02042   
02043   TGeoVolume* BXYMID = new TGeoVolume("BXYMID",bxyMidShp,
02044                                        medMap.GetMedium(Geo::kRCCoil));
02045   BXYMID -> SetLineColor(42); // tan
02046   BXYMID -> SetVisibility(kTRUE);
02047 
02048   TGeoRotation *rotMid = new TGeoRotation("BXYMid",90,0,0,0,90,90);
02049   rotMid -> RegisterYourself();
02050   BUXY -> AddNode(BXYMID,1,new TGeoCombiTrans("BXYMID",0.,
02051                   yhalftail-sRad-2.*yhalftop-yhalfmid,0.,rotMid));
02052 
02053   // Bottom section is a box that extends to floor
02054   Float_t xhalfbot = 0.4*fScale;
02055   Float_t yhalfbot = 0.5*(ycoillen-sRad-2.*yhalftop-2.*yhalfmid);
02056   Float_t zhalfbot = 0.05*fScale;
02057   
02058   TGeoVolume* BXYBOT = fGeoManager -> MakeBox("BXYBOT",
02059                                                medMap.GetMedium(Geo::kRCCoil),
02060                                                xhalfbot,yhalfbot,zhalfbot);
02061   BXYBOT -> SetLineColor(42); // tan
02062   BXYBOT -> SetVisibility(kTRUE);
02063   BUXY -> AddNode(BXYBOT,1,new TGeoTranslation(0.,-yhalftail+yhalfbot,
02064                                                zhalftail-zbotgap-zhalfbot));
02065   
02066   // Return coil along floor that extends outside of detector
02067   TGeoVolume* BXYRET = fGeoManager -> MakeBox("BXYRET",
02068                                medMap.GetMedium(Geo::kRCCoil),
02069                                retcoilhalfx,retcoilhalfy,0.5*zbotgap);
02070   BXYRET -> SetLineColor(42);  // tan
02071   BXYRET -> SetVisibility(kTRUE);
02072   BUXY -> AddNode(BXYRET,1,new TGeoTranslation(0.,-yhalftail+retcoilhalfy,
02073                                                zhalftail-0.5*zbotgap));
02074 
02075   // Segment of coil tube that extends out beyond detector
02076   TGeoVolume* BXYSTB = fGeoManager -> MakeTube("BXYSTB",
02077                                                 medMap.GetMedium(Geo::kRCCoil),
02078                                                 0.,sRad,zhalftail);
02079   BXYSTB -> SetLineColor(42);  // tan
02080   BXYSTB -> SetVisibility(kTRUE);
02081   BUXY -> AddNodeOverlap(BXYSTB,1,new TGeoTranslation(0.,yhalftail-sRad,0.));
02082                                    
02083   return;
02084 
02085 }

TGeoVolume * GeoGeometry::BuildFarCoilAirGapVolume (  )  const [private, virtual]

Definition at line 2332 of file GeoGeometry.cxx.

References GetAppType(), GeoMediumMap::GetMedium(), GetMediumMap(), Geo::GetScale(), gGeoManager, Geo::kCoilRad, Geo::kCRGapBypass, Geo::kCRGapCoil, Geo::kCRGapFlange, Geo::kCRGapThroat, Geo::kFarBypassRad, Geo::kFlangeRad, Geo::kThroatRad, and UpdateGlobalManager().

Referenced by BuildCoilAirGapVolume().

02332                                                         {
02333   //
02334   // Build far coil region to be used in airgaps between scint and steel
02335   // planes.  The far detector coil in the air gap
02336   // regions is built according to the same parameters as are used in
02337   // the build of the coil in the far detector scint pln:
02338   //   1)Insert a "bypass" (r=Geo::kFarBypassRad) region (not to be confused
02339   //     with the bypass plastic insert).  This is constructed of magnetized
02340   //     air, and indicates the region near the coil where the detailed
02341   //     field map will be used.
02342   //   2)Insert into the "bypass" a "flange" (r=Geo::kFlangeRad) of magnetized
02343   //     iron.
02344   //   3)Insert into the "flange" a "throat" (r=Geo::kThroatRad) of magnetized
02345   //     air.
02346   //   4)Insert into the "throat" a "coil segment" (r=Geo::kCoilRad) of
02347   //     magnetized FARCOIL medium.  The coil segment is set to rest on the
02348   //     throat (off-center in y).
02349   //
02350   // The thickness in z of all pieces is set to be -1 when defining the shapes,
02351   // and built as a TGeoVolumeMulti.  When placed as a node in the air gap
02352   // volume, the volumemulti shape will take on the thickness of its parent.
02353   // This allows for variable thickness of the air gaps in a non-perfect
02354   // geometry.
02355   //
02356 
02357   UpdateGlobalManager();
02358 
02359   // The nomenclature used here is "F" (far), "G" (gap), followed by
02360   // the two letter code to indicate the coil part type.
02361 
02362   const GeoMediumMap& medMap = GetMediumMap();
02363   
02364   // First check to see if volumemulti has been built. Need only build once.
02365   TGeoVolume* volBypass = gGeoManager->GetVolume("FGBY");
02366   if ( volBypass ) return volBypass;
02367 
02368   Double_t scale = Geo::GetScale(GetAppType());
02369 
02370   TGeoVolume* volCoil
02371     = gGeoManager->MakeTube("FGCO",medMap.GetMedium(Geo::kCRGapCoil),
02372                             0,Geo::kCoilRad*scale,-1.); // coil
02373   volCoil -> SetLineColor(42); // tan
02374 
02375   TGeoVolume* volThroat
02376     = gGeoManager->MakeTube("FGTR",medMap.GetMedium(Geo::kCRGapThroat),
02377                             0,Geo::kThroatRad*scale,-1.); // throat
02378   volThroat -> SetLineColor(kBlue);
02379 
02380   TGeoVolume* volFlange
02381     = gGeoManager->MakeTube("FGFL",medMap.GetMedium(Geo::kCRGapFlange),
02382                              0,Geo::kFlangeRad*scale,-1.); // flange
02383   volFlange -> SetLineColor(46); // rust
02384 
02385   volBypass
02386     = gGeoManager->MakeTube("FGBY",medMap.GetMedium(Geo::kCRGapBypass),
02387                              0,Geo::kFarBypassRad*scale,-1.); // bypass
02388   volBypass -> SetLineColor(kBlue);
02389   volBypass -> SetLineStyle(2); // dashed
02390   volBypass -> SetVisibility(kFALSE); // invisible by default
02391 
02392   volBypass -> AddNode(volFlange,1,gGeoIdentity);
02393   volFlange -> AddNode(volThroat,1,gGeoIdentity);
02394   volThroat -> AddNode(volCoil,1,new TGeoTranslation(0,-0.01*scale,0));
02395 
02396   return volBypass;
02397 
02398 }

void GeoGeometry::BuildFarLeadStacks ( TGeoVolume *  hallVol  )  [private, virtual]

Definition at line 1308 of file GeoGeometry.cxx.

References fGeoManager, fScale, GeoMediumMap::GetMedium(), GetMediumMap(), gGeoManager, Msg::kDebug, Geo::kSoLo, MSG, and UpdateGlobalManager().

Referenced by BuildGeometry().

01308                                                         {
01309   // Private. Build the lead stacks (SOLO & Reeve's Castle) that sit south 
01310   // of the detector in the beam-line of the far detector cavern hall.  
01311 
01312   UpdateGlobalManager();
01313  
01314   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildFarLeadStacks " << endl;
01315   assert(fGeoManager);
01316 
01317   const GeoMediumMap& medMap = GetMediumMap();
01318 
01319   // HALL origin
01320   TGeoNode* linrNode = fGeoManager->GetVolume("MARS")->GetNode("LINR_1");
01321   const Double_t* h0 = linrNode -> GetMatrix() -> GetTranslation();
01322   Double_t hallX0 = h0[0];
01323   //Double_t hallY0 = h0[1];
01324   Double_t hallZ0 = h0[2];
01325   // HALL half-width
01326   TGeoBBox* hallBox = dynamic_cast<TGeoBBox*>(hallVol->GetShape());
01327   Double_t dyHall = hallBox->GetDY();
01328   
01329   // "SOLO" & "Reeve's castle" lead stacks sitting south of plane 0.
01330     
01331   // J. Beatty communication of July 15, 2008:  "SoLo is a 40"x40"x40" 
01332   // stack of lead bricks weighing a nominal 12 tons. It's center of mass 
01333   // sits 45" above floor level."  It has a sample chamber in the middle
01334   // which is not modeled here.  SoLo stands for SOudan LOw Background
01335   // counting facility.
01336   Double_t dxSoLo = 0.508*fScale; // half-width in x (0.5*40"*2.54/100.)
01337   Double_t dySoLo = 0.508*fScale; // half-width in y
01338   Double_t dzSoLo = 0.508*fScale; // half-width in z
01339 
01340   TGeoVolume* volSoLo = gGeoManager -> MakeBox("SoLo",
01341                         medMap.GetMedium(Geo::kSoLo),dxSoLo,dySoLo,dzSoLo);
01342   volSoLo -> SetLineColor(17); // Grey
01343 
01344   // z-offset of SoLo center from upstream face of plane 0 
01345   Double_t dzSoLoOffset = -12.3698*fScale; // 40' 7"
01346   Double_t dxSoLoOffset = -1.8288*fScale; // 6' east of center 
01347   // y-offset of Solo center from floor
01348   Double_t dySoLoOffset = +1.143*fScale; // 45" above the floor
01349 
01350   hallVol -> AddNode(volSoLo,1,
01351              new TGeoTranslation(-hallX0+dxSoLoOffset,
01352                                  -dyHall+dySoLoOffset,
01353                                  -hallZ0+dzSoLoOffset));
01354 
01355   // J. Beatty communication of July 15 & 20, 2008:  Reeve's castle is 
01356   // a 44"x36"x44" stack of lead bricks weighing a nominal 12 tons. It's 
01357   // center of mass is 22" above floor level.  Measurements were difficult
01358   // to take "don't hold me to an inch accuracy".  It has a sample chamber
01359   // in the middle which is not modeled here.
01360   Float_t dxReeves = 0.5588*fScale; // half-width in x (0.5*44"*2.54/100.)
01361   Float_t dyReeves = 0.4572*fScale; // half-width in y (0.5*36"*2.54/100.)
01362   Float_t dzReeves = 0.5588*fScale; // half-width in z (0.5*44"*2.54/100.)
01363   TGeoVolume* volReeves 
01364             = gGeoManager -> MakeBox("Reeves",
01365                     medMap.GetMedium(Geo::kSoLo),dxReeves,dyReeves,dzReeves);
01366   volReeves -> SetLineColor(17); // Grey
01367 
01368   // z-offset of Reeves center from upstream face of plane 0 
01369   Double_t dzReevesOffset = -11.5062*fScale; // 37' 9"
01370   // x-offset of Reeves center from detector center line
01371   Double_t dxReevesOffset = +3.556*fScale; // 11' 8" west of center
01372   // y-offset of Reeves center from floor
01373   Double_t dyReevesOffset = +0.5588*fScale; // 22" above the floor
01374 
01375   hallVol -> AddNode(volReeves,1,
01376           new TGeoTranslation(-hallX0+dxReevesOffset,
01377                               -dyHall+dyReevesOffset,
01378                               -hallZ0+dzReevesOffset));
01379     
01380 
01381                                    
01382   return;
01383 
01384 }

TGeoVolume * GeoGeometry::BuildFarMARS (  )  [private, virtual]

Definition at line 1700 of file GeoGeometry.cxx.

References fGeoManager, fScale, GeoMediumMap::GetMedium(), GetMediumMap(), gGeoManager, Msg::kDebug, Geo::kHall, Geo::kMars, MSG, and UpdateGlobalManager().

Referenced by BuildGeometry().

01700                                       {
01701   // Private. Build MARS appropriate for the far detector site.
01702 
01703   UpdateGlobalManager();
01704  
01705   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildFarMARS " << endl;
01706   assert(fGeoManager);
01707 
01708   const GeoMediumMap& medMap = GetMediumMap();
01709 
01710   // Dimensions of MARS should be db parameters?
01711   Float_t mars_halfx =  85.*fScale; //  85 m MARS half-x
01712   Float_t mars_halfy =  30.*fScale; //  30 m MARS half-y
01713   Float_t mars_halfz = 250.*fScale; // 250 m MARS half-z
01714   
01715   // Far detector rock medium is different than that of near
01716   TGeoVolume* volMARS = fGeoManager->MakeBox("MARS",
01717                                         medMap.GetMedium(Geo::kMars),
01718                                         mars_halfx,mars_halfy,mars_halfz);
01719 
01720   // Build shaft, tunnel, Soudan 2 cavern & ghost of S2 detector out of air 
01721   // and according to gminos dimensions, except as noted.
01722 
01723   Float_t shft_halfx =  1.*fScale; //  1 m shaft half-x
01724   Float_t shft_halfy = 30.*fScale; // 30 m shaft half-y == MARS half-y
01725   Float_t shft_halfz =  1.*fScale; //  1 m shaft half-z
01726   TGeoVolume* volSHFT = gGeoManager->MakeBox("SHFT",
01727                                              medMap.GetMedium(Geo::kHall),
01728                                              shft_halfx,shft_halfy,shft_halfz);
01729   volSHFT -> SetVisibility(kTRUE);
01730   volSHFT -> SetVisContainers(kTRUE);
01731   
01732   // Shorten tunnel by 1 m from gminos dimensions to avoid overlap with LINR
01733   Float_t tunl_halfx =  2.*fScale; //  2 m tunnel half-x
01734   Float_t tunl_halfy =  2.*fScale; //  2 m tunnel half-y 
01735   Float_t tunl_halfz = 13.5*fScale; // 13.5 m tunnel half-z
01736   TGeoVolume* volTUNL = gGeoManager->MakeBox("TUNL",
01737                                             medMap.GetMedium(Geo::kHall),
01738                                             tunl_halfx,tunl_halfy,tunl_halfz);
01739   volTUNL -> SetVisibility(kTRUE);
01740   volTUNL -> SetVisContainers(kTRUE);
01741   
01742   Float_t s2hl_halfx =  7.  *fScale; //  7    m S2 hall half-x
01743   Float_t s2hl_halfy =  5.65*fScale; //  5.65 m S2 hall half-y 
01744   Float_t s2hl_halfz = 35.  *fScale; // 35.   m S2 hall half-z
01745   TGeoVolume* volS2HL = gGeoManager->MakeBox("S2HL",
01746                                             medMap.GetMedium(Geo::kHall),
01747                                             s2hl_halfx,s2hl_halfy,s2hl_halfz);
01748   volS2HL -> SetVisibility(kTRUE);
01749   volS2HL -> SetVisContainers(kTRUE);
01750   
01751   // The ghost of the S2 detector size is adjusted from that in gminos to 
01752   // be more realistic, but it doesn't matter of course because it's not there!
01753   Float_t s2dt_halfx =  4. *fScale; // 4   m S2 detector half-x
01754   Float_t s2dt_halfy =  2.7*fScale; // 2.7 m S2 detector half-y (4.5, gminos) 
01755   Float_t s2dt_halfz =  7.5*fScale; // 7.5 m S2 detector half-z 
01756   TGeoVolume* volS2DT = gGeoManager->MakeBox("S2DT",
01757                                             medMap.GetMedium(Geo::kHall),
01758                                             s2dt_halfx,s2dt_halfy,s2dt_halfz);
01759   volS2DT -> SetVisibility(kTRUE);
01760   volS2DT -> SetVisContainers(kTRUE);
01761   
01762   volS2HL -> AddNode(volS2DT,1,
01763                      new TGeoTranslation(0*fScale,-1.15*fScale,-23.5*fScale));
01764 
01765 
01766   volMARS -> AddNode(volSHFT,1,
01767                      new TGeoTranslation(-5.*fScale,0.*fScale,98.18*fScale));
01768   volMARS -> AddNode(volTUNL,1,
01769                      new TGeoTranslation(-5.*fScale,-4.1*fScale,83.68*fScale));
01770   TGeoRotation* s2rot = new TGeoRotation("s2rot",64,0,90,90,26,180);
01771   s2rot -> RegisterYourself();
01772   volMARS -> AddNode(volS2HL,1,
01773                      new TGeoCombiTrans(36.*fScale,-0.45*fScale,61.68*fScale,
01774                                         s2rot));
01775 
01776   return volMARS;
01777 
01778 }

void GeoGeometry::BuildGeometry ( const VldContext vldc  )  [private, virtual]

Definition at line 898 of file GeoGeometry.cxx.

References BuildDetector(), BuildFarLeadStacks(), BuildFarMARS(), BuildMinerva(), BuildNearMARS(), fGeoManager, fHallPath, fScale, UgliDbiTables::GetDbiGeometry(), VldContext::GetDetector(), UgliDbiGeometry::GetHallXYZMax(), UgliDbiGeometry::GetHallXYZMin(), GeoMediumMap::GetMedium(), GetMediumMap(), VldContext::GetTimeStamp(), UgliLoanPool::GetUseNewCavern(), UgliLoanPool::Instance(), Msg::kDebug, Detector::kFar, Msg::kFatal, Geo::kHall, Geo::kLinr, Geo::kMars, Detector::kNear, Detector::kUnknown, MSG, Time2MinervaVersion(), and UpdateGlobalManager().

Referenced by BuildAll().

00898                                                       {
00899   // Private. Build this geometry's hierarchy of nodes
00900 
00901   UpdateGlobalManager();
00902   
00903   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildGeometry" << endl;
00904   assert(fGeoManager);
00905 
00906   const GeoMediumMap& medMap = GetMediumMap();
00907   
00908   if (vldc.GetDetector() == Detector::kUnknown) {
00909     // build a minimalistic geometry
00910     TGeoVolume* volMARS = fGeoManager -> MakeBox("MARS",
00911                                    medMap.GetMedium(Geo::kMars),1.2,1.2,1.2);
00912     TGeoVolume* volLINR = fGeoManager -> MakeBox("LINR",
00913                                    medMap.GetMedium(Geo::kLinr),1.1,1.1,1.1);
00914     volMARS -> AddNode(volLINR,1,gGeoIdentity);
00915     TGeoVolume* volHALL = fGeoManager -> MakeBox("HALL",
00916                                    medMap.GetMedium(Geo::kHall),1.0,1.0,1.0);
00917     volLINR -> AddNode(volHALL,1,gGeoIdentity);
00918     fGeoManager -> SetTopVolume(volMARS);
00919     return;
00920   }
00921 
00922   const UgliDbiTables& ugliDbiTables = UgliDbiTables(vldc);
00923   const UgliDbiGeometry* ugliDbiGeo = ugliDbiTables.GetDbiGeometry();
00924   if (!ugliDbiGeo) {
00925     MSG("Geo",Msg::kFatal) 
00926        << "No UgliDbiGeometry for " << vldc << endl;
00927     abort();
00928   }
00929 
00930   // Start with the hall, this is the widest view stored in db 
00931   const Float_t* hmin = ugliDbiGeo->GetHallXYZMin();
00932   const Float_t* hmax = ugliDbiGeo->GetHallXYZMax();
00933 
00934   TGeoVolume* volHALL = 0;
00935   Double_t hminsc[3] = {0};
00936   Double_t hmaxsc[3] = {0};
00937   
00938   bool useNewCavern = UgliLoanPool::Instance()->GetUseNewCavern();
00939   if ( useNewCavern && vldc.GetDetector() == Detector::kFar ) {
00940     // New far detector cavern has arched ceiling and other improvements
00941     // The cavern consists of three sections: South, Main, North
00942     // "Main" is the section around the main detector
00943     // Dimensions are from autocad diagrams provided by Jim Beatty, 6/2008
00944     
00945     Double_t dx[3] = {0};
00946     Double_t dz[3] = {0};
00947     std::string region[3] = {"S","M","N"};
00948     
00949     // South section of cavern:
00950     dx[0] = 6.9088*fScale; // 22'8", half-width in x 
00951     dz[0] = 5.461*fScale;  // 17'11", half-width in z
00952      
00953     // Main section of cavern:
00954     dx[1] = 7.2136*fScale; // 23'8", half-width in x
00955     dz[1] =15.0114*fScale; // 49'3", half-width in z
00956 
00957     // North section of cavern:
00958     dx[2] = 7.9248*fScale; // 26', half-width in x
00959     // north section z-width is defined to align new cavern north wall 
00960     // with old cavern north wall position.  If accuracy
00961     // north of the detector is important to any analysis, modeling
00962     // in the north cavern/tunnel/shaft region could be improved...
00963     dz[2] = 20.9176*fScale; 
00964  
00965     // offset of south wall from upstream face of plane 0 
00966     Double_t dzOffset = -13.6*fScale; 
00967     Double_t dzHall = dz[0] + dz[1] + dz[2]; // half-width in z of enclosure
00968 
00969     // Loop over 3 sections of detector cavern building cavern shape
00970     // with arched ceiling
00971     Double_t dyArch = 2.04*fScale;// 6.7',arch height,semiminor axis of ellipse
00972     Double_t dyBox = 5.79*fScale; // 19',half-width in y of box under arch
00973     Double_t dyHall 
00974          = (dyBox*2+dyArch)/2.; // 22.35',half-width in y of box enclosing hall
00975     Double_t dyOffset = -4.73*fScale; // offset of floor from coil center
00976 
00977     hminsc[0] = -dx[2]-(dx[2]-dx[1]);
00978     hmaxsc[0] = +dx[2]-(dx[2]-dx[1]);
00979     hminsc[1] = dyOffset;
00980     hmaxsc[1] = 2.*dyHall+hminsc[1];
00981     hminsc[2] = dzOffset;
00982     hmaxsc[2] = 2.*dzHall+hminsc[2];
00983 
00984     // Place the center of the elliptical tube used for the arch at the 
00985     // top of the box used for the base, and make y0 the center of
00986     // the entire height.
00987     TGeoTranslation* trArch=new TGeoTranslation("cavArch",0.,dyHall-dyArch,0.);
00988     trArch -> RegisterYourself();
00989     TGeoTranslation* trBox=new TGeoTranslation("cavBox",0.,-dyHall+dyBox,0.);
00990     trBox -> RegisterYourself();
00991 
00992     std::string secName[3];
00993     Double_t epsil = 1.e-4;
00994     for ( int iz = 0; iz < 3; iz++ ) {
00995       std::string archName = "cavArch"+region[iz];
00996       new TGeoEltu(archName.c_str(),dx[iz],dyArch,dz[iz]+epsil);
00997       std::string boxName = "cavBox"+region[iz];
00998       new TGeoBBox(boxName.c_str(),dx[iz],dyBox+epsil,dz[iz]+epsil);
00999       std::string composite = boxName + ":cavBox+" + archName + ":cavArch";
01000       secName[iz] = "hall" + region[iz];
01001       new TGeoCompositeShape(secName[iz].c_str(),composite.c_str());
01002       Double_t dzrel = 0;
01003       for ( int izz = 0; izz < iz; izz++ ) dzrel += 2.*dz[izz];
01004       TGeoTranslation* offset = new TGeoTranslation(secName[iz].c_str(),
01005                                 dx[2]-dx[iz],0.,-dzHall + dzrel + dz[iz]);
01006       offset -> RegisterYourself();
01007     }
01008 
01009     // Now piece the three sections together to construct the Hall
01010     std::string composite = secName[0] + ":" + secName[0] + "+"
01011                           + secName[1] + ":" + secName[1] + "+"
01012                           + secName[2] + ":" + secName[2];
01013 
01014     TGeoCompositeShape* hallShp = new TGeoCompositeShape("HALL",
01015                                                          composite.c_str());
01016     volHALL 
01017        = new TGeoVolume("HALL",hallShp,medMap.GetMedium(Geo::kHall));
01018     
01019     volHALL -> SetLineColor(42);
01020 
01021   }
01022   else {
01023     // Near det, cal det & old style far det cavern
01024     
01025     // pad as necessary hall dimensions
01026     Double_t xpad = 0.*fScale;
01027     // For near detector, pad y-dim by 1 cm because otherwise scint plane
01028     // polygon extrudes floor in imperfect geometry. Fix me.
01029     Double_t ypad = 0.*fScale;
01030     if ( vldc.GetDetector() == Detector::kNear ) ypad = 0.01*fScale;
01031   
01032     hminsc[0] = hmin[0]*fScale-xpad;
01033     hminsc[1] = hmin[1]*fScale-ypad;
01034     hminsc[2] = hmin[2]*fScale;
01035     hmaxsc[0] = hmax[0]*fScale+xpad;
01036     hmaxsc[1] = hmax[1]*fScale+ypad;
01037     hmaxsc[2] = hmax[2]*fScale;
01038   
01039     // Hall
01040     volHALL   = fGeoManager->MakeBox("HALL",
01041                                medMap.GetMedium(Geo::kHall),
01042                                0.5*(hmaxsc[0]-hminsc[0]),
01043                                0.5*(hmaxsc[1]-hminsc[1]),
01044                                0.5*(hmaxsc[2]-hminsc[2]));
01045 
01046     volHALL-> SetVisibility(kTRUE);
01047     volHALL-> SetVisContainers(kTRUE);
01048     volHALL-> SetLineColor(42);
01049   }
01050   
01051   // x/y/zhsiz is half-width in each dimension of hall
01052   Double_t xhsiz = 0.5*(hmaxsc[0] - hminsc[0]);
01053   Double_t yhsiz = 0.5*(hmaxsc[1] - hminsc[1]);
01054   Double_t zhsiz = 0.5*(hmaxsc[2] - hminsc[2]);
01055 
01056   // x/y/z0hall is center of hall
01057   Double_t x0hall = 0.5*(hmaxsc[0] + hminsc[0]);
01058   Double_t y0hall = 0.5*(hmaxsc[1] + hminsc[1]);
01059   Double_t z0hall = 0.5*(hmaxsc[2] + hminsc[2]);
01060 
01061   MSG("Geo",Msg::kDebug) << "Hall halfwidths " << xhsiz << ","
01062                          << yhsiz << "," << zhsiz << " placed at "
01063                          << x0hall << "," << y0hall << "," << z0hall << endl;
01064   
01065   // Liner pad is box with halfwidth dimensions equal
01066   // to the hall halfwidths + the liner thickness (1 m)
01067   Detector::Detector_t dettype = (Detector::Detector_t)vldc.GetDetector();
01068   const Double_t linerpad = 1.0*fScale; // thickness concrete liner (1 m)
01069   
01070   TGeoVolume* volLINR     = fGeoManager->MakeBox("LINR",
01071                                          medMap.GetMedium(Geo::kLinr),
01072                                          xhsiz+linerpad,yhsiz+linerpad,
01073                                          zhsiz+linerpad);
01074   volLINR-> SetVisibility(kTRUE);
01075   volLINR-> SetVisContainers(kTRUE);
01076   volLINR-> SetLineColor(kYellow);
01077 
01078   // Build MARS appropriate to detector type.
01079   TGeoVolume* volMARS = 0;
01080   switch ( dettype ) {
01081   case Detector::kFar:
01082     volMARS = BuildFarMARS();
01083     break;
01084   case Detector::kNear:
01085     volMARS = BuildNearMARS();
01086     break;
01087   default:
01088     // Rock shell default is
01089     // rock padding, minimum 5 m thick onto half hall dimensions
01090     const Double_t rockpad = 5.0*fScale; // thickness of considered rock (5 m)
01091     Double_t absxmax = TMath::Max(TMath::Abs(hminsc[0]),
01092                                   TMath::Abs(hmaxsc[0]));
01093     Double_t absymax = TMath::Max(TMath::Abs(hminsc[1]),
01094                                 TMath::Abs(hmaxsc[1]));
01095     Double_t abszmax = TMath::Max(TMath::Abs(hminsc[2]),
01096                                 TMath::Abs(hmaxsc[2]));
01097     volMARS = fGeoManager->MakeBox("MARS",medMap.GetMedium(Geo::kMars),
01098                                     absxmax+rockpad,
01099                                     absymax+rockpad,abszmax+rockpad);
01100     break;
01101   }
01102 
01103   volMARS -> SetVisibility(kTRUE);
01104   volMARS -> SetVisContainers(kTRUE);
01105   volMARS -> SetLineColor(kBlack); 
01106 
01107   // The top level volume MARS will be assigned node path "/MARS_1" by root
01108   fGeoManager -> SetTopVolume(volMARS);
01109   // GeoNodes are owned by the TGeoManager
01110   std::string nodename = "LINR_1";
01111   std::string globalpath = "/MARS_1/" + nodename;
01112   volMARS -> AddNode(volLINR,1,
01113                      new TGeoTranslation("LINR",x0hall,y0hall,z0hall));
01114    
01115   nodename = "HALL_1";
01116   globalpath += "/" + nodename;
01117   fHallPath = globalpath;
01118   volLINR -> AddNode(volHALL,1,gGeoIdentity);
01119 
01120   if ( useNewCavern && vldc.GetDetector() == Detector::kFar ) {
01121     if ( UgliLoanPool::Instance() -> GetLeadStacks() ) {
01122       BuildFarLeadStacks(volHALL);
01123     }
01124   }
01125 
01126   if ( vldc.GetDetector() == Detector::kNear ) {
01127     int mversion = UgliLoanPool::Instance() -> GetMinervaVersion();
01128     if ( mversion == -1 ) mversion = Time2MinervaVersion(vldc.GetTimeStamp());
01129     if ( mversion !=  0 ) BuildMinerva(mversion);
01130   }
01131   
01132   BuildDetector(vldc,volHALL);
01133   
01134 }

void GeoGeometry::BuildHallExtent (  )  [private, virtual]

Definition at line 248 of file GeoGeometry.cxx.

References cd(), fHallMax, fHallMin, fHallPath, gGeoManager, and UpdateGlobalManager().

Referenced by GeoGeometry().

00248                                   {
00249   // Purpose: Fill the min and max (x,y,z) of the detector hall in global
00250   // (MARS) coordinates.
00251 
00252   UpdateGlobalManager();
00253   
00254   gGeoManager -> cd(fHallPath.c_str());
00255   TGeoNode* hallNode = gGeoManager->GetCurrentNode();
00256   TGeoVolume* hallVol = hallNode->GetVolume();
00257 
00258   TGeoBBox* hallBox = dynamic_cast<TGeoBBox*>(hallVol->GetShape());
00259   
00260   Double_t lxyz[3] = {-(hallBox->GetDX()),-(hallBox->GetDY()),
00261                       -(hallBox->GetDZ())};
00262   Double_t gxyz[3] = {0};
00263   
00264   gGeoManager->LocalToMaster(lxyz,gxyz);
00265   
00266   for ( int ic = 0; ic < 3; ic++ ) {
00267     lxyz[ic] *= -1.;
00268     fHallMin[ic] = gxyz[ic];
00269   }
00270   
00271   gGeoManager->LocalToMaster(lxyz,gxyz);
00272   for ( int ic = 0; ic < 3; ic++ ) fHallMax[ic] = gxyz[ic];
00273   
00274 }

void GeoGeometry::BuildMinerva ( int  mversion  )  [private, virtual]

Definition at line 1387 of file GeoGeometry.cxx.

References Msg::kInfo, and MSG.

Referenced by BuildGeometry().

01387                                            {
01388   // Private.  Build a reduced/stripped-down pseudo-Minerva geometry 
01389   MSG("Geo",Msg::kInfo) << "GeoGeometry build pseudo-Minerva version " 
01390                         << mversion << endl;
01391 }

void GeoGeometry::BuildModules ( const UgliDbiTables tbl,
GeoScintPlnNode node 
) [private, virtual]

Definition at line 2088 of file GeoGeometry.cxx.

References PlexScintMdlId::AsString(), BuildStrips(), fGeoManager, fScale, UgliDbiTables::fScintPlnStructTbl, UgliDbiScintMdl::GetClearLenEast(), UgliDbiScintMdl::GetClearLenWest(), UgliDbiTables::GetDbiScintMdlById(), GetGeoCompatibleName(), GeoNode::GetGlobalPath(), DbiResultPtr< T >::GetRowByIndex(), UgliDbiScintMdl::GetWlsLenEast(), UgliDbiScintMdl::GetWlsLenWest(), UgliDbiStructHash::HashAsPlane(), Msg::kDebug, Msg::kVerbose, MSG, and UpdateGlobalManager().

Referenced by BuildPlanePairVolumes().

02089                                                          {
02090   // Private. Purpose: Build the modules as part of the scintillator plane
02091   
02092   UpdateGlobalManager();
02093   
02094   assert(fGeoManager);
02095 
02096   const PlexPlaneId& plexPlaneId = plnNode -> GetPlexPlaneId();
02097   MSG("Geo",Msg::kDebug) <<"GeoGeometry::BuildModules for scint pln  " 
02098                          << plnNode->GetName() << endl;
02099 
02100   // Global path to plane node. Used to build module global path.
02101   std::string plnPath = plnNode->GetGlobalPath();
02102 
02103   // ScintPlnStruct used to retrieve number of modules in plane  
02104   UgliDbiStructHash planestructhash(plexPlaneId);
02105   const UgliDbiScintPlnStruct* plnStruct = ugliDbiTables.fScintPlnStructTbl
02106         .GetRowByIndex(planestructhash.HashAsPlane());
02107   Int_t nmodules = plnStruct -> GetNModules();
02108   
02109   // Loop over all modules in plane
02110   for ( int imod = 0; imod < nmodules; imod++ ) {
02111     // For each module
02112     PlexScintMdlId plexModuleId(plexPlaneId,imod);
02113 
02114     std::string mdlName = GetGeoCompatibleName(plexModuleId.AsString());
02115     
02116     // Build the module volume
02117     // Ideally could just build one module of each type but alignment varies
02118     // tpos and this may cause slight size variations
02119     // So for now generate one mdl volume per module
02120     GeoScintMdlVolume* mdlVol = new GeoScintMdlVolume(this,plexModuleId,
02121                                                       ugliDbiTables);
02122  
02123     // Build the node and place it in the plane
02124     // Establish the rotational & translational matrix for the module
02125     const UgliDbiScintMdl* scModule 
02126       = ugliDbiTables.GetDbiScintMdlById(plexModuleId);
02127     Float_t tposMod = (scModule -> GetTPosRelPln())*fScale;
02128     Float_t lposMod = (scModule -> GetLPosRelPln())*fScale;
02129     Float_t zrotMod = scModule -> GetZRotRelPlnDeg(); 
02130  
02131     TGeoRotation* modRotMatrix = new TGeoRotation(mdlName.c_str(), 90.,zrotMod,
02132                                                   90.,90.+zrotMod,0.,0.);
02133     modRotMatrix -> RegisterYourself();
02134 
02135     TGeoCombiTrans* combiMatrix = new TGeoCombiTrans(mdlName.c_str(),
02136                                      lposMod,tposMod,0.,modRotMatrix);
02137     std::string mdlNodeName = mdlName + "_1";
02138 
02139     MSG("Geo",Msg::kVerbose) << "Mdl node " << mdlNodeName.c_str() 
02140                              << "tpos, lpos, zrot(deg) rel pln " 
02141                              << tposMod << "," << lposMod << "," << zrotMod 
02142                              << endl;
02143     
02144     GeoScintMdlNode* mdlNode = new GeoScintMdlNode(this,mdlVol,combiMatrix,
02145                                                    plnNode,mdlNodeName,
02146                                                    plexModuleId,
02147                                           scModule->GetClearLenEast()*fScale,
02148                                           scModule->GetClearLenWest()*fScale,
02149                                           scModule->GetWlsLenEast()*fScale,
02150                                           scModule->GetWlsLenWest()*fScale);
02151 
02152     // Add strips to module node
02153     BuildStrips(ugliDbiTables,mdlNode);
02154 
02155   }
02156   
02157 }

void GeoGeometry::BuildNearCoil ( TGeoVolume *  hallVol  )  [private, virtual]

Definition at line 1806 of file GeoGeometry.cxx.

References fGeoManager, fScale, GeoMediumMap::GetMedium(), GetMediumMap(), GetRot315(), GetRot45(), GetZExtent(), Geo::kCoilRad, Msg::kDebug, Geo::kNeckRad, Geo::kRCAir, Geo::kRCCoil, Geo::kRCShaft, Geo::kThroatRad, MSG, and UpdateGlobalManager().

Referenced by BuildDetector().

01806                                                    {
01807   // Private. Build the near detector coil. Fix me.  
01808   // x0,y0 is coil hole center in hall coordinates (assumed constant
01809   // over all planes).
01810 
01811   UpdateGlobalManager();
01812  
01813   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildNearCoil " << endl;
01814   assert(fGeoManager);
01815 
01816   const GeoMediumMap& medMap = GetMediumMap();
01817 
01818   // The dimensions of the coil should be extracted from the db
01819   Float_t shalfx  = Geo::kNeckRad*fScale; // steel 
01820   Float_t shalfy  = shalfx; // steel
01821   Float_t ahalfx  = Geo::kThroatRad*fScale; // air
01822   Float_t ahalfy  = ahalfx; // air
01823   Float_t alhalfx = Geo::kCoilRad*fScale; // aluminum
01824   Float_t alhalfy = alhalfx; // aluminum
01825  
01826   // Build coil along z-direction, extends to ends of super module
01827   Float_t zmin,zmax;
01828   GetZExtent(zmin,zmax,-1); // returned in MARS coordinates
01829   // Convert to HALL coordinates
01830   TGeoNode* linrNode = fGeoManager->GetVolume("MARS")->GetNode("LINR_1");
01831   const Double_t* h0 = linrNode -> GetMatrix() -> GetTranslation();
01832   zmin -= h0[2];
01833   zmax -= h0[2];
01834   Float_t x0 = -h0[0];
01835   Float_t y0 = -h0[1];
01836   
01837   Float_t zcoillen = zmax - zmin;
01838   TGeoVolume* BUS0 = fGeoManager->MakeBox("BUS0",
01839                                            medMap.GetMedium(Geo::kRCShaft),
01840                                            shalfx,shalfy,0.5*zcoillen);
01841   BUS0 -> SetLineColor(14);  // gray  
01842   BUS0 -> SetVisibility(kTRUE);
01843 
01844   TGeoVolume* BUA0 = fGeoManager->MakeBox("BUA0",
01845                                            medMap.GetMedium(Geo::kRCAir),
01846                                            ahalfx,ahalfy,0.5*zcoillen);
01847   BUA0 -> SetLineColor(14);  
01848   BUA0 -> SetVisibility(kTRUE);
01849   BUS0 -> AddNode(BUA0,1,gGeoIdentity);
01850 
01851   TGeoVolume* BUC0 = fGeoManager->MakeBox("BUC0",
01852                                            medMap.GetMedium(Geo::kRCCoil),
01853                                            alhalfx,alhalfy,0.5*zcoillen);
01854   BUC0 -> SetLineColor(14);  
01855   BUC0 -> SetVisibility(kTRUE);
01856   BUA0 -> AddNode(BUC0,1,gGeoIdentity);
01857 
01858   // Rotate first, then translate
01859   TGeoRotation *rot45 = GetRot45();
01860   Float_t zcoil = (zmin+zmax)/2.;
01861 
01862   // Place return coil in hall
01863   Float_t steelhalfy = 1.9*fScale; // 1.9 m halfwidth in y direction
01864   Float_t xcoil = x0 - steelhalfy;
01865   Float_t ycoil = y0 - steelhalfy;
01866   // overlap because it overlaps pair plane volumes. Fix me.
01867   hallVol -> AddNodeOverlap(BUS0,2,
01868                             new TGeoCombiTrans(xcoil,ycoil,zcoil,rot45)); 
01869 
01870   // Along xy face
01871   Float_t cos45 = 0.707107;
01872   Float_t coillenxy = steelhalfy/cos45 + 2.*shalfx;
01873   TGeoVolume* BUSXY = fGeoManager->MakeBox("BUSXY",
01874                                             medMap.GetMedium(Geo::kRCShaft),
01875                                             shalfx,0.5*coillenxy,shalfy);
01876   BUSXY -> SetLineColor(14);  // gray  
01877   BUSXY -> SetVisibility(kTRUE);
01878   TGeoVolume* BUAXY = fGeoManager->MakeBox("BUAXY",
01879                                             medMap.GetMedium(Geo::kRCAir),
01880                                             ahalfx,0.5*coillenxy,ahalfy);
01881   BUAXY -> SetLineColor(14);  
01882   BUAXY -> SetVisibility(kTRUE);
01883   BUSXY -> AddNode(BUAXY,1,gGeoIdentity);
01884 
01885   TGeoVolume* BUCXY = fGeoManager->MakeBox("BUCXY",
01886                                             medMap.GetMedium(Geo::kRCCoil),
01887                                             alhalfx,0.5*coillenxy,alhalfy);
01888   BUCXY -> SetLineColor(14);  
01889   BUCXY -> SetVisibility(kTRUE);
01890   BUAXY -> AddNode(BUCXY,1,gGeoIdentity);
01891 
01892   // Will be rotated and then translated
01893   TGeoRotation* rotneg45 = GetRot315();
01894   xcoil = x0 - (0.5*coillenxy - shalfx)*cos45;
01895   ycoil = y0 - (0.5*coillenxy - shalfy)*cos45;
01896   zcoil = zmin - shalfy;
01897   hallVol -> AddNode(BUSXY,1,new TGeoCombiTrans(xcoil,ycoil,zcoil,rotneg45));  
01898 
01899   zcoil = zmax + shalfy;
01900   hallVol -> AddNode(BUSXY,2,new TGeoCombiTrans(xcoil,ycoil,zcoil,rotneg45));  
01901 
01902   return;
01903 
01904 }

TGeoVolume * GeoGeometry::BuildNearCoilAirGapVolume (  )  const [private, virtual]

to rest on the throat

Definition at line 2401 of file GeoGeometry.cxx.

References GetAppType(), GeoMediumMap::GetMedium(), GetMediumMap(), Geo::GetScale(), gGeoManager, Geo::kCoilRad, Geo::kCRGapBypass, Geo::kCRGapCoil, Geo::kCRGapFlange, Geo::kCRGapThroat, Geo::kCRGapWater, Geo::kFlangeRad, Geo::kNearCoolRad, Geo::kNearFullBypassRad, Geo::kThroatRad, and UpdateGlobalManager().

Referenced by BuildCoilAirGapVolume().

02401                                                          {
02402   //
02403   // Build near coil region to be used in airgaps between scint and steel
02404   // planes.  The near detector coil in the air gap
02405   // regions is built according to the same parameters as are used in
02406   // the build of the coil in the near detector full coverage scint pln:
02407   //   1)Insert a "bypass" tube (r=Geo::kNearFullBypassRad) region (not to 
02408   //     be confused with the bypass plastic insert).  This is constructed of 
02409   //     magnetized air.
02410   //   2)Insert into the "bypass" a "flange" (box of halfx/y = Geo::kFlangeRad)
02411   //     of  magnetized iron.
02412   //   3)Insert into the "flange" a "throat" (box of halfx/y = Geo::kThroatRad)
02413   //     of  magnetized air.
02414   //   4)Insert into the "throat" a "coil segment" (box of halfx/y
02415   //     = Geo::kCoilRad) of magnetized aluminum.  The coil segment is set
02417   //   5)Insert into the "coil segment" tubes (r=Geo::kNearCoolRad) of
02418   //     magnetized water in an array of 6 columns x 8 rows.
02419   //
02420   // The thickness in z of all pieces is set to be -1 when defining the shapes,
02421   // and built as a TGeoVolumeMulti.  When placed as a node in the scint
02422   // plane, the volumemulti shape will take on the thickness of its parent.
02423   // This allows for variable thickness of the scint plane in a non-perfect
02424   // geometry.
02425   //
02426 
02427   UpdateGlobalManager();
02428 
02429   const GeoMediumMap& medMap = GetMediumMap();
02430   
02431   // The nomenclature used here is "N" (near), "G" (gap), followed by
02432   // the two letter code to indicate the coil part type.
02433   std::string preface = "NG";
02434 
02435   // First check to see if volumemulti has been built. Need only build once.
02436   TGeoVolume* volBypass
02437               = gGeoManager->GetVolume(std::string(preface+"BY").c_str());
02438   if ( volBypass ) return volBypass;
02439 
02440   Double_t scale = Geo::GetScale(GetAppType());
02441 
02442   TGeoVolume* volWater
02443     = gGeoManager->MakeTube(std::string(preface+"WA").c_str(),
02444                             medMap.GetMedium(Geo::kCRGapWater),0,
02445                             Geo::kNearCoolRad*scale,-1.); // water
02446   volWater -> SetLineColor(kGreen);
02447 
02448   TGeoVolume* volCoil
02449     = gGeoManager->MakeBox(std::string(preface+"CO").c_str(),
02450                           medMap.GetMedium(Geo::kCRGapCoil),
02451                           Geo::kCoilRad*scale,Geo::kCoilRad*scale,-1.); // coil
02452   volCoil -> SetLineColor(kBlack);
02453 
02454   TGeoVolume* volThroat
02455     = gGeoManager->MakeBox(std::string(preface+"TR").c_str(),
02456                            medMap.GetMedium(Geo::kCRGapThroat),
02457                      Geo::kThroatRad*scale,Geo::kThroatRad*scale,-1.); //throat
02458   volThroat -> SetLineColor(kBlue);
02459 
02460   TGeoVolume* volFlange
02461     = gGeoManager->MakeBox(std::string(preface+"FL").c_str(),
02462                            medMap.GetMedium(Geo::kCRGapFlange),
02463                      Geo::kFlangeRad*scale,Geo::kFlangeRad*scale,-1.); //flange
02464   volFlange -> SetLineColor(kBlack);
02465 
02466   volBypass
02467       = gGeoManager->MakeTube(std::string(preface+"BY").c_str(),
02468                               medMap.GetMedium(Geo::kCRGapBypass),0,
02469                               Geo::kNearFullBypassRad*scale,-1.); // bypass
02470   volBypass -> SetLineColor(kBlue);
02471   volBypass -> SetLineStyle(2); // dashed
02472 
02473   volBypass -> AddNode(volFlange,1,gGeoIdentity);
02474   volFlange -> AddNode(volThroat,1,gGeoIdentity);
02475 
02476   volThroat -> AddNode(volCoil,1,
02477                        new TGeoTranslation(-0.01*scale,-0.01*scale,0));
02478 
02479   Int_t nx = 6;
02480   Int_t ny = 8;
02481 
02482   Float_t xedge = 0.02475*scale;// dist from x-edge to center of 1st(last) tube
02483   Float_t x0   = -Geo::kCoilRad*scale + xedge;  // first tube position in x
02484   // separation of tubes in x direction
02485   Float_t xsep = 2.*(Geo::kCoilRad*scale - xedge)/(Float_t)(nx-1);
02486 
02487   Float_t yedge = 0.02221*scale;// dist from y-edge to center of 1st(last) tube
02488   Float_t y0   = -Geo::kCoilRad*scale + yedge;  // first tube position in y
02489   // separation of tubes in y direction
02490   Float_t ysep = 2.*(Geo::kCoilRad*scale - yedge)/(Float_t)(ny-1);
02491 
02492   for ( int ix = 0; ix < nx; ix++ ) {
02493     Float_t xpos = x0 + (Float_t)ix*xsep;
02494     for ( int iy = 0; iy < ny; iy++ ) {
02495       Float_t ypos = y0 + (Float_t)iy*ysep;
02496       Int_t itube = ix*ny+iy+1;
02497       volCoil -> AddNode(volWater,itube,new TGeoTranslation(xpos,ypos,0));
02498     }
02499   }
02500 
02501   return volBypass;
02502 
02503 }

TGeoVolume * GeoGeometry::BuildNearMARS (  )  [private, virtual]

Definition at line 1781 of file GeoGeometry.cxx.

References fGeoManager, fScale, GeoMediumMap::GetMedium(), GetMediumMap(), Msg::kDebug, Geo::kMars, MSG, and UpdateGlobalManager().

Referenced by BuildGeometry().

01781                                        {
01782   // Private. Build MARS appropriate for the near detector site.
01783 
01784   UpdateGlobalManager();
01785  
01786   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildNearMARS " << endl;
01787   assert(fGeoManager);
01788 
01789   const GeoMediumMap& medMap = GetMediumMap();
01790 
01791   // Dimensions of MARS should be db parameters?
01792   Float_t mars_halfx =  85.*fScale; //  85 m MARS half-x
01793   Float_t mars_halfy =  30.*fScale; //  30 m MARS half-y
01794   Float_t mars_halfz = 250.*fScale; // 250 m MARS half-z
01795   
01796   // Near detector rock medium is different than that of far 
01797   TGeoVolume* volMARS = fGeoManager->MakeBox("MARS",
01798                                            medMap.GetMedium(Geo::kMars),
01799                                            mars_halfx,mars_halfy,mars_halfz);
01800 
01801   return volMARS;
01802 
01803 }

void GeoGeometry::BuildPlanePairVolumes ( const VldContext vldc  )  [private, virtual]

Definition at line 1406 of file GeoGeometry.cxx.

References GeoShield::AddVolume(), bfld::AsString(), PlexPlaneId::AsString(), BuildCoilAirGapVolume(), BuildModules(), BuildStripVolumes(), fGeoManager, fGeoShield, fHallPath, fPlaneMap, fScale, fSMZMax, fSMZMin, UgliDbiTables::GetDbiScintPlnByIndex(), VldContext::GetDetector(), GetGeoCompatibleName(), GeoMediumMap::GetMedium(), GetMediumMap(), DbiResultPtr< T >::GetNumRows(), PlexPlaneId::GetPlane(), PlexPlaneId::GetPlaneCoverage(), GetRot45(), DbiResultPtr< T >::GetRow(), DbiResultPtr< T >::GetRowByIndex(), UgliLoanPool::GetShieldOff(), GetSMPlaneLimits(), UgliDbiSteelPln::GetThickness(), UgliDbiScintPln::GetThickness(), UgliDbiSteelPln::GetTotalZ(), UgliDbiSteelPln::GetX0(), UgliDbiScintPln::GetX0RelSteel(), UgliDbiScintPln::GetY0RelSteel(), UgliDbiSteelPln::GetZBack(), UgliDbiScintPln::GetZRotRelSteelDeg(), UgliLoanPool::Instance(), PlexPlaneId::IsVetoShield(), Detector::kCalDet, Msg::kDebug, Detector::kFar, Geo::kHall, Detector::kNear, PlaneCoverage::kNoActive, Geo::kPlnAirGap, PlaneCoverage::kUnknown, MSG, PlexVetoShieldHack::RenumberMuxToMdl(), PlexPlaneId::SetIsSteel(), and UpdateGlobalManager().

Referenced by BuildDetector().

01406                                                               {
01407   // Private. Build this geometry's steel+scint plane pair volumes
01408 
01409   UpdateGlobalManager();
01410 
01411   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildPlanePairVolumes " << endl;
01412   assert(fGeoManager);
01413 
01414   const GeoMediumMap& medMap = GetMediumMap();
01415 
01416   DbiResultPtr<UgliDbiSteelPln> steelTbl(vldc);
01417   const UgliDbiTables& ugliDbiTables = UgliDbiTables(vldc);
01418 
01419   // Pre-build strip volumes
01420   BuildStripVolumes(vldc);
01421 
01422   Int_t plnMin[2] = {-1};
01423   Int_t plnMax[2] = {-1};
01424   Int_t nSM = GetSMPlaneLimits(vldc,plnMin,plnMax);
01425   
01426   // Build coil segment volume to be used for air gaps between scint & steel
01427   // planes.  This is built as TGeoVolumeMulti, and can be built once and
01428   // used to fill every air gap in detector.
01429   TGeoVolume* coilVol = BuildCoilAirGapVolume(vldc); 
01430   TGeoRotation* rot45 = GetRot45();
01431   Detector::Detector_t dettype = (Detector::Detector_t)vldc.GetDetector();
01432   
01433   bool shieldOff = UgliLoanPool::Instance()->GetShieldOff();
01434 
01435   for (unsigned int irow=0; irow < steelTbl.GetNumRows(); ++irow) {
01436 
01437     // Build steel and scint plane volumes first, then position so
01438     // that we know pair volume size.
01439 
01440     // Steel plane
01441     GeoSteelPlnVolume* stplnVolume = 0;
01442     const UgliDbiSteelPln* stRow = steelTbl.GetRow(irow);
01443     PlexPlaneId steelId = stRow -> GetPlaneId();
01444     if ( shieldOff && steelId.IsVetoShield() ) continue;
01445 
01446     std::string stName = GetGeoCompatibleName(steelId.AsString());
01447      
01448     if ( steelId.IsVetoShield() 
01449       && vldc.GetDetector() == Detector::kFar ) steelId =
01450       PlexVetoShieldHack::RenumberMuxToMdl(vldc,steelId);  // don't know why 
01451     else if ( steelId.GetPlane() > 485 ) continue; // because db has 0-497
01452     // Skip planes that have intentionally been placed at unphysical
01453     // locations
01454     if ( TMath::Abs(stRow->GetX0() ) > 50. ) continue;
01455     
01456     Double_t pairhalfx = 0;
01457     Double_t pairhalfy = 0;
01458 
01459     // If plane is first plane in supermodule, thickness of pair box is just
01460     // "Thickness", else pair box thickness is set by distance from back 
01461     // face of of current steel plane to back face of previous steel plane. 
01462     Int_t planeno = steelId.GetPlane();
01463     Double_t pairhalfz = 0;
01464     if ( vldc.GetDetector() == Detector::kCalDet || steelId.IsVetoShield() ) 
01465       pairhalfz = 0.5*(stRow->GetTotalZ())*fScale;
01466     else
01467       pairhalfz = 0.5*(stRow->GetThickness())*fScale;
01468     if ( !steelId.IsVetoShield() ) {
01469       if ( planeno != plnMin[0] ) {
01470         if ( nSM == 1 || (nSM > 1 && planeno != plnMin[1]) ) {
01471           const UgliDbiSteelPln* stPrevRow = steelTbl.GetRowByIndex(planeno-1);
01472           pairhalfz = 0.5*(stRow->GetZBack() - stPrevRow->GetZBack())*fScale;
01473         }
01474       }
01475     }
01476     
01477     if ( !steelId.IsVetoShield() ) {
01478       stplnVolume = new GeoSteelPlnVolume(this,steelId,
01479                                        stRow->GetThickness()*fScale);
01480       stplnVolume -> SetLineColor(kRed);
01481       stplnVolume -> SetVisibility(kTRUE);
01482 
01483       // Since we assume that pair is always placed at (x,y)=(0,0), need
01484       // to take into account bbox origin when determining pair dx,dy
01485       TGeoBBox* bbox = dynamic_cast<TGeoBBox*>(stplnVolume->GetShape());
01486       pairhalfx = bbox->GetDX() + TMath::Abs((bbox->GetOrigin())[0]);
01487       pairhalfy = bbox->GetDY() + TMath::Abs((bbox->GetOrigin())[1]);
01488     }
01489     
01490     // Scint plane
01491     GeoScintPlnVolume* scplnVolume = 0;
01492     const UgliDbiScintPln* scRow = 0;
01493     PlexPlaneId scintId = steelId;
01494     scintId.SetIsSteel(false);
01495     std::string scName = GetGeoCompatibleName(scintId.AsString());
01496     if ( PlaneCoverage::kNoActive != steelId.GetPlaneCoverage() && 
01497          PlaneCoverage::kUnknown  != steelId.GetPlaneCoverage() ) {
01498       scRow = ugliDbiTables.GetDbiScintPlnByIndex(scintId.GetPlane());
01499       MSG("Geo",Msg::kDebug) << "Build ScintPln " << scintId.AsString()
01500                              << " w/thickness " << scRow->GetThickness()*fScale
01501                              << endl;
01502 
01503       scplnVolume = new GeoScintPlnVolume(this,scintId,
01504                                           scRow->GetThickness()*fScale);
01505       scplnVolume -> SetVisibility(kFALSE); // deactivate when not debugging
01506       scplnVolume -> SetLineColor(kBlue);
01507 
01508       // This only works because scint planes are rotated in a way such that
01509       // width and height of bounding box don't change.
01510       TGeoBBox* bbox = dynamic_cast<TGeoBBox*>(scplnVolume->GetShape());
01511       pairhalfx = TMath::Max(pairhalfx,bbox->GetDX() 
01512                                      + TMath::Abs((bbox->GetOrigin())[0]));
01513       pairhalfy = TMath::Max(pairhalfy,bbox->GetDY() 
01514                                      + TMath::Abs((bbox->GetOrigin())[1]));
01515     }
01516     // avoid extension of near detector pair box into hall floor. Fix me.
01517     if ( vldc.GetDetector() == Detector::kNear ) pairhalfy = 2.91*fScale;
01518     
01519     // Build pair bounding box and position according to steel plane coords
01520     std::string pairName = GetGeoCompatibleName(steelId.AsString("b"));
01521     MSG("Geo",Msg::kDebug) << "Build PairBox " << pairName.c_str()
01522                            << " w/halfx,y,z " << pairhalfx << ","
01523                            << pairhalfy << "," << pairhalfz << "." << endl;
01524 
01525     Geo::EDetComponent detcomp = Geo::kPlnAirGap;
01526     if ( steelId.IsVetoShield() ) detcomp = Geo::kHall;
01527     TGeoVolume* pairVol = fGeoManager->MakeBox(pairName.c_str(),
01528                                              medMap.GetMedium(detcomp),
01529                                              pairhalfx,pairhalfy,pairhalfz);
01530     pairVol -> SetVisibility(kFALSE);
01531     pairVol -> VisibleDaughters(kTRUE);
01532 
01533     // Build 2 boxes representing air gaps.  "airgap0" is the gap between
01534     // the "front" (low-z face) of the scint plane in the current pair and the
01535     // "back" (high-z face) of the steel plane in the previous pair.
01536     // "airgap1" is the gap between the scint & steel plane in the current
01537     // pair.  The airgap coil segment will be added to each air gap.
01538     if ( !steelId.IsVetoShield() && coilVol ) {
01539       if ( planeno != plnMin[0] ) {
01540         if ( nSM == 1 || (nSM > 1 && planeno != plnMin[1]) ) {
01541           std::string airgap0 = pairName + "_air0";
01542           Double_t airgap0halfz = pairhalfz - 0.5*(stRow->GetTotalZ())*fScale;
01543           // totalz includes airgap even when scint pln not present? 
01544           // compensate for it here
01545           if ( !scplnVolume ) airgap0halfz 
01546                              = pairhalfz - 0.5*(stRow->GetThickness())*fScale;
01547           TGeoVolume* airgap0Vol = fGeoManager->MakeBox(airgap0.c_str(),
01548                                           medMap.GetMedium(Geo::kPlnAirGap),
01549                                           pairhalfx,pairhalfy,airgap0halfz);
01550           airgap0Vol -> SetVisibility(kFALSE);
01551           airgap0Vol -> VisibleDaughters(kTRUE);
01552           Double_t airgap0z0 = -pairhalfz + airgap0halfz;
01553           pairVol->AddNode(airgap0Vol,1,new TGeoTranslation(0.,0.,airgap0z0));
01554           if (dettype == Detector::kNear) airgap0Vol->AddNode(coilVol,1,rot45);
01555           else airgap0Vol -> AddNode(coilVol,1,gGeoIdentity);
01556         }
01557       }
01558       if ( scplnVolume ) {  // can't have airgap1 without active plane
01559         std::string airgap1 = pairName + "_air1";
01560         Double_t airgap1halfz = 0.5*(stRow->GetTotalZ()-stRow->GetThickness() 
01561                           - scRow->GetThickness())*fScale;
01562         TGeoVolume* airgap1Vol = fGeoManager->MakeBox(airgap1.c_str(),
01563                                      medMap.GetMedium(Geo::kPlnAirGap),
01564                                      pairhalfx,pairhalfy,airgap1halfz);
01565         airgap1Vol -> SetVisibility(kFALSE);
01566         airgap1Vol -> VisibleDaughters(kTRUE);
01567         Double_t airgap1z0 = pairhalfz-stRow->GetThickness()*fScale
01568                            - airgap1halfz;
01569         pairVol -> AddNode(airgap1Vol,1,new TGeoTranslation(0.,0.,airgap1z0));
01570 
01571         if ( dettype == Detector::kNear ) airgap1Vol->AddNode(coilVol,1,rot45);
01572         else airgap1Vol -> AddNode(coilVol,1,gGeoIdentity);
01573       }  
01574     }
01575     
01576     // Add to shield groups so as to be able to build bounding volume
01577     // default for caldet shield planes is still to place pair directly in hall
01578 
01579 
01580     std::string pairPath = fHallPath + "/" + pairName +"_1"; 
01581     if ( steelId.IsVetoShield() && vldc.GetDetector() == Detector::kFar ) { 
01582       GeoShield::EGroupType group=fGeoShield.AddVolume(pairVol,steelId,stRow);
01583       pairPath = fHallPath + "/" + GeoShield::AsString(group) + "_1/" + 
01584                  pairName+"_1";
01585     }
01586       
01587     int iSM = -1; // veto shield
01588     if ( !steelId.IsVetoShield() ) {
01589       iSM = 0;
01590       if ( nSM > 1 && steelId.GetPlane() > plnMax[0] ) iSM = 1;
01591     }
01592       
01593     if ( stplnVolume ) {
01594       // Place the steel plane within the pairVol
01595       std::string stplnNodeName = stName + "_1";
01596       std::string steelPlnPath = pairPath + "/" + stplnNodeName;
01597       double z0steel = pairhalfz - 0.5*(stRow->GetThickness())*fScale;
01598       MSG("Geo",Msg::kDebug) << "Placing steel pln at " << 0. << ","
01599                              << 0. << "," << z0steel << endl;
01600       GeoSteelPlnNode* stplnNode = new GeoSteelPlnNode(this,stplnVolume,
01601                           new TGeoTranslation(stName.c_str(),0.,0.,z0steel),
01602                           pairVol,steelPlnPath,stplnNodeName,steelId);
01603       
01604       // fSMZMin/Max in MARS coordinates
01605       if ( vldc.GetDetector() != Detector::kCalDet ) 
01606         fSMZMin[iSM] = TMath::Min(fSMZMin[iSM],(stRow->GetZBack()
01607                                   -stRow->GetThickness())*fScale);  
01608       else 
01609         fSMZMin[iSM] = TMath::Min(fSMZMin[iSM],(stRow->GetZBack()
01610                                   -stRow->GetTotalZ())*fScale);      
01611       fSMZMax[iSM] = TMath::Max(fSMZMax[iSM],(stRow->GetZBack())*fScale);
01612 
01613       // Insert steelplnNode in plane map
01614       fPlaneMap[steelId] = stplnNode;
01615     }
01616     
01617     if ( scplnVolume ) {
01618       // Place the scint plane within the pairVol
01619       Float_t x0pln = (scRow->GetX0RelSteel())*fScale;
01620       Float_t y0pln = (scRow->GetY0RelSteel())*fScale;
01621       Float_t z0pln = pairhalfz + 
01622                       (-stRow->GetTotalZ()+0.5*(scRow->GetThickness()))*fScale;
01623 
01624       // Rotation matrix relative to steel
01625       // (thetax,phix) = (90, 0+zrotrelsteel)
01626       // (thetay,phiy) = (90,90+zrotrelsteel)
01627       // (thetaz,phiz) = ( 0, 0)
01628       Double_t zrotrelsteel = scRow->GetZRotRelSteelDeg();
01629 
01630       MSG("Geo",Msg::kDebug) << "Placing scint pln at " << x0pln << ", "
01631                              << y0pln << "," << z0pln 
01632                              << " zrotrelsteel " << zrotrelsteel << endl;
01633         
01634       TGeoRotation* scRotMatrix = new TGeoRotation(scName.c_str(),90.,
01635                                   zrotrelsteel,90.,90.+zrotrelsteel,0.,0.);
01636       scRotMatrix -> RegisterYourself();
01637       
01638       TGeoCombiTrans* combiMatrix 
01639          = new TGeoCombiTrans(scName.c_str(),x0pln,y0pln,z0pln,scRotMatrix);
01640 
01641       std::string scplnNodeName = scName + "_1";
01642       std::string scintPlnPath = pairPath + "/" + scplnNodeName;
01643       GeoScintPlnNode* scplnNode 
01644           = new GeoScintPlnNode(this,scplnVolume,combiMatrix,pairVol,
01645                                 scintPlnPath,scplnNodeName,scintId);
01646     
01647       this -> BuildModules(ugliDbiTables, scplnNode);
01648 
01649       // Insert scint pln node in plane map
01650       fPlaneMap[scintId] = scplnNode;
01651 
01652     }
01653     
01654   } // end of loop over all plane db rows
01655 
01656   
01657   return;
01658   
01659 }

void GeoGeometry::BuildRotations (  )  [private, virtual]

Definition at line 882 of file GeoGeometry.cxx.

References fRot315, and fRot45.

Referenced by BuildAll().

00882                                  {
00883   // Build commonly used rotation matrices
00884 
00885   // Rotation about the z-axis by +45 degrees
00886   fRot45 = new TGeoRotation("rot45",90,45,90,135,0,0);
00887   fRot45 -> RegisterYourself(); // do this so that it can be found later
00888 
00889 
00890   // Rotation about the z-axis by -45 degrees
00891   fRot315 = new TGeoRotation("rot315",90,315,90,45,0,0);
00892   fRot315 -> RegisterYourself(); // do this so that it can be found later
00893 
00894 }

void GeoGeometry::BuildStrips ( const UgliDbiTables tbl,
GeoScintMdlNode node 
) [private, virtual]

Definition at line 2160 of file GeoGeometry.cxx.

References PlexStripEndId::AsString(), fGeoManager, fScale, UgliDbiTables::fScintMdlStructTbl, UgliDbiTables::GetDbiStripById(), GetGeoCompatibleName(), GeoScintMdlNode::GetPlexScintMdlId(), DbiResultPtr< T >::GetRowByIndex(), UgliDbiStructHash::HashAsScintMdl(), Msg::kDebug, Msg::kFatal, Msg::kVerbose, MSG, and UpdateGlobalManager().

Referenced by BuildModules().

02161                                                         {
02162   // Purpose:: Build this planes's scint strips and add them as nodes to the
02163   // det plane volume
02164   // This method should be moved to GeoScintPlnVolume
02165 
02166   UpdateGlobalManager();
02167   assert(fGeoManager);
02168  
02169   PlexScintMdlId plexModuleId = mdlNode->GetPlexScintMdlId();
02170   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildStrips for module " 
02171                          << mdlNode->GetName() << endl;
02172   
02173   // Determine lo,hi strip in plane
02174   UgliDbiStructHash modulestructhash(plexModuleId);
02175   const UgliDbiScintMdlStruct* scModuleStruct 
02176        = ugliDbiTables.fScintMdlStructTbl
02177         .GetRowByIndex(modulestructhash.HashAsScintMdl());
02178   Int_t lostrip = scModuleStruct -> GetFirstStrip();
02179   Int_t histrip = scModuleStruct -> GetLastStrip();
02180 
02181   for ( int istp = lostrip; istp <= histrip; istp++ ) {
02182     // For each strip in module
02183     PlexStripEndId seid(plexModuleId,istp);
02184     std::string stpName = GetGeoCompatibleName(seid.AsString());
02185 
02186     MSG("Geo",Msg::kVerbose)  << "Strip " << istp << " name " 
02187                               << stpName.c_str() << endl;
02188     const UgliDbiStrip* scStrip = ugliDbiTables.GetDbiStripById(seid);
02189 
02190     // The strip volumes have been pre-built
02191     std::string stpVolName = GetGeoCompatibleName(seid.AsString("s"));
02192     TGeoVolume* stpVol = fGeoManager -> GetVolume(stpVolName.c_str());
02193     if ( !stpVol ) {
02194       MSG("Geo",Msg::kFatal) 
02195          << "Unable to find pre-built stripvol for volume "
02196          << stpName.c_str() << " shape name " 
02197          << stpVolName.c_str() << endl;
02198       abort();
02199     } 
02200 
02201     // Build the node and place it in the plane
02202     Float_t tposStp = (scStrip -> GetTPosRelMdl())*fScale;
02203     Float_t lposStp = (scStrip -> GetLPosRelMdl())*fScale;
02204     Float_t zrotStp = scStrip -> GetZRotRelMdlDeg();
02205     MSG("Geo",Msg::kVerbose) << "tpos, lpos, zrot(deg) rel to module " 
02206                              << tposStp << ", " << lposStp << ", " 
02207                              << zrotStp << endl;
02208 
02209     std::string stpNodeName = stpVolName+"_1";
02210 
02211     TGeoRotation* stpRotMatrix = new TGeoRotation(stpNodeName.c_str(), 90.,
02212                                        zrotStp,90.,90.+zrotStp,0.,0.);
02213     stpRotMatrix -> RegisterYourself();
02214     TGeoCombiTrans* combiMatrix 
02215      = new TGeoCombiTrans(stpNodeName.c_str(),lposStp,tposStp,0.,stpRotMatrix);
02216 
02217     new GeoStripNode(this,stpVol,combiMatrix,mdlNode,stpNodeName,seid);
02218 
02219   }
02220 
02221   return;
02222   
02223 }

void GeoGeometry::BuildStripVolumes ( const VldContext vldc  )  [private, virtual]

Definition at line 2226 of file GeoGeometry.cxx.

References fGeoManager, fScale, VldContext::GetDetector(), GetGeoCompatibleName(), UgliDbiStripStruct::GetLenEastPart(), UgliDbiStripStruct::GetLenWestPart(), DbiResultPtr< T >::GetNumRows(), UgliDbiStripStruct::GetPlaneView(), DbiResultPtr< T >::GetRow(), UgliLoanPool::GetShieldOff(), UgliDbiStripStruct::GetTotalLen(), UgliDbiStripStruct::GetWlsLenBypass(), UgliDbiStripStruct::GetWlsLenEast(), UgliDbiStripStruct::GetWlsLenWest(), UgliLoanPool::Instance(), Detector::kCalDet, Msg::kDebug, Detector::kFar, PlaneView::kU, PlaneView::kV, PlaneView::kX, PlaneView::kY, MSG, and UpdateGlobalManager().

Referenced by BuildPlanePairVolumes().

02226                                                           {
02227   // pre-build set of strip volumes for this vldc.  strip volumes will be 
02228   // placed appropriately in module volumes as nodes when planes are 
02229   // constructed.
02230 
02231   UpdateGlobalManager();
02232 
02233   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildStripVolumes " << endl;
02234   assert(fGeoManager);
02235 
02236   DbiResultPtr<UgliDbiStripStruct> stripTbl(vldc);
02237   Detector::Detector_t dettype = vldc.GetDetector();
02238   
02239   bool shieldOff = UgliLoanPool::Instance()->GetShieldOff();
02240 
02241   for ( unsigned int irow = 0; irow < stripTbl.GetNumRows(); irow++ ) {
02242     const UgliDbiStripStruct* sRow = stripTbl.GetRow(irow);
02243     string stpName = GetGeoCompatibleName(sRow -> GetShapeName());
02244     PlaneView::PlaneView_t plnview = sRow->GetPlaneView();
02245     bool isVetoShield = false;
02246     if ( dettype == Detector::kFar ) {
02247       if ( plnview != PlaneView::kU && plnview != PlaneView::kV ) 
02248         isVetoShield = true;
02249     }
02250     else if ( dettype == Detector::kCalDet ) {
02251       if ( plnview != PlaneView::kX && plnview != PlaneView::kY )
02252         isVetoShield = true;
02253     }
02254 
02255     if ( shieldOff && isVetoShield ) continue;
02256     
02257     // Volumes will self-register with fGeoManager
02258     Float_t totallen = (sRow->GetTotalLen())*fScale;
02259     Float_t leneastpart = (sRow->GetLenEastPart())*fScale;
02260     Float_t lenwestpart = (sRow->GetLenWestPart())*fScale;
02261     // Clean up some caldet database crud
02262     if ( totallen < 1.E-4*fScale ) continue;
02263     if ( leneastpart < 1.E-4*fScale ) leneastpart = totallen;
02264     if ( lenwestpart < 1.E-4*fScale ) lenwestpart = totallen;
02265     
02266     new GeoStripVolume(this,stpName.c_str(),totallen,leneastpart,lenwestpart,
02267                                        (sRow->GetWlsLenEast())*fScale, 
02268                                        (sRow->GetWlsLenWest())*fScale, 
02269                                        (sRow->GetWlsLenBypass())*fScale,
02270                                        isVetoShield);
02271   } 
02272 
02273 }

void GeoGeometry::BuildVldRange ( const VldContext vldc  )  [private, virtual]

Definition at line 811 of file GeoGeometry.cxx.

References det, Detector::FullMask(), fVldRange, VldTimeStamp::GetBOT(), VldContext::GetDetector(), VldTimeStamp::GetEOT(), VldContext::GetSimFlag(), DbiResultPtr< T >::GetValidityRec(), Msg::kDebug, Detector::kUnknown, MSG, TrimVldRange(), and UpdateGlobalManager().

Referenced by BuildAll().

00811                                                       {
00812   // Private. Build VldRange from VldContext
00813 
00814   UpdateGlobalManager();
00815 
00816   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildVldRange for VldContext " 
00817                          << vldc << endl;
00818   
00819   Detector::Detector_t det = vldc.GetDetector();
00820   bool isunknown = (Detector::kUnknown == det);
00821   const char* src = "DBI";
00822   Int_t detmask = Detector::FullMask();
00823   Int_t simmask = SimFlag::FullMask();
00824   if ( isunknown ) { 
00825     src = "Fake (unknown detector)";
00826     detmask = det;
00827     simmask = vldc.GetSimFlag();
00828   }
00829   
00830   // Start the VldRange covering all of time and then trim it down
00831   VldTimeStamp starttime = VldTimeStamp::GetBOT();
00832   VldTimeStamp endtime = VldTimeStamp::GetEOT();
00833   fVldRange = VldRange(detmask,simmask,starttime,endtime,src);
00834 
00835   // special return for unknown detector
00836   if (isunknown) return;
00837 
00838   DbiResultPtr<UgliDbiSteelPln> steelTbl(vldc);
00839   TrimVldRange("UgliDbiSteelPln",steelTbl.GetValidityRec());
00840 
00841   DbiResultPtr<UgliDbiScintPlnStruct> scintStructTbl(vldc);
00842   TrimVldRange("UgliDbiScintPlnStruct",scintStructTbl.GetValidityRec());
00843 
00844   DbiResultPtr<UgliDbiScintPln> scintTbl(vldc);
00845   TrimVldRange("UgliDbiScintPln",scintTbl.GetValidityRec());
00846 
00847   DbiResultPtr<UgliDbiScintMdlStruct> mdlStructTbl(vldc);
00848   TrimVldRange("UgliDbiScintMdlStruct",mdlStructTbl.GetValidityRec());
00849 
00850   DbiResultPtr<UgliDbiScintMdl> mdlTbl(vldc);
00851   TrimVldRange("UgliDbiScintMdl",mdlTbl.GetValidityRec());
00852 
00853   DbiResultPtr<UgliDbiStripStruct> stripStructTbl(vldc);
00854   TrimVldRange("UgliDbiStripStruct",stripStructTbl.GetValidityRec());
00855 
00856   DbiResultPtr<UgliDbiStrip> stripTbl(vldc);
00857   TrimVldRange("UgliDbiStrip",stripTbl.GetValidityRec());
00858   
00859   MSG("Geo",Msg::kDebug) << "GeoGeometry::BuildVldRange built VldRange " 
00860                          << fVldRange << endl;
00861   
00862 }

void GeoGeometry::Draw ( Option_t *  volname = ""  )  [virtual]

Definition at line 157 of file GeoGeometry.cxx.

References fGeoManager, Msg::kInfo, Msg::kWarning, MSG, and UpdateGlobalManager().

Referenced by UgliGeomHandle::Draw().

00157                                         {
00158   // Public. Draw this geometry from volume volname (default "HALL")
00159 
00160   UpdateGlobalManager();
00161 
00162   std::string volnamestr(volname);
00163   if (volnamestr.empty()) volnamestr = "HALL"; 
00164    
00165   MSG("Geo",Msg::kInfo) << "GeoGeometry::Draw() from top volume " 
00166                         << volnamestr.empty() << "." << endl;
00167 
00168   if ( !fGeoManager ) {
00169     MSG("Geo",Msg::kWarning) << "Null fGeoManager" << endl;
00170     return;
00171   }
00172   
00173   TGeoVolume* topVol = fGeoManager -> GetVolume(volnamestr.c_str());
00174   if ( !topVol ) {
00175     MSG("Geo",Msg::kWarning) << "No volume of name " << volnamestr.c_str() 
00176                              << endl;
00177     return;
00178   }
00179   //fGeoManager->SetTopVisible();
00180   topVol -> SetVisContainers();
00181   topVol -> Draw();
00182    
00183 }

void GeoGeometry::DumpVolume ( std::string  volname,
std::string  preface = "" 
) const [virtual]

Definition at line 186 of file GeoGeometry.cxx.

References fGeoManager, and UpdateGlobalManager().

Referenced by Print().

00186                                                                        {
00187   // Print information about volume down through all daughter nodes
00188 
00189   UpdateGlobalManager();
00190 
00191   TGeoVolume* volume = fGeoManager->GetVolume(volname.c_str());
00192   if ( !volume ) {
00193     cout << "No volume of name \"" << volname.c_str() << "\"!" << endl;
00194     return;
00195   }
00196   
00197   cout << preface.c_str() << "Volume " << volume->GetName() << ", shape:" 
00198        << endl;
00199   cout << preface.c_str();
00200   volume->GetShape()->InspectShape();
00201   
00202   Int_t ndaughter = volume -> GetNdaughters();
00203   if ( ndaughter > 0 ) 
00204     cout << preface.c_str() << ndaughter << " daughter nodes:" << endl;
00205   else
00206     cout << preface.c_str() << "No daughter nodes." << endl;
00207   
00208   for ( int id = 0; id < ndaughter; id++ ) {
00209     TGeoNode* daughternode = volume->GetNode(id);
00210     cout << preface.c_str() << "  " << id << ")" << daughternode->GetName() 
00211          << endl;
00212     cout << preface.c_str() << "  ";
00213     daughternode->GetMatrix()->Print();
00214     TGeoVolume* daughtervol = daughternode->GetVolume();
00215     this -> DumpVolume(daughtervol->GetName(),preface+"  ");
00216   }
00217   
00218 }

Geo::EAppType GeoGeometry::GetAppType (  )  const [inline]
std::string GeoGeometry::GetGeoCompatibleName ( std::string  name  )  [static]

Definition at line 221 of file GeoGeometry.cxx.

Referenced by GeoScintMdlVolume::Build4Corners(), BuildDetector(), BuildModules(), GeoScintMdlVolume::BuildNearIXtru(), GeoScintMdlVolume::BuildNeariXtru(), BuildPlanePairVolumes(), BuildStrips(), BuildStripVolumes(), and GeoScintMdlVolume::GeoScintMdlVolume().

00221                                                           {
00222   // Public Static method to return acceptable node or volume name
00223   // Symbol "/" is replaced with "f" to avoid conflict with "/" used in paths
00224   // Symbol "-" is replaced with "h" to avoid conflict with "-" used in
00225   // composite shapes. 
00226 
00227   std::string okayname = name;
00228   // Name cannot include "/" because of ambiguity with "/" used in
00229   // path to nodes. Replace "/" with "f".
00230   size_t ipos = okayname.find("/");
00231   while ( ipos != std::string::npos ) {
00232     okayname.replace(ipos,1,"f");
00233     ipos = okayname.find("/");
00234   }
00235 
00236   // Name cannot include "-" because of ambiguity with "-" used in
00237   // composite shapes. Replace "-" with "h".
00238   ipos = okayname.find("-");
00239   while ( ipos != std::string::npos ) {
00240     okayname.replace(ipos,1,"h");
00241     ipos = okayname.find("-");
00242   }
00243   
00244   return okayname; 
00245 }

virtual TVector3 GeoGeometry::GetHallExtentMax (  )  const [inline, virtual]

Definition at line 72 of file GeoGeometry.h.

References fHallMax.

Referenced by UgliGeomHandle::GetHallExtentMax().

00072 { return fHallMax; }

virtual TVector3 GeoGeometry::GetHallExtentMin (  )  const [inline, virtual]

Definition at line 71 of file GeoGeometry.h.

References fHallMin.

Referenced by UgliGeomHandle::GetHallExtentMin().

00071 { return fHallMin; }

TGeoMedium * GeoGeometry::GetMedium ( const char *  name  )  const

Definition at line 643 of file GeoGeometry.cxx.

References fGeoManager, Msg::kFatal, medium, MSG, and UpdateGlobalManager().

Referenced by SwitchMedia().

00643                                                          {
00644   // Public. Purpose:: Return ptr to medium of given name.  If geometry
00645   // is not closed, such that this method is being called during the
00646   // geometry build stage, will abort with fatal message if no medium
00647   // of given name is found.  Otherwise, will return null ptr if
00648   // medium not found.
00649   //  
00650 
00651   UpdateGlobalManager();
00652 
00653   TGeoMedium* medium = fGeoManager->GetMedium(name);
00654   if ( !medium && !(fGeoManager->IsClosed()) ) {
00655     MSG("Geo",Msg::kFatal) << "GeoGeometry::GetMedium did not find medium\n"
00656                            << name << " during geometry build stage. Abort."
00657                            << endl;
00658     abort();
00659   }
00660   
00661   return medium;
00662 
00663 }

virtual const GeoMediumMap& GeoGeometry::GetMediumMap (  )  const [inline, virtual]
GeoSteelPlnNode * GeoGeometry::GetNearestSteelPlnNode ( Double_t  z  )  const [virtual]

Definition at line 277 of file GeoGeometry.cxx.

References fGeoManager, GetSteelPlnNodeMap(), Msg::kDebug, MSG, and UpdateGlobalManager().

00277                                                                      {
00278   // Public. Purpose:: Retrieve the nearest steel node for a given z
00279 
00280   UpdateGlobalManager();
00281 
00282   MSG("Geo",Msg::kDebug) << "GeoGeometry::GetNearestSteelPlnNode to z " 
00283                          << z << "." << endl;
00284   assert(fGeoManager);
00285 
00286   const std::map<Float_t,GeoSteelPlnNode*>& stnodemap = GetSteelPlnNodeMap();
00287 
00288   // Steel planes in map are all in main detector block
00289   // Ordering of planes is lo to hi
00290   std::map<Float_t,GeoSteelPlnNode*>::const_iterator steelplnItr;
00291   
00292   // Lower bound returns steel plane with z value greater than or equal to key
00293   steelplnItr = stnodemap.lower_bound(z);
00294   GeoSteelPlnNode* loplnNode = 0;
00295   Double_t         loplnz0   = -9999.;
00296   GeoSteelPlnNode* hiplnNode = 0;
00297   Double_t         hiplnz0   = -9999.;
00298   if ( steelplnItr != stnodemap.end() ) {
00299     hiplnNode = steelplnItr->second;
00300     hiplnz0   = steelplnItr->first;
00301   }
00302   if ( steelplnItr != stnodemap.begin() ) {
00303     steelplnItr--;
00304     loplnNode = steelplnItr->second;
00305     loplnz0   = steelplnItr->first;
00306   }
00307   if ( hiplnNode == 0 ) return loplnNode;
00308   else if ( loplnNode == 0 ) return hiplnNode;
00309   
00310   // Bracketed by two planes, determine which is closer
00311   // avoid additional (slow) coordinate transformations by using
00312   // information stored in the map
00313   return ( TMath::Abs(z-loplnz0) < TMath::Abs(z-hiplnz0) ) ? loplnNode : hiplnNode;
00314 
00315 
00316 }

PlexPlaneId GeoGeometry::GetPlaneIdFromZ ( Double_t  z  )  const [virtual]

Definition at line 319 of file GeoGeometry.cxx.

References fGeoManager, fPlaneMap, GeoNode::GlobalToLocal(), Msg::kDebug, MSG, Munits::second, and UpdateGlobalManager().

Referenced by UgliGeomHandle::GetPlaneIdFromZ().

00319                                                          {
00320   // Purpose:: Retrieve detector plane corresponding to the first
00321   // plane in the main detector block with a back face (high-z side)
00322   // "downstream" of z (greater than z).  The exception is that if z 
00323   // is greater than back face of highest-z plane in detector, return 
00324   // plexplaneid of last plane, even though this plane's high-z face is 
00325   // not downstream of z.  This behavior is that used in UgliGeometry. 
00326   // Use PlexPlaneId::IsValid() to determine validity of returned PlexPlaneId.
00327   // Will only return invalid plexplaneid if no planes in main detector
00328   // block.  
00329  
00330   UpdateGlobalManager();
00331   
00332   MSG("Geo",Msg::kDebug) << "GeoGeometry::GetPlaneIdFromZ " << z << "."<< endl;
00333   assert(fGeoManager);
00334 
00335   PlexPlaneId defplex;  // default plex is invalid
00336   
00337   PlaneMapConstItr plnItr;
00338   // Move through the plane map from low to high z
00339   Double_t xyz_global[3] = {0,0,z};
00340   Double_t xyz_local[3] = {0};
00341       
00342   // fPlaneMap has scint & steel planes 
00343   for ( plnItr = fPlaneMap.begin();  plnItr != fPlaneMap.end(); ++plnItr) {
00344     if ( (plnItr->first).IsVetoShield() ) continue; // No shield
00345     GeoPlnNode* plnNode = dynamic_cast<GeoPlnNode*>(plnItr -> second);
00346     plnNode->GlobalToLocal(xyz_global,xyz_local);
00347     Float_t dz  = dynamic_cast<TGeoBBox*>(plnNode->GetVolume()->GetShape())
00348                   ->GetDZ();
00349     if ( xyz_local[2] < dz ) {
00350       return plnItr->first;
00351     }
00352     defplex = plnItr->first; // default plex is highest-z pln in main block
00353   }
00354 
00355   return defplex;
00356 
00357 }

const vector< GeoPlnNode * > & GeoGeometry::GetPlnNodePtrVector (  )  const

Definition at line 360 of file GeoGeometry.cxx.

References fPlaneMap, fPlnNodes, Msg::kDebug, MSG, and UpdateGlobalManager().

Referenced by UgliGeomHandle::GetPlnHandleVector().

00360                                                                   {
00361   // Public. Purpose:: Return collection of ptrs for all pln nodes in detector
00362 
00363   MSG("Geo",Msg::kDebug) << "GetPlnNodePtrVector" << endl;
00364 
00365   UpdateGlobalManager();
00366 
00367   if ( fPlnNodes.empty() ) {
00368     PlaneMapConstItr plnItr;
00369     for ( plnItr = fPlaneMap.begin(); plnItr != fPlaneMap.end(); ++plnItr) {
00370       GeoPlnNode* plnNode = plnItr->second;
00371       fPlnNodes.push_back(plnNode);
00372     }
00373   }
00374   
00375   return fPlnNodes;
00376 
00377 }

TGeoRotation* GeoGeometry::GetRot315 (  )  const [inline]

Definition at line 106 of file GeoGeometry.h.

References fRot315.

Referenced by GeoScintPlnVolume::AddCoilNode(), and BuildNearCoil().

00106 { return fRot315; }

TGeoRotation* GeoGeometry::GetRot45 (  )  const [inline]

Definition at line 105 of file GeoGeometry.h.

References fRot45.

Referenced by GeoScintPlnVolume::AddCoilNode(), GeoSteelPlnVolume::AddCoilNode(), BuildNearCoil(), and BuildPlanePairVolumes().

00105 { return fRot45; } 

GeoScintPlnNode * GeoGeometry::GetScintPlnNode ( PlexPlaneId  planeId  )  const [virtual]

Definition at line 380 of file GeoGeometry.cxx.

References PlexPlaneId::AsString(), fPlaneMap, PlexPlaneId::IsSteel(), Msg::kDebug, Msg::kWarning, MSG, and UpdateGlobalManager().

Referenced by UgliGeomHandle::GetScintPlnHandle(), and GetStripNode().

00380                                                                        {
00381   // Public. Purpose:: Retrieve the node for a particular plane
00382 
00383   MSG("Geo",Msg::kDebug) << "GetScintPlnNode for plane " << planeid.AsString() 
00384                          << endl;
00385 
00386   UpdateGlobalManager();
00387 
00388   GeoScintPlnNode* plnnode = 0;
00389   if ( planeid.IsSteel() ) {
00390     MSG("Geo",Msg::kWarning) 
00391       << "GetScintPlnNode called with steel plane id " 
00392       << planeid.AsString() << endl;
00393     return 0;
00394   }
00395   
00396   PlaneMapConstItr citr = fPlaneMap.find(planeid);
00397   if ( citr != fPlaneMap.end() ) {
00398     plnnode = dynamic_cast<GeoScintPlnNode*>(citr->second);
00399   }
00400   
00401   return plnnode;
00402 
00403 }

const vector< GeoScintPlnNode * > & GeoGeometry::GetScintPlnNodePtrVector (  )  const

Definition at line 406 of file GeoGeometry.cxx.

References fPlaneMap, fScintPlnNodes, Msg::kDebug, MSG, and UpdateGlobalManager().

Referenced by UgliGeomHandle::GetScintPlnHandleVector().

00406                                                                             {
00407   // Purpose:: Return collection of ptrs for all scint pln nodes in detector
00408 
00409   MSG("Geo",Msg::kDebug) << "GetScintPlnNodePtrVector" << endl;
00410 
00411   UpdateGlobalManager();
00412 
00413   if ( fScintPlnNodes.empty() ) {
00414     PlaneMapConstItr plnItr;
00415     for ( plnItr = fPlaneMap.begin(); plnItr != fPlaneMap.end(); ++plnItr ){
00416       if ( !(plnItr->first).IsSteel() ) {
00417         fScintPlnNodes.push_back(
00418                               dynamic_cast<GeoScintPlnNode*>(plnItr->second));
00419       }
00420     }
00421   }
00422 
00423   return fScintPlnNodes;
00424 
00425 }

Int_t GeoGeometry::GetSMPlaneLimits ( const VldContext vldc,
Int_t *  plnMin,
Int_t *  plnMax 
) [private]

Definition at line 1662 of file GeoGeometry.cxx.

References bfld::AsString(), VldContext::GetDetector(), Detector::kCalDet, Msg::kError, Detector::kFar, Detector::kNear, and MSG.

Referenced by BuildDetector(), and BuildPlanePairVolumes().

01663                                                                   {
01664   // Private, but could be public?
01665   // Determine Super Module plane limits for specified vldc.  
01666   // Returns number of super modules.  plnMin/Max[0] is filled for
01667   // supermodule 0 and plnMin/Max[1] for supermodule 1 if applicable.
01668 
01669   Detector::Detector_t dettype = vldc.GetDetector();
01670   Int_t nSM = 0;
01671   switch (dettype) {
01672   case Detector::kFar: 
01673     nSM = 2;
01674     plnMin[0] = 0;
01675     plnMax[0] = 248;
01676     plnMin[1] = 249;
01677     plnMax[1] = 485;
01678     break;
01679   case Detector::kNear:
01680     nSM = 1;
01681     plnMin[0] = 0;
01682     plnMax[0] = 281;
01683     break;
01684   case Detector::kCalDet:
01685     nSM = 1;
01686     plnMin[0] = 0;
01687     plnMax[0] = 60; // main detector block, 61-64 on floor
01688     break;
01689   default:
01690     MSG("Geo",Msg::kError) 
01691     << "GetSMPlaneLimits failed for unknown detector type\n"
01692     << Detector::AsString(dettype) << "." << endl;
01693   } // end of switch
01694 
01695   return nSM;
01696   
01697 }

GeoSteelPlnNode * GeoGeometry::GetSteelPlnNode ( PlexPlaneId  planeId  )  const [virtual]

Definition at line 428 of file GeoGeometry.cxx.

References PlexPlaneId::AsString(), fPlaneMap, PlexPlaneId::IsSteel(), Msg::kDebug, Msg::kWarning, MSG, and UpdateGlobalManager().

Referenced by UgliGeomHandle::GetSteelPlnHandle().

00428                                                                        {
00429   // Public. Purpose:: Retrieve the node for a particular plane
00430 
00431   MSG("Geo",Msg::kDebug) << "GetSteelPlnNode for plane " << planeid.AsString() 
00432                          << endl;
00433 
00434   UpdateGlobalManager();
00435 
00436   GeoSteelPlnNode* plnnode = 0;
00437   if ( !planeid.IsSteel() ) {
00438     MSG("Geo",Msg::kWarning) 
00439       << "GetSteelPlnNode called with non steel plane id " 
00440       << planeid.AsString() << endl;
00441     return 0;
00442   }
00443   
00444   PlaneMapConstItr citr = fPlaneMap.find(planeid);
00445   if ( citr != fPlaneMap.end() ) {
00446     plnnode = dynamic_cast<GeoSteelPlnNode*>(citr->second);
00447   }
00448   
00449   return plnnode;
00450 
00451 }

const std::map< Float_t, GeoSteelPlnNode * > & GeoGeometry::GetSteelPlnNodeMap (  )  const

Definition at line 477 of file GeoGeometry.cxx.

References fPlaneMap, fSteelPlnNodeMap, Msg::kDebug, MSG, and UpdateGlobalManager().

Referenced by GetNearestSteelPlnNode().

00478                                                                            {
00479   // Public. Purpose:: Return collection of ptrs for all steel pln nodes 
00480   // in main body of detector, key'ed by z-position. 
00481 
00482   MSG("Geo",Msg::kDebug) << "GetSteelPlnNodeMap" << endl;
00483 
00484   UpdateGlobalManager();
00485   
00486   if ( fSteelPlnNodeMap.empty() ) {
00487     PlaneMapConstItr plnItr;
00488     for ( plnItr = fPlaneMap.begin(); plnItr != fPlaneMap.end(); plnItr++ ){
00489       if ( (plnItr->first).IsSteel() && !(plnItr->first).IsVetoShield()) {
00490         fSteelPlnNodeMap.insert(make_pair(plnItr->second->GetZ0(),
00491                              dynamic_cast<GeoSteelPlnNode*>(plnItr->second)));
00492       }
00493     }
00494   }
00495   
00496   return fSteelPlnNodeMap;
00497 
00498 }

const vector< GeoSteelPlnNode * > & GeoGeometry::GetSteelPlnNodePtrVector (  )  const

Definition at line 454 of file GeoGeometry.cxx.

References fPlaneMap, fSteelPlnNodes, Msg::kDebug, MSG, and UpdateGlobalManager().

Referenced by UgliGeomHandle::GetSteelPlnHandleVector().

00454                                                                             {
00455   // Public. Purpose:: Return collection of ptrs for all steel pln nodes 
00456   // in detector
00457 
00458   MSG("Geo",Msg::kDebug) << "GetSteelPlnNodePtrVector" << endl;
00459 
00460   UpdateGlobalManager();
00461 
00462   if ( fSteelPlnNodes.empty() ) {
00463     PlaneMapConstItr plnItr;
00464     for ( plnItr = fPlaneMap.begin(); plnItr != fPlaneMap.end(); ++plnItr ){
00465       if ( (plnItr->first).IsSteel() ) {
00466         fSteelPlnNodes.push_back(
00467                               dynamic_cast<GeoSteelPlnNode*>(plnItr->second));
00468       }
00469     }
00470   }
00471   
00472   return fSteelPlnNodes;
00473 
00474 }

GeoStripNode * GeoGeometry::GetStripNode ( const PlexStripEndId seid  )  const [virtual]

Definition at line 501 of file GeoGeometry.cxx.

References PlexStripEndId::AsString(), GetScintPlnNode(), Msg::kDebug, MSG, and UpdateGlobalManager().

Referenced by GeoStripNode::DistanceAlong(), UgliGeomHandle::GetStripHandle(), and GeoStripNode::Intersection().

00501                                                                         {
00502   // Public. Purpose:: Retrieve the node for a particular strip
00503  
00504   MSG("Geo",Msg::kDebug) << "GetStripNode for strip "  << seid.AsString() 
00505                          << endl;
00506 
00507   UpdateGlobalManager();
00508 
00509   GeoStripNode* stripnode = 0;
00510 
00511   // Retrieve the plane node and then the strip node
00512   GeoScintPlnNode* planenode = this -> GetScintPlnNode(seid);
00513   if ( planenode ) {
00514     stripnode = planenode -> GetStripNode(seid);
00515   }
00516 
00517   return stripnode;
00518 
00519 }

void GeoGeometry::GetTransverseExtent ( PlaneView::PlaneView_t  view,
Double_t &  tmin,
Double_t &  tmax 
) const [virtual]

Definition at line 522 of file GeoGeometry.cxx.

References bfld::AsString(), fScale, fVldRange, VldRange::GetDetectorMask(), Detector::kCalib, Msg::kDebug, Msg::kError, Detector::kFar, Detector::kNear, Geo::kStripWidth, PlaneView::kU, PlaneView::kV, MSG, and UpdateGlobalManager().

00523                                                                             {
00524   // Public. Purpose: Retrieve transverse extent of detector
00525   // based on detector type and form.  These values are currently hardwired
00526   // as in UgliGeometry::GetTransverseExtent
00527 
00528   MSG("Geo",Msg::kDebug) << "GetTransverseExtent for view "  
00529                          << PlaneView::AsString(view) << endl;
00530 
00531   UpdateGlobalManager();
00532 
00533   tmin = -999; tmax=-999;
00534 
00535   Detector::Detector_t detector 
00536     = (Detector::Detector_t)fVldRange.GetDetectorMask();
00537   
00538   switch (detector) {
00539   case Detector::kNear:
00540     switch (view ) {
00541     case PlaneView::kU:
00542       tmin = -2.10 * fScale;
00543       tmax = +2.75 * fScale;
00544       break;
00545     case PlaneView::kV:
00546       tmin = -2.75 * fScale;
00547       tmax = +2.10 * fScale;
00548       break;
00549     default:
00550       MSG("Geo",Msg::kError)
00551         << "GeoGeometry::GetTransverseExtent undefined for "
00552         << Detector::AsString(detector) << " view "
00553         << PlaneView::AsString(view) << endl;
00554       break;
00555     }
00556   case Detector::kFar:
00557     tmin = -4.0 * fScale;
00558     tmax = +4.0 * fScale;
00559     break;
00560   case Detector::kCalib:
00561     tmin = -0.5 * fScale;
00562     tmax = +0.5 * fScale;
00563     break;
00564   default:
00565     MSG("Geo",Msg::kError) 
00566       << "GeoGeometry::GetTransverseExtent undefined for "
00567       << Detector::AsString(detector) << endl;
00568     break;
00569   }
00570 
00571   Float_t fuzz = 0.5*Geo::kStripWidth*fScale;
00572   tmin = tmin - fuzz;
00573   tmax = tmax + fuzz;
00574   
00575   return;
00576     
00577 }

void GeoGeometry::GetTransverseExtent ( PlaneView::PlaneView_t  view,
Float_t &  tmin,
Float_t &  tmax 
) const [virtual]

Definition at line 580 of file GeoGeometry.cxx.

References UpdateGlobalManager().

Referenced by UgliGeomHandle::GetTransverseExtent().

00581                                                                           {
00582   // Public. Purpose: Retrieve transverse extent of detector in global (MARS)
00583   // coordinates.
00584 
00585   UpdateGlobalManager();
00586   
00587   Double_t tmind,tmaxd;
00588   GetTransverseExtent(view,tmind,tmaxd);
00589   tmin = (Float_t)tmind;
00590   tmax = (Float_t)tmaxd;
00591 
00592   return;
00593     
00594 }

virtual const VldRange& GeoGeometry::GetVldRange (  )  const [inline, virtual]

Definition at line 93 of file GeoGeometry.h.

References fVldRange.

Referenced by UgliGeomHandle::GetVldRange().

00093 { return fVldRange; }

void GeoGeometry::GetZExtent ( Double_t &  zmin,
Double_t &  zmax,
Int_t  isup = -1 
) const [virtual]

Definition at line 597 of file GeoGeometry.cxx.

References fSMZMax, fSMZMin, Msg::kDebug, Msg::kWarning, MSG, and UpdateGlobalManager().

00597                                                                             {
00598   // Public. Purpose: Retrieve zextent of specified isup supermodule in MARS
00599   // coordinates. If isup = -1 (default), returns zextent of entire detector.
00600  
00601   MSG("Geo",Msg::kDebug) << "GetZExtent for isup "  << isup << endl;
00602 
00603   UpdateGlobalManager();
00604  
00605   // The boundaries are calculated during geometry build 
00606   zmax =-999999;
00607   zmin =+999999; 
00608   if ( isup < 0 ) {
00609     zmin = fSMZMin[0];
00610     if ( fSMZMax[1] > 0 ) zmax = fSMZMax[1];
00611     else zmax = fSMZMax[0];
00612   }
00613   else if ( isup < 2 ) {
00614     zmin = fSMZMin[isup];
00615     zmax = fSMZMax[isup];
00616   }
00617   else {
00618     MSG("Geo",Msg::kWarning) << "GetZExtent failed. SuperModule "
00619                              << isup << " undefined." << endl;
00620   }
00621 
00622   return;
00623   
00624    
00625 }

void GeoGeometry::GetZExtent ( Float_t &  zmin,
Float_t &  zmax,
Int_t  isup = -1 
) const [virtual]

Definition at line 628 of file GeoGeometry.cxx.

References UpdateGlobalManager().

Referenced by BuildFarCoil(), BuildNearCoil(), and UgliGeomHandle::GetZExtent().

00628                                                                            {
00629   // Public. Purpose:: Retrieve zextent of specified isup supermodule. If 
00630   // isup = -1 (default), returns zextent of entire detector.
00631 
00632   UpdateGlobalManager();
00633   
00634   Double_t zmind,zmaxd;
00635   GetZExtent(zmind,zmaxd,isup);
00636   zmin = (Float_t)zmind;
00637   zmax = (Float_t)zmaxd;
00638 
00639   return;
00640 }

bool GeoGeometry::IsAlgorithmic (  )  const [inline]

Definition at line 66 of file GeoGeometry.h.

Referenced by UgliGeomHandle::IsAlgorithmic().

00066 { return false; }

bool GeoGeometry::IsCompatible ( const VldContext vldc,
Geo::EAppType  apptype 
) const

Definition at line 666 of file GeoGeometry.cxx.

References fAppType, fVldRange, VldRange::IsCompatible(), and UpdateGlobalManager().

Referenced by UgliLoanPool::GetExistingGeoGeometry().

00667                                                           {
00668   // Public. Test if vldc and apptype are in range of this geometry
00669 
00670   UpdateGlobalManager();
00671 
00672   bool iscompatible = false;
00673   if ( fVldRange.IsCompatible(vldc) && fAppType == apptype ) 
00674                                              iscompatible = true;
00675   return iscompatible; 
00676 }

bool GeoGeometry::IsFrozen (  )  const [inline]
void GeoGeometry::ls ( Option_t *  option = ""  )  const [virtual]

Definition at line 679 of file GeoGeometry.cxx.

References fGeoManager, GetMediumMap(), medium, Print(), GeoMediumMap::Print(), PrintHeader(), and UpdateGlobalManager().

Referenced by UgliGeomHandle::ls().

00679                                            {
00680   // Public. list components of this geometry
00681   // Argument: option string is a concatenated list of char options, where:
00682   //           "m" => print list materials
00683   //           "M" => print list of media.  Default won't print swim media
00684   //                  Override with configopt == "a", e.g. ls("Ma").
00685   //           "d" => print MediumMap detector components and associated 
00686   //                  mediums and swim methods 
00687   //           "v" => print list of volumes 
00688   //           "a" => configuration option "all".  If present, may toggle
00689   //                  on a greater dump of information.
00690   // Example: An option argument to specify listing of materials and mediums
00691   //          is "mM"
00692 
00693   UpdateGlobalManager();
00694   PrintHeader();
00695 
00696   TString opt = option;
00697   bool isAll = false;
00698   if ( opt.Contains("a") ) isAll = true;
00699   
00700   if (opt.Contains("m")) {
00701     // Can't use ls() for TGeoMaterial because not supported
00702     fGeoManager->GetListOfMaterials()->Print(); 
00703   }
00704   if (opt.Contains("M")) {
00705     // Can't use ls() or Print() for TGeoMedium because not supported
00706     GeoMedium::PrintHeader();  // print media table header
00707     TIter medItr(fGeoManager->GetListOfMedia());
00708     GeoMedium* medium = 0;  
00709     while ( ( medium = dynamic_cast<GeoMedium*>(medItr()) ) ) {
00710       if ( !isAll ) {
00711         std::string medName = medium->GetName();
00712         if ( medName.find("_SWIM") != std::string::npos ) continue;
00713       }
00714       medium -> Print();
00715     }
00716   }
00717   if (opt.Contains("d")) {
00718     // Print list of detector components and associated mediums and
00719     // swim methods
00720     GetMediumMap().Print();
00721   }
00722   if (opt.Contains("v")) {
00723     // Print list of volumes in this geometry
00724     TIter volItr(fGeoManager->GetListOfUVolumes());
00725     TGeoVolume* volume = 0;
00726     while ( ( volume = dynamic_cast<TGeoVolume*>(volItr()) ) ) {
00727       cout << setiosflags(ios::left) << setw(30) << volume->GetName() 
00728            << setw(30) << volume->GetMedium()->GetName()
00729            << endl;
00730     }
00731   }    
00732   
00733 }

void GeoGeometry::Print ( Option_t *  option = ""  )  const [virtual]

Definition at line 736 of file GeoGeometry.cxx.

References DumpVolume(), PrintHeader(), and UpdateGlobalManager().

Referenced by ls(), UgliGeomHandle::Print(), and UgliLoanPool::Print().

00736                                               {
00737    // Public. Print something about this geometry (name + vldrange)
00738 
00739   UpdateGlobalManager();
00740 
00741   std::string stoption(option);
00742   if (stoption != "") DumpVolume(stoption);
00743   PrintHeader();
00744   
00745 }

void GeoGeometry::PrintHeader ( Option_t *  option = ""  )  const [virtual]

Definition at line 748 of file GeoGeometry.cxx.

References VldRange::AsString(), GeoRefCnt::CountRef(), fGeoManager, and fVldRange.

Referenced by ls(), and Print().

00748                                                           {
00749   // Print header info (name + vldrange) about this geometry.
00750 
00751   cout << "GeoGeometry " << fGeoManager->GetName() << " " 
00752        << fGeoManager->GetTitle() << endl;
00753   cout << "Has " << CountRef() << " reference" << ((CountRef()==1)?"":"s")
00754        << " VldRange:" << fVldRange.AsString("acs-") << endl;
00755   
00756 }

void GeoGeometry::SwitchMedia ( bool  toswim  )  [virtual]

Definition at line 759 of file GeoGeometry.cxx.

References fGeoManager, fIsSwimMedia, and GetMedium().

00759                                          {
00760   // Method to geometry to/from swim media to default media
00761   // Swim media are used during GeoSwimmer particle transport and
00762   // have a different set of physics process flags/energy threshold
00763   // cuts assigned to them when used with a concrete VMC.
00764 
00765   Int_t ntoadd = 0;
00766   Int_t nmedia = fGeoManager->GetListOfMedia()->GetSize();
00767   if ( toswim ) {
00768     if ( fIsSwimMedia ) return;  // already set up for swim media
00769     ntoadd = nmedia/2 - 1; // number to add to current medId to get swim twin  
00770   }
00771   else {
00772     if ( !fIsSwimMedia ) return; // already set up for default media
00773     ntoadd = -nmedia/2 - 1; // number to add to current medId to get def twin
00774   }
00775   
00776   TIter nextvol(fGeoManager->GetListOfVolumes());
00777   TGeoVolume* vol = 0;
00778   while ( ( vol = (TGeoVolume*)nextvol() ) ) {
00779     TGeoMedium* currentMed = vol -> GetMedium();
00780     Int_t twinMedId = currentMed->GetId() + ntoadd;
00781     TGeoMedium* twinMed = (TGeoMedium*)
00782                      (fGeoManager->GetListOfMedia()->At(twinMedId));
00783     vol -> SetMedium(twinMed);
00784   }
00785 
00786   fIsSwimMedia = toswim;
00787 
00788 }

int GeoGeometry::Time2MinervaVersion ( const VldTimeStamp vts  )  const [private, virtual]

Definition at line 1394 of file GeoGeometry.cxx.

References VldTimeStamp::AsString(), Msg::kInfo, and MSG.

Referenced by BuildGeometry().

01394                                                                    {
01395   // Private.  Translate a timestamp into a version number for Minerva
01396   int mversion = 0;
01397   // decisions go here!
01398 
01399   MSG("Geo",Msg::kInfo) << "GeoGeometry " << vts.AsString("c") 
01400                         << " translates to version " << mversion << endl;
01401   return mversion;
01402 
01403 }

void GeoGeometry::TrimVldRange ( const char *  tblName = "",
const DbiValidityRec dbivrec = 0 
) [private, virtual]

Definition at line 865 of file GeoGeometry.cxx.

References fVldRange, DbiValidityRec::GetVldRange(), Msg::kWarning, MSG, VldRange::TrimTo(), and UpdateGlobalManager().

Referenced by BuildVldRange().

00866                                                               {
00867   // Private. Trim VldRange based on DbiValidityRec range info
00868 
00869   UpdateGlobalManager();
00870 
00871   if ( dbivrec ) {
00872     fVldRange.TrimTo(dbivrec->GetVldRange());
00873   }
00874   else {
00875     MSG("Geo",Msg::kWarning) << "No DbiValidityRec for table " << tblName 
00876                              << endl;
00877   }
00878   
00879 }

virtual void GeoGeometry::UpdateGlobalManager (  )  const [inline, virtual]
void GeoGeometry::UpdateNodeMatrices ( TGeoVolume *  volume  )  [private, virtual]

Definition at line 2276 of file GeoGeometry.cxx.

References Msg::kFatal, MSG, and UpdateGlobalManager().

Referenced by GeoGeometry().

02276                                                        {
02277   // Private method. Loop through all GeoNodes in geometry starting at volume 
02278   // and construct global matrices for use in local to global (MARS) 
02279   // coordinates
02280 
02281   UpdateGlobalManager();
02282   if (!volume) {
02283     MSG("Geo",Msg::kFatal) << "UpdateNodeMatrices called with null volume ptr "
02284                            << endl;
02285     abort();
02286   }
02287   
02288   Int_t ndaughter = volume -> GetNdaughters();
02289   for ( int id = 0; id < ndaughter; id++ ) {
02290     TGeoNode* daughternode = volume->GetNode(id);
02291     GeoNode* geonode = dynamic_cast<GeoNode*>(daughternode);
02292     if ( geonode ) geonode -> UpdateGlobalMatrix();
02293     
02294     TGeoVolume* daughtervol = daughternode->GetVolume();
02295     this -> UpdateNodeMatrices(daughtervol);
02296   }
02297   
02298 }


Member Data Documentation

Definition at line 137 of file GeoGeometry.h.

Referenced by GetAppType(), and IsCompatible().

TGeoManager* GeoGeometry::fGeoManager [private]

Definition at line 152 of file GeoGeometry.h.

Referenced by BuildDetector(), and BuildPlanePairVolumes().

TVector3 GeoGeometry::fHallMax [private]

Definition at line 143 of file GeoGeometry.h.

Referenced by BuildHallExtent(), and GetHallExtentMax().

TVector3 GeoGeometry::fHallMin [private]

Definition at line 142 of file GeoGeometry.h.

Referenced by BuildHallExtent(), and GetHallExtentMin().

std::string GeoGeometry::fHallPath [private]

Definition at line 141 of file GeoGeometry.h.

Referenced by BuildGeometry(), BuildHallExtent(), and BuildPlanePairVolumes().

Bool_t GeoGeometry::fIsSwimMedia [private]

Definition at line 153 of file GeoGeometry.h.

Referenced by SwitchMedia().

Definition at line 154 of file GeoGeometry.h.

Referenced by GeoGeometry(), GetMediumMap(), and ~GeoGeometry().

std::map<PlexPlaneId,GeoPlnNode*> GeoGeometry::fPlaneMap [mutable, private]
std::vector<GeoPlnNode*> GeoGeometry::fPlnNodes [mutable, private]

Definition at line 149 of file GeoGeometry.h.

Referenced by GetPlnNodePtrVector().

TGeoRotation* GeoGeometry::fRot315 [private]

Definition at line 157 of file GeoGeometry.h.

Referenced by BuildRotations(), and GetRot315().

TGeoRotation* GeoGeometry::fRot45 [private]

Definition at line 156 of file GeoGeometry.h.

Referenced by BuildRotations(), and GetRot45().

Float_t GeoGeometry::fScale [private]
std::vector<GeoScintPlnNode*> GeoGeometry::fScintPlnNodes [mutable, private]

Definition at line 147 of file GeoGeometry.h.

Referenced by GetScintPlnNodePtrVector().

Float_t GeoGeometry::fSMZMax[2] [private]

Definition at line 139 of file GeoGeometry.h.

Referenced by BuildPlanePairVolumes(), GeoGeometry(), and GetZExtent().

Float_t GeoGeometry::fSMZMin[2] [private]

Definition at line 138 of file GeoGeometry.h.

Referenced by BuildPlanePairVolumes(), GeoGeometry(), and GetZExtent().

std::map<Float_t, GeoSteelPlnNode*> GeoGeometry::fSteelPlnNodeMap [mutable, private]

Definition at line 150 of file GeoGeometry.h.

Referenced by GetSteelPlnNodeMap().

std::vector<GeoSteelPlnNode*> GeoGeometry::fSteelPlnNodes [mutable, private]

Definition at line 148 of file GeoGeometry.h.

Referenced by GetSteelPlnNodePtrVector().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1