GeoCheckOverlaps Class Reference

#include <GeoCheckOverlaps.h>

List of all members.

Public Member Functions

 GeoCheckOverlaps (float precision, Int_t detmask, Int_t simmask)
virtual ~GeoCheckOverlaps ()
bool RunAllTests (void)

Private Member Functions

bool TestCheckOverlaps ()

Private Attributes

VldContext fVldContext
TGeoManager * fGeoManager
float fPrecision
Int_t fDetMask
Int_t fSimMask

Detailed Description

Definition at line 18 of file GeoCheckOverlaps.h.


Constructor & Destructor Documentation

GeoCheckOverlaps::GeoCheckOverlaps ( float  precision,
Int_t  detmask,
Int_t  simmask 
)

Definition at line 27 of file GeoCheckOverlaps.cc.

00028                                                                    : 
00029                        fVldContext(),fGeoManager(0),fPrecision(precision),
00030                        fDetMask(detmask),fSimMask(simmask) {
00031   // Default constructor
00032 
00033 }

GeoCheckOverlaps::~GeoCheckOverlaps (  )  [virtual]

Definition at line 36 of file GeoCheckOverlaps.cc.

00036                                     {
00037   // Destructor
00038   // fGeoManager is not owned  
00039 }


Member Function Documentation

bool GeoCheckOverlaps::RunAllTests ( void   ) 

Definition at line 71 of file GeoCheckOverlaps.cc.

References fDetMask, fGeoManager, fPrecision, fSimMask, fVldContext, gGeoManager, UgliLoanPool::Instance(), Detector::kCalDet, SimFlag::kData, Detector::kFar, SimFlag::kMC, Detector::kNear, Detector::MaskToString(), UgliLoanPool::SetUseGeo(), and TestCheckOverlaps().

Referenced by main().

00071                                    {
00072   //
00073   //  Purpose:  Run sequence of GeoGeometry package validity tests.
00074   //
00075   //  Arguments: none.
00076   //
00077   //  Return:    pass (if all tests successful) or fail
00078   //
00079   //  Contact:   S. Kasahara
00080   // 
00081 
00082   // Test 3 detector types in sequence, with kData DB values
00083   const int ndet = 3;
00084   Detector::Detector_t dettype[ndet] = {Detector::kFar,
00085                                         Detector::kNear,
00086                                         Detector::kCalDet};
00087 
00088   const int nsim = 2;
00089   SimFlag::SimFlag_t simflag[nsim] = { SimFlag::kMC, SimFlag::kData };
00090       
00091   VldTimeStamp currentTime;
00092   
00093   cout << "*** GeoValidate::RunAllTests ***" << endl;
00094   cout << "*** CheckOverlaps w/Precision  = "
00095        << fPrecision << "(cm), Detector: "
00096        << Detector::MaskToString(fDetMask) 
00097        << ", SimFlag: " << SimFlag::MaskToString(fSimMask)
00098        << " ***" << endl;
00099   
00100  
00101   Bool_t passed[ndet][nsim];
00102   VldContext vldc[ndet][nsim];
00103 
00104   for ( int isim = 0; isim < nsim; isim++ ) {
00105     if ( !(simflag[isim] & fSimMask ) ) continue;
00106     for ( int idet = 0; idet < ndet; idet++ ) {
00107       if ( !(dettype[idet] & fDetMask) ) continue;
00108     
00109       passed[idet][isim] = true;
00110       
00111       if (dettype[idet] != Detector::kCalDet) {
00112         // Build vldc using current time
00113         fVldContext = VldContext(dettype[idet],simflag[isim],currentTime);
00114       }
00115       else {
00116         // Current time isn't valid for caldet
00117         fVldContext = VldContext(dettype[idet],simflag[isim],
00118                                  VldTimeStamp(2003,9,15,0,0,0));
00119       }
00120       vldc[idet][isim] = fVldContext; 
00121     
00122       cout << "\n*** Testing geometry with vld " 
00123            << fVldContext << " ***" << endl;
00124     
00125       UgliLoanPool::Instance()->SetUseGeo(true);
00126       UgliGeomHandle geo(fVldContext);
00127       fGeoManager = gGeoManager;
00128     
00129       // Run test methods
00130       cout << "*** TestCheckOverlaps ***" << endl;
00131       if ( TestCheckOverlaps() ) {
00132         cout << "*** All CheckOverlaps tests Passed ***" << endl;
00133       }
00134       else {
00135         cout << "*** At least one CheckOverlaps test FAILED ***" << endl;
00136         passed[idet][isim] = false;
00137       }
00138     
00139       std::string detstatus = " Passed all Tests ***";
00140       if ( !passed[idet][isim] ) detstatus = " FAILED at least one Test ***";
00141     
00142       cout << "\n*** Detector w/vld " << fVldContext << detstatus.c_str() 
00143            << endl;
00144     }
00145   }
00146 
00147   cout << "\n*** Finished all tests:" << endl;
00148   Bool_t allPassed = kTRUE;
00149   for ( int isim = 0; isim < nsim; isim++ ) {
00150     if ( !(simflag[isim] & fSimMask ) ) continue;
00151     for ( int idet = 0; idet < ndet; idet++ ) {
00152       if ( !(dettype[idet] & fDetMask) ) continue;
00153 
00154       std::string detstatus = " Passed all Tests ***";
00155       if ( !passed[idet][isim] ) {
00156         detstatus = " FAILED at least one Test ***";
00157         allPassed = kFALSE;
00158       }
00159       cout << "*** Detector w/vld " << vldc[idet][isim] 
00160            << detstatus.c_str() << endl;
00161     }
00162   }
00163   
00164   return allPassed;
00165 
00166 }

bool GeoCheckOverlaps::TestCheckOverlaps (  )  [private]

Definition at line 42 of file GeoCheckOverlaps.cc.

References fGeoManager, and fPrecision.

Referenced by RunAllTests().

00042                                          {
00043   //  Run CheckOverlaps on all volumes in detector
00044   bool pass = true;
00045   
00046   if ( !fGeoManager ) {
00047     cerr << "GeoCheckOverlaps::TestCheckOverlaps Error! fGeoManager is Null!" 
00048          << endl;
00049     pass = false;
00050     return pass;
00051   }
00052     
00053   fGeoManager->CheckOverlaps(fPrecision);
00054   
00055   TObjArray* overlaps = fGeoManager->GetListOfOverlaps();
00056   if ( overlaps ) {
00057     if ( overlaps -> GetEntriesFast() > 0 ) {
00058       cout << "Found " << overlaps->GetEntriesFast() 
00059            << " overlaps/extrusions." << endl;
00060       fGeoManager->PrintOverlaps();
00061       pass = false;
00062     }
00063     fGeoManager->ClearOverlaps(); // reset before next call
00064   }
00065    
00066   return pass;
00067 
00068 }


Member Data Documentation

Int_t GeoCheckOverlaps::fDetMask [private]

Definition at line 36 of file GeoCheckOverlaps.h.

Referenced by RunAllTests().

TGeoManager* GeoCheckOverlaps::fGeoManager [private]

Definition at line 34 of file GeoCheckOverlaps.h.

Referenced by RunAllTests(), and TestCheckOverlaps().

Definition at line 35 of file GeoCheckOverlaps.h.

Referenced by RunAllTests(), and TestCheckOverlaps().

Int_t GeoCheckOverlaps::fSimMask [private]

Definition at line 37 of file GeoCheckOverlaps.h.

Referenced by RunAllTests().

Definition at line 33 of file GeoCheckOverlaps.h.

Referenced by RunAllTests().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1