Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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

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

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.

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 PlaneView::AsString(), PlaneCoverage::AsString(), Detector::AsString(), fCoverage, fDetector, fView, 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.

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

PlaneCoverage::PlaneCoverage_t ModulesInPlnInfo::fCoverage
 

Definition at line 58 of file PlexScintMdlId.cxx.

Referenced by BoundsErrorMsg(), and getModulesInPlnInfo().

Detector::Detector_t ModulesInPlnInfo::fDetector
 

Definition at line 57 of file PlexScintMdlId.cxx.

Referenced by BoundsErrorMsg(), and getModulesInPlnInfo().

UChar_t* ModulesInPlnInfo::fFirstStripInMdl
 

Definition at line 66 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo().

UChar_t* ModulesInPlnInfo::fLastStripInMdl
 

Definition at line 67 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo().

UChar_t* ModulesInPlnInfo::fMdlType
 

Definition at line 64 of file PlexScintMdlId.cxx.

Referenced by MdlType(), and ModulesInPlnInfo().

UChar_t ModulesInPlnInfo::fNumMdls
 

Definition at line 61 of file PlexScintMdlId.cxx.

Referenced by MdlType(), and ModulesInPlnInfo().

UChar_t ModulesInPlnInfo::fNumStrips
 

Definition at line 62 of file PlexScintMdlId.cxx.

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

UChar_t* ModulesInPlnInfo::fStripsPerMdl
 

Definition at line 65 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo().

UChar_t* ModulesInPlnInfo::fStripToMapperStrip
 

Definition at line 70 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), and StripToMapperStrip().

UChar_t* ModulesInPlnInfo::fStripToMdl
 

Definition at line 68 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), and StripToMdl().

UChar_t* ModulesInPlnInfo::fStripToStripInMdl
 

Definition at line 69 of file PlexScintMdlId.cxx.

Referenced by ModulesInPlnInfo(), and StripToStripInMdl().

PlaneView::PlaneView_t ModulesInPlnInfo::fView
 

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 Mon Feb 15 11:09:37 2010 for loon by  doxygen 1.3.9.1