ModulesInPlnInfo Class Reference

List of all members.

Public Member Functions

 ModulesInPlnInfo (Detector::Detector_t detector, PlaneCoverage::PlaneCoverage_t coverage, PlaneView::PlaneView_t view, UChar_t nmdl, const UChar_t *mdltype)
 ~ModulesInPlnInfo ()
UChar_t GetNumStripsInPln ()
UChar_t GetNumScintMdlsInPln ()
UChar_t MdlType (UChar_t mdl)
UChar_t StripToMdl (UChar_t strip)
UChar_t StripToStripInMdl (UChar_t strip)
UChar_t StripToMapperStrip (UChar_t strip)
void BoundsErrorMsg (UChar_t asked, UChar_t last, const char *what="?")

Static Public Member Functions

static UChar_t NumStripsInType (UChar_t mdltype)

Public Attributes

Detector::Detector_t fDetector
PlaneCoverage::PlaneCoverage_t fCoverage
PlaneView::PlaneView_t fView
UChar_t fNumMdls
UChar_t fNumStrips
UChar_t * fMdlType
UChar_t * fStripsPerMdl
UChar_t * fFirstStripInMdl
UChar_t * fLastStripInMdl
UChar_t * fStripToMdl
UChar_t * fStripToStripInMdl
UChar_t * fStripToMapperStrip

Detailed Description

Definition at line 38 of file PlexScintMdlId.cxx.


Constructor & Destructor Documentation

ModulesInPlnInfo::ModulesInPlnInfo ( Detector::Detector_t  detector,
PlaneCoverage::PlaneCoverage_t  coverage,
PlaneView::PlaneView_t  view,
UChar_t  nmdl,
const UChar_t *  mdltype 
)

Definition at line 73 of file PlexScintMdlId.cxx.

References fFirstStripInMdl, fLastStripInMdl, fMdlType, fNumMdls, fNumStrips, fStripsPerMdl, fStripToMapperStrip, fStripToMdl, fStripToStripInMdl, and NumStripsInType().

00077   : fDetector(detector), fCoverage(coverage), fView(view), 
00078     fNumMdls(nmdl), fNumStrips(0), fMdlType(0),
00079     fStripsPerMdl(0), fFirstStripInMdl(0), fLastStripInMdl(0), 
00080     fStripToMdl(0), fStripToStripInMdl(0), fStripToMapperStrip(0)
00081 {
00082   // if no modules just return
00083   if (fNumMdls==0) return; 
00084   
00085   fMdlType         = new UChar_t [fNumMdls];
00086   fStripsPerMdl    = new UChar_t [fNumMdls];
00087   fFirstStripInMdl = new UChar_t [fNumMdls];
00088   fLastStripInMdl  = new UChar_t [fNumMdls];
00089   // copy types to owned array, translate type to strip count
00090   // calculate total # of strips, last strip in each module
00091   for (UChar_t imdl=0; imdl<fNumMdls; ++imdl) {
00092     UChar_t nstripsInMdl   = NumStripsInType(mdltype[imdl]);
00093     fNumStrips            += nstripsInMdl;
00094     fMdlType[imdl]         = mdltype[imdl];
00095     fStripsPerMdl[imdl]    = nstripsInMdl;
00096     fFirstStripInMdl[imdl] = fNumStrips-nstripsInMdl;
00097     fLastStripInMdl[imdl]  = fNumStrips-1;
00098   }
00099   
00100   fStripToMdl         = new UChar_t [fNumStrips];
00101   fStripToStripInMdl  = new UChar_t [fNumStrips];
00102   fStripToMapperStrip = new UChar_t [fNumStrips];
00103   // calculate mapping from strip to module
00104   for (UChar_t istrip=0; istrip<fNumStrips; ++istrip) {
00105     // find the right module
00106     UChar_t mdl = 0;
00107     while (istrip > fLastStripInMdl[mdl]) ++mdl;
00108 
00109     fStripToMdl[istrip] = mdl;
00110     UChar_t stripinmdl = istrip - fFirstStripInMdl[mdl];
00111     UChar_t nstrips    = fStripsPerMdl[mdl];
00112     fStripToStripInMdl[istrip]  = stripinmdl;
00113     // upper/lower case tells us about mapper convention
00114     // upper case ordering is same, but starts with 1
00115     // lower case ordering is reversed and ends with 1
00116     fStripToMapperStrip[istrip] = 
00117       ( (isupper(fMdlType[mdl]) ) ? stripinmdl+1 : nstrips-stripinmdl );
00118   }
00119 }

ModulesInPlnInfo::~ModulesInPlnInfo (  ) 

Definition at line 121 of file PlexScintMdlId.cxx.

References fFirstStripInMdl, fLastStripInMdl, fMdlType, fStripsPerMdl, fStripToMapperStrip, fStripToMdl, and fStripToStripInMdl.

00121                                     { 
00122   // delete any and all owned arrays
00123   if (fMdlType)            delete [] fMdlType;
00124   if (fStripsPerMdl)       delete [] fStripsPerMdl;
00125   if (fFirstStripInMdl)    delete [] fFirstStripInMdl;
00126   if (fLastStripInMdl)     delete [] fLastStripInMdl;
00127   if (fStripToMdl)         delete [] fStripToMdl;
00128   if (fStripToStripInMdl)  delete [] fStripToStripInMdl;
00129   if (fStripToMapperStrip) delete [] fStripToMapperStrip;
00130 }


Member Function Documentation

void ModulesInPlnInfo::BoundsErrorMsg ( UChar_t  asked,
UChar_t  last,
const char *  what = "?" 
)

Definition at line 164 of file PlexScintMdlId.cxx.

References bfld::AsString(), Detector::AsString(), fCoverage, fDetector, fView, Msg::kWarning, and MSG.

Referenced by MdlType(), StripToMapperStrip(), StripToMdl(), and StripToStripInMdl().

00165 {
00166   MSG("Plex",Msg::kWarning)
00167     << what << " " << (int)asked << " in {"
00168     << " " << Detector::AsString(fDetector)
00169     << " " << PlaneCoverage::AsString(fCoverage)
00170     << " " << PlaneView::AsString(fView)
00171     << "} is beyond last " << what << ": "
00172     << (int)last << endl;
00173 }

UChar_t ModulesInPlnInfo::GetNumScintMdlsInPln (  )  [inline]

Definition at line 47 of file PlexScintMdlId.cxx.

Referenced by PlexScintMdlId::GetNumScintMdlsInPln().

00047 { return fNumMdls; }

UChar_t ModulesInPlnInfo::GetNumStripsInPln (  )  [inline]

Definition at line 46 of file PlexScintMdlId.cxx.

Referenced by PlexScintMdlId::GetNumStripsInPln().

00046 { return fNumStrips; }

UChar_t ModulesInPlnInfo::MdlType ( UChar_t  mdl  ) 

Definition at line 132 of file PlexScintMdlId.cxx.

References BoundsErrorMsg(), fMdlType, and fNumMdls.

Referenced by PlexScintMdlId::AsString(), and PlexScintMdlId::GetModuleType().

00133 {
00134   if (mdl<fNumMdls) return fMdlType[mdl];
00135   static int nmsg = 10;
00136   if (--nmsg >= 0) BoundsErrorMsg(mdl,fNumMdls-1,"module");
00137   return '?';
00138 }

UChar_t ModulesInPlnInfo::NumStripsInType ( UChar_t  mdltype  )  [static]

Definition at line 175 of file PlexScintMdlId.cxx.

References Msg::kWarning, and MSG.

Referenced by ModulesInPlnInfo().

00176 {
00177   // module types are characterized by a single char
00178   // though actual shapes may also depend on plane view
00179   // (esp. in the case of the near detector).  For the
00180   // far detector case distinguishes between those installed
00181   // one way or rotated 180deg in the z plane.
00182 
00183   UChar_t mdltypeUpper = toupper(mdltype);
00184 
00185   switch (mdltypeUpper) {
00186     // far detector types
00187   case 'A': return 28;
00188   case 'B': return 28;
00189   case 'C': return 20;
00190   case 'D': return 20;
00191   case 'E': return 20;
00192   case 'F': return 20;
00193     // near detector partial types
00194   case 'G': return 28;
00195   case 'H': return 20;
00196   case 'I': return 20;
00197     // near detector full types
00198   case 'J': return 28;
00199   case 'K': return 20;
00200   case 'L': return 16;
00201   case 'M': return 16;
00202   case 'N': return 16;
00203     // caldet types
00204   case 'X': return 24;
00205   default:
00206     MSG("Plex",Msg::kWarning)
00207       << " no module type '" << mdltype 
00208       << "' (0x" << hex << setw(2) << (int)mdltype << dec 
00209       << ") defined" << endl;
00210   }
00211   return 0;
00212 }

UChar_t ModulesInPlnInfo::StripToMapperStrip ( UChar_t  strip  ) 

Definition at line 156 of file PlexScintMdlId.cxx.

References BoundsErrorMsg(), fNumStrips, and fStripToMapperStrip.

Referenced by PlexScintMdlId::GetMapperStripInMdl().

00157 {
00158   if (strip<fNumStrips) return fStripToMapperStrip[strip];
00159   static int nmsg = 10;
00160   if (--nmsg >= 0) BoundsErrorMsg(strip,fNumStrips-1,"strip");
00161   return 0xff;
00162 }

UChar_t ModulesInPlnInfo::StripToMdl ( UChar_t  strip  ) 

Definition at line 140 of file PlexScintMdlId.cxx.

References BoundsErrorMsg(), fNumStrips, and fStripToMdl.

Referenced by PlexScintMdlId::StripToScintMdl().

00141 {
00142   if (strip<fNumStrips) return fStripToMdl[strip];
00143   static int nmsg = 10;
00144   if (--nmsg >= 0) BoundsErrorMsg(strip,fNumStrips-1,"strip");
00145   return 0xff;
00146 }

UChar_t ModulesInPlnInfo::StripToStripInMdl ( UChar_t  strip  ) 

Definition at line 148 of file PlexScintMdlId.cxx.

References BoundsErrorMsg(), fNumStrips, and fStripToStripInMdl.

Referenced by PlexScintMdlId::GetStripInMdl().

00149 {
00150   if (strip<fNumStrips) return fStripToStripInMdl[strip];
00151   static int nmsg = 10;
00152   if (--nmsg >= 0) BoundsErrorMsg(strip,fNumStrips-1,"strip");
00153   return 0xff;
00154 }


Member Data Documentation

Definition at line 58 of file PlexScintMdlId.cxx.

Referenced by BoundsErrorMsg(), and getModulesInPlnInfo().

Definition at line 57 of file PlexScintMdlId.cxx.

Referenced by BoundsErrorMsg(), and getModulesInPlnInfo().

Definition at line 66 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), and ~ModulesInPlnInfo().

Definition at line 67 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), and ~ModulesInPlnInfo().

Definition at line 64 of file PlexScintMdlId.cxx.

Referenced by MdlType(), ModulesInPlnInfo(), and ~ModulesInPlnInfo().

Definition at line 61 of file PlexScintMdlId.cxx.

Referenced by MdlType(), and ModulesInPlnInfo().

Definition at line 65 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), and ~ModulesInPlnInfo().

Definition at line 70 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), StripToMapperStrip(), and ~ModulesInPlnInfo().

Definition at line 68 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), StripToMdl(), and ~ModulesInPlnInfo().

Definition at line 69 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), StripToStripInMdl(), and ~ModulesInPlnInfo().

Definition at line 59 of file PlexScintMdlId.cxx.

Referenced by BoundsErrorMsg(), and getModulesInPlnInfo().


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

Generated on 16 Apr 2018 for loon by  doxygen 1.6.1