UgliLoanPool Class Reference

#include <UgliLoanPool.h>

Inheritance diagram for UgliLoanPool:
CfgConfigurable

List of all members.

Classes

struct  Cleaner

Public Member Functions

virtual void Config ()
virtual const RegistryDefaultConfig () const
virtual void SetConfigFromEnvironment ()
bool DoesValidGeomExist (const VldContext &vldc, Ugli::EModifyMode mmode=Ugli::kUseGlobal, Geo::EAppType=Geo::kRecons)
void ClearPool (Bool_t frozen, Bool_t modifiable)
bool PurgeDbiTableCache () const
void SetUseGeo (Bool_t flag=kTRUE)
bool UseGeo () const
void SetUseNewCavern (Bool_t flag=kTRUE)
bool GetUseNewCavern () const
void SetLeadStacks (Bool_t flag=kTRUE)
bool GetLeadStacks () const
void SetMinervaVersion (int version=-1)
int GetMinervaVersion () const
Geo::ESwimMethod GetSwimMethodLowField () const
Geo::ESwimMethod GetSwimMethodHighField () const
void SetSwimMethodLowField (Geo::ESwimMethod swimmethod)
void SetSwimMethodHighField (Geo::ESwimMethod swimmethod)
void SetMedium (Geo::EDetComponent detcomp, const char *medName)
const char * GetMedium (Geo::EDetComponent detcomp) const
void SetShieldOff (Bool_t flag=kTRUE)
bool GetShieldOff () const
void SetProcess (UtilMCFlag::EProcess process, Int_t processvalue, const char *medname)
void SetCut (UtilMCFlag::ECut cut, Double_t cutvalue, const char *medname)
void SetTracking (UtilMCFlag::ETracking trk, Double_t trkvalue, const char *medname)
Registry GetMediumRegistry (const char *medName) const
virtual void Print (Option_t *option="") const
 UgliLoanPool ()

Static Public Member Functions

static void SetAlwaysUseDbi (Bool_t flag=kTRUE)
static Bool_t GetAlwaysUseDbi ()
static UgliLoanPoolInstance ()
static void SaveToFile (const char *filename, bool recreate=true)
static void ReadFromFile (const char *filename)

Private Member Functions

 UgliLoanPool (const UgliLoanPool &plp)
virtual ~UgliLoanPool ()
UgliGeometryGetUgliGeometry (const VldContext &vldc, Bool_t frozen)
UgliGeometryGetExistingUgliGeometry (const VldContext &vldc, Bool_t frozen)
UgliGeometryBuildUgliGeometry (const VldContext &vldc, Bool_t frozen)
GeoGeometryGetGeoGeometry (const VldContext &vldc, Bool_t frozen, Geo::EAppType apptype)
GeoGeometryGetExistingGeoGeometry (const VldContext &vldc, Bool_t frozen, Geo::EAppType apptype)
GeoGeometryBuildGeoGeometry (const VldContext &vldc, Bool_t frozen, Geo::EAppType apptype)

Private Attributes

TObjArray fFrozenUgliGeomList
TObjArray fModifiableUgliGeomList
TObjArray fFrozenGeoGeomList
TObjArray fModifiableGeoGeomList
Int_t fMaxUnref
bool fUseGeo

Static Private Attributes

static UgliLoanPoolfgInstance = 0

Friends

class UgliGeomHandle
struct Cleaner

Detailed Description

Definition at line 28 of file UgliLoanPool.h.


Constructor & Destructor Documentation

UgliLoanPool::UgliLoanPool (  ) 

Definition at line 553 of file UgliLoanPool.cxx.

References fFrozenGeoGeomList, fFrozenUgliGeomList, fgInstance, fModifiableGeoGeomList, fModifiableUgliGeomList, Msg::kSynopsis, Msg::kWarning, and MSG.

00554   : fMaxUnref(dfltMaxUnused),fUseGeo(true)
00555 {
00556    // Default ctor -- called by self only
00557 
00558    if (fgInstance && fgInstance != this) {
00559      MSG("Ugli",Msg::kWarning)
00560        << "UgliLoanPool ctor() called but global already exists"
00561        << " -- memory leak (existing one will be lost)"
00562        << endl;
00563    }
00564    fgInstance = this;
00565 
00566    MSG("Ugli",Msg::kSynopsis) << "UgliLoanPool ctor" << endl;
00567 
00568    fFrozenUgliGeomList.SetOwner(true);
00569    fModifiableUgliGeomList.SetOwner(true);
00570    fFrozenGeoGeomList.SetOwner(true);
00571    fModifiableGeoGeomList.SetOwner(true);
00572    
00573 }

UgliLoanPool::UgliLoanPool ( const UgliLoanPool plp  )  [private]

Definition at line 576 of file UgliLoanPool.cxx.

References Msg::kFatal, and MSG.

00577   : TObject(plp), CfgConfigurable(plp)
00578 {
00579    // copy constuctor should never get called
00580    MSG("Ugli",Msg::kFatal) << 
00581                "UgliLoanPool copy constructor called" << endl;
00582    assert(0);
00583 }

UgliLoanPool::~UgliLoanPool (  )  [private, virtual]

Definition at line 586 of file UgliLoanPool.cxx.

References ClearPool(), Registry::Get(), CfgConfigurable::GetConfig(), Registry::KeyExists(), Msg::kInfo, Msg::kSynopsis, MSG, and SaveToFile().

00587 {
00588   // Destroy UgliLoanPool
00589   // Write out to Cache first (if requested)
00590 
00591   MSG("Ugli",Msg::kSynopsis) << "UgliLoanPool shutdown" << endl;
00592 
00593   Registry& r = GetConfig();
00594   if ( r.KeyExists("Cache") ) {
00595     const char* cache_location = "";
00596     if ( r.Get("Cache",cache_location) && strlen(cache_location) ) {
00597       int dowrite = true;
00598       if ( ! r.Get("CacheWrite",dowrite) ) {
00599         MSG("Ugli",Msg::kInfo)
00600           << "UgliLoanPool not configured for 'CacheWrite', assume "
00601           << dowrite << "." << endl;
00602       }
00603       if (dowrite) {
00604         MSG("Ugli",Msg::kInfo) 
00605           << "UgliLoanPool writing file " 
00606           << cache_location << " ..." << flush;
00607         UgliLoanPool::SaveToFile(cache_location);
00608         MSG("Ugli",Msg::kInfo) << " done" << endl;
00609       }
00610     }
00611   }
00612 
00613   // delete all the owned sub-objects
00614   ClearPool(true,true);
00615 
00616 }


Member Function Documentation

GeoGeometry * UgliLoanPool::BuildGeoGeometry ( const VldContext vldc,
Bool_t  frozen,
Geo::EAppType  apptype 
) [private]

Definition at line 869 of file UgliLoanPool.cxx.

References bfld::AsString(), Msg::kDebug, Msg::kFatal, Msg::kVerbose, and MSG.

Referenced by GetGeoGeometry().

00872 {
00873    // Build a GeoGeometry for specified vld and application type
00874 
00875    GeoGeometry *geoGeometry = 0;
00876    if ( !frozen ) {
00877      MSG("Ugli",Msg::kFatal) << "Geo modifiable geometries not supported yet." 
00878                              << endl;
00879      abort();
00880    }
00881    
00882    MSG("Ugli",Msg::kVerbose) 
00883      << "BuildGeoGeometry for: " << vldc
00884      << " for apptype " << Geo::AsString(apptype) << "." << endl;
00885 
00886    if (!geoGeometry) {
00887       MSG("Ugli",Msg::kDebug) 
00888          << "BuildGeoGeometry vldc "
00889          << vldc << " app type " << Geo::AsString(apptype) << "." << endl;
00890       geoGeometry = new GeoGeometry(vldc,apptype);
00891    }
00892 
00893    return geoGeometry;
00894 }

UgliGeometry * UgliLoanPool::BuildUgliGeometry ( const VldContext vldc,
Bool_t  frozen 
) [private]

Definition at line 802 of file UgliLoanPool.cxx.

References bfld::AsString(), GetAlwaysUseDbi(), UgliGeometry::GetMINFStatus(), VldContext::GetSimFlag(), Msg::kDebug, Msg::kFatal, UgliGeometry::kNotThere, SimFlag::kReroot, Msg::kVerbose, Msg::kWarning, MSG, UgliGeometry::SetFrozen(), and UgliGeometry::UgliGeometry().

Referenced by GetUgliGeometry().

00804 {
00805    // Fake up a UgliGeometry from where ever
00806 
00807    UgliGeometry *ugliGeometry = 0;
00808 
00809    MSG("Ugli",Msg::kVerbose)
00810      << "BuildUgliGeometry SimFlag=" << SimFlag::AsString(vldc.GetSimFlag())
00811      << " AlwaysUseDbi=" << (GetAlwaysUseDbi()?"true":"false") << endl << endl;
00812 
00813    if (vldc.GetSimFlag() == SimFlag::kReroot && !GetAlwaysUseDbi()) {
00814       // remove circular dependency by using RTTI-like info
00815       // for UgliGeometryReroot default ctor picks up vldc from RerootExodus
00816       //was: ugliGeometry = new UgliGeometryReroot(vldc);
00817 
00818       static bool first = true;
00819       if (first) {
00820          first = false;
00821          gROOT->LoadClass("UgliGeometryReroot","libUgliGeometry.so");
00822       }
00823       void *ptr = gROOT->GetClass("UgliGeometryReroot",kTRUE)->New();
00824       if (!ptr) {
00825          MSG("Ugli",Msg::kFatal)
00826             <<  "BuildUgliGeometry failed to instantiate UgliGeometryReroot "
00827             << vldc << endl;
00828          assert(0);
00829       }
00830 
00831       MSG("Ugli",Msg::kDebug)
00832          << "BuildUgliGeometry vldc "
00833          << vldc << " (REROOT)" << endl;
00834 
00835       // can't dynamic_cast void* pointers
00836       //    ugliGeometry = dynamic_cast<UgliGeometryReroot*>(ptr);
00837       //    ugliGeometry = dynamic_cast<UgliGeometry *>(ptr);
00838       // UgliGeometryReroot isn't know to be a base type for UgliGeometry
00839       //    ugliGeometry = (UgliGeometryReroot *)(ptr);
00840       ugliGeometry = (UgliGeometry *)(ptr);
00841       if (ugliGeometry->GetMINFStatus() == UgliGeometry::kNotThere) {
00842          // perhaps this data is from a written out "streams file"
00843          // rather than an old REROOT file
00844          MSG("Ugli",Msg::kWarning)
00845             << "UgliGeometryReroot constructed " << endl
00846             << "   but there is no gMINFast, revert to using DBI version"
00847             << endl;
00848          delete ugliGeometry;
00849          ugliGeometry = 0;
00850       }
00851    }
00852 
00853    if (!ugliGeometry) {
00854       MSG("Ugli",Msg::kDebug)
00855          << "BuildUgliGeometry vldc "
00856          << vldc << " (std)" << endl;
00857       ugliGeometry = new UgliGeometry(vldc,frozen);
00858    }
00859 
00860    // we do this after-the-fact because we can't pass this into
00861    // the ctor of UgliGeometryReroot in the above scheme
00862    ugliGeometry->SetFrozen(frozen);
00863 
00864    return ugliGeometry;
00865 }

void UgliLoanPool::ClearPool ( Bool_t  frozen,
Bool_t  modifiable 
)

Definition at line 524 of file UgliLoanPool.cxx.

References fFrozenGeoGeomList, fFrozenUgliGeomList, fModifiableGeoGeomList, and fModifiableUgliGeomList.

Referenced by ~UgliLoanPool().

00525 {
00526 
00527    //LeaMemMonitor::PrintMemStat("Before UgliLoanPool::ClearPool");
00528    if ( frozen ) {     
00529      fFrozenUgliGeomList.Delete();
00530      fFrozenGeoGeomList.Delete();
00531    }
00532    if ( modifiable ) {
00533      fModifiableUgliGeomList.Delete();
00534      fModifiableGeoGeomList.Delete();
00535    }
00536    //LeaMemMonitor::PrintMemStat("After UgliLoanPool::ClearPool");
00537 }

void UgliLoanPool::Config ( void   )  [virtual]

Implements CfgConfigurable.

Definition at line 366 of file UgliLoanPool.cxx.

References bfld::AsString(), ClusterType::CharToEnum(), det, fMaxUnref, fUseGeo, Registry::Get(), CfgConfigurable::GetConfig(), UgliGeometry::IsAlgorithmic(), UgliDbiTables::IsCutOnPlnInstall(), Msg::kDebug, Msg::kInfo, MSG, UgliDbiTables::SetAlgorithmic(), and UgliDbiTables::SetCutOnPlnInstall().

00367 {
00368   //  Reconfigure after internal registry update.
00369 
00370   MSG("Ugli",Msg::kDebug) << "UgliLoanPool::Config " << endl;
00371 
00372   Registry& r = GetConfig();
00373   // r.Print();
00374 
00375   int tmpi;
00376   if (r.Get("MaxUnref",tmpi)) fMaxUnref = tmpi;
00377   if (r.Get("UseGeo",tmpi)) fUseGeo = tmpi;
00378   
00379   const char* dets[] = { "Near","Far","CalDet"};
00380   char itemnameAlg[1024];
00381   char itemnameCut[1024];
00382 
00383   for (unsigned int i=0; i<sizeof(dets)/sizeof(char*); ++i) {
00384 
00385     sprintf(itemnameAlg,"Algorithmic%s",dets[i]);
00386     MSG("Ugli",Msg::kDebug)
00387       << "lookup in Config's registry for " << itemnameAlg << endl;
00388     if (r.Get(itemnameAlg,tmpi)) {
00389       Detector::Detector_t det = 
00390         Detector::CharToEnum(dets[i][0]);
00391       // actual set flag only if it's different from current value
00392       bool new_setting = tmpi;
00393       bool current_setting = UgliDbiTables::IsAlgorithmic(det);
00394       if (new_setting != current_setting) {
00395         MSG("Ugli",Msg::kInfo)
00396           << "Set Algorithmic geometry for " << Detector::AsString(det)
00397           << " to " << (tmpi?"true":"false") << endl;
00398         UgliDbiTables::SetAlgorithmic(det,tmpi);
00399       }
00400     }
00401 
00402     sprintf(itemnameCut,"CutOnPlnInstall%s",dets[i]);
00403     MSG("Ugli",Msg::kDebug)
00404       << "lookup in Config's registry for " << itemnameCut << endl;
00405     if (r.Get(itemnameCut,tmpi)) {
00406       Detector::Detector_t det = 
00407         Detector::CharToEnum(dets[i][0]);
00408       // actual set flag only if it's different from current value
00409       bool new_setting = tmpi;
00410       bool current_setting = UgliDbiTables::IsCutOnPlnInstall(det);
00411       if (new_setting != current_setting) {
00412         MSG("Ugli",Msg::kDebug)
00413           << "Set CutOnPlnInstall geometry for " << Detector::AsString(det)
00414           << " to " << (tmpi?"true":"false") << endl;
00415         UgliDbiTables::SetCutOnPlnInstall(det,tmpi);
00416       }
00417     }
00418 
00419   }
00420 
00421 }

const Registry & UgliLoanPool::DefaultConfig ( void   )  const [virtual]

Reimplemented from CfgConfigurable.

Definition at line 424 of file UgliLoanPool.cxx.

References dfltMaxUnused, Nav::GetName(), Geo::kNoFieldSwim, Geo::kRungeKutta, Registry::LockKeys(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

Referenced by Instance().

00425 {
00426   //======================================================================
00427   // The default configuration for this framework component
00428   //======================================================================
00429   int itrue  = 1; // Work around for Registry's lack of bool
00430   int ifalse = 0; // Work around for Registry's lack of bool
00431   static Registry r;
00432   
00433   std::string name = this->GetName();
00434   name += ".config.default";
00435   r.SetName(name.c_str());
00436   
00437   r.UnLockValues();
00438   r.Set("AlwaysUseDbi",          1);
00439   r.Set("MaxUnref",              dfltMaxUnused);
00440   r.Set("UseGeo",                itrue);
00441   r.Set("UseNewCavern",          ifalse);
00442   r.Set("LeadStacks",            itrue);
00443   r.Set("MinervaVersion",        0);
00444   r.Set("ShieldOff",             ifalse);
00445   r.Set("SwimMethodHighField",   Geo::kRungeKutta);
00446   r.Set("SwimMethodLowField",    Geo::kNoFieldSwim);
00447   r.Set("Cache",                 "");        // use no cache by default
00448   r.Set("CacheWrite",            itrue);     // if cache used, write at job end
00449   r.Set("AlgorithmicNear",       ifalse);
00450   r.Set("AlgorithmicFar",        ifalse);
00451   r.Set("AlgorithmicCalDet",     ifalse);
00452   r.Set("CutOnPlnInstallNear",   ifalse);    // worry about keeping up
00453   r.Set("CutOnPlnInstallFar",    itrue);     // construction complete!
00454 //r.Set("CutOnPlnInstallFar",    ifalse);    // table isn't complete! (veto)
00455   r.Set("CutOnPlnInstallCalDet", ifalse);    // no entries
00456   // how to apply cut to MC
00457   //   0=no cut, 1=use MC table, 2=force use of Data table
00458   r.Set("CutAppliesToMC",        0);         // don't apply cut to MC
00459   r.Set("CutAppliesToVetoShield",ifalse);    // don't apply cut to VetoShield
00460   r.Set("CutMsgLevel",           "Synopsis"); // MsgLevel to report cuts at
00461   r.Set("PurgeDbiTableCache",    itrue);     // purge Dbi cache when geom built
00462   r.Set("MediumMap", Registry()); // empty registry 
00463 
00464   r.LockValues();
00465   r.LockKeys();
00466   
00467   return r;
00468 
00469 }

bool UgliLoanPool::DoesValidGeomExist ( const VldContext vldc,
Ugli::EModifyMode  mmode = Ugli::kUseGlobal,
Geo::EAppType  apptype = Geo::kRecons 
)

Definition at line 494 of file UgliLoanPool.cxx.

References Ugli::GetDefaultModifyMode(), GetExistingGeoGeometry(), GetExistingUgliGeometry(), Ugli::kFrozen, Ugli::kModifiable, Ugli::kUseGlobal, and UseGeo().

Referenced by UgliGeomHandle::DoesValidGeomExist().

00497 {
00498    // testing if ctor of UgliGeomHandle will construct a new geometry
00499 
00500    Bool_t use_frozen = true;
00501    switch (mmode) {
00502    case (Ugli::kModifiable): use_frozen = false; break;
00503    case (Ugli::kFrozen):     use_frozen = true;  break;
00504    case (Ugli::kUseGlobal): 
00505       use_frozen = true;
00506       if (Ugli::kModifiable == 
00507           Ugli::GetDefaultModifyMode()) use_frozen = false;
00508       break;
00509    }
00510 
00511    if ( !UseGeo() ) {
00512      UgliGeometry *geom = GetExistingUgliGeometry(vldc,use_frozen);
00513      if ( geom ) return true;
00514    }
00515    else {
00516      GeoGeometry* geom = GetExistingGeoGeometry(vldc,use_frozen,apptype);
00517      if ( geom ) return true;
00518    }
00519    
00520    return false;
00521 }

Bool_t UgliLoanPool::GetAlwaysUseDbi (  )  [static]

Definition at line 56 of file UgliLoanPool.cxx.

References Registry::Get(), CfgConfigurable::GetConfig(), and Instance().

Referenced by BuildUgliGeometry().

00057 {
00058   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00059   int tmpi = 1;
00060   r.Get("AlwaysUseDbi",tmpi);
00061   return tmpi;
00062 }

GeoGeometry * UgliLoanPool::GetExistingGeoGeometry ( const VldContext vldc,
Bool_t  frozen,
Geo::EAppType  apptype 
) [private]

Definition at line 769 of file UgliLoanPool.cxx.

References fFrozenGeoGeomList, fModifiableGeoGeomList, GeoGeometry::IsCompatible(), Msg::kVerbose, and MSG.

Referenced by DoesValidGeomExist(), and GetGeoGeometry().

00771 {
00772    // Find the right GeoGeometry if it exists
00773 
00774    GeoGeometry *geom = 0;
00775    
00776    // geometry should come from or be placed in one of
00777    // the two lists
00778    TObjArray*   geomList = &fFrozenGeoGeomList;
00779    if (!frozen) geomList = &fModifiableGeoGeomList;
00780 
00781    // look in the current shared or writable list
00782    // iterate from the back as that is what was added most recently
00783    // and thus most likely what we want
00784    TObjArrayIter iter(geomList,kIterBackward);
00785    // search the current list
00786    MSG("Ugli",Msg::kVerbose) << "look for Geo match to VldContext " 
00787                              << vldc << " and apptype " << apptype << endl;
00788    while ( ( geom = dynamic_cast<GeoGeometry *>(iter.Next()) ) ) {
00789       // check if it is compatible
00790       if ( geom->IsCompatible(vldc,apptype) ) {
00791          // create another handle to this GeoGeometry
00792          MSG("Ugli",Msg::kVerbose) << 
00793             "GetGeoGeometry returned found handle " << endl;
00794          return geom;
00795       }
00796    }
00797    return 0; // found nothing appropriate
00798 }

UgliGeometry * UgliLoanPool::GetExistingUgliGeometry ( const VldContext vldc,
Bool_t  frozen 
) [private]

Definition at line 737 of file UgliLoanPool.cxx.

References fFrozenUgliGeomList, fModifiableUgliGeomList, UgliGeometry::IsCompatible(), Msg::kVerbose, and MSG.

Referenced by DoesValidGeomExist(), and GetUgliGeometry().

00739 {
00740    // Find the right UgliGeometry if it exists
00741 
00742    UgliGeometry *geom = 0;
00743 
00744    // geometry should come from or be placed in one of
00745    // the two lists
00746    TObjArray*   geomList = &fFrozenUgliGeomList;
00747    if (!frozen) geomList = &fModifiableUgliGeomList;
00748 
00749    // look in the current shared or writable list
00750    // iterate from the back as that is what was added most recently
00751    // and thus most likely what we want
00752    TObjArrayIter iter(geomList,kIterBackward);
00753    // search the current list
00754    MSG("Ugli",Msg::kVerbose) << "look for match to VldContext " 
00755                              << vldc << endl;
00756    while ( ( geom = dynamic_cast<UgliGeometry *>(iter.Next()) ) ) {
00757       // check if it is compatible
00758       if ( geom->IsCompatible(vldc) ) {
00759          // create another handle to this UgliGeometry
00760          MSG("Ugli",Msg::kVerbose) << 
00761             "GetUgliGeometry returned found handle " << endl;
00762          return geom;
00763       }
00764    }
00765    return 0; // found nothing appropriate
00766 }

GeoGeometry * UgliLoanPool::GetGeoGeometry ( const VldContext vldc,
Bool_t  frozen,
Geo::EAppType  apptype 
) [private]

Definition at line 678 of file UgliLoanPool.cxx.

References bfld::AsString(), BuildGeoGeometry(), GeoRefCnt::CountRef(), fFrozenGeoGeomList, fMaxUnref, fModifiableGeoGeomList, GetExistingGeoGeometry(), Msg::kFatal, Msg::kVerbose, and MSG.

Referenced by UgliGeomHandle::ResetVldContext(), and UgliGeomHandle::UgliGeomHandle().

00680 {
00681    // Find (or create) the right GeoGeometry to give to a handle
00682    GeoGeometry *geom = GetExistingGeoGeometry(vldc,frozen,apptype);
00683    if (geom) return geom;
00684 
00685    // nothing appropriate, choose one of the managed lists
00686    // geometry should be placed in
00687    TObjArray*   geomList = &fFrozenGeoGeomList;
00688    if (!frozen) geomList = &fModifiableGeoGeomList;
00689 
00690    // first count the # of (other) unreferenced geoms
00691    GeoGeometry *other_geom = 0;
00692    Int_t todelete = -fMaxUnref;
00693    TObjArrayIter iter_cnt(geomList);
00694    while ( ( other_geom = (GeoGeometry *)iter_cnt.Next() ) ) {
00695       if ( other_geom->CountRef() <= 0 ) todelete++;
00696    }
00697    // if more unreferenced geometries than desired clean them out
00698    // iterate from the front (default) so oldest get cleaned out first
00699    if (todelete > 0) {
00700       TObjArrayIter iter_rm(geomList);
00701       while ( ( other_geom = (GeoGeometry *)iter_rm.Next() ) && 
00702               todelete > 0 ) {
00703          if ( other_geom->CountRef() <= 0 ) {
00704             geomList->Remove(other_geom);
00705             delete other_geom;
00706             todelete--;
00707          }
00708       }
00709       // remove the spaces we freed up
00710       geomList->Compress();
00711       MSG("Ugli",Msg::kVerbose) 
00712          << "GetGeoGeometry removed old unref'd geoms" << endl;
00713    }
00714 
00715    // no valid GeoGeometry available need to build one
00716    geom = BuildGeoGeometry(vldc,frozen,apptype);
00717    if ( !geom) {
00718       MSG("Ugli",Msg::kFatal)
00719         << "UgliLoanPool failed to build GeoGeometry for:\n" << vldc
00720         << " apptype " << Geo::AsString(apptype) << "." << endl;
00721       assert(geom);
00722    }
00723 
00724    // append this new geometry into the list
00725    MSG("Ugli",Msg::kVerbose) 
00726       << "GetGeoGeometry returned created new "
00727       << ((frozen)? "frozen" : "modifiable")
00728       << " GeoGeometry for:\n" << vldc << " apptype "  
00729       << Geo::AsString(apptype) << "." << endl;
00730    geomList->AddLast(geom);
00731 
00732    return geom;
00733 
00734 }

bool UgliLoanPool::GetLeadStacks (  )  const

Definition at line 135 of file UgliLoanPool.cxx.

References Registry::Get(), CfgConfigurable::GetConfig(), and Instance().

00136 {
00137   // Used to retrieve LeadStacks flag
00138   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00139   int leadstacks = 0;
00140   if ( r.Get("LeadStacks",leadstacks) ) return leadstacks;
00141   return true;
00142 }

const char * UgliLoanPool::GetMedium ( Geo::EDetComponent  detcomp  )  const

Definition at line 227 of file UgliLoanPool.cxx.

References bfld::AsString(), Geo::AsString(), Registry::Get(), CfgConfigurable::GetConfig(), Instance(), Msg::kError, and MSG.

Referenced by GeoMediumMap::SetMedium().

00228 {
00229   // Used to retrieve medium for specified detector component if configured
00230   // by user.  Returns empty string if not found.
00231   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00232   Registry mediumMap;
00233   if ( !r.Get("MediumMap",mediumMap) ) {
00234     MSG("Ugli",Msg::kError) << "GetMedium for det component "
00235                             << Geo::AsString(detcomp) << " failed due to "
00236                             << "missing MediumMap registry." << endl;
00237     return "";
00238   }
00239   const char* tmps;
00240   if ( mediumMap.Get(Geo::AsString(detcomp),tmps) ) 
00241                              return std::string(tmps).c_str();
00242 
00243   return ""; // null if no entry in map
00244 
00245 }

Registry UgliLoanPool::GetMediumRegistry ( const char *  medName  )  const

Definition at line 323 of file UgliLoanPool.cxx.

References Registry::Get(), CfgConfigurable::GetConfig(), and Instance().

Referenced by GeoMediumMap::ConfigureMedium().

00323                                                                   {
00324   // Used to retrieve configuration registry for a given medium.  If
00325   // it doesn't exist, an empty registry is returned.
00326 
00327   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00328   Registry medConfig;  // empty by default
00329   r.Get(medName,medConfig); // fills registry if key exists 
00330   return medConfig; 
00331 
00332 }

int UgliLoanPool::GetMinervaVersion (  )  const

Definition at line 146 of file UgliLoanPool.cxx.

References Registry::Get(), CfgConfigurable::GetConfig(), and Instance().

00147 {
00148   // Used to retrieve Minerva version
00149   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00150   int minervaVersion = 0;
00151   if ( r.Get("MinervaVersion",minervaVersion) ) return minervaVersion;
00152   return 0;
00153 }

bool UgliLoanPool::GetShieldOff (  )  const

Definition at line 157 of file UgliLoanPool.cxx.

References Registry::Get(), CfgConfigurable::GetConfig(), and Instance().

Referenced by GeoGeometry::BuildDetector(), GeoGeometry::BuildPlanePairVolumes(), and GeoGeometry::BuildStripVolumes().

00158 {
00159   // Used to retrieve ShieldOff flag
00160   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00161   int shieldoff = 0;
00162   if ( r.Get("ShieldOff",shieldoff) ) return shieldoff;
00163   return false;
00164 }

Geo::ESwimMethod UgliLoanPool::GetSwimMethodHighField (  )  const

Definition at line 190 of file UgliLoanPool.cxx.

References Registry::Get(), CfgConfigurable::GetConfig(), Instance(), and Geo::kUnknownSwimMethod.

00191 {
00192   // Used to retrieve swim method configuration in high field region
00193   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00194   int swimmethod = -1;
00195   if ( r.Get("SwimMethodHighField",swimmethod) )
00196     return (Geo::ESwimMethod)swimmethod;
00197   else return Geo::kUnknownSwimMethod;
00198 
00199 }

Geo::ESwimMethod UgliLoanPool::GetSwimMethodLowField (  )  const

Definition at line 168 of file UgliLoanPool.cxx.

References Registry::Get(), CfgConfigurable::GetConfig(), Instance(), and Geo::kUnknownSwimMethod.

00169 {
00170   // Used to retrieve swim method configuration in low field region
00171   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00172   int swimmethod = -1;
00173   if ( r.Get("SwimMethodLowField",swimmethod) ) 
00174     return (Geo::ESwimMethod)swimmethod;
00175   else return Geo::kUnknownSwimMethod;
00176 
00177 }

UgliGeometry * UgliLoanPool::GetUgliGeometry ( const VldContext vldc,
Bool_t  frozen 
) [private]

Definition at line 619 of file UgliLoanPool.cxx.

References BuildUgliGeometry(), UgliRefCnt::CountRef(), fFrozenUgliGeomList, fMaxUnref, fModifiableUgliGeomList, GetExistingUgliGeometry(), Msg::kFatal, Msg::kVerbose, MSG, and VldContext::Print().

Referenced by UgliGeomHandle::ResetVldContext(), and UgliGeomHandle::UgliGeomHandle().

00621 {
00622    // Find (or create) the right UgliGeometry to give to a handle
00623 
00624    UgliGeometry *geom = GetExistingUgliGeometry(vldc,frozen);
00625    if (geom) return geom;
00626 
00627    // nothing appropriate, choose one of the managed lists
00628    // geometry should be placed in
00629    TObjArray*   geomList = &fFrozenUgliGeomList;
00630    if (!frozen) geomList = &fModifiableUgliGeomList;
00631 
00632    // first count the # of (other) unreferenced geoms
00633    UgliGeometry *other_geom = 0;
00634    Int_t todelete = -fMaxUnref;
00635    TObjArrayIter iter_cnt(geomList);
00636    while ( ( other_geom = (UgliGeometry *)iter_cnt.Next() ) ) {
00637       if ( other_geom->CountRef() <= 0 ) todelete++;
00638    }
00639    // if more unreferenced geometries than desired clean them out
00640    // iterate from the front (default) so oldest get cleaned out first
00641    if (todelete > 0) {
00642       TObjArrayIter iter_rm(geomList);
00643       while ( ( other_geom = (UgliGeometry *)iter_rm.Next() ) && 
00644               todelete > 0 ) {
00645          if ( other_geom->CountRef() <= 0 ) {
00646             geomList->Remove(other_geom);
00647             delete other_geom;
00648             todelete--;
00649          }
00650       }
00651       // remove the spaces we freed up
00652       geomList->Compress();
00653       MSG("Ugli",Msg::kVerbose) 
00654          << "GetUgliGeometry removed old unref'd geoms" << endl;
00655    }
00656 
00657    // no valid UgliGeometry available need to build one
00658    geom = BuildUgliGeometry(vldc,frozen);
00659    if ( !geom) {
00660       MSG("Ugli",Msg::kFatal)
00661          << "UgliLoanPool failed to build for: " << endl;
00662       vldc.Print();
00663       assert(geom);
00664    }
00665 
00666    // append this new geometry into the list
00667    MSG("Ugli",Msg::kVerbose) 
00668       << "GetUgliGeometry returned created new "
00669       << ((frozen)? "frozen" : "modifiable")
00670       << " UgliGeometry " << endl;
00671    geomList->AddLast(geom);
00672 
00673    return geom;
00674 
00675 }

bool UgliLoanPool::GetUseNewCavern (  )  const

Definition at line 124 of file UgliLoanPool.cxx.

References Registry::Get(), CfgConfigurable::GetConfig(), and Instance().

Referenced by GeoGeometry::BuildGeometry().

00125 {
00126   // Used to retrieve UseNewCavern flag
00127   const Registry& r = UgliLoanPool::Instance()->GetConfig();
00128   int usenewcavern = 0;
00129   if ( r.Get("UseNewCavern",usenewcavern) ) return usenewcavern;
00130   return false;
00131 }

UgliLoanPool * UgliLoanPool::Instance ( void   )  [static]

Definition at line 335 of file UgliLoanPool.cxx.

References UgliLoanPool::Cleaner::ClassIsUsed(), DefaultConfig(), fgInstance, Registry::Get(), CfgConfigurable::GetConfig(), Registry::KeyExists(), Msg::kSynopsis, Registry::LockKeys(), Registry::Merge(), MSG, ReadFromFile(), SetConfigFromEnvironment(), and CfgConfigurable::Update().

Referenced by EvtKinNuModule::BeginJob(), GenieModule::BeginRun(), GeoGeometry::BuildDetector(), GeoGeometry::BuildGeometry(), UgliGeometry::BuildNodes(), GeoGeometry::BuildPlanePairVolumes(), GeoGeometry::BuildStripVolumes(), GeoMediumMap::BuildSwimMethodMap(), UgliGeometry::ClearDbiCache(), configure_ugli(), GeoMediumMap::ConfigureMedium(), dbi_setup(), UgliGeomHandle::DoesValidGeomExist(), GetAlwaysUseDbi(), GenieModule::GetHallExtent(), GetLeadStacks(), GetMedium(), GetMediumRegistry(), GetMinervaVersion(), GetShieldOff(), GetSwimMethodHighField(), GetSwimMethodLowField(), GetUseNewCavern(), UgliGeometryReroot::MakeTempDbiGeometry(), UgliGeometryReroot::MakeTempDbiPosInfo(), UgliGeometryReroot::MakeTempDbiScintStruct(), UgliGeomHandle::ResetVldContext(), GeoValidate::RunAllTests(), GeoCheckOverlaps::RunAllTests(), SaveToFile(), SetAlwaysUseDbi(), SetCut(), SetLeadStacks(), SetMedium(), GeoMediumMap::SetMedium(), SetMinervaVersion(), SetProcess(), SetShieldOff(), SetSwimMethodHighField(), SetSwimMethodLowField(), SetTracking(), SetUseGeo(), SetUseNewCavern(), GeoValidate::TestLoanPool(), GeoValidate::TestStrip_DistanceAlong(), GeoValidate::TestStrip_Intersection(), and UgliGeomHandle::UgliGeomHandle().

00336 {
00337 // protect Singleton to ensure there is only one
00338    if (fgInstance == 0) {
00339       MSG("Ugli",Msg::kSynopsis) << "UgliLoanPool instance creation" << endl;
00340 
00341       static UgliLoanPool::Cleaner c; // end-of-run clean up
00342       c.ClassIsUsed();
00343 
00344       fgInstance = new UgliLoanPool;
00345 
00346       // intialize intial (default) configuration
00347       Registry& r = fgInstance->GetConfig();
00348       r.SetName("UgliLoanPool Configuration");
00349       r.Merge(fgInstance->DefaultConfig());
00350       r.LockKeys();
00351       fgInstance->SetConfigFromEnvironment();
00352       fgInstance->Update();
00353       // if Config has 'Cache' try reading that
00354       // do this here rather than in Config() so that it only happens
00355       // on the first creation (i.e. later Config's don't redo this)
00356       if ( r.KeyExists("Cache") ) {
00357         const char* cache_location = "";
00358         if ( r.Get("Cache",cache_location) && strlen(cache_location) )
00359           UgliLoanPool::ReadFromFile(cache_location);
00360       }
00361    }
00362    return fgInstance;
00363 }

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

Definition at line 897 of file UgliLoanPool.cxx.

References fFrozenGeoGeomList, fFrozenUgliGeomList, fModifiableGeoGeomList, fModifiableUgliGeomList, CfgConfigurable::GetConfig(), Msg::kInfo, Msg::kVerbose, MSG, GeoGeometry::Print(), Registry::Print(), UgliGeometry::Print(), and UseGeo().

00898 {
00899 // Print info about the current loan pool
00900 
00901    MSG("Ugli",Msg::kVerbose) << "Print" << endl;
00902 
00903    GetConfig().Print();
00904 
00905    if ( !UseGeo() || !fFrozenUgliGeomList.IsEmpty() 
00906                   || !fModifiableUgliGeomList.IsEmpty() ) {
00907      UgliGeometry *geom = 0;
00908      MSG("Ugli",Msg::kInfo) << " --- Frozen UgliLoanPool ---" << endl;
00909      TIter frozen(&fFrozenUgliGeomList);
00910      while ( ( geom = (UgliGeometry *)frozen.Next() ) ) geom->Print(option);
00911    
00912      MSG("Ugli",Msg::kInfo) << " --- Modifiable UgliLoanPool ---" << endl;
00913      TIter modifiable(&fModifiableUgliGeomList);
00914      while ( ( geom = (UgliGeometry *)modifiable.Next() ) )geom->Print(option);
00915    }
00916    
00917    if ( UseGeo() || !fFrozenGeoGeomList.IsEmpty()
00918                  || !fModifiableGeoGeomList.IsEmpty() ) {
00919      GeoGeometry* geom = 0;
00920   
00921      MSG("Ugli",Msg::kInfo) << " --- Geo Frozen UgliLoanPool ---" << endl;
00922      TIter frozen(&fFrozenGeoGeomList);
00923      while ( ( geom = (GeoGeometry *)frozen.Next() ) ) geom->Print(option);
00924 
00925      MSG("Ugli",Msg::kInfo) << " --- Geo Modifiable UgliLoanPool ---" << endl;
00926      TIter modifiable(&fModifiableGeoGeomList);
00927      while ( ( geom = (GeoGeometry *)modifiable.Next() ) ) geom->Print(option);
00928    }
00929    
00930    MSG("Ugli",Msg::kInfo) << " --- End of UgliLoanPool ---" << endl;
00931 }

bool UgliLoanPool::PurgeDbiTableCache (  )  const

Definition at line 540 of file UgliLoanPool.cxx.

References fgInstance, Registry::Get(), and CfgConfigurable::GetConfig().

00541 {
00542    // Does the config suggest that DbiTable caches should be purged
00543    // after the UgliGeometry has been constructed?
00544 
00545    Registry& r = fgInstance->GetConfig();
00546    int dopurge = true;  // default
00547    r.Get("PurgeDbiTableCache",dopurge);
00548    return dopurge;
00549 
00550 }

void UgliLoanPool::ReadFromFile ( const char *  filename  )  [static]

Definition at line 949 of file UgliLoanPool.cxx.

References fFrozenGeoGeomList, fFrozenUgliGeomList, fgInstance, fModifiableGeoGeomList, fModifiableUgliGeomList, CfgConfigurable::GetConfig(), gSystem(), Msg::kInfo, Msg::kWarning, MSG, Registry::RemoveKey(), and UgliGeometry::RestorePlaneTable().

Referenced by Instance().

00950 {
00951   // read a UgliLoanPool from a file
00952   // ensure that there isn't a memory leak if a UgliLoanPool already exists
00953   // by merging the two
00954 
00955   if ( gSystem->AccessPathName(filename,kFileExists) ) {
00956     // note funky return value:  FALSE is you _can_ access file
00957     MSG("Ugli",Msg::kInfo)
00958       << "UgliLoanPool::ReadFromFile() no such file: " << filename << endl;
00959     return;
00960   }
00961 
00962   // bitch in general because it really isn't a good idea!
00963   MSG("Ugli",Msg::kInfo)
00964     << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl 
00965     << "UgliLoanPool::ReadFromFile() used to build some geometries. " << endl
00966     << "This is really not a safe thing to do in that it bypasses the" << endl
00967     << "database and thus is not subject to rolling updates.  Any geometry" << endl
00968     << "will thus reflect the status at the time the file was written" << endl
00969     << "and may be outdated.  Use at your own risk." << endl
00970     << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
00971 
00972   UgliLoanPool* ulpPrev = fgInstance;  // save any existing global
00973   fgInstance = 0;  // so we don't complain about a memory leak
00974 
00975   TFile f(filename);
00976   UgliLoanPool* ulp = dynamic_cast<UgliLoanPool*>(f.Get("UgliLoanPool"));
00977 
00978   if (!ulp) {
00979     // file didn't have any UgliLoanPool!
00980     MSG("Ugli",Msg::kWarning)
00981       << "UgliLoanPool::ReadFromFile() found no pool in file:"
00982       << filename
00983       << endl;
00984     // revert to old
00985     fgInstance = ulpPrev;
00986   }
00987   else if (ulpPrev) {
00988     // file had a UgliLoanPool, but we already had one as well
00989     // merge the two
00990     MSG("Ugli",Msg::kInfo)
00991       << "UgliLoanPool::ReadFromFile() will now merge newly read data "
00992       << "into prior loan pool" << endl;
00993     // make old loan pool the global one to preserve order
00994     fgInstance = ulpPrev;
00995     // loop over elements of newly read pool and move them to global copy
00996     TObjArray *from, *to;
00997     for (int pubpriv = 0; pubpriv <= 1; ++pubpriv) {
00998       if (pubpriv) {
00999         from = &ulp->fFrozenUgliGeomList;
01000         to   = &fgInstance->fFrozenUgliGeomList;
01001       }
01002       else {
01003         from = &ulp->fModifiableUgliGeomList;
01004         to   = &fgInstance->fModifiableUgliGeomList;
01005       }
01006       for (int indx = 0; indx <= from->GetLast(); ++indx) {
01007         UgliGeometry* ugligeom = 
01008           dynamic_cast<UgliGeometry*>(from->RemoveAt(indx));
01009         if (ugligeom) {
01010           // make sure merged geometry has fPlaneTable filled
01011           ugligeom->RestorePlaneTable(false);
01012           to->Add(ugligeom);
01013         }
01014       } // loop over elements
01015     } // shared/private 
01016 
01017     // Repeat for Geo arrays
01018     for (int pubpriv = 0; pubpriv <= 1; ++pubpriv) {
01019       if (pubpriv) {
01020         from = &ulp->fFrozenGeoGeomList;
01021         to   = &fgInstance->fFrozenGeoGeomList;
01022       }
01023       else {
01024         from = &ulp->fModifiableGeoGeomList;
01025         to   = &fgInstance->fModifiableGeoGeomList;
01026       }
01027       for (int indx = 0; indx <= from->GetLast(); ++indx) {
01028         GeoGeometry* geogeom= dynamic_cast<GeoGeometry*>(from->RemoveAt(indx));
01029         if (geogeom) to->Add(geogeom);
01030       } // loop over elements
01031     } // shared/private 
01032     // delete newly read, but now empty, pool
01033     // inhibit writing it out though
01034     ulp->GetConfig().RemoveKey("Cache");
01035     delete ulp;
01036   }
01037 
01038 
01039 }

void UgliLoanPool::SaveToFile ( const char *  filename,
bool  recreate = true 
) [static]

Definition at line 934 of file UgliLoanPool.cxx.

References Instance().

Referenced by ~UgliLoanPool().

00935 {
00936   // save a UgliLoanPool to a file
00937 
00938   UgliLoanPool* plp = UgliLoanPool::Instance(); // make sure there is one
00939 
00940   const char* fmode = "RECREATE";
00941   if (!recreate) fmode = "UPDATE";
00942   TFile f(filename,fmode);
00943   plp->Write();
00944   f.Write();
00945   f.Close();
00946 }

void UgliLoanPool::SetAlwaysUseDbi ( Bool_t  flag = kTRUE  )  [static]

Definition at line 49 of file UgliLoanPool.cxx.

References Form(), Instance(), and CfgConfigurable::Set().

Referenced by configure_ugli(), and dbi_setup().

00050 {
00051   UgliLoanPool::Instance()->Set(Form("AlwaysUseDbi=%d",(int)flag));
00052 }

void UgliLoanPool::SetConfigFromEnvironment (  )  [virtual]

Definition at line 472 of file UgliLoanPool.cxx.

References gSystem(), Msg::kInfo, MSG, CfgConfigurable::Set(), and UtilString::StringTok().

Referenced by Instance().

00473 {
00474   // Setup configuration from ENV_UGLI environment variable
00475   // which conists of a semi-colon separated list of DBI
00476   // configuration requests.
00477 
00478   const char* strENV_UGLI = gSystem->Getenv("ENV_UGLI");
00479   if ( strENV_UGLI == 0 || strlen(strENV_UGLI) == 0 ) return;
00480 
00481   MSG("Ugli",Msg::kInfo)
00482     << "Configuring UgliGeometry from the environment variable ENV_UGLI:" << endl
00483     << "   " << strENV_UGLI << endl;
00484 
00485   std::vector<std::string> configRequests;
00486   UtilString::StringTok(configRequests, strENV_UGLI, ";");
00487 
00488   for (unsigned entry = 0; entry < configRequests.size(); ++entry)
00489     this->Set(configRequests[entry].c_str());
00490 
00491 }

void UgliLoanPool::SetCut ( UtilMCFlag::ECut  cut,
Double_t  cutvalue,
const char *  medname 
)

Definition at line 273 of file UgliLoanPool.cxx.

References UtilMCFlag::AsString(), Registry::Get(), CfgConfigurable::GetConfig(), Instance(), Registry::LockKeys(), Registry::LockValues(), Registry::Set(), Registry::UnLockKeys(), and Registry::UnLockValues().

00274                                                {
00275   // Used to configure cut flag value for a specific medium
00276 
00277   Registry& r = UgliLoanPool::Instance()->GetConfig();
00278   Registry medConfig;
00279   bool isNew = false;
00280   // fill it with existing registry if present
00281   if ( !r.Get(medName,medConfig) ) isNew = true; 
00282 
00283   medConfig.UnLockKeys();
00284   medConfig.UnLockValues();
00285   medConfig.Set(UtilMCFlag::AsString(cut),value);
00286   medConfig.LockValues();
00287   medConfig.LockKeys();
00288 
00289   if ( isNew ) r.UnLockKeys();
00290   r.UnLockValues();
00291   r.Set(medName,medConfig);
00292   r.LockValues();
00293   if ( isNew ) r.LockKeys();
00294   
00295 }

void UgliLoanPool::SetLeadStacks ( Bool_t  flag = kTRUE  ) 

Definition at line 85 of file UgliLoanPool.cxx.

References Form(), Instance(), and CfgConfigurable::Set().

00086 {
00087   // Can be used to reconfigure UgliLoanPool for use of lead stacks
00088   // Default: true 
00089   // Note: only used with new cavern modeling
00090   UgliLoanPool::Instance()->Set(Form("LeadStacks=%d",(int)flag));
00091 
00092 }

void UgliLoanPool::SetMedium ( Geo::EDetComponent  detcomp,
const char *  medName 
)

Definition at line 203 of file UgliLoanPool.cxx.

References bfld::AsString(), Geo::AsString(), Registry::Get(), CfgConfigurable::GetConfig(), Instance(), Msg::kError, Registry::LockKeys(), Registry::LockValues(), MSG, Registry::Set(), Registry::UnLockKeys(), and Registry::UnLockValues().

00204 {
00205   // Used to configure medium in specified detector component
00206   Registry& r = UgliLoanPool::Instance()->GetConfig();
00207   Registry mediumMap;
00208   if ( !r.Get("MediumMap",mediumMap) ) {
00209     MSG("Ugli",Msg::kError) << "SetMedium " << medName << " for det component "
00210                             << Geo::AsString(detcomp) << " failed due to "
00211                             << "missing MediumMap Registry." << endl;
00212     return;
00213   }
00214   mediumMap.UnLockKeys();
00215   mediumMap.UnLockValues();
00216   mediumMap.Set(Geo::AsString(detcomp),medName);
00217   mediumMap.LockValues();
00218   mediumMap.LockKeys();
00219 
00220   r.UnLockValues();
00221   r.Set("MediumMap",mediumMap);
00222   r.LockValues();
00223   
00224 }

void UgliLoanPool::SetMinervaVersion ( int  version = -1  ) 

Definition at line 96 of file UgliLoanPool.cxx.

References Form(), Instance(), and CfgConfigurable::Set().

00097 {
00098   // Can be used to reconfigure UgliLoanPool for addition of
00099   // stripped down Minerva geometry
00100   // Default: true 
00101   UgliLoanPool::Instance()->Set(Form("MinervaVersion=%d",(int)version));
00102 
00103 }

void UgliLoanPool::SetProcess ( UtilMCFlag::EProcess  process,
Int_t  processvalue,
const char *  medname 
)

Definition at line 248 of file UgliLoanPool.cxx.

References UtilMCFlag::AsString(), Registry::Get(), CfgConfigurable::GetConfig(), Instance(), Registry::LockKeys(), Registry::LockValues(), Registry::Set(), Registry::UnLockKeys(), and Registry::UnLockValues().

00249                                                    {
00250   // Used to configure physics process flag value for a specific medium
00251 
00252   Registry& r = UgliLoanPool::Instance()->GetConfig();
00253   Registry medConfig;
00254   bool isNew = false;
00255   // fill it with existing registry if present
00256   if ( !r.Get(medName,medConfig) ) isNew = true; 
00257 
00258   medConfig.UnLockKeys();
00259   medConfig.UnLockValues();
00260   medConfig.Set(UtilMCFlag::AsString(process),value);
00261   medConfig.LockValues();
00262   medConfig.LockKeys();
00263 
00264   if ( isNew ) r.UnLockKeys();
00265   r.UnLockValues();
00266   r.Set(medName,medConfig);
00267   r.LockValues();
00268   if ( isNew ) r.LockKeys();
00269   
00270 }

void UgliLoanPool::SetShieldOff ( Bool_t  flag = kTRUE  ) 

Definition at line 107 of file UgliLoanPool.cxx.

References Form(), Instance(), and CfgConfigurable::Set().

00108 {
00109   // Can be used to reconfigure UgliLoanPool to turn shield off
00110   UgliLoanPool::Instance()->Set(Form("ShieldOff=%d",(int)flag));
00111 
00112 }

void UgliLoanPool::SetSwimMethodHighField ( Geo::ESwimMethod  swimmethod  ) 

Definition at line 181 of file UgliLoanPool.cxx.

References Form(), Instance(), and CfgConfigurable::Set().

00182 {
00183   // Used to reconfigure UgliLoanPool swim method in high field regions 
00184   UgliLoanPool::Instance()
00185                      ->Set(Form("SwimMethodHighField=%d",(int)swimmethod));
00186 }

void UgliLoanPool::SetSwimMethodLowField ( Geo::ESwimMethod  swimmethod  ) 

Definition at line 116 of file UgliLoanPool.cxx.

References Form(), Instance(), and CfgConfigurable::Set().

00117 {
00118   // Used to reconfigure UgliLoanPool swim method in low field regions 
00119   UgliLoanPool::Instance()->Set(Form("SwimMethodLowField=%d",(int)swimmethod));
00120 }

void UgliLoanPool::SetTracking ( UtilMCFlag::ETracking  trk,
Double_t  trkvalue,
const char *  medname 
)

Definition at line 298 of file UgliLoanPool.cxx.

References UtilMCFlag::AsString(), Registry::Get(), CfgConfigurable::GetConfig(), Instance(), Registry::LockKeys(), Registry::LockValues(), Registry::Set(), Registry::UnLockKeys(), and Registry::UnLockValues().

00299                                                     {
00300   // Used to configure tracking flag value for a specific medium
00301 
00302   Registry& r = UgliLoanPool::Instance()->GetConfig();
00303   Registry medConfig;
00304   bool isNew = false;
00305   // fill it with existing registry if present
00306   if ( !r.Get(medName,medConfig) ) isNew = true; 
00307 
00308   medConfig.UnLockKeys();
00309   medConfig.UnLockValues();
00310   medConfig.Set(UtilMCFlag::AsString(trk),value);
00311   medConfig.LockValues();
00312   medConfig.LockKeys();
00313 
00314   if ( isNew ) r.UnLockKeys();
00315   r.UnLockValues();
00316   r.Set(medName,medConfig);
00317   r.LockValues();
00318   if ( isNew ) r.LockKeys();
00319   
00320 }

void UgliLoanPool::SetUseGeo ( Bool_t  flag = kTRUE  ) 
void UgliLoanPool::SetUseNewCavern ( Bool_t  flag = kTRUE  ) 

Definition at line 75 of file UgliLoanPool.cxx.

References Form(), Instance(), and CfgConfigurable::Set().

00076 {
00077   // Can be used to reconfigure UgliLoanPool for use of new cavern layout
00078   // Default: false 
00079   UgliLoanPool::Instance()->Set(Form("UseNewCavern=%d",(int)flag));
00080 
00081 }

bool UgliLoanPool::UseGeo (  )  const [inline]

Definition at line 52 of file UgliLoanPool.h.

References fUseGeo.

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

00052 { return fUseGeo; }


Friends And Related Function Documentation

friend struct Cleaner [friend]

Definition at line 121 of file UgliLoanPool.h.

friend class UgliGeomHandle [friend]

Definition at line 30 of file UgliLoanPool.h.


Member Data Documentation

TObjArray UgliLoanPool::fFrozenGeoGeomList [private]
TObjArray UgliLoanPool::fFrozenUgliGeomList [private]
UgliLoanPool * UgliLoanPool::fgInstance = 0 [static, private]
Int_t UgliLoanPool::fMaxUnref [private]

Definition at line 148 of file UgliLoanPool.h.

Referenced by Config(), GetGeoGeometry(), and GetUgliGeometry().

bool UgliLoanPool::fUseGeo [private]

Definition at line 149 of file UgliLoanPool.h.

Referenced by Config(), SetUseGeo(), and UseGeo().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1