UgliGeometryReroot Class Reference

#include <UgliGeometryReroot.h>

Inheritance diagram for UgliGeometryReroot:

UgliGeometry UgliGeomABC UgliRefCnt List of all members.

Public Member Functions

 UgliGeometryReroot ()

Protected Member Functions

 UgliGeometryReroot (const VldContext &vldc)
virtual ~UgliGeometryReroot ()
virtual UgliGeometry::EMINFStatus GetMINFStatus () const
virtual void BuildVldRange (const VldContext &vldc)
virtual void BuildShapes (const VldContext &vldc)
virtual void BuildNodes (const VldContext &vldc)
void MakeTempTables (const VldContext &vldc)
void MakeTempDbiGeometry (const VldContext &vldc)
void MakeTempDbiScintStruct (const VldContext &vldc)
void MakeTempDbiPosInfo (const VldContext &vldc)
string StandardMdlName (PlexPlaneId plnid, int module, TString &aname)
void ABtoEastWest (Float_t a, Float_t b, PlexPlaneId plnid, TString &aname, Float_t &east, Float_t &west)

Private Member Functions

 UgliGeometryReroot (const UgliGeometryReroot &tf)
UgliGeometryRerootoperator= (const UgliGeometryReroot &tf)

Static Private Member Functions

static PLANEPOS_DEFCreateAndBackFillPlanePosDef (REROOT_PlanePos *)

Friends

class UgliLoanPool

Detailed Description

Definition at line 22 of file UgliGeometryReroot.h.


Constructor & Destructor Documentation

UgliGeometryReroot::UgliGeometryReroot (  ) 

Definition at line 64 of file UgliGeometryReroot.cxx.

References RerootExodus::BuildVldContext(), UgliGeometry::kNotThere, Msg::kVerbose, Msg::kWarning, and MSG.

00065    : UgliGeometry()
00066 {
00067 
00068    // Default constructor
00069    MSG("Ugli",Msg::kVerbose) << "UgliGeometryReroot default ctor" << endl;
00070 
00071    if (UgliGeometry::kNotThere == GetMINFStatus()) {
00072       MSG("Ugli",Msg::kWarning) 
00073          << "UgliGeometryReroot default ctor with no GetMINFStatus" << endl;
00074 //      UgliLoanPool::SetAlwaysUseDbi(true);
00075       return;
00076    }
00077 
00078    VldContext vldc = RerootExodus::BuildVldContext();
00079 
00080 #ifndef NO_UGLI_DATABASE
00081    MakeTempTables(vldc);
00082 #endif
00083    BuildAll(vldc);
00084 }

UgliGeometryReroot::UgliGeometryReroot ( const VldContext vldc  )  [protected]

Definition at line 87 of file UgliGeometryReroot.cxx.

References UgliGeometry::BuildAll(), GetMINFStatus(), UgliGeometry::kNotThere, Msg::kVerbose, Msg::kWarning, MakeTempTables(), and MSG.

00088    : UgliGeometry()
00089 {
00090    // normal constructor
00091 
00092    MSG("Ugli",Msg::kVerbose) << "UgliGeometryReroot vldc ctor " << endl;
00093 
00094    if (UgliGeometry::kNotThere == GetMINFStatus()) {
00095       MSG("Ugli",Msg::kWarning) 
00096          << "UgliGeometryReroot vldc ctor with no GetMINFStatus" << endl;
00097 //      UgliLoanPool::SetAlwaysUseDbi(true);
00098       return;
00099    }
00100 
00101 #ifndef NO_UGLI_DATABASE
00102    MakeTempTables(vldc);
00103 #endif
00104    BuildAll(vldc);
00105 }

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

Definition at line 108 of file UgliGeometryReroot.cxx.

References Msg::kVerbose, and MSG.

00109 {
00110    // delete all the owned sub-objects
00111 
00112    MSG("Ugli",Msg::kVerbose) << "UgliGeometryReroot dtor " << endl;
00113 
00114 }

UgliGeometryReroot::UgliGeometryReroot ( const UgliGeometryReroot tf  )  [private]


Member Function Documentation

void UgliGeometryReroot::ABtoEastWest ( Float_t  a,
Float_t  b,
PlexPlaneId  plnid,
TString &  aname,
Float_t &  east,
Float_t &  west 
) [protected]

Definition at line 1434 of file UgliGeometryReroot.cxx.

References PlexPlaneId::GetDetector(), PlexPlaneId::GetPlaneView(), Detector::kCalDet, and PlaneView::kV.

Referenced by MakeTempDbiPosInfo(), and MakeTempDbiScintStruct().

01437 {
01438    // convert an A,B pair into a East,West set
01439    // considering all the weirdnesses
01440 
01441    // use temporaries in case output == input
01442    Float_t tmpA = a;
01443    Float_t tmpB = b;
01444 
01445    if ( plnid.GetPlaneView() != PlaneView::kV ||     // rwh: fix 'M' plane
01446         plnid.GetDetector()  == Detector::kCalDet ) {
01447       // normal case, U and all kinds of CalDet
01448       east = tmpA;
01449       west = tmpB;
01450    }
01451    else {
01452      if ( aname[0] == 'F' ) {
01453        // old GMINOS V was swapped in direction of TPos
01454        // CalDet U/V were really GMINOS Y/X
01455        east = tmpB;
01456        west = tmpA;
01457      }
01458      else {
01459        // 'M' type planes are really 'W' rotated
01460        east = tmpA;
01461        west = tmpB;
01462      }
01463    }
01464 
01465 }

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

Reimplemented from UgliGeometry.

Definition at line 403 of file UgliGeometryReroot.cxx.

References RerootExodus::ActvPlaneName(), UgliGeometry::BuildNodes(), UgliGeometry::fPlaneTable, UgliGeometry::fRootGeom, gMINFast, Msg::kFatal, Msg::kInfo, MSG, RerootExodus::NumberOfPlanes(), RerootExodus::PasvPlaneName(), and RerootExodus::RerootPln2PlnId().

00404 {
00405    // build this geometry's basic nodes (planes)
00406 
00407    MSG("Ugli",Msg::kInfo) << "UgliGeometryReroot::BuildNodes " << endl;
00408 
00409    if (!gMINFast) {
00410       MSG("Ugli",Msg::kFatal) 
00411          << "UgliGeometryReroot::BuildNodes lacked gMINFast" 
00412          << endl;
00413       return;
00414    }
00415 
00416 #ifndef NO_UGLI_DATABASE
00417    UgliGeometry::BuildNodes(vldc);
00418 #else
00419    MSG("Ugli",Msg::kInfo) 
00420       << "UgliGeometryReroot BuildNodes NO_UGLI_DATABASE " << endl << endl;
00421 
00422 
00423    fRootGeom->cd();
00424    TNodeX* hallnode = dynamic_cast<TNodeX*>(fRootGeom->GetNode("hall"));
00425    hallnode->cd();
00426 
00427    Int_t nscint = RerootExodus::NumberOfPlanes(kTRUE);
00428    Int_t nsteel = RerootExodus::NumberOfPlanes(kFALSE);
00429    Int_t npairs = TMath::Max(nscint,nsteel);
00430    
00431    if (!fPlaneNodes) fPlaneNodes = new TObjArray(nscint+nsteel);
00432 
00433    TNodeX* node = 0;
00434 
00435    for (Int_t rpln = 0; rpln < npairs; rpln++) {
00436 
00437       TString pname = RerootExodus::PasvPlaneName(rpln);
00438       if ( pname[0] == 'B' || pname[0] == 'S' ) {
00439          PlexPlaneId steelid = RerootExodus::RerootPln2PlnId(rpln,kFALSE);
00440          node = new UgliSteelPlnNode(this,steelid);
00441          fPlaneNodes->AddLast(node);
00442          fPlaneTable[steelid] = node;
00443       }
00444 
00445       TString aname = RerootExodus::ActvPlaneName(rpln);
00446       if ( aname[0] == 'F' || aname[0] == 'M' ) {
00447          PlexPlaneId scintid = RerootExodus::RerootPln2PlnId(rpln,kTRUE);
00448          node = new UgliScintPlnNode(this,scintid);
00449          fPlaneNodes->AddLast(node);
00450          fPlaneTable[scintid] = node;
00451       }
00452 
00453    }
00454 #endif
00455 
00456 }

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

Reimplemented from UgliGeometry.

Definition at line 136 of file UgliGeometryReroot.cxx.

References Munits::base_length_name, UgliGeometry::BuildShapes(), Munits::cm, REROOT_SuperModule::DnSpace(), UgliGeometry::fVldRange, REROOT_Geom::geommiscs(), VldRange::GetDetectorMask(), MinosOutline::GetGlobalXOffset(), MINFast::GetREROOTGeom(), gMINFast, REROOT_GeomMisc::HallXmax(), REROOT_GeomMisc::HallXmin(), REROOT_GeomMisc::HallYmax(), REROOT_GeomMisc::HallYmin(), REROOT_GeomMisc::HallZmax(), REROOT_GeomMisc::HallZmin(), Detector::kCalib, PlaneCoverage::kComplete, Msg::kFatal, Msg::kInfo, Detector::kNear, PlaneCoverage::kNearFull, PlaneCoverage::kNearPartial, PlaneView::kUnknown, MSG, REROOT_GeomMisc::NSupmdl(), PlexPlaneId::SetIsSteel(), REROOT_Geom::supermodules(), REROOT_SuperModule::SupX0(), REROOT_SuperModule::SupY0(), REROOT_SuperModule::UpSpace(), REROOT_GeomMisc::VHall(), REROOT_SuperModule::Xmax(), REROOT_SuperModule::Xmin(), REROOT_SuperModule::Ymax(), REROOT_SuperModule::Ymin(), REROOT_SuperModule::Zmax(), and REROOT_SuperModule::Zmin().

00137 {
00138    // build some basic shapes (not planes or strips)
00139 
00140    MSG("Ugli",Msg::kInfo) << "UgliGeometryReroot::BuildShapes " << endl;
00141 
00142    if (!gMINFast) {
00143       MSG("Ugli",Msg::kFatal) 
00144          << "UgliGeometryReroot::BuildShapes lacked gMINFast" 
00145          << endl;
00146       return;
00147    }
00148 
00149    UgliGeometry::BuildShapes(vldc);
00150 
00151 #ifdef NO_UGLI_DATABASE   
00152    MSG("Ugli",Msg::kInfo) 
00153       << "UgliGeometryReroot BuildShapes NO_UGLI_DATABASE " << endl << endl;
00154 
00155    TString name;
00156    MinosOutline *outline = 0;
00157 
00159 
00160    REROOT_Geom  *rgeo = gMINFast->GetREROOTGeom();
00161    const TClonesArray *geommiscs    = rgeo->geommiscs();
00162    const TClonesArray *supermodules = rgeo->supermodules();
00163    REROOT_GeomMisc    *geommisc     = (REROOT_GeomMisc*) geommiscs->At(0);
00164    REROOT_SuperModule *supermodule  = 0;
00165 
00166    TShape     *ashapeptr = 0;
00167    TNodeX     *anodeptr  = 0;
00168    TNodeX     *worldnode = 0;
00169    TNodeX     *hallnode  = 0;
00170 
00171    Float_t local[3];
00172    Float_t global[3];
00173 
00174    // build this geometry's shapes
00175 
00176    Float_t xsize = geommisc->VHall()[0] * Munits::cm;
00177    Float_t ysize = geommisc->VHall()[1] * Munits::cm;
00178    Float_t zsize = geommisc->VHall()[2] * Munits::cm;
00179 
00180    // override so we can dispense with TView for now
00181    xsize = TMath::Max(TMath::Abs(geommisc->HallXmin()*Munits::cm),
00182                       TMath::Abs(geommisc->HallXmax()*Munits::cm)) + 
00183            100.*Munits::cm;
00184    ysize = TMath::Max(TMath::Abs(geommisc->HallYmin()*Munits::cm),
00185                       TMath::Abs(geommisc->HallYmax()*Munits::cm)) + 
00186            100.*Munits::cm;
00187    zsize = 0.5*(geommisc->HallZmax() - geommisc->HallZmin())*Munits::cm;
00188 
00189    // scale xysize by sqrt(2) so rotated UV space still encloses hall
00190    Float_t xysize = TMath::Max(xsize,ysize) * TMath::Sqrt(2.0);
00191    xsize = xysize;
00192    ysize = xysize;
00193 
00194    ashapeptr = new TBRIK("worldvol","The world space","void",
00195                          xysize,xysize,zsize+100.*Munits::cm);
00196 
00197    worldnode  = new TNodeX("worldnode","The world space",
00198                           "worldvol",0.,0.,0.);
00199    worldnode->SetVisibility(1); // make the world outline invisible
00200    worldnode->SetLineColor(kYellow);
00201    worldnode->cd();
00202 
00203 
00204    ashapeptr = new TSPHE("originvol","origin","void",10.*Munits::cm);
00205    anodeptr  = new TNodeX("originnode","origin","originvol",0.,0.,0.);
00206    anodeptr->SetLineColor(kMagenta);
00207    
00208    ashapeptr = new TBRIK("hall","The hall","void",
00209                          geommisc->VHall()[0]*Munits::cm,
00210                          geommisc->VHall()[1]*Munits::cm,
00211                          zsize);
00212 
00213    Float_t x0hall = 0.5 * ( geommisc->HallXmin()*Munits::cm + 
00214                             geommisc->HallXmax()*Munits::cm);
00215    Float_t y0hall = 0.5 * ( geommisc->HallYmin()*Munits::cm + 
00216                             geommisc->HallYmax()*Munits::cm);
00217    Float_t z0hall = 0.5 * ( geommisc->HallZmin()*Munits::cm + 
00218                             geommisc->HallZmax()*Munits::cm);
00219 
00220    const Float_t huge = 1.0e30;
00221 
00222    if (x0hall>huge) x0hall = 0.0;
00223    if (y0hall>huge) y0hall = 0.0;
00224    // world z=0 is now at first face of steel
00225    //   if (z0hall>huge) 
00226    supermodule = (REROOT_SuperModule*) supermodules->At(0);
00227    z0hall = geommisc->VHall()[2]*Munits::cm - supermodule->UpSpace()*Munits::cm;
00228 
00229    z0hall = 0;  //rwh: override for funky placement of CalDet specials
00230 
00231    hallnode = new TNodeX("hall","The hall",
00232                          "hall",x0hall,y0hall,z0hall);
00233    hallnode->SetVisibility(1); // leave the hall outline invisible
00234    hallnode->SetLineColor(kRed);
00235 
00236    MSG("Ugli",Msg::kInfo)
00237         << " UgliGeometryReroot::BuildShapes hall is sized [" 
00238         << geommisc->VHall()[0]*Munits::cm << "," 
00239         << geommisc->VHall()[1]*Munits::cm << "," 
00240         << geommisc->VHall()[2]*Munits::cm << "] "
00241         << Munits::base_length_name << "s " << endl
00242         << "    centered at [" 
00243         << x0hall << "," 
00244         << y0hall << "," 
00245         << z0hall << "]" << endl; 
00246 
00247    MSG("Ugli",Msg::kInfo) << endl
00248       << " X hall limits " 
00249       << geommisc->HallXmin()*Munits::cm << " "
00250       << geommisc->HallXmax()*Munits::cm << endl
00251       << " Y hall limits " 
00252       << geommisc->HallYmin()*Munits::cm << " "
00253       << geommisc->HallYmax()*Munits::cm << endl
00254       << " Z hall limits " 
00255       << geommisc->HallZmin()*Munits::cm << " " 
00256       << geommisc->HallZmax()*Munits::cm << endl;
00257    
00258 
00259    // the VldRange describing this geometry should only have on bit set
00260    Detector::Detector_t nearfar = 
00261       (Detector::Detector_t) fVldRange.GetDetectorMask();
00262 //      ( geommisc->NearFar() < 0 ) ? Detector::kNear : Detector::kFar;
00263 
00264    Int_t nsupmdl = geommisc->NSupmdl();
00265 
00266    Char_t xx[40];
00267    TString supmdl_name, outline_name;
00268 
00269    for (Int_t isupmdl = 0; isupmdl < nsupmdl; isupmdl++) {
00270 
00271       supermodule = (REROOT_SuperModule*) supermodules->At(isupmdl);
00272 
00273       hallnode->cd();
00274       hallnode->UpdateMatrix();
00275 
00276       Float_t zmin_supmdl = supermodule->Zmin()*Munits::cm + 
00277                             supermodule->UpSpace()*Munits::cm;
00278       Float_t zmax_supmdl = supermodule->Zmax()*Munits::cm - 
00279                             supermodule->DnSpace()*Munits::cm;
00280       Float_t dz_supmdl = 0.5*(zmax_supmdl-zmin_supmdl);
00281       Float_t z0_supmdl = 0.5*(zmax_supmdl+zmin_supmdl) - z0hall;
00282       Float_t x0_supmdl = supermodule->SupX0()*Munits::cm; // - x0hall;
00283       Float_t y0_supmdl = supermodule->SupY0()*Munits::cm; // - y0hall;
00284 
00285 //      cout << " SM" << isupmdl << " zlimits [" 
00286 //        << zmin_supmdl << "," 
00287 //        << zmax_supmdl << "] centered at [" 
00288 //        << x0_supmdl << "," 
00289 //        << y0_supmdl << "," 
00290 //        << z0_supmdl << "]" << endl; 
00291 
00292       global[0] = x0_supmdl;
00293       global[1] = y0_supmdl;
00294       global[2] = z0_supmdl;
00295 
00296       hallnode->Master2Local(global,local);
00297 
00298       x0_supmdl = local[0];
00299       y0_supmdl = local[1];
00300       z0_supmdl = local[2];
00301 
00302 //      cout << " local position ["
00303 //        << x0_supmdl << "," 
00304 //        << y0_supmdl << "," 
00305 //        << z0_supmdl << "]" << endl; 
00306 
00307       Float_t x0shift;
00308       PlaneView::PlaneView_t noview = PlaneView::kUnknown;
00309       PlaneCoverage::PlaneCoverage_t cover = PlaneCoverage::kComplete;
00310       if (nearfar == Detector::kNear)
00311                                      cover = PlaneCoverage::kNearFull;
00312 
00313       sprintf(xx,"%d",isupmdl);
00314       supmdl_name = "SM"; supmdl_name += xx;
00315 
00316 // outline "partial" active -- only first SM of near detector
00317       if (nearfar == Detector::kNear && isupmdl == 0) {
00318          PlexPlaneId partActv(nearfar,-1,false,noview,
00319                               PlaneCoverage::kNearPartial);
00320          outline_name = supmdl_name + "PartialActive";
00321          outline = new MinosOutline(outline_name,outline_name,"void",
00322                                     partActv,false,dz_supmdl,1.);
00323          x0shift = outline->GetGlobalXOffset() * Munits::cm;
00324          anodeptr = new TNodeX(outline_name,outline_name,outline_name,
00325                               x0_supmdl+x0shift,y0_supmdl,z0_supmdl);
00326          anodeptr->SetLineColor(kGreen);
00327          anodeptr->SetVisibility(1);
00328       }
00329 
00330 // special case for CalDet supermodules 5th+ (isupmdl>5) which are placed
00331 // in odd location and orientation
00332 
00333      if (nearfar == Detector::kCalib && isupmdl >= 5) {
00334 
00335         outline_name = supmdl_name;
00336         Float_t dx = 0.5*(supermodule->Xmax()*Munits::cm - 
00337                           supermodule->Xmin()*Munits::cm);
00338         Float_t dy = 0.5*(supermodule->Ymax()*Munits::cm - 
00339                           supermodule->Ymin()*Munits::cm);
00340         Float_t dz = 0.5*(supermodule->Zmax()*Munits::cm - 
00341                           supermodule->Zmin()*Munits::cm);
00342         Float_t x0 = 0.5*(supermodule->Xmax()*Munits::cm + 
00343                           supermodule->Xmin()*Munits::cm);
00344         Float_t y0 = 0.5*(supermodule->Ymax()*Munits::cm + 
00345                           supermodule->Ymin()*Munits::cm);
00346         Float_t z0 = 0.5*(supermodule->Zmax()*Munits::cm + 
00347                           supermodule->Zmin()*Munits::cm);
00348         TBRIK *caldet_special = 0;
00349         caldet_special = new TBRIK(supmdl_name,supmdl_name,"void",dx,dy,dz);
00350         anodeptr = new TNodeX(supmdl_name,supmdl_name,supmdl_name,x0,y0,z0);
00351         anodeptr->SetLineColor(kGreen);
00352         anodeptr->SetVisibility(1);
00353         // skip the rest of the shapes for this "supermodule"
00354         // move on to next "supermodule"
00355         continue; 
00356      }
00357 
00358 // outline "full" active
00359       outline_name = supmdl_name + "FullActive";
00360       PlexPlaneId fullActv(nearfar,-1,false,noview,cover);
00361       outline = new MinosOutline(outline_name,outline_name,"void",
00362                                  fullActv,false,dz_supmdl,1.);
00363       x0shift = outline->GetGlobalXOffset() * Munits::cm;
00364       anodeptr = new TNodeX(outline_name,outline_name,outline_name,
00365                            x0_supmdl+x0shift,y0_supmdl,z0_supmdl);
00366       anodeptr->SetLineColor(kGreen);
00367       anodeptr->SetVisibility(1);
00368 
00369       outline_name = supmdl_name + "SteelEars";
00370       PlexPlaneId steelid = fullActv;
00371       steelid.SetIsSteel(true);
00372       outline = new MinosOutline(outline_name,outline_name,"void",
00373                                  steelid,true,dz_supmdl,1.);
00374       x0shift = outline->GetGlobalXOffset() * Munits::cm;
00375       anodeptr = new TNodeX(outline_name,outline_name,outline_name,
00376                            x0_supmdl+x0shift,y0_supmdl,z0_supmdl);
00377       anodeptr->SetLineColor(kBlue);
00378       anodeptr->SetVisibility(1);
00379 
00380    }
00381 
00382       /*******************
00383   Double_t local[3];
00384   Double_t master[3];
00385 
00386   TPolyLine3D* line = new TPolyLine3D(2);
00387   local[0] = 0;
00388   local[1] = 0;
00389   local[2] = 0;
00390   westw->UpdateMatrix();
00391   westw->Local2Master(local,master);
00392   line->SetPoint(0,master[0],master[1],master[2]);
00393   eastw->UpdateMatrix();
00394   eastw->Local2Master(local,master);
00395   line->SetPoint(1,master[0],master[1],master[2]);
00396   *****************/                              
00397 #endif
00398 
00399 }

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

Reimplemented from UgliGeometry.

Definition at line 123 of file UgliGeometryReroot.cxx.

References UgliGeometry::BuildVldRange(), RerootExodus::BuildVldRange(), and UgliGeometry::fVldRange.

00124 {
00125    // Build VldRange from VldContext
00126 
00127 #ifdef NO_UGLI_DATABASE
00128    fVldRange = RerootExodus::BuildVldRange();
00129 #else
00130    UgliGeometry::BuildVldRange(vldc);
00131 #endif
00132 
00133 }

PLANEPOS_DEF * UgliGeometryReroot::CreateAndBackFillPlanePosDef ( REROOT_PlanePos  )  [static, private]

Definition at line 1469 of file UgliGeometryReroot.cxx.

References REROOT_PlanePos::ActvName(), PLANEPOS_DEF::ActvName, REROOT_PlanePos::ActvSpec(), PLANEPOS_DEF::ActvSpec, REROOT_PlanePos::ID(), PLANEPOS_DEF::ID, REROOT_PlanePos::IModule(), PLANEPOS_DEF::IModule, REROOT_PlanePos::InMdl(), PLANEPOS_DEF::InMdl, REROOT_PlanePos::ISuper(), PLANEPOS_DEF::ISuper, REROOT_PlanePos::PairZmax(), PLANEPOS_DEF::PairZmax, REROOT_PlanePos::PairZmin(), PLANEPOS_DEF::PairZmin, REROOT_PlanePos::PasvName(), PLANEPOS_DEF::PasvName, REROOT_PlanePos::PasvSpec(), PLANEPOS_DEF::PasvSpec, REROOT_PlanePos::Rotm(), PLANEPOS_DEF::Rotm, REROOT_PlanePos::RotmID(), PLANEPOS_DEF::RotmID, REROOT_PlanePos::XYActv(), PLANEPOS_DEF::XYActv, REROOT_PlanePos::XYPasv(), PLANEPOS_DEF::XYPasv, REROOT_PlanePos::ZFrntActv(), PLANEPOS_DEF::ZFrntActv, REROOT_PlanePos::ZFrntPasv(), and PLANEPOS_DEF::ZFrntPasv.

Referenced by MakeTempDbiPosInfo().

01470 {
01471    // create a PLANEPOS_DEF structure from a REROOT_PlanePos object
01472    // (the reverse of the REROOT_PlanePos ctor)
01473 
01474          PLANEPOS_DEF *ppdef = new PLANEPOS_DEF;
01475          ppdef->ID = reroot_PlanePos->ID() + 1;              // C->F77 index
01476          ppdef->ISuper  = reroot_PlanePos->ISuper() + 1;     // C->F77 index
01477          ppdef->IModule = reroot_PlanePos->IModule() + 1;    // C->F77 index
01478          ppdef->InMdl   = reroot_PlanePos->InMdl() + 1;      // C->F77 index
01479          ppdef->PairZmin = reroot_PlanePos->PairZmin();
01480          ppdef->PairZmax = reroot_PlanePos->PairZmax();
01481          strncpy(ppdef->PasvName,reroot_PlanePos->PasvName(),4);
01482          ppdef->XYPasv[0] = reroot_PlanePos->XYPasv()[0];
01483          ppdef->XYPasv[1] = reroot_PlanePos->XYPasv()[1];
01484          ppdef->ZFrntPasv = reroot_PlanePos->ZFrntPasv();
01485          strncpy(ppdef->ActvName,reroot_PlanePos->ActvName(),4);
01486          ppdef->XYActv[0] = reroot_PlanePos->XYActv()[0];
01487          ppdef->XYActv[1] = reroot_PlanePos->XYActv()[1];
01488          ppdef->ZFrntActv = reroot_PlanePos->ZFrntActv();
01489          strncpy(ppdef->Rotm,reroot_PlanePos->Rotm(),4);
01490          ppdef->ActvSpec  = reroot_PlanePos->ActvSpec() + 1; // C->F77 index
01491          ppdef->PasvSpec  = reroot_PlanePos->PasvSpec() + 1; // C->F77 index
01492          ppdef->RotmID    = reroot_PlanePos->RotmID() + 1;   // C->F77 index
01493 
01494          return ppdef;
01495 }

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

Reimplemented from UgliGeometry.

Definition at line 117 of file UgliGeometryReroot.cxx.

References gMINFast, UgliGeometry::kNotThere, and UgliGeometry::kOkay.

Referenced by UgliGeometryReroot().

00118 { if (gMINFast) return UgliGeometry::kOkay;
00119  else           return UgliGeometry::kNotThere; 
00120 }

void UgliGeometryReroot::MakeTempDbiGeometry ( const VldContext vldc  )  [protected]

Definition at line 484 of file UgliGeometryReroot.cxx.

References DbiWriter< T >::Close(), Munits::cm, DbiCascader::CreateTemporaryTable(), UgliGeometry::fVldRange, DbiTableProxy::GetCache(), DbiTableProxyRegistry::GetCascader(), VldRange::GetDetectorMask(), RerootExodus::GetGeomMisc(), UgliDbiGeometry::GetTableDescr(), REROOT_GeomMisc::HallXmax(), REROOT_GeomMisc::HallXmin(), REROOT_GeomMisc::HallYmax(), REROOT_GeomMisc::HallYmin(), REROOT_GeomMisc::HallZmax(), REROOT_GeomMisc::HallZmin(), DbiTableProxyRegistry::Instance(), Detector::kCalDet, Msg::kWarning, MSG, DbiCache::SetStale(), and DbiWriter< T >::TableProxy().

Referenced by MakeTempTables().

00485 {
00486    // use REROOT data to fill MySQL temporary UgiDbiGeometry table
00487 
00488    const char* tblName  = "UGLIDBIGEOMETRY";
00489    const char* tblDescr =  UgliDbiGeometry::GetTableDescr();
00490 
00491    // get the cascader
00492    DbiCascader& cascader = 
00493       DbiTableProxyRegistry::Instance().GetCascader();
00494 
00495    // find a db we can write temp tables to
00496    Int_t dbNoTemp = cascader.CreateTemporaryTable(tblName,tblDescr);
00497    if ( dbNoTemp < 0 ) {
00498       MSG("Ugli",Msg::kWarning) 
00499          << "No database will accept temporary tables." << endl;
00500       return;
00501    }
00502 
00503    // create a DbiWriter
00504    Int_t aggNo    = -1;
00505    Dbi::Task task = 0;
00506    VldTimeStamp now;
00507    DbiWriter<UgliDbiGeometry> writer(fVldRange,aggNo,task,now,dbNoTemp);
00508 
00509    // clear any copy that's being cached
00510    writer.TableProxy().GetCache()->SetStale();
00511 
00512    // dangerous, but geometry can't but one bit set in VldRange's detmask
00513    Detector::Detector_t detector = 
00514       (Detector::Detector_t) fVldRange.GetDetectorMask();
00515    bool isXYUV = false;
00516    if (Detector::kCalDet == detector) isXYUV = true;
00517 
00518    REROOT_GeomMisc *geommisc = RerootExodus::GetGeomMisc();
00519 
00520    Float_t hall_min[3];
00521    Float_t hall_max[3];
00522 
00523    hall_min[0] = geommisc->HallXmin() * Munits::cm;
00524    hall_min[1] = geommisc->HallYmin() * Munits::cm;
00525    hall_min[2] = geommisc->HallZmin() * Munits::cm;
00526    hall_max[0] = geommisc->HallXmax() * Munits::cm;
00527    hall_max[1] = geommisc->HallYmax() * Munits::cm;
00528    hall_max[2] = geommisc->HallZmax() * Munits::cm;
00529 
00530    // create a row
00531    UgliDbiGeometry row(detector,isXYUV,hall_min,hall_max);
00532 
00533    // store the row into the DbiWriter
00534    writer << row;
00535 
00536    // in this case there is only one rot
00537    // close the writer (validate and write)
00538    bool success = writer.Close();
00539 
00540    if (!success) 
00541       MSG("Ugli",Msg::kWarning) 
00542          << "Failed to write to temporary table." << endl;
00543 
00544 }

void UgliGeometryReroot::MakeTempDbiPosInfo ( const VldContext vldc  )  [protected]

Definition at line 780 of file UgliGeometryReroot.cxx.

References ABtoEastWest(), RerootExodus::ActvPlaneName(), REROOT_PlaneSpec::AirGap(), PlexPlaneId::AsString(), REROOT_PlaneSpec::BMap(), RerootExodus::BuildVldContext(), REROOT_PlaneSpec::CellWidth(), REROOT_CellPos::ClearFiberA(), REROOT_CellPos::ClearFiberB(), DbiWriter< T >::Close(), Munits::cm, CreateAndBackFillPlanePosDef(), DbiCascader::CreateTemporaryTable(), Munits::degree, UgliGeometry::fVldRange, DbiTableProxy::GetCache(), DbiTableProxyRegistry::GetCascader(), RerootExodus::GetCellPos(), VldContext::GetDetector(), PlexPlaneId::GetDetector(), UgliDbiScintMdlStruct::GetFirstStrip(), RerootExodus::GetGeomMisc(), REROOT_Geom::GetGlobalZ0Shift(), UgliDbiScintMdlStruct::GetLastStrip(), UgliDbiScintPlnStruct::GetNModules(), PlexPlaneId::GetPlane(), PlexPlaneId::GetPlaneCoverage(), RerootExodus::GetPlanePos(), RerootExodus::GetPlaneSpec(), PlexPlaneId::GetPlaneView(), MINFast::GetREROOTGeom(), DbiResultPtr< T >::GetRowByIndex(), UgliDbiStrip::GetTableDescr(), UgliDbiScintMdl::GetTableDescr(), UgliDbiScintPln::GetTableDescr(), UgliDbiSteelPln::GetTableDescr(), gMINFast, PLANEPOS_DEF::ID, PLANEPOS_DEF::InMdl, DbiTableProxyRegistry::Instance(), iscaldet, PlaneView::kA, PlaneView::kB, Detector::kCalDet, Msg::kDebug, Msg::kError, Detector::kFar, Msg::kInfo, Detector::kNear, PlaneCoverage::kNoActive, PlaneView::kU, PlaneCoverage::kUnknown, PlaneView::kV, Msg::kVerbose, Msg::kWarning, PlaneView::kX, PlaneView::kY, Munits::m, MSG, REROOT_GeomMisc::NPlanes(), PLANEPOS_DEF::PairZmax, PLANEPOS_DEF::PairZmin, RerootExodus::RerootPln2PlnId(), RerootExodus::SEIdToLPos(), RerootExodus::SEIdToTPos(), PlexPlaneId::SetIsSteel(), PlexPlaneId::SetPlane(), DbiCache::SetStale(), RerootExodus::SteelToRerootPlane(), DbiWriter< T >::TableProxy(), REROOT_PlaneSpec::Thickness(), REROOT_PlanePos::XYActv(), REROOT_PlanePos::XYPasv(), PLANEPOS_DEF::XYPasv, PLANEPOS_DEF::ZFrntActv, REROOT_PlanePos::ZFrntPasv(), PLANEPOS_DEF::ZFrntPasv, and zoffset_REROOT().

Referenced by MakeTempTables().

00781 {
00782    // use REROOT data to fill MySQL temporary tables:
00783    // UgiDbiSteelPln, UgiDbiScintPln, UgiDbiScintMdl, UgiDbiStrip 
00784 
00785   MSG("Ugli",Msg::kInfo) << "UgliGeometryReroot: Start MakeTempDbiPosInfo" << endl;
00786 
00787    const char* steelTblName  = "UGLIDBISTEELPLN";
00788    const char* steelTblDescr =  UgliDbiSteelPln::GetTableDescr();
00789 
00790    const char* plnTblName  = "UGLIDBISCINTPLN";
00791    const char* plnTblDescr =  UgliDbiScintPln::GetTableDescr();
00792 
00793    const char* mdlTblName  = "UGLIDBISCINTMDL";
00794    const char* mdlTblDescr =  UgliDbiScintMdl::GetTableDescr();
00795 
00796    const char* stripTblName  = "UGLIDBISTRIP";
00797    const char* stripTblDescr =  UgliDbiStrip::GetTableDescr();
00798 
00799    // get the cascader
00800    DbiCascader& cascader = 
00801       DbiTableProxyRegistry::Instance().GetCascader();
00802 
00803    // find a db we can write temp tables to 
00804    Int_t steelDb = cascader.CreateTemporaryTable(steelTblName,steelTblDescr);
00805    Int_t plnDb   = cascader.CreateTemporaryTable(plnTblName,plnTblDescr);
00806    Int_t mdlDb   = cascader.CreateTemporaryTable(mdlTblName,mdlTblDescr);
00807    Int_t stripDb = cascader.CreateTemporaryTable(stripTblName,stripTblDescr);
00808    if ( steelDb < 0 || plnDb < 0 || mdlDb < 0 || stripDb < 0) {
00809       MSG("Ugli",Msg::kWarning) 
00810          << "No database will accept temporary tables." << endl;
00811       return;
00812    }
00813 
00814    typedef struct angles { Char_t view; 
00815       Float_t thetax, phix, thetay, phiy, thetaz, phiz; } angles_t;
00816 
00817    angles_t gminos_angles[] =
00818    { {'X',  90,   0,  90,  90,   0,   0}, //[0]
00819      {'Y',  90, 270,  90,   0,   0,   0}, //[1]
00820      {'U',  90, -45,  90,  45,   0,   0}, //[2]  90,315, 90, 45,  0,  0
00821      {'V',  90,  45,  90, 135,   0,   0}, //[3]  90,225, 90,315,  0,  0 !!
00822      {'A',  90,   0,   0,   0,  90, 270}, //[4]
00823      {'B', 180,   0,  90,   0,  90, 270}, //[5]
00824      {'W',  90,  45,  90, 135,   0,   0}, //[6]  90, 45, 90,135,  0,  0
00825      {'?',  90,   0,  90,  90,   0,   0}  //[7]
00826    };
00827    int nangles = sizeof(gminos_angles) / sizeof(angles_t);
00828 
00829    for (int i=0; i<nangles; i++) {
00830       // convert to radians by saying these numbers are in degrees
00831       gminos_angles[i].thetax *= Munits::degree;
00832       gminos_angles[i].thetay *= Munits::degree;
00833       gminos_angles[i].thetaz *= Munits::degree;
00834       gminos_angles[i].phix   *= Munits::degree;
00835       gminos_angles[i].phiy   *= Munits::degree;
00836       gminos_angles[i].phiz   *= Munits::degree;
00837    }
00838 
00839    // loop over the all detector planes
00840    // +1 because of active-passive switch
00841    int npairs = RerootExodus::GetGeomMisc()->NPlanes() + 1;
00842 
00843    // a fake in case there is a missing PlanePos
00844    REROOT_PlanePos *fake_scintpos = 0;
00845    REROOT_PlanePos *fake_steelpos = 0;
00846 
00847    // consistent set of times for DbiWriter's
00848    VldTimeStamp now;
00849    Dbi::Task task = 0;
00850 
00851    int iplnLastWritten = -1;
00852    for (int ipln = 0; ipln<npairs; ipln++) {
00853 
00854       MSG("Ugli",Msg::kInfo) 
00855          << "UgliGeometryReroot: fill temp position table for plane " 
00856          << ipln << "\r" << flush;
00857 
00858       // create DbiWriter for SteelPln, aggregation is by plane #
00859       Int_t aggNo    = ipln;
00860 
00861       // only the steel one here
00862       // others after we know that there is a scint plane
00863       // all scint are attached to a steel (even if it has no thickness)
00864       DbiWriter<UgliDbiSteelPln> steelWriter(fVldRange,aggNo,task,now,steelDb);
00865 
00866       // RWH: Do the others here so that we get a VLD record but no data
00867       // entries for planes that don't have scintillator.  This will
00868       // obscure potentially other entries that it could otherwise
00869       // pick up.
00870       // create DbiWriter for ScintPln, ScintMdl, Strip
00871       // aggregation is by plane #
00872       DbiWriter<UgliDbiScintPln>   plnWriter(fVldRange,aggNo,task,now,plnDb);
00873       DbiWriter<UgliDbiScintMdl>   mdlWriter(fVldRange,aggNo,task,now,mdlDb);
00874       DbiWriter<UgliDbiStrip>    stripWriter(fVldRange,aggNo,task,now,stripDb);
00875 
00876       // clear any copy that's being cached
00877       steelWriter.TableProxy().GetCache()->SetStale();
00878       plnWriter.TableProxy().GetCache()->SetStale();
00879       mdlWriter.TableProxy().GetCache()->SetStale();
00880       stripWriter.TableProxy().GetCache()->SetStale();
00881 
00882       // start looking up REROOT info
00883       int rr_scint = RerootExodus::SteelToRerootPlane(ipln,true);
00884       int rr_steel = RerootExodus::SteelToRerootPlane(ipln,false);
00885       PlexPlaneId scintplnid = RerootExodus::RerootPln2PlnId(rr_scint,true);
00886       PlexPlaneId steelplnid = RerootExodus::RerootPln2PlnId(rr_steel,false);
00887       REROOT_PlanePos  *scintpos  = RerootExodus::GetPlanePos(scintplnid);
00888       REROOT_PlaneSpec *scintspec = RerootExodus::GetPlaneSpec(scintplnid);
00889       REROOT_PlanePos  *steelpos  = RerootExodus::GetPlanePos(steelplnid);
00890       REROOT_PlaneSpec *steelspec = RerootExodus::GetPlaneSpec(steelplnid);
00891 
00892 
00893       // alas some poorly constructed REROOT files have
00894       // no trailing steel behind the last active
00895       // as well as the more normal lead steel without active
00896       bool ok_steel = (steelplnid.GetPlane() == ipln);
00897       bool ok_scint = (scintplnid.GetPlane() == ipln);
00898       if (!ok_steel && !ok_scint) {
00899         MSG("Ugli",Msg::kError)
00900           << endl << "Neither ok_steel nor ok_scint."
00901           << endl;
00902         continue; // this shouldn't happen
00903       }
00904       if (!ok_steel &&  ok_scint) { // construct a valid id
00905          steelplnid = scintplnid;
00906          steelplnid.SetIsSteel(true);
00907          steelpos  = RerootExodus::GetPlanePos(steelplnid);
00908          steelspec = RerootExodus::GetPlaneSpec(steelplnid);
00909       }
00910 
00911       // special case for CalDet ...
00912       // PlexPlaneId expects a plane 0 active it might not be there in REROOT
00913       // GMINOS has no real steel downstream of plane 60
00914       //    the following steel is for the cosmic planes
00915       
00916       bool iscaldet = scintplnid.GetDetector() == Detector::kCalDet;
00917       bool noinfo   = ( !scintspec || !scintpos );
00918       bool caldet0  = iscaldet && noinfo && scintplnid.GetPlane() == 0;
00919       bool caldet60 = iscaldet && scintplnid.GetPlane() == 60;
00920 
00921       char key = RerootExodus::ActvPlaneName(rr_scint)[0];
00922       bool trailing_scint = ( ipln == npairs-1 && ok_scint && !ok_steel 
00923            && ( key == 'F' || key == 'M' ) );
00924 
00925       if (caldet0) {
00926          // for a fake caldet active plane 0 use plane 2 shifted by 2
00927          // assumes dz for both views are the same
00928          PlexPlaneId caldet2id = scintplnid; 
00929          caldet2id.SetPlane(2);
00930          scintpos  = RerootExodus::GetPlanePos(caldet2id);
00931          
00932          // produce an fake REROOT_PlanePos for scintpos
00933          PLANEPOS_DEF *pp = CreateAndBackFillPlanePosDef(scintpos);
00934          // modify it to be the plane it should be
00935          pp->ID       -= 2;
00936          pp->InMdl    -= 2;
00937          Float_t dz = pp->PairZmax - pp->PairZmin;
00938          pp->PairZmin  -= 2*dz - zoffset_REROOT();
00939          pp->PairZmax  -= 2*dz - zoffset_REROOT();
00940          pp->ZFrntPasv -= 2*dz - zoffset_REROOT();
00941          pp->ZFrntActv -= 2*dz - zoffset_REROOT();
00942          // create new fake scintpos
00943          if (fake_scintpos) delete fake_scintpos;
00944          fake_scintpos = new REROOT_PlanePos(pp);
00945          // delete intermediary PLANEPOS_DEF
00946          delete pp;
00947          // use this REROOT_PlanePos for calculations
00948          scintpos = fake_scintpos;
00949 
00950          steelspec = RerootExodus::GetPlaneSpec(caldet2id);
00951 
00952       } // missing caldet active plane 0
00953       else if (caldet60) {
00954          // for a fake caldet passive 60 use plane 58 shifted by 2
00955          // assumes dz for both views are the same
00956          PlexPlaneId caldet58id = steelplnid; 
00957          caldet58id.SetPlane(58);
00958          steelpos  = RerootExodus::GetPlanePos(caldet58id);
00959          
00960          // produce an fake REROOT_PlanePos for steelpos
00961          PLANEPOS_DEF *pp = CreateAndBackFillPlanePosDef(steelpos);
00962          // modify it to be the plane it should be
00963          pp->ID       += 2;
00964          pp->InMdl    += 2;
00965          Float_t dz = pp->PairZmax - pp->PairZmin;
00966          pp->PairZmin  += 2*dz - zoffset_REROOT();
00967          pp->PairZmax  += 2*dz - zoffset_REROOT();
00968          pp->ZFrntPasv += 2*dz - zoffset_REROOT();
00969          pp->ZFrntActv += 2*dz - zoffset_REROOT();
00970          // create new fake steelpos
00971          if (fake_steelpos) delete fake_steelpos;
00972          fake_steelpos = new REROOT_PlanePos(pp);
00973          // delete intermediary PLANEPOS_DEF
00974          delete pp;
00975          // use this REROOT_PlanePos for calculations
00976          steelpos = fake_steelpos;
00977 
00978          steelspec = RerootExodus::GetPlaneSpec(caldet58id);
00979 
00980       } // missing caldet steel for plane 60
00981       else if ( trailing_scint ) {
00982          MSG("Ugli",Msg::kInfo) << endl; // don't overwrite last info message
00983          MSG("Ugli",Msg::kWarning) 
00984             << " Geometry with trailing scint plane " << endl;
00985 
00986          // for a GMINOS geometries (namely 24 pln far detector)
00987          // that have N*<steel+active> rather than
00988          // stell + N*<active+steel>
00989 
00990          PlexPlaneId fakesteelid = steelplnid; 
00991          fakesteelid.SetPlane(steelplnid.GetPlane()-2);
00992          steelpos  = RerootExodus::GetPlanePos(fakesteelid);
00993          
00994          // produce an fake REROOT_PlanePos for steelpos
00995          PLANEPOS_DEF *pp = CreateAndBackFillPlanePosDef(steelpos);
00996          // modify it to be the plane it should be
00997          pp->ID       += 2;
00998          pp->InMdl    += 2;
00999          Float_t dz = pp->PairZmax - pp->PairZmin;
01000          pp->PairZmin  += 2*dz - zoffset_REROOT();
01001          pp->PairZmax  += 2*dz - zoffset_REROOT();
01002          pp->ZFrntPasv += 2*dz - zoffset_REROOT();
01003          pp->ZFrntActv += 2*dz - zoffset_REROOT();
01004          // create new fake steelpos
01005          if (fake_steelpos) delete fake_steelpos;
01006          fake_steelpos = new REROOT_PlanePos(pp);
01007          // delete intermediary PLANEPOS_DEF
01008          delete pp;
01009          // use this REROOT_PlanePos for calculations
01010          steelpos = fake_steelpos;
01011 
01012          steelspec = RerootExodus::GetPlaneSpec(fakesteelid);
01013       }
01014 
01015       // Every (interesting) plane has a steel (of some sort)
01016       if (!steelpos) {
01017         MSG("Ugli",Msg::kInfo)
01018           << endl << "!steelpos for ipln " << ipln << "." << endl;
01019           continue;
01020       }
01021 
01022       // copy locally because AsString uses static 
01023       char steelnam[16], scintnam[16];
01024       sprintf(steelnam,"%s",steelplnid.AsString("c"));
01025       sprintf(scintnam,"%s",scintplnid.AsString("c"));
01026 
01027       MSG("Ugli",Msg::kVerbose) 
01028          << "UgliGeometryReroot: build table info for " 
01029          << steelnam << " " << (int)ok_steel 
01030          << " " << steelpos << " " << steelspec << " "
01031          << scintnam << " " << (int)ok_scint 
01032          << " " << scintpos << " " << scintspec << " "
01033          << RerootExodus::ActvPlaneName(rr_scint)
01034          << endl;
01035 
01036       PlaneCoverage::PlaneCoverage_t cover = scintplnid.GetPlaneCoverage();
01037 
01038       Float_t cell_width   =  0;
01039       Float_t scint_thick  =  0;
01040       Float_t gap_scint    =  0;
01041 
01042       Float_t steel_thick  =  0;
01043       Float_t gap_steel    =  0;
01044       Int_t   melt         = -1;
01045       Float_t x0steel      =  0;
01046       Float_t y0steel      =  0;
01047 
01048       if (scintspec && cover != PlaneCoverage::kNoActive) {
01049          cell_width  = scintspec->CellWidth() * Munits::cm;
01050          scint_thick = scintspec->Thickness() * Munits::cm;
01051          gap_scint   = scintspec->AirGap()[1] * Munits::cm;
01052       }
01053 
01054       if (steelspec) {
01055          steel_thick = steelspec->Thickness() * Munits::cm;
01056          gap_steel   = steelspec->AirGap()[0] * Munits::cm;
01057          melt        = steelspec->BMap() + 1000000;
01058       }
01059 
01060       // steel in GMINOS is always "X" orientation
01061       // (unless it is a CalDet A/B plane)
01062       angles_t steel_angles = gminos_angles[0];
01063 
01064       PlaneView::PlaneView_t view = scintplnid.GetPlaneView();
01065       if (vldc.GetDetector() == Detector::kCalDet ) {
01066          // CalDet U/V are old GMINOS Y/X (yes, that order)
01067          if (view == PlaneView::kU) view = PlaneView::kY;
01068          if (view == PlaneView::kV) view = PlaneView::kX;
01069       }
01070 
01071       // play special games in case of CalDet A & B view planes
01072       if (PlaneView::kA == view || PlaneView::kB == view) {
01073          // UGH!!! those nasty A/B views
01074 
01075          steel_angles = gminos_angles[(int)view];
01076 
01077          // use the info for the steel *upstream*
01078          // as it is used in GMINOS
01079          PlexPlaneId steelid_AB =
01080             RerootExodus::RerootPln2PlnId(rr_scint,false);
01081          steelpos  = RerootExodus::GetPlanePos(steelid_AB);
01082          steelspec = RerootExodus::GetPlaneSpec(steelid_AB);
01083 
01084          steel_thick = steelspec->Thickness() * Munits::cm;
01085          gap_steel   = steelspec->AirGap()[0] * Munits::cm;
01086          melt        = steelspec->BMap() + 1000000;
01087 
01088          // produce an fake REROOT_PlanePos for steelpos
01089          PLANEPOS_DEF *pp = CreateAndBackFillPlanePosDef(steelpos);
01090          // modify it
01091          // compensate for various bits
01092          Float_t dz = 0.5*scintspec->Thickness();
01093          REROOT_Geom  *rgeo = gMINFast->GetREROOTGeom();
01094 
01095 #ifdef XYZZY_DEBUG
01096          cout << " pp->ZFrntPasv " << pp->ZFrntPasv << " cm "
01097               << ", dz " << dz << " cm "
01098               << ", shift " << rgeo->GetGlobalZ0Shift() << " cm "
01099               << ", steel " << steelspec->Thickness() << " cm "
01100               << endl;
01101 //pp->ZFrntPasv 49.99946594 cm , dz 0.55 cm , shift -123.0 cm , steel 0.001 cm 
01102 #endif
01103 
01104          // the following adjustments seem to work ... to within
01105          // either the precision and/or some complicated function of
01106          // the fake steel thickness (0.001cm).
01107          // possibly not enough precision in the rotation angle
01108          // (gets lost in the SQL transfer to/from the DB).
01109          pp->ZFrntPasv +=      dz - rgeo->GetGlobalZ0Shift();
01110          pp->XYPasv[0] -=      dz;
01111          pp->XYPasv[1] -=  2.0*dz;
01112 //gminos  61   0 [  -45.125, -160.476,   -0.200]  [  -49.175, -159.525,   99.800]
01113 //reroot  61   0 [  -45.125, -160.474,   -0.199]  [  -49.176, -159.524,   99.801]
01114          pp->ZFrntPasv += 0.0*steelspec->Thickness();
01115          pp->XYPasv[0] -= 1.0*steelspec->Thickness();
01116          pp->XYPasv[1] -= 1.0*steelspec->Thickness();
01117 //gminos  61   0 [  -45.125, -160.476,   -0.200]  [  -49.175, -159.525,   99.800]
01118 //reroot  61   0 [  -45.125, -160.475,   -0.200]  [  -49.176, -159.525,   99.800]
01119 
01120          if (fake_steelpos) delete fake_steelpos;
01121          fake_steelpos = new REROOT_PlanePos(pp);
01122          delete pp;
01123          steelpos = fake_steelpos;
01124 
01125       } // A & B views
01126 
01127       // scint is on the upstream face of steel
01128       Float_t gap     = gap_scint + gap_steel;
01129       Float_t total_z = scint_thick + gap + steel_thick;
01130 
01131       if (steelpos) {
01132          x0steel = steelpos->XYPasv()[0] * Munits::cm;
01133          y0steel = steelpos->XYPasv()[1] * Munits::cm;
01134       }
01135 
01136       Float_t z_back = steelpos->ZFrntPasv()*Munits::cm + steel_thick;
01137 
01138       // deal with the steel before the scintillator
01139       
01140       // create a SteelPln row, store it in the writer
01141       UgliDbiSteelPln steelRow(steelplnid,melt,steel_thick,total_z,
01142                                x0steel,y0steel,z_back,
01143                                steel_angles.thetax,steel_angles.phix,
01144                                steel_angles.thetay,steel_angles.phiy,
01145                                steel_angles.thetaz,steel_angles.phiz);
01146       steelWriter << steelRow;
01147       //cout << "SteelPln "; steelRow.Print();  //rwh
01148 
01149       // UgliDbiSteelPln is aggregated by plane #, so we're done with it.
01150       bool steelSuccess = steelWriter.Close();
01151       if (!steelSuccess) 
01152          MSG("Ugli",Msg::kWarning) 
01153             << "Failed to write to temporary table." << endl;
01154 
01155       bool doscint = true;
01156       // now do the scintillator plane and sub components
01157       if (cover == PlaneCoverage::kNoActive) doscint = false;
01158       if (cover == PlaneCoverage::kUnknown ) doscint = false;
01159       if ( noinfo && !caldet0 ) doscint = false;
01160       
01161       // one more weird case for actives ... not being a scint plane
01162       TString aname = RerootExodus::ActvPlaneName(rr_scint);
01163       if ( aname[0] != 'F' && aname[0] != 'M' && !caldet0 ) doscint = false;
01164 
01165       if (doscint) {
01166         Float_t x0scint_rel = scintpos->XYActv()[0]*Munits::cm - x0steel;
01167         Float_t y0scint_rel = scintpos->XYActv()[1]*Munits::cm - y0steel;
01168 
01169         // angle of scint relative to steel in the plane of the steel
01170         angles_t scint_angles = gminos_angles[(int)view];
01171         
01172         Float_t zrot = scint_angles.phix - steel_angles.phix;
01173         
01174         // create a ScintPln row, store it in the writer
01175         UgliDbiScintPln plnRow(scintplnid,scint_thick,gap,
01176                                x0scint_rel,y0scint_rel, zrot);
01177         plnWriter << plnRow;
01178         //cout << "ScintPln "; plnRow.Print();
01179         
01180         // use the UgliDbiScintPlnStruct and UgliDbiScintMdlStruct tables
01181         // to tell us the number of modules/plane and strip range in a module
01182         VldContext vldc = RerootExodus::BuildVldContext();
01183         DbiResultPtr<UgliDbiScintPlnStruct> plnStructTable(vldc);
01184         DbiResultPtr<UgliDbiScintMdlStruct> mdlStructTable(vldc);
01185         
01186         unsigned int pln_indx = UgliDbiStructHash(scintplnid).HashAsPlane();
01187         const UgliDbiScintPlnStruct* plnStruct = 
01188                                       plnStructTable.GetRowByIndex(pln_indx);
01189         
01190         // loop over the modules in the plane
01191         for (short mdl = 0; mdl<plnStruct->GetNModules(); mdl++) {
01192           
01193           PlexScintMdlId scintmdlid(scintplnid,mdl);
01194           unsigned int mdl_indx = 
01195                        UgliDbiStructHash(scintmdlid).HashAsScintMdl();
01196           const UgliDbiScintMdlStruct* mdlStruct = 
01197                        mdlStructTable.GetRowByIndex(mdl_indx);
01198           
01199           int first = mdlStruct->GetFirstStrip();
01200           int last  = mdlStruct->GetLastStrip();
01201           
01202           Float_t sum_clrA =0, sum_clrB = 0, sum_tpos = 0;
01203           Float_t tposFirst=9999., tposLast=-9999.;
01204           Int_t   nstrips=0, nstripA=0, nstripB=0;
01205           
01206           // loop over the strips in the module, for determining module params
01207           for (short istrip = first; istrip <= last; istrip++) {
01208             PlexStripEndId seid(scintplnid,istrip);
01209             REROOT_CellPos *cellpos = RerootExodus::GetCellPos(seid);
01210             
01211             const Float_t maxclr = 10.0 * Munits::m;
01212             Float_t clrA = cellpos->ClearFiberA() * Munits::cm;
01213             if (clrA < maxclr) { sum_clrA += clrA; nstripA++; }
01214             Float_t clrB = cellpos->ClearFiberB() * Munits::cm;
01215             if (clrB < maxclr) { sum_clrB += clrB; nstripB++; }
01216             
01217             // cellpos->XYZCenter()[1] "y" measures tpos  ... sort of
01218             // use function so we don't worry about the V flip
01219             Float_t tpos = RerootExodus::SEIdToTPos(seid) * Munits::cm; 
01220             sum_tpos += tpos;
01221             nstrips++;
01222             if (istrip == first) tposFirst = tpos;
01223             if (istrip == last)  tposLast  = tpos;
01224             
01225             
01226           } // loop over strips in module
01227           
01228           // all strips in a module should have the same clear fiber length
01229           // alas there's a mismatch between where GMINOS had modules
01230           // and where the real detector does 
01231           // (the clear lengths followed reality, GMINOS had fixed
01232           //  modules of 24 strips) ... take the average
01233          
01234           if (nstripA<=0||sum_clrA<=0.0) {nstripA=1; sum_clrA=99.99*Munits::m;}
01235           if (nstripB<=0||sum_clrB<=0.0) {nstripB=1; sum_clrB=99.99*Munits::m;}
01236           Float_t clear_east, clear_west;
01237           ABtoEastWest(sum_clrA/nstripA,sum_clrB/nstripB,
01238                        scintplnid,aname,clear_east,clear_west);
01239           
01240           int ipln = scintplnid.GetPlane();
01241           if (ipln == 1 || ipln == 2 || ipln == 3 || ipln == 6 )
01242             MSG("Exodus",Msg::kInfo) 
01243               << "Module " << scintmdlid 
01244               << " clear E=" << clear_east << "(" << nstripA << ") "
01245               << " W=" << clear_west << "(" << nstripB << ") "
01246               << endl;
01247           
01248           // individual tpos measures the centerline of the strip
01249           Float_t mdl_width = TMath::Abs(tposFirst - tposLast) + cell_width;
01250           Float_t tpos_center = sum_tpos/nstrips;
01251           // modules are define to have zero lpos
01252           Float_t lpos_mdl = 0 * Munits::cm; 
01253           Float_t zrot_mdl = 0; // gminos doesn't rotate modules
01254           
01255           // create a ScintMdl row, store it in the writer
01256           UgliDbiScintMdl mdlRow(PlexScintMdlId(scintplnid,mdl),
01257                                  mdl_width,tpos_center,
01258                                  lpos_mdl,zrot_mdl,clear_east,clear_west);
01259           mdlWriter << mdlRow;
01260           //cout << "ScintMdl "; mdlRow.Print();
01261           
01262           // since strip info is relative to the module we have to loop again
01263           // loop over the strips in the module, make Strip row entries
01264           for (int istrip = first; istrip <= last; istrip++) {
01265             PlexStripEndId seid(scintplnid,istrip);
01266             
01267             // cellpos->XYZCenter()[1] "y" measures tpos  ... sort of
01268             // use function so we don't worry about the V flip
01269             Float_t tpos = 
01270                   RerootExodus::SEIdToTPos(seid) * Munits::cm - tpos_center;
01271                
01272             // lpos is the like average of the two ends along "x"
01273             Float_t lpos =
01274                   RerootExodus::SEIdToLPos(seid) * Munits::cm;
01275             
01276             if (vldc.GetDetector() == Detector::kNear && seid.GetPlane()<6)
01277               MSG("Ugli",Msg::kDebug)
01278                 << seid.AsString("c") << " lpos " << lpos << endl;
01279             Float_t zrot = 0; // gminos doesn't rotate strips
01280             
01281             UgliDbiStrip stripRow(seid,tpos,lpos,zrot);
01282             stripWriter << stripRow;
01283             //cout << "Strip "; stripRow.Print();
01284             
01285           } // loop over strips in module
01286           
01287           
01288         } // loop over modules in plane
01289 
01290       } // actual scint information to write (not just VLD entry)
01291 
01292       // close the Mdl and Strip writers (validate and write)
01293       // these are aggregated by plane #, so now's the appropriate time
01294       bool plnSuccess   = plnWriter.Close();
01295       bool mdlSuccess   = mdlWriter.Close();
01296       bool stripSuccess = stripWriter.Close();
01297       
01298       if (! plnSuccess || ! mdlSuccess || ! stripSuccess) 
01299          MSG("Ugli",Msg::kWarning) 
01300             << "Failed to write to temporary table." << endl;
01301       else
01302         iplnLastWritten = ipln;
01303 
01304    } // loop over planes
01305 
01306    if (vldc.GetDetector() == Detector::kFar) {
01307      // make VLD rows (but no data) for planes that might have
01308      // previously existed in GMINOS but don't now.
01309 
01310      for (int ipln = iplnLastWritten+1; ipln<2*249; ++ipln) {
01311        MSG("Ugli",Msg::kInfo) 
01312          << "UgliGeometryReroot: fill temp position table for plane " 
01313          << ipln << "\r" << flush;
01314 
01315        Int_t aggNo    = ipln;
01316        
01317        DbiWriter<UgliDbiSteelPln> steelWriter(fVldRange,aggNo,task,now,steelDb);
01318        DbiWriter<UgliDbiScintPln>   plnWriter(fVldRange,aggNo,task,now,plnDb);
01319        DbiWriter<UgliDbiScintMdl>   mdlWriter(fVldRange,aggNo,task,now,mdlDb);
01320        DbiWriter<UgliDbiStrip>    stripWriter(fVldRange,aggNo,task,now,stripDb);
01321        
01322        // clear any copy that's being cached
01323        steelWriter.TableProxy().GetCache()->SetStale();
01324        plnWriter.TableProxy().GetCache()->SetStale();
01325        mdlWriter.TableProxy().GetCache()->SetStale();
01326        stripWriter.TableProxy().GetCache()->SetStale();
01327      
01328        // attach no data rows
01329      
01330        // close the writer
01331        if (!steelWriter.Close() || !plnWriter.Close() ||
01332            !mdlWriter.Close()   || !stripWriter.Close()  ) {
01333          MSG("Ugli",Msg::kWarning)
01334            << "Failed to write to temporary table." << endl;
01335        }
01336      } //loop over non-existent planes
01337    } // FarDet empty VLD records
01338       
01339    if (fake_scintpos) delete fake_scintpos; fake_scintpos = 0;
01340    if (fake_steelpos) delete fake_steelpos; fake_steelpos = 0;
01341 
01342    MSG("Ugli",Msg::kInfo) << endl << "temp position table filled" << endl;
01343 
01344 }

void UgliGeometryReroot::MakeTempDbiScintStruct ( const VldContext vldc  )  [protected]

Definition at line 547 of file UgliGeometryReroot.cxx.

References ABtoEastWest(), RerootExodus::ActvPlaneName(), PlexStripEndId::AsString(), PlexPlaneId::AsString(), DbiWriter< T >::Close(), Munits::cm, DbiCascader::CreateTemporaryTable(), REROOT_CellPos::FiberTailA(), REROOT_CellPos::FiberTailB(), UgliGeometry::fVldRange, DbiTableProxy::GetCache(), DbiTableProxyRegistry::GetCascader(), RerootExodus::GetCellPos(), RerootExodus::GetGeomMisc(), UgliDbiScintPlnStruct::GetIndex(), UgliDbiStripStruct::GetIndex(), UgliDbiScintMdlStruct::GetIndex(), RerootExodus::GetPlaneSpec(), UgliDbiStripStruct::GetTableDescr(), UgliDbiScintMdlStruct::GetTableDescr(), UgliDbiScintPlnStruct::GetTableDescr(), REROOT_CellPos::IExtr(), DbiTableProxyRegistry::Instance(), Msg::kDebug, Msg::kInfo, Msg::kWarning, MSG, REROOT_GeomMisc::NPlanes(), RerootExodus::NStripsNonZero(), RerootExodus::RerootPln2PlnId(), DbiCache::SetStale(), StandardMdlName(), RerootExodus::SteelToRerootPlane(), DbiWriter< T >::TableProxy(), REROOT_CellPos::XYZFarend(), and REROOT_CellPos::XYZReadout().

Referenced by MakeTempTables().

00548 {
00549    // use REROOT data to fill MySQL temporary tables:
00550    //   UgiDbiScintPlnStruct, UgliDbiScintMdlStruct and UgliDbiStripStruct;
00551 
00552    const char* plnTblName  = "UGLIDBISCINTPLNSTRUCT";
00553    const char* plnTblDescr =  UgliDbiScintPlnStruct::GetTableDescr();
00554 
00555    const char* mdlTblName  = "UGLIDBISCINTMDLSTRUCT";
00556    const char* mdlTblDescr =  UgliDbiScintMdlStruct::GetTableDescr();
00557 
00558    const char* stripTblName  = "UGLIDBISTRIPSTRUCT";
00559    const char* stripTblDescr =  UgliDbiStripStruct::GetTableDescr();
00560 
00561 #undef ORDERED_ENTRY
00562 //#define ORDERED_ENTRY
00563 #ifdef ORDERED_ENTRY
00564    vector<UgliDbiScintPlnStruct>           plnRowVec;
00565    vector<UgliDbiScintPlnStruct>::iterator plnRowIter;
00566    vector<UgliDbiScintMdlStruct>           mdlRowVec;
00567    vector<UgliDbiScintMdlStruct>::iterator mdlRowIter;
00568    vector<UgliDbiStripStruct>            stripRowVec;
00569    vector<UgliDbiStripStruct>::iterator  stripRowIter;
00570 #endif
00571 
00572    // get the cascader
00573    DbiCascader& cascader = 
00574       DbiTableProxyRegistry::Instance().GetCascader();
00575 
00576    // find a db we can write temp tables to 
00577    Int_t plnDb   = cascader.CreateTemporaryTable(plnTblName,plnTblDescr);
00578    Int_t mdlDb   = cascader.CreateTemporaryTable(mdlTblName,mdlTblDescr);
00579    Int_t stripDb = cascader.CreateTemporaryTable(stripTblName,stripTblDescr);
00580    if ( plnDb < 0 || mdlDb < 0 || stripDb < 0) {
00581       MSG("Ugli",Msg::kWarning) 
00582          << "No database will accept temporary tables." << endl;
00583       return;
00584    }
00585 
00586    // create DbiWriters
00587    Int_t aggNo    = -1;
00588    Dbi::Task task = 0;
00589    VldTimeStamp now;
00590 
00591    DbiWriter<UgliDbiScintPlnStruct> plnWriter(fVldRange,aggNo,task,now,plnDb);
00592    DbiWriter<UgliDbiScintMdlStruct> mdlWriter(fVldRange,aggNo,task,now,mdlDb);
00593    DbiWriter<UgliDbiStripStruct>  stripWriter(fVldRange,aggNo,task,now,stripDb);
00594 
00595    // clear any copy that's being cached
00596    plnWriter.TableProxy().GetCache()->SetStale();
00597    mdlWriter.TableProxy().GetCache()->SetStale();
00598    stripWriter.TableProxy().GetCache()->SetStale();
00599 
00600    // list of the indexes we've entered so far
00601    // this way we don't re-enter data
00602    typedef set<UInt_t>                 indxset;
00603    typedef set<UInt_t>::iterator       indxsetIter;
00604    typedef set<UInt_t>::const_iterator indxsetConstIter;
00605    typedef pair<indxsetIter,bool>      indxsetPair;
00606    indxset plnEntered, mdlEnterd, stripEnterd;
00607 
00608    // loop over the active detector planes
00609    int npairs = RerootExodus::GetGeomMisc()->NPlanes() + 1;
00610    for (int ipln = 0; ipln<npairs; ipln++) {
00611       int rr_scint = RerootExodus::SteelToRerootPlane(ipln,true);
00612       PlexPlaneId scintplnid = RerootExodus::RerootPln2PlnId(rr_scint,true);
00613       REROOT_PlaneSpec *spec = RerootExodus::GetPlaneSpec(scintplnid);
00614       // skip onward if there isn't an active at this position
00615       if (!spec) continue;
00616 
00617       // find natural index 
00618       UInt_t plnIndx = UgliDbiStructHash(scintplnid).HashAsPlane();
00619       indxsetPair ispair = plnEntered.insert(plnIndx);
00620       // check if we've already handled this combination of (view,coverage)
00621       // we can tell because if it was already in the set then 
00622       // the insert fails
00623       MSG("Ugli",Msg::kDebug)
00624          << " ScintPlnStruct " << scintplnid.AsString("c") 
00625          << " hash " << plnIndx 
00626          << " ispair.second " << (int)ispair.second << endl;
00627       if (!ispair.second) continue;
00628 
00629       TString aname = RerootExodus::ActvPlaneName(rr_scint);
00630       int mxstrips = RerootExodus::NStripsNonZero(rr_scint);
00631       // loop over the strips in the plane to find out about
00632       // MdlStruct and StripStruct
00633       int last_extru  = -1;
00634       int current_mdl = 0, first_strip = 0, last_strip = 0;  // current mdl info
00635       for (int istrip=0; istrip<mxstrips; istrip++) {
00636          PlexStripEndId seid(scintplnid,istrip);
00637          REROOT_CellPos *cellpos = RerootExodus::GetCellPos(seid);
00638          if (!cellpos) continue;
00639          if (cellpos->IExtr() != last_extru) {
00640             // starting new module
00641             if (last_extru == -1) { 
00642                // first module, just initialize
00643                current_mdl = 0;
00644                first_strip = 0;
00645             }
00646             else {
00647                // make a MdlStruct row entry, prepare for next
00648                string mdlName = StandardMdlName(scintplnid,current_mdl,aname);
00649                PlexScintMdlId scintmdlid(scintplnid,current_mdl);
00650                UgliDbiScintMdlStruct mdlRow(scintmdlid,mdlName,
00651                                             first_strip,last_strip);
00652                MSG("Ugli",Msg::kDebug)
00653                  << "UgliDbiScintMdlStruct entry " << scintplnid.AsString("c")
00654                  << " module " << current_mdl << " [" << first_strip
00655                  << "," << last_strip << "] (hash = "
00656                  << mdlRow.GetIndex(0) << ") " << endl;
00657 #ifdef ORDERED_ENTRY
00658                UInt_t indx = mdlRow.GetIndex(-1);
00659                if (mdlRowVec.size()<=indx) mdlRowVec.resize(indx+1);
00660                // resize invalidated iters
00661                mdlRowIter = mdlRowVec.begin() + indx;
00662                mdlRowVec[indx] = mdlRow;
00663 #else
00664                mdlWriter << mdlRow;
00665 #endif
00666                // prepare for next
00667                current_mdl++;
00668                first_strip = last_strip+1;
00669             }
00670             last_extru = cellpos->IExtr();
00671             last_strip = first_strip; 
00672          } // IExtr != last_extru
00673 
00674          // unpack info about this strip
00675          Float_t totlen, wls_east, wls_west, len_east, len_west, len_bypass;
00676          totlen = TMath::Abs(cellpos->XYZReadout()[0] -
00677                              cellpos->XYZFarend()[0]    ) * Munits::cm;
00678          ABtoEastWest(cellpos->FiberTailA() * Munits::cm,
00679                       cellpos->FiberTailB() * Munits::cm,
00680                       scintplnid,aname,wls_east,wls_west);
00681                       
00682          // for now don't worry about physically split strips
00683          len_east = len_west = totlen;
00684          len_bypass = 0 * Munits::cm;
00685 
00686          // make a StripStruct row entry
00687          UgliDbiStripStruct 
00688             stripRow(seid,current_mdl,totlen,wls_east,wls_west,
00689                      len_east,len_west,len_bypass);
00690 #ifdef ORDERED_ENTRY
00691                UInt_t indx = stripRow.GetIndex(-1);
00692                if (stripRowVec.size()<=indx) stripRowVec.resize(indx+1);
00693                // resize invalidated iters
00694                stripRowIter = stripRowVec.begin() + indx;
00695                stripRowVec[indx] = stripRow;
00696 #else
00697          stripWriter << stripRow;
00698 #endif
00699                                         
00700          last_strip = istrip;
00701       } // end loop over strips
00702       if (last_extru != -1) {
00703          // flush out last MdlStruct row entry
00704          string mdlName = StandardMdlName(scintplnid,current_mdl,aname);
00705          UgliDbiScintMdlStruct mdlRow(PlexScintMdlId(scintplnid,current_mdl),
00706                                       mdlName,first_strip,last_strip);
00707       MSG("Ugli",Msg::kDebug)
00708         << "UgliDbiScintMdlStruct entry " << scintplnid.AsString("c")
00709         << " module " << current_mdl << " [" << first_strip
00710         << "," << last_strip << "] (hash = "
00711         << mdlRow.GetIndex(0) << ") " << endl;
00712 #ifdef ORDERED_ENTRY
00713          UInt_t indx = mdlRow.GetIndex(-1);
00714          if (mdlRowVec.size()<=indx) mdlRowVec.resize(indx+1);
00715          // resize invalidated iters
00716          mdlRowIter = mdlRowVec.begin() + indx;
00717          mdlRowVec[indx] = mdlRow;
00718 #else
00719          mdlWriter << mdlRow;
00720 #endif
00721       }
00722 
00723       // create a PlnStruct row, store it in the writer
00724       Short_t nmodules = current_mdl+1;
00725       UgliDbiScintPlnStruct plnRow(scintplnid,nmodules);
00726       MSG("Ugli",Msg::kDebug)
00727         << "UgliDbiScintPlnStruct entry " << scintplnid.AsString("c")
00728         << " has " << nmodules << " modules (hash = "
00729         << plnRow.GetIndex(0) << ") " << endl;
00730 #ifdef ORDERED_ENTRY
00731       UInt_t indx = plnRow.GetIndex(-1);
00732       if (plnRowVec.size()<=indx) plnRowVec.resize(indx+1);
00733       // resize invalidated iters
00734       plnRowIter = plnRowVec.begin() + indx;
00735       plnRowVec[indx] = plnRow;
00736 #else
00737       plnWriter << plnRow;
00738 #endif
00739 
00740    } // loop over planes
00741 
00742 #ifdef ORDERED_ENTRY
00743    // if where in this block we've delayed entry so that
00744    // we could write the elements in order
00745    MSG("Ugli",Msg::kInfo) 
00746       << "plnRowVec had " << plnRowVec.size() << " entries " << endl;
00747    for (UInt_t i = 0; i< plnRowVec.size(); i++) 
00748      plnWriter << plnRowVec[i];
00749 
00750    MSG("Ugli",Msg::kInfo) 
00751       << "mdlRowVec had " << mdlRowVec.size() << " entries " << endl;
00752    for (UInt_t i = 0; i< mdlRowVec.size(); i++) 
00753      mdlWriter << mdlRowVec[i];
00754 
00755    MSG("Ugli",Msg::kInfo) 
00756       << "stripRowVec had " << stripRowVec.size() << " entries " << endl;
00757    for (UInt_t i = 0; i< stripRowVec.size(); i++) 
00758      stripWriter << stripRowVec[i];
00759 
00760    MSG("Ugli",Msg::kInfo) << "Struct data entry complete" << endl;
00761 #endif
00762 
00763    // close the writers (validate and write)
00764    bool plnSuccess   = plnWriter.Close();
00765    MSG("Ugli",Msg::kInfo) 
00766       << "plnStructWriter " << ((plnSuccess)?"ok":"failed") << endl;
00767    bool mdlSuccess   = mdlWriter.Close();
00768    MSG("Ugli",Msg::kInfo) 
00769       << "mdlStructWriter " << ((mdlSuccess)?"ok":"failed") << endl;
00770    bool stripSuccess = stripWriter.Close();
00771    MSG("Ugli",Msg::kInfo) 
00772       << "stripStructWriter " << ((stripSuccess)?"ok":"failed") << endl;
00773 
00774    if (!plnSuccess || !mdlSuccess || ! stripSuccess) 
00775       MSG("Ugli",Msg::kWarning) 
00776          << "Failed to write to temporary table." << endl;
00777 }

void UgliGeometryReroot::MakeTempTables ( const VldContext vldc  )  [protected]

Definition at line 460 of file UgliGeometryReroot.cxx.

References RerootExodus::BuildVldRange(), UgliGeometry::fVldRange, Msg::kInfo, MakeTempDbiGeometry(), MakeTempDbiPosInfo(), MakeTempDbiScintStruct(), and MSG.

Referenced by UgliGeometryReroot().

00461 {
00462    // use REROOT data to fill MySQL temporary tables
00463 
00464    MSG("Ugli",Msg::kInfo)
00465       << "UgliGeometryReroot::MakeTempTables --"
00466       << endl
00467       << " this step can be bypassed for standard geometries by adding the line: "
00468       << endl
00469       << "     UgliLoanPool::SetAlwaysUseDbi(true);"
00470       << endl
00471       << " in the job .C script before the any code triggers building the geometry."
00472       << endl;
00473 
00474    // writers expect a filled fVldRange
00475    fVldRange = RerootExodus::BuildVldRange();
00476 
00477    MakeTempDbiGeometry(vldc);
00478    MakeTempDbiScintStruct(vldc);
00479    MakeTempDbiPosInfo(vldc);
00480 
00481 }

UgliGeometryReroot& UgliGeometryReroot::operator= ( const UgliGeometryReroot tf  )  [private]

string UgliGeometryReroot::StandardMdlName ( PlexPlaneId  plnid,
int  module,
TString &  aname 
) [protected]

Definition at line 1347 of file UgliGeometryReroot.cxx.

References Detector::AsString(), PlaneCoverage::AsString(), PlaneView::AsString(), PlexPlaneId::GetDetector(), PlexPlaneId::GetPlaneCoverage(), PlexPlaneId::GetPlaneView(), Detector::kCalDet, PlaneCoverage::kComplete, Detector::kFar, Detector::kNear, PlaneCoverage::kNearFull, and PlaneCoverage::kNearPartial.

Referenced by MakeTempDbiScintStruct().

01349 {
01350    // lookup the standard module name
01351    // (this is used for general shape info)
01352 
01353    Detector::Detector_t detector    = plnid.GetDetector();
01354    PlaneView::PlaneView_t view          = plnid.GetPlaneView();
01355    PlaneCoverage::PlaneCoverage_t cover = plnid.GetPlaneCoverage();
01356 
01357    char mchar = '?';
01358    char vchar = PlaneView::AsString(view)[0];
01359 
01360    static char scratch[32];
01361 
01362    switch (detector) {
01363       case (Detector::kNear): {
01364          char key = aname[0];
01365          if      (cover == PlaneCoverage::kNearPartial) {
01366 //            if (module >= 3) break;
01367             if (module >= 4) break;  // wierd GMINOS breakup
01368             const char* mdl_list;
01369             // Q is a fake module having to do with how GMINOS
01370             // uses fixed 24 strip modules
01371 //            if      ('U' == vchar) mdl_list = "IHG";
01372 //            else if ('V' == vchar) mdl_list = "GHI";
01373             if (key == 'F') {
01374               if      ('U' == vchar) mdl_list = "qihg";
01375               else if ('V' == vchar) mdl_list = "ghiq";
01376               else break; // bad view
01377             }
01378             else {
01379               // 'M' planes
01380               if      ('U' == vchar) mdl_list = "IHG";
01381               else if ('V' == vchar) mdl_list = "GHI";
01382               else break; // bad view              
01383             }
01384             mchar = mdl_list[module];
01385          }
01386          else if (cover == PlaneCoverage::kNearFull) {
01387             const char* mdl_list;
01388             if (key == 'F') {
01389               if      ('U' == vchar) mdl_list = "NMLKJ";
01390               else if ('V' == vchar) mdl_list = "JKLMN";
01391               else break; // bad view
01392             }
01393             else {
01394               // 'M' planes
01395               if      ('U' == vchar) mdl_list = "NMLKJ";
01396               else if ('V' == vchar) mdl_list = "JKLMN";
01397               else break; // bad view
01398             }
01399             mchar = mdl_list[module];
01400          }
01401          break; // case kNear
01402       }
01403       case (Detector::kFar): {
01404          if (cover != PlaneCoverage::kComplete) break;
01405          if (module >= 8) break;
01406          const char* mdl_list;
01407          if      ('U' == vchar) mdl_list = "abefFEBA";
01408          else if ('V' == vchar) mdl_list = "abcdDCBA";
01409          else break; // bad view
01410          mchar = mdl_list[module];
01411          break; // case kFar
01412       }
01413       case (Detector::kCalDet): {
01414          if (cover != PlaneCoverage::kComplete) break;
01415          mchar = 'X';
01416          break; // case kCalDet
01417       }
01418    default:  // default to keep away the Warnings
01419       mchar = '?';
01420       break;
01421    }
01422 
01423    if ('?' == mchar) {
01424       char cchar = PlaneCoverage::AsString(cover)[0];
01425       sprintf(scratch,"%c:%c%c%2.2d",Detector::AsString(detector)[0],
01426               cchar,vchar,module);
01427    }
01428    else sprintf(scratch,"%c%c",mchar,vchar);
01429 
01430    return scratch;
01431 }


Friends And Related Function Documentation

friend class UgliLoanPool [friend]

Reimplemented from UgliGeometry.

Definition at line 24 of file UgliGeometryReroot.h.


The documentation for this class was generated from the following files:
Generated on Mon Nov 10 00:56:39 2014 for loon by  doxygen 1.4.7