UgliGeometry Class Reference

#include <UgliGeometry.h>

Inheritance diagram for UgliGeometry:
UgliGeomABC UgliRefCnt UgliGeometryReroot

List of all members.

Public Member Functions

Bool_t IsCompatible (const VldContext &vldc)
Bool_t IsCompatible (const VldContext *vldc)
virtual UgliScintPlnNodeGetScintPlnNode (PlexPlaneId planeid) const
virtual UgliSteelPlnNodeGetSteelPlnNode (PlexPlaneId planeid) const
virtual UgliStripNodeGetStripNode (PlexStripEndId seid) const
virtual PlexPlaneId GetPlaneIdFromZ (Double_t z) const
virtual UgliSteelPlnNodeGetNearestSteelPlnNode (Double_t z) const
const std::vector
< UgliScintPlnNode * > & 
GetScintPlnNodePtrVector () const
const std::vector
< UgliSteelPlnNode * > & 
GetSteelPlnNodePtrVector () const
const std::vector< UgliPlnNode * > & GetPlnNodePtrVector () 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 isuper=-1) const
virtual void GetZExtent (Double_t &zmin, Double_t &zmax, Int_t isuper=-1) const
virtual TVector3 GetHallExtentMin () const
virtual TVector3 GetHallExtentMax () const
const VldRangeGetVldRange () const
Bool_t IsFrozen () const
Bool_t IsAlgorithmic () const
virtual void Draw (Option_t *option="")
virtual void Print (Option_t *option="") const
virtual void ls (Option_t *option="rsn5") const
virtual TGeometryXGetTGeometryX () const
virtual TRotMatrix * GetRotMatrix (const char *name) const
virtual TShape * GetShape (const char *name) const
virtual TNode * GetNode (const char *name) const
virtual TNodeXGetTNodeX (const char *name) const
 UgliGeometry ()

Protected Types

enum  EMINFStatus { kNotNeeded, kOkay, kNotThere }

Protected Member Functions

 UgliGeometry (const VldContext &vldc, Bool_t frozen=kTRUE)
virtual ~UgliGeometry ()
void SetFrozen (Bool_t frozen)
virtual UgliGeometry::EMINFStatus GetMINFStatus () const
void TrimVldRange (const char *tblName="", const DbiValidityRec *dbivrec=0)
virtual void BuildAll (const VldContext &vldc)
virtual void BuildVldRange (const VldContext &vldc)
virtual void BuildMaterials (const VldContext &vldc)
virtual void BuildRotMatrices (const VldContext &vldc)
virtual void BuildShapes (const VldContext &vldc)
virtual void BuildNodes (const VldContext &vldc)
virtual void BuildStripShapes (const VldContext &vldc)
virtual void ClearDbiCache (const VldContext &vldc)
virtual void RestorePlaneTable (bool onlyIfEmpty=true) const

Protected Attributes

Bool_t fFrozen
Bool_t fAlgorithmic
VldRange fVldRange
TGeometryXfRootGeom
std::map< PlexPlaneId,
UgliPlnNode * > 
fPlaneTable
PlexPlaneId fCachedSteelPlnId
 ref copy (can't i/o)
UgliSteelPlnNodefCachedSteelPlnNode
PlexPlaneId fCachedScintPlnId
 ref copy
UgliScintPlnNodefCachedScintPlnNode
std::vector< UgliScintPlnNode * > fScintPlnNodes
 ref copy
std::vector< UgliSteelPlnNode * > fNormalSteelNodes
 ref copy
std::vector< UgliPlnNode * > fAllPlnNodes
 ref copy
std::vector< Double_t > fZSteelPlnMidPoint
 ref copy

Private Member Functions

 UgliGeometry (const UgliGeometry &so)

Friends

class UgliLoanPool

Detailed Description

Definition at line 38 of file UgliGeometry.h.


Member Enumeration Documentation

enum UgliGeometry::EMINFStatus [protected]
Enumerator:
kNotNeeded 
kOkay 
kNotThere 

Definition at line 93 of file UgliGeometry.h.

00093                     {
00094       kNotNeeded,  // gMINFast is not needed
00095       kOkay,       // gMINFast is needed, has non-zero value
00096       kNotThere    // gMINFast is needed, but isn't initialized
00097    };


Constructor & Destructor Documentation

UgliGeometry::UgliGeometry (  ) 

Definition at line 109 of file UgliGeometry.cxx.

References Msg::kVerbose, and MSG.

Referenced by UgliLoanPool::BuildUgliGeometry().

00110    : fFrozen(true), fAlgorithmic(false), fRootGeom(0),
00111      fCachedSteelPlnNode(0), fCachedScintPlnNode(0)
00112 {
00113    // Default constructor
00114    MSG("Ugli",Msg::kVerbose) << "UgliGeometry default ctor" << endl;
00115 }

UgliGeometry::UgliGeometry ( const VldContext vldc,
Bool_t  frozen = kTRUE 
) [protected]

Definition at line 118 of file UgliGeometry.cxx.

References BuildAll(), fAlgorithmic, VldContext::GetDetector(), IsAlgorithmic(), Detector::kFar, and PlexVetoShieldHack::SetDefaultContext().

00119    : fFrozen(frozen), fAlgorithmic(false), fRootGeom(0),
00120      fCachedSteelPlnNode(0), fCachedScintPlnNode(0)
00121 {
00122    // Normal constructor
00123 
00124    fAlgorithmic = UgliDbiTables::IsAlgorithmic(vldc.GetDetector());
00125 
00126    // complete hack to keep a "global" context so that decisions about 
00127    // veto shield configuration can be made in a pseudo-vacuum.
00128    // set this *before* going to the loan pool
00129    if (vldc.GetDetector() == Detector::kFar) 
00130      PlexVetoShieldHack::SetDefaultContext(vldc);
00131 
00132    //MSG("Ugli",Msg::kInfo) << "UgliGeometry vldc ctor @ " << this << endl;
00133 
00134    BuildAll(vldc);
00135 }

UgliGeometry::~UgliGeometry (  )  [protected, virtual]

Definition at line 138 of file UgliGeometry.cxx.

References UgliRefCnt::CountRef(), fRootGeom, Msg::kWarning, and MSG.

00139 {
00140    // delete all the owned sub-objects
00141 
00142    //MSG("Ugli",Msg::kInfo) << "UgliGeometry dtor @ " << this << endl;
00143 
00144    delete fRootGeom;    fRootGeom=0;
00145 
00146    if (CountRef()) {
00147       MSG("Ugli",Msg::kWarning)
00148          << "~UgliGeometry still had " << CountRef()
00149          << " outstanding references " << endl;
00150    }
00151 
00152 }

UgliGeometry::UgliGeometry ( const UgliGeometry so  )  [private]

Member Function Documentation

void UgliGeometry::BuildAll ( const VldContext vldc  )  [protected, virtual]

Definition at line 552 of file UgliGeometry.cxx.

References VldRange::AsString(), BuildMaterials(), BuildNodes(), BuildRotMatrices(), BuildShapes(), BuildVldRange(), ClearDbiCache(), fRootGeom, fVldRange, VldContext::GetDetector(), IsFrozen(), Detector::kUnknown, Msg::kWarning, and MSG.

Referenced by UgliGeometry(), and UgliGeometryReroot::UgliGeometryReroot().

00553 {
00554    // Build things
00555 
00556    // Get the VldRange that fits this VldContext
00557 
00558    BuildVldRange(vldc);
00559 
00560    TString name = (IsFrozen()?"Frozen":"Modifiable");
00561    name += fVldRange.AsString("s1ac-");
00562    fRootGeom = new TGeometryX(name.Data(),"a MINOS geometry");
00563    fRootGeom->cd();
00564 
00565    if (vldc.GetDetector() == Detector::kUnknown) {
00566       MSG("Ugli",Msg::kWarning)
00567          << "no possibility of building a geometry for " << endl
00568          << "   VldContext: " << vldc << endl;
00569       return;
00570    }
00571 
00572    // Build Materials
00573 
00574    BuildMaterials(vldc);
00575 
00576    // Build RotMatrices
00577 
00578    BuildRotMatrices(vldc);
00579 
00580    // Build Shapes
00581 
00582    BuildShapes(vldc);
00583 
00584    // Build Nodes
00585 
00586    BuildNodes(vldc);
00587 
00588    // Clear DBI cache
00589 
00590    ClearDbiCache(vldc);
00591 }

void UgliGeometry::BuildMaterials ( const VldContext vldc  )  [protected, virtual]

Definition at line 1085 of file UgliGeometry.cxx.

References Msg::kVerbose, and MSG.

Referenced by BuildAll().

01086 {
01087    // build this geometry's materialss
01088 
01089    MSG("Ugli",Msg::kVerbose) << "UgliGeometry BuildMaterials " << endl;
01090 
01091 //   TMaterial *mat;
01092    TMixture  *mix;
01093 
01094    // there doesn't seem to be any way to set the density (1.032)
01095    mix = new TMixture("scint","polystyrene C6H5CH-CH2",-2);
01096    mix->DefineElement(0,1.00794,1.,8.);
01097    mix->DefineElement(1,12.011,6.,8.);
01098 
01099    // loop over SteelPn, fill out material for different melts ??
01100    mix = new TMixture("steel","generic steel",2);
01101    mix->DefineElement(0,55.84999,26,.98);
01102    mix->DefineElement(1,12.01,6,.02);
01103 
01104 
01105 }

void UgliGeometry::BuildNodes ( const VldContext vldc  )  [protected, virtual]

Reimplemented in UgliGeometryReroot.

Definition at line 1149 of file UgliGeometry.cxx.

References bfld::AsString(), PlexPlaneId::AsString(), VldContext::AsString(), VldTimeStamp::AsString(), BuildStripShapes(), Munits::cm, fAlgorithmic, fPlaneTable, FabPlnInstallLookup::fPlnInstallTbl, fRootGeom, fVldRange, Registry::Get(), CfgConfigurable::GetConfig(), UgliDbiTables::GetDbiGeometry(), UgliDbiTables::GetDbiSteelPln(), VldContext::GetDetector(), UgliDbiGeometry::GetHallXYZMax(), UgliDbiGeometry::GetHallXYZMin(), FabPlnInstall::GetInstallDate(), Msg::GetLevelCode(), UgliDbiTables::GetNumSteelRows(), PlexPlaneId::GetPlane(), PlexPlaneId::GetPlaneCoverage(), UgliDbiSteelPln::GetPlaneId(), DbiResultPtr< T >::GetRowByIndex(), VldContext::GetSimFlag(), VldRange::GetTimeEnd(), VldContext::GetTimeStamp(), PlexPlaneId::GetVetoSection(), UgliLoanPool::Instance(), UgliDbiTables::IsCutOnPlnInstall(), PlexPlaneId::IsSteel(), PlexPlaneId::IsVetoShield(), Detector::kCalDet, SimFlag::kData, Msg::kDebug, Detector::kFar, Msg::kFatal, Msg::kInfo, PlaneCoverage::kNoActive, Msg::kSynopsis, PlaneCoverage::kUnknown, MSG, FabPlnInstallLookup::NextInstall(), PlexPlaneId::SetIsSteel(), and VldRange::SetTimeEnd().

Referenced by BuildAll().

01150 {
01151    // build this geometry's hierarchy of nodes
01152 
01153    MSG("Ugli",Msg::kDebug) << "UgliGeometry::BuildNodes UgliDbiTables" << endl;
01154    const UgliDbiTables& ugliTables = 
01155      ((fAlgorithmic) ? UgliDbiTables(vldc,false) : UgliDbiTables(vldc));
01156 
01157    fRootGeom->cd();
01158    // Start building from the DBI info
01159 
01160    TShape *pshape = 0;
01161    TNodeX *pnode  = 0;
01162 
01163    bool        world_is_uv = true;
01164    const char* world_rotm  = "UV";
01165 
01166    bool force_xy = true;
01167 
01168    if (vldc.GetDetector() == Detector::kCalDet) {
01169       world_is_uv = false;
01170       world_rotm  = "XY";
01171    }
01172    else if (force_xy) {
01173       MSG("Ugli",Msg::kDebug)
01174          << vldc.AsString("c") << " should use Hall oriented in UV space"
01175          << " ... but we won't for now" << endl;
01176       world_is_uv = false;
01177       world_rotm  = "XY";
01178    }
01179 
01180    MSG("Ugli",Msg::kDebug) << "Build the hall" << endl;
01181    // First we need a hall
01182    const UgliDbiGeometry* geo = ugliTables.GetDbiGeometry();
01183    if (!geo) {
01184      MSG("Ugli",Msg::kFatal) 
01185        << "No UgliDbiGeometry for " << vldc << endl;
01186      return;
01187    }
01188 
01189    const Float_t* hmin = geo->GetHallXYZMin();
01190    const Float_t* hmax = geo->GetHallXYZMax();
01191 // just a test folks
01192 //      Float_t hmin[] = {-5,-5,0};
01193 //      Float_t hmax[] = {15,15,60};
01194 
01195    Float_t absxmax  = TMath::Max(TMath::Abs(hmax[0]),TMath::Abs(hmin[0]));
01196    Float_t absymax  = TMath::Max(TMath::Abs(hmax[1]),TMath::Abs(hmin[1]));
01197    Float_t abszmax  = TMath::Max(TMath::Abs(hmax[2]),TMath::Abs(hmin[2]));
01198    Float_t absxymax = TMath::Max(absxmax,absymax);
01199    Float_t sqrt2 = TMath::Sqrt(2.0);
01200    if (world_is_uv) absxymax *= sqrt2;
01201 
01202    // define the fixed frame of the (local) universe
01203    pshape = new TBRIK("universe","all the ever is","void",
01204                       absxymax,absxymax,abszmax);
01205    pnode  = new TNodeX("universe","fixed center of all",
01206                        "universe",0,0,0,"Identity");
01207    pnode->SetVisibility(0); // nothing to see here folks
01208    pnode->SetVisibility(1);      // okay for now peek a little
01209    pnode->SetLineColor(kYellow); // but unobtrusively
01210    pnode->cd();
01211 
01212    // the world might rotate in the universe (uv or xy)
01213    pshape = new TBRIK("world","the shape of the world","void",
01214                       absxymax,absxymax,abszmax);
01215    pnode  = new TNodeX("world","it depends how we look at it",
01216                        "world",0,0,0,world_rotm);
01217    pnode->SetVisibility(1);     // see the world
01218    pnode->SetLineColor(kBlack); // it's gone black!
01219    pnode->cd();
01220    
01221    // shapes use half-sizes 
01222    Double_t xhsiz  = 0.5 * (hmax[0] - hmin[0]);
01223    Double_t yhsiz  = 0.5 * (hmax[1] - hmin[1]);
01224    Double_t zhsiz  = 0.5 * (hmax[2] - hmin[2]);
01225    
01226    Double_t x0hall = 0.5 * (hmax[0] + hmin[0]);
01227    Double_t y0hall = 0.5 * (hmax[1] + hmin[1]);
01228    Double_t z0hall = 0.5 * (hmax[2] + hmin[2]);
01229    
01230    pshape = new TBRIK("hall","The Hall","void",
01231                       xhsiz,yhsiz,zhsiz);
01232    TNodeX *hall_node = new TNodeX("hall","The Hall","hall",
01233                                   x0hall,y0hall,z0hall);
01234    hall_node->cd();
01235    hall_node->SetVisibility(1);   // see the hall
01236    hall_node->SetLineColor(kRed); // it's red!
01237    
01238    
01239    // put some markers in the hall identifying +x, +y, +z
01240    Float_t rmkr = 20.*Munits::cm;
01241    if (vldc.GetDetector() == Detector::kCalDet) rmkr = 1.*Munits::cm;
01242    pshape = new TSPHE("axismkr","axismkr","void",rmkr);
01243    pnode  = new TNodeX("+x","+x","axismkr",
01244                        xhsiz-x0hall-rmkr,-y0hall,-zhsiz+rmkr);
01245    pnode->SetLineColor(kRed);
01246    pnode->SetVisibility(1);
01247    pnode  = new TNodeX("+y","+y","axismkr",
01248                        -x0hall,yhsiz-y0hall-rmkr,-zhsiz+rmkr);
01249    pnode->SetLineColor(kGreen);
01250    pnode->SetVisibility(1);
01251    pnode  = new TNodeX("+z","+z","axismkr",
01252                        -x0hall,-y0hall,+zhsiz-rmkr);
01253    pnode->SetLineColor(kBlue);
01254    pnode->SetVisibility(1);
01255    MSG("Ugli",Msg::kDebug) << "The Hall has been installed" << endl;
01256    
01257    // pre-build the palette of strip shapes
01258    BuildStripShapes(vldc);
01259 
01260    //
01261    // determine whether (and what) to cut on the basis of FabPlnInstall
01262    //
01263    Msg::LogLevel_t cutMsgLevel = Msg::kSynopsis;
01264    VldTimeStamp geomStartTime = vldc.GetTimeStamp();
01265    bool cutOnPlnInstall = UgliDbiTables::IsCutOnPlnInstall(vldc.GetDetector());
01266 
01267    VldContext vldc_install = vldc;
01268    Registry& config = UgliLoanPool::Instance()->GetConfig();
01269    int cutAppliesToVetoShield = false;
01270    if (vldc.GetDetector() == Detector::kFar)
01271      config.Get("CutAppliesToVetoShield",cutAppliesToVetoShield);
01272    if ( cutOnPlnInstall && vldc.GetSimFlag() != SimFlag::kData ) {
01273      int applyToMC = 0;
01274      config.Get("CutAppliesToMC",applyToMC);
01275      switch ( applyToMC ) {
01276      case 1:  
01277        cutOnPlnInstall = true;  // okay, use VldContext of MC
01278        break;  
01279      case 2:  
01280        cutOnPlnInstall = true;  // okay, but use Data VldContext
01281        vldc_install = 
01282          VldContext(vldc.GetDetector(),SimFlag::kData,vldc.GetTimeStamp());
01283        MSG("Ugli",Msg::kInfo) 
01284          << "UgliGeometry::BuildNodes use kData instead of k" 
01285          << SimFlag::AsString(vldc.GetSimFlag())
01286          << " for FabPlnInstall." << endl;
01287        break;
01288      default: 
01289        cutOnPlnInstall = false; // nope, don't apply cut to MC
01290        break;  
01291      }
01292    }
01293 
01294    TString fabCutAction = "not to cut on ";
01295    if (cutOnPlnInstall) {
01296      fabCutAction = "to cut on ";
01297      if (vldc.GetDetector() == Detector::kFar) {
01298        if (cutAppliesToVetoShield) fabCutAction += "all ";
01299        else                        fabCutAction += "non-VetoShield ";
01300      }
01301    }
01302    MSG("Ugli",Msg::kInfo) 
01303      << "UgliGeometry configured " << fabCutAction 
01304      << "FabPlnInstall entries." << endl;
01305 
01306    FabPlnInstallLookup installInfo(vldc_install);
01307    if ( cutOnPlnInstall ) {
01308      const char* level = "Synopsis";
01309      config.Get("CutMsgLevel",level);
01310      cutMsgLevel = Msg::GetLevelCode(level);
01311 
01312      // if planes went up after this time then we need to trim
01313      // the VldRange end time (ignore veto shield)
01314      const FabPlnInstall* fab = installInfo.NextInstall(geomStartTime,true);
01315      if (fab) {
01316        const VldTimeStamp  time_end  = fVldRange.GetTimeEnd();
01317        const VldTimeStamp& time_next = fab->GetInstallDate();
01318        MSG("Ugli",cutMsgLevel) 
01319            << "UgliGeometry VldRange was "
01320            << time_end.AsString("sql") << " PlnInstall::NextInstall gives "
01321            << time_next.AsString("sql") << "." << endl;
01322        if ( time_next < time_end ) {
01323          MSG("Ugli",cutMsgLevel) 
01324            << "UgliGeometry VldRange TimeEnd trimmed from "
01325            << time_end.AsString("sql") << " to "
01326            << time_next.AsString("sql") << "." << endl;
01327          fVldRange.SetTimeEnd(time_next);
01328        }
01329      }
01330      else {
01331        MSG("Ugli",Msg::kInfo) 
01332          << "UgliGeometry:  No VldRange trimming as no PlnInstall::NextInstall." 
01333          << endl;
01334      }
01335    }
01336 
01337    // 
01338    // process steel + scint planes
01339    // 
01340    unsigned int nsteel = ugliTables.GetNumSteelRows();
01341    for (unsigned int irow=0; irow < nsteel; ++irow) {
01342      
01343      const UgliDbiSteelPln* steelRow = ugliTables.GetDbiSteelPln(irow);
01344 
01345      PlexPlaneId steelid = steelRow->GetPlaneId();
01346 
01347      //
01348      // check if row should be supressed due to FabPlnInstall entry
01349      //
01350      bool checkit = true;
01351      if (steelid.IsVetoShield() && !cutAppliesToVetoShield) checkit = false;
01352      if (cutOnPlnInstall && checkit) {
01353        // asked to test installation of planes based on FabPlnInstall table
01354        // so test ...
01355        const FabPlnInstall* fab =
01356          installInfo.fPlnInstallTbl.GetRowByIndex(steelid.GetPlane());
01357        if ( fab ) {
01358          if ( fab->GetInstallDate() > geomStartTime ) {
01359            MSG("Ugli",cutMsgLevel)
01360              << endl
01361              << "UgliDbiTables has entry for " << steelid
01362              << " but FabPlnInstall says " 
01363              << fab->GetInstallDate().AsString("sql")
01364              << endl;
01365            continue;  // skip installation of this steel plane
01366          }
01367        }
01368        else {
01369          MSG("Ugli",cutMsgLevel)
01370            << endl
01371            << "UgliDbiTables has entry for " << steelid
01372            << " but no entry in FabPlnInstall " 
01373            << endl;
01374          continue;  // skip installation of this steel plane
01375        }
01376          
01377      }
01378      
01379      //         int pln = steelid.GetPlane();
01380      int vis = 1;
01381      //         vis = -1;         
01382      //         if (pln== 1 || pln== 6) vis = 1;
01383      //         if (pln==13 || pln==20) vis = 1;
01384      //         if (pln>59) vis = 1;
01385      
01386      MSG("Ugli",Msg::kDebug) << " build " << steelid.AsString("c") 
01387                              << "\r" << flush;
01388           
01389      hall_node->cd();
01390      UgliSteelPlnNode* steel = 
01391        new UgliSteelPlnNode(steelid,this,ugliTables);
01392      fPlaneTable[steelid] = steel;
01393      
01394      //rwh: hack
01395      //         char boxname[16];
01396      //         sprintf(boxname,"%s",steelid.AsString("b"));  // dNNNBvc
01397      //         this->GetNode(boxname)->SetVisibility(vis);
01398      //         boxname[4] = 'P';
01399      //         this->GetNode(boxname)->SetVisibility(vis);
01400      steel->SetVisibility(vis);
01401      TNode* box_from_steel = steel->GetParent();
01402      box_from_steel->SetVisibility(vis);
01403      
01404      if (PlaneCoverage::kNoActive == steelid.GetPlaneCoverage()) continue;
01405      if (PlaneCoverage::kUnknown  == steelid.GetPlaneCoverage()) continue;
01406      
01407      PlexPlaneId scintid = steelid;
01408      scintid.SetIsSteel(false);
01409      
01410      MSG("Ugli",Msg::kSynopsis) << " build " << scintid.AsString("c") 
01411                             << "\r" << flush;
01412 
01413      box_from_steel->cd();
01414      UgliScintPlnNode* scint =
01415        new UgliScintPlnNode(scintid,this,ugliTables);
01416      fPlaneTable[scintid] = scint;
01417      
01418      //rwh: hack
01419      //         boxname[4] = 'A';
01420      //         this->GetNode(boxname)->SetVisibility(vis);
01421      scint->SetVisibility(vis);
01422      
01423    }
01424    hall_node->cd();
01425    
01426    MSG("Ugli",Msg::kSynopsis) << endl << " build  done" << endl;
01427 
01428    //
01429    // summarize what we just built
01430    //  (veto shield entries may have been out-of-order above)
01431    //
01432    PlexPlaneId loNormal, hiNormal, loShield, hiShield;
01433    const PlexPlaneId unsetPlnId;
01434    unsigned int nmdlShieldSection[5] = {0,0,0,0,0};
01435 
01436    nodeItr_t node_itr = fPlaneTable.begin();
01437    nodeItr_t node_end = fPlaneTable.end();
01438    
01439    while (node_itr != node_end) {
01440      nodePair_t map_pair = *node_itr;
01441      PlexPlaneId aPlnId = node_itr->second->GetPlexPlaneId();
01442      node_itr++;
01443 
01444      if (!aPlnId.IsVetoShield()) {
01445        if ( loNormal == unsetPlnId ) loNormal = aPlnId;
01446        hiNormal = aPlnId;
01447      }
01448      else if ( ! aPlnId.IsSteel() ) {
01449        if ( loShield == unsetPlnId ) loShield = aPlnId;
01450        hiShield = aPlnId;
01451        // characterize the shield
01452        int isection = aPlnId.GetVetoSection();
01453        nmdlShieldSection[isection]++;
01454      }    
01455    }
01456 
01457    MSG("Ugli",Msg::kInfo)
01458      << "Built Normal planes: " << loNormal << " to " << hiNormal << "." << endl;
01459    if ( loShield != unsetPlnId) {
01460      MSG("Ugli",Msg::kInfo)
01461        << "Built VetoShield: " << loShield 
01462        << " to " << hiShield << "; Section/Mdls: ";
01463      for (unsigned int isec=1; isec <= 4; ++isec) {
01464        if ( nmdlShieldSection[isec] > 0 ) {
01465          MSG("Ugli",Msg::kInfo) 
01466            << " " << isec << "/" << nmdlShieldSection[isec];
01467        }
01468      }
01469      MSG("Ugli",Msg::kInfo) << "." << endl;
01470    }
01471    else if ( vldc.GetDetector() == Detector::kFar ) {
01472      MSG("Ugli",Msg::kInfo) << "Built No VetoShield sections." << endl;
01473    }
01474 }

void UgliGeometry::BuildRotMatrices ( const VldContext vldc  )  [protected, virtual]

Definition at line 1108 of file UgliGeometry.cxx.

Referenced by BuildAll().

01109 {
01110    // build some basic rotation matrices
01111 
01112    // absolute first should be Identity
01113    new TRotMatrix("Identity","Identity matrix",90,0,90,90,0,0);
01114 
01115    new TRotMatrix("XY","WorldAsXY", 90.,  0., 90., 90.,  0.,  0.);
01116    new TRotMatrix("UV","WorldAsUV", 90.,-45., 90., 45.,  0.,  0.);
01117 
01118 }

void UgliGeometry::BuildShapes ( const VldContext vldc  )  [protected, virtual]

Reimplemented in UgliGeometryReroot.

Definition at line 1121 of file UgliGeometry.cxx.

References Munits::cm, Msg::kVerbose, Munits::m, and MSG.

Referenced by BuildAll().

01122 {
01123    // build some basic shapes (not planes or strips)
01124 
01125    MSG("Ugli",Msg::kVerbose) << "UgliGeometry BuildShapes " << endl;
01126 
01127    // this shape is a placeholder used in constructing
01128    // planes or strips within a TNode derived object
01129    // without passing it a the final shape
01130    // make it really noticable in case there was a mistake
01131    // new TBRIK("noshape","noshape","void",0,0,0);
01132    Float_t nsx[] = {   3,   3, 1.5,-1.5,  -3,  -3,-1.5, -.5,   0,   0,
01133                      .49, .49,   0,   0,   1,   1, .51, .51,   1,   1,
01134                      .5,   -1,  -2,  -2,  -1,   1,   2,   2};
01135    Float_t nsy[] = {   0, 1.5,   3,   3, 1.5,-1.5,  -3,  -3,-3.5,  -5,
01136                       -5,  -6,  -6,  -7,  -7,  -6,  -6,  -5,  -5,  -3,
01137                       -2,  -2,  -1,   1,   2,   2,   1,   0};
01138    TXTRU *noshape = new TXTRU("noshape","noshape","void",28,2);
01139    Float_t dz = 5.94 * Munits::cm;
01140    noshape->DefineSection(0,-dz,1.,0.,0.);
01141    noshape->DefineSection(1,+dz,1.,0.,0.);
01142    for (unsigned int i=0; i < sizeof(nsx)/sizeof(Float_t); i++) 
01143       noshape->DefineVertex(i,nsx[i]*Munits::m,nsy[i]*Munits::m);
01144    noshape->SetLineColor(kRed); noshape->SetLineWidth(1);
01145 
01146 }

void UgliGeometry::BuildStripShapes ( const VldContext vldc  )  [protected, virtual]

Definition at line 1478 of file UgliGeometry.cxx.

References UgliDbiStripStruct::GetLenEastPart(), UgliDbiStripStruct::GetLenWestPart(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), UgliDbiStripStruct::GetShapeName(), UgliDbiStripStruct::GetTotalLen(), DbiResultPtr< T >::GetValidityRec(), UgliDbiStripStruct::GetWlsLenBypass(), UgliDbiStripStruct::GetWlsLenEast(), UgliDbiStripStruct::GetWlsLenWest(), Msg::kDebug, MSG, and TrimVldRange().

Referenced by BuildNodes().

01479 {
01480    // build this geometry's strip shapes
01481 
01482    MSG("Ugli",Msg::kDebug) << "UgliGeometry::BuildStripShapes " << endl;
01483 
01484    DbiResultPtr<UgliDbiStripStruct> stripTbl(vldc);
01485    TrimVldRange("UgliDbiStripStruct",stripTbl.GetValidityRec());
01486 
01487       for (unsigned int irow=0; irow < stripTbl.GetNumRows(); ++irow) {
01488          const UgliDbiStripStruct* sRow = stripTbl.GetRow(irow);
01489          string sname = sRow->GetShapeName();
01490 
01491          // self-registering with TGeometry ... this isn't a memory leak
01492          new UgliStripShape(sname.c_str(),sRow->GetTotalLen(),
01493                             sRow->GetWlsLenEast(),sRow->GetWlsLenWest(),
01494                             sRow->GetLenEastPart(),sRow->GetLenWestPart(),
01495                             sRow->GetWlsLenBypass());
01496       }
01497 
01498 
01499 }

void UgliGeometry::BuildVldRange ( const VldContext vldc  )  [protected, virtual]

Reimplemented in UgliGeometryReroot.

Definition at line 863 of file UgliGeometry.cxx.

References det, fAlgorithmic, fVldRange, VldContext::GetDetector(), VldContext::GetSimFlag(), DbiResultPtr< T >::GetValidityRec(), Msg::kDebug, Msg::kInfo, Detector::kUnknown, MSG, and TrimVldRange().

Referenced by BuildAll().

00864 {
00865    // Build VldRange from VldContext
00866 
00867    MSG("Ugli",Msg::kDebug) << "UgliGeometry::BuildVldRange " << endl;
00868 
00869    Detector::Detector_t det = vldc.GetDetector();
00870    bool isunknown = (Detector::kUnknown == det);
00871    const char* src = "DBI";
00872    if (isunknown) src = "Fake (unknown detector)";
00873 
00874    // start the VldRange of covering all of time and then trim it down
00875    // each time we use a DBI table to compose some part
00876    VldTimeStamp starttime = VldTimeStamp((time_t)0,0);
00877    VldTimeStamp endtime   = VldTimeStamp(2038,1,18,0,0,0);
00878    fVldRange = VldRange(vldc.GetDetector(),vldc.GetSimFlag(),
00879                         starttime,endtime,src);
00880 
00881    // special return for unknown detector
00882    if (isunknown) return;
00883 
00884    if (fAlgorithmic) {
00885      MSG("Ugli",Msg::kInfo) 
00886        << "UgliGeometry::VldRange: Algorithmic! valid until "
00887        << endtime
00888        << endl;
00889      return;
00890    }
00891 
00892    // trim based on all the tables we'll use
00893    // this also primes the cache for all of them
00894 
00895 
00896    MSG("Ugli",Msg::kInfo) << "UgliGeometry::VldRange: UgliDbiSteelPln" 
00897                           << "                 \r" << flush;
00898    DbiResultPtr<UgliDbiSteelPln> steelTbl(vldc);
00899    TrimVldRange("UgliDbiSteelPln",steelTbl.GetValidityRec());
00900 
00901    MSG("Ugli",Msg::kInfo) << "UgliGeometry::VldRange: UgliDbiScintPlnStruct" 
00902                           << "                 \r" << flush;
00903    DbiResultPtr<UgliDbiScintPlnStruct> scintStructTbl(vldc);
00904    TrimVldRange("UgliDbiScintPlnStruct",scintStructTbl.GetValidityRec());
00905 
00906    MSG("Ugli",Msg::kInfo) << "UgliGeometry::VldRange: UgliDbiScintPln" 
00907                           << "                 \r" << flush;
00908    DbiResultPtr<UgliDbiScintPln> scintTbl(vldc);
00909    TrimVldRange("UgliDbiScintPln",scintTbl.GetValidityRec());
00910 
00911    MSG("Ugli",Msg::kInfo) << "UgliGeometry::VldRange: UgliDbiScintMdlStruct" 
00912                           << "                 \r" << flush;
00913    DbiResultPtr<UgliDbiScintMdlStruct> mdlStructTbl(vldc);
00914    TrimVldRange("UgliDbiScintMdlStruct",mdlStructTbl.GetValidityRec());
00915 
00916    MSG("Ugli",Msg::kInfo) << "UgliGeometry::VldRange: UgliDbiScintMdl" 
00917                           << "                 \r" << flush;
00918    DbiResultPtr<UgliDbiScintMdl> mdlTbl(vldc);
00919    TrimVldRange("UgliDbiScintMdl",mdlTbl.GetValidityRec());
00920 
00921    MSG("Ugli",Msg::kInfo) << "UgliGeometry::VldRange: UgliDbiStripStruct" 
00922                           << "                 \r" << flush;
00923    DbiResultPtr<UgliDbiStripStruct> stripStructTbl(vldc);
00924    TrimVldRange("UgliDbiStripStruct",stripStructTbl.GetValidityRec());
00925 
00926    MSG("Ugli",Msg::kInfo) << "UgliGeometry::VldRange: UgliDbiStrip" 
00927                           << "                 \r" << flush;
00928    DbiResultPtr<UgliDbiStrip> stripTbl(vldc);
00929    TrimVldRange("UgliDbiStrip",stripTbl.GetValidityRec());
00930 
00931    MSG("Ugli",Msg::kInfo) << "UgliGeometry::VldRange: done         " << endl;
00932 
00933 
00934 }

void UgliGeometry::ClearDbiCache ( const VldContext vldc  )  [protected, virtual]

Definition at line 937 of file UgliGeometry.cxx.

References fAlgorithmic, DbiTableProxy::GetCache(), UgliLoanPool::Instance(), Msg::kDebug, MSG, DbiCache::Purge(), and DbiResultPtr< T >::TableProxy().

Referenced by BuildAll().

00938 {
00939    // Clear DBI cache of elements
00940 
00941    MSG("Ugli",Msg::kDebug) << "UgliGeometry::ClearDbiCache " << endl;
00942 
00943    // nothing to purge if we were algorithmic
00944    if (fAlgorithmic) return;
00945 
00946    // have we been configured not to do the purge?
00947    if ( ! UgliLoanPool::Instance()->PurgeDbiTableCache() ) return;
00948 
00949    // purge the cache on the tables we've used
00950 
00951    DbiCache* steelTblCache = 0;
00952    DbiCache* scintStructTblCache = 0;
00953    DbiCache* scintTblCache = 0;
00954    DbiCache* mdlStructTblCache = 0;
00955    DbiCache* mdlTblCache = 0;
00956    DbiCache* stripStructTblCache = 0;
00957    DbiCache* stripTblCache = 0;
00958 
00959    { 
00960       //
00961       // start of inner scope so that DbiResultPtr's will die, die, die
00962       // and thus Purge will see no remaining clients
00963       //
00964       
00965 
00966       MSG("Ugli",Msg::kDebug) << "UgliGeometry::GetCache: UgliDbiSteelPln" 
00967                               << "                 \r" << flush;
00968       DbiResultPtr<UgliDbiSteelPln> steelTbl(vldc);
00969       steelTblCache = steelTbl.TableProxy().GetCache();
00970 
00971       MSG("Ugli",Msg::kDebug) << "UgliGeometry::GetCache: UgliDbiScintPlnStruct" 
00972                               << "                 \r" << flush;
00973       DbiResultPtr<UgliDbiScintPlnStruct> scintStructTbl(vldc);
00974       scintStructTblCache = scintStructTbl.TableProxy().GetCache();
00975 
00976       MSG("Ugli",Msg::kDebug) << "UgliGeometry::GetCache: UgliDbiScintPln" 
00977                               << "                 \r" << flush;
00978       DbiResultPtr<UgliDbiScintPln> scintTbl(vldc);
00979       scintTblCache = scintTbl.TableProxy().GetCache();
00980 
00981       MSG("Ugli",Msg::kDebug) << "UgliGeometry::GetCache: UgliDbiScintMdlStruct" 
00982                               << "                 \r" << flush;
00983       DbiResultPtr<UgliDbiScintMdlStruct> mdlStructTbl(vldc);
00984       mdlStructTblCache = mdlStructTbl.TableProxy().GetCache();
00985 
00986       MSG("Ugli",Msg::kDebug) << "UgliGeometry::GetCache: UgliDbiScintMdl" 
00987                               << "                 \r" << flush;
00988       DbiResultPtr<UgliDbiScintMdl> mdlTbl(vldc);
00989       mdlTblCache = mdlTbl.TableProxy().GetCache();
00990 
00991       MSG("Ugli",Msg::kDebug) << "UgliGeometry::GetCache: UgliDbiStripStruct" 
00992                               << "                 \r" << flush;
00993       DbiResultPtr<UgliDbiStripStruct> stripStructTbl(vldc);
00994       stripStructTblCache = stripStructTbl.TableProxy().GetCache();
00995 
00996 
00997       MSG("Ugli",Msg::kDebug) << "UgliGeometry::GetCache: UgliDbiStrip" 
00998                               << "                 \r" << flush;
00999       DbiResultPtr<UgliDbiStrip> stripTbl(vldc);
01000       stripTblCache = stripTbl.TableProxy().GetCache();
01001 
01002       MSG("Ugli",Msg::kDebug) << "UgliGeometry::GetCache: done         " << endl;
01003    }
01004 
01005    // now there should be no active clients we can now purge 
01006    // to our heart's content
01007 
01008    MSG("Ugli",Msg::kDebug) << "UgliGeometry::PurgeCache: UgliDbiSteelPln" 
01009                            << "                 \r" << flush;
01010    if (steelTblCache) steelTblCache->Purge();
01011 
01012    MSG("Ugli",Msg::kDebug) << "UgliGeometry::PurgeCache: UgliDbiScintPlnStruct" 
01013                            << "                 \r" << flush;
01014    if (scintStructTblCache) scintStructTblCache->Purge();
01015 
01016    MSG("Ugli",Msg::kDebug) << "UgliGeometry::PurgeCache: UgliDbiScintPln" 
01017                            << "                 \r" << flush;
01018    if (scintTblCache) scintTblCache->Purge();
01019 
01020    MSG("Ugli",Msg::kDebug) << "UgliGeometry::PurgeCache: UgliDbiScintMdlStruct" 
01021                            << "                 \r" << flush;
01022    if (mdlStructTblCache) mdlStructTblCache->Purge();
01023 
01024    MSG("Ugli",Msg::kDebug) << "UgliGeometry::PurgeCache: UgliDbiScintMdl" 
01025                            << "                 \r" << flush;
01026    if (mdlTblCache) mdlTblCache->Purge();
01027 
01028    MSG("Ugli",Msg::kDebug) << "UgliGeometry::PurgeCache: UgliDbiStripStruct" 
01029                            << "                 \r" << flush;
01030    if (stripStructTblCache) stripStructTblCache->Purge();
01031 
01032 
01033    MSG("Ugli",Msg::kDebug) << "UgliGeometry::PurgeCache: UgliDbiStrip" 
01034                            << "                 \r" << flush;
01035    if (stripTblCache) stripTblCache->Purge();
01036 
01037    MSG("Ugli",Msg::kDebug) << "UgliGeometry::PurgeCache: done         " << endl;
01038    
01039 
01040 }

void UgliGeometry::Draw ( Option_t *  option = ""  )  [virtual]

Reimplemented from UgliGeomABC.

Definition at line 463 of file UgliGeometry.cxx.

References fRootGeom, GetTransverseExtent(), GetZExtent(), Msg::kInfo, PlaneView::kU, PlaneView::kV, and MSG.

Referenced by UgliGeomHandle::Draw().

00464 {
00465    // draw this geometry
00466 
00467    MSG("Ugli",Msg::kInfo) << "UgliGeometry::Draw()" << endl;
00468 
00469    // placment, size (in pixels)
00470    TCanvas *uglicanvas = new TCanvas("ugli","ugli",200,10,700,700);
00471    // xymin, xymax, color, bordersize, bordermode
00472    TPad *uglipad = new TPad("ugli","ugli",0.02,0.02,0.98,0.98,0);
00473    uglipad->Draw();
00474    uglipad->cd();
00475 
00476    // create a view to assocate with the pad
00477 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,3)
00478    TView *ugliview = new TView3D(1,0,0);
00479 #else
00480    TView *ugliview = new TView(1);
00481 #endif
00482    //              front   top  side  weird
00483    Float_t phi   =  90; // 90   180     60
00484    Float_t theta = 180; // 90    90    150
00485    Float_t psi   =   0; // 90    90    170
00486 
00487    ugliview->SetLongitude(phi);
00488    ugliview->SetLatitude(theta);
00489    ugliview->SetPsi(psi);
00490 
00491    Float_t zmin, zmax;
00492    Float_t t[4];
00493 
00494    GetZExtent(zmin,zmax);
00495    GetTransverseExtent(PlaneView::kU,t[0],t[1]);
00496    GetTransverseExtent(PlaneView::kV,t[2],t[3]);
00497 
00498    for (Int_t i=0; i<4; i++) t[i] = TMath::Abs(t[i]);
00499    Int_t   imax = TMath::LocMax(4,t);
00500 
00501    // sqrt(2) to account for possible UV rotation space
00502    Float_t tsize = TMath::Sqrt(2.) * t[imax];
00503 
00504    Float_t x0 = 0;
00505    Float_t y0 = 0;
00506    Float_t z0 = 0.5*(zmin+zmax);
00507 
00508    Float_t dz  = 0.5*(zmax-zmin);
00509    ugliview->SetRange(x0-tsize,y0-tsize,z0-dz,x0+tsize,y0+tsize,z0+dz);
00510 
00511    // Display UgliGeometry
00512    fRootGeom->Draw("same");
00513 
00514    uglicanvas->Update();
00515 }

TVector3 UgliGeometry::GetHallExtentMax (  )  const [virtual]

Implements UgliGeomABC.

Definition at line 844 of file UgliGeometry.cxx.

References fRootGeom, Msg::kInfo, and MSG.

Referenced by UgliGeomHandle::GetHallExtentMax().

00845 {
00846   // return the min {x,y,z} of the detector hall
00847 
00848   TNodeX* hallnode  = dynamic_cast<TNodeX*>(fRootGeom->GetNode("hall"));
00849   TShape* hallshape = hallnode->GetShape();
00850   TBRIK*  hallbrik  = dynamic_cast<TBRIK*>(hallshape);
00851   if (!hallbrik) {
00852     MSG("Ugli",Msg::kInfo)
00853       << "UgliGeometry::GetHallExtentMax() hall is not a BRIK " << endl;
00854     return TVector3(+9999.,+9999.,+9999.);
00855   }
00856   TVector3 xyz0(hallnode->GetX(), hallnode->GetY(), hallnode->GetZ());
00857   TVector3 dxyz(hallbrik->GetDx(),hallbrik->GetDy(),hallbrik->GetDz());
00858   TVector3 result = xyz0 + dxyz;
00859   return result;
00860 }

TVector3 UgliGeometry::GetHallExtentMin (  )  const [virtual]

Implements UgliGeomABC.

Definition at line 824 of file UgliGeometry.cxx.

References fRootGeom, Msg::kInfo, and MSG.

Referenced by UgliGeomHandle::GetHallExtentMin().

00825 {
00826   // return the min {x,y,z} of the detector hall
00827 
00828   TNodeX* hallnode  = dynamic_cast<TNodeX*>(fRootGeom->GetNode("hall"));
00829   TShape* hallshape = hallnode->GetShape();
00830   TBRIK*  hallbrik  = dynamic_cast<TBRIK*>(hallshape);
00831   if (!hallbrik) {
00832     MSG("Ugli",Msg::kInfo)
00833       << "UgliGeometry::GetHallExtentMin() hall is not a BRIK " << endl;
00834     return TVector3(-9999.,-9999.,-9999.);
00835   }
00836   TVector3 xyz0(hallnode->GetX(), hallnode->GetY(), hallnode->GetZ());
00837   TVector3 dxyz(hallbrik->GetDx(),hallbrik->GetDy(),hallbrik->GetDz());
00838   TVector3 result = xyz0 - dxyz;
00839   return result;
00840 
00841 }

UgliGeometry::EMINFStatus UgliGeometry::GetMINFStatus (  )  const [protected, virtual]

Reimplemented in UgliGeometryReroot.

Definition at line 155 of file UgliGeometry.cxx.

References kNotNeeded.

Referenced by UgliLoanPool::BuildUgliGeometry().

00156 { return UgliGeometry::kNotNeeded; }

UgliSteelPlnNode * UgliGeometry::GetNearestSteelPlnNode ( Double_t  z  )  const [virtual]

Definition at line 1535 of file UgliGeometry.cxx.

References BinarySearchNearestLarger(), fZSteelPlnMidPoint, UgliSteelPlnNode::GetHalfThickness(), GetSteelPlnNodePtrVector(), UgliSteelPlnNode::GetZ0(), Msg::kError, and MSG.

Referenced by UgliGeomHandle::GetNearestSteelPlnHandle().

01536 {
01537    // Return the UgliSteelPlnNode* that is nearest to the given z position.
01538   
01539 
01540    const std::vector<UgliSteelPlnNode*>& steelNodes = 
01541      GetSteelPlnNodePtrVector();
01542    size_t nplns = steelNodes.size();
01543 
01544    // deal with some special cases
01545    if ( nplns == 0) {
01546      // no steel, no luck!
01547      MSG("Ugli",Msg::kError)
01548        << "GetNearestSteelPlnNode was passed 0 UgliSteelPlnNode's"
01549        << endl;
01550      return 0;
01551    }
01552    else if ( nplns == 1 ) return steelNodes[0];  // only one plane, that's it!
01553 
01554 
01555    if ( fZSteelPlnMidPoint.empty() ) {
01556      // we'll just assume vector of steel pln's is ordered in z
01557      // and also plane #.  Each entry is the mid-point z between
01558      // two steel planes faces (zMid is above the plane # with the same index)
01559      UgliSteelPlnNode* steelNode = steelNodes[0];
01560      Double_t dz        = steelNode->GetHalfThickness();
01561      Double_t z0        = steelNode->GetZ0();
01562      Double_t zDownSide = z0 - dz;
01563      Double_t zUpSide   = z0 + dz;
01564      for ( size_t indx = 1; indx < nplns; ++indx ) {
01565        Double_t zUpSideLast = zUpSide;
01566        UgliSteelPlnNode* steelNode = steelNodes[indx];
01567        dz        = steelNode->GetHalfThickness();
01568        z0        = steelNode->GetZ0();
01569        zDownSide = z0 - dz;
01570        zUpSide   = z0 + dz;
01571        Double_t zMid = 0.5 * ( zUpSideLast + zDownSide );
01572        fZSteelPlnMidPoint.push_back(zMid);
01573        /*
01574        int prec = cout.precision();
01575        cout << setprecision(18);
01576        cout << "Midpoint between " << (indx-1) << " and " << indx
01577             << " " << steelNode->GetPlexPlaneId().AsString("C") 
01578             << " z_mid = " << zMid
01579             << resetiosflags(ios::floatfield)  // reset to "%g" format
01580             << setprecision(prec) // restore precision
01581             << endl;
01582        */
01583      }
01584    }  // fZSteelPlnMidPoint is filled
01585 
01586    size_t index = BinarySearchNearestLarger(fZSteelPlnMidPoint,z);
01587    return steelNodes[index];
01588    
01589 }

TNode * UgliGeometry::GetNode ( const char *  name  )  const [inline, virtual]

Definition at line 155 of file UgliGeometry.h.

References fRootGeom.

00156 { return fRootGeom->GetNode(name); }

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

Implements UgliGeomABC.

Definition at line 1502 of file UgliGeometry.cxx.

References fPlaneTable, UgliPlnNode::GetHalfThickness(), PlexPlaneId::GetPlaneView(), UgliPlnNode::GetPlexPlaneId(), UgliPlnNode::GetZ0(), PlaneView::kA, PlaneView::kB, PlaneView::kUnknown, and RestorePlaneTable().

Referenced by UgliGeomHandle::GetPlaneIdFromZ().

01503 {
01504   // Return the PlexPlaneId for the last (normal) plane 
01505   // with a back face *downstream* of z
01506 
01507   // For now do it the dumb way with a simple loop
01508   // eventually optimization can use a binary search
01509 
01510   // make sure that the map is filled (may have been lost in persistency)
01511   RestorePlaneTable(true);
01512 
01513   nodeRevItr_t node_itr = fPlaneTable.rbegin();
01514   nodeRevItr_t node_end = fPlaneTable.rend();
01515   UgliPlnNode *uplane = 0, *prev_uplane = 0;
01516   for ( ; node_itr != node_end ; ++node_itr ) {
01517     uplane = node_itr->second;
01518     PlexPlaneId plnid  = uplane->GetPlexPlaneId();
01519     PlaneView::PlaneView_t view = plnid.GetPlaneView();
01520     // continue looking if this plane has a kA or kB view (CalDet)
01521     // or if veto shield view (FarDet)
01522     // "unknown" is okay because that means uninstrumented plane    
01523     if (view == PlaneView::kA || view == PlaneView::kB) continue;
01524     if (view > PlaneView::kUnknown ) continue;
01525     Float_t zback = uplane->GetZ0() + uplane->GetHalfThickness();
01526     if ( ! prev_uplane ) prev_uplane = uplane;
01527     if ( z > zback ) return prev_uplane->GetPlexPlaneId();
01528     prev_uplane = uplane;
01529   }
01530   return uplane->GetPlexPlaneId();
01531 
01532 }

const vector< UgliPlnNode * > & UgliGeometry::GetPlnNodePtrVector (  )  const

Definition at line 442 of file UgliGeometry.cxx.

References fAllPlnNodes, and fPlaneTable.

Referenced by UgliGeomHandle::GetPlnHandleVector().

00443 {
00444    // return collection of ptrs for all plane nodes in detector
00445 
00446    if (fAllPlnNodes.empty()) {
00447    
00448      nodeItr_t node_itr = fPlaneTable.begin();
00449      nodeItr_t node_end = fPlaneTable.end();
00450    
00451      while (node_itr != node_end) {
00452        nodePair_t map_pair = *node_itr;
00453        UgliPlnNode* plnNode = map_pair.second;
00454        if (plnNode) fAllPlnNodes.push_back(plnNode);
00455        node_itr++;
00456      }
00457    }
00458 
00459    return fAllPlnNodes;
00460 }

TRotMatrix * UgliGeometry::GetRotMatrix ( const char *  name  )  const [inline, virtual]

Definition at line 149 of file UgliGeometry.h.

References fRootGeom.

Referenced by UgliStripNode::SetZRotRelMdlRad().

00150 { return fRootGeom->GetRotMatrix(name); }

UgliScintPlnNode * UgliGeometry::GetScintPlnNode ( PlexPlaneId  planeid  )  const [virtual]

Definition at line 177 of file UgliGeometry.cxx.

References PlexPlaneId::AsString(), PlexVetoShieldHack::ConvertRangeToContext(), fCachedScintPlnId, fCachedScintPlnNode, fPlaneTable, fRootGeom, PlexPlaneId::GetDetector(), TNodeX::GetNodeToDepth(), PlexPlaneId::GetPlaneCoverage(), GetVldRange(), PlexPlaneId::IsSteel(), PlexPlaneId::IsVetoShield(), Msg::kError, Detector::kFar, Msg::kInfo, PlaneCoverage::kNoActive, MSG, PlexVetoShieldHack::RenumberMuxToMdl(), RestorePlaneTable(), and PlexPlaneId::SetIsSteel().

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

00178 {
00179    // get a node for a particular scint plane
00180 
00181    fRootGeom->cd();
00182    TNodeX* hallnode = dynamic_cast<TNodeX*>(fRootGeom->GetNode("hall"));
00183    if (!hallnode) {
00184       static int nmsg = 5;
00185       if (nmsg) {
00186          MSG("Ugli",Msg::kError) 
00187             << "GetScintPlnNode found no hall node" << endl;
00188          nmsg--;
00189          if (nmsg==0) {
00190            MSG("Ugli",Msg::kError) << "  ... last of these warnings" << endl;
00191          }
00192       }
00193       return 0;
00194    }
00195    hallnode->cd();
00196 
00197    // ensure that plane id passed in didn't have the wrong setting for IsSteel
00198    PlexPlaneId scintplnid(planeid);
00199    if (scintplnid.IsSteel()) {
00200       static Int_t nmsg = 2;
00201       if (nmsg>0) {
00202          MSG("Ugli",Msg::kError) 
00203             << "::GetScintPlnNode passed steel plane id " 
00204             << planeid.AsString("c") << endl;
00205          nmsg--;
00206          if (nmsg==0) {
00207            MSG("Ugli",Msg::kInfo)  << " ... last message " << endl;
00208          }
00209       }
00210       scintplnid.SetIsSteel(kFALSE);
00211       //rwh:
00212       assert(0);
00213    }
00214 
00215    // convert FarDet veto shield id's into one-module-per-plane #'s
00216    if (scintplnid.GetDetector() == Detector::kFar && 
00217        scintplnid.IsVetoShield()) {
00218      VldContext vldc = 
00219        PlexVetoShieldHack::ConvertRangeToContext(GetVldRange());
00220      scintplnid = PlexVetoShieldHack::RenumberMuxToMdl(vldc,scintplnid);
00221    }
00222 
00223    if (scintplnid.GetPlaneCoverage() == PlaneCoverage::kNoActive) {
00224      static int msglimit = 20; // give up after 20 messages
00225      if (msglimit) {
00226        MSG("Ugli",Msg::kError)
00227          << "::GetScintPlnNode impossible for "
00228          << scintplnid.AsString("c")
00229          << ", THERE IS NO SCINTILLATOR!"
00230          << endl;
00231        if (--msglimit == 0) {
00232          MSG("Ugli",Msg::kError) << " ... last warning of this type" << endl;
00233        }
00234      }
00235      //rwh: assert(0);
00236      return 0;
00237    }
00238 
00239    // optimization under the assumption that we'll get multiple
00240    // sequential requests for same plane (on way to getting individual
00241    // strips presumably)
00242    if (fCachedScintPlnId == scintplnid) return fCachedScintPlnNode;
00243 
00244    UgliScintPlnNode* the_node =
00245 #ifdef USENODETODEPTH
00246       dynamic_cast<UgliScintPlnNode*>(hallnode->GetNodeToDepth(scintplnid.AsString("p"),1));
00247 #else
00248    //rwh:      dynamic_cast<UgliScintPlnNode*>(fPlaneTable[scintplnid]);
00249    0;
00250    // use lookup without possibility of insertion side effect
00251    typedef std::map<PlexPlaneId,UgliPlnNode*>::const_iterator planeTableItr_t;
00252    planeTableItr_t pt_itr = fPlaneTable.find(scintplnid);
00253    if (pt_itr != fPlaneTable.end()) 
00254      the_node = dynamic_cast<UgliScintPlnNode*>(pt_itr->second);
00255    if ( ! the_node ) {
00256      // perhaps the fPlaneTable needs to be refreshed
00257      RestorePlaneTable(false);
00258      pt_itr = fPlaneTable.find(scintplnid);
00259      if (pt_itr != fPlaneTable.end()) 
00260        the_node = dynamic_cast<UgliScintPlnNode*>(pt_itr->second);
00261    }
00262 #endif
00263    if ( ! the_node ) {
00264       MSG("Ugli",Msg::kError)
00265          << "GetScintPlnNode could not find pre-constructed plane " 
00266          << scintplnid.AsString("c") 
00267          << " in " << fRootGeom->GetName() << endl;
00268       the_node = 0; // new UgliScintPlnNode(this,scintplnid);
00269       // sometimes this happens when veto shield electronics were read out
00270       // before the actual scintillator was installed.
00271       //rwh: assert(0);
00272    }
00273 
00274    // update cache of this request
00275    fCachedScintPlnId   = scintplnid;
00276    fCachedScintPlnNode = the_node;
00277 
00278    return the_node;
00279 }

const vector< UgliScintPlnNode * > & UgliGeometry::GetScintPlnNodePtrVector (  )  const

Definition at line 395 of file UgliGeometry.cxx.

References fPlaneTable, and fScintPlnNodes.

Referenced by UgliGeomHandle::GetScintPlnHandleVector().

00396 {
00397    // return collection of ptrs for all scint plane nodes in detector
00398 
00399    if (fScintPlnNodes.empty()) {
00400    
00401      nodeItr_t node_itr = fPlaneTable.begin();
00402      nodeItr_t node_end = fPlaneTable.end();
00403    
00404      while (node_itr != node_end) {
00405        nodePair_t map_pair = *node_itr;
00406        UgliScintPlnNode* scintPlnNode =
00407          dynamic_cast<UgliScintPlnNode*>(map_pair.second);
00408        if (scintPlnNode) 
00409          fScintPlnNodes.push_back(scintPlnNode);
00410        node_itr++;
00411      }
00412    }
00413 
00414    return fScintPlnNodes;
00415 }

TShape * UgliGeometry::GetShape ( const char *  name  )  const [inline, virtual]

Definition at line 152 of file UgliGeometry.h.

References fRootGeom.

Referenced by UgliStripNode::UgliStripNode().

00153 { return fRootGeom->GetShape(name); }

UgliSteelPlnNode * UgliGeometry::GetSteelPlnNode ( PlexPlaneId  planeid  )  const [virtual]

Definition at line 282 of file UgliGeometry.cxx.

References PlexPlaneId::AsString(), fCachedSteelPlnId, fCachedSteelPlnNode, fPlaneTable, fRootGeom, TNodeX::GetNodeToDepth(), PlexPlaneId::IsSteel(), Msg::kError, Msg::kInfo, Msg::kWarning, MSG, RestorePlaneTable(), and PlexPlaneId::SetIsSteel().

Referenced by UgliGeomHandle::GetSteelPlnHandle().

00283 {
00284    // get a node for a particular scint plane
00285 
00286    fRootGeom->cd();
00287    TNodeX* hallnode = dynamic_cast<TNodeX*>(fRootGeom->GetNode("hall"));
00288    if (!hallnode) {
00289       static int nmsg = 5;
00290       if (nmsg) {
00291          MSG("Ugli",Msg::kError) 
00292             << "GetSteelPlnNode found no hall node" << endl;
00293          nmsg--;
00294          if (nmsg==0) {
00295            MSG("Ugli",Msg::kError) << "  ... last of these warnings" << endl;
00296          }
00297       }
00298       return 0;
00299    }
00300    hallnode->cd();
00301 
00302    // ensure that plane id passed in didn't have the wrong setting for IsSteel
00303    PlexPlaneId steelplnid(planeid);
00304    if (!steelplnid.IsSteel()) {
00305       static Int_t nmsg = 2;
00306       if (nmsg>0) {
00307          MSG("Ugli",Msg::kWarning) 
00308             << "::GetSteelPlnNode passed scint plane id " 
00309             << planeid.AsString("c") << endl;
00310          nmsg--;
00311          if (nmsg==0) {
00312            MSG("Ugli",Msg::kInfo) << " ... last message " << endl;
00313          }
00314       }
00315       steelplnid.SetIsSteel(kTRUE);
00316       //rwh:
00317       assert(0);
00318    }
00319 
00320    // optimization under the assumption that we'll get multiple
00321    // sequential requests for same plane 
00322    if (fCachedSteelPlnId == steelplnid) return fCachedSteelPlnNode;
00323 
00324    UgliSteelPlnNode* the_node = 
00325 #ifdef USENODETODEPTH
00326       dynamic_cast<UgliSteelPlnNode*>(hallnode->GetNodeToDepth(steelplnid.AsString("p"),1));
00327 #else
00328    //rwh:      dynamic_cast<UgliSteelPlnNode*>(fPlaneTable[steelplnid]);
00329    0;
00330    // use lookup without possibility of insertion side effect
00331    typedef std::map<PlexPlaneId,UgliPlnNode*>::const_iterator planeTableItr_t;
00332    planeTableItr_t pt_itr = fPlaneTable.find(steelplnid);
00333    if ( pt_itr != fPlaneTable.end() )
00334      the_node = dynamic_cast<UgliSteelPlnNode*>(pt_itr->second);
00335    if ( ! the_node ) {
00336      // perhaps the fPlaneTable needs to be refreshed
00337      RestorePlaneTable(false);
00338      pt_itr = fPlaneTable.find(steelplnid);
00339      if ( pt_itr != fPlaneTable.end() )
00340        the_node = dynamic_cast<UgliSteelPlnNode*>(pt_itr->second);
00341    }
00342 #endif
00343    if ( ! the_node ) {
00344       MSG("Ugli",Msg::kError)
00345          << "GetSteelPlnNode could not find pre-constructed plane " 
00346          << steelplnid 
00347          << " in " << fRootGeom->GetName() << endl;
00348       the_node = 0; // new UgliSteelPlnNode(this,steelplnid);
00349    }
00350 
00351    // update cache of this request
00352    fCachedSteelPlnId   = steelplnid;
00353    fCachedSteelPlnNode = the_node;
00354 
00355    return the_node;
00356 }

const vector< UgliSteelPlnNode * > & UgliGeometry::GetSteelPlnNodePtrVector (  )  const

Definition at line 418 of file UgliGeometry.cxx.

References fNormalSteelNodes, fPlaneTable, UgliSteelPlnNode::GetPlexPlaneId(), and PlexPlaneId::IsVetoShield().

Referenced by GetNearestSteelPlnNode(), and UgliGeomHandle::GetSteelPlnHandleVector().

00419 {
00420    // Return collection of ptrs for all steel plane nodes in detector
00421    // Exclude FarDet Veto Shield pseudo-planes
00422 
00423    if (fNormalSteelNodes.empty()) {
00424 
00425      nodeItr_t node_itr = fPlaneTable.begin();
00426      nodeItr_t node_end = fPlaneTable.end();
00427    
00428      while (node_itr != node_end) {
00429        nodePair_t map_pair = *node_itr;
00430        UgliSteelPlnNode* steelPlnNode =
00431          dynamic_cast<UgliSteelPlnNode*>(map_pair.second);
00432        if (steelPlnNode && !steelPlnNode->GetPlexPlaneId().IsVetoShield()) 
00433          fNormalSteelNodes.push_back(steelPlnNode);
00434        node_itr++;
00435      }
00436    }
00437 
00438    return fNormalSteelNodes;
00439 }

UgliStripNode * UgliGeometry::GetStripNode ( PlexStripEndId  seid  )  const [virtual]

Definition at line 359 of file UgliGeometry.cxx.

References PlexVetoShieldHack::ConvertRangeToContext(), fRootGeom, PlexPlaneId::GetDetector(), GetScintPlnNode(), UgliScintPlnNode::GetStripNode(), GetVldRange(), PlexPlaneId::IsVetoShield(), Msg::kError, Detector::kFar, MSG, and PlexVetoShieldHack::RenumberMuxToMdl().

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

00360 {
00361    // get a node for a particular strip
00362 
00363    fRootGeom->cd();
00364    TNodeX* hallnode = dynamic_cast<TNodeX*>(fRootGeom->GetNode("hall"));
00365    if (!hallnode) {
00366       static int nmsg = 5;
00367       if (nmsg) {
00368          MSG("Ugli",Msg::kError) 
00369             << "GetStripNode found no hall node" << endl;
00370          nmsg--;
00371          if (nmsg==0) {
00372            MSG("Ugli",Msg::kError) << "  ... last of these warnings" << endl;
00373          }
00374       }
00375       return 0;
00376    }
00377    hallnode->cd();
00378 
00379    PlexStripEndId geom_seid = seid;
00380    // convert FarDet veto shield id's into one-module-per-plane #'s
00381    if (geom_seid.GetDetector() == Detector::kFar && 
00382        geom_seid.IsVetoShield()) {
00383      VldContext vldc = 
00384        PlexVetoShieldHack::ConvertRangeToContext(GetVldRange());
00385      geom_seid = PlexVetoShieldHack::RenumberMuxToMdl(vldc,geom_seid);
00386    }
00387 
00388    UgliScintPlnNode* the_plane = GetScintPlnNode(geom_seid);
00389    if (!the_plane) return 0;
00390 
00391    return the_plane->GetStripNode(geom_seid);
00392 }

TGeometryX * UgliGeometry::GetTGeometryX (  )  const [inline, virtual]
TNodeX * UgliGeometry::GetTNodeX ( const char *  name  )  const [inline, virtual]

Definition at line 158 of file UgliGeometry.h.

References fRootGeom.

Referenced by UgliScintPlnNode::UgliScintPlnNode(), and UgliSteelPlnNode::UgliSteelPlnNode().

00159 { return dynamic_cast<TNodeX*>(fRootGeom->GetNode(name)); }

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

Definition at line 606 of file UgliGeometry.cxx.

References bfld::AsString(), Munits::cm, fVldRange, VldRange::GetDetectorMask(), Detector::kCalib, Msg::kError, Detector::kFar, Detector::kNear, PlaneView::kU, PlaneView::kV, and MSG.

00608 {
00609   // Return extent based on detector type and view
00610   // *** bad form *** currently simple hard coded values!!
00611 
00612    // the VldRange describing this geometry should only have on bit set
00613    Detector::Detector_t detector = 
00614       (Detector::Detector_t) fVldRange.GetDetectorMask();
00615 
00616    switch (detector) {
00617    case Detector::kNear:
00618       switch (view) {
00619       case PlaneView::kU:
00620          tmin = -210. * Munits::cm;
00621          tmax = +275. * Munits::cm;      
00622          break;
00623       case PlaneView::kV:
00624          tmin = -275. * Munits::cm;
00625          tmax = +210. * Munits::cm;      
00626          break;
00627       default:
00628       MSG("Ugli",Msg::kError)
00629          << "UgliGeometry::GetTransverseExtent undefined for "
00630          << Detector::AsString(detector) << " view " 
00631          << PlaneView::AsString(view) << endl;
00632       break;
00633       }
00634    case Detector::kFar:
00635       tmin = -400. * Munits::cm;
00636       tmax = +400. * Munits::cm;
00637       break;
00638    case Detector::kCalib:
00639       tmin = -50. * Munits::cm;
00640       tmax = +50. * Munits::cm;
00641       break;
00642    default:
00643       MSG("Ugli",Msg::kError)
00644          << "UgliGeometry::GetTransverseExtent undefined for "
00645          << Detector::AsString(detector) << endl;
00646       break;
00647    }
00648 
00649 #ifdef OLDFUZZ
00650    Float_t fuzz_abs  = 10. * Munits::cm;
00651    Float_t fuzz_frac = 0.025;
00652 #else
00653    Float_t fuzz_abs  = 0.5 * 4.1 * Munits::cm;
00654    Float_t fuzz_frac = 0.0;
00655 #endif
00656    Float_t extra_per_side = 0.5*(tmax-tmin)*fuzz_frac;
00657 
00658    tmin = tmin - fuzz_abs - extra_per_side;
00659    tmax = tmax + fuzz_abs + extra_per_side;
00660 
00661 
00662 }

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

Implements UgliGeomABC.

Definition at line 594 of file UgliGeometry.cxx.

Referenced by Draw(), and UgliGeomHandle::GetTransverseExtent().

00596 {
00597   // Return extent based on detector type and view
00598 
00599   Double_t tmind, tmaxd;
00600   GetTransverseExtent(view,tmind,tmaxd);
00601   tmin = (Float_t)tmind;
00602   tmax = (Float_t)tmaxd;
00603 }

const VldRange& UgliGeometry::GetVldRange (  )  const [inline, virtual]
void UgliGeometry::GetZExtent ( Double_t &  zmin,
Double_t &  zmax,
Int_t  isuper = -1 
) const [virtual]

Definition at line 678 of file UgliGeometry.cxx.

References bfld::AsString(), VldRange::AsString(), Munits::cm, det, fPlaneTable, fVldRange, VldRange::GetDetectorMask(), UgliPlnNode::GetHalfThickness(), PlexPlaneId::GetPlaneCoverage(), PlexPlaneId::GetPlaneView(), UgliPlnNode::GetPlexPlaneId(), UgliPlnNode::GetZ0(), PlaneView::kA, PlaneView::kB, Detector::kCalDet, Msg::kDebug, Msg::kError, Detector::kFar, Detector::kNear, PlaneCoverage::kNoActive, PlaneView::kU, PlaneView::kV, Msg::kWarning, Munits::m, MSG, and RestorePlaneTable().

00679 {
00680   // Return z extent
00681   // if isuper == -1 for whole detector
00682   // otherwise by supermodule (not yet supported)
00683 
00684   // the VldRange describing this geometry should only have on bit set
00685   Detector::Detector_t det = 
00686     (Detector::Detector_t) fVldRange.GetDetectorMask();
00687 
00688   // protect against case where DBI built no planes
00689   RestorePlaneTable(true);
00690   if ( fPlaneTable.empty() ) {
00691     MSG("Ugli",Msg::kWarning)
00692       << "GetZExtent() No planes found." << endl
00693       << "   Perhaps this geometry was built with a bad VldContext" << endl
00694       << "   or the database lacked an appropriate table" << endl
00695       << fVldRange.AsString()
00696       << endl;
00697     
00698     Float_t spacing = 5.94*Munits::cm;
00699     
00700     switch (det) {
00701     case Detector::kNear:
00702       zmin =       -5.0*spacing;
00703       zmax = (float)282*spacing +  20.*Munits::cm + 5.0*spacing;
00704       break;
00705     case Detector::kCalDet:
00706       zmin =       -5.0*spacing;
00707       zmax =  (float)60*spacing +  20.*Munits::cm + 5.0*spacing;
00708       break;
00709     case Detector::kFar:
00710       zmin =       -5.0*spacing;
00711       zmax = (float)484*spacing + 125.*Munits::cm + 5.0*spacing;
00712       break;
00713     default:
00714       zmin = -5.0*spacing;
00715       zmax = 60*Munits::m;
00716       break;
00717     }
00718     // no real info ... return a guess
00719     return;
00720   }
00721 
00722   // Assumes that fPlaneTable is generally in z order
00723   // with the exception of CalDet cosmics and FarDet veto shield modules
00724   
00725   UgliPlnNode* upln_beg = fPlaneTable.begin()->second; // easy
00726 
00727   UgliPlnNode* upln_end = 0;
00728   // last "reasonable" plane needs to discount CalDet floor planes
00729   // and FarDet veto planes.  Work from the highest plane # down
00730   // until we get a reasonable view.
00731   nodeRevItr_t node_ritr = fPlaneTable.rbegin();
00732   nodeRevItr_t node_rend = fPlaneTable.rend();
00733   for ( ; node_ritr != node_rend ; ++node_ritr ) {
00734     upln_end          = node_ritr->second;
00735     PlexPlaneId plnid = upln_end->GetPlexPlaneId();
00736     PlaneView::PlaneView_t view = plnid.GetPlaneView();
00737     // continue looking if this plane has a kA or kB view (CalDet)
00738     // or stop if it finds a kU or kV view (esp. for Far w/ VetoShield)
00739     if (det == Detector::kCalDet){
00740       if (view != PlaneView::kA && view != PlaneView::kB) break;
00741     }
00742     else {
00743       if (view == PlaneView::kU || view == PlaneView::kV) break;
00744     }
00745   }
00746 
00747   if ( -1 != isuper ) {
00748     if ( Detector::kFar != det ) {
00749       MSG("Ugli",Msg::kError)
00750         << "UgliGeometry::GetZExtent does not support supermodules "
00751         << "other than -1 for " << Detector::AsString(det)
00752         << endl << "   return value for whole detector" << endl;
00753     }
00754     else {
00755       // look for intermediate uninstrumented plane
00756       // assumes only 2 super modules in far detector
00757 
00758       UgliPlnNode* upln_mid0 = upln_beg;  // just before uninstrumented
00759       UgliPlnNode* upln_mid1 = upln_beg;  // uninstrumented plane
00760 
00761       nodeItr_t node_itr = fPlaneTable.begin();
00762       nodeItr_t node_end = fPlaneTable.end();
00763 
00764       node_itr++; // move beyond first plane
00765       
00766       for ( ; node_itr != node_end ; node_itr++ ) {
00767         upln_mid0 = upln_mid1;
00768         upln_mid1 = node_itr->second;
00769         if (upln_mid1 == upln_end) {
00770           MSG("Ugli",Msg::kWarning)
00771             << "GetZExtent found no SM break for this geometry "
00772             << fVldRange << endl;
00773           upln_mid0 = upln_end;
00774           break; // reached the end, there isn't one
00775         }
00776         PlexPlaneId plnid = upln_mid1->GetPlexPlaneId();
00777         PlaneCoverage::PlaneCoverage_t cover = plnid.GetPlaneCoverage();
00778         if (cover == PlaneCoverage::kNoActive) break;
00779       }
00780       switch (isuper) {
00781       case 0:
00782         MSG("Ugli",Msg::kDebug)
00783           << " SM 0 upln_end set to upln_mid0" << endl;
00784         upln_end = upln_mid0;  // last before uninstrumented plane
00785         break;
00786       case 1:
00787         MSG("Ugli",Msg::kDebug)
00788           << " SM 1 upln_beg set to upln_mid1" << endl;
00789         upln_beg = upln_mid1;  // leading steel plane
00790         break;
00791       default:
00792         MSG("Ugli",Msg::kError)
00793           << "GetZExtent" << endl << " FarDet only has SM 0 and 1"
00794           << ", return value for whole detector." << endl;
00795       }
00796 
00797     } // FarDet
00798   } // specific SM
00799 
00800   zmin = upln_beg->GetZ0() - upln_beg->GetHalfThickness();
00801   MSG("Ugli",Msg::kDebug)
00802     << "GetZExtent first was " << upln_beg->GetPlexPlaneId() 
00803     << " Z0 " << upln_beg->GetZ0() << " - dz " << upln_beg->GetHalfThickness()
00804     << endl;
00805 
00806   zmax = upln_end->GetZ0() + upln_end->GetHalfThickness();
00807   MSG("Ugli",Msg::kDebug)
00808     << "GetZExtent last  was " << upln_end->GetPlexPlaneId() 
00809     << " Z0 " << upln_end->GetZ0() << " + dz " << upln_end->GetHalfThickness()
00810     << endl;
00811 
00812 #ifdef OLDFUZZ
00813    Float_t fuzz_abs  = 10. * Munits::cm;
00814    Float_t fuzz_frac = 0.025;
00815    Float_t extra_per_side = 0.5*(zmax-zmin)*fuzz_frac;
00816 
00817    zmin = zmin - fuzz_abs - extra_per_side;
00818    zmax = zmax + fuzz_abs + extra_per_side;
00819 #endif
00820 
00821 }

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

Implements UgliGeomABC.

Definition at line 665 of file UgliGeometry.cxx.

Referenced by Draw(), and UgliGeomHandle::GetZExtent().

00666 {
00667   // Return z extent
00668   // if isuper == -1 for whole detector
00669   // otherwise by supermodule (not yet supported)
00670 
00671   Double_t zmind, zmaxd;
00672   GetZExtent(zmind,zmaxd,isuper);
00673   zmin = (Float_t)zmind;
00674   zmax = (Float_t)zmaxd;
00675 }

Bool_t UgliGeometry::IsAlgorithmic (  )  const [inline]

Definition at line 70 of file UgliGeometry.h.

References fAlgorithmic.

Referenced by UgliLoanPool::Config(), UgliGeomHandle::IsAlgorithmic(), and UgliGeometry().

00070 { return fAlgorithmic; }

Bool_t UgliGeometry::IsCompatible ( const VldContext vldc  ) 

Definition at line 168 of file UgliGeometry.cxx.

References fVldRange, and VldRange::IsCompatible().

00169 {
00170    // check compatibility of this plex with a context
00171 
00172    return fVldRange.IsCompatible(vldc);
00173 
00174 }

Bool_t UgliGeometry::IsCompatible ( const VldContext vldc  ) 

Definition at line 159 of file UgliGeometry.cxx.

References fVldRange, and VldRange::IsCompatible().

Referenced by UgliLoanPool::GetExistingUgliGeometry().

00160 {
00161    // check compatibility of this plex with a context
00162 
00163    return fVldRange.IsCompatible(vldc);
00164 
00165 }

Bool_t UgliGeometry::IsFrozen (  )  const [inline]
void UgliGeometry::ls ( Option_t *  option = "rsn5"  )  const [virtual]

Reimplemented from UgliGeomABC.

Definition at line 531 of file UgliGeometry.cxx.

References fRootGeom.

Referenced by UgliGeomHandle::ls().

00532 {
00533    // list components of this geometry
00534 
00535    fRootGeom->ls(option);
00536 }

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

Reimplemented from UgliGeomABC.

Definition at line 518 of file UgliGeometry.cxx.

References VldRange::AsString(), UgliRefCnt::CountRef(), fRootGeom, fVldRange, Nav::GetName(), Msg::kInfo, and MSG.

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

00519 {
00520    // print something about this geometry (name + ref counts + vldrange)
00521 
00522    MSG("Ugli",Msg::kInfo)
00523      << "  " << TObject::GetName() 
00524      << " has " << CountRef() << " references " << endl
00525      << "    " << fVldRange.AsString("a") << endl;
00526    MSG("Ugli",Msg::kInfo)
00527      << "    fRootGeom \"" << fRootGeom->GetName() << "\"" << endl;
00528 }

void UgliGeometry::RestorePlaneTable ( bool  onlyIfEmpty = true  )  const [protected, virtual]

Definition at line 1043 of file UgliGeometry.cxx.

References fPlaneTable, fRootGeom, UgliPlnNode::GetPlexPlaneId(), Msg::kDebug, Msg::kVerbose, and MSG.

Referenced by GetPlaneIdFromZ(), GetScintPlnNode(), GetSteelPlnNode(), GetZExtent(), and UgliLoanPool::ReadFromFile().

01044 {
01045   // Restore map of PlexPlaneId's to UgliPlnNode*'s
01046   // The contents of this might have been lost during persistency
01047   // (as of 2003-04-30 it couldn't correctly be written out)
01048   // If "onlyIfEmpty" do it only if the map is empty.
01049 
01050   if ( onlyIfEmpty && ! fPlaneTable.empty() ) return; // nothing to do
01051 
01052   MSG("Ugli",Msg::kDebug) << "UgliGeometry::RestorePlaneTable " << endl;
01053 
01054   fRootGeom->cd();
01055   TNodeX* hallnode = dynamic_cast<TNodeX*>(fRootGeom->GetNode("hall"));
01056 
01057   // loop over the nodes in the hall ... these should be planes
01058   TIter nodeInHallItr(hallnode->GetListOfNodes());
01059   TNode* nodeInHall = 0;
01060   while ( ( nodeInHall = dynamic_cast<TNode*>(nodeInHallItr()) ) ) {
01061     // these are markers and boxes containing scint+steel planes
01062     MSG("Ugli",Msg::kVerbose) 
01063       << " found " << nodeInHall->GetName() << " in hall " << endl;
01064     TIter nodeInBoxItr(nodeInHall->GetListOfNodes());
01065     TObject* nodeInBox = 0;
01066     while ( ( nodeInBox = nodeInBoxItr() ) ) {
01067       // these should be the actual planes
01068       MSG("Ugli",Msg::kVerbose) 
01069         << " found " << nodeInBox->GetName() 
01070         << " in " << nodeInHall->GetName()<< endl;
01071       UgliPlnNode* upn = dynamic_cast<UgliPlnNode*>(nodeInBox);
01072       if (upn) {
01073         fPlaneTable[upn->GetPlexPlaneId()] = upn;
01074         MSG("Ugli",Msg::kDebug) 
01075           << "UgliGeometry::RestorePlaneTable add " 
01076           << upn->GetPlexPlaneId() << endl;
01077       }
01078     }
01079   }
01080   
01081 
01082 }

void UgliGeometry::SetFrozen ( Bool_t  frozen  )  [protected]

Definition at line 539 of file UgliGeometry.cxx.

References VldRange::AsString(), fFrozen, fRootGeom, and fVldRange.

Referenced by UgliLoanPool::BuildUgliGeometry().

00540 {
00541   // setting frozen/modifiable must modify fRootGeom's name as well
00542   // to keep it unique
00543   fFrozen = frozen;
00544   if (fRootGeom) {
00545      TString name = (frozen?"Frozen":"Modifiable");
00546      name += fVldRange.AsString("s1ac-");
00547      fRootGeom->SetName(name.Data());
00548   }
00549 }

void UgliGeometry::TrimVldRange ( const char *  tblName = "",
const DbiValidityRec dbivrec = 0 
) [protected]

Definition at line 1592 of file UgliGeometry.cxx.

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

Referenced by BuildStripShapes(), and BuildVldRange().

01594 { 
01595    // Trim VldRange based on DbiValidityRec range info
01596 
01597    if (dbivrec) {
01598       fVldRange.TrimTo(dbivrec->GetVldRange());
01599    } else {
01600       MSG("Ugli",Msg::kWarning) 
01601          << "No DbiValidityRec for table " << tblName << endl;
01602    }
01603 }


Friends And Related Function Documentation

friend class UgliLoanPool [friend]

Reimplemented in UgliGeometryReroot.

Definition at line 42 of file UgliGeometry.h.


Member Data Documentation

Bool_t UgliGeometry::fAlgorithmic [protected]

Definition at line 103 of file UgliGeometry.h.

Referenced by BuildNodes(), BuildVldRange(), ClearDbiCache(), IsAlgorithmic(), and UgliGeometry().

std::vector<UgliPlnNode*> UgliGeometry::fAllPlnNodes [mutable, protected]

ref copy

Definition at line 117 of file UgliGeometry.h.

Referenced by GetPlnNodePtrVector().

ref copy

Definition at line 111 of file UgliGeometry.h.

Referenced by GetScintPlnNode().

Definition at line 112 of file UgliGeometry.h.

Referenced by GetScintPlnNode().

ref copy (can't i/o)

Definition at line 109 of file UgliGeometry.h.

Referenced by GetSteelPlnNode().

Definition at line 110 of file UgliGeometry.h.

Referenced by GetSteelPlnNode().

Bool_t UgliGeometry::fFrozen [protected]

Definition at line 102 of file UgliGeometry.h.

Referenced by IsFrozen(), and SetFrozen().

std::vector<UgliSteelPlnNode*> UgliGeometry::fNormalSteelNodes [mutable, protected]

ref copy

Definition at line 116 of file UgliGeometry.h.

Referenced by GetSteelPlnNodePtrVector().

std::map<PlexPlaneId,UgliPlnNode*> UgliGeometry::fPlaneTable [mutable, protected]
std::vector<UgliScintPlnNode*> UgliGeometry::fScintPlnNodes [mutable, protected]

ref copy

Definition at line 115 of file UgliGeometry.h.

Referenced by GetScintPlnNodePtrVector().

std::vector<Double_t> UgliGeometry::fZSteelPlnMidPoint [mutable, protected]

ref copy

Definition at line 118 of file UgliGeometry.h.

Referenced by GetNearestSteelPlnNode().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1