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

In This Package:

ReadoutRpcTriggerDataFrame.cc
Go to the documentation of this file.
00001 #include "Event/ReadoutRpcTriggerDataFrame.h"
00002 #include <ostream>
00003 
00004 //std::ostream& DayaBay::ReadoutRpcTriggerDataFrame::fillStream(std::ostream& s) const
00005 //{
00006     //return s;
00007 //}
00008 
00009 DayaBay::DaqRtm* DayaBay::ReadoutRpcTriggerDataFrame::daqRtm(const DayaBay::Detector& detector) const
00010 {
00011     /*
00012      * CFID in RTM = (CFID in ROM) / 2
00013      * ROTID in RTM's CF = (CFID in ROM) % 2
00014      */
00015 
00016     DaqRtm* result = new DaqRtm(detector);
00017 
00018     TimeStamp tt = triggerTime();
00019     unsigned int inTrig[2] = {0,0};
00020     unsigned int outTrig[2] = {0,0};
00021 
00022 
00023     std::map< DayaBay::FecChannelId,
00024         DayaBay::Trigger::TriggerType_t >::const_iterator trigIt, trigDone;
00025 
00026     FecChannelId id;
00027     unsigned int CFId;
00028     unsigned int fecId;
00029     unsigned int RotId;
00030 
00031     trigDone = m_inTriggers.end();
00032     for (trigIt = m_inTriggers.begin(); trigIt != trigDone; trigIt++) {
00033         id = trigIt->first;
00034         CFId = id.rtmCfId();
00035         fecId = id.fecId();
00036         RotId = id.rtmRotId();
00037         // FIXME: check if the ids are in range
00039         unsigned int bit = 1 << fecId; // set the bit for corresponding FEC
00040         bit <<= RotId*16; // move the bit to the correct ROT
00041         inTrig[CFId] |= bit; // store the bit to the corresponding RTM CF
00042         if (trigIt->second == Trigger::kRPC3of4)
00043             inTrig[CFId] |= (0x8000 << RotId*16); // set the 3of4 flag bit
00044     }
00045 
00046     trigDone = m_outTriggers.end();
00047     for (trigIt = m_outTriggers.begin(); trigIt != trigDone; trigIt++) {
00048         id = trigIt->first;
00049         CFId = id.rtmCfId();
00050         fecId = id.fecId();
00051         RotId = id.rtmRotId();
00052         // FIXME: check if the ids are in range
00053         unsigned int bit = 1 << fecId; // set the bit for corresponding FEC
00054         bit <<= RotId*16; // move the bit to the correct ROT
00055         outTrig[CFId] |= bit; // store the bit to the corresponding RTM CF
00056         if (trigIt->second == Trigger::kRPC3of4)
00057             outTrig[CFId] |= (0x8000 << RotId*16); // set the 3of4 flag bit
00058     }
00059 
00060     DaqRtmData* first = new DaqRtmData (0, // RPC CF ID - in RTM
00061                                         true, // valid GPS
00062                                         true, // valid Clk
00063                                         false, // using UTC - UTC times in DaqRtm are not implemented yet (2/3/12).
00064                                         tt.GetSec(), // Trigger time - s
00065                                         tt.GetNanoSec()*2, // Trigger time - 0.5 * ns
00066                                         0, // accumulation
00067                                         inTrig[0], // triggers from ROT
00068                                         outTrig[0], // trigger map
00069                                         detector); // detector specifier
00070     DaqRtmData* second = new DaqRtmData (1,
00071                                         true,
00072                                         true,
00073                                         false,
00074                                         tt.GetSec(),
00075                                         tt.GetNanoSec() * 2,
00076                                         0,
00077                                         inTrig[1],
00078                                         outTrig[1],
00079                                         detector);
00080     result->addRtmData(first);
00081     result->addRtmData(second);
00082 
00083     result->setTriggerType( Trigger::TriggerType_t(first->triggerType()|second->triggerType()) );
00084     result->setEvtType(first->location()|second->location());
00085 
00086     return result;
00087 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

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