BfldCanvasSlice Class Reference

#include <BfldCanvasSlice.h>

Inheritance diagram for BfldCanvasSlice:
BfldCanvas

List of all members.

Public Member Functions

 BfldCanvasSlice (VldContext &vldc, int ipln, int iscoil, bool isgap, double zoff=0.0)
 BfldCanvasSlice ()
virtual ~BfldCanvasSlice ()
virtual void Draw ()
int GetPlane () const
bool GetIsGap () const

Private Member Functions

const BfldDbiPlaneMapGetPlaneMap ()
std::string GetAdmixtureString ()

Private Attributes

int fPlane
bool fIsGap

Detailed Description

Definition at line 7 of file BfldCanvasSlice.h.


Constructor & Destructor Documentation

BfldCanvasSlice::BfldCanvasSlice ( VldContext vldc,
int  ipln,
int  iscoil,
bool  isgap,
double  zoff = 0.0 
)

Definition at line 17 of file BfldCanvasSlice.cxx.

References bfld::AsString(), Munits::cm, det, Form(), GetAdmixtureString(), VldContext::GetDetector(), UgliPlnHandle::GetPlexPlaneId(), UgliGeomHandle::GetPlnHandleVector(), UgliPlnHandle::GetZ0(), PlexPlaneId::IsValid(), and BField::SetInterpMethod().

00019   : BfldCanvas(vldc,Form("BfldCanvasSlice%d",ipln),iscoil)
00020   , fPlane(ipln)
00021   , fIsGap(isgap)
00022 { 
00023   SetVldContext(vldc);
00024   if (isgap) SetScaleMax(0.1);
00025 
00026   UgliGeomHandle ugh(vldc);
00027   bool issteel = !isgap;
00028   double dz = zoff;
00029   Detector::Detector_t det = vldc.GetDetector();
00030   PlexPlaneId plnid(det,ipln,issteel);
00031   if ( ! plnid.IsValid() ) {
00032     if ( issteel ) {
00033       // no steel to reference against
00034       cout << "invalid steel plane " << ipln << " " << plnid << endl;
00035       plnid = PlexPlaneId(det,0,true);
00036     } else {
00037       // not legal scint plane
00038       // reference relative to steel by 0.5 of nominal pitch upstream
00039       cout << "invalid scint plane " << ipln << " " << plnid << endl;
00040       plnid = PlexPlaneId(det,ipln,true);
00041       dz -= 0.5 * 5.94*Munits::cm;
00042       if ( ! plnid.IsValid() ) plnid = PlexPlaneId(det,0,true);
00043     }
00044   }
00045   vector<UgliPlnHandle> uphv = ugh.GetPlnHandleVector();
00046   for (unsigned int i = 0; i < uphv.size(); ++i ) {
00047     UgliPlnHandle uph = uphv[i];
00048     if ( uph.GetPlexPlaneId() == plnid ) { 
00049       SetZ(uph.GetZ0()+dz);
00050       break;
00051     }
00052   }
00053 
00054   BField bfld(vldc);
00055   bfld.SetInterpMethod(GetInterpMethod());
00056   Fill(bfld);
00057 
00058   std::string name = Detector::AsString(vldc.GetDetector());
00059   name += ((isgap) ? "_gap" : "_pln");
00060   name += Form("%3.3d",ipln);
00061   name += GetZoomInterpString();
00062   name += " #scale[0.35]{#splitline";
00063   name += "{";
00064   name += GetAdmixtureString();
00065   name += "}";
00066   std::string zoffstr = "{.}";
00067   if ( zoff != 0.0 ) zoffstr = Form("{z0+%5.3f=%7.3f}",zoff,GetZ());
00068   cout << " zoffstr = " << zoffstr << " zoff " << zoff << " dz " << dz << endl;
00069   name += zoffstr;
00070   name += "}";  // finish scale
00071 
00072   SetTitle(name);
00073                     
00074 }

BfldCanvasSlice::BfldCanvasSlice (  ) 

Definition at line 76 of file BfldCanvasSlice.cxx.

00077   : BfldCanvas()
00078   , fPlane(-999)
00079   , fIsGap(false)
00080 {
00081   // default ctor for ROOTCINT
00082 }

BfldCanvasSlice::~BfldCanvasSlice (  )  [virtual]

Definition at line 84 of file BfldCanvasSlice.cxx.

00085 { }


Member Function Documentation

void BfldCanvasSlice::Draw (  )  [virtual]

Definition at line 87 of file BfldCanvasSlice.cxx.

References BfldDbiPlaneMap::GetDetailShape(), BfldDbiPlaneMap::GetDetailSize(), GetPlaneMap(), BfldDbiPlaneMap::kCircle, BfldDbiPlaneMap::kDiamond, and BfldDbiPlaneMap::kSquare.

00088 {
00089   BfldCanvas::Draw(); // call normal one
00090   // no add decorations
00091 
00092   double radius = 0.448;  // old 0.298
00093   BfldDbiPlaneMap::MapShape_t shape = BfldDbiPlaneMap::kCircle;
00094 
00095   const BfldDbiPlaneMap* plnmap = GetPlaneMap();
00096   if ( plnmap ) {
00097     radius = plnmap->GetDetailSize();
00098     shape  = plnmap->GetDetailShape();
00099   }
00100 
00101   int    width = 1;
00102   int    color = kWhite;
00103   int    style = 2;
00104   
00105   switch ( shape ) {
00106   case BfldDbiPlaneMap::kCircle: 
00107     {
00108       static TEllipse  circle;
00109       circle.SetLineWidth(width);
00110       circle.SetLineColor(color);
00111       circle.SetLineStyle(style);
00112       circle.SetFillStyle(0);  // transparent fill
00113       circle.DrawEllipse(0,0,radius,radius,0.,360.,0.,"");
00114       break;
00115     }
00116   case BfldDbiPlaneMap::kSquare:
00117     {
00118       static TPolyLine square;
00119       double xs[] = { -radius, -radius,  radius,  radius, -radius };
00120       double ys[] = { -radius,  radius,  radius, -radius, -radius };
00121       square.SetLineWidth(width);
00122       square.SetLineColor(color);
00123       square.SetLineStyle(style);
00124       square.DrawPolyLine(5,xs,ys);
00125       break;
00126     }
00127   case BfldDbiPlaneMap::kDiamond:
00128     {
00129       static TPolyLine diamond;
00130       double xd[] = { -radius,       0,  radius     ,  0, -radius };
00131       double yd[] = {       0,  radius,       0, -radius,       0 };
00132       for (unsigned int i=0; i < sizeof(xd)/sizeof(double); ++i )
00133         { xd[i] *= TMath::Sqrt2(); yd[i] *= TMath::Sqrt2(); }
00134       diamond.SetLineWidth(width);
00135       diamond.SetLineColor(color);
00136       diamond.SetLineStyle(style);
00137       diamond.DrawPolyLine(5,xd,yd);
00138       break;
00139     }
00140   default:
00141     cout << "illegal detail shape " << shape << endl;
00142   }
00143 }

std::string BfldCanvasSlice::GetAdmixtureString (  )  [private]

Definition at line 151 of file BfldCanvasSlice.cxx.

References Form(), GetIsGap(), BfldDbiPlaneMap::GetMapVariant(), GetPlaneMap(), BfldDbiPlaneMap::GetScale(), BfldDbiPlaneMap::IsNull(), BfldDbiPlaneMap::kDetailGapA, BfldDbiPlaneMap::kDetailSteelA, BfldDbiPlaneMap::kFullGapA, and BfldDbiPlaneMap::kFullSteelA.

Referenced by BfldCanvasSlice().

00152 {
00153   std::string result;
00154 
00155   const BfldDbiPlaneMap* plnmap = GetPlaneMap();
00156   if ( plnmap ) {
00157     int indxpair = BfldDbiPlaneMap::kFullSteelA;
00158     if ( GetIsGap() ) {
00159       if ( GetIsCoil() ) indxpair = BfldDbiPlaneMap::kDetailGapA;
00160       else               indxpair = BfldDbiPlaneMap::kFullGapA;
00161     } else {
00162       if ( GetIsCoil() ) indxpair = BfldDbiPlaneMap::kDetailSteelA;
00163       else               indxpair = BfldDbiPlaneMap::kFullSteelA;
00164     }
00165     if ( plnmap->IsNull(indxpair+1) ) {
00166       // not a linear combination (assume it in the first slot!)
00167       result += Form("map_%d",plnmap->GetMapVariant(indxpair));
00168     } else {
00169       result += Form("%5.3f*map_%d+%5.3f*map_%d",
00170                      plnmap->GetScale(indxpair),
00171                      plnmap->GetMapVariant(indxpair),
00172                      plnmap->GetScale(indxpair+1),
00173                      plnmap->GetMapVariant(indxpair+1));
00174     }
00175   }
00176 
00177   return result;
00178 }

bool BfldCanvasSlice::GetIsGap (  )  const [inline]

Definition at line 34 of file BfldCanvasSlice.h.

References fIsGap.

Referenced by GetAdmixtureString().

00034 { return fIsGap; }

int BfldCanvasSlice::GetPlane (  )  const [inline]

Definition at line 33 of file BfldCanvasSlice.h.

References fPlane.

Referenced by GetPlaneMap().

00033 { return fPlane; }

const BfldDbiPlaneMap * BfldCanvasSlice::GetPlaneMap (  )  [private]

Definition at line 145 of file BfldCanvasSlice.cxx.

References GetPlane(), DbiResultPtr< T >::GetRow(), and GetVldContext().

Referenced by Draw(), and GetAdmixtureString().

00146 {
00147   DbiResultPtr<BfldDbiPlaneMap> tblrows(GetVldContext());
00148   return tblrows.GetRow(GetPlane());
00149 }


Member Data Documentation

bool BfldCanvasSlice::fIsGap [private]

Definition at line 42 of file BfldCanvasSlice.h.

Referenced by GetIsGap().

int BfldCanvasSlice::fPlane [private]

Definition at line 41 of file BfldCanvasSlice.h.

Referenced by GetPlane().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1