GeoShieldGroup Class Reference

#include <GeoShieldGroup.h>

List of all members.

Public Member Functions

 GeoShieldGroup ()
virtual ~GeoShieldGroup ()
std::list< const TGeoVolume * > GetListOfVolumes () const
virtual void Print (Option_t *option="") const
void AddVolume (const TGeoVolume *volume, const UgliDbiSteelPln *stRow)

Protected Member Functions

 GeoShieldGroup (GeoGeometry *geo, GeoShield::EGroupType grp)
void BuildNode (TGeoVolume *hallVol)

Private Member Functions

 GeoShieldGroup (const GeoShieldGroup &that)
GeoShieldGroupoperator= (const GeoShieldGroup &that)

Private Attributes

GeoGeometryfGeoGeometry
GeoShield::EGroupType fGroup
 reference link to geometry creator
Double_t fPoints [2][3]
std::list< const TGeoVolume * > fVolumes

Friends

class GeoShield

Detailed Description

Definition at line 20 of file GeoShieldGroup.h.


Constructor & Destructor Documentation

GeoShieldGroup::GeoShieldGroup (  )  [inline]

Definition at line 27 of file GeoShieldGroup.h.

00027                   :fGeoGeometry(0),fGroup(GeoShield::kUnknown),
00028                    fPoints(),fVolumes(){} // def ctor

GeoShieldGroup::~GeoShieldGroup (  )  [virtual]

Definition at line 46 of file GeoShieldGroup.cxx.

References Msg::kDebug, and MSG.

00046                                 {
00047   // Destructor, delete all owned objects
00048   MSG("Geo",Msg::kDebug) << "GeoShield dtor @ " << this << endl;
00049   
00050   // geogeometry creator is not owned
00051   // volumes in list are not owned
00052 
00053 }

GeoShieldGroup::GeoShieldGroup ( GeoGeometry geo,
GeoShield::EGroupType  grp 
) [protected]

Definition at line 31 of file GeoShieldGroup.cxx.

References Msg::kDebug, and MSG.

00032                                                          : 
00033                                fGeoGeometry(geo), fGroup(group),
00034                                fPoints(),fVolumes() {
00035   // Normal constructor
00036 
00037   MSG("Geo",Msg::kDebug) << "GeoShieldGroup normal ctor @ " << this << endl;
00038   for ( int ic = 0; ic < 3; ic++ ) {
00039     fPoints[0][ic] = +999999.;
00040     fPoints[1][ic] = -999999.;
00041   }
00042   
00043 }

GeoShieldGroup::GeoShieldGroup ( const GeoShieldGroup that  )  [private]

Member Function Documentation

void GeoShieldGroup::AddVolume ( const TGeoVolume *  volume,
const UgliDbiSteelPln stRow 
)

Definition at line 82 of file GeoShieldGroup.cxx.

References bfld::AsString(), fGeoGeometry, fGroup, fPoints, fVolumes, GeoGeometry::GetAppType(), UgliDbiSteelPln::GetPhiDeg(), Geo::GetScale(), UgliDbiSteelPln::GetThetaDeg(), UgliDbiSteelPln::GetTotalZ(), UgliDbiSteelPln::GetX0(), UgliDbiSteelPln::GetY0(), UgliDbiSteelPln::GetZBack(), GeoShield::kFarInnerE, GeoShield::kFarInnerW, GeoShield::kFarOuterE, GeoShield::kFarOuterW, GeoShield::kFarTop, Msg::kFatal, and MSG.

00083                                                              {
00084   // The stRow is used to extract positional information in order to
00085   // determine size of bounding box
00086 
00087   fVolumes.push_back(pairVol);
00088 
00089   Double_t scale = Geo::GetScale(fGeoGeometry->GetAppType());
00090   
00091   // Extract size of volume 
00092   // Convert to local coordinates of pair to add dimensions of volume,
00093   // then convert these coordinates to global to determine size of
00094   // group, stored in global coordinates
00095   Double_t gxyz[3] = {(stRow->GetX0())*scale,(stRow->GetY0())*scale,
00096                       (stRow->GetZBack()-0.5*(stRow->GetTotalZ()))*scale};
00097   TGeoCombiTrans* pairMatrix = new TGeoCombiTrans(pairVol->GetName(),
00098                                    gxyz[0],gxyz[1],gxyz[2],new TGeoRotation(
00099                                    pairVol->GetName(),
00100                                    stRow->GetThetaDeg(0),stRow->GetPhiDeg(0),
00101                                    stRow->GetThetaDeg(1),stRow->GetPhiDeg(1),
00102                                    stRow->GetThetaDeg(2),stRow->GetPhiDeg(2)));
00103   pairMatrix -> RegisterYourself();
00104 
00105   Double_t lxyz[3] = {0};  
00106   pairMatrix -> MasterToLocal(gxyz,lxyz);
00107 
00108   // Use the volume bbox to determine dimensions of volume
00109   TGeoBBox* bbox = dynamic_cast<TGeoBBox*>(pairVol -> GetShape());
00110   Double_t halfw[3] = {bbox->GetDX(),bbox->GetDY(),bbox->GetDZ()};
00111   Double_t pad = 0.; // 0.05*scale; // not necessary
00112 
00113   // In local group coordinates, store the point, storage depends on
00114   // group type
00115   switch ( fGroup ) {
00116 
00117   case GeoShield::kFarInnerE:
00118   case GeoShield::kFarInnerW:
00119     {
00120       Double_t lxyzmin[3] = {0};
00121       Double_t lxyzmax[3] = {0};
00122       Double_t gxyzmin[3] = {0};
00123       Double_t gxyzmax[3] = {0};
00124       for ( int ic = 0; ic < 3; ic++ ) {
00125         lxyzmin[ic] = lxyz[ic] - halfw[ic] - pad;
00126         lxyzmax[ic] = lxyz[ic] + halfw[ic] + pad;
00127         pairMatrix -> LocalToMaster(lxyzmin,gxyzmin);
00128         pairMatrix -> LocalToMaster(lxyzmax,gxyzmax);
00129         fPoints[0][ic] = TMath::Min(fPoints[0][ic],gxyzmin[ic]);
00130         fPoints[0][ic] = TMath::Min(fPoints[0][ic],gxyzmax[ic]);
00131         fPoints[1][ic] = TMath::Max(fPoints[1][ic],gxyzmin[ic]);
00132         fPoints[1][ic] = TMath::Max(fPoints[1][ic],gxyzmax[ic]);
00133       }
00134     }
00135   case GeoShield::kFarOuterE: 
00136   case GeoShield::kFarOuterW: 
00137   case GeoShield::kFarTop:
00138     {
00139       Double_t lxyzcnr[3] = {0};
00140       Double_t gxyzcnr[3] = {0};
00141       Double_t sign[2] = {-1,1};
00142       for ( int ip = 0; ip < 8; ip++ ) {
00143         for ( int ix = 0; ix < 2; ix++ ) {
00144           lxyzcnr[0] = lxyz[0] + sign[ix]*(halfw[0] + pad);
00145           for ( int iy = 0; iy < 2; iy++ ) {
00146             lxyzcnr[1] = lxyz[1] + sign[iy]*(halfw[1] + pad);
00147             for ( int iz = 0; iz < 2; iz++ ) {
00148               lxyzcnr[2] = lxyz[2] + sign[iz]*(halfw[2] + pad);   
00149               pairMatrix -> LocalToMaster(lxyzcnr,gxyzcnr);
00150               for ( int ic = 0; ic < 3; ic++ ) {
00151                 fPoints[0][ic] = TMath::Min(fPoints[0][ic],gxyzcnr[ic]);
00152                 fPoints[1][ic] = TMath::Max(fPoints[1][ic],gxyzcnr[ic]);
00153               }
00154             }
00155           }
00156         }
00157       }
00158     }
00159     break;
00160 
00161   default:
00162     MSG("Geo",Msg::kFatal) << "ShieldGroup " 
00163                            <<  GeoShield::AsString(fGroup)
00164                            << " unknown!. Abort." << endl;
00165     abort();
00166   } // end of shield group switch
00167 
00168   return;
00169   
00170 }

void GeoShieldGroup::BuildNode ( TGeoVolume *  hallVol  )  [protected]

Definition at line 173 of file GeoShieldGroup.cxx.

References bfld::AsString(), fGeoGeometry, fGroup, fPoints, fVolumes, GeoGeometry::GetAppType(), GeoGeometry::GetMediumMap(), Nav::GetName(), Geo::GetScale(), gGeoManager, GeoShield::kFarInnerE, GeoShield::kFarInnerW, GeoShield::kFarOuterE, GeoShield::kFarOuterW, GeoShield::kFarTop, Msg::kFatal, Geo::kHall, and MSG.

00173                                                   {
00174   // Build shield group TGeoNode and add to the hall volume.
00175   // All shield volumes are added to the shield group volume as
00176   // nodes as well.
00177 
00178   Double_t scale = Geo::GetScale(fGeoGeometry->GetAppType());
00179 
00180   // All shield group bounding boxes are made up of air, i.e.
00181   // blend into hall mother volume
00182   const GeoMediumMap& medMap = fGeoGeometry->GetMediumMap();
00183  
00184   // Shield group volume positions are created relative to MARS, so
00185   // need hall global position to recalculate.
00186   TGeoNode* linrNode = gGeoManager->GetVolume("MARS")->GetNode("LINR_1");
00187   const Double_t* h0 = linrNode -> GetMatrix() -> GetTranslation();
00188   
00189   // So far, all shield group volumes are built as TGeoBBox
00190   Double_t gxyz0[3] = {0}; // global box center
00191   for ( int ip = 0; ip < 2; ip++ ) {
00192     for ( int ic = 0; ic < 3; ic++ ) {
00193       gxyz0[ic] += fPoints[ip][ic];
00194     }
00195   }
00196   for ( int ic = 0; ic < 3; ic++ ) gxyz0[ic] /= 2.;
00197 
00198   Double_t halfxyz[3] = {0}; // box halfwidths
00199   for ( int ip = 0; ip < 2; ip++ ) {
00200     for ( int ic = 0; ic < 3; ic++ ) {
00201       halfxyz[ic] 
00202       = TMath::Max(halfxyz[ic],TMath::Abs(fPoints[ip][ic]-gxyz0[ic]));
00203     }
00204   }
00205 
00206   // Make shield group box volume
00207   std::string grpName = GeoShield::AsString(fGroup);
00208   TGeoVolume* grpVol = 0;
00209   
00210   switch ( fGroup ) {
00211 
00212   case GeoShield::kFarInnerE:
00213   case GeoShield::kFarInnerW:
00214   case GeoShield::kFarOuterE:
00215   case GeoShield::kFarOuterW:
00216   {     
00217     // inner and outer wings are simple boxes
00218     grpVol = gGeoManager->MakeBox(grpName.c_str(),medMap.GetMedium(Geo::kHall),
00219                           halfxyz[0],halfxyz[1],halfxyz[2]);
00220   }
00221   break;
00222   
00223   case GeoShield::kFarTop:
00224   {
00225     // top section is a tgeoxtru outline of a box with trapezoid cut-out to
00226     // fit over top of detector
00227     TGeoXtru* grpShp = new TGeoXtru(2); // odd not to have a ctor w/name arg
00228     grpShp -> SetName(grpName.c_str());
00229 
00230     // This little bit of math is affordable because it's only done once
00231     Double_t hiy = 4.25*scale;
00232     Double_t loy = gxyz0[1] - halfxyz[1];
00233     Double_t tand225 = 0.414213562;
00234     Double_t halfxhiy = hiy*tand225;
00235     Double_t halfxloy = (hiy-loy)+halfxhiy;
00236     Double_t halfy = (hiy-loy)/2.;
00237 
00238     const int nv = 8;
00239     Double_t x[nv] = {0};
00240     Double_t y[nv] = {0};
00241     
00242     // etch'a sketch
00243     x[0] = -halfxyz[0]; y[0] = -halfxyz[1];
00244     x[1] = -halfxyz[0]; y[1] = +halfxyz[1];
00245     x[2] = +halfxyz[0]; y[2] = +halfxyz[1];
00246     x[3] = +halfxyz[0]; y[3] = -halfxyz[1];
00247     x[4] = +halfxloy;   y[4] = -halfxyz[1];
00248     x[5] = +halfxhiy;   y[5] = -halfxyz[1]+2.*halfy;
00249     x[6] = -halfxhiy;   y[6] = -halfxyz[1]+2.*halfy;
00250     x[7] = -halfxloy;   y[7] = -halfxyz[1];
00251         
00252     grpShp -> DefinePolygon(8,x,y);
00253     // Define section must be called after DefinePolygon
00254     grpShp -> DefineSection(0,-halfxyz[2]);
00255     grpShp -> DefineSection(1,+halfxyz[2]);
00256     
00257     grpVol = new TGeoVolume(grpName.c_str(),grpShp,
00258                             medMap.GetMedium(Geo::kHall));  
00259   }
00260   break;
00261   
00262   default:
00263     MSG("Geo",Msg::kFatal) << "ShieldGroup " 
00264                            <<  GeoShield::AsString(fGroup)
00265                            << " unknown!. Abort." << endl;
00266     abort();
00267   } // end of shield group switch
00268 
00269   //grpVol -> SetVisibility(kTRUE);
00270   //grpVol -> SetLineColor(kBlack);
00271   grpVol -> SetVisibility(kFALSE);
00272   grpVol -> VisibleDaughters(kTRUE);
00273   
00274   // Place in hallVol as node
00275   // TGeoTranslation is adopted by gGeoManager
00276   // overlap because overlaps pair plane boxes. Fix me.
00277   hallVol -> AddNodeOverlap(grpVol,1,new TGeoTranslation(grpName.c_str(),
00278               (gxyz0[0]-h0[0]),(gxyz0[1]-h0[1]),(gxyz0[2]-h0[2])));
00279 
00280   // Now add volumes in group list to shield group volume
00281   std::list<const TGeoVolume*>::const_iterator volItr;
00282 
00283   for ( volItr = fVolumes.begin(); volItr != fVolumes.end(); volItr++ ) {
00284     // ROOT somewhere between v5-34-12 and v5_34_25 changed
00285     // the const-ness of TGeoVolume::AddNode
00286     // just cast it away here ...
00287     TGeoVolume* pairVol = const_cast<TGeoVolume*>(*volItr);
00288     std::string pairName = pairVol -> GetName();
00289     TGeoCombiTrans* pairMatrix = dynamic_cast<TGeoCombiTrans*>
00290            (gGeoManager->GetListOfMatrices()->FindObject(pairName.c_str()));
00291     
00292     // Adjust pair matrix translation to set plane pair relative to volume
00293     const Double_t* x0pair = pairMatrix -> GetTranslation();
00294     pairMatrix -> SetTranslation(x0pair[0]-gxyz0[0],x0pair[1]-gxyz0[1],
00295                                  x0pair[2]-gxyz0[2]);
00296     
00297     grpVol -> AddNode(pairVol,1,pairMatrix);
00298   }  
00299   
00300   return;
00301   
00302 }

std::list<const TGeoVolume*> GeoShieldGroup::GetListOfVolumes (  )  const [inline]

Definition at line 32 of file GeoShieldGroup.h.

References fVolumes.

00032 { return fVolumes; }

GeoShieldGroup& GeoShieldGroup::operator= ( const GeoShieldGroup that  )  [private]
void GeoShieldGroup::Print ( Option_t *  option = ""  )  const [virtual]

Definition at line 56 of file GeoShieldGroup.cxx.

References bfld::AsString(), fGroup, fPoints, and fVolumes.

00056                                                        {
00057    // print to cout
00058 
00059   if ( fVolumes.size() == 0 ) {
00060     cout << "Group " << GeoShield::AsString(fGroup) << " has no volumes." 
00061          << endl;
00062   }
00063   else {
00064     cout << "Group " << GeoShield::AsString(fGroup) << " has " 
00065          << fVolumes.size() << " volume(s):" << endl;
00066     std::list<const TGeoVolume*>::const_iterator volitr;
00067     for ( volitr = fVolumes.begin(); volitr != fVolumes.end(); volitr++ ) {
00068        (*volitr) -> Print();
00069     }
00070   }
00071   
00072   cout << "Group box boundary points in global coordinates: " << endl;
00073   for ( int ipt = 0; ipt < 2; ipt++ ) {
00074     cout << " " << ipt << ": (" 
00075          << fPoints[ipt][0] << "," << fPoints[ipt][1] 
00076          << "," << fPoints[ipt][2] << ")" << endl;
00077   }
00078   
00079 }


Friends And Related Function Documentation

friend class GeoShield [friend]

Definition at line 22 of file GeoShieldGroup.h.


Member Data Documentation

Definition at line 54 of file GeoShieldGroup.h.

Referenced by AddVolume(), and BuildNode().

reference link to geometry creator

Definition at line 55 of file GeoShieldGroup.h.

Referenced by AddVolume(), BuildNode(), and Print().

Double_t GeoShieldGroup::fPoints[2][3] [private]

Definition at line 56 of file GeoShieldGroup.h.

Referenced by AddVolume(), BuildNode(), and Print().

std::list<const TGeoVolume*> GeoShieldGroup::fVolumes [private]

Definition at line 58 of file GeoShieldGroup.h.

Referenced by AddVolume(), BuildNode(), GetListOfVolumes(), and Print().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1