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

cmap::CMap Class Reference

#include <CMap.h>

Inheritance diagram for cmap::CMap:

db::Table List of all members.

Public Member Functions

 ~CMap ()
unsigned short GetPlane (const rawdata::RawDigit *dig)
unsigned short GetCell (const rawdata::RawDigit *dig)
TTimeStamp GetTimeStamp () const
rawdata::det_id_ GetDetector () const
bool ChanToCell (unsigned short dcm_id, unsigned short feb_id, unsigned short chan_id, unsigned short &plane, unsigned short &cell)
bool CellToChan (unsigned short plane, unsigned short cell, unsigned short &dcm_id, unsigned short &feb_id, unsigned short &chan_id)

Static Public Member Functions

CMapInstance (const TTimeStamp &ts, rawdata::det_id_ det)

Private Member Functions

 CMap (std::string &fname)
bool ChanToCellException (unsigned short board_id, unsigned short feb_id, unsigned short chan_id, unsigned short &plane, unsigned short &cell)
bool CellToChanException (unsigned short plane, unsigned short cell, unsigned short &dcm_id, unsigned short &feb_id, unsigned short &chan_id)

Private Attributes

unsigned int fCellMask
TTimeStamp fTS
rawdata::det_id_ fDetId

Static Private Attributes

CMapfInstance = 0

Constructor & Destructor Documentation

CMap::~CMap  ) 
 

Definition at line 60 of file CMap.cxx.

00061 {
00062 
00063 }

CMap::CMap std::string &  fname  )  [private]
 

Definition at line 21 of file CMap.cxx.

References fCellMask.

Referenced by Instance().

00021                            : 
00022   db::Table(fname)
00023 {
00024   fCellMask = (1<<10)-1;
00025 }


Member Function Documentation

bool CMap::CellToChan unsigned short  plane,
unsigned short  cell,
unsigned short &  dcm_id,
unsigned short &  feb_id,
unsigned short &  chan_id
 

Definition at line 96 of file CMap.cxx.

00099 {
00100   dcs_id = plane;
00101   feb_id = cell%32;
00102   chan_id = cell/32;
00103   return true;
00104 }

bool CMap::CellToChanException unsigned short  plane,
unsigned short  cell,
unsigned short &  dcm_id,
unsigned short &  feb_id,
unsigned short &  chan_id
[private]
 

Definition at line 133 of file CMap.cxx.

00136 {  
00137   int pl, ce;
00138 
00139   // look for exceptions in the table... if found, set plane/cell 
00140   // according to table entries
00141   for (unsigned int i=0; i<this->size(); ++i) {
00142     dbi::Row& row = (*this)[i];
00143     row.Get(std::string("plane"),pl);
00144     row.Get(std::string("cell"),ce);
00145     if (pl == plane && ce == cell) {
00146       row.Get(std::string("dcs_id"),dcs_id);
00147       row.Get(std::string("feb_id"),feb_id);
00148       row.Get(std::string("chan_id"),chan_id);
00149       return true;
00150     }
00151   }
00152   
00153   return false;
00154 }

bool CMap::ChanToCell unsigned short  dcm_id,
unsigned short  feb_id,
unsigned short  chan_id,
unsigned short &  plane,
unsigned short &  cell
 

Definition at line 85 of file CMap.cxx.

00088 {
00089   plane = dcs_id;
00090   cell = feb_id*32 + chan_id;
00091   return true;
00092 }

bool CMap::ChanToCellException unsigned short  board_id,
unsigned short  feb_id,
unsigned short  chan_id,
unsigned short &  plane,
unsigned short &  cell
[private]
 

Definition at line 108 of file CMap.cxx.

00111 {
00112   int did, cid, fid;
00113 
00114   // look for exceptions in the table... if found, set plane/cell 
00115   // according to table entries
00116   for (unsigned int i=0; i<this->size(); ++i) {
00117     dbi::Row& row = (*this)[i];
00118     row.Get(std::string("dcs_id"),did);
00119     row.Get(std::string("chan_id"),cid);
00120     row.Get(std::string("chan_id"),fid);
00121     if (did == dcs_id && cid == chan_id && fid == feb_id) {
00122       row.Get(std::string("plane"),plane);
00123       row.Get(std::string("cell"),cell);
00124       return true;
00125     }
00126   }
00127 
00128   return false;
00129 }

unsigned short CMap::GetCell const rawdata::RawDigit dig  ) 
 

Definition at line 76 of file CMap.cxx.

References rawdata::RawDigit::Channel().

Referenced by mcchk::DetAna::Ana(), mcchk::CosmicAna::Ana(), evd::Display3D::DrawRawData(), calib::Calibrator::MakeCellHit(), raw_digit_sort(), and evd::RawDataDrawer::RawDigit2D().

00077 {
00078   if (!dig) return 30000;
00079 
00080   return (dig->Channel()&(fCellMask));
00081 }

rawdata::det_id_ cmap::CMap::GetDetector  )  const [inline]
 

Definition at line 36 of file CMap.h.

00036 { return fDetId; }

unsigned short CMap::GetPlane const rawdata::RawDigit dig  ) 
 

Definition at line 67 of file CMap.cxx.

References rawdata::RawDigit::Channel().

Referenced by mcchk::DetAna::Ana(), mcchk::CosmicAna::Ana(), evd::Display3D::DrawRawData(), calib::Calibrator::MakeCellHit(), raw_digit_sort(), and evd::RawDataDrawer::RawDigit2D().

00068 {
00069   if (!dig) return 30000;
00070 
00071   return ((dig->Channel()&(~fCellMask))>>10);
00072 }

TTimeStamp cmap::CMap::GetTimeStamp  )  const [inline]
 

Definition at line 35 of file CMap.h.

00035 { return fTS; }

CMap & CMap::Instance const TTimeStamp &  ts,
rawdata::det_id_  det
[static]
 

Definition at line 29 of file CMap.cxx.

References CMap(), and fInstance.

Referenced by util::EDMUtils::GetCMap(), main(), and calib::Calibrator::MakeCellHit().

00030 {
00031   std::string fname;
00032 
00033   if (!fInstance) {
00034     switch(detid) {
00035     case rawdata::kNear:
00036       fname = "cmapnd.xml";
00037       break;
00038     case rawdata::kFar:
00039       fname = "cmapfd.xml";
00040       break;
00041     case rawdata::kIPND:
00042     case rawdata::kIPNDShed:
00043       fname = "cmapipnd.xml";
00044       break;
00045     default:
00046       throw db::Exception(__FILE__,__LINE__,db::Exception::FILE_NOT_FOUND,
00047                           "Invalid detector, no CMap found.");
00048       break;
00049     }
00050     
00051     fInstance = new CMap(fname);
00052     
00053   }
00054 
00055   return *fInstance;
00056 }


Member Data Documentation

unsigned int cmap::CMap::fCellMask [private]
 

Definition at line 59 of file CMap.h.

Referenced by CMap().

rawdata::det_id_ cmap::CMap::fDetId [private]
 

Definition at line 61 of file CMap.h.

CMap * CMap::fInstance = 0 [static, private]
 

Definition at line 17 of file CMap.cxx.

Referenced by Instance().

TTimeStamp cmap::CMap::fTS [private]
 

Definition at line 60 of file CMap.h.


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:45:31 2009 for NOvA Offline by  doxygen 1.3.9.1