/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DaqRpcPanel.cc
Go to the documentation of this file.
00001 /*
00002  *  DaqRpcPanel.cc
00003  *  DaqEvent
00004  *
00005  *  Created by Simon Patton on 9/2/2010.
00006  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00007  *
00008  */
00009 #include "Event/DaqRpcPanel.h"
00010 
00011 #include "FecReadoutFormat/FecData.h"
00012 #include "FecReadoutFormat/FecReadout.h"
00013 #include "FecReadoutFormat/FecTraits.h"
00014 
00015 using DayaBay::DaqRpcPanel;
00016 using DybDaq::FecData;
00017 using DybDaq::FecReadout;
00018 
00019 DaqRpcPanel::DaqRpcPanel(const DayaBay::FecChannelId& channelId,
00020                          FecReadout& fecReadout) :
00021     m_fecData(0),
00022     m_fecReadout(&fecReadout),
00023     m_daqRpcStripList(0),
00024     m_channelId(channelId),
00025     m_firedLayerNum(0),
00026     m_fromRot(false)
00027 {
00028 }
00029 
00030 DaqRpcPanel::DaqRpcPanel(const FecData& fecData,
00031                          const DayaBay::FecChannelId& channelId) :
00032     m_fecData(&fecData),
00033     m_fecReadout(0),
00034     m_daqRpcStripList(0),
00035     m_channelId(channelId),
00036     m_firedLayerNum(0),
00037     m_fromRot(false)
00038 {
00039 }
00040 
00041 DaqRpcPanel::~DaqRpcPanel() {
00042     if ( m_daqRpcStripList != 0 ) {
00043         RpcStripPtrList::iterator it = m_daqRpcStripList->begin();
00044         RpcStripPtrList::iterator finished = m_daqRpcStripList->end();
00045         while ( it != finished ) {
00046             delete *it;
00047             ++it;
00048         }
00049         delete m_daqRpcStripList;
00050     }
00051 }
00052 
00053 int DaqRpcPanel::location() const
00054 {
00055     if ( m_fecData->rpcFecId() == 14 ) {
00056         unsigned int cfId = m_fecData->rpcCFId();
00057         if ( (cfId&1) != 0 ) {
00058             return ( cfId == 1 ) ? 2 : 4;
00059         }
00060     }
00061     return 1;
00062 }
00063 
00064 const DaqRpcPanel::RpcStripPtrList& DaqRpcPanel::daqRpcStripList() const
00065 {
00066     if ( m_daqRpcStripList == 0 ) {
00067         RpcStripPtrList** dataPtrs = const_cast<RpcStripPtrList**>(&m_daqRpcStripList);
00068         (*dataPtrs) = new RpcStripPtrList();
00069         unsigned int hitMap = m_fecData->hitMap();
00070         for ( int iLayer = 0; iLayer < 4; ++iLayer ) {
00071             int shift = iLayer*8;
00072             if ( (hitMap & (0xFF<<shift)) == 0 ) continue;
00073             for ( int iStrip = 0; iStrip <8; ++iStrip ) {
00074                 int connector = shift + iStrip;
00075                 if ( (hitMap & (1<<connector)) != 0 ) {
00076                     (*dataPtrs)->push_back(new DaqRpcStrip(
00077                                 FecChannelId(rpcCFId(),rpcFecId(), connector, m_channelId.site(), m_channelId.detectorId()),
00078                                     this));
00079                 }
00080             }
00081             ++m_firedLayerNum;
00082         }
00083     }
00084     return *m_daqRpcStripList;
00085 }
00086 
00087 unsigned int DaqRpcPanel::hitMap() const
00088 {
00089     return m_fecData->hitMap();
00090 }
00091 
00092 unsigned int DaqRpcPanel::rpcCFId() const
00093 {
00094     return m_fecData->rpcCFId();
00095 }
00096 
00097 unsigned int DaqRpcPanel::rpcFecId() const
00098 {
00099     return m_fecData->rpcFecId();
00100 }
00101 
00102 bool DaqRpcPanel::forceTrigger() const
00103 {
00104     return m_fecData->forceTrigger();
00105 }
00106 
00107 int DaqRpcPanel::row() const
00108 {
00109     unsigned int cfId  = m_fecData->rpcCFId();
00110     unsigned int fecId = m_fecData->rpcFecId();
00111     //FIXME: different for far site here
00112     if ( fecId != 14 || (cfId&1) == 0 ) {  //array
00113         int row = (cfId/2)*3 + fecId/(5-cfId%2);
00114         return (6 - row);
00115     }
00116     //telescope
00117     return (cfId == 1) ? 7 : 0;
00118 }
00119 
00120 int DaqRpcPanel::col() const
00121 {
00122     unsigned int cfId  = m_fecData->rpcCFId();
00123     unsigned int fecId = m_fecData->rpcFecId();
00124     //FIXME: different for far site here
00125     if ( fecId != 14 || (cfId&1) == 0 ) {  //array
00126         int col = 5*(cfId%2) + fecId%(5-cfId%2);
00127         return (col+1);
00128     }
00129     //telescope
00130     return 5;
00131 }
00132 
00133 int DaqRpcPanel::firedLayerNum() const 
00134 {
00135     daqRpcStripList();
00136     return m_firedLayerNum;
00137 }
00138 
00139 void DaqRpcPanel::addFecData(const unsigned int trigType,
00140                              const unsigned int second,
00141                              const unsigned int nanoSecond,
00142                              const unsigned int hitMap)
00143 {
00144     unsigned int board = m_channelId.board();
00145     unsigned int rpcCFId = (0x70&board) >> 4;
00146     unsigned int rpcFecId = (board & 0x0f);
00147     const FecData& fecData = m_fecReadout->addFecData(rpcCFId, rpcFecId, trigType, second, nanoSecond, hitMap);
00148     m_fecData = &fecData;
00149 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:01:06 for DaqEvent by doxygen 1.7.4