MucFec Class Reference

#include <MucFec.h>

List of all members.

Public Member Functions

 MucFec (int id)
 MucFec (int id, int stripOrder, int part, int segment, int layer, int firstStripID, unsigned int vmeRecord, string chainName)
 ~MucFec ()
int GetID ()
int GetStripOrder ()
unsigned int GetVmeRecord ()
unsigned short GetVmeAddress ()
unsigned short GetData ()
int GetPart ()
int GetSegment ()
int GetLayer ()
unsigned short GetGeoAddress ()
int GetFirstStripID ()
string GetChainName ()
int GetFiredStripNumber ()
vector< int > * GetFiredStripVect ()
unsigned int GetPowerpcRecord ()
int DecodeModule ()
int DecodeSocket ()
int DecodeFecID ()
string GetBin (unsigned int record)
string GetBin (unsigned short record)
string GetVmeBin ()
string GetGeoBin ()
string GetDataBin ()
void SetStripOrder (int stripOrder)
void SetLocation (int part, int segment, int layer)
void SetFirstStripID (int firstStripID)
void SetChainName (string chainName)
void SetData (unsigned short data)

Private Member Functions

void Initialize ()
void DecodeData ()
void DecodeVmeAddress ()
void SetFiredStripNumber ()
void SetFiredStripVect ()
void EncodePowerpcRecord ()

Private Attributes

int m_ID
int m_StripOrder
unsigned int m_VmeRecord
unsigned int m_PowerpcRecord
unsigned short m_VmeAddress
unsigned short m_GeoAddress
unsigned short m_Data
int m_Module
int m_Socket
int m_FecID
string m_ChainName
int m_Part
int m_Segment
int m_Layer
int m_FirstStripID
int m_FiredStripNumber
vector< int > m_FiredStripVect


Detailed Description

Definition at line 40 of file MucFec.h.


Constructor & Destructor Documentation

MucFec::MucFec ( int  id  ) 

Definition at line 18 of file MucFec.cxx.

References DEFAULT_STRIP_ORDER, Initialize(), m_ChainName, m_FirstStripID, m_ID, m_Layer, m_Part, m_Segment, m_StripOrder, m_VmeRecord, and STRIP_NUM.

00019 {
00020         //cout << "MucFec:: Create FEC : " << id << endl;
00021 
00022         if( (id < 0) || (id > STRIP_NUM-1) )
00023   {
00024                 cout << "Initialize failure, check id!" << endl;
00025                 m_ID = 0;
00026         }
00027         else    m_ID = id;
00028         
00029         m_Part          = 0;
00030   m_Segment       = 0;
00031   m_Layer         = 0;
00032   m_FirstStripID  = 0;
00033   m_StripOrder    = DEFAULT_STRIP_ORDER;
00034         m_ChainName     = "NoName";
00035   m_VmeRecord     = 0;
00036 
00037         MucFec::Initialize();
00038 }

MucFec::MucFec ( int  id,
int  stripOrder,
int  part,
int  segment,
int  layer,
int  firstStripID,
unsigned int  vmeRecord,
string  chainName 
)

Definition at line 40 of file MucFec.cxx.

References B_LAY_NUM, B_SEG_NUM, BRID, E_LAY_NUM, E_SEG_NUM, Initialize(), m_ChainName, m_FirstStripID, m_ID, m_Layer, m_Part, m_Segment, m_StripOrder, m_VmeRecord, PART_MAX, and STRIP_NUM.

00042 {
00043 //      cout << "MucFec:: Create FEC : " << endl;
00044 //      cout << "ID: " << id << "\tPart: " << part << "\tSegment: " << segment << "\tLayer: " << layer 
00045 //           << "\tfirstStripID: " << firstStripID << "\tvmeRecord: " << vmeRecord<<endl;
00046 
00047         // Check parameters     
00048         if( (id < 0) || (id > STRIP_NUM-1) ) 
00049         {
00050                 m_ID =  0; 
00051                 cout << "MucFec::Check id:\t" << id << "!" << endl;
00052         }else
00053         if( (stripOrder != 1) && (stripOrder != -1) )
00054         {
00055                 m_StripOrder = 0;
00056                 cout << "MucFec::Check stripOrder:\t" << stripOrder << "!" << endl;
00057         }else
00058         if( (part < 0) || ( part > PART_MAX-1) )
00059         {
00060                 m_Part =  0;
00061                 cout << "MucFec::Check part:\t" << part << "!" << endl;
00062         }else
00063         if( (segment < 0) || ( segment > ((part==BRID)?(B_SEG_NUM-1):(E_SEG_NUM-1)) ) )
00064         {
00065                 m_Segment =  0;
00066                 cout << "MucFec::Check segment:\t" << segment << "!" << endl;
00067         }else
00068         if( (layer <0) || ( layer > ((part==BRID)?(B_LAY_NUM-1):(E_LAY_NUM-1)) ) )
00069         {
00070                 m_Layer = 0;
00071                 cout << "MucFec::Check layer:\t" << layer << "!" << endl;
00072         }else
00073         if( sizeof(vmeRecord) < 4 )
00074         {
00075                 m_VmeRecord = 0;
00076                 cout << "MucFec::Check record:\t" << vmeRecord << "!" << endl;
00077         }else
00078         {
00079     m_ID            = id;
00080           m_StripOrder    = stripOrder;
00081                 m_Part                                  = part;
00082                 m_Segment                               = segment;
00083                 m_Layer                                 = layer;
00084                 m_FirstStripID  = firstStripID;
00085                 m_ChainName                     = chainName;
00086     m_VmeRecord     = vmeRecord;
00087         }
00088         
00089         MucFec::Initialize();   
00090 }

MucFec::~MucFec (  )  [inline]

Definition at line 45 of file MucFec.h.

00045 { ; }


Member Function Documentation

void MucFec::DecodeData (  )  [private]

Definition at line 102 of file MucFec.cxx.

References m_Data, and m_VmeRecord.

Referenced by Initialize().

00103 {
00104         m_Data = (unsigned short)m_VmeRecord;
00105 }       

int MucFec::DecodeFecID (  )  [inline]

Definition at line 65 of file MucFec.h.

References m_FecID.

00065 { return m_FecID;                 }     

int MucFec::DecodeModule (  )  [inline]

Definition at line 63 of file MucFec.h.

References m_Module.

00063 { return m_Module;              }

int MucFec::DecodeSocket (  )  [inline]

Definition at line 64 of file MucFec.h.

References m_Socket.

00064 { return m_Socket;              }

void MucFec::DecodeVmeAddress (  )  [private]

Definition at line 107 of file MucFec.cxx.

References LENGTH, m_FecID, m_Module, m_Socket, m_VmeAddress, m_VmeRecord, MODULE_BIT, and SOCKET_BIT.

Referenced by Initialize().

00108 {
00109   m_VmeAddress = (unsigned short)(m_VmeRecord >> LENGTH);       // high 16 bits, 10 bits used
00110         m_Module     = (m_VmeAddress >> MODULE_BIT) & 0xF;      // 4 bits
00111         m_Socket     = (m_VmeAddress >> SOCKET_BIT) & 0x3;      // 2 bits
00112         m_FecID      = m_VmeAddress & 0xF;                      // 4 bits       
00113 }

void MucFec::EncodePowerpcRecord (  )  [private]

Definition at line 149 of file MucFec.cxx.

References LAY_BIT, LENGTH, m_Data, m_FirstStripID, m_GeoAddress, m_Layer, m_Part, m_PowerpcRecord, m_Segment, PART_BIT, and SEG_BIT.

Referenced by Initialize(), SetData(), and SetFirstStripID().

00150 {       
00151         unsigned int address = ( (m_Part<<PART_BIT) | (m_Segment<<SEG_BIT) | (m_Layer<<LAY_BIT) | m_FirstStripID );
00152         m_GeoAddress = (unsigned short)address;
00153         m_PowerpcRecord = ( address << LENGTH ) | m_Data;
00154 }

string MucFec::GetBin ( unsigned short  record  ) 

Definition at line 212 of file MucFec.cxx.

References genRecEmupikp::i, deljobs::string, and subSeperate::temp.

00213 {
00214         const int SIZE = sizeof( unsigned short ) * 8;
00215 
00216   string Bin;
00217   unsigned short temp = 0;
00218   for(int i=0; i<SIZE; i++)
00219   {
00220         temp = record >> SIZE-i-1;
00221     Bin += ( temp & 1 ) ? "1" : "0";
00222   }
00223 
00224   return Bin;
00225 }

string MucFec::GetBin ( unsigned int  record  ) 

Definition at line 197 of file MucFec.cxx.

References genRecEmupikp::i, deljobs::string, and subSeperate::temp.

Referenced by GetDataBin(), GetGeoBin(), and GetVmeBin().

00198 {
00199         const int SIZE = sizeof( unsigned int ) * 8;
00200 
00201   string Bin;
00202   unsigned int temp = 0;
00203   for(int i=0; i<SIZE; i++)
00204   {
00205         temp = record >> SIZE-i-1;
00206     Bin += ( temp & 1 ) ? "1" : "0";
00207   }
00208 
00209   return Bin;
00210 }

string MucFec::GetChainName (  )  [inline]

Definition at line 59 of file MucFec.h.

References m_ChainName.

00059 { return m_ChainName;           }

unsigned short MucFec::GetData (  )  [inline]

Definition at line 52 of file MucFec.h.

References m_Data.

00052 { return m_Data;              }

string MucFec::GetDataBin (  ) 

Definition at line 237 of file MucFec.cxx.

References GetBin(), and m_Data.

00238 {
00239         return MucFec::GetBin( m_Data );
00240 }

int MucFec::GetFiredStripNumber (  ) 

Definition at line 191 of file MucFec.cxx.

References m_FiredStripNumber.

00191 { return m_FiredStripNumber;    }

vector< int > * MucFec::GetFiredStripVect (  ) 

Definition at line 195 of file MucFec.cxx.

References m_FiredStripVect.

00195 { return &m_FiredStripVect;     }

int MucFec::GetFirstStripID (  )  [inline]

Definition at line 58 of file MucFec.h.

References m_FirstStripID.

00058 { return m_FirstStripID;        }

unsigned short MucFec::GetGeoAddress (  )  [inline]

Definition at line 57 of file MucFec.h.

References m_GeoAddress.

00057 { return m_GeoAddress;  }

string MucFec::GetGeoBin (  ) 

Definition at line 232 of file MucFec.cxx.

References GetBin(), and m_GeoAddress.

00233 {
00234         return MucFec::GetBin( m_GeoAddress );
00235 }

int MucFec::GetID (  )  [inline]

Definition at line 48 of file MucFec.h.

References m_ID.

00048 { return m_ID;                }

int MucFec::GetLayer (  )  [inline]

Definition at line 56 of file MucFec.h.

References m_Layer.

00056 { return m_Layer;       }

int MucFec::GetPart (  )  [inline]

Definition at line 54 of file MucFec.h.

References m_Part.

00054 { return m_Part;                }

unsigned int MucFec::GetPowerpcRecord (  ) 

Definition at line 193 of file MucFec.cxx.

References m_PowerpcRecord.

00193 { return m_PowerpcRecord;       }

int MucFec::GetSegment (  )  [inline]

Definition at line 55 of file MucFec.h.

References m_Segment.

00055 { return m_Segment; }

int MucFec::GetStripOrder (  )  [inline]

Definition at line 49 of file MucFec.h.

References m_StripOrder.

00049 { return m_StripOrder;  }

unsigned short MucFec::GetVmeAddress (  )  [inline]

Definition at line 51 of file MucFec.h.

References m_VmeAddress.

00051 { return m_VmeAddress;  }

string MucFec::GetVmeBin (  ) 

Definition at line 227 of file MucFec.cxx.

References GetBin(), and m_VmeAddress.

00228 {
00229         return MucFec::GetBin( m_VmeAddress );
00230 }

unsigned int MucFec::GetVmeRecord (  )  [inline]

Definition at line 50 of file MucFec.h.

References m_VmeRecord.

00050 { return m_VmeRecord;   } 

void MucFec::Initialize (  )  [private]

Definition at line 92 of file MucFec.cxx.

References DecodeData(), DecodeVmeAddress(), EncodePowerpcRecord(), SetFiredStripNumber(), and SetFiredStripVect().

Referenced by MucFec(), and SetLocation().

void MucFec::SetChainName ( string  chainName  ) 

void MucFec::SetData ( unsigned short  data  ) 

Definition at line 179 of file MucFec.cxx.

References EncodePowerpcRecord(), m_Data, m_VmeRecord, SetFiredStripNumber(), and SetFiredStripVect().

void MucFec::SetFiredStripNumber (  )  [private]

Definition at line 115 of file MucFec.cxx.

References genRecEmupikp::i, m_Data, m_FiredStripNumber, and STRIP_NUM.

Referenced by Initialize(), and SetData().

00116 {
00117         m_FiredStripNumber = 0;
00118         for(int i=0; i<STRIP_NUM; i++)
00119         {
00120                 if( (m_Data>>i) & 1 ) 
00121                         m_FiredStripNumber++;
00122         }       
00123 }

void MucFec::SetFiredStripVect (  )  [private]

Definition at line 125 of file MucFec.cxx.

References genRecEmupikp::i, m_Data, m_FiredStripVect, m_FirstStripID, m_StripOrder, and STRIP_NUM.

Referenced by Initialize(), SetData(), SetFirstStripID(), and SetStripOrder().

00126 {
00127         m_FiredStripVect.clear();
00128         int tempID[STRIP_NUM];
00129         int tempFired=0;
00130 
00131   for(int i=0; i<STRIP_NUM; i++)
00132   {
00133         if( (m_Data>>i) & 1 )
00134     {
00135                 tempID[tempFired] = i;  
00136                         tempFired++;
00137                 }       
00138   }
00139         
00140         int stripID = 0;        
00141         for(int i=0; i<tempFired; i++)
00142         {
00143                 stripID = ((1 - m_StripOrder)/2) * (STRIP_NUM - 1) + (m_StripOrder * tempID[i]);
00144                 stripID += m_FirstStripID;
00145                 m_FiredStripVect.push_back( stripID );
00146         }       
00147 }

void MucFec::SetFirstStripID ( int  firstStripID  ) 

Definition at line 172 of file MucFec.cxx.

References EncodePowerpcRecord(), m_FirstStripID, and SetFiredStripVect().

00173 {
00174         m_FirstStripID = firstStripID;
00175         MucFec :: EncodePowerpcRecord();
00176         MucFec :: SetFiredStripVect();
00177 }

void MucFec::SetLocation ( int  part,
int  segment,
int  layer 
)

Definition at line 163 of file MucFec.cxx.

References Initialize(), m_Layer, m_Part, and m_Segment.

00164 {
00165         m_Part = part;
00166         m_Segment = segment;
00167         m_Layer = layer;
00168 
00169         MucFec::Initialize();
00170 }

void MucFec::SetStripOrder ( int  stripOrder  ) 

Definition at line 156 of file MucFec.cxx.

References m_StripOrder, and SetFiredStripVect().

00157 {
00158         m_StripOrder = stripOrder;
00159         
00160         MucFec::SetFiredStripVect();    
00161 }


Member Data Documentation

string MucFec::m_ChainName [private]

Definition at line 96 of file MucFec.h.

Referenced by GetChainName(), and MucFec().

unsigned short MucFec::m_Data [private]

Definition at line 91 of file MucFec.h.

Referenced by DecodeData(), EncodePowerpcRecord(), GetData(), GetDataBin(), SetData(), SetFiredStripNumber(), and SetFiredStripVect().

int MucFec::m_FecID [private]

Definition at line 95 of file MucFec.h.

Referenced by DecodeFecID(), and DecodeVmeAddress().

int MucFec::m_FiredStripNumber [private]

Definition at line 101 of file MucFec.h.

Referenced by GetFiredStripNumber(), and SetFiredStripNumber().

vector< int > MucFec::m_FiredStripVect [private]

Definition at line 102 of file MucFec.h.

Referenced by GetFiredStripVect(), and SetFiredStripVect().

int MucFec::m_FirstStripID [private]

Definition at line 100 of file MucFec.h.

Referenced by EncodePowerpcRecord(), GetFirstStripID(), MucFec(), SetFiredStripVect(), and SetFirstStripID().

unsigned short MucFec::m_GeoAddress [private]

Definition at line 90 of file MucFec.h.

Referenced by EncodePowerpcRecord(), GetGeoAddress(), and GetGeoBin().

int MucFec::m_ID [private]

Definition at line 80 of file MucFec.h.

Referenced by GetID(), and MucFec().

int MucFec::m_Layer [private]

Definition at line 99 of file MucFec.h.

Referenced by EncodePowerpcRecord(), GetLayer(), MucFec(), and SetLocation().

int MucFec::m_Module [private]

Definition at line 93 of file MucFec.h.

Referenced by DecodeModule(), and DecodeVmeAddress().

int MucFec::m_Part [private]

Definition at line 97 of file MucFec.h.

Referenced by EncodePowerpcRecord(), GetPart(), MucFec(), and SetLocation().

unsigned int MucFec::m_PowerpcRecord [private]

Definition at line 85 of file MucFec.h.

Referenced by EncodePowerpcRecord(), and GetPowerpcRecord().

int MucFec::m_Segment [private]

Definition at line 98 of file MucFec.h.

Referenced by EncodePowerpcRecord(), GetSegment(), MucFec(), and SetLocation().

int MucFec::m_Socket [private]

Definition at line 94 of file MucFec.h.

Referenced by DecodeSocket(), and DecodeVmeAddress().

int MucFec::m_StripOrder [private]

Definition at line 81 of file MucFec.h.

Referenced by GetStripOrder(), MucFec(), SetFiredStripVect(), and SetStripOrder().

unsigned short MucFec::m_VmeAddress [private]

Definition at line 89 of file MucFec.h.

Referenced by DecodeVmeAddress(), GetVmeAddress(), and GetVmeBin().

unsigned int MucFec::m_VmeRecord [private]

Definition at line 82 of file MucFec.h.

Referenced by DecodeData(), DecodeVmeAddress(), GetVmeRecord(), MucFec(), and SetData().


Generated on Tue Nov 29 23:20:27 2016 for BOSS_7.0.2 by  doxygen 1.4.7