PlexScintMdlId Class Reference

#include <PlexScintMdlId.h>

Inheritance diagram for PlexScintMdlId:
PlexPlaneId

List of all members.

Public Member Functions

 PlexScintMdlId ()
 PlexScintMdlId (PlexPlaneId plnid, Int_t module)
 PlexScintMdlId (Detector::Detector_t detector, Int_t plane, Int_t module, PlaneView::PlaneView_t view=PlaneView::kUnknown, PlaneCoverage::PlaneCoverage_t cover=PlaneCoverage::kUnknown)
virtual ~PlexScintMdlId ()
 PlexScintMdlId (const UInt_t encoded)
UInt_t GetEncoded () const
const char * AsString (Option_t *option="") const
UShort_t GetModule () const
UChar_t GetModuleType () const
Int_t BuildPlnMdlKey () const
void Print (Option_t *option="") const
void SetModule (UInt_t module)

Static Public Member Functions

static PlexScintMdlId UnbuildPlnMdlKey (Detector::Detector_t det, Int_t key)
static PlexScintMdlId StripToScintMdl (const PlexPlaneId &plnid, Int_t strip)
static Short_t GetStripInMdl (const PlexPlaneId &plnid, UInt_t strip)
static Short_t GetMapperStripInMdl (const PlexPlaneId &plnid, UInt_t strip)
static UShort_t GetNumStripsInPln (const PlexPlaneId &plnid)
static UShort_t GetNumScintMdlsInPln (const PlexPlaneId &plnid)

Private Member Functions

void SetIsSteel (Bool_t)

Friends

Bool_t operator< (const PlexScintMdlId &lhs, const PlexScintMdlId &rhs)
Bool_t operator<= (const PlexScintMdlId &lhs, const PlexScintMdlId &rhs)
Bool_t operator== (const PlexScintMdlId &lhs, const PlexScintMdlId &rhs)
Bool_t operator!= (const PlexScintMdlId &lhs, const PlexScintMdlId &rhs)
Bool_t operator> (const PlexScintMdlId &lhs, const PlexScintMdlId &rhs)
Bool_t operator>= (const PlexScintMdlId &lhs, const PlexScintMdlId &rhs)

Detailed Description

Definition at line 22 of file PlexScintMdlId.h.


Constructor & Destructor Documentation

PlexScintMdlId::PlexScintMdlId (  )  [inline]

Definition at line 83 of file PlexScintMdlId.h.

References defaultPlexScintMdlId, and PlexPlaneId::fEncoded.

Referenced by StripToScintMdl(), and UnbuildPlnMdlKey().

PlexScintMdlId::PlexScintMdlId ( PlexPlaneId  plnid,
Int_t  module 
)

Definition at line 387 of file PlexScintMdlId.cxx.

References defaultPlexScintMdlId, PlexPlaneId::fEncoded, maskPlexIdEnd, maskPlexIdSubPart, SetIsSteel(), and SetModule().

00388    : PlexPlaneId(plnid)
00389 {
00390    // Normal ctor from PlaneId + extras
00391 
00392    // ensure that it isn't tagged as "steel" even if plnid was
00393    SetIsSteel(kFALSE);
00394 
00395    // because the "PlexPlaneId" passed in could actually be
00396    // a PlexStripEndId we might have subpart & end bits set
00397    // which we need to reset to the default that PlexPlaneId
00398    // would set them to
00399 
00400    const UInt_t maskLower = 
00401      defaultPlexScintMdlId & (maskPlexIdSubPart|maskPlexIdEnd);
00402    fEncoded |= maskLower;
00403 
00404    SetModule(module);
00405 
00406 }

PlexScintMdlId::PlexScintMdlId ( Detector::Detector_t  detector,
Int_t  plane,
Int_t  module,
PlaneView::PlaneView_t  view = PlaneView::kUnknown,
PlaneCoverage::PlaneCoverage_t  cover = PlaneCoverage::kUnknown 
)

Definition at line 409 of file PlexScintMdlId.cxx.

References SetModule().

00414    : PlexPlaneId(detector,plane,kFALSE,view,coverage)
00415 {
00416    // Normal ctor from all components
00417 
00418    SetModule(module);
00419 }

virtual PlexScintMdlId::~PlexScintMdlId (  )  [inline, virtual]

Definition at line 33 of file PlexScintMdlId.h.

00033 { ; } // no owned data members

PlexScintMdlId::PlexScintMdlId ( const UInt_t  encoded  )  [inline, explicit]

Definition at line 84 of file PlexScintMdlId.h.

References PlexPlaneId::fEncoded.

00085 { fEncoded = encoded; }


Member Function Documentation

const char * PlexScintMdlId::AsString ( Option_t *  option = ""  )  const

Reimplemented from PlexPlaneId.

Definition at line 460 of file PlexScintMdlId.cxx.

References PlaneView::AsString(), PlaneCoverage::AsString(), Detector::AsString(), det, PlexPlaneId::GetDetector(), GetModule(), getModulesInPlnInfo(), PlexPlaneId::GetPlane(), PlexPlaneId::GetPlaneCoverage(), PlexPlaneId::GetPlaneView(), and ModulesInPlnInfo::MdlType().

Referenced by GeoGeometry::BuildModules(), GeoScintMdlVolume::GeoScintMdlVolume(), GeoScintMdlNode::GetClearFiber(), GeoScintMdlNode::GetExtraWlsFiber(), GeoScintMdlNode::GetLPosRelPln(), GeoScintMdlNode::GetStripNode(), GeoScintMdlNode::GetTPosRelPln(), GeoScintMdlNode::GetZRotRelPlnRad(), UgliDbiScintMdl::HashToIndex(), FabPlnInstallLookup::LookForOddEntries(), operator<<(), Print(), GeoValidate::TestScintMdl(), GeoValidate::TestScintPln_GetScintMdlHandleVector(), and UnbuildPlnMdlKey().

00461 {
00462    // Return unpacked StripEndId as a string
00463    // User should copy result because it points to a 
00464    // statically allocated string.
00465    // Internally uses a circular list of buffers to avoid problems
00466    // using AsString multiple times in a cout-like situation.
00467 
00468    const int nbuffers = 8;   // use a circular list of strings
00469    static char newstring[nbuffers][27]; // = "|123456789|1234 VX|123|SE|";
00470       //                                      12345678901234567890123456
00471    static int  ibuffer = nbuffers;
00472    ibuffer = (ibuffer+1)%nbuffers;  // each time move to next buffer
00473 
00474    int mdl = GetModule();
00475    
00476    Detector::Detector_t det = GetDetector();
00477    PlaneCoverage::PlaneCoverage_t cover = GetPlaneCoverage();
00478    PlaneView::PlaneView_t view = GetPlaneView();
00479 
00480    ModulesInPlnInfo* plninfo = getModulesInPlnInfo(*this,"AsString");
00481    UChar_t mdltype = ((plninfo) ? plninfo->MdlType(mdl) : '?');
00482    
00483    switch (option[0]) {
00484    case 's':
00485       // only the part the defines the "shape"
00486       sprintf(newstring[ibuffer],"%c%c-%c%c(%1d)",
00487               Detector::AsString(det)[0],
00488               PlaneCoverage::AsString(cover)[0],
00489               mdltype,
00490               PlaneView::AsString(view)[0],
00491               mdl);
00492       break;
00493    default:
00494       // compact rendering identifying whole module (including plane)
00495       sprintf(newstring[ibuffer],"%c%4.4d-%1.1d-%c%c%c",
00496               Detector::AsString(det)[0],
00497               GetPlane(),
00498               mdl,
00499               PlaneCoverage::AsString(cover)[0],
00500               PlaneView::AsString(view)[0],
00501               mdltype);
00502 
00503       break;
00504    }
00505    
00506    return newstring[ibuffer];
00507 }

Int_t PlexScintMdlId::BuildPlnMdlKey (  )  const

Definition at line 519 of file PlexScintMdlId.cxx.

References det, PlexPlaneId::GetDetector(), GetModule(), PlexPlaneId::GetPlane(), Detector::kCalDet, Detector::kFar, Detector::kNear, Msg::kWarning, and MSG.

00520 {
00521    // compactified plane,module
00522    // packed tightly, not simple bit shifts
00523 
00524    // this isn't quite as tight as it could possibly be for the
00525    // near detector as it doesn't worry about partial vs. full planes
00526    // and has gaps for empty spectrometer planes 
00527 
00528    Int_t plane = GetPlane();
00529    Int_t mdl   = GetModule();
00530    Detector::Detector_t det = GetDetector();
00531 
00532    Int_t nMdls = 8;  // need some default
00533    switch (det) {
00534    case Detector::kNear:   nMdls =  8; break;
00535    case Detector::kFar:    nMdls =  8; break;
00536    case Detector::kCalDet: nMdls =  8; break;
00537    default:
00538       MSG("Plex",Msg::kWarning)
00539          << "PlexScintMdlId " << *this << " is not Near/Far/CalDet" << endl;
00540    }
00541 
00542    if (mdl>=nMdls) {
00543       MSG("Plex",Msg::kWarning)
00544          << "PlexScintMdlId " << *this 
00545          << " exceeds expected nMdls " << nMdls << endl;
00546    }
00547    Int_t hvalue = plane*nMdls + mdl;
00548 
00549    return hvalue;
00550 }

UInt_t PlexScintMdlId::GetEncoded (  )  const [inline]

Reimplemented from PlexPlaneId.

Definition at line 37 of file PlexScintMdlId.h.

References PlexPlaneId::fEncoded.

Referenced by AlignmentAlgorithm::AnalyzeModuleResiduals(), and AlignmentHistograms::~AlignmentHistograms().

00037 { return fEncoded; }

Short_t PlexScintMdlId::GetMapperStripInMdl ( const PlexPlaneId plnid,
UInt_t  strip 
) [static]

Definition at line 611 of file PlexScintMdlId.cxx.

References getModulesInPlnInfo(), and ModulesInPlnInfo::StripToMapperStrip().

00612                                                           {
00613    // Return an strip # within a module using construction based notation
00614    // starts w/ 1 .. flip flops w/ increasing 'tpos' depending on
00615    // installation orientation
00616  
00617    ModulesInPlnInfo* plninfo = getModulesInPlnInfo(plnid,"GetMapperStripInMdl");   if (plninfo) return plninfo->StripToMapperStrip(strip);
00618  
00619    // bogus return if nonsensical
00620    return -1;
00621 }

UShort_t PlexScintMdlId::GetModule (  )  const
UChar_t PlexScintMdlId::GetModuleType (  )  const

Definition at line 510 of file PlexScintMdlId.cxx.

References GetModule(), getModulesInPlnInfo(), and ModulesInPlnInfo::MdlType().

Referenced by GeoScintMdlVolume::Build4Corners(), GeoScintMdlVolume::BuildCalDet(), GeoScintMdlVolume::BuildFar(), and GeoScintMdlVolume::BuildNear().

00511 {
00512    ModulesInPlnInfo* plninfo = getModulesInPlnInfo(*this,"GetModuleType");
00513    int mdl = GetModule();
00514    UChar_t mdltype = ((plninfo) ? plninfo->MdlType(mdl) : '?');
00515    return mdltype;
00516 }

UShort_t PlexScintMdlId::GetNumScintMdlsInPln ( const PlexPlaneId plnid  )  [static]

Definition at line 636 of file PlexScintMdlId.cxx.

References getModulesInPlnInfo(), and ModulesInPlnInfo::GetNumScintMdlsInPln().

Referenced by PlexPlaneId::GetNumScintMdls().

00637 {
00638    // use pseudo-database to determine # of strips in plane
00639 
00640    ModulesInPlnInfo* plninfo = getModulesInPlnInfo(plnid,"GetNumStripsInPln");
00641    if (plninfo) return plninfo->GetNumScintMdlsInPln();
00642 
00643    // bogus return if nonsensical
00644    return 0;
00645 }

UShort_t PlexScintMdlId::GetNumStripsInPln ( const PlexPlaneId plnid  )  [static]

Definition at line 624 of file PlexScintMdlId.cxx.

References getModulesInPlnInfo(), and ModulesInPlnInfo::GetNumStripsInPln().

Referenced by PlexPlaneId::GetNumStrips().

00625 {
00626    // use pseudo-database to determine # of strips in plane
00627 
00628    ModulesInPlnInfo* plninfo = getModulesInPlnInfo(plnid,"GetNumStripsInPln");
00629    if (plninfo) return plninfo->GetNumStripsInPln();
00630 
00631    // bogus return if nonsensical
00632    return 0;
00633 }

Short_t PlexScintMdlId::GetStripInMdl ( const PlexPlaneId plnid,
UInt_t  strip 
) [static]

Definition at line 599 of file PlexScintMdlId.cxx.

References getModulesInPlnInfo(), and ModulesInPlnInfo::StripToStripInMdl().

00600 {
00601    // given a plane and a strip figure out which strip in module it is 
00602 
00603    ModulesInPlnInfo* plninfo = getModulesInPlnInfo(plnid,"GetStripInMdl");
00604    if (plninfo) return plninfo->StripToStripInMdl(strip);
00605 
00606    // bogus return if nonsensical
00607    return -1;
00608 }

void PlexScintMdlId::Print ( Option_t *  option = ""  )  const

Reimplemented from PlexPlaneId.

Definition at line 577 of file PlexScintMdlId.cxx.

References AsString().

00578 {
00579    // Print the (decoded) value
00580 
00581    printf("%s\n",AsString(option));
00582 }

void PlexScintMdlId::SetIsSteel ( Bool_t   )  [inline, private]

Reimplemented from PlexPlaneId.

Definition at line 77 of file PlexScintMdlId.h.

Referenced by PlexScintMdlId().

00077 {;}

void PlexScintMdlId::SetModule ( UInt_t  module  ) 

Definition at line 453 of file PlexScintMdlId.cxx.

References PlexPlaneId::fEncoded, maskPlexIdScintMdl, and shftPlexIdScintMdl.

Referenced by PlexScintMdlId().

00454 {
00455    fEncoded = ( fEncoded & ~maskPlexIdScintMdl ) | 
00456       ( ( module << shftPlexIdScintMdl ) & maskPlexIdScintMdl );
00457 }

PlexScintMdlId PlexScintMdlId::StripToScintMdl ( const PlexPlaneId plnid,
Int_t  strip 
) [static]

Definition at line 585 of file PlexScintMdlId.cxx.

References getModulesInPlnInfo(), PlexScintMdlId(), and ModulesInPlnInfo::StripToMdl().

Referenced by PlexStripEndId::GetScintMdlId().

00587 {
00588    // given a plane and a strip figure out which module it is in
00589 
00590    ModulesInPlnInfo* plninfo = getModulesInPlnInfo(plnid,"StripToScintMdl");
00591    if (plninfo) return PlexScintMdlId(plnid,plninfo->StripToMdl(strip));
00592 
00593    // should this return a completely bogus scint module id
00594    // or just one with a bogus mdl # set within it?
00595    return PlexScintMdlId();
00596 }

PlexScintMdlId PlexScintMdlId::UnbuildPlnMdlKey ( Detector::Detector_t  det,
Int_t  key 
) [static]

Definition at line 553 of file PlexScintMdlId.cxx.

References AsString(), Detector::kCalDet, Detector::kFar, Detector::kNear, Msg::kWarning, MSG, and PlexScintMdlId().

00555 {
00556    // recover true id object from hashed down version
00557    // needs detector info that was lost in compactification
00558 
00559    Int_t nMdls = 8;  // need some default
00560    switch (det) {
00561    case Detector::kNear:   nMdls =  8; break;
00562    case Detector::kFar:    nMdls =  8; break;
00563    case Detector::kCalDet: nMdls =  8; break;
00564    default:
00565       MSG("Plex",Msg::kWarning)
00566         << "PlexScintMdlId " << Detector::AsString(det) 
00567         << "(" << (int)det << ")"
00568         << " is not Near/Far/CalDet" << endl;
00569    }
00570    Int_t plane = key / nMdls;
00571    Int_t mdl   = key - (plane*nMdls);
00572    PlexPlaneId plnid(det,plane);
00573    return PlexScintMdlId(plnid,mdl);
00574 }


Friends And Related Function Documentation

Bool_t operator!= ( const PlexScintMdlId lhs,
const PlexScintMdlId rhs 
) [friend]

Reimplemented from PlexPlaneId.

Bool_t operator< ( const PlexScintMdlId lhs,
const PlexScintMdlId rhs 
) [friend]

Reimplemented from PlexPlaneId.

Bool_t operator<= ( const PlexScintMdlId lhs,
const PlexScintMdlId rhs 
) [friend]

Reimplemented from PlexPlaneId.

Bool_t operator== ( const PlexScintMdlId lhs,
const PlexScintMdlId rhs 
) [friend]

Reimplemented from PlexPlaneId.

Bool_t operator> ( const PlexScintMdlId lhs,
const PlexScintMdlId rhs 
) [friend]

Reimplemented from PlexPlaneId.

Bool_t operator>= ( const PlexScintMdlId lhs,
const PlexScintMdlId rhs 
) [friend]

Reimplemented from PlexPlaneId.


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1